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,500
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsAsync.java
|
XMLStreamEventsAsync.nextStartElement
|
public ISynchronizationPoint<Exception> nextStartElement() {
ISynchronizationPoint<Exception> next = next();
if (next.isUnblocked()) {
if (next.hasError()) return next;
if (Type.START_ELEMENT.equals(event.type)) return next;
return nextStartElement();
}
SynchronizationPoint<Exception> sp = new SynchronizationPoint<>();
next.listenInline(
() -> {
if (Type.START_ELEMENT.equals(event.type)) {
sp.unblock();
return;
}
new Next(sp) {
@Override
protected void onNext() {
if (Type.START_ELEMENT.equals(event.type)) sp.unblock();
else nextStartElement().listenInline(sp);
}
}.start();
},
sp
);
return sp;
}
|
java
|
public ISynchronizationPoint<Exception> nextStartElement() {
ISynchronizationPoint<Exception> next = next();
if (next.isUnblocked()) {
if (next.hasError()) return next;
if (Type.START_ELEMENT.equals(event.type)) return next;
return nextStartElement();
}
SynchronizationPoint<Exception> sp = new SynchronizationPoint<>();
next.listenInline(
() -> {
if (Type.START_ELEMENT.equals(event.type)) {
sp.unblock();
return;
}
new Next(sp) {
@Override
protected void onNext() {
if (Type.START_ELEMENT.equals(event.type)) sp.unblock();
else nextStartElement().listenInline(sp);
}
}.start();
},
sp
);
return sp;
}
|
[
"public",
"ISynchronizationPoint",
"<",
"Exception",
">",
"nextStartElement",
"(",
")",
"{",
"ISynchronizationPoint",
"<",
"Exception",
">",
"next",
"=",
"next",
"(",
")",
";",
"if",
"(",
"next",
".",
"isUnblocked",
"(",
")",
")",
"{",
"if",
"(",
"next",
".",
"hasError",
"(",
")",
")",
"return",
"next",
";",
"if",
"(",
"Type",
".",
"START_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
")",
"return",
"next",
";",
"return",
"nextStartElement",
"(",
")",
";",
"}",
"SynchronizationPoint",
"<",
"Exception",
">",
"sp",
"=",
"new",
"SynchronizationPoint",
"<>",
"(",
")",
";",
"next",
".",
"listenInline",
"(",
"(",
")",
"->",
"{",
"if",
"(",
"Type",
".",
"START_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
")",
"{",
"sp",
".",
"unblock",
"(",
")",
";",
"return",
";",
"}",
"new",
"Next",
"(",
"sp",
")",
"{",
"@",
"Override",
"protected",
"void",
"onNext",
"(",
")",
"{",
"if",
"(",
"Type",
".",
"START_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
")",
"sp",
".",
"unblock",
"(",
")",
";",
"else",
"nextStartElement",
"(",
")",
".",
"listenInline",
"(",
"sp",
")",
";",
"}",
"}",
".",
"start",
"(",
")",
";",
"}",
",",
"sp",
")",
";",
"return",
"sp",
";",
"}"
] |
Shortcut to move forward to the next START_ELEMENT.
|
[
"Shortcut",
"to",
"move",
"forward",
"to",
"the",
"next",
"START_ELEMENT",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsAsync.java#L31-L56
|
150,501
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsAsync.java
|
XMLStreamEventsAsync.nextInnerElement
|
public AsyncWork<Boolean, Exception> nextInnerElement(ElementContext parent) {
if (event.context.isEmpty())
return new AsyncWork<>(Boolean.FALSE, null);
if (Type.START_ELEMENT.equals(event.type) && event.context.getFirst() == parent && event.isClosed)
return new AsyncWork<>(Boolean.FALSE, null);
if (Type.END_ELEMENT.equals(event.type) && event.context.getFirst() == parent)
return new AsyncWork<>(Boolean.FALSE, null);
boolean parentPresent = false;
for (ElementContext ctx : event.context)
if (ctx == parent) {
parentPresent = true;
break;
}
if (!parentPresent)
return new AsyncWork<>(null, new Exception("Invalid context: parent element "
+ parent.localName + " is not in the current context"));
ISynchronizationPoint<Exception> next = next();
do {
if (next.isUnblocked()) {
if (next.hasError()) return new AsyncWork<>(null, next.getError());
if (Type.END_ELEMENT.equals(event.type)) {
if (event.context.getFirst() == parent)
return new AsyncWork<>(Boolean.FALSE, null);
} else if (Type.START_ELEMENT.equals(event.type)) {
if (event.context.size() > 1 && event.context.get(1) == parent)
return new AsyncWork<>(Boolean.TRUE, null);
}
next = next();
continue;
}
break;
} while (true);
AsyncWork<Boolean, Exception> result = new AsyncWork<>();
ISynchronizationPoint<Exception> n = next;
next.listenInline(
() -> {
if (n.hasError()) result.error(n.getError());
else if (Type.END_ELEMENT.equals(event.type) && event.context.getFirst() == parent)
result.unblockSuccess(Boolean.FALSE);
else if (Type.START_ELEMENT.equals(event.type) && event.context.size() > 1 && event.context.get(1) == parent)
result.unblockSuccess(Boolean.TRUE);
else new ParsingTask(() -> {
nextInnerElement(parent).listenInline(result);
}).start();
}, result
);
return result;
}
|
java
|
public AsyncWork<Boolean, Exception> nextInnerElement(ElementContext parent) {
if (event.context.isEmpty())
return new AsyncWork<>(Boolean.FALSE, null);
if (Type.START_ELEMENT.equals(event.type) && event.context.getFirst() == parent && event.isClosed)
return new AsyncWork<>(Boolean.FALSE, null);
if (Type.END_ELEMENT.equals(event.type) && event.context.getFirst() == parent)
return new AsyncWork<>(Boolean.FALSE, null);
boolean parentPresent = false;
for (ElementContext ctx : event.context)
if (ctx == parent) {
parentPresent = true;
break;
}
if (!parentPresent)
return new AsyncWork<>(null, new Exception("Invalid context: parent element "
+ parent.localName + " is not in the current context"));
ISynchronizationPoint<Exception> next = next();
do {
if (next.isUnblocked()) {
if (next.hasError()) return new AsyncWork<>(null, next.getError());
if (Type.END_ELEMENT.equals(event.type)) {
if (event.context.getFirst() == parent)
return new AsyncWork<>(Boolean.FALSE, null);
} else if (Type.START_ELEMENT.equals(event.type)) {
if (event.context.size() > 1 && event.context.get(1) == parent)
return new AsyncWork<>(Boolean.TRUE, null);
}
next = next();
continue;
}
break;
} while (true);
AsyncWork<Boolean, Exception> result = new AsyncWork<>();
ISynchronizationPoint<Exception> n = next;
next.listenInline(
() -> {
if (n.hasError()) result.error(n.getError());
else if (Type.END_ELEMENT.equals(event.type) && event.context.getFirst() == parent)
result.unblockSuccess(Boolean.FALSE);
else if (Type.START_ELEMENT.equals(event.type) && event.context.size() > 1 && event.context.get(1) == parent)
result.unblockSuccess(Boolean.TRUE);
else new ParsingTask(() -> {
nextInnerElement(parent).listenInline(result);
}).start();
}, result
);
return result;
}
|
[
"public",
"AsyncWork",
"<",
"Boolean",
",",
"Exception",
">",
"nextInnerElement",
"(",
"ElementContext",
"parent",
")",
"{",
"if",
"(",
"event",
".",
"context",
".",
"isEmpty",
"(",
")",
")",
"return",
"new",
"AsyncWork",
"<>",
"(",
"Boolean",
".",
"FALSE",
",",
"null",
")",
";",
"if",
"(",
"Type",
".",
"START_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
"&&",
"event",
".",
"context",
".",
"getFirst",
"(",
")",
"==",
"parent",
"&&",
"event",
".",
"isClosed",
")",
"return",
"new",
"AsyncWork",
"<>",
"(",
"Boolean",
".",
"FALSE",
",",
"null",
")",
";",
"if",
"(",
"Type",
".",
"END_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
"&&",
"event",
".",
"context",
".",
"getFirst",
"(",
")",
"==",
"parent",
")",
"return",
"new",
"AsyncWork",
"<>",
"(",
"Boolean",
".",
"FALSE",
",",
"null",
")",
";",
"boolean",
"parentPresent",
"=",
"false",
";",
"for",
"(",
"ElementContext",
"ctx",
":",
"event",
".",
"context",
")",
"if",
"(",
"ctx",
"==",
"parent",
")",
"{",
"parentPresent",
"=",
"true",
";",
"break",
";",
"}",
"if",
"(",
"!",
"parentPresent",
")",
"return",
"new",
"AsyncWork",
"<>",
"(",
"null",
",",
"new",
"Exception",
"(",
"\"Invalid context: parent element \"",
"+",
"parent",
".",
"localName",
"+",
"\" is not in the current context\"",
")",
")",
";",
"ISynchronizationPoint",
"<",
"Exception",
">",
"next",
"=",
"next",
"(",
")",
";",
"do",
"{",
"if",
"(",
"next",
".",
"isUnblocked",
"(",
")",
")",
"{",
"if",
"(",
"next",
".",
"hasError",
"(",
")",
")",
"return",
"new",
"AsyncWork",
"<>",
"(",
"null",
",",
"next",
".",
"getError",
"(",
")",
")",
";",
"if",
"(",
"Type",
".",
"END_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
")",
"{",
"if",
"(",
"event",
".",
"context",
".",
"getFirst",
"(",
")",
"==",
"parent",
")",
"return",
"new",
"AsyncWork",
"<>",
"(",
"Boolean",
".",
"FALSE",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"Type",
".",
"START_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
")",
"{",
"if",
"(",
"event",
".",
"context",
".",
"size",
"(",
")",
">",
"1",
"&&",
"event",
".",
"context",
".",
"get",
"(",
"1",
")",
"==",
"parent",
")",
"return",
"new",
"AsyncWork",
"<>",
"(",
"Boolean",
".",
"TRUE",
",",
"null",
")",
";",
"}",
"next",
"=",
"next",
"(",
")",
";",
"continue",
";",
"}",
"break",
";",
"}",
"while",
"(",
"true",
")",
";",
"AsyncWork",
"<",
"Boolean",
",",
"Exception",
">",
"result",
"=",
"new",
"AsyncWork",
"<>",
"(",
")",
";",
"ISynchronizationPoint",
"<",
"Exception",
">",
"n",
"=",
"next",
";",
"next",
".",
"listenInline",
"(",
"(",
")",
"->",
"{",
"if",
"(",
"n",
".",
"hasError",
"(",
")",
")",
"result",
".",
"error",
"(",
"n",
".",
"getError",
"(",
")",
")",
";",
"else",
"if",
"(",
"Type",
".",
"END_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
"&&",
"event",
".",
"context",
".",
"getFirst",
"(",
")",
"==",
"parent",
")",
"result",
".",
"unblockSuccess",
"(",
"Boolean",
".",
"FALSE",
")",
";",
"else",
"if",
"(",
"Type",
".",
"START_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
"&&",
"event",
".",
"context",
".",
"size",
"(",
")",
">",
"1",
"&&",
"event",
".",
"context",
".",
"get",
"(",
"1",
")",
"==",
"parent",
")",
"result",
".",
"unblockSuccess",
"(",
"Boolean",
".",
"TRUE",
")",
";",
"else",
"new",
"ParsingTask",
"(",
"(",
")",
"->",
"{",
"nextInnerElement",
"(",
"parent",
")",
".",
"listenInline",
"(",
"result",
")",
";",
"}",
")",
".",
"start",
"(",
")",
";",
"}",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Go to the next inner element. The result is false if the parent element has been closed.
|
[
"Go",
"to",
"the",
"next",
"inner",
"element",
".",
"The",
"result",
"is",
"false",
"if",
"the",
"parent",
"element",
"has",
"been",
"closed",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsAsync.java#L59-L106
|
150,502
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsAsync.java
|
XMLStreamEventsAsync.nextInnerElement
|
public AsyncWork<Boolean, Exception> nextInnerElement(ElementContext parent, String childName) {
AsyncWork<Boolean, Exception> next = nextInnerElement(parent);
do {
if (next.isUnblocked()) {
if (next.hasError()) return next;
if (!next.getResult().booleanValue()) return next;
if (event.text.equals(childName)) return next;
next = nextInnerElement(parent);
continue;
}
break;
} while (true);
AsyncWork<Boolean, Exception> result = new AsyncWork<>();
AsyncWork<Boolean, Exception> n = next;
next.listenInline(
() -> {
if (n.hasError()) result.error(n.getError());
else if (!n.getResult().booleanValue()) result.unblockSuccess(Boolean.FALSE);
else if (event.text.equals(childName)) result.unblockSuccess(Boolean.TRUE);
else new ParsingTask(() -> {
nextInnerElement(parent, childName).listenInline(result);
}).start();
}, result
);
return result;
}
|
java
|
public AsyncWork<Boolean, Exception> nextInnerElement(ElementContext parent, String childName) {
AsyncWork<Boolean, Exception> next = nextInnerElement(parent);
do {
if (next.isUnblocked()) {
if (next.hasError()) return next;
if (!next.getResult().booleanValue()) return next;
if (event.text.equals(childName)) return next;
next = nextInnerElement(parent);
continue;
}
break;
} while (true);
AsyncWork<Boolean, Exception> result = new AsyncWork<>();
AsyncWork<Boolean, Exception> n = next;
next.listenInline(
() -> {
if (n.hasError()) result.error(n.getError());
else if (!n.getResult().booleanValue()) result.unblockSuccess(Boolean.FALSE);
else if (event.text.equals(childName)) result.unblockSuccess(Boolean.TRUE);
else new ParsingTask(() -> {
nextInnerElement(parent, childName).listenInline(result);
}).start();
}, result
);
return result;
}
|
[
"public",
"AsyncWork",
"<",
"Boolean",
",",
"Exception",
">",
"nextInnerElement",
"(",
"ElementContext",
"parent",
",",
"String",
"childName",
")",
"{",
"AsyncWork",
"<",
"Boolean",
",",
"Exception",
">",
"next",
"=",
"nextInnerElement",
"(",
"parent",
")",
";",
"do",
"{",
"if",
"(",
"next",
".",
"isUnblocked",
"(",
")",
")",
"{",
"if",
"(",
"next",
".",
"hasError",
"(",
")",
")",
"return",
"next",
";",
"if",
"(",
"!",
"next",
".",
"getResult",
"(",
")",
".",
"booleanValue",
"(",
")",
")",
"return",
"next",
";",
"if",
"(",
"event",
".",
"text",
".",
"equals",
"(",
"childName",
")",
")",
"return",
"next",
";",
"next",
"=",
"nextInnerElement",
"(",
"parent",
")",
";",
"continue",
";",
"}",
"break",
";",
"}",
"while",
"(",
"true",
")",
";",
"AsyncWork",
"<",
"Boolean",
",",
"Exception",
">",
"result",
"=",
"new",
"AsyncWork",
"<>",
"(",
")",
";",
"AsyncWork",
"<",
"Boolean",
",",
"Exception",
">",
"n",
"=",
"next",
";",
"next",
".",
"listenInline",
"(",
"(",
")",
"->",
"{",
"if",
"(",
"n",
".",
"hasError",
"(",
")",
")",
"result",
".",
"error",
"(",
"n",
".",
"getError",
"(",
")",
")",
";",
"else",
"if",
"(",
"!",
"n",
".",
"getResult",
"(",
")",
".",
"booleanValue",
"(",
")",
")",
"result",
".",
"unblockSuccess",
"(",
"Boolean",
".",
"FALSE",
")",
";",
"else",
"if",
"(",
"event",
".",
"text",
".",
"equals",
"(",
"childName",
")",
")",
"result",
".",
"unblockSuccess",
"(",
"Boolean",
".",
"TRUE",
")",
";",
"else",
"new",
"ParsingTask",
"(",
"(",
")",
"->",
"{",
"nextInnerElement",
"(",
"parent",
",",
"childName",
")",
".",
"listenInline",
"(",
"result",
")",
";",
"}",
")",
".",
"start",
"(",
")",
";",
"}",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Go to the next inner element having the given name. The result is false if the parent element has been closed.
|
[
"Go",
"to",
"the",
"next",
"inner",
"element",
"having",
"the",
"given",
"name",
".",
"The",
"result",
"is",
"false",
"if",
"the",
"parent",
"element",
"has",
"been",
"closed",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsAsync.java#L109-L134
|
150,503
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsAsync.java
|
XMLStreamEventsAsync.closeElement
|
public ISynchronizationPoint<Exception> closeElement(ElementContext ctx) {
ISynchronizationPoint<Exception> next = next();
do {
if (!next.isUnblocked()) break;
if (next.hasError()) return next;
if (Type.END_ELEMENT.equals(event.type)) {
if (event.context.getFirst() == ctx)
return next;
}
next = next();
} while (true);
SynchronizationPoint<Exception> result = new SynchronizationPoint<>();
ISynchronizationPoint<Exception> n = next;
next.listenInline(() -> {
if (!check(n, result)) return;
if (Type.END_ELEMENT.equals(event.type)) {
if (event.context.getFirst() == ctx) {
result.unblock();
return;
}
}
new ParsingTask(() -> { closeElement(ctx).listenInline(result); }).start();
}, result);
return result;
}
|
java
|
public ISynchronizationPoint<Exception> closeElement(ElementContext ctx) {
ISynchronizationPoint<Exception> next = next();
do {
if (!next.isUnblocked()) break;
if (next.hasError()) return next;
if (Type.END_ELEMENT.equals(event.type)) {
if (event.context.getFirst() == ctx)
return next;
}
next = next();
} while (true);
SynchronizationPoint<Exception> result = new SynchronizationPoint<>();
ISynchronizationPoint<Exception> n = next;
next.listenInline(() -> {
if (!check(n, result)) return;
if (Type.END_ELEMENT.equals(event.type)) {
if (event.context.getFirst() == ctx) {
result.unblock();
return;
}
}
new ParsingTask(() -> { closeElement(ctx).listenInline(result); }).start();
}, result);
return result;
}
|
[
"public",
"ISynchronizationPoint",
"<",
"Exception",
">",
"closeElement",
"(",
"ElementContext",
"ctx",
")",
"{",
"ISynchronizationPoint",
"<",
"Exception",
">",
"next",
"=",
"next",
"(",
")",
";",
"do",
"{",
"if",
"(",
"!",
"next",
".",
"isUnblocked",
"(",
")",
")",
"break",
";",
"if",
"(",
"next",
".",
"hasError",
"(",
")",
")",
"return",
"next",
";",
"if",
"(",
"Type",
".",
"END_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
")",
"{",
"if",
"(",
"event",
".",
"context",
".",
"getFirst",
"(",
")",
"==",
"ctx",
")",
"return",
"next",
";",
"}",
"next",
"=",
"next",
"(",
")",
";",
"}",
"while",
"(",
"true",
")",
";",
"SynchronizationPoint",
"<",
"Exception",
">",
"result",
"=",
"new",
"SynchronizationPoint",
"<>",
"(",
")",
";",
"ISynchronizationPoint",
"<",
"Exception",
">",
"n",
"=",
"next",
";",
"next",
".",
"listenInline",
"(",
"(",
")",
"->",
"{",
"if",
"(",
"!",
"check",
"(",
"n",
",",
"result",
")",
")",
"return",
";",
"if",
"(",
"Type",
".",
"END_ELEMENT",
".",
"equals",
"(",
"event",
".",
"type",
")",
")",
"{",
"if",
"(",
"event",
".",
"context",
".",
"getFirst",
"(",
")",
"==",
"ctx",
")",
"{",
"result",
".",
"unblock",
"(",
")",
";",
"return",
";",
"}",
"}",
"new",
"ParsingTask",
"(",
"(",
")",
"->",
"{",
"closeElement",
"(",
"ctx",
")",
".",
"listenInline",
"(",
"result",
")",
";",
"}",
")",
".",
"start",
"(",
")",
";",
"}",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Move forward until the closing tag of the given element is found.
|
[
"Move",
"forward",
"until",
"the",
"closing",
"tag",
"of",
"the",
"given",
"element",
"is",
"found",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLStreamEventsAsync.java#L228-L252
|
150,504
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/text/TextLineStream.java
|
TextLineStream.nextLine
|
public UnprotectedStringBuffer nextLine() throws IOException {
if (input.endReached()) return null;
UnprotectedStringBuffer line = new UnprotectedStringBuffer();
boolean prevCR = false;
do {
try {
char c = input.read();
if (c == '\n') break;
if (c == '\r' && !prevCR) {
prevCR = true;
continue;
}
if (prevCR) {
line.append('\r');
prevCR = false;
}
if (c == '\r') {
prevCR = true;
continue;
}
line.append(c);
} catch (EOFException e) {
break;
}
} while (true);
return line;
}
|
java
|
public UnprotectedStringBuffer nextLine() throws IOException {
if (input.endReached()) return null;
UnprotectedStringBuffer line = new UnprotectedStringBuffer();
boolean prevCR = false;
do {
try {
char c = input.read();
if (c == '\n') break;
if (c == '\r' && !prevCR) {
prevCR = true;
continue;
}
if (prevCR) {
line.append('\r');
prevCR = false;
}
if (c == '\r') {
prevCR = true;
continue;
}
line.append(c);
} catch (EOFException e) {
break;
}
} while (true);
return line;
}
|
[
"public",
"UnprotectedStringBuffer",
"nextLine",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"input",
".",
"endReached",
"(",
")",
")",
"return",
"null",
";",
"UnprotectedStringBuffer",
"line",
"=",
"new",
"UnprotectedStringBuffer",
"(",
")",
";",
"boolean",
"prevCR",
"=",
"false",
";",
"do",
"{",
"try",
"{",
"char",
"c",
"=",
"input",
".",
"read",
"(",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"break",
";",
"if",
"(",
"c",
"==",
"'",
"'",
"&&",
"!",
"prevCR",
")",
"{",
"prevCR",
"=",
"true",
";",
"continue",
";",
"}",
"if",
"(",
"prevCR",
")",
"{",
"line",
".",
"append",
"(",
"'",
"'",
")",
";",
"prevCR",
"=",
"false",
";",
"}",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"prevCR",
"=",
"true",
";",
"continue",
";",
"}",
"line",
".",
"append",
"(",
"c",
")",
";",
"}",
"catch",
"(",
"EOFException",
"e",
")",
"{",
"break",
";",
"}",
"}",
"while",
"(",
"true",
")",
";",
"return",
"line",
";",
"}"
] |
Read a new line, return null if the end of the character stream is reached.
|
[
"Read",
"a",
"new",
"line",
"return",
"null",
"if",
"the",
"end",
"of",
"the",
"character",
"stream",
"is",
"reached",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/text/TextLineStream.java#L22-L48
|
150,505
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/ua/StandardUserAgentClient.java
|
StandardUserAgentClient.newInstance
|
public static StandardUserAgentClient newInstance(Settings settings)
{
UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY);
TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY);
return new StandardUserAgentClient(udpFactory.newUDPConnector(settings), tcpFactory.newTCPConnector(settings), settings);
}
|
java
|
public static StandardUserAgentClient newInstance(Settings settings)
{
UDPConnector.Factory udpFactory = Factories.newInstance(settings, UDP_CONNECTOR_FACTORY_KEY);
TCPConnector.Factory tcpFactory = Factories.newInstance(settings, TCP_CONNECTOR_FACTORY_KEY);
return new StandardUserAgentClient(udpFactory.newUDPConnector(settings), tcpFactory.newTCPConnector(settings), settings);
}
|
[
"public",
"static",
"StandardUserAgentClient",
"newInstance",
"(",
"Settings",
"settings",
")",
"{",
"UDPConnector",
".",
"Factory",
"udpFactory",
"=",
"Factories",
".",
"newInstance",
"(",
"settings",
",",
"UDP_CONNECTOR_FACTORY_KEY",
")",
";",
"TCPConnector",
".",
"Factory",
"tcpFactory",
"=",
"Factories",
".",
"newInstance",
"(",
"settings",
",",
"TCP_CONNECTOR_FACTORY_KEY",
")",
";",
"return",
"new",
"StandardUserAgentClient",
"(",
"udpFactory",
".",
"newUDPConnector",
"(",
"settings",
")",
",",
"tcpFactory",
".",
"newTCPConnector",
"(",
"settings",
")",
",",
"settings",
")",
";",
"}"
] |
Creates and configures a new StandardUserAgentClient instance.
@param settings the configuration settings
@return a new configured StandardUserAgentClient
@see Factory#newUserAgentClient(Settings)
|
[
"Creates",
"and",
"configures",
"a",
"new",
"StandardUserAgentClient",
"instance",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/ua/StandardUserAgentClient.java#L48-L53
|
150,506
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java
|
Message5WH_Builder.setWhere
|
public Message5WH_Builder setWhere(Object where, int line, int column){
this.whereLocation = where;
this.whereLine = line;
this.whereColumn = column;
return this;
}
|
java
|
public Message5WH_Builder setWhere(Object where, int line, int column){
this.whereLocation = where;
this.whereLine = line;
this.whereColumn = column;
return this;
}
|
[
"public",
"Message5WH_Builder",
"setWhere",
"(",
"Object",
"where",
",",
"int",
"line",
",",
"int",
"column",
")",
"{",
"this",
".",
"whereLocation",
"=",
"where",
";",
"this",
".",
"whereLine",
"=",
"line",
";",
"this",
".",
"whereColumn",
"=",
"column",
";",
"return",
"this",
";",
"}"
] |
Sets the Where? part of the message.
Nothing will be set if the first parameter is null.
@param where location for Where?
@param line line for Where?, ignored if <1;
@param column column for Where?, ignored if <1
@return self to allow chaining
|
[
"Sets",
"the",
"Where?",
"part",
"of",
"the",
"message",
".",
"Nothing",
"will",
"be",
"set",
"if",
"the",
"first",
"parameter",
"is",
"null",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java#L160-L165
|
150,507
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java
|
Message5WH_Builder.setWhere
|
public Message5WH_Builder setWhere(Object where, RecognitionException lineAndColumn){
if(where!=null && lineAndColumn!=null){
IsAntlrRuntimeObject iaro = IsAntlrRuntimeObject.create(lineAndColumn);
this.setWhere(where, iaro.getLine(), iaro.getColumn());
}
return this;
}
|
java
|
public Message5WH_Builder setWhere(Object where, RecognitionException lineAndColumn){
if(where!=null && lineAndColumn!=null){
IsAntlrRuntimeObject iaro = IsAntlrRuntimeObject.create(lineAndColumn);
this.setWhere(where, iaro.getLine(), iaro.getColumn());
}
return this;
}
|
[
"public",
"Message5WH_Builder",
"setWhere",
"(",
"Object",
"where",
",",
"RecognitionException",
"lineAndColumn",
")",
"{",
"if",
"(",
"where",
"!=",
"null",
"&&",
"lineAndColumn",
"!=",
"null",
")",
"{",
"IsAntlrRuntimeObject",
"iaro",
"=",
"IsAntlrRuntimeObject",
".",
"create",
"(",
"lineAndColumn",
")",
";",
"this",
".",
"setWhere",
"(",
"where",
",",
"iaro",
".",
"getLine",
"(",
")",
",",
"iaro",
".",
"getColumn",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Sets the Where? part of the message.
Line and column information are taken from the recognition exception, if they are larger than 0.
Nothing will be set if the two parameters are null.
@param where location for Where?
@param lineAndColumn source for the Where? part
@return self to allow chaining
|
[
"Sets",
"the",
"Where?",
"part",
"of",
"the",
"message",
".",
"Line",
"and",
"column",
"information",
"are",
"taken",
"from",
"the",
"recognition",
"exception",
"if",
"they",
"are",
"larger",
"than",
"0",
".",
"Nothing",
"will",
"be",
"set",
"if",
"the",
"two",
"parameters",
"are",
"null",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java#L175-L181
|
150,508
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java
|
Message5WH_Builder.build
|
public Message5WH build(){
return new Message5WH(this.who, this.what, this.whereLocation, this.whereLine, this.whereColumn, this.when, this.why, this.how, this.reporter, this.type);
}
|
java
|
public Message5WH build(){
return new Message5WH(this.who, this.what, this.whereLocation, this.whereLine, this.whereColumn, this.when, this.why, this.how, this.reporter, this.type);
}
|
[
"public",
"Message5WH",
"build",
"(",
")",
"{",
"return",
"new",
"Message5WH",
"(",
"this",
".",
"who",
",",
"this",
".",
"what",
",",
"this",
".",
"whereLocation",
",",
"this",
".",
"whereLine",
",",
"this",
".",
"whereColumn",
",",
"this",
".",
"when",
",",
"this",
".",
"why",
",",
"this",
".",
"how",
",",
"this",
".",
"reporter",
",",
"this",
".",
"type",
")",
";",
"}"
] |
Builds a message object with the set parameters.
@return new message object
|
[
"Builds",
"a",
"message",
"object",
"with",
"the",
"set",
"parameters",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java#L270-L272
|
150,509
|
rwl/CSparseJ
|
src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_utsolve.java
|
Dcs_utsolve.cs_utsolve
|
public static boolean cs_utsolve(Dcs U, double[] x) {
int p, j, n, Up[], Ui[];
double Ux[];
if (!Dcs_util.CS_CSC(U) || x == null)
return (false); /* check inputs */
n = U.n;
Up = U.p;
Ui = U.i;
Ux = U.x;
for (j = 0; j < n; j++) {
for (p = Up[j]; p < Up[j + 1] - 1; p++) {
x[j] -= Ux[p] * x[Ui[p]];
}
x[j] /= Ux[Up[j + 1] - 1];
}
return (true);
}
|
java
|
public static boolean cs_utsolve(Dcs U, double[] x) {
int p, j, n, Up[], Ui[];
double Ux[];
if (!Dcs_util.CS_CSC(U) || x == null)
return (false); /* check inputs */
n = U.n;
Up = U.p;
Ui = U.i;
Ux = U.x;
for (j = 0; j < n; j++) {
for (p = Up[j]; p < Up[j + 1] - 1; p++) {
x[j] -= Ux[p] * x[Ui[p]];
}
x[j] /= Ux[Up[j + 1] - 1];
}
return (true);
}
|
[
"public",
"static",
"boolean",
"cs_utsolve",
"(",
"Dcs",
"U",
",",
"double",
"[",
"]",
"x",
")",
"{",
"int",
"p",
",",
"j",
",",
"n",
",",
"Up",
"[",
"]",
",",
"Ui",
"[",
"]",
";",
"double",
"Ux",
"[",
"]",
";",
"if",
"(",
"!",
"Dcs_util",
".",
"CS_CSC",
"(",
"U",
")",
"||",
"x",
"==",
"null",
")",
"return",
"(",
"false",
")",
";",
"/* check inputs */",
"n",
"=",
"U",
".",
"n",
";",
"Up",
"=",
"U",
".",
"p",
";",
"Ui",
"=",
"U",
".",
"i",
";",
"Ux",
"=",
"U",
".",
"x",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"n",
";",
"j",
"++",
")",
"{",
"for",
"(",
"p",
"=",
"Up",
"[",
"j",
"]",
";",
"p",
"<",
"Up",
"[",
"j",
"+",
"1",
"]",
"-",
"1",
";",
"p",
"++",
")",
"{",
"x",
"[",
"j",
"]",
"-=",
"Ux",
"[",
"p",
"]",
"*",
"x",
"[",
"Ui",
"[",
"p",
"]",
"]",
";",
"}",
"x",
"[",
"j",
"]",
"/=",
"Ux",
"[",
"Up",
"[",
"j",
"+",
"1",
"]",
"-",
"1",
"]",
";",
"}",
"return",
"(",
"true",
")",
";",
"}"
] |
Solves a lower triangular system U'x=b, where x and b are dense vectors.
The diagonal of U must be the last entry of each column.
@param U
upper triangular matrix in column-compressed form
@param x
size n, right hand side on input, solution on output
@return true if successful, false on error
|
[
"Solves",
"a",
"lower",
"triangular",
"system",
"U",
"x",
"=",
"b",
"where",
"x",
"and",
"b",
"are",
"dense",
"vectors",
".",
"The",
"diagonal",
"of",
"U",
"must",
"be",
"the",
"last",
"entry",
"of",
"each",
"column",
"."
] |
6a6f66bccce1558156a961494358952603b0ac84
|
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_utsolve.java#L47-L63
|
150,510
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/FixedPredictor.java
|
FixedPredictor.computeResidual
|
public static void computeResidual(int[] data, int dataLen, int order, int[] residual) {
int idataLen = (int) dataLen;
switch (order) {
case 0 :
for (int i = 0; i < idataLen; i++) {
residual[i] = data[i];
}
break;
case 1 :
for (int i = 0; i < idataLen; i++) {
residual[i] = data[i] - data[i - 1];
}
break;
case 2 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 2*data[i-1] + data[i-2] */
residual[i] = data[i] - (data[i - 1] << 1) + data[i - 2];
}
break;
case 3 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3] */
residual[i] = data[i] - (((data[i - 1] - data[i - 2]) << 1) + (data[i - 1] - data[i - 2])) - data[i - 3];
}
break;
case 4 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4] */
residual[i] = data[i] - ((data[i - 1] + data[i - 3]) << 2) + ((data[i - 2] << 2) + (data[i - 2] << 1)) + data[i - 4];
}
break;
default :
}
}
|
java
|
public static void computeResidual(int[] data, int dataLen, int order, int[] residual) {
int idataLen = (int) dataLen;
switch (order) {
case 0 :
for (int i = 0; i < idataLen; i++) {
residual[i] = data[i];
}
break;
case 1 :
for (int i = 0; i < idataLen; i++) {
residual[i] = data[i] - data[i - 1];
}
break;
case 2 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 2*data[i-1] + data[i-2] */
residual[i] = data[i] - (data[i - 1] << 1) + data[i - 2];
}
break;
case 3 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3] */
residual[i] = data[i] - (((data[i - 1] - data[i - 2]) << 1) + (data[i - 1] - data[i - 2])) - data[i - 3];
}
break;
case 4 :
for (int i = 0; i < idataLen; i++) {
/* == data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4] */
residual[i] = data[i] - ((data[i - 1] + data[i - 3]) << 2) + ((data[i - 2] << 2) + (data[i - 2] << 1)) + data[i - 4];
}
break;
default :
}
}
|
[
"public",
"static",
"void",
"computeResidual",
"(",
"int",
"[",
"]",
"data",
",",
"int",
"dataLen",
",",
"int",
"order",
",",
"int",
"[",
"]",
"residual",
")",
"{",
"int",
"idataLen",
"=",
"(",
"int",
")",
"dataLen",
";",
"switch",
"(",
"order",
")",
"{",
"case",
"0",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idataLen",
";",
"i",
"++",
")",
"{",
"residual",
"[",
"i",
"]",
"=",
"data",
"[",
"i",
"]",
";",
"}",
"break",
";",
"case",
"1",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idataLen",
";",
"i",
"++",
")",
"{",
"residual",
"[",
"i",
"]",
"=",
"data",
"[",
"i",
"]",
"-",
"data",
"[",
"i",
"-",
"1",
"]",
";",
"}",
"break",
";",
"case",
"2",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idataLen",
";",
"i",
"++",
")",
"{",
"/* == data[i] - 2*data[i-1] + data[i-2] */",
"residual",
"[",
"i",
"]",
"=",
"data",
"[",
"i",
"]",
"-",
"(",
"data",
"[",
"i",
"-",
"1",
"]",
"<<",
"1",
")",
"+",
"data",
"[",
"i",
"-",
"2",
"]",
";",
"}",
"break",
";",
"case",
"3",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idataLen",
";",
"i",
"++",
")",
"{",
"/* == data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3] */",
"residual",
"[",
"i",
"]",
"=",
"data",
"[",
"i",
"]",
"-",
"(",
"(",
"(",
"data",
"[",
"i",
"-",
"1",
"]",
"-",
"data",
"[",
"i",
"-",
"2",
"]",
")",
"<<",
"1",
")",
"+",
"(",
"data",
"[",
"i",
"-",
"1",
"]",
"-",
"data",
"[",
"i",
"-",
"2",
"]",
")",
")",
"-",
"data",
"[",
"i",
"-",
"3",
"]",
";",
"}",
"break",
";",
"case",
"4",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idataLen",
";",
"i",
"++",
")",
"{",
"/* == data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4] */",
"residual",
"[",
"i",
"]",
"=",
"data",
"[",
"i",
"]",
"-",
"(",
"(",
"data",
"[",
"i",
"-",
"1",
"]",
"+",
"data",
"[",
"i",
"-",
"3",
"]",
")",
"<<",
"2",
")",
"+",
"(",
"(",
"data",
"[",
"i",
"-",
"2",
"]",
"<<",
"2",
")",
"+",
"(",
"data",
"[",
"i",
"-",
"2",
"]",
"<<",
"1",
")",
")",
"+",
"data",
"[",
"i",
"-",
"4",
"]",
";",
"}",
"break",
";",
"default",
":",
"}",
"}"
] |
Compute the residual from the compressed signal.
@param data
@param dataLen
@param order
@param residual
|
[
"Compute",
"the",
"residual",
"from",
"the",
"compressed",
"signal",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/FixedPredictor.java#L163-L197
|
150,511
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/FixedPredictor.java
|
FixedPredictor.restoreSignal
|
public static void restoreSignal(int[] residual, int dataLen, int order, int[] data, int startAt) {
int idataLen = (int) dataLen;
switch (order) {
case 0 :
for (int i = 0; i < idataLen; i++) {
data[i + startAt] = residual[i];
}
break;
case 1 :
for (int i = 0; i < idataLen; i++) {
data[i + startAt] = residual[i] + data[i + startAt - 1];
}
break;
case 2 :
for (int i = 0; i < idataLen; i++) {
/* == residual[i] + 2*data[i-1] - data[i-2] */
data[i + startAt] = residual[i] + (data[i + startAt - 1] << 1) - data[i + startAt - 2];
}
break;
case 3 :
for (int i = 0; i < idataLen; i++) {
/* residual[i] + 3*data[i-1] - 3*data[i-2]) + data[i-3] */
data[i + startAt] = residual[i] + (((data[i + startAt - 1] - data[i + startAt - 2]) << 1) + (data[i + startAt - 1] - data[i + startAt - 2])) + data[i + startAt - 3];
}
break;
case 4 :
for (int i = 0; i < idataLen; i++) {
/* == residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4] */
data[i + startAt] = residual[i] + ((data[i + startAt - 1] + data[i + startAt - 3]) << 2) - ((data[i + startAt - 2] << 2) + (data[i + startAt - 2] << 1)) - data[i + startAt - 4];
}
break;
default :
}
}
|
java
|
public static void restoreSignal(int[] residual, int dataLen, int order, int[] data, int startAt) {
int idataLen = (int) dataLen;
switch (order) {
case 0 :
for (int i = 0; i < idataLen; i++) {
data[i + startAt] = residual[i];
}
break;
case 1 :
for (int i = 0; i < idataLen; i++) {
data[i + startAt] = residual[i] + data[i + startAt - 1];
}
break;
case 2 :
for (int i = 0; i < idataLen; i++) {
/* == residual[i] + 2*data[i-1] - data[i-2] */
data[i + startAt] = residual[i] + (data[i + startAt - 1] << 1) - data[i + startAt - 2];
}
break;
case 3 :
for (int i = 0; i < idataLen; i++) {
/* residual[i] + 3*data[i-1] - 3*data[i-2]) + data[i-3] */
data[i + startAt] = residual[i] + (((data[i + startAt - 1] - data[i + startAt - 2]) << 1) + (data[i + startAt - 1] - data[i + startAt - 2])) + data[i + startAt - 3];
}
break;
case 4 :
for (int i = 0; i < idataLen; i++) {
/* == residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4] */
data[i + startAt] = residual[i] + ((data[i + startAt - 1] + data[i + startAt - 3]) << 2) - ((data[i + startAt - 2] << 2) + (data[i + startAt - 2] << 1)) - data[i + startAt - 4];
}
break;
default :
}
}
|
[
"public",
"static",
"void",
"restoreSignal",
"(",
"int",
"[",
"]",
"residual",
",",
"int",
"dataLen",
",",
"int",
"order",
",",
"int",
"[",
"]",
"data",
",",
"int",
"startAt",
")",
"{",
"int",
"idataLen",
"=",
"(",
"int",
")",
"dataLen",
";",
"switch",
"(",
"order",
")",
"{",
"case",
"0",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idataLen",
";",
"i",
"++",
")",
"{",
"data",
"[",
"i",
"+",
"startAt",
"]",
"=",
"residual",
"[",
"i",
"]",
";",
"}",
"break",
";",
"case",
"1",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idataLen",
";",
"i",
"++",
")",
"{",
"data",
"[",
"i",
"+",
"startAt",
"]",
"=",
"residual",
"[",
"i",
"]",
"+",
"data",
"[",
"i",
"+",
"startAt",
"-",
"1",
"]",
";",
"}",
"break",
";",
"case",
"2",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idataLen",
";",
"i",
"++",
")",
"{",
"/* == residual[i] + 2*data[i-1] - data[i-2] */",
"data",
"[",
"i",
"+",
"startAt",
"]",
"=",
"residual",
"[",
"i",
"]",
"+",
"(",
"data",
"[",
"i",
"+",
"startAt",
"-",
"1",
"]",
"<<",
"1",
")",
"-",
"data",
"[",
"i",
"+",
"startAt",
"-",
"2",
"]",
";",
"}",
"break",
";",
"case",
"3",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idataLen",
";",
"i",
"++",
")",
"{",
"/* residual[i] + 3*data[i-1] - 3*data[i-2]) + data[i-3] */",
"data",
"[",
"i",
"+",
"startAt",
"]",
"=",
"residual",
"[",
"i",
"]",
"+",
"(",
"(",
"(",
"data",
"[",
"i",
"+",
"startAt",
"-",
"1",
"]",
"-",
"data",
"[",
"i",
"+",
"startAt",
"-",
"2",
"]",
")",
"<<",
"1",
")",
"+",
"(",
"data",
"[",
"i",
"+",
"startAt",
"-",
"1",
"]",
"-",
"data",
"[",
"i",
"+",
"startAt",
"-",
"2",
"]",
")",
")",
"+",
"data",
"[",
"i",
"+",
"startAt",
"-",
"3",
"]",
";",
"}",
"break",
";",
"case",
"4",
":",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"idataLen",
";",
"i",
"++",
")",
"{",
"/* == residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4] */",
"data",
"[",
"i",
"+",
"startAt",
"]",
"=",
"residual",
"[",
"i",
"]",
"+",
"(",
"(",
"data",
"[",
"i",
"+",
"startAt",
"-",
"1",
"]",
"+",
"data",
"[",
"i",
"+",
"startAt",
"-",
"3",
"]",
")",
"<<",
"2",
")",
"-",
"(",
"(",
"data",
"[",
"i",
"+",
"startAt",
"-",
"2",
"]",
"<<",
"2",
")",
"+",
"(",
"data",
"[",
"i",
"+",
"startAt",
"-",
"2",
"]",
"<<",
"1",
")",
")",
"-",
"data",
"[",
"i",
"+",
"startAt",
"-",
"4",
"]",
";",
"}",
"break",
";",
"default",
":",
"}",
"}"
] |
Restore the signal from the fixed predictor.
@param residual The residual data
@param dataLen The length of residual data
@param order The preicate order
@param data The restored signal (output)
@param startAt The starting position in the data array
|
[
"Restore",
"the",
"signal",
"from",
"the",
"fixed",
"predictor",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/FixedPredictor.java#L207-L241
|
150,512
|
hawkular/hawkular-bus
|
hawkular-bus-samples/hawkular-bus-sample-virtual-topic-mdb/src/main/java/org/hawkular/bus/sample/mdb/VirtualTopicSendServlet.java
|
VirtualTopicSendServlet.createMyFilterHeader
|
private static Map<String, String> createMyFilterHeader(String value) {
Map<String, String> map = new HashMap<String, String>(1);
map.put("MyFilter", value);
return map;
}
|
java
|
private static Map<String, String> createMyFilterHeader(String value) {
Map<String, String> map = new HashMap<String, String>(1);
map.put("MyFilter", value);
return map;
}
|
[
"private",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"createMyFilterHeader",
"(",
"String",
"value",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
"1",
")",
";",
"map",
".",
"put",
"(",
"\"MyFilter\"",
",",
"value",
")",
";",
"return",
"map",
";",
"}"
] |
return the header that our sample MDBs' selectors will look at
|
[
"return",
"the",
"header",
"that",
"our",
"sample",
"MDBs",
"selectors",
"will",
"look",
"at"
] |
28d6b58bec81a50f8344d39f309b6971271ae627
|
https://github.com/hawkular/hawkular-bus/blob/28d6b58bec81a50f8344d39f309b6971271ae627/hawkular-bus-samples/hawkular-bus-sample-virtual-topic-mdb/src/main/java/org/hawkular/bus/sample/mdb/VirtualTopicSendServlet.java#L78-L82
|
150,513
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/encoding/Base64Decoder.java
|
Base64Decoder.decode
|
public ISynchronizationPoint<IOException> decode(ByteBuffer buffer) {
SynchronizationPoint<IOException> result = new SynchronizationPoint<>();
new Task.Cpu<Void, NoException>("Decoding base 64", output.getPriority()) {
@Override
public Void run() {
if (nbPrev > 0) {
while (nbPrev < 4 && buffer.hasRemaining())
previous[nbPrev++] = buffer.get();
if (nbPrev < 4) {
result.unblock();
return null;
}
byte[] out = new byte[3];
try { Base64.decode4BytesBase64(previous, out); }
catch (IOException e) {
result.error(e);
return null;
}
nbPrev = 0;
if (!buffer.hasRemaining()) {
write(out, result);
return null;
}
write(out, null);
}
byte[] out;
try { out = Base64.decode(buffer); }
catch (IOException e) {
result.error(e);
return null;
}
while (buffer.hasRemaining())
previous[nbPrev++] = buffer.get();
write(out, result);
return null;
}
}.start();
return result;
}
|
java
|
public ISynchronizationPoint<IOException> decode(ByteBuffer buffer) {
SynchronizationPoint<IOException> result = new SynchronizationPoint<>();
new Task.Cpu<Void, NoException>("Decoding base 64", output.getPriority()) {
@Override
public Void run() {
if (nbPrev > 0) {
while (nbPrev < 4 && buffer.hasRemaining())
previous[nbPrev++] = buffer.get();
if (nbPrev < 4) {
result.unblock();
return null;
}
byte[] out = new byte[3];
try { Base64.decode4BytesBase64(previous, out); }
catch (IOException e) {
result.error(e);
return null;
}
nbPrev = 0;
if (!buffer.hasRemaining()) {
write(out, result);
return null;
}
write(out, null);
}
byte[] out;
try { out = Base64.decode(buffer); }
catch (IOException e) {
result.error(e);
return null;
}
while (buffer.hasRemaining())
previous[nbPrev++] = buffer.get();
write(out, result);
return null;
}
}.start();
return result;
}
|
[
"public",
"ISynchronizationPoint",
"<",
"IOException",
">",
"decode",
"(",
"ByteBuffer",
"buffer",
")",
"{",
"SynchronizationPoint",
"<",
"IOException",
">",
"result",
"=",
"new",
"SynchronizationPoint",
"<>",
"(",
")",
";",
"new",
"Task",
".",
"Cpu",
"<",
"Void",
",",
"NoException",
">",
"(",
"\"Decoding base 64\"",
",",
"output",
".",
"getPriority",
"(",
")",
")",
"{",
"@",
"Override",
"public",
"Void",
"run",
"(",
")",
"{",
"if",
"(",
"nbPrev",
">",
"0",
")",
"{",
"while",
"(",
"nbPrev",
"<",
"4",
"&&",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"previous",
"[",
"nbPrev",
"++",
"]",
"=",
"buffer",
".",
"get",
"(",
")",
";",
"if",
"(",
"nbPrev",
"<",
"4",
")",
"{",
"result",
".",
"unblock",
"(",
")",
";",
"return",
"null",
";",
"}",
"byte",
"[",
"]",
"out",
"=",
"new",
"byte",
"[",
"3",
"]",
";",
"try",
"{",
"Base64",
".",
"decode4BytesBase64",
"(",
"previous",
",",
"out",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"result",
".",
"error",
"(",
"e",
")",
";",
"return",
"null",
";",
"}",
"nbPrev",
"=",
"0",
";",
"if",
"(",
"!",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"{",
"write",
"(",
"out",
",",
"result",
")",
";",
"return",
"null",
";",
"}",
"write",
"(",
"out",
",",
"null",
")",
";",
"}",
"byte",
"[",
"]",
"out",
";",
"try",
"{",
"out",
"=",
"Base64",
".",
"decode",
"(",
"buffer",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"result",
".",
"error",
"(",
"e",
")",
";",
"return",
"null",
";",
"}",
"while",
"(",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"previous",
"[",
"nbPrev",
"++",
"]",
"=",
"buffer",
".",
"get",
"(",
")",
";",
"write",
"(",
"out",
",",
"result",
")",
";",
"return",
"null",
";",
"}",
"}",
".",
"start",
"(",
")",
";",
"return",
"result",
";",
"}"
] |
Start a new Task to decode the given buffer.
|
[
"Start",
"a",
"new",
"Task",
"to",
"decode",
"the",
"given",
"buffer",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/encoding/Base64Decoder.java#L27-L65
|
150,514
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/encoding/Base64Decoder.java
|
Base64Decoder.flush
|
public ISynchronizationPoint<IOException> flush() {
if (nbPrev == 0)
return lastWrite;
while (nbPrev < 4)
previous[nbPrev++] = '=';
try { write(Base64.decode(previous), null); }
catch (IOException e) {
return new SynchronizationPoint<>(e);
}
return lastWrite;
}
|
java
|
public ISynchronizationPoint<IOException> flush() {
if (nbPrev == 0)
return lastWrite;
while (nbPrev < 4)
previous[nbPrev++] = '=';
try { write(Base64.decode(previous), null); }
catch (IOException e) {
return new SynchronizationPoint<>(e);
}
return lastWrite;
}
|
[
"public",
"ISynchronizationPoint",
"<",
"IOException",
">",
"flush",
"(",
")",
"{",
"if",
"(",
"nbPrev",
"==",
"0",
")",
"return",
"lastWrite",
";",
"while",
"(",
"nbPrev",
"<",
"4",
")",
"previous",
"[",
"nbPrev",
"++",
"]",
"=",
"'",
"'",
";",
"try",
"{",
"write",
"(",
"Base64",
".",
"decode",
"(",
"previous",
")",
",",
"null",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
"new",
"SynchronizationPoint",
"<>",
"(",
"e",
")",
";",
"}",
"return",
"lastWrite",
";",
"}"
] |
Decode any pending bytes, then return a synchronization point that will be unblocked once
the last writing operation is done.
|
[
"Decode",
"any",
"pending",
"bytes",
"then",
"return",
"a",
"synchronization",
"point",
"that",
"will",
"be",
"unblocked",
"once",
"the",
"last",
"writing",
"operation",
"is",
"done",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/encoding/Base64Decoder.java#L111-L121
|
150,515
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/BCrypt.java
|
BCrypt.checkpw
|
public static boolean checkpw(String plaintext, String hashed) {
return (hashed.compareTo(hashpw(plaintext, hashed)) == 0);
}
|
java
|
public static boolean checkpw(String plaintext, String hashed) {
return (hashed.compareTo(hashpw(plaintext, hashed)) == 0);
}
|
[
"public",
"static",
"boolean",
"checkpw",
"(",
"String",
"plaintext",
",",
"String",
"hashed",
")",
"{",
"return",
"(",
"hashed",
".",
"compareTo",
"(",
"hashpw",
"(",
"plaintext",
",",
"hashed",
")",
")",
"==",
"0",
")",
";",
"}"
] |
Check that a plaintext password matches a previously hashed
one
@param plaintext the plaintext password to verify
@param hashed the previously-hashed password
@return true if the passwords match, false otherwise
|
[
"Check",
"that",
"a",
"plaintext",
"password",
"matches",
"a",
"previously",
"hashed",
"one"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/BCrypt.java#L764-L766
|
150,516
|
caelum/timemachine
|
src/main/java/br/com/caelum/timemachine/TimeMachine.java
|
TimeMachine.toBlock
|
private Block<Void> toBlock(final Runnable code) {
return new Block<Void>() {
public Void run() {
code.run();
return null;
}
};
}
|
java
|
private Block<Void> toBlock(final Runnable code) {
return new Block<Void>() {
public Void run() {
code.run();
return null;
}
};
}
|
[
"private",
"Block",
"<",
"Void",
">",
"toBlock",
"(",
"final",
"Runnable",
"code",
")",
"{",
"return",
"new",
"Block",
"<",
"Void",
">",
"(",
")",
"{",
"public",
"Void",
"run",
"(",
")",
"{",
"code",
".",
"run",
"(",
")",
";",
"return",
"null",
";",
"}",
"}",
";",
"}"
] |
Transforms a Runnable into a Block, so that we need only one
implementation of the time-traveling code
@param code
The Runnable to be converted
@return A Block that, when called, executes the given Runnable
|
[
"Transforms",
"a",
"Runnable",
"into",
"a",
"Block",
"so",
"that",
"we",
"need",
"only",
"one",
"implementation",
"of",
"the",
"time",
"-",
"traveling",
"code"
] |
67327e67d93b7c64ac2cdcecf77c8919832cc8b9
|
https://github.com/caelum/timemachine/blob/67327e67d93b7c64ac2cdcecf77c8919832cc8b9/src/main/java/br/com/caelum/timemachine/TimeMachine.java#L121-L128
|
150,517
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
|
ID3v2Tag.parseFrames
|
private void parseFrames(RandomAccessInputStream raf) throws FileNotFoundException, IOException, ID3v2FormatException
{
int offset = head.getHeaderSize();
int framesLength = head.getTagSize();
if (head.getExtendedHeader())
{
framesLength -= ext_head.getSize();
offset += ext_head.getSize();
}
raf.seek(offset);
int bytesRead = 0;
boolean done = false;
while ((bytesRead < framesLength) && !done)
{
byte[] buf = new byte[4];
bytesRead += raf.read(buf);
if (buf[0] != 0)
{
String id = new String(buf);
bytesRead += raf.read(buf);
int curLength = Helpers.convertDWordToInt(buf, 0);
byte [] flags = new byte[2];
bytesRead += raf.read(flags);
byte [] data = new byte[curLength];
bytesRead += raf.read(data);
ID3v2Frame frame = new ID3v2Frame(id, flags, data);
frames.put(id, frame);
}
else
{
done = true;
padding = framesLength - bytesRead - buf.length;
}
}
}
|
java
|
private void parseFrames(RandomAccessInputStream raf) throws FileNotFoundException, IOException, ID3v2FormatException
{
int offset = head.getHeaderSize();
int framesLength = head.getTagSize();
if (head.getExtendedHeader())
{
framesLength -= ext_head.getSize();
offset += ext_head.getSize();
}
raf.seek(offset);
int bytesRead = 0;
boolean done = false;
while ((bytesRead < framesLength) && !done)
{
byte[] buf = new byte[4];
bytesRead += raf.read(buf);
if (buf[0] != 0)
{
String id = new String(buf);
bytesRead += raf.read(buf);
int curLength = Helpers.convertDWordToInt(buf, 0);
byte [] flags = new byte[2];
bytesRead += raf.read(flags);
byte [] data = new byte[curLength];
bytesRead += raf.read(data);
ID3v2Frame frame = new ID3v2Frame(id, flags, data);
frames.put(id, frame);
}
else
{
done = true;
padding = framesLength - bytesRead - buf.length;
}
}
}
|
[
"private",
"void",
"parseFrames",
"(",
"RandomAccessInputStream",
"raf",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
",",
"ID3v2FormatException",
"{",
"int",
"offset",
"=",
"head",
".",
"getHeaderSize",
"(",
")",
";",
"int",
"framesLength",
"=",
"head",
".",
"getTagSize",
"(",
")",
";",
"if",
"(",
"head",
".",
"getExtendedHeader",
"(",
")",
")",
"{",
"framesLength",
"-=",
"ext_head",
".",
"getSize",
"(",
")",
";",
"offset",
"+=",
"ext_head",
".",
"getSize",
"(",
")",
";",
"}",
"raf",
".",
"seek",
"(",
"offset",
")",
";",
"int",
"bytesRead",
"=",
"0",
";",
"boolean",
"done",
"=",
"false",
";",
"while",
"(",
"(",
"bytesRead",
"<",
"framesLength",
")",
"&&",
"!",
"done",
")",
"{",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"bytesRead",
"+=",
"raf",
".",
"read",
"(",
"buf",
")",
";",
"if",
"(",
"buf",
"[",
"0",
"]",
"!=",
"0",
")",
"{",
"String",
"id",
"=",
"new",
"String",
"(",
"buf",
")",
";",
"bytesRead",
"+=",
"raf",
".",
"read",
"(",
"buf",
")",
";",
"int",
"curLength",
"=",
"Helpers",
".",
"convertDWordToInt",
"(",
"buf",
",",
"0",
")",
";",
"byte",
"[",
"]",
"flags",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"bytesRead",
"+=",
"raf",
".",
"read",
"(",
"flags",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"curLength",
"]",
";",
"bytesRead",
"+=",
"raf",
".",
"read",
"(",
"data",
")",
";",
"ID3v2Frame",
"frame",
"=",
"new",
"ID3v2Frame",
"(",
"id",
",",
"flags",
",",
"data",
")",
";",
"frames",
".",
"put",
"(",
"id",
",",
"frame",
")",
";",
"}",
"else",
"{",
"done",
"=",
"true",
";",
"padding",
"=",
"framesLength",
"-",
"bytesRead",
"-",
"buf",
".",
"length",
";",
"}",
"}",
"}"
] |
Read the frames from the file and create ID3v2Frame objects from the
data found.
@param raf the open file to read from
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
@exception ID3v2FormatException if an error occurs
|
[
"Read",
"the",
"frames",
"from",
"the",
"file",
"and",
"create",
"ID3v2Frame",
"objects",
"from",
"the",
"data",
"found",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L103-L141
|
150,518
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
|
ID3v2Tag.writeTag
|
public void writeTag(RandomAccessFile raf) throws FileNotFoundException, IOException
{
int curSize = getSize();
origPadding = padding;
padding = getUpdatedPadding();
// This means that the file does not need to change size
if ((padding > origPadding) || ((padding == origPadding) && (curSize == origSize)))
{
byte[] out = getBytes();
raf.seek(0);
raf.write(out);
}
else
{
//TODO: This needs copying without full loading
int bufSize = (int)(raf.length() + curSize);
byte[] out = new byte[bufSize];
System.arraycopy(getBytes(), 0, out, 0, curSize);
int bufSize2 = (int)(raf.length() - origSize);
byte[] in = new byte[bufSize2];
raf.seek(origSize);
if (raf.read(in) != in.length)
{
throw new IOException("Error reading mp3 file before writing");
}
System.arraycopy(in, 0, out, curSize, in.length);
raf.setLength(bufSize2);
raf.seek(0);
raf.write(out);
}
origSize = curSize;
exists = true;
}
|
java
|
public void writeTag(RandomAccessFile raf) throws FileNotFoundException, IOException
{
int curSize = getSize();
origPadding = padding;
padding = getUpdatedPadding();
// This means that the file does not need to change size
if ((padding > origPadding) || ((padding == origPadding) && (curSize == origSize)))
{
byte[] out = getBytes();
raf.seek(0);
raf.write(out);
}
else
{
//TODO: This needs copying without full loading
int bufSize = (int)(raf.length() + curSize);
byte[] out = new byte[bufSize];
System.arraycopy(getBytes(), 0, out, 0, curSize);
int bufSize2 = (int)(raf.length() - origSize);
byte[] in = new byte[bufSize2];
raf.seek(origSize);
if (raf.read(in) != in.length)
{
throw new IOException("Error reading mp3 file before writing");
}
System.arraycopy(in, 0, out, curSize, in.length);
raf.setLength(bufSize2);
raf.seek(0);
raf.write(out);
}
origSize = curSize;
exists = true;
}
|
[
"public",
"void",
"writeTag",
"(",
"RandomAccessFile",
"raf",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"int",
"curSize",
"=",
"getSize",
"(",
")",
";",
"origPadding",
"=",
"padding",
";",
"padding",
"=",
"getUpdatedPadding",
"(",
")",
";",
"// This means that the file does not need to change size",
"if",
"(",
"(",
"padding",
">",
"origPadding",
")",
"||",
"(",
"(",
"padding",
"==",
"origPadding",
")",
"&&",
"(",
"curSize",
"==",
"origSize",
")",
")",
")",
"{",
"byte",
"[",
"]",
"out",
"=",
"getBytes",
"(",
")",
";",
"raf",
".",
"seek",
"(",
"0",
")",
";",
"raf",
".",
"write",
"(",
"out",
")",
";",
"}",
"else",
"{",
"//TODO: This needs copying without full loading",
"int",
"bufSize",
"=",
"(",
"int",
")",
"(",
"raf",
".",
"length",
"(",
")",
"+",
"curSize",
")",
";",
"byte",
"[",
"]",
"out",
"=",
"new",
"byte",
"[",
"bufSize",
"]",
";",
"System",
".",
"arraycopy",
"(",
"getBytes",
"(",
")",
",",
"0",
",",
"out",
",",
"0",
",",
"curSize",
")",
";",
"int",
"bufSize2",
"=",
"(",
"int",
")",
"(",
"raf",
".",
"length",
"(",
")",
"-",
"origSize",
")",
";",
"byte",
"[",
"]",
"in",
"=",
"new",
"byte",
"[",
"bufSize2",
"]",
";",
"raf",
".",
"seek",
"(",
"origSize",
")",
";",
"if",
"(",
"raf",
".",
"read",
"(",
"in",
")",
"!=",
"in",
".",
"length",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Error reading mp3 file before writing\"",
")",
";",
"}",
"System",
".",
"arraycopy",
"(",
"in",
",",
"0",
",",
"out",
",",
"curSize",
",",
"in",
".",
"length",
")",
";",
"raf",
".",
"setLength",
"(",
"bufSize2",
")",
";",
"raf",
".",
"seek",
"(",
"0",
")",
";",
"raf",
".",
"write",
"(",
"out",
")",
";",
"}",
"origSize",
"=",
"curSize",
";",
"exists",
"=",
"true",
";",
"}"
] |
Saves all the information in the tag to the file passed to the
constructor. If a tag doesn't exist, a tag is prepended to the file.
If the padding has not changed since the creation of this object and
the size is less than the original size + the original padding, then
the previous tag and part of the previous padding will be overwritten.
Otherwise, a new tag will be prepended to the file.
@return true if the tag was successfully written
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Saves",
"all",
"the",
"information",
"in",
"the",
"tag",
"to",
"the",
"file",
"passed",
"to",
"the",
"constructor",
".",
"If",
"a",
"tag",
"doesn",
"t",
"exist",
"a",
"tag",
"is",
"prepended",
"to",
"the",
"file",
".",
"If",
"the",
"padding",
"has",
"not",
"changed",
"since",
"the",
"creation",
"of",
"this",
"object",
"and",
"the",
"size",
"is",
"less",
"than",
"the",
"original",
"size",
"+",
"the",
"original",
"padding",
"then",
"the",
"previous",
"tag",
"and",
"part",
"of",
"the",
"previous",
"padding",
"will",
"be",
"overwritten",
".",
"Otherwise",
"a",
"new",
"tag",
"will",
"be",
"prepended",
"to",
"the",
"file",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L155-L194
|
150,519
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
|
ID3v2Tag.removeTag
|
public void removeTag(RandomAccessFile raf) throws FileNotFoundException, IOException
{
if (exists)
{
int bufSize = (int)(raf.length() - origSize);
byte[] buf = new byte[bufSize];
raf.seek(origSize);
if (raf.read(buf) != buf.length)
{
throw new IOException("Error encountered while removing " + "id3v2 tag.");
}
raf.setLength(bufSize);
raf.seek(0);
raf.write(buf);
exists = false;
}
}
|
java
|
public void removeTag(RandomAccessFile raf) throws FileNotFoundException, IOException
{
if (exists)
{
int bufSize = (int)(raf.length() - origSize);
byte[] buf = new byte[bufSize];
raf.seek(origSize);
if (raf.read(buf) != buf.length)
{
throw new IOException("Error encountered while removing " + "id3v2 tag.");
}
raf.setLength(bufSize);
raf.seek(0);
raf.write(buf);
exists = false;
}
}
|
[
"public",
"void",
"removeTag",
"(",
"RandomAccessFile",
"raf",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"if",
"(",
"exists",
")",
"{",
"int",
"bufSize",
"=",
"(",
"int",
")",
"(",
"raf",
".",
"length",
"(",
")",
"-",
"origSize",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"bufSize",
"]",
";",
"raf",
".",
"seek",
"(",
"origSize",
")",
";",
"if",
"(",
"raf",
".",
"read",
"(",
"buf",
")",
"!=",
"buf",
".",
"length",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Error encountered while removing \"",
"+",
"\"id3v2 tag.\"",
")",
";",
"}",
"raf",
".",
"setLength",
"(",
"bufSize",
")",
";",
"raf",
".",
"seek",
"(",
"0",
")",
";",
"raf",
".",
"write",
"(",
"buf",
")",
";",
"exists",
"=",
"false",
";",
"}",
"}"
] |
Remove an existing id3v2 tag from the file passed to the constructor.
@return true if the removal was a success
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Remove",
"an",
"existing",
"id3v2",
"tag",
"from",
"the",
"file",
"passed",
"to",
"the",
"constructor",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L203-L223
|
150,520
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
|
ID3v2Tag.getUpdatedPadding
|
private int getUpdatedPadding()
{
int curSize = getSize();
int pad = 0;
if ((origPadding == padding) && (curSize > origSize) && (padding >= (curSize - origSize)))
{
pad = padding - (curSize - origSize);
}
else if (curSize < origSize)
{
pad = (origSize - curSize) + padding;
}
return pad;
}
|
java
|
private int getUpdatedPadding()
{
int curSize = getSize();
int pad = 0;
if ((origPadding == padding) && (curSize > origSize) && (padding >= (curSize - origSize)))
{
pad = padding - (curSize - origSize);
}
else if (curSize < origSize)
{
pad = (origSize - curSize) + padding;
}
return pad;
}
|
[
"private",
"int",
"getUpdatedPadding",
"(",
")",
"{",
"int",
"curSize",
"=",
"getSize",
"(",
")",
";",
"int",
"pad",
"=",
"0",
";",
"if",
"(",
"(",
"origPadding",
"==",
"padding",
")",
"&&",
"(",
"curSize",
">",
"origSize",
")",
"&&",
"(",
"padding",
">=",
"(",
"curSize",
"-",
"origSize",
")",
")",
")",
"{",
"pad",
"=",
"padding",
"-",
"(",
"curSize",
"-",
"origSize",
")",
";",
"}",
"else",
"if",
"(",
"curSize",
"<",
"origSize",
")",
"{",
"pad",
"=",
"(",
"origSize",
"-",
"curSize",
")",
"+",
"padding",
";",
"}",
"return",
"pad",
";",
"}"
] |
Determines the new amount of padding to use. If the user has not
changed the amount of padding then existing padding will be overwritten
instead of increasing the size of the file. That is only if there is
a sufficient amount of padding for the updated tag.
@return the new amount of padding
|
[
"Determines",
"the",
"new",
"amount",
"of",
"padding",
"to",
"use",
".",
"If",
"the",
"user",
"has",
"not",
"changed",
"the",
"amount",
"of",
"padding",
"then",
"existing",
"padding",
"will",
"be",
"overwritten",
"instead",
"of",
"increasing",
"the",
"size",
"of",
"the",
"file",
".",
"That",
"is",
"only",
"if",
"there",
"is",
"a",
"sufficient",
"amount",
"of",
"padding",
"for",
"the",
"updated",
"tag",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L274-L289
|
150,521
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
|
ID3v2Tag.setTextFrame
|
public void setTextFrame(String id, String data)
{
if ((id.charAt(0) == 'T') && !id.equals(ID3v2Frames.USER_DEFINED_TEXT_INFO))
{
try
{
byte[] b = new byte[data.length() + 1];
b[0] = 0;
System.arraycopy(data.getBytes(ENC_TYPE), 0, b, 1, data.length());
updateFrameData(id, b);
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
}
}
|
java
|
public void setTextFrame(String id, String data)
{
if ((id.charAt(0) == 'T') && !id.equals(ID3v2Frames.USER_DEFINED_TEXT_INFO))
{
try
{
byte[] b = new byte[data.length() + 1];
b[0] = 0;
System.arraycopy(data.getBytes(ENC_TYPE), 0, b, 1, data.length());
updateFrameData(id, b);
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
}
}
|
[
"public",
"void",
"setTextFrame",
"(",
"String",
"id",
",",
"String",
"data",
")",
"{",
"if",
"(",
"(",
"id",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"&&",
"!",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"USER_DEFINED_TEXT_INFO",
")",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"data",
".",
"length",
"(",
")",
"+",
"1",
"]",
";",
"b",
"[",
"0",
"]",
"=",
"0",
";",
"System",
".",
"arraycopy",
"(",
"data",
".",
"getBytes",
"(",
"ENC_TYPE",
")",
",",
"0",
",",
"b",
",",
"1",
",",
"data",
".",
"length",
"(",
")",
")",
";",
"updateFrameData",
"(",
"id",
",",
"b",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}"
] |
Set the data contained in a text frame. This includes all frames with
an id that starts with 'T' but excludes "TXXX". If an improper id
is passed, then nothing will happen.
@param id the id of the frame to set the data for
@param data the data for the frame
|
[
"Set",
"the",
"data",
"contained",
"in",
"a",
"text",
"frame",
".",
"This",
"includes",
"all",
"frames",
"with",
"an",
"id",
"that",
"starts",
"with",
"T",
"but",
"excludes",
"TXXX",
".",
"If",
"an",
"improper",
"id",
"is",
"passed",
"then",
"nothing",
"will",
"happen",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L299-L317
|
150,522
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
|
ID3v2Tag.setURLFrame
|
public void setURLFrame(String id, String data)
{
if ((id.charAt(0) == 'W') && !id.equals(ID3v2Frames.USER_DEFINED_URL))
{
updateFrameData(id, data.getBytes());
}
}
|
java
|
public void setURLFrame(String id, String data)
{
if ((id.charAt(0) == 'W') && !id.equals(ID3v2Frames.USER_DEFINED_URL))
{
updateFrameData(id, data.getBytes());
}
}
|
[
"public",
"void",
"setURLFrame",
"(",
"String",
"id",
",",
"String",
"data",
")",
"{",
"if",
"(",
"(",
"id",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"&&",
"!",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"USER_DEFINED_URL",
")",
")",
"{",
"updateFrameData",
"(",
"id",
",",
"data",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"}"
] |
Set the data contained in a URL frame. This includes all frames with
an id that starts with 'W' but excludes "WXXX". If an improper id is
passed, then nothing will happen.
@param id the id of the frame to set the data for
@param data the data for the frame
|
[
"Set",
"the",
"data",
"contained",
"in",
"a",
"URL",
"frame",
".",
"This",
"includes",
"all",
"frames",
"with",
"an",
"id",
"that",
"starts",
"with",
"W",
"but",
"excludes",
"WXXX",
".",
"If",
"an",
"improper",
"id",
"is",
"passed",
"then",
"nothing",
"will",
"happen",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L327-L333
|
150,523
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
|
ID3v2Tag.updateFrameData
|
public void updateFrameData(String id, byte[] data)
{
if (frames.containsKey(id))
{
((ID3v2Frame) frames.get(id)).setFrameData(data);
}
else
{
ID3v2Frame frame = new ID3v2Frame(id, data);
frames.put(id, frame);
}
updateSize();
}
|
java
|
public void updateFrameData(String id, byte[] data)
{
if (frames.containsKey(id))
{
((ID3v2Frame) frames.get(id)).setFrameData(data);
}
else
{
ID3v2Frame frame = new ID3v2Frame(id, data);
frames.put(id, frame);
}
updateSize();
}
|
[
"public",
"void",
"updateFrameData",
"(",
"String",
"id",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"frames",
".",
"containsKey",
"(",
"id",
")",
")",
"{",
"(",
"(",
"ID3v2Frame",
")",
"frames",
".",
"get",
"(",
"id",
")",
")",
".",
"setFrameData",
"(",
"data",
")",
";",
"}",
"else",
"{",
"ID3v2Frame",
"frame",
"=",
"new",
"ID3v2Frame",
"(",
"id",
",",
"data",
")",
";",
"frames",
".",
"put",
"(",
"id",
",",
"frame",
")",
";",
"}",
"updateSize",
"(",
")",
";",
"}"
] |
Updates the data for the frame specified by id. If no frame exists for
the id specified, a new frame with that id is created.
@param id the id of the frame to update
@param data the data for the frame
|
[
"Updates",
"the",
"data",
"for",
"the",
"frame",
"specified",
"by",
"id",
".",
"If",
"no",
"frame",
"exists",
"for",
"the",
"id",
"specified",
"a",
"new",
"frame",
"with",
"that",
"id",
"is",
"created",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L438-L451
|
150,524
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
|
ID3v2Tag.getFrameDataString
|
public String getFrameDataString(String id)
{
try
{
if (frames.containsKey(id))
{
return ((ID3v2Frame) frames.get(id)).getDataString();
}
}
catch (ID3v2FormatException ex)
{
Log.error("ID3v2Tag:", ex);
}
return null;
}
|
java
|
public String getFrameDataString(String id)
{
try
{
if (frames.containsKey(id))
{
return ((ID3v2Frame) frames.get(id)).getDataString();
}
}
catch (ID3v2FormatException ex)
{
Log.error("ID3v2Tag:", ex);
}
return null;
}
|
[
"public",
"String",
"getFrameDataString",
"(",
"String",
"id",
")",
"{",
"try",
"{",
"if",
"(",
"frames",
".",
"containsKey",
"(",
"id",
")",
")",
"{",
"return",
"(",
"(",
"ID3v2Frame",
")",
"frames",
".",
"get",
"(",
"id",
")",
")",
".",
"getDataString",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"ID3v2FormatException",
"ex",
")",
"{",
"Log",
".",
"error",
"(",
"\"ID3v2Tag:\"",
",",
"ex",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the textual information contained in the frame specified by the
id. Not every type of frame has textual information. If an id is
specified that will not work, the empty string is returned.
@param id the id of the frame to get text from
@return the text information contained in the frame
@exception ID3v2FormatException if an error is encountered parsing data
|
[
"Returns",
"the",
"textual",
"information",
"contained",
"in",
"the",
"frame",
"specified",
"by",
"the",
"id",
".",
"Not",
"every",
"type",
"of",
"frame",
"has",
"textual",
"information",
".",
"If",
"an",
"id",
"is",
"specified",
"that",
"will",
"not",
"work",
"the",
"empty",
"string",
"is",
"returned",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L462-L476
|
150,525
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
|
ID3v2Tag.getFrameData
|
public byte[] getFrameData(String id)
{
if (frames.containsKey(id))
{
return ((ID3v2Frame) frames.get(id)).getFrameData();
}
return null;
}
|
java
|
public byte[] getFrameData(String id)
{
if (frames.containsKey(id))
{
return ((ID3v2Frame) frames.get(id)).getFrameData();
}
return null;
}
|
[
"public",
"byte",
"[",
"]",
"getFrameData",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"frames",
".",
"containsKey",
"(",
"id",
")",
")",
"{",
"return",
"(",
"(",
"ID3v2Frame",
")",
"frames",
".",
"get",
"(",
"id",
")",
")",
".",
"getFrameData",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the data found in the frame specified by the id. If the frame
doesn't exist, then a zero length array is returned.
@param id the id of the frame to get the data from
@return the data found in the frame
|
[
"Returns",
"the",
"data",
"found",
"in",
"the",
"frame",
"specified",
"by",
"the",
"id",
".",
"If",
"the",
"frame",
"doesn",
"t",
"exist",
"then",
"a",
"zero",
"length",
"array",
"is",
"returned",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L485-L493
|
150,526
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
|
ID3v2Tag.getSize
|
public int getSize()
{
int retval = head.getTagSize() + head.getHeaderSize();
if (head.getFooter())
{
retval += foot.getFooterSize();
}
return retval;
}
|
java
|
public int getSize()
{
int retval = head.getTagSize() + head.getHeaderSize();
if (head.getFooter())
{
retval += foot.getFooterSize();
}
return retval;
}
|
[
"public",
"int",
"getSize",
"(",
")",
"{",
"int",
"retval",
"=",
"head",
".",
"getTagSize",
"(",
")",
"+",
"head",
".",
"getHeaderSize",
"(",
")",
";",
"if",
"(",
"head",
".",
"getFooter",
"(",
")",
")",
"{",
"retval",
"+=",
"foot",
".",
"getFooterSize",
"(",
")",
";",
"}",
"return",
"retval",
";",
"}"
] |
Returns the size of this id3v2 tag. This includes the header,
extended header, frames, padding, and footer.
@return the size (in bytes) of the entire id3v2 tag
|
[
"Returns",
"the",
"size",
"of",
"this",
"id3v2",
"tag",
".",
"This",
"includes",
"the",
"header",
"extended",
"header",
"frames",
"padding",
"and",
"footer",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L535-L545
|
150,527
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/graphic/renderer/VerticalTableHeaderCellRenderer.java
|
VerticalTableHeaderCellRenderer.getIcon
|
@Override
protected Icon getIcon(JTable table, int column) {
SortKey sortKey = getSortKey(table, column);
if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) {
SortOrder sortOrder = sortKey.getSortOrder();
switch (sortOrder) {
case ASCENDING:
return VerticalSortIcon.ASCENDING;
case DESCENDING:
return VerticalSortIcon.DESCENDING;
case UNSORTED:
return VerticalSortIcon.ASCENDING;
}
}
return null;
}
|
java
|
@Override
protected Icon getIcon(JTable table, int column) {
SortKey sortKey = getSortKey(table, column);
if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) {
SortOrder sortOrder = sortKey.getSortOrder();
switch (sortOrder) {
case ASCENDING:
return VerticalSortIcon.ASCENDING;
case DESCENDING:
return VerticalSortIcon.DESCENDING;
case UNSORTED:
return VerticalSortIcon.ASCENDING;
}
}
return null;
}
|
[
"@",
"Override",
"protected",
"Icon",
"getIcon",
"(",
"JTable",
"table",
",",
"int",
"column",
")",
"{",
"SortKey",
"sortKey",
"=",
"getSortKey",
"(",
"table",
",",
"column",
")",
";",
"if",
"(",
"sortKey",
"!=",
"null",
"&&",
"table",
".",
"convertColumnIndexToView",
"(",
"sortKey",
".",
"getColumn",
"(",
")",
")",
"==",
"column",
")",
"{",
"SortOrder",
"sortOrder",
"=",
"sortKey",
".",
"getSortOrder",
"(",
")",
";",
"switch",
"(",
"sortOrder",
")",
"{",
"case",
"ASCENDING",
":",
"return",
"VerticalSortIcon",
".",
"ASCENDING",
";",
"case",
"DESCENDING",
":",
"return",
"VerticalSortIcon",
".",
"DESCENDING",
";",
"case",
"UNSORTED",
":",
"return",
"VerticalSortIcon",
".",
"ASCENDING",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Overridden to return a rotated version of the sort icon.
@param table
the <code>JTable</code>.
@param column
the colummn index.
@return the sort icon, or null if the column is unsorted.
|
[
"Overridden",
"to",
"return",
"a",
"rotated",
"version",
"of",
"the",
"sort",
"icon",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/renderer/VerticalTableHeaderCellRenderer.java#L48-L63
|
150,528
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/util/SystemEnvironment.java
|
SystemEnvironment.getOSFamily
|
public static OSFamily getOSFamily() {
String name = System.getProperty("os.name").toLowerCase(Locale.US);
if (name.contains("windows")) {
if (name.contains("95") ||
name.contains("98") ||
name.contains("me") ||
name.contains("ce"))
return OSFamily.win9x;
return OSFamily.windows;
}
if (name.contains("os/2"))
return OSFamily.os2;
if (name.contains("netware"))
return OSFamily.netware;
String sep = System.getProperty("path.separator");
if (sep.equals(";"))
return OSFamily.dos;
if (name.contains("nonstop_kernel"))
return OSFamily.tandem;
if (name.contains("openvms"))
return OSFamily.openvms;
if (sep.equals(":") && (!name.contains("mac") || name.endsWith("x")))
return OSFamily.unix;
if (name.contains("mac"))
return OSFamily.mac;
if (name.contains("z/os") || name.contains("os/390"))
return OSFamily.zos;
if (name.contains("os/400"))
return OSFamily.os400;
return null;
}
|
java
|
public static OSFamily getOSFamily() {
String name = System.getProperty("os.name").toLowerCase(Locale.US);
if (name.contains("windows")) {
if (name.contains("95") ||
name.contains("98") ||
name.contains("me") ||
name.contains("ce"))
return OSFamily.win9x;
return OSFamily.windows;
}
if (name.contains("os/2"))
return OSFamily.os2;
if (name.contains("netware"))
return OSFamily.netware;
String sep = System.getProperty("path.separator");
if (sep.equals(";"))
return OSFamily.dos;
if (name.contains("nonstop_kernel"))
return OSFamily.tandem;
if (name.contains("openvms"))
return OSFamily.openvms;
if (sep.equals(":") && (!name.contains("mac") || name.endsWith("x")))
return OSFamily.unix;
if (name.contains("mac"))
return OSFamily.mac;
if (name.contains("z/os") || name.contains("os/390"))
return OSFamily.zos;
if (name.contains("os/400"))
return OSFamily.os400;
return null;
}
|
[
"public",
"static",
"OSFamily",
"getOSFamily",
"(",
")",
"{",
"String",
"name",
"=",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"US",
")",
";",
"if",
"(",
"name",
".",
"contains",
"(",
"\"windows\"",
")",
")",
"{",
"if",
"(",
"name",
".",
"contains",
"(",
"\"95\"",
")",
"||",
"name",
".",
"contains",
"(",
"\"98\"",
")",
"||",
"name",
".",
"contains",
"(",
"\"me\"",
")",
"||",
"name",
".",
"contains",
"(",
"\"ce\"",
")",
")",
"return",
"OSFamily",
".",
"win9x",
";",
"return",
"OSFamily",
".",
"windows",
";",
"}",
"if",
"(",
"name",
".",
"contains",
"(",
"\"os/2\"",
")",
")",
"return",
"OSFamily",
".",
"os2",
";",
"if",
"(",
"name",
".",
"contains",
"(",
"\"netware\"",
")",
")",
"return",
"OSFamily",
".",
"netware",
";",
"String",
"sep",
"=",
"System",
".",
"getProperty",
"(",
"\"path.separator\"",
")",
";",
"if",
"(",
"sep",
".",
"equals",
"(",
"\";\"",
")",
")",
"return",
"OSFamily",
".",
"dos",
";",
"if",
"(",
"name",
".",
"contains",
"(",
"\"nonstop_kernel\"",
")",
")",
"return",
"OSFamily",
".",
"tandem",
";",
"if",
"(",
"name",
".",
"contains",
"(",
"\"openvms\"",
")",
")",
"return",
"OSFamily",
".",
"openvms",
";",
"if",
"(",
"sep",
".",
"equals",
"(",
"\":\"",
")",
"&&",
"(",
"!",
"name",
".",
"contains",
"(",
"\"mac\"",
")",
"||",
"name",
".",
"endsWith",
"(",
"\"x\"",
")",
")",
")",
"return",
"OSFamily",
".",
"unix",
";",
"if",
"(",
"name",
".",
"contains",
"(",
"\"mac\"",
")",
")",
"return",
"OSFamily",
".",
"mac",
";",
"if",
"(",
"name",
".",
"contains",
"(",
"\"z/os\"",
")",
"||",
"name",
".",
"contains",
"(",
"\"os/390\"",
")",
")",
"return",
"OSFamily",
".",
"zos",
";",
"if",
"(",
"name",
".",
"contains",
"(",
"\"os/400\"",
")",
")",
"return",
"OSFamily",
".",
"os400",
";",
"return",
"null",
";",
"}"
] |
Returns the type of operating system.
|
[
"Returns",
"the",
"type",
"of",
"operating",
"system",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/SystemEnvironment.java#L35-L65
|
150,529
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeLongByRange.java
|
RedBlackTreeLongByRange.getMin
|
public Node<T> getMin() {
if (size == 0) return null;
Node<RedBlackTreeLong<T>> e = ranges.getMin();
return e.getElement().getMin();
}
|
java
|
public Node<T> getMin() {
if (size == 0) return null;
Node<RedBlackTreeLong<T>> e = ranges.getMin();
return e.getElement().getMin();
}
|
[
"public",
"Node",
"<",
"T",
">",
"getMin",
"(",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"null",
";",
"Node",
"<",
"RedBlackTreeLong",
"<",
"T",
">",
">",
"e",
"=",
"ranges",
".",
"getMin",
"(",
")",
";",
"return",
"e",
".",
"getElement",
"(",
")",
".",
"getMin",
"(",
")",
";",
"}"
] |
Return the first node.
|
[
"Return",
"the",
"first",
"node",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeLongByRange.java#L97-L101
|
150,530
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeLongByRange.java
|
RedBlackTreeLongByRange.getMax
|
public Node<T> getMax() {
if (size == 0) return null;
Node<RedBlackTreeLong<T>> e = ranges.getMax();
return e.getElement().getMax();
}
|
java
|
public Node<T> getMax() {
if (size == 0) return null;
Node<RedBlackTreeLong<T>> e = ranges.getMax();
return e.getElement().getMax();
}
|
[
"public",
"Node",
"<",
"T",
">",
"getMax",
"(",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"null",
";",
"Node",
"<",
"RedBlackTreeLong",
"<",
"T",
">",
">",
"e",
"=",
"ranges",
".",
"getMax",
"(",
")",
";",
"return",
"e",
".",
"getElement",
"(",
")",
".",
"getMax",
"(",
")",
";",
"}"
] |
Return the last node.
|
[
"Return",
"the",
"last",
"node",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/RedBlackTreeLongByRange.java#L104-L108
|
150,531
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/PowerPackerFile.java
|
PowerPackerFile.isPowerPacker
|
public static boolean isPowerPacker(RandomAccessInputStream input) throws IOException
{
long pos = input.getFilePointer();
input.seek(0);
byte [] ppId = new byte [4];
input.read(ppId, 0, 4);
input.seek(pos);
return Helpers.retrieveAsString(ppId, 0, 4).equals("PP20");
}
|
java
|
public static boolean isPowerPacker(RandomAccessInputStream input) throws IOException
{
long pos = input.getFilePointer();
input.seek(0);
byte [] ppId = new byte [4];
input.read(ppId, 0, 4);
input.seek(pos);
return Helpers.retrieveAsString(ppId, 0, 4).equals("PP20");
}
|
[
"public",
"static",
"boolean",
"isPowerPacker",
"(",
"RandomAccessInputStream",
"input",
")",
"throws",
"IOException",
"{",
"long",
"pos",
"=",
"input",
".",
"getFilePointer",
"(",
")",
";",
"input",
".",
"seek",
"(",
"0",
")",
";",
"byte",
"[",
"]",
"ppId",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"input",
".",
"read",
"(",
"ppId",
",",
"0",
",",
"4",
")",
";",
"input",
".",
"seek",
"(",
"pos",
")",
";",
"return",
"Helpers",
".",
"retrieveAsString",
"(",
"ppId",
",",
"0",
",",
"4",
")",
".",
"equals",
"(",
"\"PP20\"",
")",
";",
"}"
] |
Will check for a power packer file
@since 04.01.2011
@param input
@return true if this file is a powerpacker file
@throws IOException
|
[
"Will",
"check",
"for",
"a",
"power",
"packer",
"file"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/PowerPackerFile.java#L207-L215
|
150,532
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/PowerPackerFile.java
|
PowerPackerFile.pp20DoUnpack
|
private void pp20DoUnpack(RandomAccessInputStream source, byte [] buffer) throws IOException
{
BitBuffer bitBuffer = new BitBuffer(source, (int)source.getLength()-4);
source.seek(source.getLength()-1);
int skip = source.read();
bitBuffer.getBits(skip);
int nBytesLeft = buffer.length;
while (nBytesLeft > 0)
{
if (bitBuffer.getBits(1) == 0)
{
int n = 1;
while (n < nBytesLeft)
{
int code = (int)bitBuffer.getBits(2);
n += code;
if (code != 3) break;
}
for (int i=0; i<n; i++)
{
buffer[--nBytesLeft] = (byte)bitBuffer.getBits(8);
}
if (nBytesLeft == 0) break;
}
int n = bitBuffer.getBits(2)+1;
source.seek(n+3);
int nbits = source.read();
int nofs;
if (n==4)
{
nofs = bitBuffer.getBits( (bitBuffer.getBits(1)!=0) ? nbits : 7 );
while (n < nBytesLeft)
{
int code = bitBuffer.getBits(3);
n += code;
if (code != 7) break;
}
}
else
{
nofs = bitBuffer.getBits(nbits);
}
for (int i=0; i<=n; i++)
{
buffer[nBytesLeft-1] = (nBytesLeft+nofs < buffer.length) ? buffer[nBytesLeft+nofs] : 0;
if ((--nBytesLeft)==0) break;
}
}
}
|
java
|
private void pp20DoUnpack(RandomAccessInputStream source, byte [] buffer) throws IOException
{
BitBuffer bitBuffer = new BitBuffer(source, (int)source.getLength()-4);
source.seek(source.getLength()-1);
int skip = source.read();
bitBuffer.getBits(skip);
int nBytesLeft = buffer.length;
while (nBytesLeft > 0)
{
if (bitBuffer.getBits(1) == 0)
{
int n = 1;
while (n < nBytesLeft)
{
int code = (int)bitBuffer.getBits(2);
n += code;
if (code != 3) break;
}
for (int i=0; i<n; i++)
{
buffer[--nBytesLeft] = (byte)bitBuffer.getBits(8);
}
if (nBytesLeft == 0) break;
}
int n = bitBuffer.getBits(2)+1;
source.seek(n+3);
int nbits = source.read();
int nofs;
if (n==4)
{
nofs = bitBuffer.getBits( (bitBuffer.getBits(1)!=0) ? nbits : 7 );
while (n < nBytesLeft)
{
int code = bitBuffer.getBits(3);
n += code;
if (code != 7) break;
}
}
else
{
nofs = bitBuffer.getBits(nbits);
}
for (int i=0; i<=n; i++)
{
buffer[nBytesLeft-1] = (nBytesLeft+nofs < buffer.length) ? buffer[nBytesLeft+nofs] : 0;
if ((--nBytesLeft)==0) break;
}
}
}
|
[
"private",
"void",
"pp20DoUnpack",
"(",
"RandomAccessInputStream",
"source",
",",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"IOException",
"{",
"BitBuffer",
"bitBuffer",
"=",
"new",
"BitBuffer",
"(",
"source",
",",
"(",
"int",
")",
"source",
".",
"getLength",
"(",
")",
"-",
"4",
")",
";",
"source",
".",
"seek",
"(",
"source",
".",
"getLength",
"(",
")",
"-",
"1",
")",
";",
"int",
"skip",
"=",
"source",
".",
"read",
"(",
")",
";",
"bitBuffer",
".",
"getBits",
"(",
"skip",
")",
";",
"int",
"nBytesLeft",
"=",
"buffer",
".",
"length",
";",
"while",
"(",
"nBytesLeft",
">",
"0",
")",
"{",
"if",
"(",
"bitBuffer",
".",
"getBits",
"(",
"1",
")",
"==",
"0",
")",
"{",
"int",
"n",
"=",
"1",
";",
"while",
"(",
"n",
"<",
"nBytesLeft",
")",
"{",
"int",
"code",
"=",
"(",
"int",
")",
"bitBuffer",
".",
"getBits",
"(",
"2",
")",
";",
"n",
"+=",
"code",
";",
"if",
"(",
"code",
"!=",
"3",
")",
"break",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"buffer",
"[",
"--",
"nBytesLeft",
"]",
"=",
"(",
"byte",
")",
"bitBuffer",
".",
"getBits",
"(",
"8",
")",
";",
"}",
"if",
"(",
"nBytesLeft",
"==",
"0",
")",
"break",
";",
"}",
"int",
"n",
"=",
"bitBuffer",
".",
"getBits",
"(",
"2",
")",
"+",
"1",
";",
"source",
".",
"seek",
"(",
"n",
"+",
"3",
")",
";",
"int",
"nbits",
"=",
"source",
".",
"read",
"(",
")",
";",
"int",
"nofs",
";",
"if",
"(",
"n",
"==",
"4",
")",
"{",
"nofs",
"=",
"bitBuffer",
".",
"getBits",
"(",
"(",
"bitBuffer",
".",
"getBits",
"(",
"1",
")",
"!=",
"0",
")",
"?",
"nbits",
":",
"7",
")",
";",
"while",
"(",
"n",
"<",
"nBytesLeft",
")",
"{",
"int",
"code",
"=",
"bitBuffer",
".",
"getBits",
"(",
"3",
")",
";",
"n",
"+=",
"code",
";",
"if",
"(",
"code",
"!=",
"7",
")",
"break",
";",
"}",
"}",
"else",
"{",
"nofs",
"=",
"bitBuffer",
".",
"getBits",
"(",
"nbits",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"n",
";",
"i",
"++",
")",
"{",
"buffer",
"[",
"nBytesLeft",
"-",
"1",
"]",
"=",
"(",
"nBytesLeft",
"+",
"nofs",
"<",
"buffer",
".",
"length",
")",
"?",
"buffer",
"[",
"nBytesLeft",
"+",
"nofs",
"]",
":",
"0",
";",
"if",
"(",
"(",
"--",
"nBytesLeft",
")",
"==",
"0",
")",
"break",
";",
"}",
"}",
"}"
] |
Will unpack powerpacker 2.0 packed contend while reading from the packed Stream
and unpacking into memory
@since 06.01.2010
@param source
@param buffer
@throws IOException
|
[
"Will",
"unpack",
"powerpacker",
"2",
".",
"0",
"packed",
"contend",
"while",
"reading",
"from",
"the",
"packed",
"Stream",
"and",
"unpacking",
"into",
"memory"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/PowerPackerFile.java#L224-L273
|
150,533
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/spi/Converger.java
|
Converger.manycastSendAndReceive
|
protected List<T> manycastSendAndReceive(DatagramSocket datagramSocket, byte[] rqstBytes, int timeout)
{
List<T> result = new ArrayList<T>();
udpConnector.manycastSend(datagramSocket, rqstBytes);
DatagramPacket packet = null;
while ((packet = udpConnector.receive(datagramSocket, timeout)) != null)
{
byte[] data = new byte[packet.getLength()];
System.arraycopy(packet.getData(), packet.getOffset(), data, 0, data.length);
InetSocketAddress address = (InetSocketAddress)packet.getSocketAddress();
T rply = convert(data, address);
if (rply != null)
{
rply.setResponder(address.getAddress().getHostAddress());
result.add(rply);
}
}
return result;
}
|
java
|
protected List<T> manycastSendAndReceive(DatagramSocket datagramSocket, byte[] rqstBytes, int timeout)
{
List<T> result = new ArrayList<T>();
udpConnector.manycastSend(datagramSocket, rqstBytes);
DatagramPacket packet = null;
while ((packet = udpConnector.receive(datagramSocket, timeout)) != null)
{
byte[] data = new byte[packet.getLength()];
System.arraycopy(packet.getData(), packet.getOffset(), data, 0, data.length);
InetSocketAddress address = (InetSocketAddress)packet.getSocketAddress();
T rply = convert(data, address);
if (rply != null)
{
rply.setResponder(address.getAddress().getHostAddress());
result.add(rply);
}
}
return result;
}
|
[
"protected",
"List",
"<",
"T",
">",
"manycastSendAndReceive",
"(",
"DatagramSocket",
"datagramSocket",
",",
"byte",
"[",
"]",
"rqstBytes",
",",
"int",
"timeout",
")",
"{",
"List",
"<",
"T",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"T",
">",
"(",
")",
";",
"udpConnector",
".",
"manycastSend",
"(",
"datagramSocket",
",",
"rqstBytes",
")",
";",
"DatagramPacket",
"packet",
"=",
"null",
";",
"while",
"(",
"(",
"packet",
"=",
"udpConnector",
".",
"receive",
"(",
"datagramSocket",
",",
"timeout",
")",
")",
"!=",
"null",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"packet",
".",
"getLength",
"(",
")",
"]",
";",
"System",
".",
"arraycopy",
"(",
"packet",
".",
"getData",
"(",
")",
",",
"packet",
".",
"getOffset",
"(",
")",
",",
"data",
",",
"0",
",",
"data",
".",
"length",
")",
";",
"InetSocketAddress",
"address",
"=",
"(",
"InetSocketAddress",
")",
"packet",
".",
"getSocketAddress",
"(",
")",
";",
"T",
"rply",
"=",
"convert",
"(",
"data",
",",
"address",
")",
";",
"if",
"(",
"rply",
"!=",
"null",
")",
"{",
"rply",
".",
"setResponder",
"(",
"address",
".",
"getAddress",
"(",
")",
".",
"getHostAddress",
"(",
")",
")",
";",
"result",
".",
"add",
"(",
"rply",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Sends the given request bytes, then waits at most for the given timeout for replies.
For each reply, sets the responder address.
@param datagramSocket the socket to use to send and receive
@param rqstBytes the request bytes to send
@param timeout the max time to wait for a reply
@return a list of replies received
|
[
"Sends",
"the",
"given",
"request",
"bytes",
"then",
"waits",
"at",
"most",
"for",
"the",
"given",
"timeout",
"for",
"replies",
".",
"For",
"each",
"reply",
"sets",
"the",
"responder",
"address",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/spi/Converger.java#L254-L275
|
150,534
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/misc/ListUtils.java
|
ListUtils.getRandomItem
|
public static <T> T getRandomItem(List<T> list) {
return list.get(rand.nextInt(list.size()));
}
|
java
|
public static <T> T getRandomItem(List<T> list) {
return list.get(rand.nextInt(list.size()));
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"getRandomItem",
"(",
"List",
"<",
"T",
">",
"list",
")",
"{",
"return",
"list",
".",
"get",
"(",
"rand",
".",
"nextInt",
"(",
"list",
".",
"size",
"(",
")",
")",
")",
";",
"}"
] |
Returns a random element of the given list.
@param <T>
Type of list elements
@param list
List
@return Random element of <code>list</code>
|
[
"Returns",
"a",
"random",
"element",
"of",
"the",
"given",
"list",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ListUtils.java#L32-L34
|
150,535
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/misc/ListUtils.java
|
ListUtils.insertHeader
|
public static <T> void insertHeader(List<T> list, T headerValue, int headerSize) {
for (int i = 0; i < headerSize; i++)
list.add(0, headerValue);
}
|
java
|
public static <T> void insertHeader(List<T> list, T headerValue, int headerSize) {
for (int i = 0; i < headerSize; i++)
list.add(0, headerValue);
}
|
[
"public",
"static",
"<",
"T",
">",
"void",
"insertHeader",
"(",
"List",
"<",
"T",
">",
"list",
",",
"T",
"headerValue",
",",
"int",
"headerSize",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"headerSize",
";",
"i",
"++",
")",
"list",
".",
"(",
"0",
",",
"headerValue",
")",
";",
"}"
] |
Inserts a header
@param <T>
@param list
@param headerValue
@param headerSize
|
[
"Inserts",
"a",
"header"
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ListUtils.java#L44-L47
|
150,536
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/misc/ListUtils.java
|
ListUtils.divideAsList
|
public static <T> List<List<T>> divideAsList(List<T> coll) {
List<List<T>> result = new ArrayList<>();
for (T t : coll) {
List<T> list = new ArrayList<>();
list.add(t);
result.add(list);
}
return result;
}
|
java
|
public static <T> List<List<T>> divideAsList(List<T> coll) {
List<List<T>> result = new ArrayList<>();
for (T t : coll) {
List<T> list = new ArrayList<>();
list.add(t);
result.add(list);
}
return result;
}
|
[
"public",
"static",
"<",
"T",
">",
"List",
"<",
"List",
"<",
"T",
">",
">",
"divideAsList",
"(",
"List",
"<",
"T",
">",
"coll",
")",
"{",
"List",
"<",
"List",
"<",
"T",
">>",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"T",
"t",
":",
"coll",
")",
"{",
"List",
"<",
"T",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"list",
".",
"add",
"(",
"t",
")",
";",
"result",
".",
"add",
"(",
"list",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns a list of lists containing exactly one element of the given list
each.
@param coll
The list to split
@return A list of lists containing exactly one element of the given list
each.
|
[
"Returns",
"a",
"list",
"of",
"lists",
"containing",
"exactly",
"one",
"element",
"of",
"the",
"given",
"list",
"each",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/ListUtils.java#L357-L365
|
150,537
|
danidemi/jlubricant
|
jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/hsql/core/HsqlDbms.java
|
HsqlDbms.dataSourceByName
|
@Override
@Deprecated
public DataSource dataSourceByName(String dbName) {
return new com.danidemi.jlubricant.embeddable.BasicDataSource(
dbByName(dbName));
}
|
java
|
@Override
@Deprecated
public DataSource dataSourceByName(String dbName) {
return new com.danidemi.jlubricant.embeddable.BasicDataSource(
dbByName(dbName));
}
|
[
"@",
"Override",
"@",
"Deprecated",
"public",
"DataSource",
"dataSourceByName",
"(",
"String",
"dbName",
")",
"{",
"return",
"new",
"com",
".",
"danidemi",
".",
"jlubricant",
".",
"embeddable",
".",
"BasicDataSource",
"(",
"dbByName",
"(",
"dbName",
")",
")",
";",
"}"
] |
Returns a DataSource on the given database.
@deprecated Databases are {@link DataSource} now.
|
[
"Returns",
"a",
"DataSource",
"on",
"the",
"given",
"database",
"."
] |
a9937c141c69ec34b768bd603b8093e496329b3a
|
https://github.com/danidemi/jlubricant/blob/a9937c141c69ec34b768bd603b8093e496329b3a/jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/hsql/core/HsqlDbms.java#L277-L282
|
150,538
|
danidemi/jlubricant
|
jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/hsql/core/HsqlDbms.java
|
HsqlDbms.getFastDataSource
|
DataSource getFastDataSource(HsqlDatabaseDescriptor hsqlDatabase) {
BasicDataSource bds = new BasicDataSource();
bds.setDriverClassName(hsqlDatabase.getDriverClassName());
bds.setUsername(hsqlDatabase.getUsername());
bds.setPassword(hsqlDatabase.getPassword());
bds.setUrl(hsqlDatabase.getUrl());
return bds;
}
|
java
|
DataSource getFastDataSource(HsqlDatabaseDescriptor hsqlDatabase) {
BasicDataSource bds = new BasicDataSource();
bds.setDriverClassName(hsqlDatabase.getDriverClassName());
bds.setUsername(hsqlDatabase.getUsername());
bds.setPassword(hsqlDatabase.getPassword());
bds.setUrl(hsqlDatabase.getUrl());
return bds;
}
|
[
"DataSource",
"getFastDataSource",
"(",
"HsqlDatabaseDescriptor",
"hsqlDatabase",
")",
"{",
"BasicDataSource",
"bds",
"=",
"new",
"BasicDataSource",
"(",
")",
";",
"bds",
".",
"setDriverClassName",
"(",
"hsqlDatabase",
".",
"getDriverClassName",
"(",
")",
")",
";",
"bds",
".",
"setUsername",
"(",
"hsqlDatabase",
".",
"getUsername",
"(",
")",
")",
";",
"bds",
".",
"setPassword",
"(",
"hsqlDatabase",
".",
"getPassword",
"(",
")",
")",
";",
"bds",
".",
"setUrl",
"(",
"hsqlDatabase",
".",
"getUrl",
"(",
")",
")",
";",
"return",
"bds",
";",
"}"
] |
Return a quick datasource for the given hsqldatabase.
|
[
"Return",
"a",
"quick",
"datasource",
"for",
"the",
"given",
"hsqldatabase",
"."
] |
a9937c141c69ec34b768bd603b8093e496329b3a
|
https://github.com/danidemi/jlubricant/blob/a9937c141c69ec34b768bd603b8093e496329b3a/jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/hsql/core/HsqlDbms.java#L312-L319
|
150,539
|
danidemi/jlubricant
|
jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/hsql/core/HsqlDbms.java
|
HsqlDbms.closeFastDataSource
|
public void closeFastDataSource(DataSource ds) throws SQLException {
BasicDataSource bds = (BasicDataSource) ds;
bds.close();
}
|
java
|
public void closeFastDataSource(DataSource ds) throws SQLException {
BasicDataSource bds = (BasicDataSource) ds;
bds.close();
}
|
[
"public",
"void",
"closeFastDataSource",
"(",
"DataSource",
"ds",
")",
"throws",
"SQLException",
"{",
"BasicDataSource",
"bds",
"=",
"(",
"BasicDataSource",
")",
"ds",
";",
"bds",
".",
"close",
"(",
")",
";",
"}"
] |
Close the fast datasource.
|
[
"Close",
"the",
"fast",
"datasource",
"."
] |
a9937c141c69ec34b768bd603b8093e496329b3a
|
https://github.com/danidemi/jlubricant/blob/a9937c141c69ec34b768bd603b8093e496329b3a/jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/hsql/core/HsqlDbms.java#L325-L328
|
150,540
|
rwl/CSparseJ
|
src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_dfs.java
|
Dcs_dfs.cs_dfs
|
public static int cs_dfs(int j, Dcs G, int top, int[] xi, int xi_offset, int[] pstack, int pstack_offset,
int[] pinv, int pinv_offset) {
int i, p, p2, jnew, head = 0, Gp[], Gi[];
boolean done;
if (!Dcs_util.CS_CSC(G) || xi == null || pstack == null)
return (-1); /* check inputs */
Gp = G.p;
Gi = G.i;
xi[xi_offset + 0] = j; /* initialize the recursion stack */
while (head >= 0) {
j = xi[xi_offset + head]; /* get j from the top of the recursion stack */
jnew = pinv != null ? (pinv[pinv_offset + j]) : j;
if (!Dcs_util.CS_MARKED(Gp, j)) {
Dcs_util.CS_MARK(Gp, j); /* mark node j as visited */
pstack[pstack_offset + head] = (jnew < 0) ? 0 : Dcs_util.CS_UNFLIP(Gp[jnew]);
}
done = true; /* node j done if no unvisited neighbors */
p2 = (jnew < 0) ? 0 : Dcs_util.CS_UNFLIP(Gp[jnew + 1]);
for (p = pstack[pstack_offset + head]; p < p2; p++) /* examine all neighbors of j */
{
i = Gi[p]; /* consider neighbor node i */
if (Dcs_util.CS_MARKED(Gp, i))
continue; /* skip visited node i */
pstack[pstack_offset + head] = p; /* pause depth-first search of node j */
xi[xi_offset + ++head] = i; /* start dfs at node i */
done = false; /* node j is not done */
break; /* break, to start dfs (i) */
}
if (done) /* depth-first search at node j is done */
{
head--; /* remove j from the recursion stack */
xi[xi_offset + --top] = j; /* and place in the output stack */
}
}
return (top);
}
|
java
|
public static int cs_dfs(int j, Dcs G, int top, int[] xi, int xi_offset, int[] pstack, int pstack_offset,
int[] pinv, int pinv_offset) {
int i, p, p2, jnew, head = 0, Gp[], Gi[];
boolean done;
if (!Dcs_util.CS_CSC(G) || xi == null || pstack == null)
return (-1); /* check inputs */
Gp = G.p;
Gi = G.i;
xi[xi_offset + 0] = j; /* initialize the recursion stack */
while (head >= 0) {
j = xi[xi_offset + head]; /* get j from the top of the recursion stack */
jnew = pinv != null ? (pinv[pinv_offset + j]) : j;
if (!Dcs_util.CS_MARKED(Gp, j)) {
Dcs_util.CS_MARK(Gp, j); /* mark node j as visited */
pstack[pstack_offset + head] = (jnew < 0) ? 0 : Dcs_util.CS_UNFLIP(Gp[jnew]);
}
done = true; /* node j done if no unvisited neighbors */
p2 = (jnew < 0) ? 0 : Dcs_util.CS_UNFLIP(Gp[jnew + 1]);
for (p = pstack[pstack_offset + head]; p < p2; p++) /* examine all neighbors of j */
{
i = Gi[p]; /* consider neighbor node i */
if (Dcs_util.CS_MARKED(Gp, i))
continue; /* skip visited node i */
pstack[pstack_offset + head] = p; /* pause depth-first search of node j */
xi[xi_offset + ++head] = i; /* start dfs at node i */
done = false; /* node j is not done */
break; /* break, to start dfs (i) */
}
if (done) /* depth-first search at node j is done */
{
head--; /* remove j from the recursion stack */
xi[xi_offset + --top] = j; /* and place in the output stack */
}
}
return (top);
}
|
[
"public",
"static",
"int",
"cs_dfs",
"(",
"int",
"j",
",",
"Dcs",
"G",
",",
"int",
"top",
",",
"int",
"[",
"]",
"xi",
",",
"int",
"xi_offset",
",",
"int",
"[",
"]",
"pstack",
",",
"int",
"pstack_offset",
",",
"int",
"[",
"]",
"pinv",
",",
"int",
"pinv_offset",
")",
"{",
"int",
"i",
",",
"p",
",",
"p2",
",",
"jnew",
",",
"head",
"=",
"0",
",",
"Gp",
"[",
"]",
",",
"Gi",
"[",
"]",
";",
"boolean",
"done",
";",
"if",
"(",
"!",
"Dcs_util",
".",
"CS_CSC",
"(",
"G",
")",
"||",
"xi",
"==",
"null",
"||",
"pstack",
"==",
"null",
")",
"return",
"(",
"-",
"1",
")",
";",
"/* check inputs */",
"Gp",
"=",
"G",
".",
"p",
";",
"Gi",
"=",
"G",
".",
"i",
";",
"xi",
"[",
"xi_offset",
"+",
"0",
"]",
"=",
"j",
";",
"/* initialize the recursion stack */",
"while",
"(",
"head",
">=",
"0",
")",
"{",
"j",
"=",
"xi",
"[",
"xi_offset",
"+",
"head",
"]",
";",
"/* get j from the top of the recursion stack */",
"jnew",
"=",
"pinv",
"!=",
"null",
"?",
"(",
"pinv",
"[",
"pinv_offset",
"+",
"j",
"]",
")",
":",
"j",
";",
"if",
"(",
"!",
"Dcs_util",
".",
"CS_MARKED",
"(",
"Gp",
",",
"j",
")",
")",
"{",
"Dcs_util",
".",
"CS_MARK",
"(",
"Gp",
",",
"j",
")",
";",
"/* mark node j as visited */",
"pstack",
"[",
"pstack_offset",
"+",
"head",
"]",
"=",
"(",
"jnew",
"<",
"0",
")",
"?",
"0",
":",
"Dcs_util",
".",
"CS_UNFLIP",
"(",
"Gp",
"[",
"jnew",
"]",
")",
";",
"}",
"done",
"=",
"true",
";",
"/* node j done if no unvisited neighbors */",
"p2",
"=",
"(",
"jnew",
"<",
"0",
")",
"?",
"0",
":",
"Dcs_util",
".",
"CS_UNFLIP",
"(",
"Gp",
"[",
"jnew",
"+",
"1",
"]",
")",
";",
"for",
"(",
"p",
"=",
"pstack",
"[",
"pstack_offset",
"+",
"head",
"]",
";",
"p",
"<",
"p2",
";",
"p",
"++",
")",
"/* examine all neighbors of j */",
"{",
"i",
"=",
"Gi",
"[",
"p",
"]",
";",
"/* consider neighbor node i */",
"if",
"(",
"Dcs_util",
".",
"CS_MARKED",
"(",
"Gp",
",",
"i",
")",
")",
"continue",
";",
"/* skip visited node i */",
"pstack",
"[",
"pstack_offset",
"+",
"head",
"]",
"=",
"p",
";",
"/* pause depth-first search of node j */",
"xi",
"[",
"xi_offset",
"+",
"++",
"head",
"]",
"=",
"i",
";",
"/* start dfs at node i */",
"done",
"=",
"false",
";",
"/* node j is not done */",
"break",
";",
"/* break, to start dfs (i) */",
"}",
"if",
"(",
"done",
")",
"/* depth-first search at node j is done */",
"{",
"head",
"--",
";",
"/* remove j from the recursion stack */",
"xi",
"[",
"xi_offset",
"+",
"--",
"top",
"]",
"=",
"j",
";",
"/* and place in the output stack */",
"}",
"}",
"return",
"(",
"top",
")",
";",
"}"
] |
Depth-first-search of the graph of a matrix, starting at node j.
@param j
starting node
@param G
graph to search (G.p modified, then restored)
@param top
stack[top..n-1] is used on input
@param xi
size n, stack containing nodes traversed
@param xi_offset
the index of the first element in array xi
@param pstack
size n, work array
@param pstack_offset
the index of the first element in array pstack
@param pinv
mapping of rows to columns of G, ignored if null
@param pinv_offset
the index of the first element in array pinv
@return new value of top, -1 on error
|
[
"Depth",
"-",
"first",
"-",
"search",
"of",
"the",
"graph",
"of",
"a",
"matrix",
"starting",
"at",
"node",
"j",
"."
] |
6a6f66bccce1558156a961494358952603b0ac84
|
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_dfs.java#L60-L95
|
150,541
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/SoundOutputStreamImpl.java
|
SoundOutputStreamImpl.setVolume
|
public synchronized void setVolume(float gain)
{
if (currentVolume != gain)
{
currentVolume = gain;
if (sourceLine!=null && sourceLine.isControlSupported(FloatControl.Type.MASTER_GAIN))
{
FloatControl gainControl = (FloatControl)sourceLine.getControl(FloatControl.Type.MASTER_GAIN);
float dB = (float)(Helpers.getDBValueFrom(gain));
if (dB > gainControl.getMaximum()) dB = gainControl.getMaximum();
else
if (dB < gainControl.getMinimum()) dB = gainControl.getMinimum();
gainControl.setValue(dB);
}
}
}
|
java
|
public synchronized void setVolume(float gain)
{
if (currentVolume != gain)
{
currentVolume = gain;
if (sourceLine!=null && sourceLine.isControlSupported(FloatControl.Type.MASTER_GAIN))
{
FloatControl gainControl = (FloatControl)sourceLine.getControl(FloatControl.Type.MASTER_GAIN);
float dB = (float)(Helpers.getDBValueFrom(gain));
if (dB > gainControl.getMaximum()) dB = gainControl.getMaximum();
else
if (dB < gainControl.getMinimum()) dB = gainControl.getMinimum();
gainControl.setValue(dB);
}
}
}
|
[
"public",
"synchronized",
"void",
"setVolume",
"(",
"float",
"gain",
")",
"{",
"if",
"(",
"currentVolume",
"!=",
"gain",
")",
"{",
"currentVolume",
"=",
"gain",
";",
"if",
"(",
"sourceLine",
"!=",
"null",
"&&",
"sourceLine",
".",
"isControlSupported",
"(",
"FloatControl",
".",
"Type",
".",
"MASTER_GAIN",
")",
")",
"{",
"FloatControl",
"gainControl",
"=",
"(",
"FloatControl",
")",
"sourceLine",
".",
"getControl",
"(",
"FloatControl",
".",
"Type",
".",
"MASTER_GAIN",
")",
";",
"float",
"dB",
"=",
"(",
"float",
")",
"(",
"Helpers",
".",
"getDBValueFrom",
"(",
"gain",
")",
")",
";",
"if",
"(",
"dB",
">",
"gainControl",
".",
"getMaximum",
"(",
")",
")",
"dB",
"=",
"gainControl",
".",
"getMaximum",
"(",
")",
";",
"else",
"if",
"(",
"dB",
"<",
"gainControl",
".",
"getMinimum",
"(",
")",
")",
"dB",
"=",
"gainControl",
".",
"getMinimum",
"(",
")",
";",
"gainControl",
".",
"setValue",
"(",
"dB",
")",
";",
"}",
"}",
"}"
] |
Set the Gain of the sourceLine
@since 01.11.2008
@param gain
|
[
"Set",
"the",
"Gain",
"of",
"the",
"sourceLine"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/SoundOutputStreamImpl.java#L275-L290
|
150,542
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/SoundOutputStreamImpl.java
|
SoundOutputStreamImpl.setBalance
|
public synchronized void setBalance(float balance)
{
if (currentBalance != balance)
{
currentBalance = balance;
if (sourceLine!=null && sourceLine.isControlSupported(FloatControl.Type.BALANCE))
{
FloatControl balanceControl = (FloatControl)sourceLine.getControl(FloatControl.Type.BALANCE);
if (balance <= balanceControl.getMaximum() && balance >= balanceControl.getMinimum())
balanceControl.setValue(balance);
}
}
}
|
java
|
public synchronized void setBalance(float balance)
{
if (currentBalance != balance)
{
currentBalance = balance;
if (sourceLine!=null && sourceLine.isControlSupported(FloatControl.Type.BALANCE))
{
FloatControl balanceControl = (FloatControl)sourceLine.getControl(FloatControl.Type.BALANCE);
if (balance <= balanceControl.getMaximum() && balance >= balanceControl.getMinimum())
balanceControl.setValue(balance);
}
}
}
|
[
"public",
"synchronized",
"void",
"setBalance",
"(",
"float",
"balance",
")",
"{",
"if",
"(",
"currentBalance",
"!=",
"balance",
")",
"{",
"currentBalance",
"=",
"balance",
";",
"if",
"(",
"sourceLine",
"!=",
"null",
"&&",
"sourceLine",
".",
"isControlSupported",
"(",
"FloatControl",
".",
"Type",
".",
"BALANCE",
")",
")",
"{",
"FloatControl",
"balanceControl",
"=",
"(",
"FloatControl",
")",
"sourceLine",
".",
"getControl",
"(",
"FloatControl",
".",
"Type",
".",
"BALANCE",
")",
";",
"if",
"(",
"balance",
"<=",
"balanceControl",
".",
"getMaximum",
"(",
")",
"&&",
"balance",
">=",
"balanceControl",
".",
"getMinimum",
"(",
")",
")",
"balanceControl",
".",
"setValue",
"(",
"balance",
")",
";",
"}",
"}",
"}"
] |
Set the Balance of the sourceLine
@since 01.11.2008
@param gain
|
[
"Set",
"the",
"Balance",
"of",
"the",
"sourceLine"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/SoundOutputStreamImpl.java#L296-L308
|
150,543
|
zmarko/jPasswordObfuscator
|
jPasswordObfuscator-lib/src/main/java/rs/in/zivanovic/obfuscator/impl/ObfuscatedData.java
|
ObfuscatedData.fromString
|
public static ObfuscatedData fromString(String obfuscatedString) {
String[] parts = obfuscatedString.split("\\$");
if (parts.length != 5) {
throw new IllegalArgumentException("Invalid obfuscated data");
}
if (!parts[1].equals(SIGNATURE)) {
throw new IllegalArgumentException("Invalid obfuscated data");
}
return new ObfuscatedData(Integer.parseInt(parts[2]), Base64.decode(parts[3]), Base64.decode(parts[4]));
}
|
java
|
public static ObfuscatedData fromString(String obfuscatedString) {
String[] parts = obfuscatedString.split("\\$");
if (parts.length != 5) {
throw new IllegalArgumentException("Invalid obfuscated data");
}
if (!parts[1].equals(SIGNATURE)) {
throw new IllegalArgumentException("Invalid obfuscated data");
}
return new ObfuscatedData(Integer.parseInt(parts[2]), Base64.decode(parts[3]), Base64.decode(parts[4]));
}
|
[
"public",
"static",
"ObfuscatedData",
"fromString",
"(",
"String",
"obfuscatedString",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"obfuscatedString",
".",
"split",
"(",
"\"\\\\$\"",
")",
";",
"if",
"(",
"parts",
".",
"length",
"!=",
"5",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid obfuscated data\"",
")",
";",
"}",
"if",
"(",
"!",
"parts",
"[",
"1",
"]",
".",
"equals",
"(",
"SIGNATURE",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid obfuscated data\"",
")",
";",
"}",
"return",
"new",
"ObfuscatedData",
"(",
"Integer",
".",
"parseInt",
"(",
"parts",
"[",
"2",
"]",
")",
",",
"Base64",
".",
"decode",
"(",
"parts",
"[",
"3",
"]",
")",
",",
"Base64",
".",
"decode",
"(",
"parts",
"[",
"4",
"]",
")",
")",
";",
"}"
] |
Parse string containing obfuscated data.
@param obfuscatedString obfuscated string to parse
@return parsed data
|
[
"Parse",
"string",
"containing",
"obfuscated",
"data",
"."
] |
40844a826bb4d6ccac0caa2480cd89c6362cfdd0
|
https://github.com/zmarko/jPasswordObfuscator/blob/40844a826bb4d6ccac0caa2480cd89c6362cfdd0/jPasswordObfuscator-lib/src/main/java/rs/in/zivanovic/obfuscator/impl/ObfuscatedData.java#L65-L74
|
150,544
|
mtnfog/entity-model
|
src/main/java/com/mtnfog/entity/comparators/EntityComparator.java
|
EntityComparator.sort
|
public static Set<Entity> sort(Set<Entity> entities, Order sortingBy) {
EntityComparator comparator = new EntityComparator(sortingBy);
List<Entity> list = new ArrayList<Entity>(entities);
Collections.sort(list, comparator);
Set<Entity> sortedEntities = new LinkedHashSet<>(list);
return sortedEntities;
}
|
java
|
public static Set<Entity> sort(Set<Entity> entities, Order sortingBy) {
EntityComparator comparator = new EntityComparator(sortingBy);
List<Entity> list = new ArrayList<Entity>(entities);
Collections.sort(list, comparator);
Set<Entity> sortedEntities = new LinkedHashSet<>(list);
return sortedEntities;
}
|
[
"public",
"static",
"Set",
"<",
"Entity",
">",
"sort",
"(",
"Set",
"<",
"Entity",
">",
"entities",
",",
"Order",
"sortingBy",
")",
"{",
"EntityComparator",
"comparator",
"=",
"new",
"EntityComparator",
"(",
"sortingBy",
")",
";",
"List",
"<",
"Entity",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"Entity",
">",
"(",
"entities",
")",
";",
"Collections",
".",
"sort",
"(",
"list",
",",
"comparator",
")",
";",
"Set",
"<",
"Entity",
">",
"sortedEntities",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
"list",
")",
";",
"return",
"sortedEntities",
";",
"}"
] |
Sort the entities.
@param entities The set of {@link Entity entities}.
@param sortingBy The sorting method.
@return A set of sorted {@link Entity entities}.
|
[
"Sort",
"the",
"entities",
"."
] |
48488751685f2ec801363967236f130922b9060a
|
https://github.com/mtnfog/entity-model/blob/48488751685f2ec801363967236f130922b9060a/src/main/java/com/mtnfog/entity/comparators/EntityComparator.java#L81-L90
|
150,545
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/GaplessSoundOutputStreamImpl.java
|
GaplessSoundOutputStreamImpl.openSourceLine
|
@Override
protected synchronized void openSourceLine()
{
try
{
if (audioFormat!=null && (sourceLine==null || (sourceLine != null && !sourceLine.getFormat().matches(audioFormat))))
{
super.openSourceLine();
}
else if (sourceLine != null)
{
if (!sourceLine.isOpen()) sourceLine.open();
if (!sourceLine.isRunning()) sourceLine.start();
}
}
catch (Exception ex)
{
sourceLine = null;
Log.error("Error occured when opening audio device", ex);
}
}
|
java
|
@Override
protected synchronized void openSourceLine()
{
try
{
if (audioFormat!=null && (sourceLine==null || (sourceLine != null && !sourceLine.getFormat().matches(audioFormat))))
{
super.openSourceLine();
}
else if (sourceLine != null)
{
if (!sourceLine.isOpen()) sourceLine.open();
if (!sourceLine.isRunning()) sourceLine.start();
}
}
catch (Exception ex)
{
sourceLine = null;
Log.error("Error occured when opening audio device", ex);
}
}
|
[
"@",
"Override",
"protected",
"synchronized",
"void",
"openSourceLine",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"audioFormat",
"!=",
"null",
"&&",
"(",
"sourceLine",
"==",
"null",
"||",
"(",
"sourceLine",
"!=",
"null",
"&&",
"!",
"sourceLine",
".",
"getFormat",
"(",
")",
".",
"matches",
"(",
"audioFormat",
")",
")",
")",
")",
"{",
"super",
".",
"openSourceLine",
"(",
")",
";",
"}",
"else",
"if",
"(",
"sourceLine",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"sourceLine",
".",
"isOpen",
"(",
")",
")",
"sourceLine",
".",
"open",
"(",
")",
";",
"if",
"(",
"!",
"sourceLine",
".",
"isRunning",
"(",
")",
")",
"sourceLine",
".",
"start",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"sourceLine",
"=",
"null",
";",
"Log",
".",
"error",
"(",
"\"Error occured when opening audio device\"",
",",
"ex",
")",
";",
"}",
"}"
] |
This method will only create a new line if
a) an AudioFormat is set
and
b) no line is open
c) or the already open Line is not matching the audio format needed
After creating or reusing the line, status "open" and "running" are ensured
@see de.quippy.javamod.io.SoundOutputStreamImpl#openSourceLine()
@since 27.02.2011
|
[
"This",
"method",
"will",
"only",
"create",
"a",
"new",
"line",
"if",
"a",
")",
"an",
"AudioFormat",
"is",
"set",
"and",
"b",
")",
"no",
"line",
"is",
"open",
"c",
")",
"or",
"the",
"already",
"open",
"Line",
"is",
"not",
"matching",
"the",
"audio",
"format",
"needed",
"After",
"creating",
"or",
"reusing",
"the",
"line",
"status",
"open",
"and",
"running",
"are",
"ensured"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/GaplessSoundOutputStreamImpl.java#L63-L83
|
150,546
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/STValidator.java
|
STValidator.validate
|
protected void validate(ST st, Set<String> expectedArguments){
Map<?,?> formalArgs = st.impl.formalArguments;
if(formalArgs==null){
for(String s : expectedArguments){
this.errors.addError("ST <{}> does not define argument <{}>", st.getName(), s);
}
}
else{
for(String s : expectedArguments){
if(!formalArgs.containsKey(s)){
this.errors.addError("ST <{}> does not define argument <{}>", st.getName(), s);
}
}
}
}
|
java
|
protected void validate(ST st, Set<String> expectedArguments){
Map<?,?> formalArgs = st.impl.formalArguments;
if(formalArgs==null){
for(String s : expectedArguments){
this.errors.addError("ST <{}> does not define argument <{}>", st.getName(), s);
}
}
else{
for(String s : expectedArguments){
if(!formalArgs.containsKey(s)){
this.errors.addError("ST <{}> does not define argument <{}>", st.getName(), s);
}
}
}
}
|
[
"protected",
"void",
"validate",
"(",
"ST",
"st",
",",
"Set",
"<",
"String",
">",
"expectedArguments",
")",
"{",
"Map",
"<",
"?",
",",
"?",
">",
"formalArgs",
"=",
"st",
".",
"impl",
".",
"formalArguments",
";",
"if",
"(",
"formalArgs",
"==",
"null",
")",
"{",
"for",
"(",
"String",
"s",
":",
"expectedArguments",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"ST <{}> does not define argument <{}>\"",
",",
"st",
".",
"getName",
"(",
")",
",",
"s",
")",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"String",
"s",
":",
"expectedArguments",
")",
"{",
"if",
"(",
"!",
"formalArgs",
".",
"containsKey",
"(",
"s",
")",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"ST <{}> does not define argument <{}>\"",
",",
"st",
".",
"getName",
"(",
")",
",",
"s",
")",
";",
"}",
"}",
"}",
"}"
] |
Validates the ST object and marks all missing arguments.
@param st ST object for validation
@param expectedArguments expected arguments to test for
|
[
"Validates",
"the",
"ST",
"object",
"and",
"marks",
"all",
"missing",
"arguments",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/STValidator.java#L65-L79
|
150,547
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.parseXML
|
public static XNElement parseXML(URL url) throws IOException, XMLStreamException {
try (InputStream in = new BufferedInputStream(url.openStream())) {
return parseXML(in);
}
}
|
java
|
public static XNElement parseXML(URL url) throws IOException, XMLStreamException {
try (InputStream in = new BufferedInputStream(url.openStream())) {
return parseXML(in);
}
}
|
[
"public",
"static",
"XNElement",
"parseXML",
"(",
"URL",
"url",
")",
"throws",
"IOException",
",",
"XMLStreamException",
"{",
"try",
"(",
"InputStream",
"in",
"=",
"new",
"BufferedInputStream",
"(",
"url",
".",
"openStream",
"(",
")",
")",
")",
"{",
"return",
"parseXML",
"(",
"in",
")",
";",
"}",
"}"
] |
Parse an XML from the supplied URL.
@param url the target URL
@return the parsed XML
@throws IOException if an I/O error occurs
@throws XMLStreamException if a parser error occurs
|
[
"Parse",
"an",
"XML",
"from",
"the",
"supplied",
"URL",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L208-L212
|
150,548
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.add
|
public XNElement add(String name) {
XNElement e = new XNElement(name);
e.parent = this;
children.add(e);
return e;
}
|
java
|
public XNElement add(String name) {
XNElement e = new XNElement(name);
e.parent = this;
children.add(e);
return e;
}
|
[
"public",
"XNElement",
"add",
"(",
"String",
"name",
")",
"{",
"XNElement",
"e",
"=",
"new",
"XNElement",
"(",
"name",
")",
";",
"e",
".",
"parent",
"=",
"this",
";",
"children",
".",
"add",
"(",
"e",
")",
";",
"return",
"e",
";",
"}"
] |
Add a new XElement with the given local name and no namespace.
@param name the name of the new element
@return the created XElement child
|
[
"Add",
"a",
"new",
"XElement",
"with",
"the",
"given",
"local",
"name",
"and",
"no",
"namespace",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L378-L383
|
150,549
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.add
|
public XNElement add(XNElement child) {
child.parent = this;
children.add(child);
return child;
}
|
java
|
public XNElement add(XNElement child) {
child.parent = this;
children.add(child);
return child;
}
|
[
"public",
"XNElement",
"add",
"(",
"XNElement",
"child",
")",
"{",
"child",
".",
"parent",
"=",
"this",
";",
"children",
".",
"add",
"(",
"child",
")",
";",
"return",
"child",
";",
"}"
] |
Add the given existing child to this element.
@param child the child element
@return the child element
|
[
"Add",
"the",
"given",
"existing",
"child",
"to",
"this",
"element",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L402-L406
|
150,550
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.childValue
|
public String childValue(String name, String namespace) {
for (XNElement e : children) {
if (Objects.equals(e.name, name) && Objects.equals(e.namespace, namespace)) {
return e.content;
}
}
return null;
}
|
java
|
public String childValue(String name, String namespace) {
for (XNElement e : children) {
if (Objects.equals(e.name, name) && Objects.equals(e.namespace, namespace)) {
return e.content;
}
}
return null;
}
|
[
"public",
"String",
"childValue",
"(",
"String",
"name",
",",
"String",
"namespace",
")",
"{",
"for",
"(",
"XNElement",
"e",
":",
"children",
")",
"{",
"if",
"(",
"Objects",
".",
"equals",
"(",
"e",
".",
"name",
",",
"name",
")",
"&&",
"Objects",
".",
"equals",
"(",
"e",
".",
"namespace",
",",
"namespace",
")",
")",
"{",
"return",
"e",
".",
"content",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Returns the content of the first child which has the given name.
@param name the child name
@param namespace the namespace URI
@return the content or null if no such child
|
[
"Returns",
"the",
"content",
"of",
"the",
"first",
"child",
"which",
"has",
"the",
"given",
"name",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L495-L502
|
150,551
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.copyFrom
|
public void copyFrom(XNElement other) {
content = other.content;
userObject = other.userObject;
for (Map.Entry<XAttributeName, String> me : other.attributes.entrySet()) {
XAttributeName an = new XAttributeName(me.getKey().name, me.getKey().namespace, me.getKey().prefix);
attributes.put(an, me.getValue());
}
for (XNElement c : children) {
XNElement c0 = c.copy();
c0.parent = this;
children.add(c0);
}
}
|
java
|
public void copyFrom(XNElement other) {
content = other.content;
userObject = other.userObject;
for (Map.Entry<XAttributeName, String> me : other.attributes.entrySet()) {
XAttributeName an = new XAttributeName(me.getKey().name, me.getKey().namespace, me.getKey().prefix);
attributes.put(an, me.getValue());
}
for (XNElement c : children) {
XNElement c0 = c.copy();
c0.parent = this;
children.add(c0);
}
}
|
[
"public",
"void",
"copyFrom",
"(",
"XNElement",
"other",
")",
"{",
"content",
"=",
"other",
".",
"content",
";",
"userObject",
"=",
"other",
".",
"userObject",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"XAttributeName",
",",
"String",
">",
"me",
":",
"other",
".",
"attributes",
".",
"entrySet",
"(",
")",
")",
"{",
"XAttributeName",
"an",
"=",
"new",
"XAttributeName",
"(",
"me",
".",
"getKey",
"(",
")",
".",
"name",
",",
"me",
".",
"getKey",
"(",
")",
".",
"namespace",
",",
"me",
".",
"getKey",
"(",
")",
".",
"prefix",
")",
";",
"attributes",
".",
"put",
"(",
"an",
",",
"me",
".",
"getValue",
"(",
")",
")",
";",
"}",
"for",
"(",
"XNElement",
"c",
":",
"children",
")",
"{",
"XNElement",
"c0",
"=",
"c",
".",
"copy",
"(",
")",
";",
"c0",
".",
"parent",
"=",
"this",
";",
"children",
".",
"add",
"(",
"c0",
")",
";",
"}",
"}"
] |
Copy the attributes and child elements from the other element.
@param other the other element
|
[
"Copy",
"the",
"attributes",
"and",
"child",
"elements",
"from",
"the",
"other",
"element",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L517-L529
|
150,552
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.createPrefix
|
protected Pair<String, String> createPrefix(Map<String, String> nss, String currentNamespace, String currentPrefix) {
if (currentNamespace == null) {
return Pair.of(null, null);
}
String pf = nss.get(currentNamespace);
if (pf != null) {
return Pair.of(pf, null);
}
int nsc = 0;
pf = currentPrefix;
if (pf == null) {
pf = "ns" + nsc;
}
outer:
while (!Thread.currentThread().isInterrupted()) {
for (Map.Entry<String, String> e : nss.entrySet()) {
if (Objects.equals(e.getValue(), pf)) {
nsc++;
pf = "ns" + nsc;
continue outer;
}
}
// if we get here, the prefix is not yet used
break;
}
nss.put(currentNamespace, pf);
StringBuilder xmlns = new StringBuilder();
xmlns.append(" xmlns").append(pf != null && pf.length() > 0 ? ":" : "")
.append(pf != null && pf.length() > 0 ? pf : "").append("='")
.append(sanitize(currentNamespace)).append("'");
;
return Pair.of(pf, xmlns.toString());
}
|
java
|
protected Pair<String, String> createPrefix(Map<String, String> nss, String currentNamespace, String currentPrefix) {
if (currentNamespace == null) {
return Pair.of(null, null);
}
String pf = nss.get(currentNamespace);
if (pf != null) {
return Pair.of(pf, null);
}
int nsc = 0;
pf = currentPrefix;
if (pf == null) {
pf = "ns" + nsc;
}
outer:
while (!Thread.currentThread().isInterrupted()) {
for (Map.Entry<String, String> e : nss.entrySet()) {
if (Objects.equals(e.getValue(), pf)) {
nsc++;
pf = "ns" + nsc;
continue outer;
}
}
// if we get here, the prefix is not yet used
break;
}
nss.put(currentNamespace, pf);
StringBuilder xmlns = new StringBuilder();
xmlns.append(" xmlns").append(pf != null && pf.length() > 0 ? ":" : "")
.append(pf != null && pf.length() > 0 ? pf : "").append("='")
.append(sanitize(currentNamespace)).append("'");
;
return Pair.of(pf, xmlns.toString());
}
|
[
"protected",
"Pair",
"<",
"String",
",",
"String",
">",
"createPrefix",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"nss",
",",
"String",
"currentNamespace",
",",
"String",
"currentPrefix",
")",
"{",
"if",
"(",
"currentNamespace",
"==",
"null",
")",
"{",
"return",
"Pair",
".",
"of",
"(",
"null",
",",
"null",
")",
";",
"}",
"String",
"pf",
"=",
"nss",
".",
"get",
"(",
"currentNamespace",
")",
";",
"if",
"(",
"pf",
"!=",
"null",
")",
"{",
"return",
"Pair",
".",
"of",
"(",
"pf",
",",
"null",
")",
";",
"}",
"int",
"nsc",
"=",
"0",
";",
"pf",
"=",
"currentPrefix",
";",
"if",
"(",
"pf",
"==",
"null",
")",
"{",
"pf",
"=",
"\"ns\"",
"+",
"nsc",
";",
"}",
"outer",
":",
"while",
"(",
"!",
"Thread",
".",
"currentThread",
"(",
")",
".",
"isInterrupted",
"(",
")",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"e",
":",
"nss",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"Objects",
".",
"equals",
"(",
"e",
".",
"getValue",
"(",
")",
",",
"pf",
")",
")",
"{",
"nsc",
"++",
";",
"pf",
"=",
"\"ns\"",
"+",
"nsc",
";",
"continue",
"outer",
";",
"}",
"}",
"// if we get here, the prefix is not yet used",
"break",
";",
"}",
"nss",
".",
"put",
"(",
"currentNamespace",
",",
"pf",
")",
";",
"StringBuilder",
"xmlns",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"xmlns",
".",
"append",
"(",
"\" xmlns\"",
")",
".",
"append",
"(",
"pf",
"!=",
"null",
"&&",
"pf",
".",
"length",
"(",
")",
">",
"0",
"?",
"\":\"",
":",
"\"\"",
")",
".",
"append",
"(",
"pf",
"!=",
"null",
"&&",
"pf",
".",
"length",
"(",
")",
">",
"0",
"?",
"pf",
":",
"\"\"",
")",
".",
"append",
"(",
"\"='\"",
")",
".",
"append",
"(",
"sanitize",
"(",
"currentNamespace",
")",
")",
".",
"append",
"(",
"\"'\"",
")",
";",
";",
"return",
"Pair",
".",
"of",
"(",
"pf",
",",
"xmlns",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Generate a new prefix if the current is empty or already exists but with a different URI.
@param nss the namespace to prefix cache.
@param currentNamespace the current namespace
@param currentPrefix the current prefix
@return a pair of the derived prefix and (the xmlns declaration if needed, null otherwise)
|
[
"Generate",
"a",
"new",
"prefix",
"if",
"the",
"current",
"is",
"empty",
"or",
"already",
"exists",
"but",
"with",
"a",
"different",
"URI",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L565-L601
|
150,553
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.get
|
public String get(String attributeName) {
// check first for a namespace-less attribute
String attr = attributes.get(new XAttributeName(attributeName, null, null));
if (attr == null) {
// find any attribute ignoring namespace
for (XAttributeName n : attributes.keySet()) {
if (Objects.equals(n.name, attributeName)) {
return attributes.get(n);
}
}
}
return attr;
}
|
java
|
public String get(String attributeName) {
// check first for a namespace-less attribute
String attr = attributes.get(new XAttributeName(attributeName, null, null));
if (attr == null) {
// find any attribute ignoring namespace
for (XAttributeName n : attributes.keySet()) {
if (Objects.equals(n.name, attributeName)) {
return attributes.get(n);
}
}
}
return attr;
}
|
[
"public",
"String",
"get",
"(",
"String",
"attributeName",
")",
"{",
"// check first for a namespace-less attribute",
"String",
"attr",
"=",
"attributes",
".",
"get",
"(",
"new",
"XAttributeName",
"(",
"attributeName",
",",
"null",
",",
"null",
")",
")",
";",
"if",
"(",
"attr",
"==",
"null",
")",
"{",
"// find any attribute ignoring namespace",
"for",
"(",
"XAttributeName",
"n",
":",
"attributes",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"Objects",
".",
"equals",
"(",
"n",
".",
"name",
",",
"attributeName",
")",
")",
"{",
"return",
"attributes",
".",
"get",
"(",
"n",
")",
";",
"}",
"}",
"}",
"return",
"attr",
";",
"}"
] |
Retrieve the first attribute which has the given local attribute name.
@param attributeName the attribute name
@return the attribute value or null if no such attribute
|
[
"Retrieve",
"the",
"first",
"attribute",
"which",
"has",
"the",
"given",
"local",
"attribute",
"name",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L667-L679
|
150,554
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.get
|
public String get(String attributeName, String attributeNamespace) {
return attributes.get(new XAttributeName(attributeName, attributeNamespace, null));
}
|
java
|
public String get(String attributeName, String attributeNamespace) {
return attributes.get(new XAttributeName(attributeName, attributeNamespace, null));
}
|
[
"public",
"String",
"get",
"(",
"String",
"attributeName",
",",
"String",
"attributeNamespace",
")",
"{",
"return",
"attributes",
".",
"get",
"(",
"new",
"XAttributeName",
"(",
"attributeName",
",",
"attributeNamespace",
",",
"null",
")",
")",
";",
"}"
] |
Retrieve the specific attribute.
@param attributeName the attribute name
@param attributeNamespace the attribute namespace URI
@return the attribute value or null if not present
|
[
"Retrieve",
"the",
"specific",
"attribute",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L686-L688
|
150,555
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.getBoolean
|
public boolean getBoolean(String attribute) {
String s = get(attribute);
if ("true".equals(s) || "1".equals(s)) {
return true;
} else
if ("false".equals(s) || "0".equals(s)) {
return false;
}
throw new IllegalArgumentException("Attribute " + attribute + " is non-boolean");
}
|
java
|
public boolean getBoolean(String attribute) {
String s = get(attribute);
if ("true".equals(s) || "1".equals(s)) {
return true;
} else
if ("false".equals(s) || "0".equals(s)) {
return false;
}
throw new IllegalArgumentException("Attribute " + attribute + " is non-boolean");
}
|
[
"public",
"boolean",
"getBoolean",
"(",
"String",
"attribute",
")",
"{",
"String",
"s",
"=",
"get",
"(",
"attribute",
")",
";",
"if",
"(",
"\"true\"",
".",
"equals",
"(",
"s",
")",
"||",
"\"1\"",
".",
"equals",
"(",
"s",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"\"false\"",
".",
"equals",
"(",
"s",
")",
"||",
"\"0\"",
".",
"equals",
"(",
"s",
")",
")",
"{",
"return",
"false",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Attribute \"",
"+",
"attribute",
"+",
"\" is non-boolean\"",
")",
";",
"}"
] |
Retrieve a value of a boolean attribute.
Throws IllegalArgumentException if the attribute is missing or not of type boolean.
@param attribute the attribute name
@return the value
|
[
"Retrieve",
"a",
"value",
"of",
"a",
"boolean",
"attribute",
".",
"Throws",
"IllegalArgumentException",
"if",
"the",
"attribute",
"is",
"missing",
"or",
"not",
"of",
"type",
"boolean",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L702-L711
|
150,556
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.getDouble
|
public double getDouble(String name, String namespace) {
return Double.parseDouble(get(name, namespace));
}
|
java
|
public double getDouble(String name, String namespace) {
return Double.parseDouble(get(name, namespace));
}
|
[
"public",
"double",
"getDouble",
"(",
"String",
"name",
",",
"String",
"namespace",
")",
"{",
"return",
"Double",
".",
"parseDouble",
"(",
"get",
"(",
"name",
",",
"namespace",
")",
")",
";",
"}"
] |
Returns the attribute as a double value.
@param name the attribute name
@param namespace the attribute namespace
@return the value
|
[
"Returns",
"the",
"attribute",
"as",
"a",
"double",
"value",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L787-L789
|
150,557
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.getDouble
|
public double getDouble(String name, String namespace, double defaultValue) {
String v = get(name, namespace);
return v != null ? Double.parseDouble(v) : defaultValue;
}
|
java
|
public double getDouble(String name, String namespace, double defaultValue) {
String v = get(name, namespace);
return v != null ? Double.parseDouble(v) : defaultValue;
}
|
[
"public",
"double",
"getDouble",
"(",
"String",
"name",
",",
"String",
"namespace",
",",
"double",
"defaultValue",
")",
"{",
"String",
"v",
"=",
"get",
"(",
"name",
",",
"namespace",
")",
";",
"return",
"v",
"!=",
"null",
"?",
"Double",
".",
"parseDouble",
"(",
"v",
")",
":",
"defaultValue",
";",
"}"
] |
Returns the attribute as a double value or the default.
@param name the attribute name
@param namespace the attribute namespace
@param defaultValue the default if the attribute is missing
@return the value
|
[
"Returns",
"the",
"attribute",
"as",
"a",
"double",
"value",
"or",
"the",
"default",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L797-L800
|
150,558
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.getLong
|
public long getLong(String attribute, String namespace) {
return Long.parseLong(get(attribute, namespace));
}
|
java
|
public long getLong(String attribute, String namespace) {
return Long.parseLong(get(attribute, namespace));
}
|
[
"public",
"long",
"getLong",
"(",
"String",
"attribute",
",",
"String",
"namespace",
")",
"{",
"return",
"Long",
".",
"parseLong",
"(",
"get",
"(",
"attribute",
",",
"namespace",
")",
")",
";",
"}"
] |
Retrieve an integer attribute or throw an exception if not exists.
@param attribute the attribute name
@param namespace the attribute namespace URI
@return the value
|
[
"Retrieve",
"an",
"integer",
"attribute",
"or",
"throw",
"an",
"exception",
"if",
"not",
"exists",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L872-L874
|
150,559
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.hasName
|
public boolean hasName(String name, String namespace) {
return hasName(name) && Objects.equals(this.namespace, namespace);
}
|
java
|
public boolean hasName(String name, String namespace) {
return hasName(name) && Objects.equals(this.namespace, namespace);
}
|
[
"public",
"boolean",
"hasName",
"(",
"String",
"name",
",",
"String",
"namespace",
")",
"{",
"return",
"hasName",
"(",
"name",
")",
"&&",
"Objects",
".",
"equals",
"(",
"this",
".",
"namespace",
",",
"namespace",
")",
";",
"}"
] |
Test if this XElement has the given name and namespace.
@param name the name to test against
@param namespace the namespace to test against
@return true if the names and namespaces equal
|
[
"Test",
"if",
"this",
"XElement",
"has",
"the",
"given",
"name",
"and",
"namespace",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L975-L977
|
150,560
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.intValue
|
public int intValue(String name, String namespace) {
String s = childValue(name, namespace);
if (s != null) {
return Integer.parseInt(s);
}
throw new IllegalArgumentException(this + ": content: " + name);
}
|
java
|
public int intValue(String name, String namespace) {
String s = childValue(name, namespace);
if (s != null) {
return Integer.parseInt(s);
}
throw new IllegalArgumentException(this + ": content: " + name);
}
|
[
"public",
"int",
"intValue",
"(",
"String",
"name",
",",
"String",
"namespace",
")",
"{",
"String",
"s",
"=",
"childValue",
"(",
"name",
",",
"namespace",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"s",
")",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"this",
"+",
"\": content: \"",
"+",
"name",
")",
";",
"}"
] |
Returns an integer value of the supplied child or throws an exception if missing.
@param name the child element name
@param namespace the element namespace
@return the value
|
[
"Returns",
"an",
"integer",
"value",
"of",
"the",
"supplied",
"child",
"or",
"throws",
"an",
"exception",
"if",
"missing",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L984-L990
|
150,561
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.longValue
|
public long longValue(String name, String namespace) {
String s = childValue(name, namespace);
if (s != null) {
return Long.parseLong(s);
}
throw new IllegalArgumentException(this + ": content: " + name);
}
|
java
|
public long longValue(String name, String namespace) {
String s = childValue(name, namespace);
if (s != null) {
return Long.parseLong(s);
}
throw new IllegalArgumentException(this + ": content: " + name);
}
|
[
"public",
"long",
"longValue",
"(",
"String",
"name",
",",
"String",
"namespace",
")",
"{",
"String",
"s",
"=",
"childValue",
"(",
"name",
",",
"namespace",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"return",
"Long",
".",
"parseLong",
"(",
"s",
")",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"this",
"+",
"\": content: \"",
"+",
"name",
")",
";",
"}"
] |
Returns a long value of the supplied child or throws an exception if missing.
@param name the child element name
@param namespace the element namespace
@return the value
|
[
"Returns",
"a",
"long",
"value",
"of",
"the",
"supplied",
"child",
"or",
"throws",
"an",
"exception",
"if",
"missing",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L1011-L1017
|
150,562
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.save
|
public void save(Writer stream) throws IOException {
final PrintWriter out = new PrintWriter(new BufferedWriter(stream));
try {
out.println("<?xml version='1.0' encoding='UTF-8'?>");
toStringRep("", new HashMap<String, String>(), new XNAppender() {
@Override
public XNAppender append(Object o) {
out.print(o);
return this;
}
@Override
public int length() {
return 0; // Not used here
}
}, null);
} finally {
out.flush();
}
}
|
java
|
public void save(Writer stream) throws IOException {
final PrintWriter out = new PrintWriter(new BufferedWriter(stream));
try {
out.println("<?xml version='1.0' encoding='UTF-8'?>");
toStringRep("", new HashMap<String, String>(), new XNAppender() {
@Override
public XNAppender append(Object o) {
out.print(o);
return this;
}
@Override
public int length() {
return 0; // Not used here
}
}, null);
} finally {
out.flush();
}
}
|
[
"public",
"void",
"save",
"(",
"Writer",
"stream",
")",
"throws",
"IOException",
"{",
"final",
"PrintWriter",
"out",
"=",
"new",
"PrintWriter",
"(",
"new",
"BufferedWriter",
"(",
"stream",
")",
")",
";",
"try",
"{",
"out",
".",
"println",
"(",
"\"<?xml version='1.0' encoding='UTF-8'?>\"",
")",
";",
"toStringRep",
"(",
"\"\"",
",",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
",",
"new",
"XNAppender",
"(",
")",
"{",
"@",
"Override",
"public",
"XNAppender",
"append",
"(",
"Object",
"o",
")",
"{",
"out",
".",
"print",
"(",
"o",
")",
";",
"return",
"this",
";",
"}",
"@",
"Override",
"public",
"int",
"length",
"(",
")",
"{",
"return",
"0",
";",
"// Not used here",
"}",
"}",
",",
"null",
")",
";",
"}",
"finally",
"{",
"out",
".",
"flush",
"(",
")",
";",
"}",
"}"
] |
Save this XML into the given writer.
Does not close the writer.
@param stream the output writer
@throws IOException on error
|
[
"Save",
"this",
"XML",
"into",
"the",
"given",
"writer",
".",
"Does",
"not",
"close",
"the",
"writer",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L1065-L1083
|
150,563
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.save
|
public void save(XMLStreamWriter stream) throws XMLStreamException {
stream.writeStartDocument("UTF-8", "1.0");
saveInternal(stream);
stream.writeEndDocument();
}
|
java
|
public void save(XMLStreamWriter stream) throws XMLStreamException {
stream.writeStartDocument("UTF-8", "1.0");
saveInternal(stream);
stream.writeEndDocument();
}
|
[
"public",
"void",
"save",
"(",
"XMLStreamWriter",
"stream",
")",
"throws",
"XMLStreamException",
"{",
"stream",
".",
"writeStartDocument",
"(",
"\"UTF-8\"",
",",
"\"1.0\"",
")",
";",
"saveInternal",
"(",
"stream",
")",
";",
"stream",
".",
"writeEndDocument",
"(",
")",
";",
"}"
] |
Save the tree into the given XML stream writer.
@param stream the stream writer
@throws XMLStreamException if an error occurs
|
[
"Save",
"the",
"tree",
"into",
"the",
"given",
"XML",
"stream",
"writer",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L1089-L1095
|
150,564
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.saveInternal
|
protected void saveInternal(XMLStreamWriter stream) throws XMLStreamException {
if (namespace != null) {
stream.writeStartElement(prefix, namespace, name);
} else {
stream.writeStartElement(name);
}
for (Map.Entry<XAttributeName, String> a : attributes.entrySet()) {
XAttributeName an = a.getKey();
if (an.namespace != null) {
stream.writeAttribute(an.prefix, an.namespace, an.name, a.getValue());
} else {
stream.writeAttribute(an.name, a.getValue());
}
}
if (content != null) {
stream.writeCharacters(content);
} else {
for (XNElement e : children) {
e.saveInternal(stream);
}
}
stream.writeEndElement();
}
|
java
|
protected void saveInternal(XMLStreamWriter stream) throws XMLStreamException {
if (namespace != null) {
stream.writeStartElement(prefix, namespace, name);
} else {
stream.writeStartElement(name);
}
for (Map.Entry<XAttributeName, String> a : attributes.entrySet()) {
XAttributeName an = a.getKey();
if (an.namespace != null) {
stream.writeAttribute(an.prefix, an.namespace, an.name, a.getValue());
} else {
stream.writeAttribute(an.name, a.getValue());
}
}
if (content != null) {
stream.writeCharacters(content);
} else {
for (XNElement e : children) {
e.saveInternal(stream);
}
}
stream.writeEndElement();
}
|
[
"protected",
"void",
"saveInternal",
"(",
"XMLStreamWriter",
"stream",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"namespace",
"!=",
"null",
")",
"{",
"stream",
".",
"writeStartElement",
"(",
"prefix",
",",
"namespace",
",",
"name",
")",
";",
"}",
"else",
"{",
"stream",
".",
"writeStartElement",
"(",
"name",
")",
";",
"}",
"for",
"(",
"Map",
".",
"Entry",
"<",
"XAttributeName",
",",
"String",
">",
"a",
":",
"attributes",
".",
"entrySet",
"(",
")",
")",
"{",
"XAttributeName",
"an",
"=",
"a",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"an",
".",
"namespace",
"!=",
"null",
")",
"{",
"stream",
".",
"writeAttribute",
"(",
"an",
".",
"prefix",
",",
"an",
".",
"namespace",
",",
"an",
".",
"name",
",",
"a",
".",
"getValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"stream",
".",
"writeAttribute",
"(",
"an",
".",
"name",
",",
"a",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"content",
"!=",
"null",
")",
"{",
"stream",
".",
"writeCharacters",
"(",
"content",
")",
";",
"}",
"else",
"{",
"for",
"(",
"XNElement",
"e",
":",
"children",
")",
"{",
"e",
".",
"saveInternal",
"(",
"stream",
")",
";",
"}",
"}",
"stream",
".",
"writeEndElement",
"(",
")",
";",
"}"
] |
Store the element's content and recursively call itself for children.
@param stream the stream output
@throws XMLStreamException if an error occurs
|
[
"Store",
"the",
"element",
"s",
"content",
"and",
"recursively",
"call",
"itself",
"for",
"children",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L1101-L1124
|
150,565
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.set
|
public void set(Object... nameValues) {
if (nameValues.length % 2 != 0) {
throw new IllegalArgumentException("Names and values must be in pairs");
}
for (int i = 0; i < nameValues.length; i += 2) {
set((String)nameValues[i], nameValues[i + 1]);
}
}
|
java
|
public void set(Object... nameValues) {
if (nameValues.length % 2 != 0) {
throw new IllegalArgumentException("Names and values must be in pairs");
}
for (int i = 0; i < nameValues.length; i += 2) {
set((String)nameValues[i], nameValues[i + 1]);
}
}
|
[
"public",
"void",
"set",
"(",
"Object",
"...",
"nameValues",
")",
"{",
"if",
"(",
"nameValues",
".",
"length",
"%",
"2",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Names and values must be in pairs\"",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nameValues",
".",
"length",
";",
"i",
"+=",
"2",
")",
"{",
"set",
"(",
"(",
"String",
")",
"nameValues",
"[",
"i",
"]",
",",
"nameValues",
"[",
"i",
"+",
"1",
"]",
")",
";",
"}",
"}"
] |
Set a multitude of attribute names and values.
@param nameValues the attribute name and attribute value pairs.
|
[
"Set",
"a",
"multitude",
"of",
"attribute",
"names",
"and",
"values",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L1129-L1136
|
150,566
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.set
|
public void set(String name, String namespace, Object value) {
if (value != null) {
if (value instanceof Date) {
attributes.put(new XAttributeName(name, namespace, null), formatDateTime((Date)value));
} else {
attributes.put(new XAttributeName(name, namespace, null), value.toString());
}
} else {
attributes.remove(new XAttributeName(name, namespace, null));
}
}
|
java
|
public void set(String name, String namespace, Object value) {
if (value != null) {
if (value instanceof Date) {
attributes.put(new XAttributeName(name, namespace, null), formatDateTime((Date)value));
} else {
attributes.put(new XAttributeName(name, namespace, null), value.toString());
}
} else {
attributes.remove(new XAttributeName(name, namespace, null));
}
}
|
[
"public",
"void",
"set",
"(",
"String",
"name",
",",
"String",
"namespace",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Date",
")",
"{",
"attributes",
".",
"put",
"(",
"new",
"XAttributeName",
"(",
"name",
",",
"namespace",
",",
"null",
")",
",",
"formatDateTime",
"(",
"(",
"Date",
")",
"value",
")",
")",
";",
"}",
"else",
"{",
"attributes",
".",
"put",
"(",
"new",
"XAttributeName",
"(",
"name",
",",
"namespace",
",",
"null",
")",
",",
"value",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"attributes",
".",
"remove",
"(",
"new",
"XAttributeName",
"(",
"name",
",",
"namespace",
",",
"null",
")",
")",
";",
"}",
"}"
] |
Set an attribute value identified by a local name and namespace.
@param name the attribute name
@param namespace the attribute namespace
@param value the value, if null, the attribute will be removed
|
[
"Set",
"an",
"attribute",
"value",
"identified",
"by",
"a",
"local",
"name",
"and",
"namespace",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L1151-L1161
|
150,567
|
akarnokd/akarnokd-xml
|
src/main/java/hu/akarnokd/xml/XNElement.java
|
XNElement.set
|
@SuppressWarnings("unchecked")
public <T> T set(T newUserObject) {
T result = (T)userObject;
userObject = newUserObject;
return result;
}
|
java
|
@SuppressWarnings("unchecked")
public <T> T set(T newUserObject) {
T result = (T)userObject;
userObject = newUserObject;
return result;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"set",
"(",
"T",
"newUserObject",
")",
"{",
"T",
"result",
"=",
"(",
"T",
")",
"userObject",
";",
"userObject",
"=",
"newUserObject",
";",
"return",
"result",
";",
"}"
] |
Replace the associated user object with a new object.
@param <T> the object type
@param newUserObject the new user object
@return the original user object
|
[
"Replace",
"the",
"associated",
"user",
"object",
"with",
"a",
"new",
"object",
"."
] |
57466a5a9cb455a13d7121557c165287b31ee870
|
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L1168-L1173
|
150,568
|
jtrfp/javamod
|
src/main/java/de/quippy/ogg/jorbis/CodeBook.java
|
CodeBook.make_decode_tree
|
DecodeAux make_decode_tree(){
int top=0;
DecodeAux t=new DecodeAux();
int[] ptr0=t.ptr0=new int[entries*2];
int[] ptr1=t.ptr1=new int[entries*2];
int[] codelist=make_words(c.lengthlist, c.entries);
if(codelist==null)
return (null);
//t.aux=entries*2;
for(int i=0; i<entries; i++){
if(c.lengthlist[i]>0){
int ptr=0;
int j;
for(j=0; j<c.lengthlist[i]-1; j++){
int bit=(codelist[i]>>>j)&1;
if(bit==0){
if(ptr0[ptr]==0){
ptr0[ptr]=++top;
}
ptr=ptr0[ptr];
}
else{
if(ptr1[ptr]==0){
ptr1[ptr]=++top;
}
ptr=ptr1[ptr];
}
}
if(((codelist[i]>>>j)&1)==0){
ptr0[ptr]=-i;
}
else{
ptr1[ptr]=-i;
}
}
}
t.tabn=Util.ilog(entries)-4;
if(t.tabn<5)
t.tabn=5;
int n=1<<t.tabn;
t.tab=new int[n];
t.tabl=new int[n];
for(int i=0; i<n; i++){
int p=0;
int j=0;
for(j=0; j<t.tabn&&(p>0||j==0); j++){
if((i&(1<<j))!=0){
p=ptr1[p];
}
else{
p=ptr0[p];
}
}
t.tab[i]=p; // -code
t.tabl[i]=j; // length
}
return (t);
}
|
java
|
DecodeAux make_decode_tree(){
int top=0;
DecodeAux t=new DecodeAux();
int[] ptr0=t.ptr0=new int[entries*2];
int[] ptr1=t.ptr1=new int[entries*2];
int[] codelist=make_words(c.lengthlist, c.entries);
if(codelist==null)
return (null);
//t.aux=entries*2;
for(int i=0; i<entries; i++){
if(c.lengthlist[i]>0){
int ptr=0;
int j;
for(j=0; j<c.lengthlist[i]-1; j++){
int bit=(codelist[i]>>>j)&1;
if(bit==0){
if(ptr0[ptr]==0){
ptr0[ptr]=++top;
}
ptr=ptr0[ptr];
}
else{
if(ptr1[ptr]==0){
ptr1[ptr]=++top;
}
ptr=ptr1[ptr];
}
}
if(((codelist[i]>>>j)&1)==0){
ptr0[ptr]=-i;
}
else{
ptr1[ptr]=-i;
}
}
}
t.tabn=Util.ilog(entries)-4;
if(t.tabn<5)
t.tabn=5;
int n=1<<t.tabn;
t.tab=new int[n];
t.tabl=new int[n];
for(int i=0; i<n; i++){
int p=0;
int j=0;
for(j=0; j<t.tabn&&(p>0||j==0); j++){
if((i&(1<<j))!=0){
p=ptr1[p];
}
else{
p=ptr0[p];
}
}
t.tab[i]=p; // -code
t.tabl[i]=j; // length
}
return (t);
}
|
[
"DecodeAux",
"make_decode_tree",
"(",
")",
"{",
"int",
"top",
"=",
"0",
";",
"DecodeAux",
"t",
"=",
"new",
"DecodeAux",
"(",
")",
";",
"int",
"[",
"]",
"ptr0",
"=",
"t",
".",
"ptr0",
"=",
"new",
"int",
"[",
"entries",
"*",
"2",
"]",
";",
"int",
"[",
"]",
"ptr1",
"=",
"t",
".",
"ptr1",
"=",
"new",
"int",
"[",
"entries",
"*",
"2",
"]",
";",
"int",
"[",
"]",
"codelist",
"=",
"make_words",
"(",
"c",
".",
"lengthlist",
",",
"c",
".",
"entries",
")",
";",
"if",
"(",
"codelist",
"==",
"null",
")",
"return",
"(",
"null",
")",
";",
"//t.aux=entries*2;",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"entries",
";",
"i",
"++",
")",
"{",
"if",
"(",
"c",
".",
"lengthlist",
"[",
"i",
"]",
">",
"0",
")",
"{",
"int",
"ptr",
"=",
"0",
";",
"int",
"j",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"c",
".",
"lengthlist",
"[",
"i",
"]",
"-",
"1",
";",
"j",
"++",
")",
"{",
"int",
"bit",
"=",
"(",
"codelist",
"[",
"i",
"]",
">>>",
"j",
")",
"&",
"1",
";",
"if",
"(",
"bit",
"==",
"0",
")",
"{",
"if",
"(",
"ptr0",
"[",
"ptr",
"]",
"==",
"0",
")",
"{",
"ptr0",
"[",
"ptr",
"]",
"=",
"++",
"top",
";",
"}",
"ptr",
"=",
"ptr0",
"[",
"ptr",
"]",
";",
"}",
"else",
"{",
"if",
"(",
"ptr1",
"[",
"ptr",
"]",
"==",
"0",
")",
"{",
"ptr1",
"[",
"ptr",
"]",
"=",
"++",
"top",
";",
"}",
"ptr",
"=",
"ptr1",
"[",
"ptr",
"]",
";",
"}",
"}",
"if",
"(",
"(",
"(",
"codelist",
"[",
"i",
"]",
">>>",
"j",
")",
"&",
"1",
")",
"==",
"0",
")",
"{",
"ptr0",
"[",
"ptr",
"]",
"=",
"-",
"i",
";",
"}",
"else",
"{",
"ptr1",
"[",
"ptr",
"]",
"=",
"-",
"i",
";",
"}",
"}",
"}",
"t",
".",
"tabn",
"=",
"Util",
".",
"ilog",
"(",
"entries",
")",
"-",
"4",
";",
"if",
"(",
"t",
".",
"tabn",
"<",
"5",
")",
"t",
".",
"tabn",
"=",
"5",
";",
"int",
"n",
"=",
"1",
"<<",
"t",
".",
"tabn",
";",
"t",
".",
"tab",
"=",
"new",
"int",
"[",
"n",
"]",
";",
"t",
".",
"tabl",
"=",
"new",
"int",
"[",
"n",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"int",
"p",
"=",
"0",
";",
"int",
"j",
"=",
"0",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"t",
".",
"tabn",
"&&",
"(",
"p",
">",
"0",
"||",
"j",
"==",
"0",
")",
";",
"j",
"++",
")",
"{",
"if",
"(",
"(",
"i",
"&",
"(",
"1",
"<<",
"j",
")",
")",
"!=",
"0",
")",
"{",
"p",
"=",
"ptr1",
"[",
"p",
"]",
";",
"}",
"else",
"{",
"p",
"=",
"ptr0",
"[",
"p",
"]",
";",
"}",
"}",
"t",
".",
"tab",
"[",
"i",
"]",
"=",
"p",
";",
"// -code",
"t",
".",
"tabl",
"[",
"i",
"]",
"=",
"j",
";",
"// length ",
"}",
"return",
"(",
"t",
")",
";",
"}"
] |
build the decode helper tree from the codewords
|
[
"build",
"the",
"decode",
"helper",
"tree",
"from",
"the",
"codewords"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/ogg/jorbis/CodeBook.java#L403-L468
|
150,569
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/mixer/BasicMixer.java
|
BasicMixer.stopPlayback
|
@Override
public void stopPlayback()
{
if (isNotStoppingNorStopped())
{
setIsStopping();
while (!isStopped())
{
try { Thread.sleep(1); } catch (InterruptedException ex) { /*noop*/ }
}
stopLine();
}
}
|
java
|
@Override
public void stopPlayback()
{
if (isNotStoppingNorStopped())
{
setIsStopping();
while (!isStopped())
{
try { Thread.sleep(1); } catch (InterruptedException ex) { /*noop*/ }
}
stopLine();
}
}
|
[
"@",
"Override",
"public",
"void",
"stopPlayback",
"(",
")",
"{",
"if",
"(",
"isNotStoppingNorStopped",
"(",
")",
")",
"{",
"setIsStopping",
"(",
")",
";",
"while",
"(",
"!",
"isStopped",
"(",
")",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"1",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"/*noop*/",
"}",
"}",
"stopLine",
"(",
")",
";",
"}",
"}"
] |
Stopps the playback.
Will wait until stopp is done
@since 22.06.2006
|
[
"Stopps",
"the",
"playback",
".",
"Will",
"wait",
"until",
"stopp",
"is",
"done"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/mixer/BasicMixer.java#L220-L232
|
150,570
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/mixer/BasicMixer.java
|
BasicMixer.pausePlayback
|
@Override
public void pausePlayback()
{
if (isNotPausingNorPaused() && isNotStoppingNorStopped())
{
setIsPausing();
while (!isPaused() && !isStopped())
{
try { Thread.sleep(1); } catch (InterruptedException ex) { /*noop*/ }
}
stopLine();
}
else
if (isPaused())
{
startLine();
setIsPlaying();
}
}
|
java
|
@Override
public void pausePlayback()
{
if (isNotPausingNorPaused() && isNotStoppingNorStopped())
{
setIsPausing();
while (!isPaused() && !isStopped())
{
try { Thread.sleep(1); } catch (InterruptedException ex) { /*noop*/ }
}
stopLine();
}
else
if (isPaused())
{
startLine();
setIsPlaying();
}
}
|
[
"@",
"Override",
"public",
"void",
"pausePlayback",
"(",
")",
"{",
"if",
"(",
"isNotPausingNorPaused",
"(",
")",
"&&",
"isNotStoppingNorStopped",
"(",
")",
")",
"{",
"setIsPausing",
"(",
")",
";",
"while",
"(",
"!",
"isPaused",
"(",
")",
"&&",
"!",
"isStopped",
"(",
")",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"1",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"/*noop*/",
"}",
"}",
"stopLine",
"(",
")",
";",
"}",
"else",
"if",
"(",
"isPaused",
"(",
")",
")",
"{",
"startLine",
"(",
")",
";",
"setIsPlaying",
"(",
")",
";",
"}",
"}"
] |
Halts the playback
Will wait until playback halted
@since 22.06.2006
|
[
"Halts",
"the",
"playback",
"Will",
"wait",
"until",
"playback",
"halted"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/mixer/BasicMixer.java#L238-L256
|
150,571
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/util/DirectoryWalker.java
|
DirectoryWalker.start
|
public ISynchronizationPoint<IOException> start(byte priority, WorkProgress progress, long work) {
JoinPoint<IOException> jp = new JoinPoint<>();
jp.addToJoin(1);
processDirectory("", root, rootObject, jp, priority, progress, work);
jp.start();
return jp;
}
|
java
|
public ISynchronizationPoint<IOException> start(byte priority, WorkProgress progress, long work) {
JoinPoint<IOException> jp = new JoinPoint<>();
jp.addToJoin(1);
processDirectory("", root, rootObject, jp, priority, progress, work);
jp.start();
return jp;
}
|
[
"public",
"ISynchronizationPoint",
"<",
"IOException",
">",
"start",
"(",
"byte",
"priority",
",",
"WorkProgress",
"progress",
",",
"long",
"work",
")",
"{",
"JoinPoint",
"<",
"IOException",
">",
"jp",
"=",
"new",
"JoinPoint",
"<>",
"(",
")",
";",
"jp",
".",
"addToJoin",
"(",
"1",
")",
";",
"processDirectory",
"(",
"\"\"",
",",
"root",
",",
"rootObject",
",",
"jp",
",",
"priority",
",",
"progress",
",",
"work",
")",
";",
"jp",
".",
"start",
"(",
")",
";",
"return",
"jp",
";",
"}"
] |
Start the directory analysis.
|
[
"Start",
"the",
"directory",
"analysis",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/DirectoryWalker.java#L47-L53
|
150,572
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/math/MathUtils.java
|
MathUtils.getRHD
|
public static <N extends Number> int getRHD(N number) {
String numberAsString = String.valueOf(number);
return numberAsString.substring(numberAsString.lastIndexOf('.') + 1).length();
}
|
java
|
public static <N extends Number> int getRHD(N number) {
String numberAsString = String.valueOf(number);
return numberAsString.substring(numberAsString.lastIndexOf('.') + 1).length();
}
|
[
"public",
"static",
"<",
"N",
"extends",
"Number",
">",
"int",
"getRHD",
"(",
"N",
"number",
")",
"{",
"String",
"numberAsString",
"=",
"String",
".",
"valueOf",
"(",
"number",
")",
";",
"return",
"numberAsString",
".",
"substring",
"(",
"numberAsString",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
".",
"length",
"(",
")",
";",
"}"
] |
Returns the number of places after the decimal separator of the given
number.
@param <N> Number type
@param number Basic number for operation
@return The number of places after the decimal separator of
<code>number</code>
|
[
"Returns",
"the",
"number",
"of",
"places",
"after",
"the",
"decimal",
"separator",
"of",
"the",
"given",
"number",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/math/MathUtils.java#L85-L88
|
150,573
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.notEmpty
|
public static <O extends Object> void notEmpty(Iterable<O> coll) {
if(!validation) return;
notNull(coll);
if(!coll.iterator().hasNext())
throw new ParameterException(ErrorCode.EMPTY);
}
|
java
|
public static <O extends Object> void notEmpty(Iterable<O> coll) {
if(!validation) return;
notNull(coll);
if(!coll.iterator().hasNext())
throw new ParameterException(ErrorCode.EMPTY);
}
|
[
"public",
"static",
"<",
"O",
"extends",
"Object",
">",
"void",
"notEmpty",
"(",
"Iterable",
"<",
"O",
">",
"coll",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"coll",
")",
";",
"if",
"(",
"!",
"coll",
".",
"iterator",
"(",
")",
".",
"hasNext",
"(",
")",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"EMPTY",
")",
";",
"}"
] |
Checks if the given iterable object is empty.
@param coll The iterable object to validate.
@throws ParameterException if the given object is empty.
|
[
"Checks",
"if",
"the",
"given",
"iterable",
"object",
"is",
"empty",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L88-L93
|
150,574
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.notEmpty
|
public static <O extends Object> void notEmpty(O[] arr) {
if(!validation) return;
notNull(arr);
if(arr.length == 0)
throw new ParameterException(ErrorCode.EMPTY);
}
|
java
|
public static <O extends Object> void notEmpty(O[] arr) {
if(!validation) return;
notNull(arr);
if(arr.length == 0)
throw new ParameterException(ErrorCode.EMPTY);
}
|
[
"public",
"static",
"<",
"O",
"extends",
"Object",
">",
"void",
"notEmpty",
"(",
"O",
"[",
"]",
"arr",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"arr",
")",
";",
"if",
"(",
"arr",
".",
"length",
"==",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"EMPTY",
")",
";",
"}"
] |
Checks if the given array is empty.
@param arr The array to validate.
@throws ParameterException if the given array is empty.
|
[
"Checks",
"if",
"the",
"given",
"array",
"is",
"empty",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L100-L105
|
150,575
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.bigger
|
public static <T extends Object> void bigger(Comparable<T> value, T reference) {
if(!validation) return;
Validate.notNull(value);
Validate.notNull(reference);
if(value.compareTo(reference) <= 0)
throw new ParameterException(ErrorCode.RANGEVIOLATION, "Parameter is smaller or equal "+reference);
}
|
java
|
public static <T extends Object> void bigger(Comparable<T> value, T reference) {
if(!validation) return;
Validate.notNull(value);
Validate.notNull(reference);
if(value.compareTo(reference) <= 0)
throw new ParameterException(ErrorCode.RANGEVIOLATION, "Parameter is smaller or equal "+reference);
}
|
[
"public",
"static",
"<",
"T",
"extends",
"Object",
">",
"void",
"bigger",
"(",
"Comparable",
"<",
"T",
">",
"value",
",",
"T",
"reference",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"Validate",
".",
"notNull",
"(",
"value",
")",
";",
"Validate",
".",
"notNull",
"(",
"reference",
")",
";",
"if",
"(",
"value",
".",
"compareTo",
"(",
"reference",
")",
"<=",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"RANGEVIOLATION",
",",
"\"Parameter is smaller or equal \"",
"+",
"reference",
")",
";",
"}"
] |
Checks if the given value is bigger than the reference value.
@param value The value to validate.
@param reference The reference value to check against.
@throws ParameterException if one of the parameters is <code>null</code> of the value is smaller or equal to the reference value.
|
[
"Checks",
"if",
"the",
"given",
"value",
"is",
"bigger",
"than",
"the",
"reference",
"value",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L240-L246
|
150,576
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.type
|
public static <T,V extends Object> void type(V value, Class<T> type) {
if(!validation) return;
notNull(value);
notNull(type);
if(!type.isAssignableFrom(value.getClass())){
throw new TypeException(type.getCanonicalName());
}
}
|
java
|
public static <T,V extends Object> void type(V value, Class<T> type) {
if(!validation) return;
notNull(value);
notNull(type);
if(!type.isAssignableFrom(value.getClass())){
throw new TypeException(type.getCanonicalName());
}
}
|
[
"public",
"static",
"<",
"T",
",",
"V",
"extends",
"Object",
">",
"void",
"type",
"(",
"V",
"value",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"value",
")",
";",
"notNull",
"(",
"type",
")",
";",
"if",
"(",
"!",
"type",
".",
"isAssignableFrom",
"(",
"value",
".",
"getClass",
"(",
")",
")",
")",
"{",
"throw",
"new",
"TypeException",
"(",
"type",
".",
"getCanonicalName",
"(",
")",
")",
";",
"}",
"}"
] |
Checks if a given value has a specific type.
@param value The value to validate.
@param type The target type for the given value.
@throws ParameterException if the type of the given value is not a valid subclass of the target type.
|
[
"Checks",
"if",
"a",
"given",
"value",
"has",
"a",
"specific",
"type",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L401-L408
|
150,577
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.type
|
public static <T,V extends Object> void type(Collection<V> valueColl, Class<T> type) {
for(V value: valueColl)
type(value, type);
}
//------- Numerical checks ----------------------------------------------------------------------------
//------- Integer --------------------------------
/**
* Checks if the given integer is positive.
* @param value The integer value to validate.
* @throws ParameterException if the given integer value is <code>null</code> or smaller/equal to 0.
*/
public static void positive(Integer value) {
if(!validation) return;
notNull(value);
if(value <= 0)
throw new ParameterException(ErrorCode.NOTPOSITIVE);
}
|
java
|
public static <T,V extends Object> void type(Collection<V> valueColl, Class<T> type) {
for(V value: valueColl)
type(value, type);
}
//------- Numerical checks ----------------------------------------------------------------------------
//------- Integer --------------------------------
/**
* Checks if the given integer is positive.
* @param value The integer value to validate.
* @throws ParameterException if the given integer value is <code>null</code> or smaller/equal to 0.
*/
public static void positive(Integer value) {
if(!validation) return;
notNull(value);
if(value <= 0)
throw new ParameterException(ErrorCode.NOTPOSITIVE);
}
|
[
"public",
"static",
"<",
"T",
",",
"V",
"extends",
"Object",
">",
"void",
"type",
"(",
"Collection",
"<",
"V",
">",
"valueColl",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"for",
"(",
"V",
"value",
":",
"valueColl",
")",
"type",
"(",
"value",
",",
"type",
")",
";",
"}",
"//------- Numerical checks ----------------------------------------------------------------------------",
"//------- Integer --------------------------------",
"/**\n\t * Checks if the given integer is positive.\n\t * @param value The integer value to validate.\n\t * @throws ParameterException if the given integer value is <code>null</code> or smaller/equal to 0.\n\t */",
"public",
"static",
"void",
"positive",
"(",
"Integer",
"value",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"value",
")",
";",
"if",
"(",
"value",
"<=",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"NOTPOSITIVE",
")",
";",
"}"
] |
Checks if the elements of a given collection have a specific type.
@param valueColl The collection of elements to validate.
@param type The target type.
@throws ParameterException if the type of at least one element is not a valid subclass of the target type.
|
[
"Checks",
"if",
"the",
"elements",
"of",
"a",
"given",
"collection",
"have",
"a",
"specific",
"type",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L416-L435
|
150,578
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.notPositive
|
public static void notPositive(Integer value) {
if(!validation) return;
notNull(value);
if(value > 0)
throw new ParameterException(ErrorCode.POSITIVE);
}
|
java
|
public static void notPositive(Integer value) {
if(!validation) return;
notNull(value);
if(value > 0)
throw new ParameterException(ErrorCode.POSITIVE);
}
|
[
"public",
"static",
"void",
"notPositive",
"(",
"Integer",
"value",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"value",
")",
";",
"if",
"(",
"value",
">",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"POSITIVE",
")",
";",
"}"
] |
Checks if the given integer is NOT positive.
@param value The integer value to validate.
@throws ParameterException if the given integer value is <code>null</code> or bigger than 0.
|
[
"Checks",
"if",
"the",
"given",
"integer",
"is",
"NOT",
"positive",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L442-L447
|
150,579
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.notNegative
|
public static void notNegative(Integer value) {
if(!validation) return;
Validate.notNull(value);
if(value < 0)
throw new ParameterException(ErrorCode.NEGATIVE);
}
|
java
|
public static void notNegative(Integer value) {
if(!validation) return;
Validate.notNull(value);
if(value < 0)
throw new ParameterException(ErrorCode.NEGATIVE);
}
|
[
"public",
"static",
"void",
"notNegative",
"(",
"Integer",
"value",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"Validate",
".",
"notNull",
"(",
"value",
")",
";",
"if",
"(",
"value",
"<",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"NEGATIVE",
")",
";",
"}"
] |
Checks if the given integer is NOT negative.
@param value The integer value to validate.
@throws ParameterException if the given integer value is <code>null</code> or smaller than 0.
|
[
"Checks",
"if",
"the",
"given",
"integer",
"is",
"NOT",
"negative",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L494-L499
|
150,580
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.positive
|
public static void positive(Long value) {
if(!validation) return;
notNull(value);
if(value <= 0)
throw new ParameterException(ErrorCode.NOTPOSITIVE);
}
|
java
|
public static void positive(Long value) {
if(!validation) return;
notNull(value);
if(value <= 0)
throw new ParameterException(ErrorCode.NOTPOSITIVE);
}
|
[
"public",
"static",
"void",
"positive",
"(",
"Long",
"value",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"value",
")",
";",
"if",
"(",
"value",
"<=",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"NOTPOSITIVE",
")",
";",
"}"
] |
Checks if the given long value is positive.
@param value The long value to validate.
@throws ParameterException if the given long value is <code>null</code> or smaller/equal to 0.
|
[
"Checks",
"if",
"the",
"given",
"long",
"value",
"is",
"positive",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L522-L527
|
150,581
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.notPositive
|
public static void notPositive(Long value) {
if(!validation) return;
notNull(value);
if(value > 0)
throw new ParameterException(ErrorCode.POSITIVE);
}
|
java
|
public static void notPositive(Long value) {
if(!validation) return;
notNull(value);
if(value > 0)
throw new ParameterException(ErrorCode.POSITIVE);
}
|
[
"public",
"static",
"void",
"notPositive",
"(",
"Long",
"value",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"value",
")",
";",
"if",
"(",
"value",
">",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"POSITIVE",
")",
";",
"}"
] |
Checks if the given long is NOT positive.
@param value The long value to validate.
@throws ParameterException if the given long value is <code>null</code> or bigger than 0.
|
[
"Checks",
"if",
"the",
"given",
"long",
"is",
"NOT",
"positive",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L534-L539
|
150,582
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.notPositive
|
public static void notPositive(Long value, String message) {
if(!validation) return;
notNull(value);
notNull(message);
if(value > 0)
throw new ParameterException(ErrorCode.POSITIVE, message);
}
|
java
|
public static void notPositive(Long value, String message) {
if(!validation) return;
notNull(value);
notNull(message);
if(value > 0)
throw new ParameterException(ErrorCode.POSITIVE, message);
}
|
[
"public",
"static",
"void",
"notPositive",
"(",
"Long",
"value",
",",
"String",
"message",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"value",
")",
";",
"notNull",
"(",
"message",
")",
";",
"if",
"(",
"value",
">",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"POSITIVE",
",",
"message",
")",
";",
"}"
] |
Checks if the given long value is NOT positive.
@param value The long value to validate.
@param message The error message to include in the exception in case the validation fails.
@throws ParameterException if the given long value is <code>null</code> or bigger than 0.
|
[
"Checks",
"if",
"the",
"given",
"long",
"value",
"is",
"NOT",
"positive",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L547-L553
|
150,583
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.notNegative
|
public static void notNegative(Long value) {
if(!validation) return;
notNull(value);
if(value < 0)
throw new ParameterException(ErrorCode.NEGATIVE);
}
|
java
|
public static void notNegative(Long value) {
if(!validation) return;
notNull(value);
if(value < 0)
throw new ParameterException(ErrorCode.NEGATIVE);
}
|
[
"public",
"static",
"void",
"notNegative",
"(",
"Long",
"value",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"value",
")",
";",
"if",
"(",
"value",
"<",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"NEGATIVE",
")",
";",
"}"
] |
Checks if the given long value is NOT negative.
@param value The long value to validate.
@throws ParameterException if the given long value is <code>null</code> or smaller than 0.
|
[
"Checks",
"if",
"the",
"given",
"long",
"value",
"is",
"NOT",
"negative",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L586-L591
|
150,584
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.positive
|
public static void positive(Double value) {
if(!validation) return;
notNull(value);
if(value <= 0)
throw new ParameterException(ErrorCode.NOTPOSITIVE);
}
|
java
|
public static void positive(Double value) {
if(!validation) return;
notNull(value);
if(value <= 0)
throw new ParameterException(ErrorCode.NOTPOSITIVE);
}
|
[
"public",
"static",
"void",
"positive",
"(",
"Double",
"value",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"value",
")",
";",
"if",
"(",
"value",
"<=",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"NOTPOSITIVE",
")",
";",
"}"
] |
Checks if the given double value is positive.
@param value The double value to validate.
@throws ParameterException if the given double value is <code>null</code> or smaller/equal to 0.
|
[
"Checks",
"if",
"the",
"given",
"double",
"value",
"is",
"positive",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L614-L619
|
150,585
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.notPositive
|
public static void notPositive(Double value) {
if(!validation) return;
notNull(value);
if(value > 0)
throw new ParameterException(ErrorCode.POSITIVE);
}
|
java
|
public static void notPositive(Double value) {
if(!validation) return;
notNull(value);
if(value > 0)
throw new ParameterException(ErrorCode.POSITIVE);
}
|
[
"public",
"static",
"void",
"notPositive",
"(",
"Double",
"value",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"value",
")",
";",
"if",
"(",
"value",
">",
"0",
")",
"throw",
"new",
"ParameterException",
"(",
"ErrorCode",
".",
"POSITIVE",
")",
";",
"}"
] |
Checks if the given double is NOT positive.
@param value The double value to validate.
@throws ParameterException if the given double value is <code>null</code> or bigger than 0.
|
[
"Checks",
"if",
"the",
"given",
"double",
"is",
"NOT",
"positive",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L626-L631
|
150,586
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.isInteger
|
public static Integer isInteger(String value) {
Validate.notNull(value);
Validate.notEmpty(value);
Integer intValue = null;
try{
intValue = Integer.parseInt(value);
} catch(NumberFormatException e){
throw new TypeException("Integer");
}
return intValue;
}
|
java
|
public static Integer isInteger(String value) {
Validate.notNull(value);
Validate.notEmpty(value);
Integer intValue = null;
try{
intValue = Integer.parseInt(value);
} catch(NumberFormatException e){
throw new TypeException("Integer");
}
return intValue;
}
|
[
"public",
"static",
"Integer",
"isInteger",
"(",
"String",
"value",
")",
"{",
"Validate",
".",
"notNull",
"(",
"value",
")",
";",
"Validate",
".",
"notEmpty",
"(",
"value",
")",
";",
"Integer",
"intValue",
"=",
"null",
";",
"try",
"{",
"intValue",
"=",
"Integer",
".",
"parseInt",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"throw",
"new",
"TypeException",
"(",
"\"Integer\"",
")",
";",
"}",
"return",
"intValue",
";",
"}"
] |
Checks if the given String is an integer value.
@param value The String value to validate.
@return The parsed integer value.
@throws ParameterException if the given String value cannot be parsed as integer.
|
[
"Checks",
"if",
"the",
"given",
"String",
"is",
"an",
"integer",
"value",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L707-L717
|
150,587
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.isDouble
|
public static Double isDouble(String value) {
Validate.notNull(value);
Validate.notEmpty(value);
Double doubleValue = null;
try{
doubleValue = Double.parseDouble(value);
} catch(NumberFormatException e){
throw new TypeException("Double");
}
return doubleValue;
}
|
java
|
public static Double isDouble(String value) {
Validate.notNull(value);
Validate.notEmpty(value);
Double doubleValue = null;
try{
doubleValue = Double.parseDouble(value);
} catch(NumberFormatException e){
throw new TypeException("Double");
}
return doubleValue;
}
|
[
"public",
"static",
"Double",
"isDouble",
"(",
"String",
"value",
")",
"{",
"Validate",
".",
"notNull",
"(",
"value",
")",
";",
"Validate",
".",
"notEmpty",
"(",
"value",
")",
";",
"Double",
"doubleValue",
"=",
"null",
";",
"try",
"{",
"doubleValue",
"=",
"Double",
".",
"parseDouble",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"throw",
"new",
"TypeException",
"(",
"\"Double\"",
")",
";",
"}",
"return",
"doubleValue",
";",
"}"
] |
Checks if the given String is a double value.
@param value The String value to validate.
@return The parsed double value.
@throws ParameterException if the given String value cannot be parsed as double.
|
[
"Checks",
"if",
"the",
"given",
"String",
"is",
"a",
"double",
"value",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L725-L735
|
150,588
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.directory
|
public static File directory(File file) {
Validate.exists(file);
if(!file.isDirectory())
throw new ParameterException("\""+file+"\" is not a directory!");
return file;
}
|
java
|
public static File directory(File file) {
Validate.exists(file);
if(!file.isDirectory())
throw new ParameterException("\""+file+"\" is not a directory!");
return file;
}
|
[
"public",
"static",
"File",
"directory",
"(",
"File",
"file",
")",
"{",
"Validate",
".",
"exists",
"(",
"file",
")",
";",
"if",
"(",
"!",
"file",
".",
"isDirectory",
"(",
")",
")",
"throw",
"new",
"ParameterException",
"(",
"\"\\\"\"",
"+",
"file",
"+",
"\"\\\" is not a directory!\"",
")",
";",
"return",
"file",
";",
"}"
] |
Checks if the given file exists and is a directory.
@param file The file to validate.
@return The validated file reference.
@throws ParameterException if the file does not exist or is not a directory.
|
[
"Checks",
"if",
"the",
"given",
"file",
"exists",
"and",
"is",
"a",
"directory",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L980-L985
|
150,589
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/validate/Validate.java
|
Validate.noDirectory
|
public static File noDirectory(File file) {
Validate.exists(file);
if(file.isDirectory())
throw new ParameterException("\""+file+"\" is a directory!");
return file;
}
|
java
|
public static File noDirectory(File file) {
Validate.exists(file);
if(file.isDirectory())
throw new ParameterException("\""+file+"\" is a directory!");
return file;
}
|
[
"public",
"static",
"File",
"noDirectory",
"(",
"File",
"file",
")",
"{",
"Validate",
".",
"exists",
"(",
"file",
")",
";",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"throw",
"new",
"ParameterException",
"(",
"\"\\\"\"",
"+",
"file",
"+",
"\"\\\" is a directory!\"",
")",
";",
"return",
"file",
";",
"}"
] |
Checks if the given file exists and is not a directory.
@param file The file to validate.
@return The validated file reference.
@throws ParameterException if the file exists or is a directory.
|
[
"Checks",
"if",
"the",
"given",
"file",
"exists",
"and",
"is",
"not",
"a",
"directory",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L1006-L1011
|
150,590
|
actorapp/droidkit-actors
|
actors/src/main/java/com/droidkit/actors/dispatch/ThreadPoolDispatcher.java
|
ThreadPoolDispatcher.notifyDispatcher
|
@Override
protected void notifyDispatcher() {
if (threads != null) {
synchronized (threads) {
threads.notifyAll();
for (Thread thread : threads) {
((DispatcherThread) thread).setChanged(true);
}
}
}
}
|
java
|
@Override
protected void notifyDispatcher() {
if (threads != null) {
synchronized (threads) {
threads.notifyAll();
for (Thread thread : threads) {
((DispatcherThread) thread).setChanged(true);
}
}
}
}
|
[
"@",
"Override",
"protected",
"void",
"notifyDispatcher",
"(",
")",
"{",
"if",
"(",
"threads",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"threads",
")",
"{",
"threads",
".",
"notifyAll",
"(",
")",
";",
"for",
"(",
"Thread",
"thread",
":",
"threads",
")",
"{",
"(",
"(",
"DispatcherThread",
")",
"thread",
")",
".",
"setChanged",
"(",
"true",
")",
";",
"}",
"}",
"}",
"}"
] |
Notification about queue change
|
[
"Notification",
"about",
"queue",
"change"
] |
fdb72fcfdd1c5e54a970f203a33a71fa54344217
|
https://github.com/actorapp/droidkit-actors/blob/fdb72fcfdd1c5e54a970f203a33a71fa54344217/actors/src/main/java/com/droidkit/actors/dispatch/ThreadPoolDispatcher.java#L112-L122
|
150,591
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/SLP.java
|
SLP.newUserAgent
|
public static UserAgent newUserAgent(Settings settings)
{
UserAgent.Factory factory = Factories.newInstance(settings, Keys.UA_FACTORY_KEY);
return factory.newUserAgent(settings);
}
|
java
|
public static UserAgent newUserAgent(Settings settings)
{
UserAgent.Factory factory = Factories.newInstance(settings, Keys.UA_FACTORY_KEY);
return factory.newUserAgent(settings);
}
|
[
"public",
"static",
"UserAgent",
"newUserAgent",
"(",
"Settings",
"settings",
")",
"{",
"UserAgent",
".",
"Factory",
"factory",
"=",
"Factories",
".",
"newInstance",
"(",
"settings",
",",
"Keys",
".",
"UA_FACTORY_KEY",
")",
";",
"return",
"factory",
".",
"newUserAgent",
"(",
"settings",
")",
";",
"}"
] |
Creates a new UserAgent with the given configuration; the UserAgent must be started.
@param settings the configuration for the UserAgent
@return a new UserAgent with the given configuration
|
[
"Creates",
"a",
"new",
"UserAgent",
"with",
"the",
"given",
"configuration",
";",
"the",
"UserAgent",
"must",
"be",
"started",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/SLP.java#L48-L52
|
150,592
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/SLP.java
|
SLP.newServiceAgent
|
public static ServiceAgent newServiceAgent(Settings settings)
{
ServiceAgent.Factory factory = Factories.newInstance(settings, Keys.SA_FACTORY_KEY);
return factory.newServiceAgent(settings);
}
|
java
|
public static ServiceAgent newServiceAgent(Settings settings)
{
ServiceAgent.Factory factory = Factories.newInstance(settings, Keys.SA_FACTORY_KEY);
return factory.newServiceAgent(settings);
}
|
[
"public",
"static",
"ServiceAgent",
"newServiceAgent",
"(",
"Settings",
"settings",
")",
"{",
"ServiceAgent",
".",
"Factory",
"factory",
"=",
"Factories",
".",
"newInstance",
"(",
"settings",
",",
"Keys",
".",
"SA_FACTORY_KEY",
")",
";",
"return",
"factory",
".",
"newServiceAgent",
"(",
"settings",
")",
";",
"}"
] |
Creates a new ServiceAgent with the given configuration; the ServiceAgent must be started.
@param settings the configuration for the ServiceAgent
@return a new ServiceAgent with the given configuration
|
[
"Creates",
"a",
"new",
"ServiceAgent",
"with",
"the",
"given",
"configuration",
";",
"the",
"ServiceAgent",
"must",
"be",
"started",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/SLP.java#L70-L74
|
150,593
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/info/FileValidator.java
|
FileValidator.validate
|
protected void validate(File file, ValidationOptions option){
if(!file.exists()){
this.errors.addError("file <{}> does not exist in file system", file.getAbsolutePath());
}
else if(!file.isFile()){
this.errors.addError("file <{}> is not a file", file.getAbsolutePath());
}
if(file.isHidden()){
this.errors.addError("file <{}> is a hidden file", file.getAbsolutePath());
}
else{
switch(option){
case AS_SOURCE:
if(!file.canRead()){
this.errors.addError("file <{}> is not readable", file.getAbsolutePath());
}
break;
case AS_SOURCE_AND_TARGET:
if(!file.canRead()){
this.errors.addError("file <{}> is not readable", file.getAbsolutePath());
}
if(!file.canWrite()){
this.errors.addError("file <{}> is not writable", file.getAbsolutePath());
}
break;
case AS_TARGET:
if(!file.canWrite()){
this.errors.addError("file <{}> is not writable", file.getAbsolutePath());
}
break;
}
}
}
|
java
|
protected void validate(File file, ValidationOptions option){
if(!file.exists()){
this.errors.addError("file <{}> does not exist in file system", file.getAbsolutePath());
}
else if(!file.isFile()){
this.errors.addError("file <{}> is not a file", file.getAbsolutePath());
}
if(file.isHidden()){
this.errors.addError("file <{}> is a hidden file", file.getAbsolutePath());
}
else{
switch(option){
case AS_SOURCE:
if(!file.canRead()){
this.errors.addError("file <{}> is not readable", file.getAbsolutePath());
}
break;
case AS_SOURCE_AND_TARGET:
if(!file.canRead()){
this.errors.addError("file <{}> is not readable", file.getAbsolutePath());
}
if(!file.canWrite()){
this.errors.addError("file <{}> is not writable", file.getAbsolutePath());
}
break;
case AS_TARGET:
if(!file.canWrite()){
this.errors.addError("file <{}> is not writable", file.getAbsolutePath());
}
break;
}
}
}
|
[
"protected",
"void",
"validate",
"(",
"File",
"file",
",",
"ValidationOptions",
"option",
")",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"file <{}> does not exist in file system\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"!",
"file",
".",
"isFile",
"(",
")",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"file <{}> is not a file\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"if",
"(",
"file",
".",
"isHidden",
"(",
")",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"file <{}> is a hidden file\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"else",
"{",
"switch",
"(",
"option",
")",
"{",
"case",
"AS_SOURCE",
":",
"if",
"(",
"!",
"file",
".",
"canRead",
"(",
")",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"file <{}> is not readable\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"break",
";",
"case",
"AS_SOURCE_AND_TARGET",
":",
"if",
"(",
"!",
"file",
".",
"canRead",
"(",
")",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"file <{}> is not readable\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"file",
".",
"canWrite",
"(",
")",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"file <{}> is not writable\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"break",
";",
"case",
"AS_TARGET",
":",
"if",
"(",
"!",
"file",
".",
"canWrite",
"(",
")",
")",
"{",
"this",
".",
"errors",
".",
"addError",
"(",
"\"file <{}> is not writable\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"break",
";",
"}",
"}",
"}"
] |
Does the actual validation.
@param file file to validate
@param option validation options
|
[
"Does",
"the",
"actual",
"validation",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/FileValidator.java#L79-L111
|
150,594
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/bucket/hashfunction/util/RangeHashSorter.java
|
RangeHashSorter.insertionSort
|
private void insertionSort(int left, int right) {
for (int p = left + 1; p <= right; p++) {
byte[] tmpRange = ranges[p];
String tmpFilename = filenames[p];
int j;
for (j = p; j > left && KeyUtils.compareKey(tmpRange, ranges[j - 1]) < 0; j--) {
ranges[j] = ranges[j - 1];
filenames[j] = filenames[j - 1];
}
ranges[j] = tmpRange;
filenames[j] = tmpFilename;
}
}
|
java
|
private void insertionSort(int left, int right) {
for (int p = left + 1; p <= right; p++) {
byte[] tmpRange = ranges[p];
String tmpFilename = filenames[p];
int j;
for (j = p; j > left && KeyUtils.compareKey(tmpRange, ranges[j - 1]) < 0; j--) {
ranges[j] = ranges[j - 1];
filenames[j] = filenames[j - 1];
}
ranges[j] = tmpRange;
filenames[j] = tmpFilename;
}
}
|
[
"private",
"void",
"insertionSort",
"(",
"int",
"left",
",",
"int",
"right",
")",
"{",
"for",
"(",
"int",
"p",
"=",
"left",
"+",
"1",
";",
"p",
"<=",
"right",
";",
"p",
"++",
")",
"{",
"byte",
"[",
"]",
"tmpRange",
"=",
"ranges",
"[",
"p",
"]",
";",
"String",
"tmpFilename",
"=",
"filenames",
"[",
"p",
"]",
";",
"int",
"j",
";",
"for",
"(",
"j",
"=",
"p",
";",
"j",
">",
"left",
"&&",
"KeyUtils",
".",
"compareKey",
"(",
"tmpRange",
",",
"ranges",
"[",
"j",
"-",
"1",
"]",
")",
"<",
"0",
";",
"j",
"--",
")",
"{",
"ranges",
"[",
"j",
"]",
"=",
"ranges",
"[",
"j",
"-",
"1",
"]",
";",
"filenames",
"[",
"j",
"]",
"=",
"filenames",
"[",
"j",
"-",
"1",
"]",
";",
"}",
"ranges",
"[",
"j",
"]",
"=",
"tmpRange",
";",
"filenames",
"[",
"j",
"]",
"=",
"tmpFilename",
";",
"}",
"}"
] |
Internal insertion sort routine for subarrays of ranges that is used by quicksort.
@param left
the left-most index of the subarray.
@param right
the right-most index of the subarray.
|
[
"Internal",
"insertion",
"sort",
"routine",
"for",
"subarrays",
"of",
"ranges",
"that",
"is",
"used",
"by",
"quicksort",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/util/RangeHashSorter.java#L118-L131
|
150,595
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/bucket/hashfunction/util/RangeHashSorter.java
|
RangeHashSorter.swap
|
protected void swap(int i, int j) {
byte[] ltemp = ranges[i];
ranges[i] = ranges[j];
ranges[j] = ltemp;
String tempFilename = filenames[i];
filenames[i] = filenames[j];
filenames[j] = tempFilename;
}
|
java
|
protected void swap(int i, int j) {
byte[] ltemp = ranges[i];
ranges[i] = ranges[j];
ranges[j] = ltemp;
String tempFilename = filenames[i];
filenames[i] = filenames[j];
filenames[j] = tempFilename;
}
|
[
"protected",
"void",
"swap",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"byte",
"[",
"]",
"ltemp",
"=",
"ranges",
"[",
"i",
"]",
";",
"ranges",
"[",
"i",
"]",
"=",
"ranges",
"[",
"j",
"]",
";",
"ranges",
"[",
"j",
"]",
"=",
"ltemp",
";",
"String",
"tempFilename",
"=",
"filenames",
"[",
"i",
"]",
";",
"filenames",
"[",
"i",
"]",
"=",
"filenames",
"[",
"j",
"]",
";",
"filenames",
"[",
"j",
"]",
"=",
"tempFilename",
";",
"}"
] |
Swaps the elements of the ith position with the elements of the jth position of all three arrays.
|
[
"Swaps",
"the",
"elements",
"of",
"the",
"ith",
"position",
"with",
"the",
"elements",
"of",
"the",
"jth",
"position",
"of",
"all",
"three",
"arrays",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/bucket/hashfunction/util/RangeHashSorter.java#L134-L142
|
150,596
|
danidemi/jlubricant
|
jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/hsql/core/HsqlDatabaseDescriptor.java
|
HsqlDatabaseDescriptor.postStartSetUp
|
public void postStartSetUp() throws SQLException {
PostStartContribution poll;
while( (poll = postStartContributions.poll()) != null){
poll.apply(this);
}
}
|
java
|
public void postStartSetUp() throws SQLException {
PostStartContribution poll;
while( (poll = postStartContributions.poll()) != null){
poll.apply(this);
}
}
|
[
"public",
"void",
"postStartSetUp",
"(",
")",
"throws",
"SQLException",
"{",
"PostStartContribution",
"poll",
";",
"while",
"(",
"(",
"poll",
"=",
"postStartContributions",
".",
"poll",
"(",
")",
")",
"!=",
"null",
")",
"{",
"poll",
".",
"apply",
"(",
"this",
")",
";",
"}",
"}"
] |
Invoked after server has started up. Here the database can connect to himself.
|
[
"Invoked",
"after",
"server",
"has",
"started",
"up",
".",
"Here",
"the",
"database",
"can",
"connect",
"to",
"himself",
"."
] |
a9937c141c69ec34b768bd603b8093e496329b3a
|
https://github.com/danidemi/jlubricant/blob/a9937c141c69ec34b768bd603b8093e496329b3a/jlubricant-embeddable-hsql/src/main/java/com/danidemi/jlubricant/embeddable/hsql/core/HsqlDatabaseDescriptor.java#L112-L119
|
150,597
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/sync/SyncManager.java
|
SyncManager.bucketsEmpty
|
private boolean bucketsEmpty() {
for (int i = 0; i < numberOfBuckets; i++) {
if (bucketContainer.getBucket(i).elementsInBucket > 0) {
return false;
}
}
return true;
}
|
java
|
private boolean bucketsEmpty() {
for (int i = 0; i < numberOfBuckets; i++) {
if (bucketContainer.getBucket(i).elementsInBucket > 0) {
return false;
}
}
return true;
}
|
[
"private",
"boolean",
"bucketsEmpty",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numberOfBuckets",
";",
"i",
"++",
")",
"{",
"if",
"(",
"bucketContainer",
".",
"getBucket",
"(",
"i",
")",
".",
"elementsInBucket",
">",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
checks, if the buckets are empty. Returns true only if all buckets are empty.
@return true only if all buckets are empty
|
[
"checks",
"if",
"the",
"buckets",
"are",
"empty",
".",
"Returns",
"true",
"only",
"if",
"all",
"buckets",
"are",
"empty",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/sync/SyncManager.java#L189-L196
|
150,598
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java
|
StandardDirectoryAgentServer.matchServices
|
protected List<ServiceInfo> matchServices(ServiceType serviceType, String language, Scopes scopes, String filter)
{
if (logger.isLoggable(Level.FINEST))
logger.finest("DirectoryAgent " + this + " matching ServiceType " + serviceType + ", language " + language + ", scopes " + scopes + ", filter " + filter);
return services.match(serviceType, language, scopes, new FilterParser().parse(filter));
}
|
java
|
protected List<ServiceInfo> matchServices(ServiceType serviceType, String language, Scopes scopes, String filter)
{
if (logger.isLoggable(Level.FINEST))
logger.finest("DirectoryAgent " + this + " matching ServiceType " + serviceType + ", language " + language + ", scopes " + scopes + ", filter " + filter);
return services.match(serviceType, language, scopes, new FilterParser().parse(filter));
}
|
[
"protected",
"List",
"<",
"ServiceInfo",
">",
"matchServices",
"(",
"ServiceType",
"serviceType",
",",
"String",
"language",
",",
"Scopes",
"scopes",
",",
"String",
"filter",
")",
"{",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"logger",
".",
"finest",
"(",
"\"DirectoryAgent \"",
"+",
"this",
"+",
"\" matching ServiceType \"",
"+",
"serviceType",
"+",
"\", language \"",
"+",
"language",
"+",
"\", scopes \"",
"+",
"scopes",
"+",
"\", filter \"",
"+",
"filter",
")",
";",
"return",
"services",
".",
"match",
"(",
"serviceType",
",",
"language",
",",
"scopes",
",",
"new",
"FilterParser",
"(",
")",
".",
"parse",
"(",
"filter",
")",
")",
";",
"}"
] |
Matches the services of this directory agent against the given arguments.
@param serviceType the service type to match or null to match any service type
@param scopes the Scopes to match or null to match any Scopes
@param filter the LDAPv3 filter to match the service Attributes against or null to match any Attributes
@param language the language to match or null to match any language
@return a list of matching services
|
[
"Matches",
"the",
"services",
"of",
"this",
"directory",
"agent",
"against",
"the",
"given",
"arguments",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java#L508-L513
|
150,599
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/memory/SimpleCache.java
|
SimpleCache.get
|
public Data get(Key key) {
synchronized (cache) {
Pair<Data,Long> p = cache.get(key);
if (p != null) {
p.setValue2(Long.valueOf(System.currentTimeMillis()));
return p.getValue1();
}
p = new Pair<>(provider.provide(key), Long.valueOf(System.currentTimeMillis()));
cache.put(key, p);
return p.getValue1();
}
}
|
java
|
public Data get(Key key) {
synchronized (cache) {
Pair<Data,Long> p = cache.get(key);
if (p != null) {
p.setValue2(Long.valueOf(System.currentTimeMillis()));
return p.getValue1();
}
p = new Pair<>(provider.provide(key), Long.valueOf(System.currentTimeMillis()));
cache.put(key, p);
return p.getValue1();
}
}
|
[
"public",
"Data",
"get",
"(",
"Key",
"key",
")",
"{",
"synchronized",
"(",
"cache",
")",
"{",
"Pair",
"<",
"Data",
",",
"Long",
">",
"p",
"=",
"cache",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"p",
"!=",
"null",
")",
"{",
"p",
".",
"setValue2",
"(",
"Long",
".",
"valueOf",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
")",
";",
"return",
"p",
".",
"getValue1",
"(",
")",
";",
"}",
"p",
"=",
"new",
"Pair",
"<>",
"(",
"provider",
".",
"provide",
"(",
"key",
")",
",",
"Long",
".",
"valueOf",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
")",
";",
"cache",
".",
"put",
"(",
"key",
",",
"p",
")",
";",
"return",
"p",
".",
"getValue1",
"(",
")",
";",
"}",
"}"
] |
Get a data, or create it using the provider.
|
[
"Get",
"a",
"data",
"or",
"create",
"it",
"using",
"the",
"provider",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/memory/SimpleCache.java#L38-L49
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.