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,800
|
vdmeer/skb-java-base
|
src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java
|
SkbShellFactory.newArgumentArray
|
public static SkbShellArgument[] newArgumentArray(SkbShellArgument ... args){
if(args==null){
return null;
}
Set<SkbShellArgument> ret = new HashSet<>();
for(SkbShellArgument arg : args){
if(arg!=null){
ret.add(arg);
}
}
return ret.toArray(new SkbShellArgument[args.length]);
}
|
java
|
public static SkbShellArgument[] newArgumentArray(SkbShellArgument ... args){
if(args==null){
return null;
}
Set<SkbShellArgument> ret = new HashSet<>();
for(SkbShellArgument arg : args){
if(arg!=null){
ret.add(arg);
}
}
return ret.toArray(new SkbShellArgument[args.length]);
}
|
[
"public",
"static",
"SkbShellArgument",
"[",
"]",
"newArgumentArray",
"(",
"SkbShellArgument",
"...",
"args",
")",
"{",
"if",
"(",
"args",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Set",
"<",
"SkbShellArgument",
">",
"ret",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"SkbShellArgument",
"arg",
":",
"args",
")",
"{",
"if",
"(",
"arg",
"!=",
"null",
")",
"{",
"ret",
".",
"add",
"(",
"arg",
")",
";",
"}",
"}",
"return",
"ret",
".",
"toArray",
"(",
"new",
"SkbShellArgument",
"[",
"args",
".",
"length",
"]",
")",
";",
"}"
] |
Returns a new argument array.
@param args input arguments, any argument being null will be ignored
@return argument array, null if none provided
|
[
"Returns",
"a",
"new",
"argument",
"array",
"."
] |
6d845bcc482aa9344d016e80c0c3455aeae13a13
|
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L164-L175
|
150,801
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java
|
Sample.fixSampleLoops
|
public void fixSampleLoops(int modType)
{
if (sample==null || length==0) return;
if (repeatStop>length)
{
repeatStop = length;
repeatLength = repeatStop - repeatStart;
}
if (repeatStart+2>repeatStop)
{
repeatStop = repeatStart = 0;
repeatLength = repeatStop - repeatStart;
loopType = 0;
}
sample[length+4] = sample[length+3] = sample[length+2] = sample[length+1] = sample[length] = sample[length-1];
if (loopType==1 && (repeatStop+4>repeatLength || modType==Helpers.MODTYPE_MOD || modType==Helpers.MODTYPE_S3M))
{
sample[repeatStop ] = sample[repeatStart ];
sample[repeatStop+1] = sample[repeatStart+1];
sample[repeatStop+2] = sample[repeatStart+2];
sample[repeatStop+3] = sample[repeatStart+3];
sample[repeatStop+4] = sample[repeatStart+4];
}
}
|
java
|
public void fixSampleLoops(int modType)
{
if (sample==null || length==0) return;
if (repeatStop>length)
{
repeatStop = length;
repeatLength = repeatStop - repeatStart;
}
if (repeatStart+2>repeatStop)
{
repeatStop = repeatStart = 0;
repeatLength = repeatStop - repeatStart;
loopType = 0;
}
sample[length+4] = sample[length+3] = sample[length+2] = sample[length+1] = sample[length] = sample[length-1];
if (loopType==1 && (repeatStop+4>repeatLength || modType==Helpers.MODTYPE_MOD || modType==Helpers.MODTYPE_S3M))
{
sample[repeatStop ] = sample[repeatStart ];
sample[repeatStop+1] = sample[repeatStart+1];
sample[repeatStop+2] = sample[repeatStart+2];
sample[repeatStop+3] = sample[repeatStart+3];
sample[repeatStop+4] = sample[repeatStart+4];
}
}
|
[
"public",
"void",
"fixSampleLoops",
"(",
"int",
"modType",
")",
"{",
"if",
"(",
"sample",
"==",
"null",
"||",
"length",
"==",
"0",
")",
"return",
";",
"if",
"(",
"repeatStop",
">",
"length",
")",
"{",
"repeatStop",
"=",
"length",
";",
"repeatLength",
"=",
"repeatStop",
"-",
"repeatStart",
";",
"}",
"if",
"(",
"repeatStart",
"+",
"2",
">",
"repeatStop",
")",
"{",
"repeatStop",
"=",
"repeatStart",
"=",
"0",
";",
"repeatLength",
"=",
"repeatStop",
"-",
"repeatStart",
";",
"loopType",
"=",
"0",
";",
"}",
"sample",
"[",
"length",
"+",
"4",
"]",
"=",
"sample",
"[",
"length",
"+",
"3",
"]",
"=",
"sample",
"[",
"length",
"+",
"2",
"]",
"=",
"sample",
"[",
"length",
"+",
"1",
"]",
"=",
"sample",
"[",
"length",
"]",
"=",
"sample",
"[",
"length",
"-",
"1",
"]",
";",
"if",
"(",
"loopType",
"==",
"1",
"&&",
"(",
"repeatStop",
"+",
"4",
">",
"repeatLength",
"||",
"modType",
"==",
"Helpers",
".",
"MODTYPE_MOD",
"||",
"modType",
"==",
"Helpers",
".",
"MODTYPE_S3M",
")",
")",
"{",
"sample",
"[",
"repeatStop",
"]",
"=",
"sample",
"[",
"repeatStart",
"]",
";",
"sample",
"[",
"repeatStop",
"+",
"1",
"]",
"=",
"sample",
"[",
"repeatStart",
"+",
"1",
"]",
";",
"sample",
"[",
"repeatStop",
"+",
"2",
"]",
"=",
"sample",
"[",
"repeatStart",
"+",
"2",
"]",
";",
"sample",
"[",
"repeatStop",
"+",
"3",
"]",
"=",
"sample",
"[",
"repeatStart",
"+",
"3",
"]",
";",
"sample",
"[",
"repeatStop",
"+",
"4",
"]",
"=",
"sample",
"[",
"repeatStart",
"+",
"4",
"]",
";",
"}",
"}"
] |
Fits the loop-data given in instruments loaded
These values are often not correkt
@since 27.08.2006
@param modType
|
[
"Fits",
"the",
"loop",
"-",
"data",
"given",
"in",
"instruments",
"loaded",
"These",
"values",
"are",
"often",
"not",
"correkt"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java#L83-L106
|
150,802
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java
|
Sample.getLinearInterpolated
|
private int getLinearInterpolated(final int currentSamplePos, final int currentTuningPos)
{
final long s1 = ((long)sample[currentSamplePos ])<<Helpers.SAMPLE_SHIFT;
final long s2 = ((long)sample[currentSamplePos+1])<<Helpers.SAMPLE_SHIFT;
return (int)((s1 + (((s2-s1)*((long)currentTuningPos))>>Helpers.SHIFT))>>Helpers.SAMPLE_SHIFT);
}
|
java
|
private int getLinearInterpolated(final int currentSamplePos, final int currentTuningPos)
{
final long s1 = ((long)sample[currentSamplePos ])<<Helpers.SAMPLE_SHIFT;
final long s2 = ((long)sample[currentSamplePos+1])<<Helpers.SAMPLE_SHIFT;
return (int)((s1 + (((s2-s1)*((long)currentTuningPos))>>Helpers.SHIFT))>>Helpers.SAMPLE_SHIFT);
}
|
[
"private",
"int",
"getLinearInterpolated",
"(",
"final",
"int",
"currentSamplePos",
",",
"final",
"int",
"currentTuningPos",
")",
"{",
"final",
"long",
"s1",
"=",
"(",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"]",
")",
"<<",
"Helpers",
".",
"SAMPLE_SHIFT",
";",
"final",
"long",
"s2",
"=",
"(",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"+",
"1",
"]",
")",
"<<",
"Helpers",
".",
"SAMPLE_SHIFT",
";",
"return",
"(",
"int",
")",
"(",
"(",
"s1",
"+",
"(",
"(",
"(",
"s2",
"-",
"s1",
")",
"*",
"(",
"(",
"long",
")",
"currentTuningPos",
")",
")",
">>",
"Helpers",
".",
"SHIFT",
")",
")",
">>",
"Helpers",
".",
"SAMPLE_SHIFT",
")",
";",
"}"
] |
Does the linear interpolation with the next sample
@since 06.06.2006
@param currentTuningPos
@return
|
[
"Does",
"the",
"linear",
"interpolation",
"with",
"the",
"next",
"sample"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java#L138-L143
|
150,803
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java
|
Sample.getCubicInterpolated
|
private int getCubicInterpolated(final int currentSamplePos, final int currentTuningPos)
{
final int poslo = (currentTuningPos >> CubicSpline.SPLINE_FRACSHIFT) & CubicSpline.SPLINE_FRACMASK;
final long v1 = (((currentSamplePos-1)<0)?0L: (long)CubicSpline.lut[poslo ]*(long)sample[currentSamplePos-1]) +
( (long)CubicSpline.lut[poslo+1]*(long)sample[currentSamplePos ]) +
( (long)CubicSpline.lut[poslo+2]*(long)sample[currentSamplePos+1]) +
( (long)CubicSpline.lut[poslo+3]*(long)sample[currentSamplePos+2]);
return (int)(v1 >> CubicSpline.SPLINE_QUANTBITS);
}
|
java
|
private int getCubicInterpolated(final int currentSamplePos, final int currentTuningPos)
{
final int poslo = (currentTuningPos >> CubicSpline.SPLINE_FRACSHIFT) & CubicSpline.SPLINE_FRACMASK;
final long v1 = (((currentSamplePos-1)<0)?0L: (long)CubicSpline.lut[poslo ]*(long)sample[currentSamplePos-1]) +
( (long)CubicSpline.lut[poslo+1]*(long)sample[currentSamplePos ]) +
( (long)CubicSpline.lut[poslo+2]*(long)sample[currentSamplePos+1]) +
( (long)CubicSpline.lut[poslo+3]*(long)sample[currentSamplePos+2]);
return (int)(v1 >> CubicSpline.SPLINE_QUANTBITS);
}
|
[
"private",
"int",
"getCubicInterpolated",
"(",
"final",
"int",
"currentSamplePos",
",",
"final",
"int",
"currentTuningPos",
")",
"{",
"final",
"int",
"poslo",
"=",
"(",
"currentTuningPos",
">>",
"CubicSpline",
".",
"SPLINE_FRACSHIFT",
")",
"&",
"CubicSpline",
".",
"SPLINE_FRACMASK",
";",
"final",
"long",
"v1",
"=",
"(",
"(",
"(",
"currentSamplePos",
"-",
"1",
")",
"<",
"0",
")",
"?",
"0L",
":",
"(",
"long",
")",
"CubicSpline",
".",
"lut",
"[",
"poslo",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"-",
"1",
"]",
")",
"+",
"(",
"(",
"long",
")",
"CubicSpline",
".",
"lut",
"[",
"poslo",
"+",
"1",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"]",
")",
"+",
"(",
"(",
"long",
")",
"CubicSpline",
".",
"lut",
"[",
"poslo",
"+",
"2",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"+",
"1",
"]",
")",
"+",
"(",
"(",
"long",
")",
"CubicSpline",
".",
"lut",
"[",
"poslo",
"+",
"3",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"+",
"2",
"]",
")",
";",
"return",
"(",
"int",
")",
"(",
"v1",
">>",
"CubicSpline",
".",
"SPLINE_QUANTBITS",
")",
";",
"}"
] |
does cubic interpolation with the next sample
@since 06.06.2006
@param currentTuningPos
@return
|
[
"does",
"cubic",
"interpolation",
"with",
"the",
"next",
"sample"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java#L150-L160
|
150,804
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java
|
Sample.getFIRInterpolated
|
private int getFIRInterpolated(final int currentSamplePos, final int currentTuningPos)
{
final int poslo = currentTuningPos & WindowedFIR.WFIR_POSFRACMASK;
final int firidx = ((poslo+WindowedFIR.WFIR_FRACHALVE)>>WindowedFIR.WFIR_FRACSHIFT) & WindowedFIR.WFIR_FRACMASK;
final long v1 = (((currentSamplePos-3)<0)?0L: (long)WindowedFIR.lut[firidx ]*(long)sample[currentSamplePos-3]) +
(((currentSamplePos-2)<0)?0L: (long)WindowedFIR.lut[firidx+1]*(long)sample[currentSamplePos-2]) +
(((currentSamplePos-1)<0)?0L: (long)WindowedFIR.lut[firidx+2]*(long)sample[currentSamplePos-1]) +
( (long)WindowedFIR.lut[firidx+3]*(long)sample[currentSamplePos ]);
final long v2 = ( (long)WindowedFIR.lut[firidx+4]*(long)sample[currentSamplePos+1]) +
( (long)WindowedFIR.lut[firidx+5]*(long)sample[currentSamplePos+2]) +
( (long)WindowedFIR.lut[firidx+6]*(long)sample[currentSamplePos+3]) +
( (long)WindowedFIR.lut[firidx+7]*(long)sample[currentSamplePos+4]);
return (int)(((v1>>1) + (v2>>1)) >> WindowedFIR.WFIR_16BITSHIFT);
}
|
java
|
private int getFIRInterpolated(final int currentSamplePos, final int currentTuningPos)
{
final int poslo = currentTuningPos & WindowedFIR.WFIR_POSFRACMASK;
final int firidx = ((poslo+WindowedFIR.WFIR_FRACHALVE)>>WindowedFIR.WFIR_FRACSHIFT) & WindowedFIR.WFIR_FRACMASK;
final long v1 = (((currentSamplePos-3)<0)?0L: (long)WindowedFIR.lut[firidx ]*(long)sample[currentSamplePos-3]) +
(((currentSamplePos-2)<0)?0L: (long)WindowedFIR.lut[firidx+1]*(long)sample[currentSamplePos-2]) +
(((currentSamplePos-1)<0)?0L: (long)WindowedFIR.lut[firidx+2]*(long)sample[currentSamplePos-1]) +
( (long)WindowedFIR.lut[firidx+3]*(long)sample[currentSamplePos ]);
final long v2 = ( (long)WindowedFIR.lut[firidx+4]*(long)sample[currentSamplePos+1]) +
( (long)WindowedFIR.lut[firidx+5]*(long)sample[currentSamplePos+2]) +
( (long)WindowedFIR.lut[firidx+6]*(long)sample[currentSamplePos+3]) +
( (long)WindowedFIR.lut[firidx+7]*(long)sample[currentSamplePos+4]);
return (int)(((v1>>1) + (v2>>1)) >> WindowedFIR.WFIR_16BITSHIFT);
}
|
[
"private",
"int",
"getFIRInterpolated",
"(",
"final",
"int",
"currentSamplePos",
",",
"final",
"int",
"currentTuningPos",
")",
"{",
"final",
"int",
"poslo",
"=",
"currentTuningPos",
"&",
"WindowedFIR",
".",
"WFIR_POSFRACMASK",
";",
"final",
"int",
"firidx",
"=",
"(",
"(",
"poslo",
"+",
"WindowedFIR",
".",
"WFIR_FRACHALVE",
")",
">>",
"WindowedFIR",
".",
"WFIR_FRACSHIFT",
")",
"&",
"WindowedFIR",
".",
"WFIR_FRACMASK",
";",
"final",
"long",
"v1",
"=",
"(",
"(",
"(",
"currentSamplePos",
"-",
"3",
")",
"<",
"0",
")",
"?",
"0L",
":",
"(",
"long",
")",
"WindowedFIR",
".",
"lut",
"[",
"firidx",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"-",
"3",
"]",
")",
"+",
"(",
"(",
"(",
"currentSamplePos",
"-",
"2",
")",
"<",
"0",
")",
"?",
"0L",
":",
"(",
"long",
")",
"WindowedFIR",
".",
"lut",
"[",
"firidx",
"+",
"1",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"-",
"2",
"]",
")",
"+",
"(",
"(",
"(",
"currentSamplePos",
"-",
"1",
")",
"<",
"0",
")",
"?",
"0L",
":",
"(",
"long",
")",
"WindowedFIR",
".",
"lut",
"[",
"firidx",
"+",
"2",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"-",
"1",
"]",
")",
"+",
"(",
"(",
"long",
")",
"WindowedFIR",
".",
"lut",
"[",
"firidx",
"+",
"3",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"]",
")",
";",
"final",
"long",
"v2",
"=",
"(",
"(",
"long",
")",
"WindowedFIR",
".",
"lut",
"[",
"firidx",
"+",
"4",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"+",
"1",
"]",
")",
"+",
"(",
"(",
"long",
")",
"WindowedFIR",
".",
"lut",
"[",
"firidx",
"+",
"5",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"+",
"2",
"]",
")",
"+",
"(",
"(",
"long",
")",
"WindowedFIR",
".",
"lut",
"[",
"firidx",
"+",
"6",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"+",
"3",
"]",
")",
"+",
"(",
"(",
"long",
")",
"WindowedFIR",
".",
"lut",
"[",
"firidx",
"+",
"7",
"]",
"*",
"(",
"long",
")",
"sample",
"[",
"currentSamplePos",
"+",
"4",
"]",
")",
";",
"return",
"(",
"int",
")",
"(",
"(",
"(",
"v1",
">>",
"1",
")",
"+",
"(",
"v2",
">>",
"1",
")",
")",
">>",
"WindowedFIR",
".",
"WFIR_16BITSHIFT",
")",
";",
"}"
] |
does a windowed fir interploation with the next sample
@since 15.06.2006
@param currentTuningPos
@return
|
[
"does",
"a",
"windowed",
"fir",
"interploation",
"with",
"the",
"next",
"sample"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mod/loader/instrument/Sample.java#L167-L180
|
150,805
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/collections/TurnArray.java
|
TurnArray.contains
|
@Override
public synchronized boolean contains(Object o) {
if (start == end) return false; // empty
if (end == -1) {
// full
for (int i = array.length - 1; i >= 0; --i)
if (array[i].equals(o))
return true;
return false;
}
if (end < start) {
for (int i = array.length - 1; i >= start; --i)
if (array[i].equals(o))
return true;
for (int i = 0; i < end; ++i)
if (array[i].equals(o))
return true;
return false;
}
for (int i = start; i < end; ++i)
if (array[i].equals(o))
return true;
return false;
}
|
java
|
@Override
public synchronized boolean contains(Object o) {
if (start == end) return false; // empty
if (end == -1) {
// full
for (int i = array.length - 1; i >= 0; --i)
if (array[i].equals(o))
return true;
return false;
}
if (end < start) {
for (int i = array.length - 1; i >= start; --i)
if (array[i].equals(o))
return true;
for (int i = 0; i < end; ++i)
if (array[i].equals(o))
return true;
return false;
}
for (int i = start; i < end; ++i)
if (array[i].equals(o))
return true;
return false;
}
|
[
"@",
"Override",
"public",
"synchronized",
"boolean",
"contains",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"start",
"==",
"end",
")",
"return",
"false",
";",
"// empty\r",
"if",
"(",
"end",
"==",
"-",
"1",
")",
"{",
"// full\r",
"for",
"(",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
".",
"equals",
"(",
"o",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}",
"if",
"(",
"end",
"<",
"start",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"i",
">=",
"start",
";",
"--",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
".",
"equals",
"(",
"o",
")",
")",
"return",
"true",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"end",
";",
"++",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
".",
"equals",
"(",
"o",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"++",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
".",
"equals",
"(",
"o",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] |
other operation which may cost
|
[
"other",
"operation",
"which",
"may",
"cost"
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/TurnArray.java#L370-L393
|
150,806
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/collections/TurnArray.java
|
TurnArray.removeAny
|
public synchronized boolean removeAny(Object element) {
if (end == start) return false;
if (end == -1) {
for (int i = array.length - 1; i >= 0; --i)
if (array[i].equals(element)) {
removeAt(i);
return true;
}
return false;
}
if (end < start) {
for (int i = array.length - 1; i >= start; --i)
if (array[i].equals(element)) {
removeAt(i);
return true;
}
for (int i = 0; i < end; ++i)
if (array[i].equals(element)) {
removeAt(i);
return true;
}
return false;
}
for (int i = start; i < end; ++i)
if (array[i].equals(element)) {
removeAt(i);
return true;
}
return false;
}
|
java
|
public synchronized boolean removeAny(Object element) {
if (end == start) return false;
if (end == -1) {
for (int i = array.length - 1; i >= 0; --i)
if (array[i].equals(element)) {
removeAt(i);
return true;
}
return false;
}
if (end < start) {
for (int i = array.length - 1; i >= start; --i)
if (array[i].equals(element)) {
removeAt(i);
return true;
}
for (int i = 0; i < end; ++i)
if (array[i].equals(element)) {
removeAt(i);
return true;
}
return false;
}
for (int i = start; i < end; ++i)
if (array[i].equals(element)) {
removeAt(i);
return true;
}
return false;
}
|
[
"public",
"synchronized",
"boolean",
"removeAny",
"(",
"Object",
"element",
")",
"{",
"if",
"(",
"end",
"==",
"start",
")",
"return",
"false",
";",
"if",
"(",
"end",
"==",
"-",
"1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
".",
"equals",
"(",
"element",
")",
")",
"{",
"removeAt",
"(",
"i",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"if",
"(",
"end",
"<",
"start",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"i",
">=",
"start",
";",
"--",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
".",
"equals",
"(",
"element",
")",
")",
"{",
"removeAt",
"(",
"i",
")",
";",
"return",
"true",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"end",
";",
"++",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
".",
"equals",
"(",
"element",
")",
")",
"{",
"removeAt",
"(",
"i",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"++",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
".",
"equals",
"(",
"element",
")",
")",
"{",
"removeAt",
"(",
"i",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
remove this element, not necessarily the first or last occurrence.
|
[
"remove",
"this",
"element",
"not",
"necessarily",
"the",
"first",
"or",
"last",
"occurrence",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/TurnArray.java#L403-L432
|
150,807
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/collections/TurnArray.java
|
TurnArray.removeInstance
|
public synchronized boolean removeInstance(T element) {
if (end == start) return false;
if (end == -1) {
for (int i = array.length - 1; i >= 0; --i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
}
if (end < start) {
for (int i = array.length - 1; i >= start; --i)
if (array[i] == element) {
removeAt(i);
return true;
}
for (int i = 0; i < end; ++i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
}
for (int i = start; i < end; ++i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
}
|
java
|
public synchronized boolean removeInstance(T element) {
if (end == start) return false;
if (end == -1) {
for (int i = array.length - 1; i >= 0; --i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
}
if (end < start) {
for (int i = array.length - 1; i >= start; --i)
if (array[i] == element) {
removeAt(i);
return true;
}
for (int i = 0; i < end; ++i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
}
for (int i = start; i < end; ++i)
if (array[i] == element) {
removeAt(i);
return true;
}
return false;
}
|
[
"public",
"synchronized",
"boolean",
"removeInstance",
"(",
"T",
"element",
")",
"{",
"if",
"(",
"end",
"==",
"start",
")",
"return",
"false",
";",
"if",
"(",
"end",
"==",
"-",
"1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
"==",
"element",
")",
"{",
"removeAt",
"(",
"i",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"if",
"(",
"end",
"<",
"start",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"i",
">=",
"start",
";",
"--",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
"==",
"element",
")",
"{",
"removeAt",
"(",
"i",
")",
";",
"return",
"true",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"end",
";",
"++",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
"==",
"element",
")",
"{",
"removeAt",
"(",
"i",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"++",
"i",
")",
"if",
"(",
"array",
"[",
"i",
"]",
"==",
"element",
")",
"{",
"removeAt",
"(",
"i",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Remove the given instance.
|
[
"Remove",
"the",
"given",
"instance",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/TurnArray.java#L509-L538
|
150,808
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/collections/TurnArray.java
|
TurnArray.removeAllNoOrder
|
@SuppressWarnings("unchecked")
public synchronized List<T> removeAllNoOrder() {
if (end == -1) {
List<Object> a = Arrays.asList(array);
array = new Object[array.length];
start = end = 0;
return (List<T>)a;
}
if (start == end) return Collections.EMPTY_LIST;
if (end > start) {
Object[] a = new Object[end - start];
System.arraycopy(array, start, a, 0, end - start);
for (int i = start; i < end; ++i) array[i] = null;
start = end = 0;
return (List<T>)Arrays.asList(a);
}
Object[] a = new Object[array.length - start + end];
System.arraycopy(array, start, a, 0, array.length - start);
if (end > 0)
System.arraycopy(array, 0, a, array.length - start, end);
for (int i = array.length - 1; i >= 0; --i) array[i] = null;
start = end = 0;
return (List<T>)Arrays.asList(a);
}
|
java
|
@SuppressWarnings("unchecked")
public synchronized List<T> removeAllNoOrder() {
if (end == -1) {
List<Object> a = Arrays.asList(array);
array = new Object[array.length];
start = end = 0;
return (List<T>)a;
}
if (start == end) return Collections.EMPTY_LIST;
if (end > start) {
Object[] a = new Object[end - start];
System.arraycopy(array, start, a, 0, end - start);
for (int i = start; i < end; ++i) array[i] = null;
start = end = 0;
return (List<T>)Arrays.asList(a);
}
Object[] a = new Object[array.length - start + end];
System.arraycopy(array, start, a, 0, array.length - start);
if (end > 0)
System.arraycopy(array, 0, a, array.length - start, end);
for (int i = array.length - 1; i >= 0; --i) array[i] = null;
start = end = 0;
return (List<T>)Arrays.asList(a);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"synchronized",
"List",
"<",
"T",
">",
"removeAllNoOrder",
"(",
")",
"{",
"if",
"(",
"end",
"==",
"-",
"1",
")",
"{",
"List",
"<",
"Object",
">",
"a",
"=",
"Arrays",
".",
"asList",
"(",
"array",
")",
";",
"array",
"=",
"new",
"Object",
"[",
"array",
".",
"length",
"]",
";",
"start",
"=",
"end",
"=",
"0",
";",
"return",
"(",
"List",
"<",
"T",
">",
")",
"a",
";",
"}",
"if",
"(",
"start",
"==",
"end",
")",
"return",
"Collections",
".",
"EMPTY_LIST",
";",
"if",
"(",
"end",
">",
"start",
")",
"{",
"Object",
"[",
"]",
"a",
"=",
"new",
"Object",
"[",
"end",
"-",
"start",
"]",
";",
"System",
".",
"arraycopy",
"(",
"array",
",",
"start",
",",
"a",
",",
"0",
",",
"end",
"-",
"start",
")",
";",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"++",
"i",
")",
"array",
"[",
"i",
"]",
"=",
"null",
";",
"start",
"=",
"end",
"=",
"0",
";",
"return",
"(",
"List",
"<",
"T",
">",
")",
"Arrays",
".",
"asList",
"(",
"a",
")",
";",
"}",
"Object",
"[",
"]",
"a",
"=",
"new",
"Object",
"[",
"array",
".",
"length",
"-",
"start",
"+",
"end",
"]",
";",
"System",
".",
"arraycopy",
"(",
"array",
",",
"start",
",",
"a",
",",
"0",
",",
"array",
".",
"length",
"-",
"start",
")",
";",
"if",
"(",
"end",
">",
"0",
")",
"System",
".",
"arraycopy",
"(",
"array",
",",
"0",
",",
"a",
",",
"array",
".",
"length",
"-",
"start",
",",
"end",
")",
";",
"for",
"(",
"int",
"i",
"=",
"array",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"array",
"[",
"i",
"]",
"=",
"null",
";",
"start",
"=",
"end",
"=",
"0",
";",
"return",
"(",
"List",
"<",
"T",
">",
")",
"Arrays",
".",
"asList",
"(",
"a",
")",
";",
"}"
] |
Remove all elements and return them, but the returned list is not ordered.
The reason it is not ordered is for performance, when the order is not important.
|
[
"Remove",
"all",
"elements",
"and",
"return",
"them",
"but",
"the",
"returned",
"list",
"is",
"not",
"ordered",
".",
"The",
"reason",
"it",
"is",
"not",
"ordered",
"is",
"for",
"performance",
"when",
"the",
"order",
"is",
"not",
"important",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/TurnArray.java#L707-L730
|
150,809
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/MainForm.java
|
MainForm.createFileFilter
|
private void createFileFilter()
{
HashMap<String, String[]> extensionMap = MultimediaContainerManager.getSupportedFileExtensionsPerContainer();
ArrayList<FileFilter> chooserFilterArray = new ArrayList<FileFilter>(extensionMap.size() + 1);
// add all single file extensions grouped by container
Set<String> containerNameSet = extensionMap.keySet();
Iterator<String> containerNameIterator = containerNameSet.iterator();
while (containerNameIterator.hasNext())
{
String containerName = containerNameIterator.next();
String [] extensions = extensionMap.get(containerName);
StringBuilder fileText = new StringBuilder(containerName);
fileText.append(" (");
int ende = extensions.length-1;
for (int i=0; i<=ende; i++)
{
fileText.append("*.").append(extensions[i]);
if (i<ende) fileText.append(", ");
}
fileText.append(')');
chooserFilterArray.add(new FileChooserFilter(extensions, fileText.toString()));
}
// now add playlist as group of files
chooserFilterArray.add(PlayList.PLAYLIST_FILE_FILTER);
// now add all playable files at the last step (container extensions and playlist files)
String [] containerExtensions = MultimediaContainerManager.getSupportedFileExtensions();
String [] fullSupportedExtensions = new String[containerExtensions.length + PlayList.SUPPORTEDPLAYLISTS.length];
System.arraycopy(PlayList.SUPPORTEDPLAYLISTS, 0, fullSupportedExtensions, 0, PlayList.SUPPORTEDPLAYLISTS.length);
System.arraycopy(containerExtensions, 0, fullSupportedExtensions, PlayList.SUPPORTEDPLAYLISTS.length, containerExtensions.length);
chooserFilterArray.add(new FileChooserFilter(fullSupportedExtensions, "All playable files"));
// add default "all files" - WE DO NOT DO THAT ANYMORE ;)
// chooserFilterArray.add(new FileChooserFilter("*", "All files"));
fileFilterLoad = new FileFilter[chooserFilterArray.size()];
chooserFilterArray.toArray(fileFilterLoad);
fileFilterExport = new FileFilter[1];
fileFilterExport[0] = new FileChooserFilter(javax.sound.sampled.AudioFileFormat.Type.WAVE.getExtension(), javax.sound.sampled.AudioFileFormat.Type.WAVE.toString());
}
|
java
|
private void createFileFilter()
{
HashMap<String, String[]> extensionMap = MultimediaContainerManager.getSupportedFileExtensionsPerContainer();
ArrayList<FileFilter> chooserFilterArray = new ArrayList<FileFilter>(extensionMap.size() + 1);
// add all single file extensions grouped by container
Set<String> containerNameSet = extensionMap.keySet();
Iterator<String> containerNameIterator = containerNameSet.iterator();
while (containerNameIterator.hasNext())
{
String containerName = containerNameIterator.next();
String [] extensions = extensionMap.get(containerName);
StringBuilder fileText = new StringBuilder(containerName);
fileText.append(" (");
int ende = extensions.length-1;
for (int i=0; i<=ende; i++)
{
fileText.append("*.").append(extensions[i]);
if (i<ende) fileText.append(", ");
}
fileText.append(')');
chooserFilterArray.add(new FileChooserFilter(extensions, fileText.toString()));
}
// now add playlist as group of files
chooserFilterArray.add(PlayList.PLAYLIST_FILE_FILTER);
// now add all playable files at the last step (container extensions and playlist files)
String [] containerExtensions = MultimediaContainerManager.getSupportedFileExtensions();
String [] fullSupportedExtensions = new String[containerExtensions.length + PlayList.SUPPORTEDPLAYLISTS.length];
System.arraycopy(PlayList.SUPPORTEDPLAYLISTS, 0, fullSupportedExtensions, 0, PlayList.SUPPORTEDPLAYLISTS.length);
System.arraycopy(containerExtensions, 0, fullSupportedExtensions, PlayList.SUPPORTEDPLAYLISTS.length, containerExtensions.length);
chooserFilterArray.add(new FileChooserFilter(fullSupportedExtensions, "All playable files"));
// add default "all files" - WE DO NOT DO THAT ANYMORE ;)
// chooserFilterArray.add(new FileChooserFilter("*", "All files"));
fileFilterLoad = new FileFilter[chooserFilterArray.size()];
chooserFilterArray.toArray(fileFilterLoad);
fileFilterExport = new FileFilter[1];
fileFilterExport[0] = new FileChooserFilter(javax.sound.sampled.AudioFileFormat.Type.WAVE.getExtension(), javax.sound.sampled.AudioFileFormat.Type.WAVE.toString());
}
|
[
"private",
"void",
"createFileFilter",
"(",
")",
"{",
"HashMap",
"<",
"String",
",",
"String",
"[",
"]",
">",
"extensionMap",
"=",
"MultimediaContainerManager",
".",
"getSupportedFileExtensionsPerContainer",
"(",
")",
";",
"ArrayList",
"<",
"FileFilter",
">",
"chooserFilterArray",
"=",
"new",
"ArrayList",
"<",
"FileFilter",
">",
"(",
"extensionMap",
".",
"size",
"(",
")",
"+",
"1",
")",
";",
"// add all single file extensions grouped by container",
"Set",
"<",
"String",
">",
"containerNameSet",
"=",
"extensionMap",
".",
"keySet",
"(",
")",
";",
"Iterator",
"<",
"String",
">",
"containerNameIterator",
"=",
"containerNameSet",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"containerNameIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"containerName",
"=",
"containerNameIterator",
".",
"next",
"(",
")",
";",
"String",
"[",
"]",
"extensions",
"=",
"extensionMap",
".",
"get",
"(",
"containerName",
")",
";",
"StringBuilder",
"fileText",
"=",
"new",
"StringBuilder",
"(",
"containerName",
")",
";",
"fileText",
".",
"append",
"(",
"\" (\"",
")",
";",
"int",
"ende",
"=",
"extensions",
".",
"length",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"ende",
";",
"i",
"++",
")",
"{",
"fileText",
".",
"append",
"(",
"\"*.\"",
")",
".",
"append",
"(",
"extensions",
"[",
"i",
"]",
")",
";",
"if",
"(",
"i",
"<",
"ende",
")",
"fileText",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"fileText",
".",
"append",
"(",
"'",
"'",
")",
";",
"chooserFilterArray",
".",
"add",
"(",
"new",
"FileChooserFilter",
"(",
"extensions",
",",
"fileText",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"// now add playlist as group of files",
"chooserFilterArray",
".",
"add",
"(",
"PlayList",
".",
"PLAYLIST_FILE_FILTER",
")",
";",
"// now add all playable files at the last step (container extensions and playlist files)",
"String",
"[",
"]",
"containerExtensions",
"=",
"MultimediaContainerManager",
".",
"getSupportedFileExtensions",
"(",
")",
";",
"String",
"[",
"]",
"fullSupportedExtensions",
"=",
"new",
"String",
"[",
"containerExtensions",
".",
"length",
"+",
"PlayList",
".",
"SUPPORTEDPLAYLISTS",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"PlayList",
".",
"SUPPORTEDPLAYLISTS",
",",
"0",
",",
"fullSupportedExtensions",
",",
"0",
",",
"PlayList",
".",
"SUPPORTEDPLAYLISTS",
".",
"length",
")",
";",
"System",
".",
"arraycopy",
"(",
"containerExtensions",
",",
"0",
",",
"fullSupportedExtensions",
",",
"PlayList",
".",
"SUPPORTEDPLAYLISTS",
".",
"length",
",",
"containerExtensions",
".",
"length",
")",
";",
"chooserFilterArray",
".",
"add",
"(",
"new",
"FileChooserFilter",
"(",
"fullSupportedExtensions",
",",
"\"All playable files\"",
")",
")",
";",
"// add default \"all files\" - WE DO NOT DO THAT ANYMORE ;)",
"//\t\tchooserFilterArray.add(new FileChooserFilter(\"*\", \"All files\"));",
"fileFilterLoad",
"=",
"new",
"FileFilter",
"[",
"chooserFilterArray",
".",
"size",
"(",
")",
"]",
";",
"chooserFilterArray",
".",
"toArray",
"(",
"fileFilterLoad",
")",
";",
"fileFilterExport",
"=",
"new",
"FileFilter",
"[",
"1",
"]",
";",
"fileFilterExport",
"[",
"0",
"]",
"=",
"new",
"FileChooserFilter",
"(",
"javax",
".",
"sound",
".",
"sampled",
".",
"AudioFileFormat",
".",
"Type",
".",
"WAVE",
".",
"getExtension",
"(",
")",
",",
"javax",
".",
"sound",
".",
"sampled",
".",
"AudioFileFormat",
".",
"Type",
".",
"WAVE",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Create the file filters so that we do have them for
the dialogs
@since 05.01.2008
|
[
"Create",
"the",
"file",
"filters",
"so",
"that",
"we",
"do",
"have",
"them",
"for",
"the",
"dialogs"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L548-L589
|
150,810
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/MainForm.java
|
MainForm.initialize
|
private void initialize()
{
Log.addLogListener(new LogMessageCallBack()
{
@Override
public void debug(String message)
{
showMessage(message);
}
@Override
public void info(String message)
{
showMessage(message);
}
@Override
public void error(String message, Throwable ex)
{
if (ex!=null)
showMessage(message+'|'+ex.toString());
else
showMessage(message);
}
});
readPropertyFile();
setSystemTray();
setName(WINDOW_NAME);
setTitle(WINDOW_TITLE);
getTrayIcon().setToolTip(WINDOW_TITLE);
java.net.URL iconURL = MainForm.class.getResource(DEFAULTICONPATH);
if (iconURL!=null)
setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage(iconURL));
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter()
{
@Override
public void windowClosing(java.awt.event.WindowEvent e)
{
doClose();
}
/**
* @param e
* @see java.awt.event.WindowAdapter#windowIconified(java.awt.event.WindowEvent)
* @since 07.02.2012
*/
@Override
public void windowIconified(WindowEvent e)
{
if (useSystemTray) setVisible(false);
}
/**
* @param e
* @see java.awt.event.WindowAdapter#windowDeiconified(java.awt.event.WindowEvent)
* @since 07.02.2012
*/
@Override
public void windowDeiconified(WindowEvent e)
{
if (useSystemTray) setVisible(true);
}
});
setSize(mainDialogSize);
setPreferredSize(mainDialogSize);
setJMenuBar(getBaseMenuBar());
setContentPane(getBaseContentPane());
setPlayListIcons();
// Volumecontrol by mousewheel:
addMouseWheelListener(new MouseWheelVolumeControl());
pack();
createAllWindows();
updateLookAndFeel(uiClassName);
if (mainDialogLocation == null || (mainDialogLocation.getX()==-1 || mainDialogLocation.getY()==-1))
mainDialogLocation = Helpers.getFrameCenteredLocation(this, null);
setLocation(mainDialogLocation);
getModInfoDialog().setVisible(modInfoDialogVisable);
getPlaylistDialog().setVisible(playlistDialogVisable);
getEffectDialog().setVisible(effectDialogVisable);
getPlayerSetUpDialog().setVisible(playerSetUpDialogVisable);
dropTargetList = new ArrayList<DropTarget>();
PlaylistDropListener myListener = new PlaylistDropListener(this);
Helpers.registerDropListener(dropTargetList, this, myListener);
MultimediaContainerManager.addMultimediaContainerEventListener(this);
createFileFilter();
currentContainer = null; //set Back to null!
showMessage("Ready...");
}
|
java
|
private void initialize()
{
Log.addLogListener(new LogMessageCallBack()
{
@Override
public void debug(String message)
{
showMessage(message);
}
@Override
public void info(String message)
{
showMessage(message);
}
@Override
public void error(String message, Throwable ex)
{
if (ex!=null)
showMessage(message+'|'+ex.toString());
else
showMessage(message);
}
});
readPropertyFile();
setSystemTray();
setName(WINDOW_NAME);
setTitle(WINDOW_TITLE);
getTrayIcon().setToolTip(WINDOW_TITLE);
java.net.URL iconURL = MainForm.class.getResource(DEFAULTICONPATH);
if (iconURL!=null)
setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage(iconURL));
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter()
{
@Override
public void windowClosing(java.awt.event.WindowEvent e)
{
doClose();
}
/**
* @param e
* @see java.awt.event.WindowAdapter#windowIconified(java.awt.event.WindowEvent)
* @since 07.02.2012
*/
@Override
public void windowIconified(WindowEvent e)
{
if (useSystemTray) setVisible(false);
}
/**
* @param e
* @see java.awt.event.WindowAdapter#windowDeiconified(java.awt.event.WindowEvent)
* @since 07.02.2012
*/
@Override
public void windowDeiconified(WindowEvent e)
{
if (useSystemTray) setVisible(true);
}
});
setSize(mainDialogSize);
setPreferredSize(mainDialogSize);
setJMenuBar(getBaseMenuBar());
setContentPane(getBaseContentPane());
setPlayListIcons();
// Volumecontrol by mousewheel:
addMouseWheelListener(new MouseWheelVolumeControl());
pack();
createAllWindows();
updateLookAndFeel(uiClassName);
if (mainDialogLocation == null || (mainDialogLocation.getX()==-1 || mainDialogLocation.getY()==-1))
mainDialogLocation = Helpers.getFrameCenteredLocation(this, null);
setLocation(mainDialogLocation);
getModInfoDialog().setVisible(modInfoDialogVisable);
getPlaylistDialog().setVisible(playlistDialogVisable);
getEffectDialog().setVisible(effectDialogVisable);
getPlayerSetUpDialog().setVisible(playerSetUpDialogVisable);
dropTargetList = new ArrayList<DropTarget>();
PlaylistDropListener myListener = new PlaylistDropListener(this);
Helpers.registerDropListener(dropTargetList, this, myListener);
MultimediaContainerManager.addMultimediaContainerEventListener(this);
createFileFilter();
currentContainer = null; //set Back to null!
showMessage("Ready...");
}
|
[
"private",
"void",
"initialize",
"(",
")",
"{",
"Log",
".",
"addLogListener",
"(",
"new",
"LogMessageCallBack",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"debug",
"(",
"String",
"message",
")",
"{",
"showMessage",
"(",
"message",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"info",
"(",
"String",
"message",
")",
"{",
"showMessage",
"(",
"message",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"error",
"(",
"String",
"message",
",",
"Throwable",
"ex",
")",
"{",
"if",
"(",
"ex",
"!=",
"null",
")",
"showMessage",
"(",
"message",
"+",
"'",
"'",
"+",
"ex",
".",
"toString",
"(",
")",
")",
";",
"else",
"showMessage",
"(",
"message",
")",
";",
"}",
"}",
")",
";",
"readPropertyFile",
"(",
")",
";",
"setSystemTray",
"(",
")",
";",
"setName",
"(",
"WINDOW_NAME",
")",
";",
"setTitle",
"(",
"WINDOW_TITLE",
")",
";",
"getTrayIcon",
"(",
")",
".",
"setToolTip",
"(",
"WINDOW_TITLE",
")",
";",
"java",
".",
"net",
".",
"URL",
"iconURL",
"=",
"MainForm",
".",
"class",
".",
"getResource",
"(",
"DEFAULTICONPATH",
")",
";",
"if",
"(",
"iconURL",
"!=",
"null",
")",
"setIconImage",
"(",
"java",
".",
"awt",
".",
"Toolkit",
".",
"getDefaultToolkit",
"(",
")",
".",
"getImage",
"(",
"iconURL",
")",
")",
";",
"setDefaultCloseOperation",
"(",
"javax",
".",
"swing",
".",
"WindowConstants",
".",
"DISPOSE_ON_CLOSE",
")",
";",
"addWindowListener",
"(",
"new",
"java",
".",
"awt",
".",
"event",
".",
"WindowAdapter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"windowClosing",
"(",
"java",
".",
"awt",
".",
"event",
".",
"WindowEvent",
"e",
")",
"{",
"doClose",
"(",
")",
";",
"}",
"/**\n\t\t\t * @param e\n\t\t\t * @see java.awt.event.WindowAdapter#windowIconified(java.awt.event.WindowEvent)\n\t\t\t * @since 07.02.2012\n\t\t\t */",
"@",
"Override",
"public",
"void",
"windowIconified",
"(",
"WindowEvent",
"e",
")",
"{",
"if",
"(",
"useSystemTray",
")",
"setVisible",
"(",
"false",
")",
";",
"}",
"/**\n\t\t\t * @param e\n\t\t\t * @see java.awt.event.WindowAdapter#windowDeiconified(java.awt.event.WindowEvent)\n\t\t\t * @since 07.02.2012\n\t\t\t */",
"@",
"Override",
"public",
"void",
"windowDeiconified",
"(",
"WindowEvent",
"e",
")",
"{",
"if",
"(",
"useSystemTray",
")",
"setVisible",
"(",
"true",
")",
";",
"}",
"}",
")",
";",
"setSize",
"(",
"mainDialogSize",
")",
";",
"setPreferredSize",
"(",
"mainDialogSize",
")",
";",
"setJMenuBar",
"(",
"getBaseMenuBar",
"(",
")",
")",
";",
"setContentPane",
"(",
"getBaseContentPane",
"(",
")",
")",
";",
"setPlayListIcons",
"(",
")",
";",
"// Volumecontrol by mousewheel:",
"addMouseWheelListener",
"(",
"new",
"MouseWheelVolumeControl",
"(",
")",
")",
";",
"pack",
"(",
")",
";",
"createAllWindows",
"(",
")",
";",
"updateLookAndFeel",
"(",
"uiClassName",
")",
";",
"if",
"(",
"mainDialogLocation",
"==",
"null",
"||",
"(",
"mainDialogLocation",
".",
"getX",
"(",
")",
"==",
"-",
"1",
"||",
"mainDialogLocation",
".",
"getY",
"(",
")",
"==",
"-",
"1",
")",
")",
"mainDialogLocation",
"=",
"Helpers",
".",
"getFrameCenteredLocation",
"(",
"this",
",",
"null",
")",
";",
"setLocation",
"(",
"mainDialogLocation",
")",
";",
"getModInfoDialog",
"(",
")",
".",
"setVisible",
"(",
"modInfoDialogVisable",
")",
";",
"getPlaylistDialog",
"(",
")",
".",
"setVisible",
"(",
"playlistDialogVisable",
")",
";",
"getEffectDialog",
"(",
")",
".",
"setVisible",
"(",
"effectDialogVisable",
")",
";",
"getPlayerSetUpDialog",
"(",
")",
".",
"setVisible",
"(",
"playerSetUpDialogVisable",
")",
";",
"dropTargetList",
"=",
"new",
"ArrayList",
"<",
"DropTarget",
">",
"(",
")",
";",
"PlaylistDropListener",
"myListener",
"=",
"new",
"PlaylistDropListener",
"(",
"this",
")",
";",
"Helpers",
".",
"registerDropListener",
"(",
"dropTargetList",
",",
"this",
",",
"myListener",
")",
";",
"MultimediaContainerManager",
".",
"addMultimediaContainerEventListener",
"(",
"this",
")",
";",
"createFileFilter",
"(",
")",
";",
"currentContainer",
"=",
"null",
";",
"//set Back to null!",
"showMessage",
"(",
"\"Ready...\"",
")",
";",
"}"
] |
Do main initials
@since 22.06.2006
|
[
"Do",
"main",
"initials"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L594-L691
|
150,811
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/MainForm.java
|
MainForm.setLookAndFeel
|
private void setLookAndFeel(String lookAndFeelClassName)
{
try
{
javax.swing.UIManager.setLookAndFeel(lookAndFeelClassName);
}
catch (Throwable e)
{
showMessage("The selected Look&Feel is not supported or not reachable through the classpath. Switching to system default...");
try
{
lookAndFeelClassName = javax.swing.UIManager.getSystemLookAndFeelClassName();
javax.swing.UIManager.setLookAndFeel(lookAndFeelClassName);
}
catch (Throwable e1)
{
Log.error("[MainForm]", e1);
}
}
}
|
java
|
private void setLookAndFeel(String lookAndFeelClassName)
{
try
{
javax.swing.UIManager.setLookAndFeel(lookAndFeelClassName);
}
catch (Throwable e)
{
showMessage("The selected Look&Feel is not supported or not reachable through the classpath. Switching to system default...");
try
{
lookAndFeelClassName = javax.swing.UIManager.getSystemLookAndFeelClassName();
javax.swing.UIManager.setLookAndFeel(lookAndFeelClassName);
}
catch (Throwable e1)
{
Log.error("[MainForm]", e1);
}
}
}
|
[
"private",
"void",
"setLookAndFeel",
"(",
"String",
"lookAndFeelClassName",
")",
"{",
"try",
"{",
"javax",
".",
"swing",
".",
"UIManager",
".",
"setLookAndFeel",
"(",
"lookAndFeelClassName",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"showMessage",
"(",
"\"The selected Look&Feel is not supported or not reachable through the classpath. Switching to system default...\"",
")",
";",
"try",
"{",
"lookAndFeelClassName",
"=",
"javax",
".",
"swing",
".",
"UIManager",
".",
"getSystemLookAndFeelClassName",
"(",
")",
";",
"javax",
".",
"swing",
".",
"UIManager",
".",
"setLookAndFeel",
"(",
"lookAndFeelClassName",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e1",
")",
"{",
"Log",
".",
"error",
"(",
"\"[MainForm]\"",
",",
"e1",
")",
";",
"}",
"}",
"}"
] |
set the selected look and feel
@since 01.07.2006
@param lookAndFeelClassName
@return
|
[
"set",
"the",
"selected",
"look",
"and",
"feel"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L745-L764
|
150,812
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/MainForm.java
|
MainForm.updateLookAndFeel
|
private void updateLookAndFeel(String lookAndFeelClassName)
{
setLookAndFeel(lookAndFeelClassName);
MultimediaContainerManager.updateLookAndFeel();
SwingUtilities.updateComponentTreeUI(this); pack();
for (Window window : windows)
{
SwingUtilities.updateComponentTreeUI(window); window.pack();
}
}
|
java
|
private void updateLookAndFeel(String lookAndFeelClassName)
{
setLookAndFeel(lookAndFeelClassName);
MultimediaContainerManager.updateLookAndFeel();
SwingUtilities.updateComponentTreeUI(this); pack();
for (Window window : windows)
{
SwingUtilities.updateComponentTreeUI(window); window.pack();
}
}
|
[
"private",
"void",
"updateLookAndFeel",
"(",
"String",
"lookAndFeelClassName",
")",
"{",
"setLookAndFeel",
"(",
"lookAndFeelClassName",
")",
";",
"MultimediaContainerManager",
".",
"updateLookAndFeel",
"(",
")",
";",
"SwingUtilities",
".",
"updateComponentTreeUI",
"(",
"this",
")",
";",
"pack",
"(",
")",
";",
"for",
"(",
"Window",
"window",
":",
"windows",
")",
"{",
"SwingUtilities",
".",
"updateComponentTreeUI",
"(",
"window",
")",
";",
"window",
".",
"pack",
"(",
")",
";",
"}",
"}"
] |
Changes the look and feel to the new ClassName
@since 22.06.2006
@param lookAndFeelClassName
@return
|
[
"Changes",
"the",
"look",
"and",
"feel",
"to",
"the",
"new",
"ClassName"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L771-L780
|
150,813
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/MainForm.java
|
MainForm.doClose
|
private void doClose()
{
// set visible, if system tray active and frame is iconified
if (useSystemTray && (getExtendedState()&ICONIFIED)!=0) setVisible(true);
doStopPlaying();
getSeekBarPanel().pauseThread();
getVULMeterPanel().pauseThread();
getVURMeterPanel().pauseThread();
getSALMeterPanel().pauseThread();
getSARMeterPanel().pauseThread();
getLEDScrollPanel().pauseThread();
writePropertyFile();
if (audioProcessor!=null) audioProcessor.removeListener(this);
MultimediaContainerManager.removeMultimediaContainerEventListener(this);
useSystemTray = false; setSystemTray();
for (Window win : windows)
{
win.setVisible(false);
win.dispose();
}
setVisible(false);
dispose();
System.exit(0); // this should not be needed!
}
|
java
|
private void doClose()
{
// set visible, if system tray active and frame is iconified
if (useSystemTray && (getExtendedState()&ICONIFIED)!=0) setVisible(true);
doStopPlaying();
getSeekBarPanel().pauseThread();
getVULMeterPanel().pauseThread();
getVURMeterPanel().pauseThread();
getSALMeterPanel().pauseThread();
getSARMeterPanel().pauseThread();
getLEDScrollPanel().pauseThread();
writePropertyFile();
if (audioProcessor!=null) audioProcessor.removeListener(this);
MultimediaContainerManager.removeMultimediaContainerEventListener(this);
useSystemTray = false; setSystemTray();
for (Window win : windows)
{
win.setVisible(false);
win.dispose();
}
setVisible(false);
dispose();
System.exit(0); // this should not be needed!
}
|
[
"private",
"void",
"doClose",
"(",
")",
"{",
"// set visible, if system tray active and frame is iconified",
"if",
"(",
"useSystemTray",
"&&",
"(",
"getExtendedState",
"(",
")",
"&",
"ICONIFIED",
")",
"!=",
"0",
")",
"setVisible",
"(",
"true",
")",
";",
"doStopPlaying",
"(",
")",
";",
"getSeekBarPanel",
"(",
")",
".",
"pauseThread",
"(",
")",
";",
"getVULMeterPanel",
"(",
")",
".",
"pauseThread",
"(",
")",
";",
"getVURMeterPanel",
"(",
")",
".",
"pauseThread",
"(",
")",
";",
"getSALMeterPanel",
"(",
")",
".",
"pauseThread",
"(",
")",
";",
"getSARMeterPanel",
"(",
")",
".",
"pauseThread",
"(",
")",
";",
"getLEDScrollPanel",
"(",
")",
".",
"pauseThread",
"(",
")",
";",
"writePropertyFile",
"(",
")",
";",
"if",
"(",
"audioProcessor",
"!=",
"null",
")",
"audioProcessor",
".",
"removeListener",
"(",
"this",
")",
";",
"MultimediaContainerManager",
".",
"removeMultimediaContainerEventListener",
"(",
"this",
")",
";",
"useSystemTray",
"=",
"false",
";",
"setSystemTray",
"(",
")",
";",
"for",
"(",
"Window",
"win",
":",
"windows",
")",
"{",
"win",
".",
"setVisible",
"(",
"false",
")",
";",
"win",
".",
"dispose",
"(",
")",
";",
"}",
"setVisible",
"(",
"false",
")",
";",
"dispose",
"(",
")",
";",
"System",
".",
"exit",
"(",
"0",
")",
";",
"// this should not be needed! ",
"}"
] |
Default Close Operation
@since 22.06.2006
|
[
"Default",
"Close",
"Operation"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L2065-L2093
|
150,814
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/MainForm.java
|
MainForm.doOpenFile
|
public void doOpenFile(File[] files)
{
if (files!=null)
{
if (files.length==1)
{
File f = files[0];
if (f.isFile())
{
String modFileName = f.getAbsolutePath();
int i = modFileName.lastIndexOf(File.separatorChar);
searchPath = modFileName.substring(0, i);
loadMultimediaOrPlayListFile(Helpers.createURLfromFile(f));
}
else
if (f.isDirectory())
{
searchPath = f.getAbsolutePath();
}
}
else
{
playlistRecieved(null, PlayList.createNewListWithFiles(files, false, false), null);
}
}
}
|
java
|
public void doOpenFile(File[] files)
{
if (files!=null)
{
if (files.length==1)
{
File f = files[0];
if (f.isFile())
{
String modFileName = f.getAbsolutePath();
int i = modFileName.lastIndexOf(File.separatorChar);
searchPath = modFileName.substring(0, i);
loadMultimediaOrPlayListFile(Helpers.createURLfromFile(f));
}
else
if (f.isDirectory())
{
searchPath = f.getAbsolutePath();
}
}
else
{
playlistRecieved(null, PlayList.createNewListWithFiles(files, false, false), null);
}
}
}
|
[
"public",
"void",
"doOpenFile",
"(",
"File",
"[",
"]",
"files",
")",
"{",
"if",
"(",
"files",
"!=",
"null",
")",
"{",
"if",
"(",
"files",
".",
"length",
"==",
"1",
")",
"{",
"File",
"f",
"=",
"files",
"[",
"0",
"]",
";",
"if",
"(",
"f",
".",
"isFile",
"(",
")",
")",
"{",
"String",
"modFileName",
"=",
"f",
".",
"getAbsolutePath",
"(",
")",
";",
"int",
"i",
"=",
"modFileName",
".",
"lastIndexOf",
"(",
"File",
".",
"separatorChar",
")",
";",
"searchPath",
"=",
"modFileName",
".",
"substring",
"(",
"0",
",",
"i",
")",
";",
"loadMultimediaOrPlayListFile",
"(",
"Helpers",
".",
"createURLfromFile",
"(",
"f",
")",
")",
";",
"}",
"else",
"if",
"(",
"f",
".",
"isDirectory",
"(",
")",
")",
"{",
"searchPath",
"=",
"f",
".",
"getAbsolutePath",
"(",
")",
";",
"}",
"}",
"else",
"{",
"playlistRecieved",
"(",
"null",
",",
"PlayList",
".",
"createNewListWithFiles",
"(",
"files",
",",
"false",
",",
"false",
")",
",",
"null",
")",
";",
"}",
"}",
"}"
] |
Open a new File
@since 22.06.2006
|
[
"Open",
"a",
"new",
"File"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L2108-L2133
|
150,815
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/MainForm.java
|
MainForm.doExportToWave
|
private void doExportToWave()
{
doStopPlaying();
if (currentContainer==null)
{
JOptionPane.showMessageDialog(this, "You need to load a file first!", "Ups!", JOptionPane.ERROR_MESSAGE);
}
else
{
do
{
String fileName = Helpers.createLocalFileStringFromURL(currentContainer.getFileURL(), true);
fileName = fileName.substring(fileName.lastIndexOf(File.separatorChar)+1);
String exportToWav = exportPath + File.separatorChar + fileName + ".WAV";
FileChooserResult selectedFile = Helpers.selectFileNameFor(this, exportToWav, "Export to wave", fileFilterExport, 1, false, false);
if (selectedFile!=null)
{
File f = selectedFile.getSelectedFile();
if (f!=null)
{
if (f.exists())
{
int result = JOptionPane.showConfirmDialog(this, "File already exists! Overwrite?", "Overwrite confirmation", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (result==JOptionPane.CANCEL_OPTION) return;
if (result==JOptionPane.NO_OPTION) continue; // Reselect
boolean ok = f.delete();
if (!ok)
{
JOptionPane.showMessageDialog(MainForm.this, "Overwrite failed. Is file write protected or in use?", "Failed", JOptionPane.ERROR_MESSAGE);
return;
}
}
// get Export Type from selected filechooser index (find the index ;) )
String modFileName = f.getAbsolutePath();
int i = modFileName.lastIndexOf(File.separatorChar);
exportPath = modFileName.substring(0, i);
int result = JOptionPane.showConfirmDialog(this, "Continue playback while exporting?", "Playback?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
Mixer mixer = createNewMixer();
mixer.setPlayDuringExport(result==JOptionPane.YES_OPTION);
mixer.setExportFile(f);
playerThread = new PlayThread(mixer, this);
playerThread.start();
inExportMode = true; // Signal, that we are exporting right now...
}
}
return;
}
while (true);
}
}
|
java
|
private void doExportToWave()
{
doStopPlaying();
if (currentContainer==null)
{
JOptionPane.showMessageDialog(this, "You need to load a file first!", "Ups!", JOptionPane.ERROR_MESSAGE);
}
else
{
do
{
String fileName = Helpers.createLocalFileStringFromURL(currentContainer.getFileURL(), true);
fileName = fileName.substring(fileName.lastIndexOf(File.separatorChar)+1);
String exportToWav = exportPath + File.separatorChar + fileName + ".WAV";
FileChooserResult selectedFile = Helpers.selectFileNameFor(this, exportToWav, "Export to wave", fileFilterExport, 1, false, false);
if (selectedFile!=null)
{
File f = selectedFile.getSelectedFile();
if (f!=null)
{
if (f.exists())
{
int result = JOptionPane.showConfirmDialog(this, "File already exists! Overwrite?", "Overwrite confirmation", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (result==JOptionPane.CANCEL_OPTION) return;
if (result==JOptionPane.NO_OPTION) continue; // Reselect
boolean ok = f.delete();
if (!ok)
{
JOptionPane.showMessageDialog(MainForm.this, "Overwrite failed. Is file write protected or in use?", "Failed", JOptionPane.ERROR_MESSAGE);
return;
}
}
// get Export Type from selected filechooser index (find the index ;) )
String modFileName = f.getAbsolutePath();
int i = modFileName.lastIndexOf(File.separatorChar);
exportPath = modFileName.substring(0, i);
int result = JOptionPane.showConfirmDialog(this, "Continue playback while exporting?", "Playback?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
Mixer mixer = createNewMixer();
mixer.setPlayDuringExport(result==JOptionPane.YES_OPTION);
mixer.setExportFile(f);
playerThread = new PlayThread(mixer, this);
playerThread.start();
inExportMode = true; // Signal, that we are exporting right now...
}
}
return;
}
while (true);
}
}
|
[
"private",
"void",
"doExportToWave",
"(",
")",
"{",
"doStopPlaying",
"(",
")",
";",
"if",
"(",
"currentContainer",
"==",
"null",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"this",
",",
"\"You need to load a file first!\"",
",",
"\"Ups!\"",
",",
"JOptionPane",
".",
"ERROR_MESSAGE",
")",
";",
"}",
"else",
"{",
"do",
"{",
"String",
"fileName",
"=",
"Helpers",
".",
"createLocalFileStringFromURL",
"(",
"currentContainer",
".",
"getFileURL",
"(",
")",
",",
"true",
")",
";",
"fileName",
"=",
"fileName",
".",
"substring",
"(",
"fileName",
".",
"lastIndexOf",
"(",
"File",
".",
"separatorChar",
")",
"+",
"1",
")",
";",
"String",
"exportToWav",
"=",
"exportPath",
"+",
"File",
".",
"separatorChar",
"+",
"fileName",
"+",
"\".WAV\"",
";",
"FileChooserResult",
"selectedFile",
"=",
"Helpers",
".",
"selectFileNameFor",
"(",
"this",
",",
"exportToWav",
",",
"\"Export to wave\"",
",",
"fileFilterExport",
",",
"1",
",",
"false",
",",
"false",
")",
";",
"if",
"(",
"selectedFile",
"!=",
"null",
")",
"{",
"File",
"f",
"=",
"selectedFile",
".",
"getSelectedFile",
"(",
")",
";",
"if",
"(",
"f",
"!=",
"null",
")",
"{",
"if",
"(",
"f",
".",
"exists",
"(",
")",
")",
"{",
"int",
"result",
"=",
"JOptionPane",
".",
"showConfirmDialog",
"(",
"this",
",",
"\"File already exists! Overwrite?\"",
",",
"\"Overwrite confirmation\"",
",",
"JOptionPane",
".",
"YES_NO_CANCEL_OPTION",
",",
"JOptionPane",
".",
"QUESTION_MESSAGE",
")",
";",
"if",
"(",
"result",
"==",
"JOptionPane",
".",
"CANCEL_OPTION",
")",
"return",
";",
"if",
"(",
"result",
"==",
"JOptionPane",
".",
"NO_OPTION",
")",
"continue",
";",
"// Reselect",
"boolean",
"ok",
"=",
"f",
".",
"delete",
"(",
")",
";",
"if",
"(",
"!",
"ok",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"MainForm",
".",
"this",
",",
"\"Overwrite failed. Is file write protected or in use?\"",
",",
"\"Failed\"",
",",
"JOptionPane",
".",
"ERROR_MESSAGE",
")",
";",
"return",
";",
"}",
"}",
"// get Export Type from selected filechooser index (find the index ;) )",
"String",
"modFileName",
"=",
"f",
".",
"getAbsolutePath",
"(",
")",
";",
"int",
"i",
"=",
"modFileName",
".",
"lastIndexOf",
"(",
"File",
".",
"separatorChar",
")",
";",
"exportPath",
"=",
"modFileName",
".",
"substring",
"(",
"0",
",",
"i",
")",
";",
"int",
"result",
"=",
"JOptionPane",
".",
"showConfirmDialog",
"(",
"this",
",",
"\"Continue playback while exporting?\"",
",",
"\"Playback?\"",
",",
"JOptionPane",
".",
"YES_NO_OPTION",
",",
"JOptionPane",
".",
"QUESTION_MESSAGE",
")",
";",
"Mixer",
"mixer",
"=",
"createNewMixer",
"(",
")",
";",
"mixer",
".",
"setPlayDuringExport",
"(",
"result",
"==",
"JOptionPane",
".",
"YES_OPTION",
")",
";",
"mixer",
".",
"setExportFile",
"(",
"f",
")",
";",
"playerThread",
"=",
"new",
"PlayThread",
"(",
"mixer",
",",
"this",
")",
";",
"playerThread",
".",
"start",
"(",
")",
";",
"inExportMode",
"=",
"true",
";",
"// Signal, that we are exporting right now...",
"}",
"}",
"return",
";",
"}",
"while",
"(",
"true",
")",
";",
"}",
"}"
] |
Exports to a Wavefile
@since 01.07.2006
|
[
"Exports",
"to",
"a",
"Wavefile"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L2159-L2211
|
150,816
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/MainForm.java
|
MainForm.doStopPlaying
|
private void doStopPlaying()
{
if (playerThread!=null)
{
playerThread.stopMod();
getSoundOutputStream().closeAllDevices();
playerThread = null;
removeMixer();
}
}
|
java
|
private void doStopPlaying()
{
if (playerThread!=null)
{
playerThread.stopMod();
getSoundOutputStream().closeAllDevices();
playerThread = null;
removeMixer();
}
}
|
[
"private",
"void",
"doStopPlaying",
"(",
")",
"{",
"if",
"(",
"playerThread",
"!=",
"null",
")",
"{",
"playerThread",
".",
"stopMod",
"(",
")",
";",
"getSoundOutputStream",
"(",
")",
".",
"closeAllDevices",
"(",
")",
";",
"playerThread",
"=",
"null",
";",
"removeMixer",
"(",
")",
";",
"}",
"}"
] |
stop playback of a mod
@since 01.07.2006
|
[
"stop",
"playback",
"of",
"a",
"mod"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L2354-L2363
|
150,817
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/gui/MainForm.java
|
MainForm.showMessage
|
private synchronized void showMessage(final String msg)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
getMessages().setText(msg);
}
});
}
|
java
|
private synchronized void showMessage(final String msg)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
getMessages().setText(msg);
}
});
}
|
[
"private",
"synchronized",
"void",
"showMessage",
"(",
"final",
"String",
"msg",
")",
"{",
"SwingUtilities",
".",
"invokeLater",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"getMessages",
"(",
")",
".",
"setText",
"(",
"msg",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Shows the given Message
@since 22.06.2006
@param msg
|
[
"Shows",
"the",
"given",
"Message"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L2559-L2568
|
150,818
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java
|
Threading.registerResource
|
public static void registerResource(Object resource, TaskManager tm) {
if (resource == null) return;
synchronized (resources) {
resources.put(resource, tm);
}
}
|
java
|
public static void registerResource(Object resource, TaskManager tm) {
if (resource == null) return;
synchronized (resources) {
resources.put(resource, tm);
}
}
|
[
"public",
"static",
"void",
"registerResource",
"(",
"Object",
"resource",
",",
"TaskManager",
"tm",
")",
"{",
"if",
"(",
"resource",
"==",
"null",
")",
"return",
";",
"synchronized",
"(",
"resources",
")",
"{",
"resources",
".",
"put",
"(",
"resource",
",",
"tm",
")",
";",
"}",
"}"
] |
Register a resource.
|
[
"Register",
"a",
"resource",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java#L159-L164
|
150,819
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java
|
Threading.unregisterResource
|
public static TaskManager unregisterResource(Object resource) {
if (resource == null) return null;
synchronized (resources) {
return resources.remove(resource);
}
}
|
java
|
public static TaskManager unregisterResource(Object resource) {
if (resource == null) return null;
synchronized (resources) {
return resources.remove(resource);
}
}
|
[
"public",
"static",
"TaskManager",
"unregisterResource",
"(",
"Object",
"resource",
")",
"{",
"if",
"(",
"resource",
"==",
"null",
")",
"return",
"null",
";",
"synchronized",
"(",
"resources",
")",
"{",
"return",
"resources",
".",
"remove",
"(",
"resource",
")",
";",
"}",
"}"
] |
Unregister a resource.
|
[
"Unregister",
"a",
"resource",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java#L167-L172
|
150,820
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java
|
Threading.registerBlockedThreadHandler
|
public static void registerBlockedThreadHandler(BlockedThreadHandler handler, Thread thread) {
synchronized (blockedHandlers) {
blockedHandlers.put(thread, handler);
}
}
|
java
|
public static void registerBlockedThreadHandler(BlockedThreadHandler handler, Thread thread) {
synchronized (blockedHandlers) {
blockedHandlers.put(thread, handler);
}
}
|
[
"public",
"static",
"void",
"registerBlockedThreadHandler",
"(",
"BlockedThreadHandler",
"handler",
",",
"Thread",
"thread",
")",
"{",
"synchronized",
"(",
"blockedHandlers",
")",
"{",
"blockedHandlers",
".",
"put",
"(",
"thread",
",",
"handler",
")",
";",
"}",
"}"
] |
Rregister the given thread.
|
[
"Rregister",
"the",
"given",
"thread",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java#L189-L193
|
150,821
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java
|
Threading.waitFinished
|
public static void waitFinished(Collection<? extends Task<?,?>> tasks) throws Exception {
for (Task<?,?> t : tasks) {
t.getOutput().blockThrow(0);
}
}
|
java
|
public static void waitFinished(Collection<? extends Task<?,?>> tasks) throws Exception {
for (Task<?,?> t : tasks) {
t.getOutput().blockThrow(0);
}
}
|
[
"public",
"static",
"void",
"waitFinished",
"(",
"Collection",
"<",
"?",
"extends",
"Task",
"<",
"?",
",",
"?",
">",
">",
"tasks",
")",
"throws",
"Exception",
"{",
"for",
"(",
"Task",
"<",
"?",
",",
"?",
">",
"t",
":",
"tasks",
")",
"{",
"t",
".",
"getOutput",
"(",
")",
".",
"blockThrow",
"(",
"0",
")",
";",
"}",
"}"
] |
Wait for the given tasks to be done.
|
[
"Wait",
"for",
"the",
"given",
"tasks",
"to",
"be",
"done",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java#L208-L212
|
150,822
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java
|
Threading.waitUnblockedWithError
|
public static <TError extends Exception> void waitUnblockedWithError(Collection<AsyncWork<?,TError>> tasks) throws TError, CancelException {
for (AsyncWork<?,TError> t : tasks)
t.blockResult(0);
}
|
java
|
public static <TError extends Exception> void waitUnblockedWithError(Collection<AsyncWork<?,TError>> tasks) throws TError, CancelException {
for (AsyncWork<?,TError> t : tasks)
t.blockResult(0);
}
|
[
"public",
"static",
"<",
"TError",
"extends",
"Exception",
">",
"void",
"waitUnblockedWithError",
"(",
"Collection",
"<",
"AsyncWork",
"<",
"?",
",",
"TError",
">",
">",
"tasks",
")",
"throws",
"TError",
",",
"CancelException",
"{",
"for",
"(",
"AsyncWork",
"<",
"?",
",",
"TError",
">",
"t",
":",
"tasks",
")",
"t",
".",
"blockResult",
"(",
"0",
")",
";",
"}"
] |
Wait for the given tasks to finish, if one has an error this error is immediately thrown without waiting for other tasks.
|
[
"Wait",
"for",
"the",
"given",
"tasks",
"to",
"finish",
"if",
"one",
"has",
"an",
"error",
"this",
"error",
"is",
"immediately",
"thrown",
"without",
"waiting",
"for",
"other",
"tasks",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java#L215-L218
|
150,823
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java
|
Threading.waitOneFinished
|
public static void waitOneFinished(List<? extends Task<?,?>> tasks) {
if (tasks.isEmpty()) return;
if (tasks.size() == 1)
try { tasks.get(0).getOutput().block(0); }
catch (Throwable e) { /* ignore */ }
SynchronizationPoint<Exception> sp = new SynchronizationPoint<>();
for (Task<?,?> t : tasks) {
if (t.isDone()) return;
t.getOutput().synchWithNoError(sp);
}
sp.block(0);
}
|
java
|
public static void waitOneFinished(List<? extends Task<?,?>> tasks) {
if (tasks.isEmpty()) return;
if (tasks.size() == 1)
try { tasks.get(0).getOutput().block(0); }
catch (Throwable e) { /* ignore */ }
SynchronizationPoint<Exception> sp = new SynchronizationPoint<>();
for (Task<?,?> t : tasks) {
if (t.isDone()) return;
t.getOutput().synchWithNoError(sp);
}
sp.block(0);
}
|
[
"public",
"static",
"void",
"waitOneFinished",
"(",
"List",
"<",
"?",
"extends",
"Task",
"<",
"?",
",",
"?",
">",
">",
"tasks",
")",
"{",
"if",
"(",
"tasks",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"if",
"(",
"tasks",
".",
"size",
"(",
")",
"==",
"1",
")",
"try",
"{",
"tasks",
".",
"get",
"(",
"0",
")",
".",
"getOutput",
"(",
")",
".",
"block",
"(",
"0",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"/* ignore */",
"}",
"SynchronizationPoint",
"<",
"Exception",
">",
"sp",
"=",
"new",
"SynchronizationPoint",
"<>",
"(",
")",
";",
"for",
"(",
"Task",
"<",
"?",
",",
"?",
">",
"t",
":",
"tasks",
")",
"{",
"if",
"(",
"t",
".",
"isDone",
"(",
")",
")",
"return",
";",
"t",
".",
"getOutput",
"(",
")",
".",
"synchWithNoError",
"(",
"sp",
")",
";",
"}",
"sp",
".",
"block",
"(",
"0",
")",
";",
"}"
] |
Wait for one of the given task to be done.
|
[
"Wait",
"for",
"one",
"of",
"the",
"given",
"task",
"to",
"be",
"done",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java#L221-L232
|
150,824
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java
|
Threading.debug
|
public static String debug() {
StringBuilder s = new StringBuilder();
for (TaskManager tm : resources.values())
tm.debug(s);
return s.toString();
}
|
java
|
public static String debug() {
StringBuilder s = new StringBuilder();
for (TaskManager tm : resources.values())
tm.debug(s);
return s.toString();
}
|
[
"public",
"static",
"String",
"debug",
"(",
")",
"{",
"StringBuilder",
"s",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"TaskManager",
"tm",
":",
"resources",
".",
"values",
"(",
")",
")",
"tm",
".",
"debug",
"(",
"s",
")",
";",
"return",
"s",
".",
"toString",
"(",
")",
";",
"}"
] |
Return a string containing multi-threading status for debugging purposes.
|
[
"Return",
"a",
"string",
"containing",
"multi",
"-",
"threading",
"status",
"for",
"debugging",
"purposes",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/concurrent/Threading.java#L235-L240
|
150,825
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/frame/Frame.java
|
Frame.getMaxRicePartitionOrderFromBlocksize
|
public static int getMaxRicePartitionOrderFromBlocksize(int blocksize) {
int maxRicePartitionOrder = 0;
while ((blocksize & 1) == 0) {
maxRicePartitionOrder++;
blocksize >>= 1;
}
return Math.min(Constants.MAX_RICE_PARTITION_ORDER, maxRicePartitionOrder);
}
|
java
|
public static int getMaxRicePartitionOrderFromBlocksize(int blocksize) {
int maxRicePartitionOrder = 0;
while ((blocksize & 1) == 0) {
maxRicePartitionOrder++;
blocksize >>= 1;
}
return Math.min(Constants.MAX_RICE_PARTITION_ORDER, maxRicePartitionOrder);
}
|
[
"public",
"static",
"int",
"getMaxRicePartitionOrderFromBlocksize",
"(",
"int",
"blocksize",
")",
"{",
"int",
"maxRicePartitionOrder",
"=",
"0",
";",
"while",
"(",
"(",
"blocksize",
"&",
"1",
")",
"==",
"0",
")",
"{",
"maxRicePartitionOrder",
"++",
";",
"blocksize",
">>=",
"1",
";",
"}",
"return",
"Math",
".",
"min",
"(",
"Constants",
".",
"MAX_RICE_PARTITION_ORDER",
",",
"maxRicePartitionOrder",
")",
";",
"}"
] |
Return the maximum Rice partition order based on the block size.
@param blocksize The block size
@return The maximum Rice partition order
|
[
"Return",
"the",
"maximum",
"Rice",
"partition",
"order",
"based",
"on",
"the",
"block",
"size",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/frame/Frame.java#L59-L66
|
150,826
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/CommandLine.java
|
CommandLine.showHelp
|
private static void showHelp()
{
Log.info("java -jar ./javamod [-rx] [-b{8,16,24}] [-s{+,-}] [-i{+,-}] [-w{+,-}] [-n{+,-}] [-m{+,-}] [-l{+,-}] [-h{+,-}] [-j{+,-}] [-v0.0-1.0]");
Log.info(" [-eWAVFILE] MODFILE\n");
Log.info("-rx : use Samplerate x (8000/11025/22050/44100/96000...");
Log.info(" anything allowed, your soundhardware supports)");
Log.info("-b8/16/24 : #Bits per sample");
Log.info("-s+/- : Stereo/Mono");
Log.info("-i0/1/2/3 : interpolation: 0:none; 1:linear; 2:cubic spline; 3:fir interpolation");
Log.info("-tms : ms of buffer size (30 is minimum)");
Log.info("-w+/- : do/don't wide stereo mix");
Log.info("-n+/- : do/don't noise reduction");
Log.info("-m+/- : do/don't mega bass");
Log.info("-l0/1/2 : set infinit loop handling: 0:original; 1:fade out; 2:ignore");
Log.info("-h+/- : do/don't shuffle playlists after loading");
Log.info("-j+/- : do/don't repeat playlist");
Log.info("-v0.0-1.0 : set volume");
Log.info("-eWAVEFILE : export to wave file");
}
|
java
|
private static void showHelp()
{
Log.info("java -jar ./javamod [-rx] [-b{8,16,24}] [-s{+,-}] [-i{+,-}] [-w{+,-}] [-n{+,-}] [-m{+,-}] [-l{+,-}] [-h{+,-}] [-j{+,-}] [-v0.0-1.0]");
Log.info(" [-eWAVFILE] MODFILE\n");
Log.info("-rx : use Samplerate x (8000/11025/22050/44100/96000...");
Log.info(" anything allowed, your soundhardware supports)");
Log.info("-b8/16/24 : #Bits per sample");
Log.info("-s+/- : Stereo/Mono");
Log.info("-i0/1/2/3 : interpolation: 0:none; 1:linear; 2:cubic spline; 3:fir interpolation");
Log.info("-tms : ms of buffer size (30 is minimum)");
Log.info("-w+/- : do/don't wide stereo mix");
Log.info("-n+/- : do/don't noise reduction");
Log.info("-m+/- : do/don't mega bass");
Log.info("-l0/1/2 : set infinit loop handling: 0:original; 1:fade out; 2:ignore");
Log.info("-h+/- : do/don't shuffle playlists after loading");
Log.info("-j+/- : do/don't repeat playlist");
Log.info("-v0.0-1.0 : set volume");
Log.info("-eWAVEFILE : export to wave file");
}
|
[
"private",
"static",
"void",
"showHelp",
"(",
")",
"{",
"Log",
".",
"info",
"(",
"\"java -jar ./javamod [-rx] [-b{8,16,24}] [-s{+,-}] [-i{+,-}] [-w{+,-}] [-n{+,-}] [-m{+,-}] [-l{+,-}] [-h{+,-}] [-j{+,-}] [-v0.0-1.0]\"",
")",
";",
"Log",
".",
"info",
"(",
"\" [-eWAVFILE] MODFILE\\n\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-rx : use Samplerate x (8000/11025/22050/44100/96000...\"",
")",
";",
"Log",
".",
"info",
"(",
"\" anything allowed, your soundhardware supports)\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-b8/16/24 : #Bits per sample\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-s+/- : Stereo/Mono\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-i0/1/2/3 : interpolation: 0:none; 1:linear; 2:cubic spline; 3:fir interpolation\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-tms : ms of buffer size (30 is minimum)\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-w+/- : do/don't wide stereo mix\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-n+/- : do/don't noise reduction\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-m+/- : do/don't mega bass\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-l0/1/2 : set infinit loop handling: 0:original; 1:fade out; 2:ignore\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-h+/- : do/don't shuffle playlists after loading\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-j+/- : do/don't repeat playlist\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-v0.0-1.0 : set volume\"",
")",
";",
"Log",
".",
"info",
"(",
"\"-eWAVEFILE : export to wave file\"",
")",
";",
"}"
] |
Show a help screen...
|
[
"Show",
"a",
"help",
"screen",
"..."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/CommandLine.java#L74-L92
|
150,827
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/CommandLine.java
|
CommandLine.doStartPlaying
|
private void doStartPlaying()
{
if (currentContainer!=null)
{
doStopPlaying();
if (currentContainer instanceof ModContainer)
{
System.out.println(((ModContainer) currentContainer).getCurrentMod().toString());
}
Mixer mixer = createNewMixer();
mixer.setExportFile(wavFileName);
playerThread = new PlayThread(mixer, this);
playerThread.start();
}
}
|
java
|
private void doStartPlaying()
{
if (currentContainer!=null)
{
doStopPlaying();
if (currentContainer instanceof ModContainer)
{
System.out.println(((ModContainer) currentContainer).getCurrentMod().toString());
}
Mixer mixer = createNewMixer();
mixer.setExportFile(wavFileName);
playerThread = new PlayThread(mixer, this);
playerThread.start();
}
}
|
[
"private",
"void",
"doStartPlaying",
"(",
")",
"{",
"if",
"(",
"currentContainer",
"!=",
"null",
")",
"{",
"doStopPlaying",
"(",
")",
";",
"if",
"(",
"currentContainer",
"instanceof",
"ModContainer",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"(",
"(",
"ModContainer",
")",
"currentContainer",
")",
".",
"getCurrentMod",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"Mixer",
"mixer",
"=",
"createNewMixer",
"(",
")",
";",
"mixer",
".",
"setExportFile",
"(",
"wavFileName",
")",
";",
"playerThread",
"=",
"new",
"PlayThread",
"(",
"mixer",
",",
"this",
")",
";",
"playerThread",
".",
"start",
"(",
")",
";",
"}",
"}"
] |
Plays the modfile with the current
parameters set
|
[
"Plays",
"the",
"modfile",
"with",
"the",
"current",
"parameters",
"set"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/CommandLine.java#L195-L209
|
150,828
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/menu/MenuList.java
|
MenuList.add
|
public Menu add(Menu m) {
submenus.add(m);
m.setParent(this);
return m;
}
|
java
|
public Menu add(Menu m) {
submenus.add(m);
m.setParent(this);
return m;
}
|
[
"public",
"Menu",
"add",
"(",
"Menu",
"m",
")",
"{",
"submenus",
".",
"add",
"(",
"m",
")",
";",
"m",
".",
"setParent",
"(",
"this",
")",
";",
"return",
"m",
";",
"}"
] |
Add the given menu to the submenu list
@param m The submenu to add
@return The same added menu.
|
[
"Add",
"the",
"given",
"menu",
"to",
"the",
"submenu",
"list"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/menu/MenuList.java#L24-L28
|
150,829
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/event/ListenableLongProperty.java
|
ListenableLongProperty.set
|
public void set(long value) {
if (this.value == value) return;
long previous = this.value;
this.value = value;
event.fire(Long.valueOf(previous));
}
|
java
|
public void set(long value) {
if (this.value == value) return;
long previous = this.value;
this.value = value;
event.fire(Long.valueOf(previous));
}
|
[
"public",
"void",
"set",
"(",
"long",
"value",
")",
"{",
"if",
"(",
"this",
".",
"value",
"==",
"value",
")",
"return",
";",
"long",
"previous",
"=",
"this",
".",
"value",
";",
"this",
".",
"value",
"=",
"value",
";",
"event",
".",
"fire",
"(",
"Long",
".",
"valueOf",
"(",
"previous",
")",
")",
";",
"}"
] |
Set a new value.
|
[
"Set",
"a",
"new",
"value",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/event/ListenableLongProperty.java#L25-L30
|
150,830
|
PistoiaHELM/ChemistryToolkit
|
src/main/java/org/helm/chemtoolkit/AbstractChemistryManipulator.java
|
AbstractChemistryManipulator.convertExtendedSmiles
|
public String convertExtendedSmiles(String data){
if(data != null){
Pattern pattern = Pattern.compile("\\[\\*\\]|\\*");
Matcher matcher = pattern.matcher(data);
if(matcher != null){
String smiles = data.split("\\|")[0];
List<Integer> rgroupInformation = extractRgroups(data);
StringBuilder sb = new StringBuilder();
int start = 0;
int index = 0;
String rGroup = "";
while(matcher.find() && rgroupInformation.size() > 0){
rGroup = smiles.substring(start, matcher.end());
rGroup = rGroup.replace(matcher.group(), "[*:" +rgroupInformation.get(index) + "]");
sb.append(rGroup);
index ++;
start = matcher.end();
}
if( start < smiles.length()){
sb.append(smiles.substring(start));
}
return sb.toString();
}
}
return data;
}
|
java
|
public String convertExtendedSmiles(String data){
if(data != null){
Pattern pattern = Pattern.compile("\\[\\*\\]|\\*");
Matcher matcher = pattern.matcher(data);
if(matcher != null){
String smiles = data.split("\\|")[0];
List<Integer> rgroupInformation = extractRgroups(data);
StringBuilder sb = new StringBuilder();
int start = 0;
int index = 0;
String rGroup = "";
while(matcher.find() && rgroupInformation.size() > 0){
rGroup = smiles.substring(start, matcher.end());
rGroup = rGroup.replace(matcher.group(), "[*:" +rgroupInformation.get(index) + "]");
sb.append(rGroup);
index ++;
start = matcher.end();
}
if( start < smiles.length()){
sb.append(smiles.substring(start));
}
return sb.toString();
}
}
return data;
}
|
[
"public",
"String",
"convertExtendedSmiles",
"(",
"String",
"data",
")",
"{",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"\"\\\\[\\\\*\\\\]|\\\\*\"",
")",
";",
"Matcher",
"matcher",
"=",
"pattern",
".",
"matcher",
"(",
"data",
")",
";",
"if",
"(",
"matcher",
"!=",
"null",
")",
"{",
"String",
"smiles",
"=",
"data",
".",
"split",
"(",
"\"\\\\|\"",
")",
"[",
"0",
"]",
";",
"List",
"<",
"Integer",
">",
"rgroupInformation",
"=",
"extractRgroups",
"(",
"data",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"start",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"String",
"rGroup",
"=",
"\"\"",
";",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
"&&",
"rgroupInformation",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"rGroup",
"=",
"smiles",
".",
"substring",
"(",
"start",
",",
"matcher",
".",
"end",
"(",
")",
")",
";",
"rGroup",
"=",
"rGroup",
".",
"replace",
"(",
"matcher",
".",
"group",
"(",
")",
",",
"\"[*:\"",
"+",
"rgroupInformation",
".",
"get",
"(",
"index",
")",
"+",
"\"]\"",
")",
";",
"sb",
".",
"append",
"(",
"rGroup",
")",
";",
"index",
"++",
";",
"start",
"=",
"matcher",
".",
"end",
"(",
")",
";",
"}",
"if",
"(",
"start",
"<",
"smiles",
".",
"length",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"smiles",
".",
"substring",
"(",
"start",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"}",
"return",
"data",
";",
"}"
] |
convert extended smiles format to smiles with atom mappings
@param data chemical notation to convert
@return chemical notation
|
[
"convert",
"extended",
"smiles",
"format",
"to",
"smiles",
"with",
"atom",
"mappings"
] |
f8969865b3e9d4dd796ff3e536613a96d69a395d
|
https://github.com/PistoiaHELM/ChemistryToolkit/blob/f8969865b3e9d4dd796ff3e536613a96d69a395d/src/main/java/org/helm/chemtoolkit/AbstractChemistryManipulator.java#L103-L128
|
150,831
|
PistoiaHELM/ChemistryToolkit
|
src/main/java/org/helm/chemtoolkit/AbstractChemistryManipulator.java
|
AbstractChemistryManipulator.extractRgroups
|
private List<Integer> extractRgroups(String data){
Pattern pattern = Pattern.compile("R[1-9]\\d*");
Matcher matcher = pattern.matcher(data);
List<Integer> listValues = new ArrayList<Integer>();
while(matcher.find()){
listValues.add(Integer.parseInt(matcher.group().split("R")[1]));
}
return listValues;
}
|
java
|
private List<Integer> extractRgroups(String data){
Pattern pattern = Pattern.compile("R[1-9]\\d*");
Matcher matcher = pattern.matcher(data);
List<Integer> listValues = new ArrayList<Integer>();
while(matcher.find()){
listValues.add(Integer.parseInt(matcher.group().split("R")[1]));
}
return listValues;
}
|
[
"private",
"List",
"<",
"Integer",
">",
"extractRgroups",
"(",
"String",
"data",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"\"R[1-9]\\\\d*\"",
")",
";",
"Matcher",
"matcher",
"=",
"pattern",
".",
"matcher",
"(",
"data",
")",
";",
"List",
"<",
"Integer",
">",
"listValues",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"while",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"listValues",
".",
"add",
"(",
"Integer",
".",
"parseInt",
"(",
"matcher",
".",
"group",
"(",
")",
".",
"split",
"(",
"\"R\"",
")",
"[",
"1",
"]",
")",
")",
";",
"}",
"return",
"listValues",
";",
"}"
] |
extract Rgroups from extended smiles
@param data extended smiles
@return List of Rgroups
|
[
"extract",
"Rgroups",
"from",
"extended",
"smiles"
] |
f8969865b3e9d4dd796ff3e536613a96d69a395d
|
https://github.com/PistoiaHELM/ChemistryToolkit/blob/f8969865b3e9d4dd796ff3e536613a96d69a395d/src/main/java/org/helm/chemtoolkit/AbstractChemistryManipulator.java#L136-L145
|
150,832
|
PistoiaHELM/ChemistryToolkit
|
src/main/java/org/helm/chemtoolkit/AbstractChemistryManipulator.java
|
AbstractChemistryManipulator.merge
|
public AbstractMolecule merge(AbstractMolecule firstContainer, IAtomBase firstRgroup,
AbstractMolecule secondContainer,
IAtomBase secondRgroup) throws CTKException {
if (firstContainer.isSingleStereo(firstRgroup) && secondContainer.isSingleStereo(secondRgroup)) {
throw new CTKException("Both R atoms are connected to chiral centers");
}
if (firstContainer == secondContainer) {
firstContainer.dearomatize();
secondContainer.dearomatize();
IAtomBase atom1 = getNeighborAtom(firstRgroup);
IAtomBase atom2 = getNeighborAtom(secondRgroup);
firstContainer.removeAttachment(firstRgroup);
firstContainer.removeAttachment(secondRgroup);
setStereoInformation(firstContainer, firstRgroup, firstContainer, secondRgroup, atom1, atom2);
firstContainer.removeINode(firstRgroup);
firstContainer.removeINode(secondRgroup);
} else {
firstContainer.dearomatize();
secondContainer.dearomatize();
IAtomBase atom1 = getNeighborAtom(firstRgroup);
IAtomBase atom2 = getNeighborAtom(secondRgroup);
firstContainer.removeAttachment(firstRgroup);
secondContainer.removeAttachment(secondRgroup);
setStereoInformation(firstContainer, firstRgroup, secondContainer, secondRgroup, atom1, atom2);
firstContainer.removeINode(firstRgroup);
secondContainer.removeINode(secondRgroup);
AttachmentList mergedAttachments = mergeAttachments(firstContainer, secondContainer);
firstContainer.addIBase(secondContainer);
firstContainer.setAttachments(mergedAttachments);
}
return firstContainer;
}
|
java
|
public AbstractMolecule merge(AbstractMolecule firstContainer, IAtomBase firstRgroup,
AbstractMolecule secondContainer,
IAtomBase secondRgroup) throws CTKException {
if (firstContainer.isSingleStereo(firstRgroup) && secondContainer.isSingleStereo(secondRgroup)) {
throw new CTKException("Both R atoms are connected to chiral centers");
}
if (firstContainer == secondContainer) {
firstContainer.dearomatize();
secondContainer.dearomatize();
IAtomBase atom1 = getNeighborAtom(firstRgroup);
IAtomBase atom2 = getNeighborAtom(secondRgroup);
firstContainer.removeAttachment(firstRgroup);
firstContainer.removeAttachment(secondRgroup);
setStereoInformation(firstContainer, firstRgroup, firstContainer, secondRgroup, atom1, atom2);
firstContainer.removeINode(firstRgroup);
firstContainer.removeINode(secondRgroup);
} else {
firstContainer.dearomatize();
secondContainer.dearomatize();
IAtomBase atom1 = getNeighborAtom(firstRgroup);
IAtomBase atom2 = getNeighborAtom(secondRgroup);
firstContainer.removeAttachment(firstRgroup);
secondContainer.removeAttachment(secondRgroup);
setStereoInformation(firstContainer, firstRgroup, secondContainer, secondRgroup, atom1, atom2);
firstContainer.removeINode(firstRgroup);
secondContainer.removeINode(secondRgroup);
AttachmentList mergedAttachments = mergeAttachments(firstContainer, secondContainer);
firstContainer.addIBase(secondContainer);
firstContainer.setAttachments(mergedAttachments);
}
return firstContainer;
}
|
[
"public",
"AbstractMolecule",
"merge",
"(",
"AbstractMolecule",
"firstContainer",
",",
"IAtomBase",
"firstRgroup",
",",
"AbstractMolecule",
"secondContainer",
",",
"IAtomBase",
"secondRgroup",
")",
"throws",
"CTKException",
"{",
"if",
"(",
"firstContainer",
".",
"isSingleStereo",
"(",
"firstRgroup",
")",
"&&",
"secondContainer",
".",
"isSingleStereo",
"(",
"secondRgroup",
")",
")",
"{",
"throw",
"new",
"CTKException",
"(",
"\"Both R atoms are connected to chiral centers\"",
")",
";",
"}",
"if",
"(",
"firstContainer",
"==",
"secondContainer",
")",
"{",
"firstContainer",
".",
"dearomatize",
"(",
")",
";",
"secondContainer",
".",
"dearomatize",
"(",
")",
";",
"IAtomBase",
"atom1",
"=",
"getNeighborAtom",
"(",
"firstRgroup",
")",
";",
"IAtomBase",
"atom2",
"=",
"getNeighborAtom",
"(",
"secondRgroup",
")",
";",
"firstContainer",
".",
"removeAttachment",
"(",
"firstRgroup",
")",
";",
"firstContainer",
".",
"removeAttachment",
"(",
"secondRgroup",
")",
";",
"setStereoInformation",
"(",
"firstContainer",
",",
"firstRgroup",
",",
"firstContainer",
",",
"secondRgroup",
",",
"atom1",
",",
"atom2",
")",
";",
"firstContainer",
".",
"removeINode",
"(",
"firstRgroup",
")",
";",
"firstContainer",
".",
"removeINode",
"(",
"secondRgroup",
")",
";",
"}",
"else",
"{",
"firstContainer",
".",
"dearomatize",
"(",
")",
";",
"secondContainer",
".",
"dearomatize",
"(",
")",
";",
"IAtomBase",
"atom1",
"=",
"getNeighborAtom",
"(",
"firstRgroup",
")",
";",
"IAtomBase",
"atom2",
"=",
"getNeighborAtom",
"(",
"secondRgroup",
")",
";",
"firstContainer",
".",
"removeAttachment",
"(",
"firstRgroup",
")",
";",
"secondContainer",
".",
"removeAttachment",
"(",
"secondRgroup",
")",
";",
"setStereoInformation",
"(",
"firstContainer",
",",
"firstRgroup",
",",
"secondContainer",
",",
"secondRgroup",
",",
"atom1",
",",
"atom2",
")",
";",
"firstContainer",
".",
"removeINode",
"(",
"firstRgroup",
")",
";",
"secondContainer",
".",
"removeINode",
"(",
"secondRgroup",
")",
";",
"AttachmentList",
"mergedAttachments",
"=",
"mergeAttachments",
"(",
"firstContainer",
",",
"secondContainer",
")",
";",
"firstContainer",
".",
"addIBase",
"(",
"secondContainer",
")",
";",
"firstContainer",
".",
"setAttachments",
"(",
"mergedAttachments",
")",
";",
"}",
"return",
"firstContainer",
";",
"}"
] |
merges second molecule to first using given rGroups
@param firstContainer a first molecule to merge instance of {@link AbstractMolecule}
@param firstRgroup atom of first molecule to be removed, the connected atom is used for merging, instance of
{@link IAtomBase}
@param secondContainer a second molecule to merge, instance of {@link AbstractMolecule}
@param secondRgroup of second molecule to be removed, the connected atom is used for merging, instance of
{@link IAtomBase}
@return merged molecule instance of {@link AbstractMolecule}
@throws CTKException general ChemToolKit exception passed to HELMToolKit
|
[
"merges",
"second",
"molecule",
"to",
"first",
"using",
"given",
"rGroups"
] |
f8969865b3e9d4dd796ff3e536613a96d69a395d
|
https://github.com/PistoiaHELM/ChemistryToolkit/blob/f8969865b3e9d4dd796ff3e536613a96d69a395d/src/main/java/org/helm/chemtoolkit/AbstractChemistryManipulator.java#L227-L269
|
150,833
|
PistoiaHELM/ChemistryToolkit
|
src/main/java/org/helm/chemtoolkit/AbstractChemistryManipulator.java
|
AbstractChemistryManipulator.setStereoInformation
|
protected boolean setStereoInformation(AbstractMolecule firstContainer, IAtomBase firstRgroup,
AbstractMolecule secondContainer, IAtomBase secondRgroup, IAtomBase atom1, IAtomBase atom2) throws CTKException {
IStereoElementBase stereo = null;
boolean result = false;
if (firstContainer.isSingleStereo(firstRgroup)) {
stereo = getStereoInformation(firstContainer, firstRgroup, atom2, atom1);
}
if (secondContainer.isSingleStereo(secondRgroup)) {
stereo = getStereoInformation(secondContainer, secondRgroup, atom1, atom2);
}
if (stereo != null) {
firstContainer.addIBase(stereo);
result = true;
}
return result;
}
|
java
|
protected boolean setStereoInformation(AbstractMolecule firstContainer, IAtomBase firstRgroup,
AbstractMolecule secondContainer, IAtomBase secondRgroup, IAtomBase atom1, IAtomBase atom2) throws CTKException {
IStereoElementBase stereo = null;
boolean result = false;
if (firstContainer.isSingleStereo(firstRgroup)) {
stereo = getStereoInformation(firstContainer, firstRgroup, atom2, atom1);
}
if (secondContainer.isSingleStereo(secondRgroup)) {
stereo = getStereoInformation(secondContainer, secondRgroup, atom1, atom2);
}
if (stereo != null) {
firstContainer.addIBase(stereo);
result = true;
}
return result;
}
|
[
"protected",
"boolean",
"setStereoInformation",
"(",
"AbstractMolecule",
"firstContainer",
",",
"IAtomBase",
"firstRgroup",
",",
"AbstractMolecule",
"secondContainer",
",",
"IAtomBase",
"secondRgroup",
",",
"IAtomBase",
"atom1",
",",
"IAtomBase",
"atom2",
")",
"throws",
"CTKException",
"{",
"IStereoElementBase",
"stereo",
"=",
"null",
";",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"firstContainer",
".",
"isSingleStereo",
"(",
"firstRgroup",
")",
")",
"{",
"stereo",
"=",
"getStereoInformation",
"(",
"firstContainer",
",",
"firstRgroup",
",",
"atom2",
",",
"atom1",
")",
";",
"}",
"if",
"(",
"secondContainer",
".",
"isSingleStereo",
"(",
"secondRgroup",
")",
")",
"{",
"stereo",
"=",
"getStereoInformation",
"(",
"secondContainer",
",",
"secondRgroup",
",",
"atom1",
",",
"atom2",
")",
";",
"}",
"if",
"(",
"stereo",
"!=",
"null",
")",
"{",
"firstContainer",
".",
"addIBase",
"(",
"stereo",
")",
";",
"result",
"=",
"true",
";",
"}",
"return",
"result",
";",
"}"
] |
recycles and set stereo information on firstContaner
@param firstContainer a first molecule instance of {@link AbstractMolecule}
@param firstRgroup atom to remove, instance of {@link IAtomBase}
@param secondContainer a second molecule, instance of {@link AbstractMolecule}
@param secondRgroup atom to remove, instance of {@link IAtomBase}
@param atom1 atom connected to firstGroup
@param atom2 atom connected to secondGroup
@return true, if stereo information was set, false otherwise
@throws CTKException general ChemToolKit exception passed to HELMToolKit
|
[
"recycles",
"and",
"set",
"stereo",
"information",
"on",
"firstContaner"
] |
f8969865b3e9d4dd796ff3e536613a96d69a395d
|
https://github.com/PistoiaHELM/ChemistryToolkit/blob/f8969865b3e9d4dd796ff3e536613a96d69a395d/src/main/java/org/helm/chemtoolkit/AbstractChemistryManipulator.java#L283-L302
|
150,834
|
jtrfp/javamod
|
src/main/java/de/quippy/mp3/decoder/Obuffer.java
|
Obuffer.appendSamples
|
public void appendSamples(int channel, float[] f)
{
for (int i = 0; i < 32;)
{
final float fs = f[i++];
append(channel, (short) (fs > 32767.0f ? 32767.0f : (fs < -32768.0f ? -32768.0f : fs)));
}
}
|
java
|
public void appendSamples(int channel, float[] f)
{
for (int i = 0; i < 32;)
{
final float fs = f[i++];
append(channel, (short) (fs > 32767.0f ? 32767.0f : (fs < -32768.0f ? -32768.0f : fs)));
}
}
|
[
"public",
"void",
"appendSamples",
"(",
"int",
"channel",
",",
"float",
"[",
"]",
"f",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"32",
";",
")",
"{",
"final",
"float",
"fs",
"=",
"f",
"[",
"i",
"++",
"]",
";",
"append",
"(",
"channel",
",",
"(",
"short",
")",
"(",
"fs",
">",
"32767.0f",
"?",
"32767.0f",
":",
"(",
"fs",
"<",
"-",
"32768.0f",
"?",
"-",
"32768.0f",
":",
"fs",
")",
")",
")",
";",
"}",
"}"
] |
Accepts 32 new PCM samples.
|
[
"Accepts",
"32",
"new",
"PCM",
"samples",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/Obuffer.java#L53-L60
|
150,835
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/Scopes.java
|
Scopes.from
|
public static Scopes from(String... scopes)
{
if (scopes == null || scopes.length == 0) return NONE;
return new Scopes(scopes, true);
}
|
java
|
public static Scopes from(String... scopes)
{
if (scopes == null || scopes.length == 0) return NONE;
return new Scopes(scopes, true);
}
|
[
"public",
"static",
"Scopes",
"from",
"(",
"String",
"...",
"scopes",
")",
"{",
"if",
"(",
"scopes",
"==",
"null",
"||",
"scopes",
".",
"length",
"==",
"0",
")",
"return",
"NONE",
";",
"return",
"new",
"Scopes",
"(",
"scopes",
",",
"true",
")",
";",
"}"
] |
Creates a Scopes object from the given strings.
@param scopes the scope strings
@return a new Scope instance
|
[
"Creates",
"a",
"Scopes",
"object",
"from",
"the",
"given",
"strings",
"."
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/Scopes.java#L81-L85
|
150,836
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/Scopes.java
|
Scopes.escape
|
private String escape(String value)
{
StringBuilder result = new StringBuilder();
for (int i = 0; i < value.length(); ++i)
{
char c = value.charAt(i);
if (c < reservedChars.length && reservedChars[c] == c)
{
result.append(ESCAPE_PREFIX);
int code = c & 0xFF;
if (code < 16) result.append("0");
result.append(Integer.toHexString(code));
}
else
{
result.append(c);
}
}
return result.toString();
}
|
java
|
private String escape(String value)
{
StringBuilder result = new StringBuilder();
for (int i = 0; i < value.length(); ++i)
{
char c = value.charAt(i);
if (c < reservedChars.length && reservedChars[c] == c)
{
result.append(ESCAPE_PREFIX);
int code = c & 0xFF;
if (code < 16) result.append("0");
result.append(Integer.toHexString(code));
}
else
{
result.append(c);
}
}
return result.toString();
}
|
[
"private",
"String",
"escape",
"(",
"String",
"value",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"value",
".",
"length",
"(",
")",
";",
"++",
"i",
")",
"{",
"char",
"c",
"=",
"value",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"c",
"<",
"reservedChars",
".",
"length",
"&&",
"reservedChars",
"[",
"c",
"]",
"==",
"c",
")",
"{",
"result",
".",
"append",
"(",
"ESCAPE_PREFIX",
")",
";",
"int",
"code",
"=",
"c",
"&",
"0xFF",
";",
"if",
"(",
"code",
"<",
"16",
")",
"result",
".",
"append",
"(",
"\"0\"",
")",
";",
"result",
".",
"append",
"(",
"Integer",
".",
"toHexString",
"(",
"code",
")",
")",
";",
"}",
"else",
"{",
"result",
".",
"append",
"(",
"c",
")",
";",
"}",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
Escapes the scope string following RFC 2608, 6.4.1
@param value The scope string to escape
@return The escaped scope string
@see #unescape(String)
|
[
"Escapes",
"the",
"scope",
"string",
"following",
"RFC",
"2608",
"6",
".",
"4",
".",
"1"
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/Scopes.java#L215-L234
|
150,837
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/Scopes.java
|
Scopes.unescape
|
private String unescape(String value)
{
StringBuilder result = new StringBuilder();
for (int i = 0; i < value.length(); ++i)
{
char c = value.charAt(i);
if (c == ESCAPE_PREFIX)
{
String codeString = value.substring(i + 1, i + 3);
int code = Integer.parseInt(codeString, 16);
if (code < reservedChars.length && reservedChars[code] == code)
{
result.append(reservedChars[code]);
i += 2;
}
else
{
throw new ServiceLocationException("Unknown escaped character " + ESCAPE_PREFIX + codeString + " at position " + (i + 1) + " of " + value, SLPError.PARSE_ERROR);
}
}
else
{
result.append(c);
}
}
return result.toString();
}
|
java
|
private String unescape(String value)
{
StringBuilder result = new StringBuilder();
for (int i = 0; i < value.length(); ++i)
{
char c = value.charAt(i);
if (c == ESCAPE_PREFIX)
{
String codeString = value.substring(i + 1, i + 3);
int code = Integer.parseInt(codeString, 16);
if (code < reservedChars.length && reservedChars[code] == code)
{
result.append(reservedChars[code]);
i += 2;
}
else
{
throw new ServiceLocationException("Unknown escaped character " + ESCAPE_PREFIX + codeString + " at position " + (i + 1) + " of " + value, SLPError.PARSE_ERROR);
}
}
else
{
result.append(c);
}
}
return result.toString();
}
|
[
"private",
"String",
"unescape",
"(",
"String",
"value",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"value",
".",
"length",
"(",
")",
";",
"++",
"i",
")",
"{",
"char",
"c",
"=",
"value",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"c",
"==",
"ESCAPE_PREFIX",
")",
"{",
"String",
"codeString",
"=",
"value",
".",
"substring",
"(",
"i",
"+",
"1",
",",
"i",
"+",
"3",
")",
";",
"int",
"code",
"=",
"Integer",
".",
"parseInt",
"(",
"codeString",
",",
"16",
")",
";",
"if",
"(",
"code",
"<",
"reservedChars",
".",
"length",
"&&",
"reservedChars",
"[",
"code",
"]",
"==",
"code",
")",
"{",
"result",
".",
"append",
"(",
"reservedChars",
"[",
"code",
"]",
")",
";",
"i",
"+=",
"2",
";",
"}",
"else",
"{",
"throw",
"new",
"ServiceLocationException",
"(",
"\"Unknown escaped character \"",
"+",
"ESCAPE_PREFIX",
"+",
"codeString",
"+",
"\" at position \"",
"+",
"(",
"i",
"+",
"1",
")",
"+",
"\" of \"",
"+",
"value",
",",
"SLPError",
".",
"PARSE_ERROR",
")",
";",
"}",
"}",
"else",
"{",
"result",
".",
"append",
"(",
"c",
")",
";",
"}",
"}",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
Unescapes the scope string following RFC 2608, 6.4.1
@param value The scope string to unescape
@return The unescaped scope string
@see #escape(String)
|
[
"Unescapes",
"the",
"scope",
"string",
"following",
"RFC",
"2608",
"6",
".",
"4",
".",
"1"
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/Scopes.java#L243-L269
|
150,838
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLWriter.java
|
XMLWriter.start
|
public ISynchronizationPoint<IOException> start(String rootNamespaceURI, String rootLocalName, Map<String, String> namespaces) {
if (includeXMLDeclaration) {
writer.write(XML_DECLARATION_START);
writer.write(output.getEncoding().name());
writer.write(XML_DECLARATION_END);
}
writer.write('<');
if (rootNamespaceURI != null) {
String ns = namespaces.get(rootNamespaceURI);
if (ns != null && ns.length() > 0) {
writer.write(ns);
writer.write(':');
}
}
ISynchronizationPoint<IOException> result = writer.write(rootLocalName);
if (namespaces != null && !namespaces.isEmpty()) {
for (Map.Entry<String, String> ns : namespaces.entrySet()) {
writer.write(XMLNS);
if (ns.getValue().length() > 0) {
writer.write(':');
writer.write(ns.getValue());
}
writer.write(ATTRIBUTE_EQUALS);
writer.write(escape(ns.getKey()));
result = writer.write('"');
}
}
Context ctx = new Context();
ctx.namespaces = new HashMap<>();
if (namespaces != null) ctx.namespaces.putAll(namespaces);
ctx.namespaceURI = rootNamespaceURI;
ctx.localName = rootLocalName;
ctx.open = true;
context.addFirst(ctx);
return result;
}
|
java
|
public ISynchronizationPoint<IOException> start(String rootNamespaceURI, String rootLocalName, Map<String, String> namespaces) {
if (includeXMLDeclaration) {
writer.write(XML_DECLARATION_START);
writer.write(output.getEncoding().name());
writer.write(XML_DECLARATION_END);
}
writer.write('<');
if (rootNamespaceURI != null) {
String ns = namespaces.get(rootNamespaceURI);
if (ns != null && ns.length() > 0) {
writer.write(ns);
writer.write(':');
}
}
ISynchronizationPoint<IOException> result = writer.write(rootLocalName);
if (namespaces != null && !namespaces.isEmpty()) {
for (Map.Entry<String, String> ns : namespaces.entrySet()) {
writer.write(XMLNS);
if (ns.getValue().length() > 0) {
writer.write(':');
writer.write(ns.getValue());
}
writer.write(ATTRIBUTE_EQUALS);
writer.write(escape(ns.getKey()));
result = writer.write('"');
}
}
Context ctx = new Context();
ctx.namespaces = new HashMap<>();
if (namespaces != null) ctx.namespaces.putAll(namespaces);
ctx.namespaceURI = rootNamespaceURI;
ctx.localName = rootLocalName;
ctx.open = true;
context.addFirst(ctx);
return result;
}
|
[
"public",
"ISynchronizationPoint",
"<",
"IOException",
">",
"start",
"(",
"String",
"rootNamespaceURI",
",",
"String",
"rootLocalName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"namespaces",
")",
"{",
"if",
"(",
"includeXMLDeclaration",
")",
"{",
"writer",
".",
"write",
"(",
"XML_DECLARATION_START",
")",
";",
"writer",
".",
"write",
"(",
"output",
".",
"getEncoding",
"(",
")",
".",
"name",
"(",
")",
")",
";",
"writer",
".",
"write",
"(",
"XML_DECLARATION_END",
")",
";",
"}",
"writer",
".",
"write",
"(",
"'",
"'",
")",
";",
"if",
"(",
"rootNamespaceURI",
"!=",
"null",
")",
"{",
"String",
"ns",
"=",
"namespaces",
".",
"get",
"(",
"rootNamespaceURI",
")",
";",
"if",
"(",
"ns",
"!=",
"null",
"&&",
"ns",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"writer",
".",
"write",
"(",
"ns",
")",
";",
"writer",
".",
"write",
"(",
"'",
"'",
")",
";",
"}",
"}",
"ISynchronizationPoint",
"<",
"IOException",
">",
"result",
"=",
"writer",
".",
"write",
"(",
"rootLocalName",
")",
";",
"if",
"(",
"namespaces",
"!=",
"null",
"&&",
"!",
"namespaces",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"ns",
":",
"namespaces",
".",
"entrySet",
"(",
")",
")",
"{",
"writer",
".",
"write",
"(",
"XMLNS",
")",
";",
"if",
"(",
"ns",
".",
"getValue",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"writer",
".",
"write",
"(",
"'",
"'",
")",
";",
"writer",
".",
"write",
"(",
"ns",
".",
"getValue",
"(",
")",
")",
";",
"}",
"writer",
".",
"write",
"(",
"ATTRIBUTE_EQUALS",
")",
";",
"writer",
".",
"write",
"(",
"escape",
"(",
"ns",
".",
"getKey",
"(",
")",
")",
")",
";",
"result",
"=",
"writer",
".",
"write",
"(",
"'",
"'",
")",
";",
"}",
"}",
"Context",
"ctx",
"=",
"new",
"Context",
"(",
")",
";",
"ctx",
".",
"namespaces",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"if",
"(",
"namespaces",
"!=",
"null",
")",
"ctx",
".",
"namespaces",
".",
"putAll",
"(",
"namespaces",
")",
";",
"ctx",
".",
"namespaceURI",
"=",
"rootNamespaceURI",
";",
"ctx",
".",
"localName",
"=",
"rootLocalName",
";",
"ctx",
".",
"open",
"=",
"true",
";",
"context",
".",
"addFirst",
"(",
"ctx",
")",
";",
"return",
"result",
";",
"}"
] |
Start the document with the XML processing instruction if needed, and opening the root element.
@param rootNamespaceURI namespace of the root element
@param rootLocalName name of the root element
@param namespaces mapping from namespace URI and prefix, prefix may be empty for default namespace
|
[
"Start",
"the",
"document",
"with",
"the",
"XML",
"processing",
"instruction",
"if",
"needed",
"and",
"opening",
"the",
"root",
"element",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLWriter.java#L109-L144
|
150,839
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLWriter.java
|
XMLWriter.end
|
public ISynchronizationPoint<IOException> end() {
while (!context.isEmpty())
closeElement();
ISynchronizationPoint<IOException> write = writer.flush();
if (!write.isUnblocked()) {
SynchronizationPoint<IOException> sp = new SynchronizationPoint<>();
write.listenInline(() -> { output.flush().listenInline(sp); }, sp);
return sp;
}
if (write.hasError())
return write;
return output.flush();
}
|
java
|
public ISynchronizationPoint<IOException> end() {
while (!context.isEmpty())
closeElement();
ISynchronizationPoint<IOException> write = writer.flush();
if (!write.isUnblocked()) {
SynchronizationPoint<IOException> sp = new SynchronizationPoint<>();
write.listenInline(() -> { output.flush().listenInline(sp); }, sp);
return sp;
}
if (write.hasError())
return write;
return output.flush();
}
|
[
"public",
"ISynchronizationPoint",
"<",
"IOException",
">",
"end",
"(",
")",
"{",
"while",
"(",
"!",
"context",
".",
"isEmpty",
"(",
")",
")",
"closeElement",
"(",
")",
";",
"ISynchronizationPoint",
"<",
"IOException",
">",
"write",
"=",
"writer",
".",
"flush",
"(",
")",
";",
"if",
"(",
"!",
"write",
".",
"isUnblocked",
"(",
")",
")",
"{",
"SynchronizationPoint",
"<",
"IOException",
">",
"sp",
"=",
"new",
"SynchronizationPoint",
"<>",
"(",
")",
";",
"write",
".",
"listenInline",
"(",
"(",
")",
"->",
"{",
"output",
".",
"flush",
"(",
")",
".",
"listenInline",
"(",
"sp",
")",
";",
"}",
",",
"sp",
")",
";",
"return",
"sp",
";",
"}",
"if",
"(",
"write",
".",
"hasError",
"(",
")",
")",
"return",
"write",
";",
"return",
"output",
".",
"flush",
"(",
")",
";",
"}"
] |
End the document, close any open element, and flush the output stream.
|
[
"End",
"the",
"document",
"close",
"any",
"open",
"element",
"and",
"flush",
"the",
"output",
"stream",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/xml/XMLWriter.java#L147-L159
|
150,840
|
jtrfp/javamod
|
src/main/java/de/quippy/mp3/decoder/SynthesisFilter.java
|
SynthesisFilter.reset
|
public void reset()
{
// float[] floatp;
// float[] floatp2;
// initialize v1[] and v2[]:
// for (floatp = v1 + 512, floatp2 = v2 + 512; floatp > v1; )
// *--floatp = *--floatp2 = 0.0;
for (int p = 0; p < 512; p++)
v1[p] = v2[p] = 0.0f;
// initialize samples[]:
// for (floatp = samples + 32; floatp > samples; )
// *--floatp = 0.0;
for (int p2 = 0; p2 < 32; p2++)
samples[p2] = 0.0f;
actual_v = v1;
actual_write_pos = 15;
}
|
java
|
public void reset()
{
// float[] floatp;
// float[] floatp2;
// initialize v1[] and v2[]:
// for (floatp = v1 + 512, floatp2 = v2 + 512; floatp > v1; )
// *--floatp = *--floatp2 = 0.0;
for (int p = 0; p < 512; p++)
v1[p] = v2[p] = 0.0f;
// initialize samples[]:
// for (floatp = samples + 32; floatp > samples; )
// *--floatp = 0.0;
for (int p2 = 0; p2 < 32; p2++)
samples[p2] = 0.0f;
actual_v = v1;
actual_write_pos = 15;
}
|
[
"public",
"void",
"reset",
"(",
")",
"{",
"// float[] floatp;",
"// float[] floatp2;",
"// initialize v1[] and v2[]:",
"// for (floatp = v1 + 512, floatp2 = v2 + 512; floatp > v1; )",
"// *--floatp = *--floatp2 = 0.0;",
"for",
"(",
"int",
"p",
"=",
"0",
";",
"p",
"<",
"512",
";",
"p",
"++",
")",
"v1",
"[",
"p",
"]",
"=",
"v2",
"[",
"p",
"]",
"=",
"0.0f",
";",
"// initialize samples[]:",
"// for (floatp = samples + 32; floatp > samples; )",
"// *--floatp = 0.0;",
"for",
"(",
"int",
"p2",
"=",
"0",
";",
"p2",
"<",
"32",
";",
"p2",
"++",
")",
"samples",
"[",
"p2",
"]",
"=",
"0.0f",
";",
"actual_v",
"=",
"v1",
";",
"actual_write_pos",
"=",
"15",
";",
"}"
] |
Reset the synthesis filter.
|
[
"Reset",
"the",
"synthesis",
"filter",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/SynthesisFilter.java#L119-L138
|
150,841
|
jtrfp/javamod
|
src/main/java/de/quippy/mp3/decoder/SynthesisFilter.java
|
SynthesisFilter.calculate_pcm_samples
|
public void calculate_pcm_samples(Obuffer buffer)
{
compute_new_v();
compute_pcm_samples(buffer);
actual_write_pos = (actual_write_pos + 1) & 0xf;
actual_v = (actual_v == v1) ? v2 : v1;
// initialize samples[]:
// for (register float *floatp = samples + 32; floatp > samples; )
// *--floatp = 0.0f;
// MDM: this may not be necessary. The Layer III decoder always
// outputs 32 subband samples, but I haven't checked layer I & II.
for (int p = 0; p < 32; p++)
samples[p] = 0.0f;
}
|
java
|
public void calculate_pcm_samples(Obuffer buffer)
{
compute_new_v();
compute_pcm_samples(buffer);
actual_write_pos = (actual_write_pos + 1) & 0xf;
actual_v = (actual_v == v1) ? v2 : v1;
// initialize samples[]:
// for (register float *floatp = samples + 32; floatp > samples; )
// *--floatp = 0.0f;
// MDM: this may not be necessary. The Layer III decoder always
// outputs 32 subband samples, but I haven't checked layer I & II.
for (int p = 0; p < 32; p++)
samples[p] = 0.0f;
}
|
[
"public",
"void",
"calculate_pcm_samples",
"(",
"Obuffer",
"buffer",
")",
"{",
"compute_new_v",
"(",
")",
";",
"compute_pcm_samples",
"(",
"buffer",
")",
";",
"actual_write_pos",
"=",
"(",
"actual_write_pos",
"+",
"1",
")",
"&",
"0xf",
";",
"actual_v",
"=",
"(",
"actual_v",
"==",
"v1",
")",
"?",
"v2",
":",
"v1",
";",
"// initialize samples[]:",
"// for (register float *floatp = samples + 32; floatp > samples; )",
"// *--floatp = 0.0f;",
"// MDM: this may not be necessary. The Layer III decoder always",
"// outputs 32 subband samples, but I haven't checked layer I & II.",
"for",
"(",
"int",
"p",
"=",
"0",
";",
"p",
"<",
"32",
";",
"p",
"++",
")",
"samples",
"[",
"p",
"]",
"=",
"0.0f",
";",
"}"
] |
Calculate 32 PCM samples and put the into the Obuffer-object.
|
[
"Calculate",
"32",
"PCM",
"samples",
"and",
"put",
"the",
"into",
"the",
"Obuffer",
"-",
"object",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/SynthesisFilter.java#L1270-L1286
|
150,842
|
jtrfp/javamod
|
src/main/java/de/quippy/mp3/decoder/SynthesisFilter.java
|
SynthesisFilter.splitArray
|
static private float[][] splitArray(final float[] array, final int blockSize)
{
int size = array.length / blockSize;
float[][] split = new float[size][];
for (int i = 0; i < size; i++)
{
split[i] = subArray(array, i * blockSize, blockSize);
}
return split;
}
|
java
|
static private float[][] splitArray(final float[] array, final int blockSize)
{
int size = array.length / blockSize;
float[][] split = new float[size][];
for (int i = 0; i < size; i++)
{
split[i] = subArray(array, i * blockSize, blockSize);
}
return split;
}
|
[
"static",
"private",
"float",
"[",
"]",
"[",
"]",
"splitArray",
"(",
"final",
"float",
"[",
"]",
"array",
",",
"final",
"int",
"blockSize",
")",
"{",
"int",
"size",
"=",
"array",
".",
"length",
"/",
"blockSize",
";",
"float",
"[",
"]",
"[",
"]",
"split",
"=",
"new",
"float",
"[",
"size",
"]",
"[",
"",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"split",
"[",
"i",
"]",
"=",
"subArray",
"(",
"array",
",",
"i",
"*",
"blockSize",
",",
"blockSize",
")",
";",
"}",
"return",
"split",
";",
"}"
] |
Converts a 1D array into a number of smaller arrays. This is used
to achieve offset + constant indexing into an array. Each sub-array
represents a block of values of the original array.
@param array
The array to split up into blocks.
@param blockSize
The size of the blocks to split the array
into. This must be an exact divisor of
the length of the array, or some data
will be lost from the main array.
@return An array of arrays in which each element in the returned
array will be of length <code>blockSize</code>.
|
[
"Converts",
"a",
"1D",
"array",
"into",
"a",
"number",
"of",
"smaller",
"arrays",
".",
"This",
"is",
"used",
"to",
"achieve",
"offset",
"+",
"constant",
"indexing",
"into",
"an",
"array",
".",
"Each",
"sub",
"-",
"array",
"represents",
"a",
"block",
"of",
"values",
"of",
"the",
"original",
"array",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/SynthesisFilter.java#L1367-L1376
|
150,843
|
jtrfp/javamod
|
src/main/java/de/quippy/mp3/decoder/SynthesisFilter.java
|
SynthesisFilter.subArray
|
static private float[] subArray(final float[] array, final int offs, int len)
{
if (offs + len > array.length)
{
len = array.length - offs;
}
if (len < 0) len = 0;
float[] subarray = new float[len];
for (int i = 0; i < len; i++)
{
subarray[i] = array[offs + i];
}
return subarray;
}
|
java
|
static private float[] subArray(final float[] array, final int offs, int len)
{
if (offs + len > array.length)
{
len = array.length - offs;
}
if (len < 0) len = 0;
float[] subarray = new float[len];
for (int i = 0; i < len; i++)
{
subarray[i] = array[offs + i];
}
return subarray;
}
|
[
"static",
"private",
"float",
"[",
"]",
"subArray",
"(",
"final",
"float",
"[",
"]",
"array",
",",
"final",
"int",
"offs",
",",
"int",
"len",
")",
"{",
"if",
"(",
"offs",
"+",
"len",
">",
"array",
".",
"length",
")",
"{",
"len",
"=",
"array",
".",
"length",
"-",
"offs",
";",
"}",
"if",
"(",
"len",
"<",
"0",
")",
"len",
"=",
"0",
";",
"float",
"[",
"]",
"subarray",
"=",
"new",
"float",
"[",
"len",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"subarray",
"[",
"i",
"]",
"=",
"array",
"[",
"offs",
"+",
"i",
"]",
";",
"}",
"return",
"subarray",
";",
"}"
] |
Returns a subarray of an existing array.
@param array
The array to retrieve a subarra from.
@param offs
The offset in the array that corresponds to
the first index of the subarray.
@param len
The number of indeces in the subarray.
@return The subarray, which may be of length 0.
|
[
"Returns",
"a",
"subarray",
"of",
"an",
"existing",
"array",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/mp3/decoder/SynthesisFilter.java#L1390-L1406
|
150,844
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/collections/map/MapUtil.java
|
MapUtil.removeValue
|
public static <T> void removeValue(Map<?,T> map, T value) {
ArrayList<Object> keys = new ArrayList<>();
for (Map.Entry<?,T> e : map.entrySet())
if (e.getValue().equals(value))
keys.add(e.getKey());
for (Object key : keys)
map.remove(key);
}
|
java
|
public static <T> void removeValue(Map<?,T> map, T value) {
ArrayList<Object> keys = new ArrayList<>();
for (Map.Entry<?,T> e : map.entrySet())
if (e.getValue().equals(value))
keys.add(e.getKey());
for (Object key : keys)
map.remove(key);
}
|
[
"public",
"static",
"<",
"T",
">",
"void",
"removeValue",
"(",
"Map",
"<",
"?",
",",
"T",
">",
"map",
",",
"T",
"value",
")",
"{",
"ArrayList",
"<",
"Object",
">",
"keys",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"?",
",",
"T",
">",
"e",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"if",
"(",
"e",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"value",
")",
")",
"keys",
".",
"add",
"(",
"e",
".",
"getKey",
"(",
")",
")",
";",
"for",
"(",
"Object",
"key",
":",
"keys",
")",
"map",
".",
"remove",
"(",
"key",
")",
";",
"}"
] |
Remove all keys associated with the given value.
|
[
"Remove",
"all",
"keys",
"associated",
"with",
"the",
"given",
"value",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/map/MapUtil.java#L14-L21
|
150,845
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/ApplicationConfiguration.java
|
ApplicationConfiguration.load
|
public static ApplicationConfiguration load(File file) throws Exception {
try (FileInputStream in = new FileInputStream(file)) {
return load(in);
}
}
|
java
|
public static ApplicationConfiguration load(File file) throws Exception {
try (FileInputStream in = new FileInputStream(file)) {
return load(in);
}
}
|
[
"public",
"static",
"ApplicationConfiguration",
"load",
"(",
"File",
"file",
")",
"throws",
"Exception",
"{",
"try",
"(",
"FileInputStream",
"in",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
")",
"{",
"return",
"load",
"(",
"in",
")",
";",
"}",
"}"
] |
Load the given file.
|
[
"Load",
"the",
"given",
"file",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/ApplicationConfiguration.java#L24-L28
|
150,846
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/application/ApplicationConfiguration.java
|
ApplicationConfiguration.load
|
public static ApplicationConfiguration load(InputStream input) throws Exception {
XMLStreamReader xml = XMLInputFactory.newFactory().createXMLStreamReader(input);
while (xml.hasNext()) {
xml.next();
if (xml.getEventType() == XMLStreamConstants.START_ELEMENT) {
if (!"project".equals(xml.getLocalName()))
throw new Exception("Root element of an lc-project.xml file must be <project>");
ApplicationConfiguration cfg = new ApplicationConfiguration();
boolean found = false;
while (xml.hasNext()) {
xml.next();
if (xml.getEventType() == XMLStreamConstants.START_ELEMENT) {
if ("application".equals(xml.getLocalName())) {
found = true;
cfg.load(xml);
break;
}
}
}
if (!found)
throw new Exception("No application element found in lc-project.xml file");
return cfg;
}
}
throw new Exception("Nothing found in lc-project.xml file");
}
|
java
|
public static ApplicationConfiguration load(InputStream input) throws Exception {
XMLStreamReader xml = XMLInputFactory.newFactory().createXMLStreamReader(input);
while (xml.hasNext()) {
xml.next();
if (xml.getEventType() == XMLStreamConstants.START_ELEMENT) {
if (!"project".equals(xml.getLocalName()))
throw new Exception("Root element of an lc-project.xml file must be <project>");
ApplicationConfiguration cfg = new ApplicationConfiguration();
boolean found = false;
while (xml.hasNext()) {
xml.next();
if (xml.getEventType() == XMLStreamConstants.START_ELEMENT) {
if ("application".equals(xml.getLocalName())) {
found = true;
cfg.load(xml);
break;
}
}
}
if (!found)
throw new Exception("No application element found in lc-project.xml file");
return cfg;
}
}
throw new Exception("Nothing found in lc-project.xml file");
}
|
[
"public",
"static",
"ApplicationConfiguration",
"load",
"(",
"InputStream",
"input",
")",
"throws",
"Exception",
"{",
"XMLStreamReader",
"xml",
"=",
"XMLInputFactory",
".",
"newFactory",
"(",
")",
".",
"createXMLStreamReader",
"(",
"input",
")",
";",
"while",
"(",
"xml",
".",
"hasNext",
"(",
")",
")",
"{",
"xml",
".",
"next",
"(",
")",
";",
"if",
"(",
"xml",
".",
"getEventType",
"(",
")",
"==",
"XMLStreamConstants",
".",
"START_ELEMENT",
")",
"{",
"if",
"(",
"!",
"\"project\"",
".",
"equals",
"(",
"xml",
".",
"getLocalName",
"(",
")",
")",
")",
"throw",
"new",
"Exception",
"(",
"\"Root element of an lc-project.xml file must be <project>\"",
")",
";",
"ApplicationConfiguration",
"cfg",
"=",
"new",
"ApplicationConfiguration",
"(",
")",
";",
"boolean",
"found",
"=",
"false",
";",
"while",
"(",
"xml",
".",
"hasNext",
"(",
")",
")",
"{",
"xml",
".",
"next",
"(",
")",
";",
"if",
"(",
"xml",
".",
"getEventType",
"(",
")",
"==",
"XMLStreamConstants",
".",
"START_ELEMENT",
")",
"{",
"if",
"(",
"\"application\"",
".",
"equals",
"(",
"xml",
".",
"getLocalName",
"(",
")",
")",
")",
"{",
"found",
"=",
"true",
";",
"cfg",
".",
"load",
"(",
"xml",
")",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"found",
")",
"throw",
"new",
"Exception",
"(",
"\"No application element found in lc-project.xml file\"",
")",
";",
"return",
"cfg",
";",
"}",
"}",
"throw",
"new",
"Exception",
"(",
"\"Nothing found in lc-project.xml file\"",
")",
";",
"}"
] |
Load from the given stream.
|
[
"Load",
"from",
"the",
"given",
"stream",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/ApplicationConfiguration.java#L31-L56
|
150,847
|
PistoiaHELM/ChemistryToolkit
|
src/main/java/org/helm/chemtoolkit/AbstractMolecule.java
|
AbstractMolecule.removeAttachment
|
public void removeAttachment(IAtomBase toRemove) throws CTKException {
Map<String, IAtomBase> groups = getRgroups();
for (String key : groups.keySet()) {
if (groups.get(key).compare(toRemove)) {
for (int i = 0; i < attachments.size(); i++) {
if (attachments.get(i).getLabel().equals(key)) {
attachments.remove(i);
break;
}
}
}
}
}
|
java
|
public void removeAttachment(IAtomBase toRemove) throws CTKException {
Map<String, IAtomBase> groups = getRgroups();
for (String key : groups.keySet()) {
if (groups.get(key).compare(toRemove)) {
for (int i = 0; i < attachments.size(); i++) {
if (attachments.get(i).getLabel().equals(key)) {
attachments.remove(i);
break;
}
}
}
}
}
|
[
"public",
"void",
"removeAttachment",
"(",
"IAtomBase",
"toRemove",
")",
"throws",
"CTKException",
"{",
"Map",
"<",
"String",
",",
"IAtomBase",
">",
"groups",
"=",
"getRgroups",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"groups",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"groups",
".",
"get",
"(",
"key",
")",
".",
"compare",
"(",
"toRemove",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"attachments",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"attachments",
".",
"get",
"(",
"i",
")",
".",
"getLabel",
"(",
")",
".",
"equals",
"(",
"key",
")",
")",
"{",
"attachments",
".",
"remove",
"(",
"i",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}"
] |
removes a given attachment from molecule
@param toRemove a atom to be removed
@throws CTKException general ChemToolKit exception passed to HELMToolKit
|
[
"removes",
"a",
"given",
"attachment",
"from",
"molecule"
] |
f8969865b3e9d4dd796ff3e536613a96d69a395d
|
https://github.com/PistoiaHELM/ChemistryToolkit/blob/f8969865b3e9d4dd796ff3e536613a96d69a395d/src/main/java/org/helm/chemtoolkit/AbstractMolecule.java#L136-L150
|
150,848
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/DRUMSParameterSet.java
|
DRUMSParameterSet.initParameters
|
private void initParameters() throws FileNotFoundException {
InputStream fileStream;
if (new File(parameterfile).exists()) {
logger.info("Try reading properties directly from {}.", parameterfile);
fileStream = new FileInputStream(new File(parameterfile));
} else {
logger.info("Try reading properties from Resources");
fileStream = this.getClass().getClassLoader().getResourceAsStream(parameterfile);
}
Properties props = new Properties();
try {
props.load(fileStream);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
DATABASE_DIRECTORY = props.getProperty("DATABASE_DIRECTORY");
BUCKET_MEMORY = parseSize(props.getProperty("BUCKET_MEMORY", "1G"));
MEMORY_CHUNK = (int) parseSize(props.getProperty("MEMORY_CHUNK", "10K"));
MAX_MEMORY_PER_BUCKET = parseSize(props.getProperty("MAX_MEMORY_PER_BUCKET", "100M"));
SYNC_CHUNK_SIZE = parseSize(props.getProperty("SYNC_CHUNK_SIZE", "2M"));
FILE_CHUNK_SIZE = parseSize(props.getProperty("FILE_CHUNK_SIZE", "32K"));
// determine exact index size
FILE_CHUNK_SIZE = FILE_CHUNK_SIZE - FILE_CHUNK_SIZE % prototype.getSize();
NUMBER_OF_SYNCHRONIZER_THREADS = Integer.valueOf(props.getProperty("NUMBER_OF_SYNCHRONIZER_THREADS", "1"));
MAX_BUCKET_STORAGE_TIME = Long.valueOf(props.getProperty("MAX_BUCKET_STORAGE_TIME", "84000000"));
MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC = Integer
.valueOf(props.getProperty("MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC", "1"));
HEADER_FILE_LOCK_RETRY = Integer.valueOf(props.getProperty("HEADER_FILE_LOCK_RETRY", "100"));
INITIAL_FILE_SIZE = (int) parseSize(props.getProperty("INITIAL_FILE_SIZE", "16M"));
INITIAL_INCREMENT_SIZE = (int) parseSize(props.getProperty("INITIAL_INCREMENT_SIZE", "16M"));
configToLogInfo();
}
|
java
|
private void initParameters() throws FileNotFoundException {
InputStream fileStream;
if (new File(parameterfile).exists()) {
logger.info("Try reading properties directly from {}.", parameterfile);
fileStream = new FileInputStream(new File(parameterfile));
} else {
logger.info("Try reading properties from Resources");
fileStream = this.getClass().getClassLoader().getResourceAsStream(parameterfile);
}
Properties props = new Properties();
try {
props.load(fileStream);
} catch (IOException ex) {
throw new RuntimeException(ex);
}
DATABASE_DIRECTORY = props.getProperty("DATABASE_DIRECTORY");
BUCKET_MEMORY = parseSize(props.getProperty("BUCKET_MEMORY", "1G"));
MEMORY_CHUNK = (int) parseSize(props.getProperty("MEMORY_CHUNK", "10K"));
MAX_MEMORY_PER_BUCKET = parseSize(props.getProperty("MAX_MEMORY_PER_BUCKET", "100M"));
SYNC_CHUNK_SIZE = parseSize(props.getProperty("SYNC_CHUNK_SIZE", "2M"));
FILE_CHUNK_SIZE = parseSize(props.getProperty("FILE_CHUNK_SIZE", "32K"));
// determine exact index size
FILE_CHUNK_SIZE = FILE_CHUNK_SIZE - FILE_CHUNK_SIZE % prototype.getSize();
NUMBER_OF_SYNCHRONIZER_THREADS = Integer.valueOf(props.getProperty("NUMBER_OF_SYNCHRONIZER_THREADS", "1"));
MAX_BUCKET_STORAGE_TIME = Long.valueOf(props.getProperty("MAX_BUCKET_STORAGE_TIME", "84000000"));
MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC = Integer
.valueOf(props.getProperty("MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC", "1"));
HEADER_FILE_LOCK_RETRY = Integer.valueOf(props.getProperty("HEADER_FILE_LOCK_RETRY", "100"));
INITIAL_FILE_SIZE = (int) parseSize(props.getProperty("INITIAL_FILE_SIZE", "16M"));
INITIAL_INCREMENT_SIZE = (int) parseSize(props.getProperty("INITIAL_INCREMENT_SIZE", "16M"));
configToLogInfo();
}
|
[
"private",
"void",
"initParameters",
"(",
")",
"throws",
"FileNotFoundException",
"{",
"InputStream",
"fileStream",
";",
"if",
"(",
"new",
"File",
"(",
"parameterfile",
")",
".",
"exists",
"(",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Try reading properties directly from {}.\"",
",",
"parameterfile",
")",
";",
"fileStream",
"=",
"new",
"FileInputStream",
"(",
"new",
"File",
"(",
"parameterfile",
")",
")",
";",
"}",
"else",
"{",
"logger",
".",
"info",
"(",
"\"Try reading properties from Resources\"",
")",
";",
"fileStream",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"parameterfile",
")",
";",
"}",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"props",
".",
"load",
"(",
"fileStream",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"ex",
")",
";",
"}",
"DATABASE_DIRECTORY",
"=",
"props",
".",
"getProperty",
"(",
"\"DATABASE_DIRECTORY\"",
")",
";",
"BUCKET_MEMORY",
"=",
"parseSize",
"(",
"props",
".",
"getProperty",
"(",
"\"BUCKET_MEMORY\"",
",",
"\"1G\"",
")",
")",
";",
"MEMORY_CHUNK",
"=",
"(",
"int",
")",
"parseSize",
"(",
"props",
".",
"getProperty",
"(",
"\"MEMORY_CHUNK\"",
",",
"\"10K\"",
")",
")",
";",
"MAX_MEMORY_PER_BUCKET",
"=",
"parseSize",
"(",
"props",
".",
"getProperty",
"(",
"\"MAX_MEMORY_PER_BUCKET\"",
",",
"\"100M\"",
")",
")",
";",
"SYNC_CHUNK_SIZE",
"=",
"parseSize",
"(",
"props",
".",
"getProperty",
"(",
"\"SYNC_CHUNK_SIZE\"",
",",
"\"2M\"",
")",
")",
";",
"FILE_CHUNK_SIZE",
"=",
"parseSize",
"(",
"props",
".",
"getProperty",
"(",
"\"FILE_CHUNK_SIZE\"",
",",
"\"32K\"",
")",
")",
";",
"// determine exact index size\r",
"FILE_CHUNK_SIZE",
"=",
"FILE_CHUNK_SIZE",
"-",
"FILE_CHUNK_SIZE",
"%",
"prototype",
".",
"getSize",
"(",
")",
";",
"NUMBER_OF_SYNCHRONIZER_THREADS",
"=",
"Integer",
".",
"valueOf",
"(",
"props",
".",
"getProperty",
"(",
"\"NUMBER_OF_SYNCHRONIZER_THREADS\"",
",",
"\"1\"",
")",
")",
";",
"MAX_BUCKET_STORAGE_TIME",
"=",
"Long",
".",
"valueOf",
"(",
"props",
".",
"getProperty",
"(",
"\"MAX_BUCKET_STORAGE_TIME\"",
",",
"\"84000000\"",
")",
")",
";",
"MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC",
"=",
"Integer",
".",
"valueOf",
"(",
"props",
".",
"getProperty",
"(",
"\"MIN_ELEMENT_IN_BUCKET_BEFORE_SYNC\"",
",",
"\"1\"",
")",
")",
";",
"HEADER_FILE_LOCK_RETRY",
"=",
"Integer",
".",
"valueOf",
"(",
"props",
".",
"getProperty",
"(",
"\"HEADER_FILE_LOCK_RETRY\"",
",",
"\"100\"",
")",
")",
";",
"INITIAL_FILE_SIZE",
"=",
"(",
"int",
")",
"parseSize",
"(",
"props",
".",
"getProperty",
"(",
"\"INITIAL_FILE_SIZE\"",
",",
"\"16M\"",
")",
")",
";",
"INITIAL_INCREMENT_SIZE",
"=",
"(",
"int",
")",
"parseSize",
"(",
"props",
".",
"getProperty",
"(",
"\"INITIAL_INCREMENT_SIZE\"",
",",
"\"16M\"",
")",
")",
";",
"configToLogInfo",
"(",
")",
";",
"}"
] |
Initialises all Parameters.
@throws FileNotFoundException
|
[
"Initialises",
"all",
"Parameters",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/DRUMSParameterSet.java#L183-L216
|
150,849
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/DRUMSParameterSet.java
|
DRUMSParameterSet.configToLogInfo
|
public void configToLogInfo() {
logger.info("----- MEMEORY USAGE -----");
logger.info("BUCKET_MEMORY = {}", BUCKET_MEMORY);
logger.info("MEMORY_CHUNK = {}", MEMORY_CHUNK);
logger.info("MAX_MEMORY_PER_BUCKET = {}", MAX_MEMORY_PER_BUCKET);
logger.info("CHUNKSIZE = {}", SYNC_CHUNK_SIZE);
logger.info("----- HeaderIndexFile -----");
logger.info("INITIAL_FILE_SIZE = {}", INITIAL_FILE_SIZE);
logger.info("INITIAL_INCREMENT_SIZE = {}", INITIAL_INCREMENT_SIZE);
logger.info("CHUNK_SIZE = {}", FILE_CHUNK_SIZE);
}
|
java
|
public void configToLogInfo() {
logger.info("----- MEMEORY USAGE -----");
logger.info("BUCKET_MEMORY = {}", BUCKET_MEMORY);
logger.info("MEMORY_CHUNK = {}", MEMORY_CHUNK);
logger.info("MAX_MEMORY_PER_BUCKET = {}", MAX_MEMORY_PER_BUCKET);
logger.info("CHUNKSIZE = {}", SYNC_CHUNK_SIZE);
logger.info("----- HeaderIndexFile -----");
logger.info("INITIAL_FILE_SIZE = {}", INITIAL_FILE_SIZE);
logger.info("INITIAL_INCREMENT_SIZE = {}", INITIAL_INCREMENT_SIZE);
logger.info("CHUNK_SIZE = {}", FILE_CHUNK_SIZE);
}
|
[
"public",
"void",
"configToLogInfo",
"(",
")",
"{",
"logger",
".",
"info",
"(",
"\"----- MEMEORY USAGE -----\"",
")",
";",
"logger",
".",
"info",
"(",
"\"BUCKET_MEMORY = {}\"",
",",
"BUCKET_MEMORY",
")",
";",
"logger",
".",
"info",
"(",
"\"MEMORY_CHUNK = {}\"",
",",
"MEMORY_CHUNK",
")",
";",
"logger",
".",
"info",
"(",
"\"MAX_MEMORY_PER_BUCKET = {}\"",
",",
"MAX_MEMORY_PER_BUCKET",
")",
";",
"logger",
".",
"info",
"(",
"\"CHUNKSIZE = {}\"",
",",
"SYNC_CHUNK_SIZE",
")",
";",
"logger",
".",
"info",
"(",
"\"----- HeaderIndexFile -----\"",
")",
";",
"logger",
".",
"info",
"(",
"\"INITIAL_FILE_SIZE = {}\"",
",",
"INITIAL_FILE_SIZE",
")",
";",
"logger",
".",
"info",
"(",
"\"INITIAL_INCREMENT_SIZE = {}\"",
",",
"INITIAL_INCREMENT_SIZE",
")",
";",
"logger",
".",
"info",
"(",
"\"CHUNK_SIZE = {}\"",
",",
"FILE_CHUNK_SIZE",
")",
";",
"}"
] |
Outputs the configuration to the Logger.
|
[
"Outputs",
"the",
"configuration",
"to",
"the",
"Logger",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/DRUMSParameterSet.java#L221-L232
|
150,850
|
mgledi/DRUMS
|
src/main/java/com/unister/semweb/drums/DRUMSParameterSet.java
|
DRUMSParameterSet.parseSize
|
public static long parseSize(String s) {
Matcher m = p_mem.matcher(s);
if (m.find()) {
long i = Long.parseLong(m.group(1));
char multiplier = 'B';
if (m.group(2) != null && m.group(2).length() == 1) {
multiplier = m.group(2).charAt(0);
}
if (multiplier == 'B') {
return (long) i;
}
if (multiplier == 'K') {
return (long) i * 1024l;
}
if (multiplier == 'M') {
return (long) i * 1024l * 1024l;
}
if (multiplier == 'G') {
return (long) i * 1024l * 1024l * 1024l;
}
}
return -1;
}
|
java
|
public static long parseSize(String s) {
Matcher m = p_mem.matcher(s);
if (m.find()) {
long i = Long.parseLong(m.group(1));
char multiplier = 'B';
if (m.group(2) != null && m.group(2).length() == 1) {
multiplier = m.group(2).charAt(0);
}
if (multiplier == 'B') {
return (long) i;
}
if (multiplier == 'K') {
return (long) i * 1024l;
}
if (multiplier == 'M') {
return (long) i * 1024l * 1024l;
}
if (multiplier == 'G') {
return (long) i * 1024l * 1024l * 1024l;
}
}
return -1;
}
|
[
"public",
"static",
"long",
"parseSize",
"(",
"String",
"s",
")",
"{",
"Matcher",
"m",
"=",
"p_mem",
".",
"matcher",
"(",
"s",
")",
";",
"if",
"(",
"m",
".",
"find",
"(",
")",
")",
"{",
"long",
"i",
"=",
"Long",
".",
"parseLong",
"(",
"m",
".",
"group",
"(",
"1",
")",
")",
";",
"char",
"multiplier",
"=",
"'",
"'",
";",
"if",
"(",
"m",
".",
"group",
"(",
"2",
")",
"!=",
"null",
"&&",
"m",
".",
"group",
"(",
"2",
")",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"multiplier",
"=",
"m",
".",
"group",
"(",
"2",
")",
".",
"charAt",
"(",
"0",
")",
";",
"}",
"if",
"(",
"multiplier",
"==",
"'",
"'",
")",
"{",
"return",
"(",
"long",
")",
"i",
";",
"}",
"if",
"(",
"multiplier",
"==",
"'",
"'",
")",
"{",
"return",
"(",
"long",
")",
"i",
"*",
"1024l",
";",
"}",
"if",
"(",
"multiplier",
"==",
"'",
"'",
")",
"{",
"return",
"(",
"long",
")",
"i",
"*",
"1024l",
"*",
"1024l",
";",
"}",
"if",
"(",
"multiplier",
"==",
"'",
"'",
")",
"{",
"return",
"(",
"long",
")",
"i",
"*",
"1024l",
"*",
"1024l",
"*",
"1024l",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
This methods parses the given String, which should represent a size, to a long. 'K' is interpreted as 1024, 'M'
as 1024^2 and 'G' as 1024^3.
@param s
the String to parse
@return size in byte. -1 if the String was not parsable.
|
[
"This",
"methods",
"parses",
"the",
"given",
"String",
"which",
"should",
"represent",
"a",
"size",
"to",
"a",
"long",
".",
"K",
"is",
"interpreted",
"as",
"1024",
"M",
"as",
"1024^2",
"and",
"G",
"as",
"1024^3",
"."
] |
a670f17a2186c9a15725f26617d77ce8e444e072
|
https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/DRUMSParameterSet.java#L244-L266
|
150,851
|
oaqa/uima-ecd
|
src/main/java/edu/cmu/lti/oaqa/framework/types/OutputElement.java
|
OutputElement.getSequenceId
|
public String getSequenceId() {
if (OutputElement_Type.featOkTst && ((OutputElement_Type)jcasType).casFeat_sequenceId == null)
jcasType.jcas.throwFeatMissing("sequenceId", "edu.cmu.lti.oaqa.framework.types.OutputElement");
return jcasType.ll_cas.ll_getStringValue(addr, ((OutputElement_Type)jcasType).casFeatCode_sequenceId);}
|
java
|
public String getSequenceId() {
if (OutputElement_Type.featOkTst && ((OutputElement_Type)jcasType).casFeat_sequenceId == null)
jcasType.jcas.throwFeatMissing("sequenceId", "edu.cmu.lti.oaqa.framework.types.OutputElement");
return jcasType.ll_cas.ll_getStringValue(addr, ((OutputElement_Type)jcasType).casFeatCode_sequenceId);}
|
[
"public",
"String",
"getSequenceId",
"(",
")",
"{",
"if",
"(",
"OutputElement_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"OutputElement_Type",
")",
"jcasType",
")",
".",
"casFeat_sequenceId",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"sequenceId\"",
",",
"\"edu.cmu.lti.oaqa.framework.types.OutputElement\"",
")",
";",
"return",
"jcasType",
".",
"ll_cas",
".",
"ll_getStringValue",
"(",
"addr",
",",
"(",
"(",
"OutputElement_Type",
")",
"jcasType",
")",
".",
"casFeatCode_sequenceId",
")",
";",
"}"
] |
getter for sequenceId - gets
@generated
|
[
"getter",
"for",
"sequenceId",
"-",
"gets"
] |
09a0ae26647490b43affc36ab3a01100702b989f
|
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/framework/types/OutputElement.java#L67-L70
|
150,852
|
oaqa/uima-ecd
|
src/main/java/edu/cmu/lti/oaqa/framework/types/OutputElement.java
|
OutputElement.setSequenceId
|
public void setSequenceId(String v) {
if (OutputElement_Type.featOkTst && ((OutputElement_Type)jcasType).casFeat_sequenceId == null)
jcasType.jcas.throwFeatMissing("sequenceId", "edu.cmu.lti.oaqa.framework.types.OutputElement");
jcasType.ll_cas.ll_setStringValue(addr, ((OutputElement_Type)jcasType).casFeatCode_sequenceId, v);}
|
java
|
public void setSequenceId(String v) {
if (OutputElement_Type.featOkTst && ((OutputElement_Type)jcasType).casFeat_sequenceId == null)
jcasType.jcas.throwFeatMissing("sequenceId", "edu.cmu.lti.oaqa.framework.types.OutputElement");
jcasType.ll_cas.ll_setStringValue(addr, ((OutputElement_Type)jcasType).casFeatCode_sequenceId, v);}
|
[
"public",
"void",
"setSequenceId",
"(",
"String",
"v",
")",
"{",
"if",
"(",
"OutputElement_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"OutputElement_Type",
")",
"jcasType",
")",
".",
"casFeat_sequenceId",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"sequenceId\"",
",",
"\"edu.cmu.lti.oaqa.framework.types.OutputElement\"",
")",
";",
"jcasType",
".",
"ll_cas",
".",
"ll_setStringValue",
"(",
"addr",
",",
"(",
"(",
"OutputElement_Type",
")",
"jcasType",
")",
".",
"casFeatCode_sequenceId",
",",
"v",
")",
";",
"}"
] |
setter for sequenceId - sets
@generated
|
[
"setter",
"for",
"sequenceId",
"-",
"sets"
] |
09a0ae26647490b43affc36ab3a01100702b989f
|
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/framework/types/OutputElement.java#L74-L77
|
150,853
|
oaqa/uima-ecd
|
src/main/java/edu/cmu/lti/oaqa/framework/types/OutputElement.java
|
OutputElement.getAnswer
|
public String getAnswer() {
if (OutputElement_Type.featOkTst && ((OutputElement_Type)jcasType).casFeat_answer == null)
jcasType.jcas.throwFeatMissing("answer", "edu.cmu.lti.oaqa.framework.types.OutputElement");
return jcasType.ll_cas.ll_getStringValue(addr, ((OutputElement_Type)jcasType).casFeatCode_answer);}
|
java
|
public String getAnswer() {
if (OutputElement_Type.featOkTst && ((OutputElement_Type)jcasType).casFeat_answer == null)
jcasType.jcas.throwFeatMissing("answer", "edu.cmu.lti.oaqa.framework.types.OutputElement");
return jcasType.ll_cas.ll_getStringValue(addr, ((OutputElement_Type)jcasType).casFeatCode_answer);}
|
[
"public",
"String",
"getAnswer",
"(",
")",
"{",
"if",
"(",
"OutputElement_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"OutputElement_Type",
")",
"jcasType",
")",
".",
"casFeat_answer",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"answer\"",
",",
"\"edu.cmu.lti.oaqa.framework.types.OutputElement\"",
")",
";",
"return",
"jcasType",
".",
"ll_cas",
".",
"ll_getStringValue",
"(",
"addr",
",",
"(",
"(",
"OutputElement_Type",
")",
"jcasType",
")",
".",
"casFeatCode_answer",
")",
";",
"}"
] |
getter for answer - gets
@generated
|
[
"getter",
"for",
"answer",
"-",
"gets"
] |
09a0ae26647490b43affc36ab3a01100702b989f
|
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/framework/types/OutputElement.java#L85-L88
|
150,854
|
oaqa/uima-ecd
|
src/main/java/edu/cmu/lti/oaqa/framework/types/OutputElement.java
|
OutputElement.setAnswer
|
public void setAnswer(String v) {
if (OutputElement_Type.featOkTst && ((OutputElement_Type)jcasType).casFeat_answer == null)
jcasType.jcas.throwFeatMissing("answer", "edu.cmu.lti.oaqa.framework.types.OutputElement");
jcasType.ll_cas.ll_setStringValue(addr, ((OutputElement_Type)jcasType).casFeatCode_answer, v);}
|
java
|
public void setAnswer(String v) {
if (OutputElement_Type.featOkTst && ((OutputElement_Type)jcasType).casFeat_answer == null)
jcasType.jcas.throwFeatMissing("answer", "edu.cmu.lti.oaqa.framework.types.OutputElement");
jcasType.ll_cas.ll_setStringValue(addr, ((OutputElement_Type)jcasType).casFeatCode_answer, v);}
|
[
"public",
"void",
"setAnswer",
"(",
"String",
"v",
")",
"{",
"if",
"(",
"OutputElement_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"OutputElement_Type",
")",
"jcasType",
")",
".",
"casFeat_answer",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"answer\"",
",",
"\"edu.cmu.lti.oaqa.framework.types.OutputElement\"",
")",
";",
"jcasType",
".",
"ll_cas",
".",
"ll_setStringValue",
"(",
"addr",
",",
"(",
"(",
"OutputElement_Type",
")",
"jcasType",
")",
".",
"casFeatCode_answer",
",",
"v",
")",
";",
"}"
] |
setter for answer - sets
@generated
|
[
"setter",
"for",
"answer",
"-",
"sets"
] |
09a0ae26647490b43affc36ab3a01100702b989f
|
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/framework/types/OutputElement.java#L92-L95
|
150,855
|
adamfisk/dnsjava-fork
|
src/org/xbill/DNS/Compression.java
|
Compression.add
|
public void
add(int pos, Name name) {
if (pos > MAX_POINTER)
return;
int row = (name.hashCode() & 0x7FFFFFFF) % TABLE_SIZE;
Entry entry = new Entry();
entry.name = name;
entry.pos = pos;
entry.next = table[row];
table[row] = entry;
if (verbose)
System.err.println("Adding " + name + " at " + pos);
}
|
java
|
public void
add(int pos, Name name) {
if (pos > MAX_POINTER)
return;
int row = (name.hashCode() & 0x7FFFFFFF) % TABLE_SIZE;
Entry entry = new Entry();
entry.name = name;
entry.pos = pos;
entry.next = table[row];
table[row] = entry;
if (verbose)
System.err.println("Adding " + name + " at " + pos);
}
|
[
"public",
"void",
"add",
"(",
"int",
"pos",
",",
"Name",
"name",
")",
"{",
"if",
"(",
"pos",
">",
"MAX_POINTER",
")",
"return",
";",
"int",
"row",
"=",
"(",
"name",
".",
"hashCode",
"(",
")",
"&",
"0x7FFFFFFF",
")",
"%",
"TABLE_SIZE",
";",
"Entry",
"entry",
"=",
"new",
"Entry",
"(",
")",
";",
"entry",
".",
"name",
"=",
"name",
";",
"entry",
".",
"pos",
"=",
"pos",
";",
"entry",
".",
"next",
"=",
"table",
"[",
"row",
"]",
";",
"table",
"[",
"row",
"]",
"=",
"entry",
";",
"if",
"(",
"verbose",
")",
"System",
".",
"err",
".",
"println",
"(",
"\"Adding \"",
"+",
"name",
"+",
"\" at \"",
"+",
"pos",
")",
";",
"}"
] |
Adds a compression entry mapping a name to a position in a message.
@param pos The position at which the name is added.
@param name The name being added to the message.
|
[
"Adds",
"a",
"compression",
"entry",
"mapping",
"a",
"name",
"to",
"a",
"position",
"in",
"a",
"message",
"."
] |
69510a1cad0518badb19a6615724313bebc61f90
|
https://github.com/adamfisk/dnsjava-fork/blob/69510a1cad0518badb19a6615724313bebc61f90/src/org/xbill/DNS/Compression.java#L39-L51
|
150,856
|
adamfisk/dnsjava-fork
|
src/org/xbill/DNS/Compression.java
|
Compression.get
|
public int
get(Name name) {
int row = (name.hashCode() & 0x7FFFFFFF) % TABLE_SIZE;
int pos = -1;
for (Entry entry = table[row]; entry != null; entry = entry.next) {
if (entry.name.equals(name))
pos = entry.pos;
}
if (verbose)
System.err.println("Looking for " + name + ", found " + pos);
return pos;
}
|
java
|
public int
get(Name name) {
int row = (name.hashCode() & 0x7FFFFFFF) % TABLE_SIZE;
int pos = -1;
for (Entry entry = table[row]; entry != null; entry = entry.next) {
if (entry.name.equals(name))
pos = entry.pos;
}
if (verbose)
System.err.println("Looking for " + name + ", found " + pos);
return pos;
}
|
[
"public",
"int",
"get",
"(",
"Name",
"name",
")",
"{",
"int",
"row",
"=",
"(",
"name",
".",
"hashCode",
"(",
")",
"&",
"0x7FFFFFFF",
")",
"%",
"TABLE_SIZE",
";",
"int",
"pos",
"=",
"-",
"1",
";",
"for",
"(",
"Entry",
"entry",
"=",
"table",
"[",
"row",
"]",
";",
"entry",
"!=",
"null",
";",
"entry",
"=",
"entry",
".",
"next",
")",
"{",
"if",
"(",
"entry",
".",
"name",
".",
"equals",
"(",
"name",
")",
")",
"pos",
"=",
"entry",
".",
"pos",
";",
"}",
"if",
"(",
"verbose",
")",
"System",
".",
"err",
".",
"println",
"(",
"\"Looking for \"",
"+",
"name",
"+",
"\", found \"",
"+",
"pos",
")",
";",
"return",
"pos",
";",
"}"
] |
Retrieves the position of the given name, if it has been previously
included in the message.
@param name The name to find in the compression table.
@return The position of the name, or -1 if not found.
|
[
"Retrieves",
"the",
"position",
"of",
"the",
"given",
"name",
"if",
"it",
"has",
"been",
"previously",
"included",
"in",
"the",
"message",
"."
] |
69510a1cad0518badb19a6615724313bebc61f90
|
https://github.com/adamfisk/dnsjava-fork/blob/69510a1cad0518badb19a6615724313bebc61f90/src/org/xbill/DNS/Compression.java#L59-L70
|
150,857
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/wav/RiffFile.java
|
RiffFile.open
|
public int open(String Filename, int NewMode)
{
int retcode = DDC_SUCCESS;
if (fmode != RFM_UNKNOWN)
{
retcode = close();
}
if (retcode == DDC_SUCCESS)
{
switch (NewMode)
{
case RFM_WRITE:
try
{
file = new RandomAccessFile(Filename, "rw");
fmode = RFM_WRITE;
// Write the RIFF header...
// We will have to come back later and patch it!
if (writeHeader_internally(riff_header)!=DDC_SUCCESS)
{
file.close();
fmode = RFM_UNKNOWN;
}
}
catch (IOException ioe)
{
fmode = RFM_UNKNOWN;
retcode = DDC_FILE_ERROR;
}
break;
case RFM_READ:
try
{
file = new RandomAccessFile(Filename, "r");
try
{
// Try to read the RIFF header...
byte[] br = new byte[8];
file.read(br, 0, 8);
fmode = RFM_READ;
riff_header.ckID = ((br[0] << 24) & 0xFF000000) | ((br[1] << 16) & 0x00FF0000) | ((br[2] << 8) & 0x0000FF00) | (br[3] & 0x000000FF);
riff_header.ckSize = ((br[7] << 24) & 0xFF000000) | ((br[6] << 16) & 0x00FF0000) | ((br[5] << 8) & 0x0000FF00) | (br[4] & 0x000000FF);
}
catch (IOException ioe)
{
file.close();
fmode = RFM_UNKNOWN;
}
}
catch (IOException ioe)
{
fmode = RFM_UNKNOWN;
retcode = DDC_FILE_ERROR;
}
break;
default:
retcode = DDC_INVALID_CALL;
}
}
return retcode;
}
|
java
|
public int open(String Filename, int NewMode)
{
int retcode = DDC_SUCCESS;
if (fmode != RFM_UNKNOWN)
{
retcode = close();
}
if (retcode == DDC_SUCCESS)
{
switch (NewMode)
{
case RFM_WRITE:
try
{
file = new RandomAccessFile(Filename, "rw");
fmode = RFM_WRITE;
// Write the RIFF header...
// We will have to come back later and patch it!
if (writeHeader_internally(riff_header)!=DDC_SUCCESS)
{
file.close();
fmode = RFM_UNKNOWN;
}
}
catch (IOException ioe)
{
fmode = RFM_UNKNOWN;
retcode = DDC_FILE_ERROR;
}
break;
case RFM_READ:
try
{
file = new RandomAccessFile(Filename, "r");
try
{
// Try to read the RIFF header...
byte[] br = new byte[8];
file.read(br, 0, 8);
fmode = RFM_READ;
riff_header.ckID = ((br[0] << 24) & 0xFF000000) | ((br[1] << 16) & 0x00FF0000) | ((br[2] << 8) & 0x0000FF00) | (br[3] & 0x000000FF);
riff_header.ckSize = ((br[7] << 24) & 0xFF000000) | ((br[6] << 16) & 0x00FF0000) | ((br[5] << 8) & 0x0000FF00) | (br[4] & 0x000000FF);
}
catch (IOException ioe)
{
file.close();
fmode = RFM_UNKNOWN;
}
}
catch (IOException ioe)
{
fmode = RFM_UNKNOWN;
retcode = DDC_FILE_ERROR;
}
break;
default:
retcode = DDC_INVALID_CALL;
}
}
return retcode;
}
|
[
"public",
"int",
"open",
"(",
"String",
"Filename",
",",
"int",
"NewMode",
")",
"{",
"int",
"retcode",
"=",
"DDC_SUCCESS",
";",
"if",
"(",
"fmode",
"!=",
"RFM_UNKNOWN",
")",
"{",
"retcode",
"=",
"close",
"(",
")",
";",
"}",
"if",
"(",
"retcode",
"==",
"DDC_SUCCESS",
")",
"{",
"switch",
"(",
"NewMode",
")",
"{",
"case",
"RFM_WRITE",
":",
"try",
"{",
"file",
"=",
"new",
"RandomAccessFile",
"(",
"Filename",
",",
"\"rw\"",
")",
";",
"fmode",
"=",
"RFM_WRITE",
";",
"// Write the RIFF header...",
"// We will have to come back later and patch it!",
"if",
"(",
"writeHeader_internally",
"(",
"riff_header",
")",
"!=",
"DDC_SUCCESS",
")",
"{",
"file",
".",
"close",
"(",
")",
";",
"fmode",
"=",
"RFM_UNKNOWN",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"fmode",
"=",
"RFM_UNKNOWN",
";",
"retcode",
"=",
"DDC_FILE_ERROR",
";",
"}",
"break",
";",
"case",
"RFM_READ",
":",
"try",
"{",
"file",
"=",
"new",
"RandomAccessFile",
"(",
"Filename",
",",
"\"r\"",
")",
";",
"try",
"{",
"// Try to read the RIFF header... \t\t\t\t ",
"byte",
"[",
"]",
"br",
"=",
"new",
"byte",
"[",
"8",
"]",
";",
"file",
".",
"read",
"(",
"br",
",",
"0",
",",
"8",
")",
";",
"fmode",
"=",
"RFM_READ",
";",
"riff_header",
".",
"ckID",
"=",
"(",
"(",
"br",
"[",
"0",
"]",
"<<",
"24",
")",
"&",
"0xFF000000",
")",
"|",
"(",
"(",
"br",
"[",
"1",
"]",
"<<",
"16",
")",
"&",
"0x00FF0000",
")",
"|",
"(",
"(",
"br",
"[",
"2",
"]",
"<<",
"8",
")",
"&",
"0x0000FF00",
")",
"|",
"(",
"br",
"[",
"3",
"]",
"&",
"0x000000FF",
")",
";",
"riff_header",
".",
"ckSize",
"=",
"(",
"(",
"br",
"[",
"7",
"]",
"<<",
"24",
")",
"&",
"0xFF000000",
")",
"|",
"(",
"(",
"br",
"[",
"6",
"]",
"<<",
"16",
")",
"&",
"0x00FF0000",
")",
"|",
"(",
"(",
"br",
"[",
"5",
"]",
"<<",
"8",
")",
"&",
"0x0000FF00",
")",
"|",
"(",
"br",
"[",
"4",
"]",
"&",
"0x000000FF",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"file",
".",
"close",
"(",
")",
";",
"fmode",
"=",
"RFM_UNKNOWN",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"fmode",
"=",
"RFM_UNKNOWN",
";",
"retcode",
"=",
"DDC_FILE_ERROR",
";",
"}",
"break",
";",
"default",
":",
"retcode",
"=",
"DDC_INVALID_CALL",
";",
"}",
"}",
"return",
"retcode",
";",
"}"
] |
Open a RIFF file.
|
[
"Open",
"a",
"RIFF",
"file",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/wav/RiffFile.java#L91-L154
|
150,858
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/wav/RiffFile.java
|
RiffFile.read
|
public int read(byte[] Data, int NumBytes)
{
int retcode = DDC_SUCCESS;
try
{
file.read(Data, 0, NumBytes);
}
catch (IOException ioe)
{
retcode = DDC_FILE_ERROR;
}
return retcode;
}
|
java
|
public int read(byte[] Data, int NumBytes)
{
int retcode = DDC_SUCCESS;
try
{
file.read(Data, 0, NumBytes);
}
catch (IOException ioe)
{
retcode = DDC_FILE_ERROR;
}
return retcode;
}
|
[
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"Data",
",",
"int",
"NumBytes",
")",
"{",
"int",
"retcode",
"=",
"DDC_SUCCESS",
";",
"try",
"{",
"file",
".",
"read",
"(",
"Data",
",",
"0",
",",
"NumBytes",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"retcode",
"=",
"DDC_FILE_ERROR",
";",
"}",
"return",
"retcode",
";",
"}"
] |
Read NumBytes data.
|
[
"Read",
"NumBytes",
"data",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/wav/RiffFile.java#L271-L283
|
150,859
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/wav/RiffFile.java
|
RiffFile.expect
|
public int expect(String Data, int NumBytes)
{
byte target = 0;
int cnt = 0;
try
{
while ((NumBytes--) != 0)
{
target = file.readByte();
if (target != Data.charAt(cnt++)) return DDC_FILE_ERROR;
}
}
catch (IOException ioe)
{
return DDC_FILE_ERROR;
}
return DDC_SUCCESS;
}
|
java
|
public int expect(String Data, int NumBytes)
{
byte target = 0;
int cnt = 0;
try
{
while ((NumBytes--) != 0)
{
target = file.readByte();
if (target != Data.charAt(cnt++)) return DDC_FILE_ERROR;
}
}
catch (IOException ioe)
{
return DDC_FILE_ERROR;
}
return DDC_SUCCESS;
}
|
[
"public",
"int",
"expect",
"(",
"String",
"Data",
",",
"int",
"NumBytes",
")",
"{",
"byte",
"target",
"=",
"0",
";",
"int",
"cnt",
"=",
"0",
";",
"try",
"{",
"while",
"(",
"(",
"NumBytes",
"--",
")",
"!=",
"0",
")",
"{",
"target",
"=",
"file",
".",
"readByte",
"(",
")",
";",
"if",
"(",
"target",
"!=",
"Data",
".",
"charAt",
"(",
"cnt",
"++",
")",
")",
"return",
"DDC_FILE_ERROR",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"return",
"DDC_FILE_ERROR",
";",
"}",
"return",
"DDC_SUCCESS",
";",
"}"
] |
Expect NumBytes data.
|
[
"Expect",
"NumBytes",
"data",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/wav/RiffFile.java#L288-L305
|
150,860
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/wav/RiffFile.java
|
RiffFile.close
|
public int close()
{
int retcode = DDC_SUCCESS;
switch (fmode)
{
case RFM_WRITE:
try
{
file.seek(0);
try
{
writeHeader_internally(riff_header);
file.close();
}
catch (IOException ioe)
{
retcode = DDC_FILE_ERROR;
}
}
catch (IOException ioe)
{
retcode = DDC_FILE_ERROR;
}
break;
case RFM_READ:
try
{
file.close();
}
catch (IOException ioe)
{
retcode = DDC_FILE_ERROR;
}
break;
}
file = null;
fmode = RFM_UNKNOWN;
return retcode;
}
|
java
|
public int close()
{
int retcode = DDC_SUCCESS;
switch (fmode)
{
case RFM_WRITE:
try
{
file.seek(0);
try
{
writeHeader_internally(riff_header);
file.close();
}
catch (IOException ioe)
{
retcode = DDC_FILE_ERROR;
}
}
catch (IOException ioe)
{
retcode = DDC_FILE_ERROR;
}
break;
case RFM_READ:
try
{
file.close();
}
catch (IOException ioe)
{
retcode = DDC_FILE_ERROR;
}
break;
}
file = null;
fmode = RFM_UNKNOWN;
return retcode;
}
|
[
"public",
"int",
"close",
"(",
")",
"{",
"int",
"retcode",
"=",
"DDC_SUCCESS",
";",
"switch",
"(",
"fmode",
")",
"{",
"case",
"RFM_WRITE",
":",
"try",
"{",
"file",
".",
"seek",
"(",
"0",
")",
";",
"try",
"{",
"writeHeader_internally",
"(",
"riff_header",
")",
";",
"file",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"retcode",
"=",
"DDC_FILE_ERROR",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"retcode",
"=",
"DDC_FILE_ERROR",
";",
"}",
"break",
";",
"case",
"RFM_READ",
":",
"try",
"{",
"file",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"retcode",
"=",
"DDC_FILE_ERROR",
";",
"}",
"break",
";",
"}",
"file",
"=",
"null",
";",
"fmode",
"=",
"RFM_UNKNOWN",
";",
"return",
"retcode",
";",
"}"
] |
Close Riff File.
Length is written too.
|
[
"Close",
"Riff",
"File",
".",
"Length",
"is",
"written",
"too",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/wav/RiffFile.java#L311-L351
|
150,861
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/wav/RiffFile.java
|
RiffFile.backpatchHeader
|
public int backpatchHeader(long FileOffset, RiffChunkHeader data)
{
if (file == null)
{
return DDC_INVALID_CALL;
}
try
{
file.seek(FileOffset);
}
catch (IOException ioe)
{
return DDC_FILE_ERROR;
}
return writeHeader_internally(data);
}
|
java
|
public int backpatchHeader(long FileOffset, RiffChunkHeader data)
{
if (file == null)
{
return DDC_INVALID_CALL;
}
try
{
file.seek(FileOffset);
}
catch (IOException ioe)
{
return DDC_FILE_ERROR;
}
return writeHeader_internally(data);
}
|
[
"public",
"int",
"backpatchHeader",
"(",
"long",
"FileOffset",
",",
"RiffChunkHeader",
"data",
")",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"return",
"DDC_INVALID_CALL",
";",
"}",
"try",
"{",
"file",
".",
"seek",
"(",
"FileOffset",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"return",
"DDC_FILE_ERROR",
";",
"}",
"return",
"writeHeader_internally",
"(",
"data",
")",
";",
"}"
] |
Write Data to specified offset.
|
[
"Write",
"Data",
"to",
"specified",
"offset",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/wav/RiffFile.java#L373-L388
|
150,862
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/wav/RiffFile.java
|
RiffFile.seek
|
protected int seek(long offset)
{
int rc;
try
{
file.seek(offset);
rc = DDC_SUCCESS;
}
catch (IOException ioe)
{
rc = DDC_FILE_ERROR;
}
return rc;
}
|
java
|
protected int seek(long offset)
{
int rc;
try
{
file.seek(offset);
rc = DDC_SUCCESS;
}
catch (IOException ioe)
{
rc = DDC_FILE_ERROR;
}
return rc;
}
|
[
"protected",
"int",
"seek",
"(",
"long",
"offset",
")",
"{",
"int",
"rc",
";",
"try",
"{",
"file",
".",
"seek",
"(",
"offset",
")",
";",
"rc",
"=",
"DDC_SUCCESS",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"rc",
"=",
"DDC_FILE_ERROR",
";",
"}",
"return",
"rc",
";",
"}"
] |
Seek in the File.
|
[
"Seek",
"in",
"the",
"File",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/wav/RiffFile.java#L410-L423
|
150,863
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/io/wav/RiffFile.java
|
RiffFile.fourCC
|
public static int fourCC(String ChunkName)
{
byte[] p =
{
0x20, 0x20, 0x20, 0x20
};
System.arraycopy(ChunkName.getBytes(), 0, p, 0, 4);
int ret = (((p[0] << 24) & 0xFF000000) | ((p[1] << 16) & 0x00FF0000) | ((p[2] << 8) & 0x0000FF00) | (p[3] & 0x000000FF));
return ret;
}
|
java
|
public static int fourCC(String ChunkName)
{
byte[] p =
{
0x20, 0x20, 0x20, 0x20
};
System.arraycopy(ChunkName.getBytes(), 0, p, 0, 4);
int ret = (((p[0] << 24) & 0xFF000000) | ((p[1] << 16) & 0x00FF0000) | ((p[2] << 8) & 0x0000FF00) | (p[3] & 0x000000FF));
return ret;
}
|
[
"public",
"static",
"int",
"fourCC",
"(",
"String",
"ChunkName",
")",
"{",
"byte",
"[",
"]",
"p",
"=",
"{",
"0x20",
",",
"0x20",
",",
"0x20",
",",
"0x20",
"}",
";",
"System",
".",
"arraycopy",
"(",
"ChunkName",
".",
"getBytes",
"(",
")",
",",
"0",
",",
"p",
",",
"0",
",",
"4",
")",
";",
"int",
"ret",
"=",
"(",
"(",
"(",
"p",
"[",
"0",
"]",
"<<",
"24",
")",
"&",
"0xFF000000",
")",
"|",
"(",
"(",
"p",
"[",
"1",
"]",
"<<",
"16",
")",
"&",
"0x00FF0000",
")",
"|",
"(",
"(",
"p",
"[",
"2",
"]",
"<<",
"8",
")",
"&",
"0x0000FF00",
")",
"|",
"(",
"p",
"[",
"3",
"]",
"&",
"0x000000FF",
")",
")",
";",
"return",
"ret",
";",
"}"
] |
Fill the header.
|
[
"Fill",
"the",
"header",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/io/wav/RiffFile.java#L445-L454
|
150,864
|
diegossilveira/jcors
|
src/main/java/org/jcors/config/ConfigBuilder.java
|
ConfigBuilder.buildConfig
|
JCorsConfig buildConfig() {
JCorsConfig config = new JCorsConfig();
if (enableNonCorsRequests != null) {
config.setEnableNonCorsRequests(enableNonCorsRequests);
}
if (resourcesSupportCredentials != null) {
config.setResourcesSupportCredentials(resourcesSupportCredentials);
}
if (preflightResultCacheMaxAge != null) {
config.setPreflightResultCacheMaxAge(preflightResultCacheMaxAge);
}
setAllowedOrigins(config);
setAllowedHeaders(config);
setAllowedMethods(config);
setExposedHeaders(config);
return config;
}
|
java
|
JCorsConfig buildConfig() {
JCorsConfig config = new JCorsConfig();
if (enableNonCorsRequests != null) {
config.setEnableNonCorsRequests(enableNonCorsRequests);
}
if (resourcesSupportCredentials != null) {
config.setResourcesSupportCredentials(resourcesSupportCredentials);
}
if (preflightResultCacheMaxAge != null) {
config.setPreflightResultCacheMaxAge(preflightResultCacheMaxAge);
}
setAllowedOrigins(config);
setAllowedHeaders(config);
setAllowedMethods(config);
setExposedHeaders(config);
return config;
}
|
[
"JCorsConfig",
"buildConfig",
"(",
")",
"{",
"JCorsConfig",
"config",
"=",
"new",
"JCorsConfig",
"(",
")",
";",
"if",
"(",
"enableNonCorsRequests",
"!=",
"null",
")",
"{",
"config",
".",
"setEnableNonCorsRequests",
"(",
"enableNonCorsRequests",
")",
";",
"}",
"if",
"(",
"resourcesSupportCredentials",
"!=",
"null",
")",
"{",
"config",
".",
"setResourcesSupportCredentials",
"(",
"resourcesSupportCredentials",
")",
";",
"}",
"if",
"(",
"preflightResultCacheMaxAge",
"!=",
"null",
")",
"{",
"config",
".",
"setPreflightResultCacheMaxAge",
"(",
"preflightResultCacheMaxAge",
")",
";",
"}",
"setAllowedOrigins",
"(",
"config",
")",
";",
"setAllowedHeaders",
"(",
"config",
")",
";",
"setAllowedMethods",
"(",
"config",
")",
";",
"setExposedHeaders",
"(",
"config",
")",
";",
"return",
"config",
";",
"}"
] |
Build a new configuration
@return
|
[
"Build",
"a",
"new",
"configuration"
] |
cd56a9e2055d629baa42f93b27dd5615ced9632f
|
https://github.com/diegossilveira/jcors/blob/cd56a9e2055d629baa42f93b27dd5615ced9632f/src/main/java/org/jcors/config/ConfigBuilder.java#L50-L72
|
150,865
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Footer.java
|
ID3v2Footer.checkFooter
|
private boolean checkFooter(RandomAccessInputStream raf, int location) throws IOException
{
raf.seek(location);
byte[] buf = new byte[FOOT_SIZE];
if (raf.read(buf) != FOOT_SIZE)
{
throw new IOException("Error encountered finding id3v2 footer");
}
String result = new String(buf, ENC_TYPE);
if (result.substring(0, TAG_START.length()).equals(TAG_START))
{
if ((((int)buf[3]&0xFF) != 0xff) && (((int)buf[4]&0xFF) != 0xff))
{
if (((int)buf[6]&0x80)==0 && ((int)buf[7]&0x80)==0 && ((int)buf[8]&0x80)==0 && ((int)buf[9]&0x80)==0)
{
return true;
}
}
}
return false;
}
|
java
|
private boolean checkFooter(RandomAccessInputStream raf, int location) throws IOException
{
raf.seek(location);
byte[] buf = new byte[FOOT_SIZE];
if (raf.read(buf) != FOOT_SIZE)
{
throw new IOException("Error encountered finding id3v2 footer");
}
String result = new String(buf, ENC_TYPE);
if (result.substring(0, TAG_START.length()).equals(TAG_START))
{
if ((((int)buf[3]&0xFF) != 0xff) && (((int)buf[4]&0xFF) != 0xff))
{
if (((int)buf[6]&0x80)==0 && ((int)buf[7]&0x80)==0 && ((int)buf[8]&0x80)==0 && ((int)buf[9]&0x80)==0)
{
return true;
}
}
}
return false;
}
|
[
"private",
"boolean",
"checkFooter",
"(",
"RandomAccessInputStream",
"raf",
",",
"int",
"location",
")",
"throws",
"IOException",
"{",
"raf",
".",
"seek",
"(",
"location",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"FOOT_SIZE",
"]",
";",
"if",
"(",
"raf",
".",
"read",
"(",
"buf",
")",
"!=",
"FOOT_SIZE",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Error encountered finding id3v2 footer\"",
")",
";",
"}",
"String",
"result",
"=",
"new",
"String",
"(",
"buf",
",",
"ENC_TYPE",
")",
";",
"if",
"(",
"result",
".",
"substring",
"(",
"0",
",",
"TAG_START",
".",
"length",
"(",
")",
")",
".",
"equals",
"(",
"TAG_START",
")",
")",
"{",
"if",
"(",
"(",
"(",
"(",
"int",
")",
"buf",
"[",
"3",
"]",
"&",
"0xFF",
")",
"!=",
"0xff",
")",
"&&",
"(",
"(",
"(",
"int",
")",
"buf",
"[",
"4",
"]",
"&",
"0xFF",
")",
"!=",
"0xff",
")",
")",
"{",
"if",
"(",
"(",
"(",
"int",
")",
"buf",
"[",
"6",
"]",
"&",
"0x80",
")",
"==",
"0",
"&&",
"(",
"(",
"int",
")",
"buf",
"[",
"7",
"]",
"&",
"0x80",
")",
"==",
"0",
"&&",
"(",
"(",
"int",
")",
"buf",
"[",
"8",
"]",
"&",
"0x80",
")",
"==",
"0",
"&&",
"(",
"(",
"int",
")",
"buf",
"[",
"9",
"]",
"&",
"0x80",
")",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks to see if there is an id3v2 footer in the file provided to the
constructor.
@param location where the footer should be located in the file
@return true if an id3v2 footer exists in the file
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Checks",
"to",
"see",
"if",
"there",
"is",
"an",
"id3v2",
"footer",
"in",
"the",
"file",
"provided",
"to",
"the",
"constructor",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Footer.java#L81-L104
|
150,866
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Footer.java
|
ID3v2Footer.readFooter
|
private void readFooter(RandomAccessInputStream raf, int location) throws IOException
{
raf.seek(location);
byte[] foot = new byte[FOOT_SIZE];
if (raf.read(foot) != FOOT_SIZE)
{
throw new IOException("Error encountered reading id3v2 footer");
}
majorVersion = (int) foot[3];
if (majorVersion <= NEW_MAJOR_VERSION)
{
minorVersion = (int) foot[4];
unsynchronisation = (foot[5]&0x80)!=0;
extended = (foot[5]&0x40)!=0;
experimental = (foot[5]&0x20)!=0;
footer = (foot[5]&0x10)!=0;
tagSize = Helpers.convertDWordToInt(foot, 6);
}
}
|
java
|
private void readFooter(RandomAccessInputStream raf, int location) throws IOException
{
raf.seek(location);
byte[] foot = new byte[FOOT_SIZE];
if (raf.read(foot) != FOOT_SIZE)
{
throw new IOException("Error encountered reading id3v2 footer");
}
majorVersion = (int) foot[3];
if (majorVersion <= NEW_MAJOR_VERSION)
{
minorVersion = (int) foot[4];
unsynchronisation = (foot[5]&0x80)!=0;
extended = (foot[5]&0x40)!=0;
experimental = (foot[5]&0x20)!=0;
footer = (foot[5]&0x10)!=0;
tagSize = Helpers.convertDWordToInt(foot, 6);
}
}
|
[
"private",
"void",
"readFooter",
"(",
"RandomAccessInputStream",
"raf",
",",
"int",
"location",
")",
"throws",
"IOException",
"{",
"raf",
".",
"seek",
"(",
"location",
")",
";",
"byte",
"[",
"]",
"foot",
"=",
"new",
"byte",
"[",
"FOOT_SIZE",
"]",
";",
"if",
"(",
"raf",
".",
"read",
"(",
"foot",
")",
"!=",
"FOOT_SIZE",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Error encountered reading id3v2 footer\"",
")",
";",
"}",
"majorVersion",
"=",
"(",
"int",
")",
"foot",
"[",
"3",
"]",
";",
"if",
"(",
"majorVersion",
"<=",
"NEW_MAJOR_VERSION",
")",
"{",
"minorVersion",
"=",
"(",
"int",
")",
"foot",
"[",
"4",
"]",
";",
"unsynchronisation",
"=",
"(",
"foot",
"[",
"5",
"]",
"&",
"0x80",
")",
"!=",
"0",
";",
"extended",
"=",
"(",
"foot",
"[",
"5",
"]",
"&",
"0x40",
")",
"!=",
"0",
";",
"experimental",
"=",
"(",
"foot",
"[",
"5",
"]",
"&",
"0x20",
")",
"!=",
"0",
";",
"footer",
"=",
"(",
"foot",
"[",
"5",
"]",
"&",
"0x10",
")",
"!=",
"0",
";",
"tagSize",
"=",
"Helpers",
".",
"convertDWordToInt",
"(",
"foot",
",",
"6",
")",
";",
"}",
"}"
] |
Extracts the information from the footer.
@param location where the footer is in the file
@exception FileNotFoundException if an error occurs
@exception IOException if an error occurs
|
[
"Extracts",
"the",
"information",
"from",
"the",
"footer",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Footer.java#L113-L134
|
150,867
|
hawkular/hawkular-inventory
|
hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/model/SyncHash.java
|
SyncHash.of
|
public static String of(InventoryStructure<?> structure, CanonicalPath rootPath) {
return ComputeHash.of(structure, rootPath, true, true, true).getSyncHash();
}
|
java
|
public static String of(InventoryStructure<?> structure, CanonicalPath rootPath) {
return ComputeHash.of(structure, rootPath, true, true, true).getSyncHash();
}
|
[
"public",
"static",
"String",
"of",
"(",
"InventoryStructure",
"<",
"?",
">",
"structure",
",",
"CanonicalPath",
"rootPath",
")",
"{",
"return",
"ComputeHash",
".",
"of",
"(",
"structure",
",",
"rootPath",
",",
"true",
",",
"true",
",",
"true",
")",
".",
"getSyncHash",
"(",
")",
";",
"}"
] |
The root path is required so that paths in the blueprints can be correctly relativized.
@param structure the structure to compute the root hash of.
@param rootPath the canonical path of the root of the inventory structure
@return the sync hash of the root of the structure
|
[
"The",
"root",
"path",
"is",
"required",
"so",
"that",
"paths",
"in",
"the",
"blueprints",
"can",
"be",
"correctly",
"relativized",
"."
] |
f56dc10323dca21777feb5b609a9e9cc70ffaf62
|
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/model/SyncHash.java#L47-L49
|
150,868
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java
|
Field.visualize
|
public Object visualize(PMContext ctx, Operation operation, Entity entity) throws PMException {
debug("Converting [" + operation.getId() + "]" + entity.getId() + "." + getId());
try {
Converter c = null;
if (getConverters() != null) {
c = getConverter(operation.getId());
}
if (c == null) {
c = getDefaultConverter();
}
final Object instance = ctx.getEntityInstance();
ctx.setField(this);
// We only set the field value if instance is not null.
// Some operations may use this value without an instance.
if (instance != null) {
ctx.setEntityInstanceWrapper(ctx.buildInstanceWrapper(instance));
ctx.setFieldValue(getPm().get(instance, getProperty()));
}
return c.visualize(ctx);
} catch (ConverterException e) {
throw e;
} catch (Exception e) {
getPm().error(e);
throw new ConverterException("Unable to convert " + entity.getId() + "." + getProperty());
}
}
|
java
|
public Object visualize(PMContext ctx, Operation operation, Entity entity) throws PMException {
debug("Converting [" + operation.getId() + "]" + entity.getId() + "." + getId());
try {
Converter c = null;
if (getConverters() != null) {
c = getConverter(operation.getId());
}
if (c == null) {
c = getDefaultConverter();
}
final Object instance = ctx.getEntityInstance();
ctx.setField(this);
// We only set the field value if instance is not null.
// Some operations may use this value without an instance.
if (instance != null) {
ctx.setEntityInstanceWrapper(ctx.buildInstanceWrapper(instance));
ctx.setFieldValue(getPm().get(instance, getProperty()));
}
return c.visualize(ctx);
} catch (ConverterException e) {
throw e;
} catch (Exception e) {
getPm().error(e);
throw new ConverterException("Unable to convert " + entity.getId() + "." + getProperty());
}
}
|
[
"public",
"Object",
"visualize",
"(",
"PMContext",
"ctx",
",",
"Operation",
"operation",
",",
"Entity",
"entity",
")",
"throws",
"PMException",
"{",
"debug",
"(",
"\"Converting [\"",
"+",
"operation",
".",
"getId",
"(",
")",
"+",
"\"]\"",
"+",
"entity",
".",
"getId",
"(",
")",
"+",
"\".\"",
"+",
"getId",
"(",
")",
")",
";",
"try",
"{",
"Converter",
"c",
"=",
"null",
";",
"if",
"(",
"getConverters",
"(",
")",
"!=",
"null",
")",
"{",
"c",
"=",
"getConverter",
"(",
"operation",
".",
"getId",
"(",
")",
")",
";",
"}",
"if",
"(",
"c",
"==",
"null",
")",
"{",
"c",
"=",
"getDefaultConverter",
"(",
")",
";",
"}",
"final",
"Object",
"instance",
"=",
"ctx",
".",
"getEntityInstance",
"(",
")",
";",
"ctx",
".",
"setField",
"(",
"this",
")",
";",
"// We only set the field value if instance is not null.",
"// Some operations may use this value without an instance.",
"if",
"(",
"instance",
"!=",
"null",
")",
"{",
"ctx",
".",
"setEntityInstanceWrapper",
"(",
"ctx",
".",
"buildInstanceWrapper",
"(",
"instance",
")",
")",
";",
"ctx",
".",
"setFieldValue",
"(",
"getPm",
"(",
")",
".",
"get",
"(",
"instance",
",",
"getProperty",
"(",
")",
")",
")",
";",
"}",
"return",
"c",
".",
"visualize",
"(",
"ctx",
")",
";",
"}",
"catch",
"(",
"ConverterException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"getPm",
"(",
")",
".",
"error",
"(",
"e",
")",
";",
"throw",
"new",
"ConverterException",
"(",
"\"Unable to convert \"",
"+",
"entity",
".",
"getId",
"(",
")",
"+",
"\".\"",
"+",
"getProperty",
"(",
")",
")",
";",
"}",
"}"
] |
Visualize the field using the given operation and entity
@param ctx the context
@param operation The operation
@param entity The entity
@return The string visualization
@throws PMException
|
[
"Visualize",
"the",
"field",
"using",
"the",
"given",
"operation",
"and",
"entity"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java#L71-L96
|
150,869
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java
|
Field.getDefaultConverter
|
public Converter getDefaultConverter() {
if (getPm().getDefaultConverter() == null) {
Converter c = new GenericConverter();
Properties properties = new Properties();
properties.put("filename", "converters/show.tostring.converter");
c.setProperties(properties);
return c;
} else {
return getPm().getDefaultConverter();
}
}
|
java
|
public Converter getDefaultConverter() {
if (getPm().getDefaultConverter() == null) {
Converter c = new GenericConverter();
Properties properties = new Properties();
properties.put("filename", "converters/show.tostring.converter");
c.setProperties(properties);
return c;
} else {
return getPm().getDefaultConverter();
}
}
|
[
"public",
"Converter",
"getDefaultConverter",
"(",
")",
"{",
"if",
"(",
"getPm",
"(",
")",
".",
"getDefaultConverter",
"(",
")",
"==",
"null",
")",
"{",
"Converter",
"c",
"=",
"new",
"GenericConverter",
"(",
")",
";",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"properties",
".",
"put",
"(",
"\"filename\"",
",",
"\"converters/show.tostring.converter\"",
")",
";",
"c",
".",
"setProperties",
"(",
"properties",
")",
";",
"return",
"c",
";",
"}",
"else",
"{",
"return",
"getPm",
"(",
")",
".",
"getDefaultConverter",
"(",
")",
";",
"}",
"}"
] |
Return the default converter if none is defined
@return The converter
|
[
"Return",
"the",
"default",
"converter",
"if",
"none",
"is",
"defined"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java#L103-L113
|
150,870
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java
|
Field.visualize
|
public Object visualize(PMContext ctx, Operation operation) throws PMException {
return visualize(ctx, operation, ctx.getEntity());
}
|
java
|
public Object visualize(PMContext ctx, Operation operation) throws PMException {
return visualize(ctx, operation, ctx.getEntity());
}
|
[
"public",
"Object",
"visualize",
"(",
"PMContext",
"ctx",
",",
"Operation",
"operation",
")",
"throws",
"PMException",
"{",
"return",
"visualize",
"(",
"ctx",
",",
"operation",
",",
"ctx",
".",
"getEntity",
"(",
")",
")",
";",
"}"
] |
Visualize the field using the given operation and context entity
@param ctx the context
@param operation The operation
@return The String visualization
@throws PMException
|
[
"Visualize",
"the",
"field",
"using",
"the",
"given",
"operation",
"and",
"context",
"entity"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java#L123-L125
|
150,871
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java
|
Field.shouldDisplay
|
public boolean shouldDisplay(String operationId, PMSecurityUser user) {
if (operationId == null) {
return false;
}
//First we check permissions
for (FieldOperationConfig config : getConfigs()) {
if (config.includes(operationId)) {
if (config.getPerm() != null && user != null && !user.hasPermission(config.getPerm())) {
return false;
}
}
}
if (getDisplay().equalsIgnoreCase("all")) {
return true;
}
final String[] split = getDisplay().split("[ ]");
for (String string : split) {
if (string.equalsIgnoreCase(operationId)) {
return true;
}
}
return false;
}
|
java
|
public boolean shouldDisplay(String operationId, PMSecurityUser user) {
if (operationId == null) {
return false;
}
//First we check permissions
for (FieldOperationConfig config : getConfigs()) {
if (config.includes(operationId)) {
if (config.getPerm() != null && user != null && !user.hasPermission(config.getPerm())) {
return false;
}
}
}
if (getDisplay().equalsIgnoreCase("all")) {
return true;
}
final String[] split = getDisplay().split("[ ]");
for (String string : split) {
if (string.equalsIgnoreCase(operationId)) {
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"shouldDisplay",
"(",
"String",
"operationId",
",",
"PMSecurityUser",
"user",
")",
"{",
"if",
"(",
"operationId",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"//First we check permissions",
"for",
"(",
"FieldOperationConfig",
"config",
":",
"getConfigs",
"(",
")",
")",
"{",
"if",
"(",
"config",
".",
"includes",
"(",
"operationId",
")",
")",
"{",
"if",
"(",
"config",
".",
"getPerm",
"(",
")",
"!=",
"null",
"&&",
"user",
"!=",
"null",
"&&",
"!",
"user",
".",
"hasPermission",
"(",
"config",
".",
"getPerm",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"if",
"(",
"getDisplay",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"\"all\"",
")",
")",
"{",
"return",
"true",
";",
"}",
"final",
"String",
"[",
"]",
"split",
"=",
"getDisplay",
"(",
")",
".",
"split",
"(",
"\"[ ]\"",
")",
";",
"for",
"(",
"String",
"string",
":",
"split",
")",
"{",
"if",
"(",
"string",
".",
"equalsIgnoreCase",
"(",
"operationId",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Indicates if the field is shown in the given operation id
@param operationId The Operation id
@return true if field is displayed on the operation
|
[
"Indicates",
"if",
"the",
"field",
"is",
"shown",
"in",
"the",
"given",
"operation",
"id"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java#L208-L230
|
150,872
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java
|
Field.getTitle
|
public String getTitle() {
final String key = String.format("pm.field.%s.%s", getEntity().getId(), getId());
final String message = getPm().message(key);
if (key.equals(message)) {
final Entity extendzEntity = getEntity().getExtendzEntity();
if (extendzEntity != null && extendzEntity.getFieldById(getId()) != null) {
return extendzEntity.getFieldById(getId()).getTitle();
}
}
return message;
}
|
java
|
public String getTitle() {
final String key = String.format("pm.field.%s.%s", getEntity().getId(), getId());
final String message = getPm().message(key);
if (key.equals(message)) {
final Entity extendzEntity = getEntity().getExtendzEntity();
if (extendzEntity != null && extendzEntity.getFieldById(getId()) != null) {
return extendzEntity.getFieldById(getId()).getTitle();
}
}
return message;
}
|
[
"public",
"String",
"getTitle",
"(",
")",
"{",
"final",
"String",
"key",
"=",
"String",
".",
"format",
"(",
"\"pm.field.%s.%s\"",
",",
"getEntity",
"(",
")",
".",
"getId",
"(",
")",
",",
"getId",
"(",
")",
")",
";",
"final",
"String",
"message",
"=",
"getPm",
"(",
")",
".",
"message",
"(",
"key",
")",
";",
"if",
"(",
"key",
".",
"equals",
"(",
"message",
")",
")",
"{",
"final",
"Entity",
"extendzEntity",
"=",
"getEntity",
"(",
")",
".",
"getExtendzEntity",
"(",
")",
";",
"if",
"(",
"extendzEntity",
"!=",
"null",
"&&",
"extendzEntity",
".",
"getFieldById",
"(",
"getId",
"(",
")",
")",
"!=",
"null",
")",
"{",
"return",
"extendzEntity",
".",
"getFieldById",
"(",
"getId",
"(",
")",
")",
".",
"getTitle",
"(",
")",
";",
"}",
"}",
"return",
"message",
";",
"}"
] |
Returns the internationalized field title
|
[
"Returns",
"the",
"internationalized",
"field",
"title"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java#L334-L344
|
150,873
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java
|
Field.getTooltip
|
public String getTooltip() {
final String key = "pm.field." + getEntity().getId() + "." + getId() + ".tooltip";
if (key == null) {
return null;
}
final String message = getPm().message(key);
if (key.equals(message)) {
return null;
}
return message;
}
|
java
|
public String getTooltip() {
final String key = "pm.field." + getEntity().getId() + "." + getId() + ".tooltip";
if (key == null) {
return null;
}
final String message = getPm().message(key);
if (key.equals(message)) {
return null;
}
return message;
}
|
[
"public",
"String",
"getTooltip",
"(",
")",
"{",
"final",
"String",
"key",
"=",
"\"pm.field.\"",
"+",
"getEntity",
"(",
")",
".",
"getId",
"(",
")",
"+",
"\".\"",
"+",
"getId",
"(",
")",
"+",
"\".tooltip\"",
";",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"String",
"message",
"=",
"getPm",
"(",
")",
".",
"message",
"(",
"key",
")",
";",
"if",
"(",
"key",
".",
"equals",
"(",
"message",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"message",
";",
"}"
] |
Returns the internationalized field tooltip
|
[
"Returns",
"the",
"internationalized",
"field",
"tooltip"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java#L349-L359
|
150,874
|
jpaoletti/java-presentation-manager
|
modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java
|
Field.getConverter
|
public Converter getConverter(String operation) {
//First we check "covnerters" list
Converter c = getConverters().getConverterForOperation(operation);
if (c == null) {
// if not found, we check configs
for (FieldOperationConfig config : getConfigs()) {
if (config.includes(operation)) {
c = getPm().findExternalConverter(config.getEconverter());
break;
}
}
}
if (c == null) {
// If not found, we check class level converters
final String _property = getProperty();
try {
final String[] _properties = _property.split("[.]");
Class<?> clazz = Class.forName(getEntity().getClazz());
for (int i = 0; i < _properties.length - 1; i++) {
clazz = FieldUtils.getField(clazz, _properties[i], true).getType();
}
final String className = FieldUtils.getField(clazz, _properties[_properties.length - 1], true).getType().getName();
c = getPm().getClassConverters().getConverter(operation, className);
} catch (Exception ex) {
getPm().info(String.format("Unable to introspect field '%s' on entity '%s'", _property, getEntity().getId()));
}
}
return c;
}
|
java
|
public Converter getConverter(String operation) {
//First we check "covnerters" list
Converter c = getConverters().getConverterForOperation(operation);
if (c == null) {
// if not found, we check configs
for (FieldOperationConfig config : getConfigs()) {
if (config.includes(operation)) {
c = getPm().findExternalConverter(config.getEconverter());
break;
}
}
}
if (c == null) {
// If not found, we check class level converters
final String _property = getProperty();
try {
final String[] _properties = _property.split("[.]");
Class<?> clazz = Class.forName(getEntity().getClazz());
for (int i = 0; i < _properties.length - 1; i++) {
clazz = FieldUtils.getField(clazz, _properties[i], true).getType();
}
final String className = FieldUtils.getField(clazz, _properties[_properties.length - 1], true).getType().getName();
c = getPm().getClassConverters().getConverter(operation, className);
} catch (Exception ex) {
getPm().info(String.format("Unable to introspect field '%s' on entity '%s'", _property, getEntity().getId()));
}
}
return c;
}
|
[
"public",
"Converter",
"getConverter",
"(",
"String",
"operation",
")",
"{",
"//First we check \"covnerters\" list",
"Converter",
"c",
"=",
"getConverters",
"(",
")",
".",
"getConverterForOperation",
"(",
"operation",
")",
";",
"if",
"(",
"c",
"==",
"null",
")",
"{",
"// if not found, we check configs",
"for",
"(",
"FieldOperationConfig",
"config",
":",
"getConfigs",
"(",
")",
")",
"{",
"if",
"(",
"config",
".",
"includes",
"(",
"operation",
")",
")",
"{",
"c",
"=",
"getPm",
"(",
")",
".",
"findExternalConverter",
"(",
"config",
".",
"getEconverter",
"(",
")",
")",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"c",
"==",
"null",
")",
"{",
"// If not found, we check class level converters",
"final",
"String",
"_property",
"=",
"getProperty",
"(",
")",
";",
"try",
"{",
"final",
"String",
"[",
"]",
"_properties",
"=",
"_property",
".",
"split",
"(",
"\"[.]\"",
")",
";",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"getEntity",
"(",
")",
".",
"getClazz",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_properties",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"clazz",
"=",
"FieldUtils",
".",
"getField",
"(",
"clazz",
",",
"_properties",
"[",
"i",
"]",
",",
"true",
")",
".",
"getType",
"(",
")",
";",
"}",
"final",
"String",
"className",
"=",
"FieldUtils",
".",
"getField",
"(",
"clazz",
",",
"_properties",
"[",
"_properties",
".",
"length",
"-",
"1",
"]",
",",
"true",
")",
".",
"getType",
"(",
")",
".",
"getName",
"(",
")",
";",
"c",
"=",
"getPm",
"(",
")",
".",
"getClassConverters",
"(",
")",
".",
"getConverter",
"(",
"operation",
",",
"className",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"getPm",
"(",
")",
".",
"info",
"(",
"String",
".",
"format",
"(",
"\"Unable to introspect field '%s' on entity '%s'\"",
",",
"_property",
",",
"getEntity",
"(",
")",
".",
"getId",
"(",
")",
")",
")",
";",
"}",
"}",
"return",
"c",
";",
"}"
] |
Find the right converter for this field on the given operation.
@param operation
@return a converter
|
[
"Find",
"the",
"right",
"converter",
"for",
"this",
"field",
"on",
"the",
"given",
"operation",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/core/Field.java#L376-L404
|
150,875
|
amlinv/amq-monitor
|
amq-monitor-web-impl/src/main/java/com/amlinv/activemq/stats/QueueStatisticsRegistry.java
|
QueueStatisticsRegistry.onUpdatedStats
|
public void onUpdatedStats(ActiveMQQueueJmxStats updatedStats) {
QueueStatisticsCollection queueStatisticsCollection;
synchronized ( this.queueStats ) {
queueStatisticsCollection = this.queueStats.get(updatedStats.getQueueName());
if ( queueStatisticsCollection == null ) {
queueStatisticsCollection = new QueueStatisticsCollection(updatedStats.getQueueName());
this.queueStats.put(updatedStats.getQueueName(), queueStatisticsCollection);
}
}
queueStatisticsCollection.onUpdatedStats(updatedStats);
}
|
java
|
public void onUpdatedStats(ActiveMQQueueJmxStats updatedStats) {
QueueStatisticsCollection queueStatisticsCollection;
synchronized ( this.queueStats ) {
queueStatisticsCollection = this.queueStats.get(updatedStats.getQueueName());
if ( queueStatisticsCollection == null ) {
queueStatisticsCollection = new QueueStatisticsCollection(updatedStats.getQueueName());
this.queueStats.put(updatedStats.getQueueName(), queueStatisticsCollection);
}
}
queueStatisticsCollection.onUpdatedStats(updatedStats);
}
|
[
"public",
"void",
"onUpdatedStats",
"(",
"ActiveMQQueueJmxStats",
"updatedStats",
")",
"{",
"QueueStatisticsCollection",
"queueStatisticsCollection",
";",
"synchronized",
"(",
"this",
".",
"queueStats",
")",
"{",
"queueStatisticsCollection",
"=",
"this",
".",
"queueStats",
".",
"get",
"(",
"updatedStats",
".",
"getQueueName",
"(",
")",
")",
";",
"if",
"(",
"queueStatisticsCollection",
"==",
"null",
")",
"{",
"queueStatisticsCollection",
"=",
"new",
"QueueStatisticsCollection",
"(",
"updatedStats",
".",
"getQueueName",
"(",
")",
")",
";",
"this",
".",
"queueStats",
".",
"put",
"(",
"updatedStats",
".",
"getQueueName",
"(",
")",
",",
"queueStatisticsCollection",
")",
";",
"}",
"}",
"queueStatisticsCollection",
".",
"onUpdatedStats",
"(",
"updatedStats",
")",
";",
"}"
] |
Update the statistics in the registry given one set of polled statistics. These statistics are assigned a
timestamp equal to "now".
@param updatedStats statistics with which to update the registry.
|
[
"Update",
"the",
"statistics",
"in",
"the",
"registry",
"given",
"one",
"set",
"of",
"polled",
"statistics",
".",
"These",
"statistics",
"are",
"assigned",
"a",
"timestamp",
"equal",
"to",
"now",
"."
] |
0ae0156f56d7d3edf98bca9c30b153b770fe5bfa
|
https://github.com/amlinv/amq-monitor/blob/0ae0156f56d7d3edf98bca9c30b153b770fe5bfa/amq-monitor-web-impl/src/main/java/com/amlinv/activemq/stats/QueueStatisticsRegistry.java#L52-L65
|
150,876
|
amlinv/amq-monitor
|
amq-monitor-web-impl/src/main/java/com/amlinv/activemq/stats/QueueStatisticsRegistry.java
|
QueueStatisticsRegistry.getQueueStats
|
public Map<String, ActiveMQQueueStats> getQueueStats() {
Map<String, ActiveMQQueueStats> result;
result = new TreeMap<>();
synchronized ( this.queueStats ) {
for (QueueStatisticsCollection queueStatisticsCollection : this.queueStats.values()) {
result.put(queueStatisticsCollection.getQueueName(), queueStatisticsCollection.getQueueTotalStats());
}
}
return result;
}
|
java
|
public Map<String, ActiveMQQueueStats> getQueueStats() {
Map<String, ActiveMQQueueStats> result;
result = new TreeMap<>();
synchronized ( this.queueStats ) {
for (QueueStatisticsCollection queueStatisticsCollection : this.queueStats.values()) {
result.put(queueStatisticsCollection.getQueueName(), queueStatisticsCollection.getQueueTotalStats());
}
}
return result;
}
|
[
"public",
"Map",
"<",
"String",
",",
"ActiveMQQueueStats",
">",
"getQueueStats",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"ActiveMQQueueStats",
">",
"result",
";",
"result",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"synchronized",
"(",
"this",
".",
"queueStats",
")",
"{",
"for",
"(",
"QueueStatisticsCollection",
"queueStatisticsCollection",
":",
"this",
".",
"queueStats",
".",
"values",
"(",
")",
")",
"{",
"result",
".",
"put",
"(",
"queueStatisticsCollection",
".",
"getQueueName",
"(",
")",
",",
"queueStatisticsCollection",
".",
"getQueueTotalStats",
"(",
")",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Retrieve statistics for all of the queues.
@return map of aggregated statistics for each queue in the registry.
|
[
"Retrieve",
"statistics",
"for",
"all",
"of",
"the",
"queues",
"."
] |
0ae0156f56d7d3edf98bca9c30b153b770fe5bfa
|
https://github.com/amlinv/amq-monitor/blob/0ae0156f56d7d3edf98bca9c30b153b770fe5bfa/amq-monitor-web-impl/src/main/java/com/amlinv/activemq/stats/QueueStatisticsRegistry.java#L72-L84
|
150,877
|
socialsensor/geo-util
|
src/main/java/eu/socialsensor/geo/Countrycoder.java
|
Countrycoder.getMentionedGnObjects
|
public List<GeoObject> getMentionedGnObjects(List<String> tokenList){
//logger.info("tokenList: " + tokenList);
Set<Integer> gnIds = new HashSet<Integer>();
for (int i = 0; i < tokenList.size(); i++){
Set<Integer> ids = gnObjectMapNameLookup.get(tokenList.get(i));
if (ids != null){
gnIds.addAll(ids);
}
//logger.info("t: " + tokenList.get(i) + " -> " + ids);
}
// use also pairs of consecutive tokens
if (tokenList.size() > 1) {
for (int i = 0; i < tokenList.size() - 1; i++){
Set<Integer> ids = gnObjectMapNameLookup.get(tokenList.get(i) + " " + tokenList.get(i+1));
if (ids != null){
gnIds.addAll(ids);
}
//logger.info("t: " + tokenList.get(i) + " " + tokenList.get(i+1) + " -> " + ids);
}
}
List<GeoObject> locations = new ArrayList<GeoObject>(gnIds.size());
for (Integer id : gnIds) {
locations.add(gnObjectMap.get(id));
}
return locations;
}
|
java
|
public List<GeoObject> getMentionedGnObjects(List<String> tokenList){
//logger.info("tokenList: " + tokenList);
Set<Integer> gnIds = new HashSet<Integer>();
for (int i = 0; i < tokenList.size(); i++){
Set<Integer> ids = gnObjectMapNameLookup.get(tokenList.get(i));
if (ids != null){
gnIds.addAll(ids);
}
//logger.info("t: " + tokenList.get(i) + " -> " + ids);
}
// use also pairs of consecutive tokens
if (tokenList.size() > 1) {
for (int i = 0; i < tokenList.size() - 1; i++){
Set<Integer> ids = gnObjectMapNameLookup.get(tokenList.get(i) + " " + tokenList.get(i+1));
if (ids != null){
gnIds.addAll(ids);
}
//logger.info("t: " + tokenList.get(i) + " " + tokenList.get(i+1) + " -> " + ids);
}
}
List<GeoObject> locations = new ArrayList<GeoObject>(gnIds.size());
for (Integer id : gnIds) {
locations.add(gnObjectMap.get(id));
}
return locations;
}
|
[
"public",
"List",
"<",
"GeoObject",
">",
"getMentionedGnObjects",
"(",
"List",
"<",
"String",
">",
"tokenList",
")",
"{",
"//logger.info(\"tokenList: \" + tokenList);",
"Set",
"<",
"Integer",
">",
"gnIds",
"=",
"new",
"HashSet",
"<",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tokenList",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Set",
"<",
"Integer",
">",
"ids",
"=",
"gnObjectMapNameLookup",
".",
"get",
"(",
"tokenList",
".",
"get",
"(",
"i",
")",
")",
";",
"if",
"(",
"ids",
"!=",
"null",
")",
"{",
"gnIds",
".",
"addAll",
"(",
"ids",
")",
";",
"}",
"//logger.info(\"t: \" + tokenList.get(i) + \" -> \" + ids);",
"}",
"// use also pairs of consecutive tokens",
"if",
"(",
"tokenList",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tokenList",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
"++",
")",
"{",
"Set",
"<",
"Integer",
">",
"ids",
"=",
"gnObjectMapNameLookup",
".",
"get",
"(",
"tokenList",
".",
"get",
"(",
"i",
")",
"+",
"\" \"",
"+",
"tokenList",
".",
"get",
"(",
"i",
"+",
"1",
")",
")",
";",
"if",
"(",
"ids",
"!=",
"null",
")",
"{",
"gnIds",
".",
"addAll",
"(",
"ids",
")",
";",
"}",
"//logger.info(\"t: \" + tokenList.get(i) + \" \" + tokenList.get(i+1) + \" -> \" + ids);",
"}",
"}",
"List",
"<",
"GeoObject",
">",
"locations",
"=",
"new",
"ArrayList",
"<",
"GeoObject",
">",
"(",
"gnIds",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Integer",
"id",
":",
"gnIds",
")",
"{",
"locations",
".",
"add",
"(",
"gnObjectMap",
".",
"get",
"(",
"id",
")",
")",
";",
"}",
"return",
"locations",
";",
"}"
] |
Given an arbitrary text string, extract the referred names of locations
@param tokenList List of tokens.
@return List of mentioned LightweightGeoObjects in the list of tokens.
|
[
"Given",
"an",
"arbitrary",
"text",
"string",
"extract",
"the",
"referred",
"names",
"of",
"locations"
] |
ffe729896187dc589f4a362d6e6819fc155ced1d
|
https://github.com/socialsensor/geo-util/blob/ffe729896187dc589f4a362d6e6819fc155ced1d/src/main/java/eu/socialsensor/geo/Countrycoder.java#L220-L248
|
150,878
|
socialsensor/geo-util
|
src/main/java/eu/socialsensor/geo/Countrycoder.java
|
Countrycoder.getTokens
|
protected List<String> getTokens(String text){
String[] tokens = text.toLowerCase().split("[\\s\\p{Punct}]");
List<String> tokenList = new ArrayList<String>(tokens.length);
for (int i = 0; i < tokens.length; i++){
if (tokens[i].trim().length() < 1){
continue;
}
tokenList.add(tokens[i].trim());
}
return tokenList;
}
|
java
|
protected List<String> getTokens(String text){
String[] tokens = text.toLowerCase().split("[\\s\\p{Punct}]");
List<String> tokenList = new ArrayList<String>(tokens.length);
for (int i = 0; i < tokens.length; i++){
if (tokens[i].trim().length() < 1){
continue;
}
tokenList.add(tokens[i].trim());
}
return tokenList;
}
|
[
"protected",
"List",
"<",
"String",
">",
"getTokens",
"(",
"String",
"text",
")",
"{",
"String",
"[",
"]",
"tokens",
"=",
"text",
".",
"toLowerCase",
"(",
")",
".",
"split",
"(",
"\"[\\\\s\\\\p{Punct}]\"",
")",
";",
"List",
"<",
"String",
">",
"tokenList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"tokens",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tokens",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"tokens",
"[",
"i",
"]",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"<",
"1",
")",
"{",
"continue",
";",
"}",
"tokenList",
".",
"add",
"(",
"tokens",
"[",
"i",
"]",
".",
"trim",
"(",
")",
")",
";",
"}",
"return",
"tokenList",
";",
"}"
] |
Utility method for splitting a piece of text to tokens
@param text
@return List of tokens
|
[
"Utility",
"method",
"for",
"splitting",
"a",
"piece",
"of",
"text",
"to",
"tokens"
] |
ffe729896187dc589f4a362d6e6819fc155ced1d
|
https://github.com/socialsensor/geo-util/blob/ffe729896187dc589f4a362d6e6819fc155ced1d/src/main/java/eu/socialsensor/geo/Countrycoder.java#L255-L265
|
150,879
|
jpaoletti/java-presentation-manager
|
modules/jpm-struts1/src/main/java/jpaoletti/jpm/struts/actions/ActionSupport.java
|
ActionSupport.success
|
protected void success(PMStrutsContext ctx, String url, boolean redirect) throws PMForwardException {
if (ctx.getOperation() != null && ctx.getOperation().getFollows() != null) {
final String plainUrl = PMTags.plainUrl(
ctx.getPmsession(),
"/" + ctx.getOperation().getFollows() + ".do?pmid=" + ctx.getEntity().getId()).substring(getContextPath().length());
throw new PMForwardException(new ActionRedirect(plainUrl));
} else {
final String plainUrl = PMTags.plainUrl(ctx.getPmsession(), url).substring(getContextPath().length());
if (redirect) {
throw new PMForwardException(new ActionRedirect(plainUrl));
} else {
throw new PMForwardException(new ActionForward(plainUrl));
}
}
}
|
java
|
protected void success(PMStrutsContext ctx, String url, boolean redirect) throws PMForwardException {
if (ctx.getOperation() != null && ctx.getOperation().getFollows() != null) {
final String plainUrl = PMTags.plainUrl(
ctx.getPmsession(),
"/" + ctx.getOperation().getFollows() + ".do?pmid=" + ctx.getEntity().getId()).substring(getContextPath().length());
throw new PMForwardException(new ActionRedirect(plainUrl));
} else {
final String plainUrl = PMTags.plainUrl(ctx.getPmsession(), url).substring(getContextPath().length());
if (redirect) {
throw new PMForwardException(new ActionRedirect(plainUrl));
} else {
throw new PMForwardException(new ActionForward(plainUrl));
}
}
}
|
[
"protected",
"void",
"success",
"(",
"PMStrutsContext",
"ctx",
",",
"String",
"url",
",",
"boolean",
"redirect",
")",
"throws",
"PMForwardException",
"{",
"if",
"(",
"ctx",
".",
"getOperation",
"(",
")",
"!=",
"null",
"&&",
"ctx",
".",
"getOperation",
"(",
")",
".",
"getFollows",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"String",
"plainUrl",
"=",
"PMTags",
".",
"plainUrl",
"(",
"ctx",
".",
"getPmsession",
"(",
")",
",",
"\"/\"",
"+",
"ctx",
".",
"getOperation",
"(",
")",
".",
"getFollows",
"(",
")",
"+",
"\".do?pmid=\"",
"+",
"ctx",
".",
"getEntity",
"(",
")",
".",
"getId",
"(",
")",
")",
".",
"substring",
"(",
"getContextPath",
"(",
")",
".",
"length",
"(",
")",
")",
";",
"throw",
"new",
"PMForwardException",
"(",
"new",
"ActionRedirect",
"(",
"plainUrl",
")",
")",
";",
"}",
"else",
"{",
"final",
"String",
"plainUrl",
"=",
"PMTags",
".",
"plainUrl",
"(",
"ctx",
".",
"getPmsession",
"(",
")",
",",
"url",
")",
".",
"substring",
"(",
"getContextPath",
"(",
")",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"redirect",
")",
"{",
"throw",
"new",
"PMForwardException",
"(",
"new",
"ActionRedirect",
"(",
"plainUrl",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"PMForwardException",
"(",
"new",
"ActionForward",
"(",
"plainUrl",
")",
")",
";",
"}",
"}",
"}"
] |
Consider the operation successful and redirect or forward to the given
url
@param ctx Context
@param url Next url
@param redirect If true, redirects, else, forwards
@throws PMForwardException always
|
[
"Consider",
"the",
"operation",
"successful",
"and",
"redirect",
"or",
"forward",
"to",
"the",
"given",
"url"
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-struts1/src/main/java/jpaoletti/jpm/struts/actions/ActionSupport.java#L112-L126
|
150,880
|
jpaoletti/java-presentation-manager
|
modules/jpm-struts1/src/main/java/jpaoletti/jpm/struts/actions/ActionSupport.java
|
ActionSupport.jSONSuccess
|
protected void jSONSuccess(PMStrutsContext ctx, Object object) throws PMForwardException {
final String toJson = new Gson().toJson(object);
ctx.put(PM_VOID_TEXT, toJson);
success(ctx, "converters/void.jsp", false);
}
|
java
|
protected void jSONSuccess(PMStrutsContext ctx, Object object) throws PMForwardException {
final String toJson = new Gson().toJson(object);
ctx.put(PM_VOID_TEXT, toJson);
success(ctx, "converters/void.jsp", false);
}
|
[
"protected",
"void",
"jSONSuccess",
"(",
"PMStrutsContext",
"ctx",
",",
"Object",
"object",
")",
"throws",
"PMForwardException",
"{",
"final",
"String",
"toJson",
"=",
"new",
"Gson",
"(",
")",
".",
"toJson",
"(",
"object",
")",
";",
"ctx",
".",
"put",
"(",
"PM_VOID_TEXT",
",",
"toJson",
")",
";",
"success",
"(",
"ctx",
",",
"\"converters/void.jsp\"",
",",
"false",
")",
";",
"}"
] |
Just a helper to return a serialized object with jSON.
Specially useful dealing with encoding problems
|
[
"Just",
"a",
"helper",
"to",
"return",
"a",
"serialized",
"object",
"with",
"jSON",
"."
] |
d5aab55638383695db244744b4bfe27c5200e04f
|
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-struts1/src/main/java/jpaoletti/jpm/struts/actions/ActionSupport.java#L144-L148
|
150,881
|
isisaddons-legacy/isis-module-publishmq
|
dom/servicespi/src/main/java/org/isisaddons/module/publishmq/dom/servicespi/PublisherServiceUsingActiveMq.java
|
PublisherServiceUsingActiveMq.init
|
@PostConstruct
public void init(Map<String,String> properties) {
vmTransportUrl = properties.getOrDefault(KEY_VM_TRANSPORT_URL, KEY_VM_TRANSPORT_URL_DEFAULT);
memberInteractionsQueueName = properties.getOrDefault(KEY_MEMBER_INTERACTIONS_QUEUE,
KEY_MEMBER_INTERACTIONS_QUEUE_DEFAULT);
jmsConnectionFactory = new ActiveMQConnectionFactory(vmTransportUrl);
try {
jmsConnection = jmsConnectionFactory.createConnection();
} catch (JMSException e) {
LOG.error("Unable to create connection", e);
throw new RuntimeException(e);
}
try {
jmsConnection.start();
} catch (JMSException e) {
LOG.error("Unable to start connection", e);
closeSafely(jmsConnection);
jmsConnection = null;
}
}
|
java
|
@PostConstruct
public void init(Map<String,String> properties) {
vmTransportUrl = properties.getOrDefault(KEY_VM_TRANSPORT_URL, KEY_VM_TRANSPORT_URL_DEFAULT);
memberInteractionsQueueName = properties.getOrDefault(KEY_MEMBER_INTERACTIONS_QUEUE,
KEY_MEMBER_INTERACTIONS_QUEUE_DEFAULT);
jmsConnectionFactory = new ActiveMQConnectionFactory(vmTransportUrl);
try {
jmsConnection = jmsConnectionFactory.createConnection();
} catch (JMSException e) {
LOG.error("Unable to create connection", e);
throw new RuntimeException(e);
}
try {
jmsConnection.start();
} catch (JMSException e) {
LOG.error("Unable to start connection", e);
closeSafely(jmsConnection);
jmsConnection = null;
}
}
|
[
"@",
"PostConstruct",
"public",
"void",
"init",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"vmTransportUrl",
"=",
"properties",
".",
"getOrDefault",
"(",
"KEY_VM_TRANSPORT_URL",
",",
"KEY_VM_TRANSPORT_URL_DEFAULT",
")",
";",
"memberInteractionsQueueName",
"=",
"properties",
".",
"getOrDefault",
"(",
"KEY_MEMBER_INTERACTIONS_QUEUE",
",",
"KEY_MEMBER_INTERACTIONS_QUEUE_DEFAULT",
")",
";",
"jmsConnectionFactory",
"=",
"new",
"ActiveMQConnectionFactory",
"(",
"vmTransportUrl",
")",
";",
"try",
"{",
"jmsConnection",
"=",
"jmsConnectionFactory",
".",
"createConnection",
"(",
")",
";",
"}",
"catch",
"(",
"JMSException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Unable to create connection\"",
",",
"e",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"try",
"{",
"jmsConnection",
".",
"start",
"(",
")",
";",
"}",
"catch",
"(",
"JMSException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Unable to start connection\"",
",",
"e",
")",
";",
"closeSafely",
"(",
"jmsConnection",
")",
";",
"jmsConnection",
"=",
"null",
";",
"}",
"}"
] |
region > init, shutdown
|
[
"region",
">",
"init",
"shutdown"
] |
b1a424f95b26a2a0369aac706c2e30074b7f6e43
|
https://github.com/isisaddons-legacy/isis-module-publishmq/blob/b1a424f95b26a2a0369aac706c2e30074b7f6e43/dom/servicespi/src/main/java/org/isisaddons/module/publishmq/dom/servicespi/PublisherServiceUsingActiveMq.java#L81-L104
|
150,882
|
icode/ameba-utils
|
src/main/java/ameba/util/MimeType.java
|
MimeType.getExtension
|
private static String getExtension(String fileName) {
// play it safe and get rid of any fragment id
// that might be there
int length = fileName.length();
int newEnd = fileName.lastIndexOf('#');
if (newEnd == -1) {
newEnd = length;
}
int i = fileName.lastIndexOf('.', newEnd);
if (i != -1) {
return fileName.substring(i + 1, newEnd);
} else {
// no extension, no content type
return null;
}
}
|
java
|
private static String getExtension(String fileName) {
// play it safe and get rid of any fragment id
// that might be there
int length = fileName.length();
int newEnd = fileName.lastIndexOf('#');
if (newEnd == -1) {
newEnd = length;
}
int i = fileName.lastIndexOf('.', newEnd);
if (i != -1) {
return fileName.substring(i + 1, newEnd);
} else {
// no extension, no content type
return null;
}
}
|
[
"private",
"static",
"String",
"getExtension",
"(",
"String",
"fileName",
")",
"{",
"// play it safe and get rid of any fragment id",
"// that might be there",
"int",
"length",
"=",
"fileName",
".",
"length",
"(",
")",
";",
"int",
"newEnd",
"=",
"fileName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"newEnd",
"==",
"-",
"1",
")",
"{",
"newEnd",
"=",
"length",
";",
"}",
"int",
"i",
"=",
"fileName",
".",
"lastIndexOf",
"(",
"'",
"'",
",",
"newEnd",
")",
";",
"if",
"(",
"i",
"!=",
"-",
"1",
")",
"{",
"return",
"fileName",
".",
"substring",
"(",
"i",
"+",
"1",
",",
"newEnd",
")",
";",
"}",
"else",
"{",
"// no extension, no content type",
"return",
"null",
";",
"}",
"}"
] |
Get extension of file, without fragment id
|
[
"Get",
"extension",
"of",
"file",
"without",
"fragment",
"id"
] |
1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35
|
https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/MimeType.java#L104-L120
|
150,883
|
GerdHolz/TOVAL
|
src/de/invation/code/toval/types/DynamicMatrix.java
|
DynamicMatrix.getValuesAsString
|
public String getValuesAsString() {
StringBuilder builder = new StringBuilder();
for(E row: rowKeys.keySet())
for(E col: colKeys.keySet()) {
builder.append(getValueAsString(row, col, true));
builder.append('\n');
}
return builder.toString();
}
|
java
|
public String getValuesAsString() {
StringBuilder builder = new StringBuilder();
for(E row: rowKeys.keySet())
for(E col: colKeys.keySet()) {
builder.append(getValueAsString(row, col, true));
builder.append('\n');
}
return builder.toString();
}
|
[
"public",
"String",
"getValuesAsString",
"(",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"E",
"row",
":",
"rowKeys",
".",
"keySet",
"(",
")",
")",
"for",
"(",
"E",
"col",
":",
"colKeys",
".",
"keySet",
"(",
")",
")",
"{",
"builder",
".",
"append",
"(",
"getValueAsString",
"(",
"row",
",",
"col",
",",
"true",
")",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns a String representation of all matrix entries.
@return String representation of all matrix entries
@see #getValueAsString(Object, Object, boolean)
|
[
"Returns",
"a",
"String",
"representation",
"of",
"all",
"matrix",
"entries",
"."
] |
036922cdfd710fa53b18e5dbe1e07f226f731fde
|
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/DynamicMatrix.java#L96-L104
|
150,884
|
lkwg82/enforcer-rules
|
src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java
|
ArtifactMatcher.match
|
public boolean match( Artifact artifact )
throws InvalidVersionSpecificationException
{
for ( Pattern pattern : patterns )
{
if ( pattern.match( artifact ) )
{
for ( Pattern ignorePattern : ignorePatterns )
{
if ( ignorePattern.match( artifact ) )
{
return false;
}
}
return true;
}
}
return false;
}
|
java
|
public boolean match( Artifact artifact )
throws InvalidVersionSpecificationException
{
for ( Pattern pattern : patterns )
{
if ( pattern.match( artifact ) )
{
for ( Pattern ignorePattern : ignorePatterns )
{
if ( ignorePattern.match( artifact ) )
{
return false;
}
}
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"match",
"(",
"Artifact",
"artifact",
")",
"throws",
"InvalidVersionSpecificationException",
"{",
"for",
"(",
"Pattern",
"pattern",
":",
"patterns",
")",
"{",
"if",
"(",
"pattern",
".",
"match",
"(",
"artifact",
")",
")",
"{",
"for",
"(",
"Pattern",
"ignorePattern",
":",
"ignorePatterns",
")",
"{",
"if",
"(",
"ignorePattern",
".",
"match",
"(",
"artifact",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Check if artifact matches patterns.
@throws InvalidVersionSpecificationException
|
[
"Check",
"if",
"artifact",
"matches",
"patterns",
"."
] |
fa2d309af7907b17fc8eaf386f8056d77b654749
|
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java#L195-L213
|
150,885
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/io/provider/IOProviderFromURL.java
|
IOProviderFromURL.registerProtocol
|
public void registerProtocol(String protocol, IOProviderFrom<URL> provider) {
protocols.put(protocol.toLowerCase(), provider);
}
|
java
|
public void registerProtocol(String protocol, IOProviderFrom<URL> provider) {
protocols.put(protocol.toLowerCase(), provider);
}
|
[
"public",
"void",
"registerProtocol",
"(",
"String",
"protocol",
",",
"IOProviderFrom",
"<",
"URL",
">",
"provider",
")",
"{",
"protocols",
".",
"put",
"(",
"protocol",
".",
"toLowerCase",
"(",
")",
",",
"provider",
")",
";",
"}"
] |
Register a new IOProvider from URL for a specific protocol.
|
[
"Register",
"a",
"new",
"IOProvider",
"from",
"URL",
"for",
"a",
"specific",
"protocol",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/io/provider/IOProviderFromURL.java#L24-L26
|
150,886
|
netarchivesuite/heritrix3-wrapper
|
src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java
|
Heritrix3Wrapper.exitJavaProcess
|
public EngineResult exitJavaProcess(List<String> ignoreJobs) {
HttpPost postRequest = new HttpPost(baseUrl);
List<NameValuePair> nvp = new LinkedList<NameValuePair>();
// 3.2.x
//nvp.add(new BasicNameValuePair("action", "Exit Java Process"));
// 3.3.x
nvp.add(new BasicNameValuePair("action", "exit java process"));
nvp.add(new BasicNameValuePair("im_sure", "on"));
// ignore__${jobname}=on
if (ignoreJobs != null && ignoreJobs.size() > 0) {
for (int i=0; i<ignoreJobs.size(); ++i) {
nvp.add(new BasicNameValuePair("ignore__" + ignoreJobs.get(i), "on"));
}
}
StringEntity postEntity = null;
try {
postEntity = new UrlEncodedFormEntity(nvp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return engineResult(postRequest);
}
|
java
|
public EngineResult exitJavaProcess(List<String> ignoreJobs) {
HttpPost postRequest = new HttpPost(baseUrl);
List<NameValuePair> nvp = new LinkedList<NameValuePair>();
// 3.2.x
//nvp.add(new BasicNameValuePair("action", "Exit Java Process"));
// 3.3.x
nvp.add(new BasicNameValuePair("action", "exit java process"));
nvp.add(new BasicNameValuePair("im_sure", "on"));
// ignore__${jobname}=on
if (ignoreJobs != null && ignoreJobs.size() > 0) {
for (int i=0; i<ignoreJobs.size(); ++i) {
nvp.add(new BasicNameValuePair("ignore__" + ignoreJobs.get(i), "on"));
}
}
StringEntity postEntity = null;
try {
postEntity = new UrlEncodedFormEntity(nvp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return engineResult(postRequest);
}
|
[
"public",
"EngineResult",
"exitJavaProcess",
"(",
"List",
"<",
"String",
">",
"ignoreJobs",
")",
"{",
"HttpPost",
"postRequest",
"=",
"new",
"HttpPost",
"(",
"baseUrl",
")",
";",
"List",
"<",
"NameValuePair",
">",
"nvp",
"=",
"new",
"LinkedList",
"<",
"NameValuePair",
">",
"(",
")",
";",
"// 3.2.x",
"//nvp.add(new BasicNameValuePair(\"action\", \"Exit Java Process\"));",
"// 3.3.x",
"nvp",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"\"action\"",
",",
"\"exit java process\"",
")",
")",
";",
"nvp",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"\"im_sure\"",
",",
"\"on\"",
")",
")",
";",
"// ignore__${jobname}=on",
"if",
"(",
"ignoreJobs",
"!=",
"null",
"&&",
"ignoreJobs",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ignoreJobs",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{",
"nvp",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"\"ignore__\"",
"+",
"ignoreJobs",
".",
"get",
"(",
"i",
")",
",",
"\"on\"",
")",
")",
";",
"}",
"}",
"StringEntity",
"postEntity",
"=",
"null",
";",
"try",
"{",
"postEntity",
"=",
"new",
"UrlEncodedFormEntity",
"(",
"nvp",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"postEntity",
".",
"setContentType",
"(",
"\"application/x-www-form-urlencoded\"",
")",
";",
"postRequest",
".",
"addHeader",
"(",
"\"Accept\"",
",",
"\"application/xml\"",
")",
";",
"postRequest",
".",
"setEntity",
"(",
"postEntity",
")",
";",
"return",
"engineResult",
"(",
"postRequest",
")",
";",
"}"
] |
Send JVM shutdown action to Heritrix 3.
If there are any running jobs they must be included in the ignored jobs list passed as argument.
Otherwise the shutdown action is ignored.
@return <code>EngineResult</code>, but only in case the shutdown was not performed
|
[
"Send",
"JVM",
"shutdown",
"action",
"to",
"Heritrix",
"3",
".",
"If",
"there",
"are",
"any",
"running",
"jobs",
"they",
"must",
"be",
"included",
"in",
"the",
"ignored",
"jobs",
"list",
"passed",
"as",
"argument",
".",
"Otherwise",
"the",
"shutdown",
"action",
"is",
"ignored",
"."
] |
e53ec5736cbac0bdd3925b5331737dc905871629
|
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java#L175-L199
|
150,887
|
netarchivesuite/heritrix3-wrapper
|
src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java
|
Heritrix3Wrapper.createNewJob
|
public EngineResult createNewJob(String jobname) {
HttpPost postRequest = new HttpPost(baseUrl);
List<NameValuePair> nvp = new LinkedList<NameValuePair>();
nvp.add(new BasicNameValuePair("action", "create"));
nvp.add(new BasicNameValuePair("createpath", jobname));
StringEntity postEntity = null;
try {
postEntity = new UrlEncodedFormEntity(nvp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return engineResult(postRequest);
}
|
java
|
public EngineResult createNewJob(String jobname) {
HttpPost postRequest = new HttpPost(baseUrl);
List<NameValuePair> nvp = new LinkedList<NameValuePair>();
nvp.add(new BasicNameValuePair("action", "create"));
nvp.add(new BasicNameValuePair("createpath", jobname));
StringEntity postEntity = null;
try {
postEntity = new UrlEncodedFormEntity(nvp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return engineResult(postRequest);
}
|
[
"public",
"EngineResult",
"createNewJob",
"(",
"String",
"jobname",
")",
"{",
"HttpPost",
"postRequest",
"=",
"new",
"HttpPost",
"(",
"baseUrl",
")",
";",
"List",
"<",
"NameValuePair",
">",
"nvp",
"=",
"new",
"LinkedList",
"<",
"NameValuePair",
">",
"(",
")",
";",
"nvp",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"\"action\"",
",",
"\"create\"",
")",
")",
";",
"nvp",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"\"createpath\"",
",",
"jobname",
")",
")",
";",
"StringEntity",
"postEntity",
"=",
"null",
";",
"try",
"{",
"postEntity",
"=",
"new",
"UrlEncodedFormEntity",
"(",
"nvp",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"postEntity",
".",
"setContentType",
"(",
"\"application/x-www-form-urlencoded\"",
")",
";",
"postRequest",
".",
"addHeader",
"(",
"\"Accept\"",
",",
"\"application/xml\"",
")",
";",
"postRequest",
".",
"setEntity",
"(",
"postEntity",
")",
";",
"return",
"engineResult",
"(",
"postRequest",
")",
";",
"}"
] |
Creates a new job and initialises it with the default cxml file which must be modified before launch.
@param jobname name of the new job
@return engine state and a list of registered jobs
|
[
"Creates",
"a",
"new",
"job",
"and",
"initialises",
"it",
"with",
"the",
"default",
"cxml",
"file",
"which",
"must",
"be",
"modified",
"before",
"launch",
"."
] |
e53ec5736cbac0bdd3925b5331737dc905871629
|
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java#L275-L290
|
150,888
|
netarchivesuite/heritrix3-wrapper
|
src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java
|
Heritrix3Wrapper.engineResult
|
public EngineResult engineResult(HttpRequestBase request) {
EngineResult engineResult = new EngineResult();
try {
HttpResponse response = httpClient.execute(request);
if (response != null) {
engineResult.responseCode = response.getStatusLine().getStatusCode();
HttpEntity responseEntity = response.getEntity();
long contentLength = responseEntity.getContentLength();
if (contentLength < 0) {
contentLength = 0;
}
ByteArrayOutputStream bOut = new ByteArrayOutputStream((int) contentLength);
InputStream in = responseEntity.getContent();
int read;
byte[] tmpBuf = new byte[8192];
while ((read = in.read(tmpBuf)) != -1) {
bOut.write(tmpBuf, 0, read);
}
in.close();
bOut.close();
engineResult.response = bOut.toByteArray();
switch (engineResult.responseCode) {
case 200:
engineResult.parse(xmlValidator);
in = new ByteArrayInputStream(engineResult.response);
engineResult.engine = Engine.unmarshall(in);
in.close();
engineResult.status = ResultStatus.OK;
break;
case 404:
engineResult.status = ResultStatus.NOT_FOUND;
break;
case 500:
engineResult.status = ResultStatus.INTERNAL_ERROR;
break;
default:
engineResult.status = ResultStatus.NO_RESPONSE;
break;
}
} else {
engineResult.status = ResultStatus.NO_RESPONSE;
}
} catch (NoHttpResponseException e) {
engineResult.status = ResultStatus.OFFLINE;
engineResult.t = e;
} catch (ClientProtocolException e) {
engineResult.status = ResultStatus.RESPONSE_EXCEPTION;
engineResult.t = e;
} catch (IOException e) {
engineResult.status = ResultStatus.RESPONSE_EXCEPTION;
engineResult.t = e;
} catch (JAXBException e) {
engineResult.status = ResultStatus.JAXB_EXCEPTION;
engineResult.t = e;
} catch (XMLStreamException e) {
engineResult.status = ResultStatus.XML_EXCEPTION;
engineResult.t = e;
}
return engineResult;
}
|
java
|
public EngineResult engineResult(HttpRequestBase request) {
EngineResult engineResult = new EngineResult();
try {
HttpResponse response = httpClient.execute(request);
if (response != null) {
engineResult.responseCode = response.getStatusLine().getStatusCode();
HttpEntity responseEntity = response.getEntity();
long contentLength = responseEntity.getContentLength();
if (contentLength < 0) {
contentLength = 0;
}
ByteArrayOutputStream bOut = new ByteArrayOutputStream((int) contentLength);
InputStream in = responseEntity.getContent();
int read;
byte[] tmpBuf = new byte[8192];
while ((read = in.read(tmpBuf)) != -1) {
bOut.write(tmpBuf, 0, read);
}
in.close();
bOut.close();
engineResult.response = bOut.toByteArray();
switch (engineResult.responseCode) {
case 200:
engineResult.parse(xmlValidator);
in = new ByteArrayInputStream(engineResult.response);
engineResult.engine = Engine.unmarshall(in);
in.close();
engineResult.status = ResultStatus.OK;
break;
case 404:
engineResult.status = ResultStatus.NOT_FOUND;
break;
case 500:
engineResult.status = ResultStatus.INTERNAL_ERROR;
break;
default:
engineResult.status = ResultStatus.NO_RESPONSE;
break;
}
} else {
engineResult.status = ResultStatus.NO_RESPONSE;
}
} catch (NoHttpResponseException e) {
engineResult.status = ResultStatus.OFFLINE;
engineResult.t = e;
} catch (ClientProtocolException e) {
engineResult.status = ResultStatus.RESPONSE_EXCEPTION;
engineResult.t = e;
} catch (IOException e) {
engineResult.status = ResultStatus.RESPONSE_EXCEPTION;
engineResult.t = e;
} catch (JAXBException e) {
engineResult.status = ResultStatus.JAXB_EXCEPTION;
engineResult.t = e;
} catch (XMLStreamException e) {
engineResult.status = ResultStatus.XML_EXCEPTION;
engineResult.t = e;
}
return engineResult;
}
|
[
"public",
"EngineResult",
"engineResult",
"(",
"HttpRequestBase",
"request",
")",
"{",
"EngineResult",
"engineResult",
"=",
"new",
"EngineResult",
"(",
")",
";",
"try",
"{",
"HttpResponse",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"request",
")",
";",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"engineResult",
".",
"responseCode",
"=",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
";",
"HttpEntity",
"responseEntity",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"long",
"contentLength",
"=",
"responseEntity",
".",
"getContentLength",
"(",
")",
";",
"if",
"(",
"contentLength",
"<",
"0",
")",
"{",
"contentLength",
"=",
"0",
";",
"}",
"ByteArrayOutputStream",
"bOut",
"=",
"new",
"ByteArrayOutputStream",
"(",
"(",
"int",
")",
"contentLength",
")",
";",
"InputStream",
"in",
"=",
"responseEntity",
".",
"getContent",
"(",
")",
";",
"int",
"read",
";",
"byte",
"[",
"]",
"tmpBuf",
"=",
"new",
"byte",
"[",
"8192",
"]",
";",
"while",
"(",
"(",
"read",
"=",
"in",
".",
"read",
"(",
"tmpBuf",
")",
")",
"!=",
"-",
"1",
")",
"{",
"bOut",
".",
"write",
"(",
"tmpBuf",
",",
"0",
",",
"read",
")",
";",
"}",
"in",
".",
"close",
"(",
")",
";",
"bOut",
".",
"close",
"(",
")",
";",
"engineResult",
".",
"response",
"=",
"bOut",
".",
"toByteArray",
"(",
")",
";",
"switch",
"(",
"engineResult",
".",
"responseCode",
")",
"{",
"case",
"200",
":",
"engineResult",
".",
"parse",
"(",
"xmlValidator",
")",
";",
"in",
"=",
"new",
"ByteArrayInputStream",
"(",
"engineResult",
".",
"response",
")",
";",
"engineResult",
".",
"engine",
"=",
"Engine",
".",
"unmarshall",
"(",
"in",
")",
";",
"in",
".",
"close",
"(",
")",
";",
"engineResult",
".",
"status",
"=",
"ResultStatus",
".",
"OK",
";",
"break",
";",
"case",
"404",
":",
"engineResult",
".",
"status",
"=",
"ResultStatus",
".",
"NOT_FOUND",
";",
"break",
";",
"case",
"500",
":",
"engineResult",
".",
"status",
"=",
"ResultStatus",
".",
"INTERNAL_ERROR",
";",
"break",
";",
"default",
":",
"engineResult",
".",
"status",
"=",
"ResultStatus",
".",
"NO_RESPONSE",
";",
"break",
";",
"}",
"}",
"else",
"{",
"engineResult",
".",
"status",
"=",
"ResultStatus",
".",
"NO_RESPONSE",
";",
"}",
"}",
"catch",
"(",
"NoHttpResponseException",
"e",
")",
"{",
"engineResult",
".",
"status",
"=",
"ResultStatus",
".",
"OFFLINE",
";",
"engineResult",
".",
"t",
"=",
"e",
";",
"}",
"catch",
"(",
"ClientProtocolException",
"e",
")",
"{",
"engineResult",
".",
"status",
"=",
"ResultStatus",
".",
"RESPONSE_EXCEPTION",
";",
"engineResult",
".",
"t",
"=",
"e",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"engineResult",
".",
"status",
"=",
"ResultStatus",
".",
"RESPONSE_EXCEPTION",
";",
"engineResult",
".",
"t",
"=",
"e",
";",
"}",
"catch",
"(",
"JAXBException",
"e",
")",
"{",
"engineResult",
".",
"status",
"=",
"ResultStatus",
".",
"JAXB_EXCEPTION",
";",
"engineResult",
".",
"t",
"=",
"e",
";",
"}",
"catch",
"(",
"XMLStreamException",
"e",
")",
"{",
"engineResult",
".",
"status",
"=",
"ResultStatus",
".",
"XML_EXCEPTION",
";",
"engineResult",
".",
"t",
"=",
"e",
";",
"}",
"return",
"engineResult",
";",
"}"
] |
Process the engine result XML and turn it into a Java object.
@param request HTTP request
@return engine state and a list of registered jobs
|
[
"Process",
"the",
"engine",
"result",
"XML",
"and",
"turn",
"it",
"into",
"a",
"Java",
"object",
"."
] |
e53ec5736cbac0bdd3925b5331737dc905871629
|
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java#L319-L378
|
150,889
|
netarchivesuite/heritrix3-wrapper
|
src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java
|
Heritrix3Wrapper.jobResult
|
public JobResult jobResult(HttpRequestBase request) {
JobResult jobResult = new JobResult();
try {
HttpResponse response = httpClient.execute(request);
if (response != null) {
jobResult.responseCode = response.getStatusLine().getStatusCode();
HttpEntity responseEntity = response.getEntity();
long contentLength = responseEntity.getContentLength();
if (contentLength < 0) {
contentLength = 0;
}
ByteArrayOutputStream bOut = new ByteArrayOutputStream((int) contentLength);
InputStream in = responseEntity.getContent();
int read;
byte[] tmpBuf = new byte[8192];
while ((read = in.read(tmpBuf)) != -1) {
bOut.write(tmpBuf, 0, read);
}
in.close();
bOut.close();
jobResult.response = bOut.toByteArray();
switch (jobResult.responseCode) {
case 200:
jobResult.parse(xmlValidator);
in = new ByteArrayInputStream(jobResult.response);
jobResult.job = Job.unmarshall(in);
in.close();
jobResult.status = ResultStatus.OK;
break;
case 404:
jobResult.status = ResultStatus.NOT_FOUND;
break;
case 500:
jobResult.status = ResultStatus.INTERNAL_ERROR;
break;
default:
jobResult.status = ResultStatus.NO_RESPONSE;
break;
}
} else {
jobResult.status = ResultStatus.NO_RESPONSE;
}
} catch (NoHttpResponseException e) {
jobResult.status = ResultStatus.OFFLINE;
jobResult.t = e;
} catch (ClientProtocolException e) {
jobResult.status = ResultStatus.RESPONSE_EXCEPTION;
jobResult.t = e;
} catch (IOException e) {
jobResult.status = ResultStatus.RESPONSE_EXCEPTION;
jobResult.t = e;
} catch (JAXBException e) {
jobResult.status = ResultStatus.JAXB_EXCEPTION;
jobResult.t = e;
} catch (XMLStreamException e) {
jobResult.status = ResultStatus.XML_EXCEPTION;
jobResult.t = e;
}
return jobResult;
}
|
java
|
public JobResult jobResult(HttpRequestBase request) {
JobResult jobResult = new JobResult();
try {
HttpResponse response = httpClient.execute(request);
if (response != null) {
jobResult.responseCode = response.getStatusLine().getStatusCode();
HttpEntity responseEntity = response.getEntity();
long contentLength = responseEntity.getContentLength();
if (contentLength < 0) {
contentLength = 0;
}
ByteArrayOutputStream bOut = new ByteArrayOutputStream((int) contentLength);
InputStream in = responseEntity.getContent();
int read;
byte[] tmpBuf = new byte[8192];
while ((read = in.read(tmpBuf)) != -1) {
bOut.write(tmpBuf, 0, read);
}
in.close();
bOut.close();
jobResult.response = bOut.toByteArray();
switch (jobResult.responseCode) {
case 200:
jobResult.parse(xmlValidator);
in = new ByteArrayInputStream(jobResult.response);
jobResult.job = Job.unmarshall(in);
in.close();
jobResult.status = ResultStatus.OK;
break;
case 404:
jobResult.status = ResultStatus.NOT_FOUND;
break;
case 500:
jobResult.status = ResultStatus.INTERNAL_ERROR;
break;
default:
jobResult.status = ResultStatus.NO_RESPONSE;
break;
}
} else {
jobResult.status = ResultStatus.NO_RESPONSE;
}
} catch (NoHttpResponseException e) {
jobResult.status = ResultStatus.OFFLINE;
jobResult.t = e;
} catch (ClientProtocolException e) {
jobResult.status = ResultStatus.RESPONSE_EXCEPTION;
jobResult.t = e;
} catch (IOException e) {
jobResult.status = ResultStatus.RESPONSE_EXCEPTION;
jobResult.t = e;
} catch (JAXBException e) {
jobResult.status = ResultStatus.JAXB_EXCEPTION;
jobResult.t = e;
} catch (XMLStreamException e) {
jobResult.status = ResultStatus.XML_EXCEPTION;
jobResult.t = e;
}
return jobResult;
}
|
[
"public",
"JobResult",
"jobResult",
"(",
"HttpRequestBase",
"request",
")",
"{",
"JobResult",
"jobResult",
"=",
"new",
"JobResult",
"(",
")",
";",
"try",
"{",
"HttpResponse",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"request",
")",
";",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"jobResult",
".",
"responseCode",
"=",
"response",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
";",
"HttpEntity",
"responseEntity",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"long",
"contentLength",
"=",
"responseEntity",
".",
"getContentLength",
"(",
")",
";",
"if",
"(",
"contentLength",
"<",
"0",
")",
"{",
"contentLength",
"=",
"0",
";",
"}",
"ByteArrayOutputStream",
"bOut",
"=",
"new",
"ByteArrayOutputStream",
"(",
"(",
"int",
")",
"contentLength",
")",
";",
"InputStream",
"in",
"=",
"responseEntity",
".",
"getContent",
"(",
")",
";",
"int",
"read",
";",
"byte",
"[",
"]",
"tmpBuf",
"=",
"new",
"byte",
"[",
"8192",
"]",
";",
"while",
"(",
"(",
"read",
"=",
"in",
".",
"read",
"(",
"tmpBuf",
")",
")",
"!=",
"-",
"1",
")",
"{",
"bOut",
".",
"write",
"(",
"tmpBuf",
",",
"0",
",",
"read",
")",
";",
"}",
"in",
".",
"close",
"(",
")",
";",
"bOut",
".",
"close",
"(",
")",
";",
"jobResult",
".",
"response",
"=",
"bOut",
".",
"toByteArray",
"(",
")",
";",
"switch",
"(",
"jobResult",
".",
"responseCode",
")",
"{",
"case",
"200",
":",
"jobResult",
".",
"parse",
"(",
"xmlValidator",
")",
";",
"in",
"=",
"new",
"ByteArrayInputStream",
"(",
"jobResult",
".",
"response",
")",
";",
"jobResult",
".",
"job",
"=",
"Job",
".",
"unmarshall",
"(",
"in",
")",
";",
"in",
".",
"close",
"(",
")",
";",
"jobResult",
".",
"status",
"=",
"ResultStatus",
".",
"OK",
";",
"break",
";",
"case",
"404",
":",
"jobResult",
".",
"status",
"=",
"ResultStatus",
".",
"NOT_FOUND",
";",
"break",
";",
"case",
"500",
":",
"jobResult",
".",
"status",
"=",
"ResultStatus",
".",
"INTERNAL_ERROR",
";",
"break",
";",
"default",
":",
"jobResult",
".",
"status",
"=",
"ResultStatus",
".",
"NO_RESPONSE",
";",
"break",
";",
"}",
"}",
"else",
"{",
"jobResult",
".",
"status",
"=",
"ResultStatus",
".",
"NO_RESPONSE",
";",
"}",
"}",
"catch",
"(",
"NoHttpResponseException",
"e",
")",
"{",
"jobResult",
".",
"status",
"=",
"ResultStatus",
".",
"OFFLINE",
";",
"jobResult",
".",
"t",
"=",
"e",
";",
"}",
"catch",
"(",
"ClientProtocolException",
"e",
")",
"{",
"jobResult",
".",
"status",
"=",
"ResultStatus",
".",
"RESPONSE_EXCEPTION",
";",
"jobResult",
".",
"t",
"=",
"e",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"jobResult",
".",
"status",
"=",
"ResultStatus",
".",
"RESPONSE_EXCEPTION",
";",
"jobResult",
".",
"t",
"=",
"e",
";",
"}",
"catch",
"(",
"JAXBException",
"e",
")",
"{",
"jobResult",
".",
"status",
"=",
"ResultStatus",
".",
"JAXB_EXCEPTION",
";",
"jobResult",
".",
"t",
"=",
"e",
";",
"}",
"catch",
"(",
"XMLStreamException",
"e",
")",
"{",
"jobResult",
".",
"status",
"=",
"ResultStatus",
".",
"XML_EXCEPTION",
";",
"jobResult",
".",
"t",
"=",
"e",
";",
"}",
"return",
"jobResult",
";",
"}"
] |
Send a job request and process the XML response and turn it into a Java object.
@param request HTTP request
@return job state
|
[
"Send",
"a",
"job",
"request",
"and",
"process",
"the",
"XML",
"response",
"and",
"turn",
"it",
"into",
"a",
"Java",
"object",
"."
] |
e53ec5736cbac0bdd3925b5331737dc905871629
|
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java#L385-L444
|
150,890
|
netarchivesuite/heritrix3-wrapper
|
src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java
|
Heritrix3Wrapper.job
|
public JobResult job(String jobname) {
HttpGet getRequest = new HttpGet(baseUrl + "job/" + jobname);
getRequest.addHeader("Accept", "application/xml");
return jobResult(getRequest);
}
|
java
|
public JobResult job(String jobname) {
HttpGet getRequest = new HttpGet(baseUrl + "job/" + jobname);
getRequest.addHeader("Accept", "application/xml");
return jobResult(getRequest);
}
|
[
"public",
"JobResult",
"job",
"(",
"String",
"jobname",
")",
"{",
"HttpGet",
"getRequest",
"=",
"new",
"HttpGet",
"(",
"baseUrl",
"+",
"\"job/\"",
"+",
"jobname",
")",
";",
"getRequest",
".",
"addHeader",
"(",
"\"Accept\"",
",",
"\"application/xml\"",
")",
";",
"return",
"jobResult",
"(",
"getRequest",
")",
";",
"}"
] |
Returns the job state object given a jobname.
@param jobname job name
@return job state
|
[
"Returns",
"the",
"job",
"state",
"object",
"given",
"a",
"jobname",
"."
] |
e53ec5736cbac0bdd3925b5331737dc905871629
|
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java#L451-L455
|
150,891
|
netarchivesuite/heritrix3-wrapper
|
src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java
|
Heritrix3Wrapper.copyJob
|
public JobResult copyJob(String srcJobname, String dstJobName, boolean bAsProfile) {
HttpPost postRequest = new HttpPost(baseUrl + "job/" + srcJobname);
List<NameValuePair> nvp = new LinkedList<NameValuePair>();
nvp.add(new BasicNameValuePair("copyTo", dstJobName));
if (bAsProfile) {
nvp.add(new BasicNameValuePair("asProfile", "on"));
}
StringEntity postEntity = null;
try {
postEntity = new UrlEncodedFormEntity(nvp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return jobResult(postRequest);
}
|
java
|
public JobResult copyJob(String srcJobname, String dstJobName, boolean bAsProfile) {
HttpPost postRequest = new HttpPost(baseUrl + "job/" + srcJobname);
List<NameValuePair> nvp = new LinkedList<NameValuePair>();
nvp.add(new BasicNameValuePair("copyTo", dstJobName));
if (bAsProfile) {
nvp.add(new BasicNameValuePair("asProfile", "on"));
}
StringEntity postEntity = null;
try {
postEntity = new UrlEncodedFormEntity(nvp);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return jobResult(postRequest);
}
|
[
"public",
"JobResult",
"copyJob",
"(",
"String",
"srcJobname",
",",
"String",
"dstJobName",
",",
"boolean",
"bAsProfile",
")",
"{",
"HttpPost",
"postRequest",
"=",
"new",
"HttpPost",
"(",
"baseUrl",
"+",
"\"job/\"",
"+",
"srcJobname",
")",
";",
"List",
"<",
"NameValuePair",
">",
"nvp",
"=",
"new",
"LinkedList",
"<",
"NameValuePair",
">",
"(",
")",
";",
"nvp",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"\"copyTo\"",
",",
"dstJobName",
")",
")",
";",
"if",
"(",
"bAsProfile",
")",
"{",
"nvp",
".",
"add",
"(",
"new",
"BasicNameValuePair",
"(",
"\"asProfile\"",
",",
"\"on\"",
")",
")",
";",
"}",
"StringEntity",
"postEntity",
"=",
"null",
";",
"try",
"{",
"postEntity",
"=",
"new",
"UrlEncodedFormEntity",
"(",
"nvp",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"postEntity",
".",
"setContentType",
"(",
"\"application/x-www-form-urlencoded\"",
")",
";",
"postRequest",
".",
"addHeader",
"(",
"\"Accept\"",
",",
"\"application/xml\"",
")",
";",
"postRequest",
".",
"setEntity",
"(",
"postEntity",
")",
";",
"return",
"jobResult",
"(",
"postRequest",
")",
";",
"}"
] |
Copy a job.
@param srcJobname source job name
@param dstJobName destination job name
@param bAsProfile define if the job should be copied as a profile or not
@return job state of new job
|
[
"Copy",
"a",
"job",
"."
] |
e53ec5736cbac0bdd3925b5331737dc905871629
|
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java#L503-L520
|
150,892
|
netarchivesuite/heritrix3-wrapper
|
src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java
|
Heritrix3Wrapper.buildJobConfiguration
|
public JobResult buildJobConfiguration(String jobname){
HttpPost postRequest = new HttpPost(baseUrl + "job/" + jobname);
StringEntity postEntity = null;
try {
postEntity = new StringEntity(BUILD_ACTION);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return jobResult(postRequest);
}
|
java
|
public JobResult buildJobConfiguration(String jobname){
HttpPost postRequest = new HttpPost(baseUrl + "job/" + jobname);
StringEntity postEntity = null;
try {
postEntity = new StringEntity(BUILD_ACTION);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
postEntity.setContentType("application/x-www-form-urlencoded");
postRequest.addHeader("Accept", "application/xml");
postRequest.setEntity(postEntity);
return jobResult(postRequest);
}
|
[
"public",
"JobResult",
"buildJobConfiguration",
"(",
"String",
"jobname",
")",
"{",
"HttpPost",
"postRequest",
"=",
"new",
"HttpPost",
"(",
"baseUrl",
"+",
"\"job/\"",
"+",
"jobname",
")",
";",
"StringEntity",
"postEntity",
"=",
"null",
";",
"try",
"{",
"postEntity",
"=",
"new",
"StringEntity",
"(",
"BUILD_ACTION",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"postEntity",
".",
"setContentType",
"(",
"\"application/x-www-form-urlencoded\"",
")",
";",
"postRequest",
".",
"addHeader",
"(",
"\"Accept\"",
",",
"\"application/xml\"",
")",
";",
"postRequest",
".",
"setEntity",
"(",
"postEntity",
")",
";",
"return",
"jobResult",
"(",
"postRequest",
")",
";",
"}"
] |
Build an existing job.
@param jobname job name
@return job state
|
[
"Build",
"an",
"existing",
"job",
"."
] |
e53ec5736cbac0bdd3925b5331737dc905871629
|
https://github.com/netarchivesuite/heritrix3-wrapper/blob/e53ec5736cbac0bdd3925b5331737dc905871629/src/main/java/org/netarchivesuite/heritrix3wrapper/Heritrix3Wrapper.java#L527-L539
|
150,893
|
lecousin/java-framework-core
|
net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/OldestList.java
|
OldestList.add
|
public void add(long date, T element) {
if (size == 0) {
elements[0] = element;
dates[0] = date;
size = 1;
oldestIndex = 0;
newestIndex = 0;
return;
}
if (size < elements.length) {
elements[size] = element;
dates[size] = date;
if (date < dates[oldestIndex]) oldestIndex = size;
if (date > dates[newestIndex]) newestIndex = size;
size++;
return;
}
if (dates[oldestIndex] > date) {
// older than oldest
if (newestIndex < 0) refreshNewestIndex();
elements[newestIndex] = element;
dates[newestIndex] = date;
oldestIndex = newestIndex;
newestIndex = -1;
return;
}
if (newestIndex < 0) refreshNewestIndex();
if (dates[newestIndex] < date) return; // newer than newest
// replace the newest
elements[newestIndex] = element;
dates[newestIndex] = date;
oldestIndex = newestIndex;
newestIndex = -1;
return;
}
|
java
|
public void add(long date, T element) {
if (size == 0) {
elements[0] = element;
dates[0] = date;
size = 1;
oldestIndex = 0;
newestIndex = 0;
return;
}
if (size < elements.length) {
elements[size] = element;
dates[size] = date;
if (date < dates[oldestIndex]) oldestIndex = size;
if (date > dates[newestIndex]) newestIndex = size;
size++;
return;
}
if (dates[oldestIndex] > date) {
// older than oldest
if (newestIndex < 0) refreshNewestIndex();
elements[newestIndex] = element;
dates[newestIndex] = date;
oldestIndex = newestIndex;
newestIndex = -1;
return;
}
if (newestIndex < 0) refreshNewestIndex();
if (dates[newestIndex] < date) return; // newer than newest
// replace the newest
elements[newestIndex] = element;
dates[newestIndex] = date;
oldestIndex = newestIndex;
newestIndex = -1;
return;
}
|
[
"public",
"void",
"add",
"(",
"long",
"date",
",",
"T",
"element",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"elements",
"[",
"0",
"]",
"=",
"element",
";",
"dates",
"[",
"0",
"]",
"=",
"date",
";",
"size",
"=",
"1",
";",
"oldestIndex",
"=",
"0",
";",
"newestIndex",
"=",
"0",
";",
"return",
";",
"}",
"if",
"(",
"size",
"<",
"elements",
".",
"length",
")",
"{",
"elements",
"[",
"size",
"]",
"=",
"element",
";",
"dates",
"[",
"size",
"]",
"=",
"date",
";",
"if",
"(",
"date",
"<",
"dates",
"[",
"oldestIndex",
"]",
")",
"oldestIndex",
"=",
"size",
";",
"if",
"(",
"date",
">",
"dates",
"[",
"newestIndex",
"]",
")",
"newestIndex",
"=",
"size",
";",
"size",
"++",
";",
"return",
";",
"}",
"if",
"(",
"dates",
"[",
"oldestIndex",
"]",
">",
"date",
")",
"{",
"// older than oldest\r",
"if",
"(",
"newestIndex",
"<",
"0",
")",
"refreshNewestIndex",
"(",
")",
";",
"elements",
"[",
"newestIndex",
"]",
"=",
"element",
";",
"dates",
"[",
"newestIndex",
"]",
"=",
"date",
";",
"oldestIndex",
"=",
"newestIndex",
";",
"newestIndex",
"=",
"-",
"1",
";",
"return",
";",
"}",
"if",
"(",
"newestIndex",
"<",
"0",
")",
"refreshNewestIndex",
"(",
")",
";",
"if",
"(",
"dates",
"[",
"newestIndex",
"]",
"<",
"date",
")",
"return",
";",
"// newer than newest\r",
"// replace the newest\r",
"elements",
"[",
"newestIndex",
"]",
"=",
"element",
";",
"dates",
"[",
"newestIndex",
"]",
"=",
"date",
";",
"oldestIndex",
"=",
"newestIndex",
";",
"newestIndex",
"=",
"-",
"1",
";",
"return",
";",
"}"
] |
Add an elements with the given timestamp.
|
[
"Add",
"an",
"elements",
"with",
"the",
"given",
"timestamp",
"."
] |
b0c893b44bfde2c03f90ea846a49ef5749d598f3
|
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/collections/sort/OldestList.java#L34-L68
|
150,894
|
PureSolTechnologies/extended-objects-titan
|
titan/src/main/java/com/puresoltechnologies/xo/titan/impl/GremlinManager.java
|
GremlinManager.getGremlinExpression
|
public static <QL> GremlinExpression getGremlinExpression(QL expression,
Map<String, Object> parameters) {
GremlinExpression gremlinExpression = null;
if (expression instanceof String) {
gremlinExpression = new GremlinExpression("", (String) expression);
} else if (expression instanceof Gremlin) {
Gremlin gremlin = (Gremlin) expression;
gremlinExpression = new GremlinExpression(gremlin.name(),
gremlin.value());
} else if (AnnotatedElement.class.isAssignableFrom(expression
.getClass())) {
AnnotatedElement<?> typeExpression = (AnnotatedElement<?>) expression;
gremlinExpression = extractExpression(typeExpression);
} else if (Class.class.isAssignableFrom(expression.getClass())) {
Class<?> clazz = (Class<?>) expression;
gremlinExpression = extractExpression(clazz);
} else if (Method.class.isAssignableFrom(expression.getClass())) {
Method method = (Method) expression;
gremlinExpression = extractExpression(method);
} else {
throw new XOException("Unsupported query expression "
+ expression.toString() + "(class=" + expression.getClass()
+ ")");
}
return applyParameters(parameters, gremlinExpression);
}
|
java
|
public static <QL> GremlinExpression getGremlinExpression(QL expression,
Map<String, Object> parameters) {
GremlinExpression gremlinExpression = null;
if (expression instanceof String) {
gremlinExpression = new GremlinExpression("", (String) expression);
} else if (expression instanceof Gremlin) {
Gremlin gremlin = (Gremlin) expression;
gremlinExpression = new GremlinExpression(gremlin.name(),
gremlin.value());
} else if (AnnotatedElement.class.isAssignableFrom(expression
.getClass())) {
AnnotatedElement<?> typeExpression = (AnnotatedElement<?>) expression;
gremlinExpression = extractExpression(typeExpression);
} else if (Class.class.isAssignableFrom(expression.getClass())) {
Class<?> clazz = (Class<?>) expression;
gremlinExpression = extractExpression(clazz);
} else if (Method.class.isAssignableFrom(expression.getClass())) {
Method method = (Method) expression;
gremlinExpression = extractExpression(method);
} else {
throw new XOException("Unsupported query expression "
+ expression.toString() + "(class=" + expression.getClass()
+ ")");
}
return applyParameters(parameters, gremlinExpression);
}
|
[
"public",
"static",
"<",
"QL",
">",
"GremlinExpression",
"getGremlinExpression",
"(",
"QL",
"expression",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"{",
"GremlinExpression",
"gremlinExpression",
"=",
"null",
";",
"if",
"(",
"expression",
"instanceof",
"String",
")",
"{",
"gremlinExpression",
"=",
"new",
"GremlinExpression",
"(",
"\"\"",
",",
"(",
"String",
")",
"expression",
")",
";",
"}",
"else",
"if",
"(",
"expression",
"instanceof",
"Gremlin",
")",
"{",
"Gremlin",
"gremlin",
"=",
"(",
"Gremlin",
")",
"expression",
";",
"gremlinExpression",
"=",
"new",
"GremlinExpression",
"(",
"gremlin",
".",
"name",
"(",
")",
",",
"gremlin",
".",
"value",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"AnnotatedElement",
".",
"class",
".",
"isAssignableFrom",
"(",
"expression",
".",
"getClass",
"(",
")",
")",
")",
"{",
"AnnotatedElement",
"<",
"?",
">",
"typeExpression",
"=",
"(",
"AnnotatedElement",
"<",
"?",
">",
")",
"expression",
";",
"gremlinExpression",
"=",
"extractExpression",
"(",
"typeExpression",
")",
";",
"}",
"else",
"if",
"(",
"Class",
".",
"class",
".",
"isAssignableFrom",
"(",
"expression",
".",
"getClass",
"(",
")",
")",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"(",
"Class",
"<",
"?",
">",
")",
"expression",
";",
"gremlinExpression",
"=",
"extractExpression",
"(",
"clazz",
")",
";",
"}",
"else",
"if",
"(",
"Method",
".",
"class",
".",
"isAssignableFrom",
"(",
"expression",
".",
"getClass",
"(",
")",
")",
")",
"{",
"Method",
"method",
"=",
"(",
"Method",
")",
"expression",
";",
"gremlinExpression",
"=",
"extractExpression",
"(",
"method",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"XOException",
"(",
"\"Unsupported query expression \"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\"(class=\"",
"+",
"expression",
".",
"getClass",
"(",
")",
"+",
"\")\"",
")",
";",
"}",
"return",
"applyParameters",
"(",
"parameters",
",",
"gremlinExpression",
")",
";",
"}"
] |
This is a helper method to extract the Gremlin expression.
@param expression
is the object which comes in from
DatastoreSession#executeQuery(Object, java.util.Map).
@param parameters
is a Map of parameters.
@return A {@link String} containing a Gremlin expression is returned.
@param <QL>
is the query language.
|
[
"This",
"is",
"a",
"helper",
"method",
"to",
"extract",
"the",
"Gremlin",
"expression",
"."
] |
26c091f04d03d858af7c97230c71f7f7205b4519
|
https://github.com/PureSolTechnologies/extended-objects-titan/blob/26c091f04d03d858af7c97230c71f7f7205b4519/titan/src/main/java/com/puresoltechnologies/xo/titan/impl/GremlinManager.java#L33-L58
|
150,895
|
hawkular/hawkular-bus
|
hawkular-bus-common/src/main/java/org/hawkular/bus/common/SimpleBasicMessage.java
|
SimpleBasicMessage.getDetails
|
public Map<String, String> getDetails() {
if (details == null) {
return null;
}
return Collections.unmodifiableMap(details);
}
|
java
|
public Map<String, String> getDetails() {
if (details == null) {
return null;
}
return Collections.unmodifiableMap(details);
}
|
[
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getDetails",
"(",
")",
"{",
"if",
"(",
"details",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"Collections",
".",
"unmodifiableMap",
"(",
"details",
")",
";",
"}"
] |
Optional additional details about this message. This could be null if there are no additional details associated
with this message.
@return the details of this message or null. This is an unmodifiable, read-only map of details.
|
[
"Optional",
"additional",
"details",
"about",
"this",
"message",
".",
"This",
"could",
"be",
"null",
"if",
"there",
"are",
"no",
"additional",
"details",
"associated",
"with",
"this",
"message",
"."
] |
28d6b58bec81a50f8344d39f309b6971271ae627
|
https://github.com/hawkular/hawkular-bus/blob/28d6b58bec81a50f8344d39f309b6971271ae627/hawkular-bus-common/src/main/java/org/hawkular/bus/common/SimpleBasicMessage.java#L77-L82
|
150,896
|
livetribe/livetribe-slp
|
core/src/main/java/org/livetribe/slp/spi/sa/ServiceAgentInfo.java
|
ServiceAgentInfo.from
|
public static ServiceAgentInfo from(SAAdvert saAdvert)
{
IdentifierExtension identifierExtension = IdentifierExtension.findFirst(saAdvert.getExtensions());
String identifier = identifierExtension == null ? null : identifierExtension.getIdentifier();
return new ServiceAgentInfo(identifier, saAdvert.getURL(), saAdvert.getScopes(), saAdvert.getAttributes(), saAdvert.getLanguage());
}
|
java
|
public static ServiceAgentInfo from(SAAdvert saAdvert)
{
IdentifierExtension identifierExtension = IdentifierExtension.findFirst(saAdvert.getExtensions());
String identifier = identifierExtension == null ? null : identifierExtension.getIdentifier();
return new ServiceAgentInfo(identifier, saAdvert.getURL(), saAdvert.getScopes(), saAdvert.getAttributes(), saAdvert.getLanguage());
}
|
[
"public",
"static",
"ServiceAgentInfo",
"from",
"(",
"SAAdvert",
"saAdvert",
")",
"{",
"IdentifierExtension",
"identifierExtension",
"=",
"IdentifierExtension",
".",
"findFirst",
"(",
"saAdvert",
".",
"getExtensions",
"(",
")",
")",
";",
"String",
"identifier",
"=",
"identifierExtension",
"==",
"null",
"?",
"null",
":",
"identifierExtension",
".",
"getIdentifier",
"(",
")",
";",
"return",
"new",
"ServiceAgentInfo",
"(",
"identifier",
",",
"saAdvert",
".",
"getURL",
"(",
")",
",",
"saAdvert",
".",
"getScopes",
"(",
")",
",",
"saAdvert",
".",
"getAttributes",
"(",
")",
",",
"saAdvert",
".",
"getLanguage",
"(",
")",
")",
";",
"}"
] |
private final int port;
|
[
"private",
"final",
"int",
"port",
";"
] |
6cc13dbe81feab133fe3dd291ca081cbc6e1f591
|
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/spi/sa/ServiceAgentInfo.java#L41-L46
|
150,897
|
skuzzle/TinyPlugz
|
tiny-plugz/src/main/java/de/skuzzle/tinyplugz/servlet/TinyPlugzContextServlet.java
|
TinyPlugzContextServlet.wrap
|
public static Servlet wrap(Servlet servlet) {
Require.nonNull(servlet, "servlet");
if (servlet instanceof TinyPlugzContextServlet) {
return servlet;
}
return new TinyPlugzContextServlet(servlet);
}
|
java
|
public static Servlet wrap(Servlet servlet) {
Require.nonNull(servlet, "servlet");
if (servlet instanceof TinyPlugzContextServlet) {
return servlet;
}
return new TinyPlugzContextServlet(servlet);
}
|
[
"public",
"static",
"Servlet",
"wrap",
"(",
"Servlet",
"servlet",
")",
"{",
"Require",
".",
"nonNull",
"(",
"servlet",
",",
"\"servlet\"",
")",
";",
"if",
"(",
"servlet",
"instanceof",
"TinyPlugzContextServlet",
")",
"{",
"return",
"servlet",
";",
"}",
"return",
"new",
"TinyPlugzContextServlet",
"(",
"servlet",
")",
";",
"}"
] |
Wraps the given Servlet.
@param servlet The servlet to wrap.
@return The decorated servlet.
|
[
"Wraps",
"the",
"given",
"Servlet",
"."
] |
739858ed0ba5a0c75b6ccf18df9a4d5612374a4b
|
https://github.com/skuzzle/TinyPlugz/blob/739858ed0ba5a0c75b6ccf18df9a4d5612374a4b/tiny-plugz/src/main/java/de/skuzzle/tinyplugz/servlet/TinyPlugzContextServlet.java#L37-L43
|
150,898
|
jtrfp/javamod
|
src/main/java/de/quippy/javamod/main/applet/JavaModAppletBase.java
|
JavaModAppletBase.getPlayingPosition
|
public int getPlayingPosition()
{
if (playerThread!=null)
{
final Mixer mixer = playerThread.getCurrentMixer();
if (mixer!=null && mixer instanceof ModMixer)
{
final BasicModMixer modMixer = ((ModMixer)mixer).getModMixer();
if (modMixer!=null) return modMixer.getCurrentPatternPosition();
}
}
return -1;
}
|
java
|
public int getPlayingPosition()
{
if (playerThread!=null)
{
final Mixer mixer = playerThread.getCurrentMixer();
if (mixer!=null && mixer instanceof ModMixer)
{
final BasicModMixer modMixer = ((ModMixer)mixer).getModMixer();
if (modMixer!=null) return modMixer.getCurrentPatternPosition();
}
}
return -1;
}
|
[
"public",
"int",
"getPlayingPosition",
"(",
")",
"{",
"if",
"(",
"playerThread",
"!=",
"null",
")",
"{",
"final",
"Mixer",
"mixer",
"=",
"playerThread",
".",
"getCurrentMixer",
"(",
")",
";",
"if",
"(",
"mixer",
"!=",
"null",
"&&",
"mixer",
"instanceof",
"ModMixer",
")",
"{",
"final",
"BasicModMixer",
"modMixer",
"=",
"(",
"(",
"ModMixer",
")",
"mixer",
")",
".",
"getModMixer",
"(",
")",
";",
"if",
"(",
"modMixer",
"!=",
"null",
")",
"return",
"modMixer",
".",
"getCurrentPatternPosition",
"(",
")",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
PLAYER INFO METHOD FOR JAVASCRIPT
|
[
"PLAYER",
"INFO",
"METHOD",
"FOR",
"JAVASCRIPT"
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/applet/JavaModAppletBase.java#L233-L245
|
150,899
|
jtrfp/javamod
|
src/main/java/de/quippy/jflac/metadata/SeekTable.java
|
SeekTable.getSeekPoint
|
public SeekPoint getSeekPoint(int idx) {
if (idx < 0 || idx >= points.length) return null;
return points[idx];
}
|
java
|
public SeekPoint getSeekPoint(int idx) {
if (idx < 0 || idx >= points.length) return null;
return points[idx];
}
|
[
"public",
"SeekPoint",
"getSeekPoint",
"(",
"int",
"idx",
")",
"{",
"if",
"(",
"idx",
"<",
"0",
"||",
"idx",
">=",
"points",
".",
"length",
")",
"return",
"null",
";",
"return",
"points",
"[",
"idx",
"]",
";",
"}"
] |
Return the selected seek point.
@param idx The seek point number
@return The selected seek point
|
[
"Return",
"the",
"selected",
"seek",
"point",
"."
] |
cda4fe943a589dc49415f4413453e2eece72076a
|
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/metadata/SeekTable.java#L100-L103
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.