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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
154,300
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
|
MainApplication.createRemoteTask
|
public RemoteTask createRemoteTask(String strServer, String strRemoteApp, String strUserID, String strPassword)
{
RemoteTask remoteTask = super.createRemoteTask(strServer, strRemoteApp, strUserID, strPassword);
return remoteTask;
}
|
java
|
public RemoteTask createRemoteTask(String strServer, String strRemoteApp, String strUserID, String strPassword)
{
RemoteTask remoteTask = super.createRemoteTask(strServer, strRemoteApp, strUserID, strPassword);
return remoteTask;
}
|
[
"public",
"RemoteTask",
"createRemoteTask",
"(",
"String",
"strServer",
",",
"String",
"strRemoteApp",
",",
"String",
"strUserID",
",",
"String",
"strPassword",
")",
"{",
"RemoteTask",
"remoteTask",
"=",
"super",
".",
"createRemoteTask",
"(",
"strServer",
",",
"strRemoteApp",
",",
"strUserID",
",",
"strPassword",
")",
";",
"return",
"remoteTask",
";",
"}"
] |
Connect to the remote server and get the remote server object.
@param strServer The (rmi) server.
@param The remote application name in jndi index.
@return The remote server object.
|
[
"Connect",
"to",
"the",
"remote",
"server",
"and",
"get",
"the",
"remote",
"server",
"object",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L636-L640
|
154,301
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/crypto/core/ConcatKDFBytesGenerator.java
|
ConcatKDFBytesGenerator.generateBytes
|
public int generateBytes(byte[] out, int outOff, int len) throws DataLengthException,
IllegalArgumentException
{
if ((out.length - len) < outOff)
{
throw new DataLengthException("output buffer too small");
}
long oBytes = len;
int outLen = digest.getDigestSize();
//
// this is at odds with the standard implementation, the
// maximum value should be hBits * (2^32 - 1) where hBits
// is the digest output size in bits. We can't have an
// array with a long index at the moment...
//
if (oBytes > ((2L << 32) - 1))
{
throw new IllegalArgumentException("Output length too large");
}
int cThreshold = (int)((oBytes + outLen - 1) / outLen);
byte[] dig = new byte[digest.getDigestSize()];
byte[] C = new byte[4];
Pack.intToBigEndian(counterStart, C, 0);
int counterBase = counterStart & ~0xFF;
for (int i = 0; i < cThreshold; i++)
{
digest.update(C, 0, C.length);
digest.update(shared, 0, shared.length);
if (iv != null)
{
digest.update(iv, 0, iv.length);
}
digest.doFinal(dig, 0);
if (len > outLen)
{
System.arraycopy(dig, 0, out, outOff, outLen);
outOff += outLen;
len -= outLen;
}
else
{
System.arraycopy(dig, 0, out, outOff, len);
}
if (++C[3] == 0)
{
counterBase += 0x100;
Pack.intToBigEndian(counterBase, C, 0);
}
}
digest.reset();
return (int)oBytes;
}
|
java
|
public int generateBytes(byte[] out, int outOff, int len) throws DataLengthException,
IllegalArgumentException
{
if ((out.length - len) < outOff)
{
throw new DataLengthException("output buffer too small");
}
long oBytes = len;
int outLen = digest.getDigestSize();
//
// this is at odds with the standard implementation, the
// maximum value should be hBits * (2^32 - 1) where hBits
// is the digest output size in bits. We can't have an
// array with a long index at the moment...
//
if (oBytes > ((2L << 32) - 1))
{
throw new IllegalArgumentException("Output length too large");
}
int cThreshold = (int)((oBytes + outLen - 1) / outLen);
byte[] dig = new byte[digest.getDigestSize()];
byte[] C = new byte[4];
Pack.intToBigEndian(counterStart, C, 0);
int counterBase = counterStart & ~0xFF;
for (int i = 0; i < cThreshold; i++)
{
digest.update(C, 0, C.length);
digest.update(shared, 0, shared.length);
if (iv != null)
{
digest.update(iv, 0, iv.length);
}
digest.doFinal(dig, 0);
if (len > outLen)
{
System.arraycopy(dig, 0, out, outOff, outLen);
outOff += outLen;
len -= outLen;
}
else
{
System.arraycopy(dig, 0, out, outOff, len);
}
if (++C[3] == 0)
{
counterBase += 0x100;
Pack.intToBigEndian(counterBase, C, 0);
}
}
digest.reset();
return (int)oBytes;
}
|
[
"public",
"int",
"generateBytes",
"(",
"byte",
"[",
"]",
"out",
",",
"int",
"outOff",
",",
"int",
"len",
")",
"throws",
"DataLengthException",
",",
"IllegalArgumentException",
"{",
"if",
"(",
"(",
"out",
".",
"length",
"-",
"len",
")",
"<",
"outOff",
")",
"{",
"throw",
"new",
"DataLengthException",
"(",
"\"output buffer too small\"",
")",
";",
"}",
"long",
"oBytes",
"=",
"len",
";",
"int",
"outLen",
"=",
"digest",
".",
"getDigestSize",
"(",
")",
";",
"//",
"// this is at odds with the standard implementation, the",
"// maximum value should be hBits * (2^32 - 1) where hBits",
"// is the digest output size in bits. We can't have an",
"// array with a long index at the moment...",
"//",
"if",
"(",
"oBytes",
">",
"(",
"(",
"2L",
"<<",
"32",
")",
"-",
"1",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Output length too large\"",
")",
";",
"}",
"int",
"cThreshold",
"=",
"(",
"int",
")",
"(",
"(",
"oBytes",
"+",
"outLen",
"-",
"1",
")",
"/",
"outLen",
")",
";",
"byte",
"[",
"]",
"dig",
"=",
"new",
"byte",
"[",
"digest",
".",
"getDigestSize",
"(",
")",
"]",
";",
"byte",
"[",
"]",
"C",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"Pack",
".",
"intToBigEndian",
"(",
"counterStart",
",",
"C",
",",
"0",
")",
";",
"int",
"counterBase",
"=",
"counterStart",
"&",
"~",
"0xFF",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cThreshold",
";",
"i",
"++",
")",
"{",
"digest",
".",
"update",
"(",
"C",
",",
"0",
",",
"C",
".",
"length",
")",
";",
"digest",
".",
"update",
"(",
"shared",
",",
"0",
",",
"shared",
".",
"length",
")",
";",
"if",
"(",
"iv",
"!=",
"null",
")",
"{",
"digest",
".",
"update",
"(",
"iv",
",",
"0",
",",
"iv",
".",
"length",
")",
";",
"}",
"digest",
".",
"doFinal",
"(",
"dig",
",",
"0",
")",
";",
"if",
"(",
"len",
">",
"outLen",
")",
"{",
"System",
".",
"arraycopy",
"(",
"dig",
",",
"0",
",",
"out",
",",
"outOff",
",",
"outLen",
")",
";",
"outOff",
"+=",
"outLen",
";",
"len",
"-=",
"outLen",
";",
"}",
"else",
"{",
"System",
".",
"arraycopy",
"(",
"dig",
",",
"0",
",",
"out",
",",
"outOff",
",",
"len",
")",
";",
"}",
"if",
"(",
"++",
"C",
"[",
"3",
"]",
"==",
"0",
")",
"{",
"counterBase",
"+=",
"0x100",
";",
"Pack",
".",
"intToBigEndian",
"(",
"counterBase",
",",
"C",
",",
"0",
")",
";",
"}",
"}",
"digest",
".",
"reset",
"(",
")",
";",
"return",
"(",
"int",
")",
"oBytes",
";",
"}"
] |
fill len bytes of the output buffer with bytes generated from the
derivation function.
@throws IllegalArgumentException
if the size of the request will cause an overflow.
@throws DataLengthException
if the out buffer is too small.
|
[
"fill",
"len",
"bytes",
"of",
"the",
"output",
"buffer",
"with",
"bytes",
"generated",
"from",
"the",
"derivation",
"function",
"."
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ConcatKDFBytesGenerator.java#L97-L161
|
154,302
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/logging/BaseLogging.java
|
BaseLogging.severe
|
public void severe(String format, Object... args)
{
if (isLoggable(SEVERE))
{
logIt(SEVERE, String.format(format, args));
}
}
|
java
|
public void severe(String format, Object... args)
{
if (isLoggable(SEVERE))
{
logIt(SEVERE, String.format(format, args));
}
}
|
[
"public",
"void",
"severe",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isLoggable",
"(",
"SEVERE",
")",
")",
"{",
"logIt",
"(",
"SEVERE",
",",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}",
"}"
] |
Write to log SEVERE level.
@param format
@param args
@see java.util.Formatter#format(java.lang.String, java.lang.Object...)
@see java.util.logging.Level
|
[
"Write",
"to",
"log",
"SEVERE",
"level",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/BaseLogging.java#L45-L51
|
154,303
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/logging/BaseLogging.java
|
BaseLogging.warning
|
public void warning(String format, Object... args)
{
if (isLoggable(WARNING))
{
logIt(WARNING, String.format(format, args));
}
}
|
java
|
public void warning(String format, Object... args)
{
if (isLoggable(WARNING))
{
logIt(WARNING, String.format(format, args));
}
}
|
[
"public",
"void",
"warning",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isLoggable",
"(",
"WARNING",
")",
")",
"{",
"logIt",
"(",
"WARNING",
",",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}",
"}"
] |
Write to log at WARNING level.
@param format
@param args
@see java.util.Formatter#format(java.lang.String, java.lang.Object...)
@see java.util.logging.Level
|
[
"Write",
"to",
"log",
"at",
"WARNING",
"level",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/BaseLogging.java#L70-L76
|
154,304
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/logging/BaseLogging.java
|
BaseLogging.info
|
public void info(String format, Object... args)
{
if (isLoggable(INFO))
{
logIt(INFO, String.format(format, args));
}
}
|
java
|
public void info(String format, Object... args)
{
if (isLoggable(INFO))
{
logIt(INFO, String.format(format, args));
}
}
|
[
"public",
"void",
"info",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isLoggable",
"(",
"INFO",
")",
")",
"{",
"logIt",
"(",
"INFO",
",",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}",
"}"
] |
Write to log at INFO level.
@param format
@param args
@see java.util.Formatter#format(java.lang.String, java.lang.Object...)
@see java.util.logging.Level
|
[
"Write",
"to",
"log",
"at",
"INFO",
"level",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/BaseLogging.java#L95-L101
|
154,305
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/logging/BaseLogging.java
|
BaseLogging.config
|
public void config(String format, Object... args)
{
if (isLoggable(CONFIG))
{
logIt(CONFIG, String.format(format, args));
}
}
|
java
|
public void config(String format, Object... args)
{
if (isLoggable(CONFIG))
{
logIt(CONFIG, String.format(format, args));
}
}
|
[
"public",
"void",
"config",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isLoggable",
"(",
"CONFIG",
")",
")",
"{",
"logIt",
"(",
"CONFIG",
",",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}",
"}"
] |
Write to log at CONFIG level.
@param format
@param args
@see java.util.Formatter#format(java.lang.String, java.lang.Object...)
@see java.util.logging.Level
|
[
"Write",
"to",
"log",
"at",
"CONFIG",
"level",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/BaseLogging.java#L120-L126
|
154,306
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/logging/BaseLogging.java
|
BaseLogging.fine
|
public void fine(String format, Object... args)
{
if (isLoggable(FINE))
{
logIt(FINE, String.format(format, args));
}
}
|
java
|
public void fine(String format, Object... args)
{
if (isLoggable(FINE))
{
logIt(FINE, String.format(format, args));
}
}
|
[
"public",
"void",
"fine",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isLoggable",
"(",
"FINE",
")",
")",
"{",
"logIt",
"(",
"FINE",
",",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}",
"}"
] |
Write to log at FINE level.
@param format
@param args
@see java.util.Formatter#format(java.lang.String, java.lang.Object...)
@see java.util.logging.Level
|
[
"Write",
"to",
"log",
"at",
"FINE",
"level",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/BaseLogging.java#L145-L151
|
154,307
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/logging/BaseLogging.java
|
BaseLogging.finer
|
public void finer(String format, Object... args)
{
if (isLoggable(FINER))
{
logIt(FINER, String.format(format, args));
}
}
|
java
|
public void finer(String format, Object... args)
{
if (isLoggable(FINER))
{
logIt(FINER, String.format(format, args));
}
}
|
[
"public",
"void",
"finer",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isLoggable",
"(",
"FINER",
")",
")",
"{",
"logIt",
"(",
"FINER",
",",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}",
"}"
] |
Write to log at FINER level.
@param format
@param args
@see java.util.Formatter#format(java.lang.String, java.lang.Object...)
@see java.util.logging.Level
|
[
"Write",
"to",
"log",
"at",
"FINER",
"level",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/BaseLogging.java#L170-L176
|
154,308
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/logging/BaseLogging.java
|
BaseLogging.finest
|
public void finest(String format, Object... args)
{
if (isLoggable(FINEST))
{
logIt(FINEST, String.format(format, args));
}
}
|
java
|
public void finest(String format, Object... args)
{
if (isLoggable(FINEST))
{
logIt(FINEST, String.format(format, args));
}
}
|
[
"public",
"void",
"finest",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isLoggable",
"(",
"FINEST",
")",
")",
"{",
"logIt",
"(",
"FINEST",
",",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}",
"}"
] |
Write to log at FINEST level.
@param format
@param args
@see java.util.Formatter#format(java.lang.String, java.lang.Object...)
@see java.util.logging.Level
|
[
"Write",
"to",
"log",
"at",
"FINEST",
"level",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/BaseLogging.java#L195-L201
|
154,309
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/logging/BaseLogging.java
|
BaseLogging.verbose
|
public void verbose(String format, Object... args)
{
if (isLoggable(VERBOSE))
{
logIt(VERBOSE, String.format(format, args));
}
}
|
java
|
public void verbose(String format, Object... args)
{
if (isLoggable(VERBOSE))
{
logIt(VERBOSE, String.format(format, args));
}
}
|
[
"public",
"void",
"verbose",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isLoggable",
"(",
"VERBOSE",
")",
")",
"{",
"logIt",
"(",
"VERBOSE",
",",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}",
"}"
] |
Write to log at VERBOSE level.
@param format
@param args
@see java.util.Formatter#format(java.lang.String, java.lang.Object...)
@see java.util.logging.Level
|
[
"Write",
"to",
"log",
"at",
"VERBOSE",
"level",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/BaseLogging.java#L220-L226
|
154,310
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/logging/BaseLogging.java
|
BaseLogging.debug
|
public void debug(String format, Object... args)
{
if (isLoggable(DEBUG))
{
logIt(DEBUG, String.format(format, args));
}
}
|
java
|
public void debug(String format, Object... args)
{
if (isLoggable(DEBUG))
{
logIt(DEBUG, String.format(format, args));
}
}
|
[
"public",
"void",
"debug",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isLoggable",
"(",
"DEBUG",
")",
")",
"{",
"logIt",
"(",
"DEBUG",
",",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}",
"}"
] |
Write to log at DEBUG level.
@param format
@param args
@see java.util.Formatter#format(java.lang.String, java.lang.Object...)
@see java.util.logging.Level
|
[
"Write",
"to",
"log",
"at",
"DEBUG",
"level",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/BaseLogging.java#L245-L251
|
154,311
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/logging/BaseLogging.java
|
BaseLogging.log
|
public void log(Level level, String format, Object... args)
{
if (isLoggable(level))
{
if (format != null)
{
logIt(level, String.format(format, args));
}
else
{
logIt(level, String.format("%s format == null", level));
}
}
}
|
java
|
public void log(Level level, String format, Object... args)
{
if (isLoggable(level))
{
if (format != null)
{
logIt(level, String.format(format, args));
}
else
{
logIt(level, String.format("%s format == null", level));
}
}
}
|
[
"public",
"void",
"log",
"(",
"Level",
"level",
",",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"isLoggable",
"(",
"level",
")",
")",
"{",
"if",
"(",
"format",
"!=",
"null",
")",
"{",
"logIt",
"(",
"level",
",",
"String",
".",
"format",
"(",
"format",
",",
"args",
")",
")",
";",
"}",
"else",
"{",
"logIt",
"(",
"level",
",",
"String",
".",
"format",
"(",
"\"%s format == null\"",
",",
"level",
")",
")",
";",
"}",
"}",
"}"
] |
Write to log
@param level
@param format
@param args
@see java.util.Formatter#format(java.lang.String, java.lang.Object...)
@see java.util.logging.Level
|
[
"Write",
"to",
"log"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/logging/BaseLogging.java#L271-L284
|
154,312
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseToolbar.java
|
JBaseToolbar.addButton
|
public JButton addButton(String strParam)
{
String strDesc = strParam;
BaseApplet applet = this.getBaseApplet();
if (applet != null)
strDesc = applet.getString(strParam);
return this.addButton(strDesc, strParam);
}
|
java
|
public JButton addButton(String strParam)
{
String strDesc = strParam;
BaseApplet applet = this.getBaseApplet();
if (applet != null)
strDesc = applet.getString(strParam);
return this.addButton(strDesc, strParam);
}
|
[
"public",
"JButton",
"addButton",
"(",
"String",
"strParam",
")",
"{",
"String",
"strDesc",
"=",
"strParam",
";",
"BaseApplet",
"applet",
"=",
"this",
".",
"getBaseApplet",
"(",
")",
";",
"if",
"(",
"applet",
"!=",
"null",
")",
"strDesc",
"=",
"applet",
".",
"getString",
"(",
"strParam",
")",
";",
"return",
"this",
".",
"addButton",
"(",
"strDesc",
",",
"strParam",
")",
";",
"}"
] |
Add a button to this window.
Convert this param to the local string and call addButton.
@param The key for this button.
@return TODO
|
[
"Add",
"a",
"button",
"to",
"this",
"window",
".",
"Convert",
"this",
"param",
"to",
"the",
"local",
"string",
"and",
"call",
"addButton",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseToolbar.java#L69-L76
|
154,313
|
DDTH/ddth-tsc
|
ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/internal/MetadataManager.java
|
MetadataManager.getCounterMetadata
|
public CounterMetadata getCounterMetadata(String counterName) {
// first fetch metadata for the specified counter
String jsonString = getRow(counterName);
if (jsonString != null) {
CounterMetadata result = CounterMetadata.fromJsonString(jsonString);
if (result != null) {
result.setName(counterName);
}
return result;
} else {
// no exact match, try to build counter metadata from global config
return findCounterMetadata(counterName);
}
}
|
java
|
public CounterMetadata getCounterMetadata(String counterName) {
// first fetch metadata for the specified counter
String jsonString = getRow(counterName);
if (jsonString != null) {
CounterMetadata result = CounterMetadata.fromJsonString(jsonString);
if (result != null) {
result.setName(counterName);
}
return result;
} else {
// no exact match, try to build counter metadata from global config
return findCounterMetadata(counterName);
}
}
|
[
"public",
"CounterMetadata",
"getCounterMetadata",
"(",
"String",
"counterName",
")",
"{",
"// first fetch metadata for the specified counter",
"String",
"jsonString",
"=",
"getRow",
"(",
"counterName",
")",
";",
"if",
"(",
"jsonString",
"!=",
"null",
")",
"{",
"CounterMetadata",
"result",
"=",
"CounterMetadata",
".",
"fromJsonString",
"(",
"jsonString",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"result",
".",
"setName",
"(",
"counterName",
")",
";",
"}",
"return",
"result",
";",
"}",
"else",
"{",
"// no exact match, try to build counter metadata from global config",
"return",
"findCounterMetadata",
"(",
"counterName",
")",
";",
"}",
"}"
] |
Gets a counter metadata by name.
@param name
@return
|
[
"Gets",
"a",
"counter",
"metadata",
"by",
"name",
"."
] |
d233c304c8fed2f3c069de42a36b7bbd5c8be01b
|
https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/internal/MetadataManager.java#L154-L167
|
154,314
|
lightblueseas/vintage-time
|
src/main/java/de/alpharogroup/date/CreateDateExtensions.java
|
CreateDateExtensions.newRandomDate
|
public static Date newRandomDate(final Date from)
{
final Random secrand = new SecureRandom();
final double randDouble = -secrand.nextDouble() * from.getTime();
final double randomDouble = from.getTime() - secrand.nextDouble();
final double result = randDouble * randomDouble;
return new Date((long)result);
}
|
java
|
public static Date newRandomDate(final Date from)
{
final Random secrand = new SecureRandom();
final double randDouble = -secrand.nextDouble() * from.getTime();
final double randomDouble = from.getTime() - secrand.nextDouble();
final double result = randDouble * randomDouble;
return new Date((long)result);
}
|
[
"public",
"static",
"Date",
"newRandomDate",
"(",
"final",
"Date",
"from",
")",
"{",
"final",
"Random",
"secrand",
"=",
"new",
"SecureRandom",
"(",
")",
";",
"final",
"double",
"randDouble",
"=",
"-",
"secrand",
".",
"nextDouble",
"(",
")",
"*",
"from",
".",
"getTime",
"(",
")",
";",
"final",
"double",
"randomDouble",
"=",
"from",
".",
"getTime",
"(",
")",
"-",
"secrand",
".",
"nextDouble",
"(",
")",
";",
"final",
"double",
"result",
"=",
"randDouble",
"*",
"randomDouble",
";",
"return",
"new",
"Date",
"(",
"(",
"long",
")",
"result",
")",
";",
"}"
] |
Creates the random date.
@param from
the from
@return the date
|
[
"Creates",
"the",
"random",
"date",
"."
] |
fbf201e679d9f9b92e7b5771f3eea1413cc2e113
|
https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CreateDateExtensions.java#L174-L181
|
154,315
|
kametic/specifications
|
src/main/java/org/kametic/specifications/reflect/ClassMethodsAnnotatedWith.java
|
ClassMethodsAnnotatedWith.getAllInterfacesAndClasses
|
@SuppressWarnings("unchecked")
Class<?>[] getAllInterfacesAndClasses ( Class<?>[] classes )
{
if(0 == classes.length )
{
return classes;
}
else
{
List<Class<?>> extendedClasses = new ArrayList<Class<?>>();
// all interfaces hierarchy
for (Class<?> clazz: classes) {
if (clazz != null)
{
Class<?>[] interfaces = clazz.getInterfaces();
if (interfaces != null)
{
extendedClasses.addAll(Arrays.asList(interfaces));
}
Class<?> superclass = clazz.getSuperclass();
if (superclass != null && superclass != Object.class)
{
extendedClasses.addAll(Arrays.asList(superclass));
}
}
}
//Class::getInterfaces() gets only interfaces/classes implemented/extended directly by a given class.
//We need to walk the whole way up the tree.
return (Class[]) ArrayUtils.addAll( classes, getAllInterfacesAndClasses( extendedClasses.toArray(new Class[extendedClasses.size()])));
}
}
|
java
|
@SuppressWarnings("unchecked")
Class<?>[] getAllInterfacesAndClasses ( Class<?>[] classes )
{
if(0 == classes.length )
{
return classes;
}
else
{
List<Class<?>> extendedClasses = new ArrayList<Class<?>>();
// all interfaces hierarchy
for (Class<?> clazz: classes) {
if (clazz != null)
{
Class<?>[] interfaces = clazz.getInterfaces();
if (interfaces != null)
{
extendedClasses.addAll(Arrays.asList(interfaces));
}
Class<?> superclass = clazz.getSuperclass();
if (superclass != null && superclass != Object.class)
{
extendedClasses.addAll(Arrays.asList(superclass));
}
}
}
//Class::getInterfaces() gets only interfaces/classes implemented/extended directly by a given class.
//We need to walk the whole way up the tree.
return (Class[]) ArrayUtils.addAll( classes, getAllInterfacesAndClasses( extendedClasses.toArray(new Class[extendedClasses.size()])));
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Class",
"<",
"?",
">",
"[",
"]",
"getAllInterfacesAndClasses",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
")",
"{",
"if",
"(",
"0",
"==",
"classes",
".",
"length",
")",
"{",
"return",
"classes",
";",
"}",
"else",
"{",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"extendedClasses",
"=",
"new",
"ArrayList",
"<",
"Class",
"<",
"?",
">",
">",
"(",
")",
";",
"// all interfaces hierarchy\r",
"for",
"(",
"Class",
"<",
"?",
">",
"clazz",
":",
"classes",
")",
"{",
"if",
"(",
"clazz",
"!=",
"null",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
"=",
"clazz",
".",
"getInterfaces",
"(",
")",
";",
"if",
"(",
"interfaces",
"!=",
"null",
")",
"{",
"extendedClasses",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"interfaces",
")",
")",
";",
"}",
"Class",
"<",
"?",
">",
"superclass",
"=",
"clazz",
".",
"getSuperclass",
"(",
")",
";",
"if",
"(",
"superclass",
"!=",
"null",
"&&",
"superclass",
"!=",
"Object",
".",
"class",
")",
"{",
"extendedClasses",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"superclass",
")",
")",
";",
"}",
"}",
"}",
"//Class::getInterfaces() gets only interfaces/classes implemented/extended directly by a given class.\r",
"//We need to walk the whole way up the tree.\r",
"return",
"(",
"Class",
"[",
"]",
")",
"ArrayUtils",
".",
"addAll",
"(",
"classes",
",",
"getAllInterfacesAndClasses",
"(",
"extendedClasses",
".",
"toArray",
"(",
"new",
"Class",
"[",
"extendedClasses",
".",
"size",
"(",
")",
"]",
")",
")",
")",
";",
"}",
"}"
] |
possibly contain the declaration of the annotated method we're looking for.
|
[
"possibly",
"contain",
"the",
"declaration",
"of",
"the",
"annotated",
"method",
"we",
"re",
"looking",
"for",
"."
] |
7453ced475355bac8adae7605e259354e0a96479
|
https://github.com/kametic/specifications/blob/7453ced475355bac8adae7605e259354e0a96479/src/main/java/org/kametic/specifications/reflect/ClassMethodsAnnotatedWith.java#L77-L108
|
154,316
|
tsweets/jdefault
|
src/main/java/org/beer30/jdefault/JDefaultIdentity.java
|
JDefaultIdentity.driversLicense
|
public static String driversLicense() {
StringBuffer dl = new StringBuffer(JDefaultAddress.stateAbbr());
dl.append("-");
dl.append(JDefaultNumber.randomNumberString(8));
return dl.toString();
}
|
java
|
public static String driversLicense() {
StringBuffer dl = new StringBuffer(JDefaultAddress.stateAbbr());
dl.append("-");
dl.append(JDefaultNumber.randomNumberString(8));
return dl.toString();
}
|
[
"public",
"static",
"String",
"driversLicense",
"(",
")",
"{",
"StringBuffer",
"dl",
"=",
"new",
"StringBuffer",
"(",
"JDefaultAddress",
".",
"stateAbbr",
"(",
")",
")",
";",
"dl",
".",
"append",
"(",
"\"-\"",
")",
";",
"dl",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomNumberString",
"(",
"8",
")",
")",
";",
"return",
"dl",
".",
"toString",
"(",
")",
";",
"}"
] |
Creates a Driver's license in the format of 2 Letter State Code, Dash, 8 Digit Random Number
ie CO-12345678
@return driver's license string
|
[
"Creates",
"a",
"Driver",
"s",
"license",
"in",
"the",
"format",
"of",
"2",
"Letter",
"State",
"Code",
"Dash",
"8",
"Digit",
"Random",
"Number",
"ie",
"CO",
"-",
"12345678"
] |
1793ab8e1337e930f31e362071db4af0c3978b70
|
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultIdentity.java#L63-L69
|
154,317
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.free
|
public void free()
{
if (m_messageReceiver != null)
m_messageReceiver.removeMessageFilter(this, false); // Remove from this and don't free again
m_messageReceiver = null;
while (this.getMessageListener(0) != null)
{
JMessageListener listener = this.getMessageListener(0);
this.removeFilterMessageListener(listener);
}
if (m_vListenerList != null)
m_vListenerList.clear();
m_vListenerList = null;
super.free();
m_intID = null;
}
|
java
|
public void free()
{
if (m_messageReceiver != null)
m_messageReceiver.removeMessageFilter(this, false); // Remove from this and don't free again
m_messageReceiver = null;
while (this.getMessageListener(0) != null)
{
JMessageListener listener = this.getMessageListener(0);
this.removeFilterMessageListener(listener);
}
if (m_vListenerList != null)
m_vListenerList.clear();
m_vListenerList = null;
super.free();
m_intID = null;
}
|
[
"public",
"void",
"free",
"(",
")",
"{",
"if",
"(",
"m_messageReceiver",
"!=",
"null",
")",
"m_messageReceiver",
".",
"removeMessageFilter",
"(",
"this",
",",
"false",
")",
";",
"// Remove from this and don't free again",
"m_messageReceiver",
"=",
"null",
";",
"while",
"(",
"this",
".",
"getMessageListener",
"(",
"0",
")",
"!=",
"null",
")",
"{",
"JMessageListener",
"listener",
"=",
"this",
".",
"getMessageListener",
"(",
"0",
")",
";",
"this",
".",
"removeFilterMessageListener",
"(",
"listener",
")",
";",
"}",
"if",
"(",
"m_vListenerList",
"!=",
"null",
")",
"m_vListenerList",
".",
"clear",
"(",
")",
";",
"m_vListenerList",
"=",
"null",
";",
"super",
".",
"free",
"(",
")",
";",
"m_intID",
"=",
"null",
";",
"}"
] |
Free this object.
If I belong to a message listener, set my reference to null, and free the listener.
If I belong to a messagereceiver, remove this filter from it.
|
[
"Free",
"this",
"object",
".",
"If",
"I",
"belong",
"to",
"a",
"message",
"listener",
"set",
"my",
"reference",
"to",
"null",
"and",
"free",
"the",
"listener",
".",
"If",
"I",
"belong",
"to",
"a",
"messagereceiver",
"remove",
"this",
"filter",
"from",
"it",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L126-L143
|
154,318
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.setRemoteFilterInfo
|
public void setRemoteFilterInfo(String strRemoteQueueName, String strRemoteQueueType, Integer intRemoteQueueID, Integer intRegistryID)
{
m_strRemoteQueueName = strRemoteQueueName;
m_strRemoteQueueType = strRemoteQueueType;
m_intRemoteID = intRemoteQueueID;
m_intRegistryID = intRegistryID;
}
|
java
|
public void setRemoteFilterInfo(String strRemoteQueueName, String strRemoteQueueType, Integer intRemoteQueueID, Integer intRegistryID)
{
m_strRemoteQueueName = strRemoteQueueName;
m_strRemoteQueueType = strRemoteQueueType;
m_intRemoteID = intRemoteQueueID;
m_intRegistryID = intRegistryID;
}
|
[
"public",
"void",
"setRemoteFilterInfo",
"(",
"String",
"strRemoteQueueName",
",",
"String",
"strRemoteQueueType",
",",
"Integer",
"intRemoteQueueID",
",",
"Integer",
"intRegistryID",
")",
"{",
"m_strRemoteQueueName",
"=",
"strRemoteQueueName",
";",
"m_strRemoteQueueType",
"=",
"strRemoteQueueType",
";",
"m_intRemoteID",
"=",
"intRemoteQueueID",
";",
"m_intRegistryID",
"=",
"intRegistryID",
";",
"}"
] |
Set the links to the remote filter.
@param strRemoteQueueName The remote queue name.
@param strRemoteQueueType The remote queue type.
@param intRemoteQueueID The remote queue ID.
|
[
"Set",
"the",
"links",
"to",
"the",
"remote",
"filter",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L208-L214
|
154,319
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.addMessageListener
|
public void addMessageListener(JMessageListener listener)
{
if (listener == null)
return; // Never
this.removeDuplicateFilters(listener); // Remove any duplicate record filters
if (m_vListenerList == null)
m_vListenerList = new Vector<JMessageListener>();
for (int i = 0; i < m_vListenerList.size(); i++)
{
if (m_vListenerList.get(i) == listener)
{
Util.getLogger().warning("--------Error-Added message listener twice--------");
return; // I'm sure you didn't mean to do that.
}
}
m_vListenerList.add(listener);
listener.addListenerMessageFilter(this);
}
|
java
|
public void addMessageListener(JMessageListener listener)
{
if (listener == null)
return; // Never
this.removeDuplicateFilters(listener); // Remove any duplicate record filters
if (m_vListenerList == null)
m_vListenerList = new Vector<JMessageListener>();
for (int i = 0; i < m_vListenerList.size(); i++)
{
if (m_vListenerList.get(i) == listener)
{
Util.getLogger().warning("--------Error-Added message listener twice--------");
return; // I'm sure you didn't mean to do that.
}
}
m_vListenerList.add(listener);
listener.addListenerMessageFilter(this);
}
|
[
"public",
"void",
"addMessageListener",
"(",
"JMessageListener",
"listener",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"return",
";",
"// Never",
"this",
".",
"removeDuplicateFilters",
"(",
"listener",
")",
";",
"// Remove any duplicate record filters",
"if",
"(",
"m_vListenerList",
"==",
"null",
")",
"m_vListenerList",
"=",
"new",
"Vector",
"<",
"JMessageListener",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_vListenerList",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"m_vListenerList",
".",
"get",
"(",
"i",
")",
"==",
"listener",
")",
"{",
"Util",
".",
"getLogger",
"(",
")",
".",
"warning",
"(",
"\"--------Error-Added message listener twice--------\"",
")",
";",
"return",
";",
"// I'm sure you didn't mean to do that.",
"}",
"}",
"m_vListenerList",
".",
"add",
"(",
"listener",
")",
";",
"listener",
".",
"addListenerMessageFilter",
"(",
"this",
")",
";",
"}"
] |
Add this message listener to the listener list.
Also adds the filter to my filter list.
@param listener The message listener to set this filter to.
|
[
"Add",
"this",
"message",
"listener",
"to",
"the",
"listener",
"list",
".",
"Also",
"adds",
"the",
"filter",
"to",
"my",
"filter",
"list",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L284-L301
|
154,320
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.removeDuplicateFilters
|
public void removeDuplicateFilters(JMessageListener listenerToCheck)
{
for (int iIndex = 0; ; iIndex++)
{
BaseMessageFilter filter = listenerToCheck.getListenerMessageFilter(iIndex);
if (filter == null)
break;
if (this.isSameFilter(filter))
{
if (filter.getMessageListener(1) == null)
{ // Only free if the message list is the same and only
filter.removeFilterMessageListener(listenerToCheck);
// DO NOT free the listener.
filter.free(); // Cool, it was a dup... get rid of it.
iIndex--;
}
}
}
}
|
java
|
public void removeDuplicateFilters(JMessageListener listenerToCheck)
{
for (int iIndex = 0; ; iIndex++)
{
BaseMessageFilter filter = listenerToCheck.getListenerMessageFilter(iIndex);
if (filter == null)
break;
if (this.isSameFilter(filter))
{
if (filter.getMessageListener(1) == null)
{ // Only free if the message list is the same and only
filter.removeFilterMessageListener(listenerToCheck);
// DO NOT free the listener.
filter.free(); // Cool, it was a dup... get rid of it.
iIndex--;
}
}
}
}
|
[
"public",
"void",
"removeDuplicateFilters",
"(",
"JMessageListener",
"listenerToCheck",
")",
"{",
"for",
"(",
"int",
"iIndex",
"=",
"0",
";",
";",
"iIndex",
"++",
")",
"{",
"BaseMessageFilter",
"filter",
"=",
"listenerToCheck",
".",
"getListenerMessageFilter",
"(",
"iIndex",
")",
";",
"if",
"(",
"filter",
"==",
"null",
")",
"break",
";",
"if",
"(",
"this",
".",
"isSameFilter",
"(",
"filter",
")",
")",
"{",
"if",
"(",
"filter",
".",
"getMessageListener",
"(",
"1",
")",
"==",
"null",
")",
"{",
"// Only free if the message list is the same and only",
"filter",
".",
"removeFilterMessageListener",
"(",
"listenerToCheck",
")",
";",
"// DO NOT free the listener.",
"filter",
".",
"free",
"(",
")",
";",
"// Cool, it was a dup... get rid of it.",
"iIndex",
"--",
";",
"}",
"}",
"}",
"}"
] |
If there is another RecordMessageFilter supplying messages to this listener, remove it.
This typically fixes the problem in TableModelSession where a grid listener is added for the session and then also when thin needs a listener
@param listenerToCheck
|
[
"If",
"there",
"is",
"another",
"RecordMessageFilter",
"supplying",
"messages",
"to",
"this",
"listener",
"remove",
"it",
".",
"This",
"typically",
"fixes",
"the",
"problem",
"in",
"TableModelSession",
"where",
"a",
"grid",
"listener",
"is",
"added",
"for",
"the",
"session",
"and",
"then",
"also",
"when",
"thin",
"needs",
"a",
"listener"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L307-L325
|
154,321
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.isSameFilter
|
public boolean isSameFilter(BaseMessageFilter filter)
{
if (filter.getClass().equals(this.getClass()))
{
if (filter.isFilterMatch(this))
; // return true;? todo (don) You need to figure out how to compare filters
}
return false;
}
|
java
|
public boolean isSameFilter(BaseMessageFilter filter)
{
if (filter.getClass().equals(this.getClass()))
{
if (filter.isFilterMatch(this))
; // return true;? todo (don) You need to figure out how to compare filters
}
return false;
}
|
[
"public",
"boolean",
"isSameFilter",
"(",
"BaseMessageFilter",
"filter",
")",
"{",
"if",
"(",
"filter",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"this",
".",
"getClass",
"(",
")",
")",
")",
"{",
"if",
"(",
"filter",
".",
"isFilterMatch",
"(",
"this",
")",
")",
";",
"// return true;? todo (don) You need to figure out how to compare filters",
"}",
"return",
"false",
";",
"}"
] |
Are these filters functionally the same?
Override this to compare filters.
@return true if they are.
|
[
"Are",
"these",
"filters",
"functionally",
"the",
"same?",
"Override",
"this",
"to",
"compare",
"filters",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L331-L339
|
154,322
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.removeFilterMessageListener
|
public void removeFilterMessageListener(JMessageListener listener)
{
if (listener == null)
return; // Never
if (m_vListenerList == null)
return; // Never
for (int i = 0; i < m_vListenerList.size(); i++)
{
if (m_vListenerList.get(i) == listener)
m_vListenerList.remove(i); // Does this work?
}
listener.removeListenerMessageFilter(this);
}
|
java
|
public void removeFilterMessageListener(JMessageListener listener)
{
if (listener == null)
return; // Never
if (m_vListenerList == null)
return; // Never
for (int i = 0; i < m_vListenerList.size(); i++)
{
if (m_vListenerList.get(i) == listener)
m_vListenerList.remove(i); // Does this work?
}
listener.removeListenerMessageFilter(this);
}
|
[
"public",
"void",
"removeFilterMessageListener",
"(",
"JMessageListener",
"listener",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"return",
";",
"// Never",
"if",
"(",
"m_vListenerList",
"==",
"null",
")",
"return",
";",
"// Never",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_vListenerList",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"m_vListenerList",
".",
"get",
"(",
"i",
")",
"==",
"listener",
")",
"m_vListenerList",
".",
"remove",
"(",
"i",
")",
";",
"// Does this work?",
"}",
"listener",
".",
"removeListenerMessageFilter",
"(",
"this",
")",
";",
"}"
] |
Set the message listener.
@param listener The message listener to set this filter to.
|
[
"Set",
"the",
"message",
"listener",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L344-L356
|
154,323
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.getMessageListener
|
public JMessageListener getMessageListener(int iIndex)
{
if (m_vListenerList == null)
return null;
if (iIndex >= m_vListenerList.size())
return null;
return m_vListenerList.get(iIndex);
}
|
java
|
public JMessageListener getMessageListener(int iIndex)
{
if (m_vListenerList == null)
return null;
if (iIndex >= m_vListenerList.size())
return null;
return m_vListenerList.get(iIndex);
}
|
[
"public",
"JMessageListener",
"getMessageListener",
"(",
"int",
"iIndex",
")",
"{",
"if",
"(",
"m_vListenerList",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"iIndex",
">=",
"m_vListenerList",
".",
"size",
"(",
")",
")",
"return",
"null",
";",
"return",
"m_vListenerList",
".",
"get",
"(",
"iIndex",
")",
";",
"}"
] |
Get the message listener for this filter.
@return The listener.
|
[
"Get",
"the",
"message",
"listener",
"for",
"this",
"filter",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L361-L368
|
154,324
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.setMessageReceiver
|
public void setMessageReceiver(BaseMessageReceiver messageReceiver, Integer intID)
{
if ((messageReceiver != null) || (intID != null))
if ((m_intID != null) || (m_messageReceiver != null))
Util.getLogger().warning("BaseMessageFilter/setMessageReceiver()----Error - Filter added twice.");
m_messageReceiver = messageReceiver;
m_intID = intID;
}
|
java
|
public void setMessageReceiver(BaseMessageReceiver messageReceiver, Integer intID)
{
if ((messageReceiver != null) || (intID != null))
if ((m_intID != null) || (m_messageReceiver != null))
Util.getLogger().warning("BaseMessageFilter/setMessageReceiver()----Error - Filter added twice.");
m_messageReceiver = messageReceiver;
m_intID = intID;
}
|
[
"public",
"void",
"setMessageReceiver",
"(",
"BaseMessageReceiver",
"messageReceiver",
",",
"Integer",
"intID",
")",
"{",
"if",
"(",
"(",
"messageReceiver",
"!=",
"null",
")",
"||",
"(",
"intID",
"!=",
"null",
")",
")",
"if",
"(",
"(",
"m_intID",
"!=",
"null",
")",
"||",
"(",
"m_messageReceiver",
"!=",
"null",
")",
")",
"Util",
".",
"getLogger",
"(",
")",
".",
"warning",
"(",
"\"BaseMessageFilter/setMessageReceiver()----Error - Filter added twice.\"",
")",
";",
"m_messageReceiver",
"=",
"messageReceiver",
";",
"m_intID",
"=",
"intID",
";",
"}"
] |
Set the message receiver for this filter.
@param messageReceiver The message receiver.
|
[
"Set",
"the",
"message",
"receiver",
"for",
"this",
"filter",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L373-L380
|
154,325
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.updateFilterMap
|
public final void updateFilterMap(Map<String,Object> propFilter)
{
if (propFilter == null)
propFilter = new HashMap<String,Object>(); // Then handleUpdateFilterMap can modify the filter
propFilter = this.handleUpdateFilterMap(propFilter); // Update this object's local filter.
this.setFilterMap(propFilter); // Update any remote copy of this.
}
|
java
|
public final void updateFilterMap(Map<String,Object> propFilter)
{
if (propFilter == null)
propFilter = new HashMap<String,Object>(); // Then handleUpdateFilterMap can modify the filter
propFilter = this.handleUpdateFilterMap(propFilter); // Update this object's local filter.
this.setFilterMap(propFilter); // Update any remote copy of this.
}
|
[
"public",
"final",
"void",
"updateFilterMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"propFilter",
")",
"{",
"if",
"(",
"propFilter",
"==",
"null",
")",
"propFilter",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"// Then handleUpdateFilterMap can modify the filter",
"propFilter",
"=",
"this",
".",
"handleUpdateFilterMap",
"(",
"propFilter",
")",
";",
"// Update this object's local filter.",
"this",
".",
"setFilterMap",
"(",
"propFilter",
")",
";",
"// Update any remote copy of this.",
"}"
] |
Update this object's filter with this new map information.
@param propFilter New filter information (ie, bookmark=345) pass null to sync the local and remote filters.
|
[
"Update",
"this",
"object",
"s",
"filter",
"with",
"this",
"new",
"map",
"information",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L435-L441
|
154,326
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.setFilterMap
|
public final void setFilterMap(Map<String, Object> propFilter)
{
if (this.getMessageReceiver() != null)
this.getMessageReceiver().setNewFilterProperties(this, null, propFilter); // Update any remote copy of this.
}
|
java
|
public final void setFilterMap(Map<String, Object> propFilter)
{
if (this.getMessageReceiver() != null)
this.getMessageReceiver().setNewFilterProperties(this, null, propFilter); // Update any remote copy of this.
}
|
[
"public",
"final",
"void",
"setFilterMap",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"propFilter",
")",
"{",
"if",
"(",
"this",
".",
"getMessageReceiver",
"(",
")",
"!=",
"null",
")",
"this",
".",
"getMessageReceiver",
"(",
")",
".",
"setNewFilterProperties",
"(",
"this",
",",
"null",
",",
"propFilter",
")",
";",
"// Update any remote copy of this.",
"}"
] |
Update the remote filter with this new map information.
@param propFilter New filter information (ie, bookmark=345).
|
[
"Update",
"the",
"remote",
"filter",
"with",
"this",
"new",
"map",
"information",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L478-L482
|
154,327
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java
|
BaseMessageFilter.setFilterTree
|
public final void setFilterTree(Object[][] mxProperties)
{
if (this.getMessageReceiver() != null)
this.getMessageReceiver().setNewFilterProperties(this, mxProperties, null); // Update any remote copy of this.
else
this.setNameValueTree(mxProperties); // Rarely called (typically during initialization - before the receiver is set up)
}
|
java
|
public final void setFilterTree(Object[][] mxProperties)
{
if (this.getMessageReceiver() != null)
this.getMessageReceiver().setNewFilterProperties(this, mxProperties, null); // Update any remote copy of this.
else
this.setNameValueTree(mxProperties); // Rarely called (typically during initialization - before the receiver is set up)
}
|
[
"public",
"final",
"void",
"setFilterTree",
"(",
"Object",
"[",
"]",
"[",
"]",
"mxProperties",
")",
"{",
"if",
"(",
"this",
".",
"getMessageReceiver",
"(",
")",
"!=",
"null",
")",
"this",
".",
"getMessageReceiver",
"(",
")",
".",
"setNewFilterProperties",
"(",
"this",
",",
"mxProperties",
",",
"null",
")",
";",
"// Update any remote copy of this.",
"else",
"this",
".",
"setNameValueTree",
"(",
"mxProperties",
")",
";",
"// Rarely called (typically during initialization - before the receiver is set up)",
"}"
] |
Update this filter and the remote filter with this new key tree.
@param mxProperties New tree filter.
|
[
"Update",
"this",
"filter",
"and",
"the",
"remote",
"filter",
"with",
"this",
"new",
"key",
"tree",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageFilter.java#L487-L493
|
154,328
|
js-lib-com/commons
|
src/main/java/js/io/FilesInputStream.java
|
FilesInputStream.getMeta
|
public <T> T getMeta(String key, Class<T> type) {
return ConverterRegistry.getConverter().asObject(getMeta(key), type);
}
|
java
|
public <T> T getMeta(String key, Class<T> type) {
return ConverterRegistry.getConverter().asObject(getMeta(key), type);
}
|
[
"public",
"<",
"T",
">",
"T",
"getMeta",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"ConverterRegistry",
".",
"getConverter",
"(",
")",
".",
"asObject",
"(",
"getMeta",
"(",
"key",
")",
",",
"type",
")",
";",
"}"
] |
Get files archive meta data converted to requested type.
@param key meta data key,
@param type type to convert meta data value to.
@param <T> meta data type.
@return meta data value converted to type.
@throws InvalidFilesArchiveException if requested meta data key does not exists.
|
[
"Get",
"files",
"archive",
"meta",
"data",
"converted",
"to",
"requested",
"type",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesInputStream.java#L187-L189
|
154,329
|
js-lib-com/commons
|
src/main/java/js/io/FilesInputStream.java
|
FilesInputStream.getMeta
|
public <T> T getMeta(String key, Class<T> type, T defaultValue) {
String value = manifest.getMainAttributes().getValue(key);
return value == null ? defaultValue : ConverterRegistry.getConverter().asObject(value, type);
}
|
java
|
public <T> T getMeta(String key, Class<T> type, T defaultValue) {
String value = manifest.getMainAttributes().getValue(key);
return value == null ? defaultValue : ConverterRegistry.getConverter().asObject(value, type);
}
|
[
"public",
"<",
"T",
">",
"T",
"getMeta",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"getValue",
"(",
"key",
")",
";",
"return",
"value",
"==",
"null",
"?",
"defaultValue",
":",
"ConverterRegistry",
".",
"getConverter",
"(",
")",
".",
"asObject",
"(",
"value",
",",
"type",
")",
";",
"}"
] |
Get files archive meta data converted to requested type or default value if meta data key is missing.
@param key meta data key,
@param type type to convert meta data value to,
@param defaultValue default value returned if key not found.
@param <T> meta data type.
@return meta data value converted to type or default value.
|
[
"Get",
"files",
"archive",
"meta",
"data",
"converted",
"to",
"requested",
"type",
"or",
"default",
"value",
"if",
"meta",
"data",
"key",
"is",
"missing",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesInputStream.java#L200-L203
|
154,330
|
pressgang-ccms/PressGangCCMSQuery
|
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
|
BaseFilterQueryBuilder.addSizeGreaterThanOrEqualToCondition
|
protected void addSizeGreaterThanOrEqualToCondition(final String propertyName, final Integer size) {
final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class));
fieldConditions.add(getCriteriaBuilder().ge(propertySizeExpression, size));
}
|
java
|
protected void addSizeGreaterThanOrEqualToCondition(final String propertyName, final Integer size) {
final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class));
fieldConditions.add(getCriteriaBuilder().ge(propertySizeExpression, size));
}
|
[
"protected",
"void",
"addSizeGreaterThanOrEqualToCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Integer",
"size",
")",
"{",
"final",
"Expression",
"<",
"Integer",
">",
"propertySizeExpression",
"=",
"getCriteriaBuilder",
"(",
")",
".",
"size",
"(",
"getRootPath",
"(",
")",
".",
"get",
"(",
"propertyName",
")",
".",
"as",
"(",
"Set",
".",
"class",
")",
")",
";",
"fieldConditions",
".",
"add",
"(",
"getCriteriaBuilder",
"(",
")",
".",
"ge",
"(",
"propertySizeExpression",
",",
"size",
")",
")",
";",
"}"
] |
Add a Field Search Condition that will check if the size of a collection in an entity is greater than or equal to the
specified size.
@param propertyName The name of the collection as defined in the Entity mapping class.
@param size The size that the collection should be greater than or equal to.
|
[
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"check",
"if",
"the",
"size",
"of",
"a",
"collection",
"in",
"an",
"entity",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"specified",
"size",
"."
] |
2bb23430adab956737d0301cd2ea933f986dd85b
|
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L247-L250
|
154,331
|
pressgang-ccms/PressGangCCMSQuery
|
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
|
BaseFilterQueryBuilder.addSizeGreaterThanCondition
|
protected void addSizeGreaterThanCondition(final String propertyName, final Integer size) {
final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class));
fieldConditions.add(getCriteriaBuilder().gt(propertySizeExpression, size));
}
|
java
|
protected void addSizeGreaterThanCondition(final String propertyName, final Integer size) {
final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class));
fieldConditions.add(getCriteriaBuilder().gt(propertySizeExpression, size));
}
|
[
"protected",
"void",
"addSizeGreaterThanCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Integer",
"size",
")",
"{",
"final",
"Expression",
"<",
"Integer",
">",
"propertySizeExpression",
"=",
"getCriteriaBuilder",
"(",
")",
".",
"size",
"(",
"getRootPath",
"(",
")",
".",
"get",
"(",
"propertyName",
")",
".",
"as",
"(",
"Set",
".",
"class",
")",
")",
";",
"fieldConditions",
".",
"add",
"(",
"getCriteriaBuilder",
"(",
")",
".",
"gt",
"(",
"propertySizeExpression",
",",
"size",
")",
")",
";",
"}"
] |
Add a Field Search Condition that will check if the size of a collection in an entity is greater than the specified size.
@param propertyName The name of the collection as defined in the Entity mapping class.
@param size The size that the collection should be greater than.
|
[
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"check",
"if",
"the",
"size",
"of",
"a",
"collection",
"in",
"an",
"entity",
"is",
"greater",
"than",
"the",
"specified",
"size",
"."
] |
2bb23430adab956737d0301cd2ea933f986dd85b
|
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L258-L261
|
154,332
|
pressgang-ccms/PressGangCCMSQuery
|
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
|
BaseFilterQueryBuilder.addSizeLessThanOrEqualToCondition
|
protected void addSizeLessThanOrEqualToCondition(final String propertyName, final Integer size) {
final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class));
fieldConditions.add(getCriteriaBuilder().le(propertySizeExpression, size));
}
|
java
|
protected void addSizeLessThanOrEqualToCondition(final String propertyName, final Integer size) {
final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class));
fieldConditions.add(getCriteriaBuilder().le(propertySizeExpression, size));
}
|
[
"protected",
"void",
"addSizeLessThanOrEqualToCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Integer",
"size",
")",
"{",
"final",
"Expression",
"<",
"Integer",
">",
"propertySizeExpression",
"=",
"getCriteriaBuilder",
"(",
")",
".",
"size",
"(",
"getRootPath",
"(",
")",
".",
"get",
"(",
"propertyName",
")",
".",
"as",
"(",
"Set",
".",
"class",
")",
")",
";",
"fieldConditions",
".",
"add",
"(",
"getCriteriaBuilder",
"(",
")",
".",
"le",
"(",
"propertySizeExpression",
",",
"size",
")",
")",
";",
"}"
] |
Add a Field Search Condition that will check if the size of a collection in an entity is less than or equal to the
specified size.
@param propertyName The name of the collection as defined in the Entity mapping class.
@param size The size that the collection should be less than or equal to.
|
[
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"check",
"if",
"the",
"size",
"of",
"a",
"collection",
"in",
"an",
"entity",
"is",
"less",
"than",
"or",
"equal",
"to",
"the",
"specified",
"size",
"."
] |
2bb23430adab956737d0301cd2ea933f986dd85b
|
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L270-L273
|
154,333
|
pressgang-ccms/PressGangCCMSQuery
|
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
|
BaseFilterQueryBuilder.addSizeLessThanCondition
|
protected void addSizeLessThanCondition(final String propertyName, final Integer size) {
final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class));
fieldConditions.add(getCriteriaBuilder().lt(propertySizeExpression, size));
}
|
java
|
protected void addSizeLessThanCondition(final String propertyName, final Integer size) {
final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class));
fieldConditions.add(getCriteriaBuilder().lt(propertySizeExpression, size));
}
|
[
"protected",
"void",
"addSizeLessThanCondition",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Integer",
"size",
")",
"{",
"final",
"Expression",
"<",
"Integer",
">",
"propertySizeExpression",
"=",
"getCriteriaBuilder",
"(",
")",
".",
"size",
"(",
"getRootPath",
"(",
")",
".",
"get",
"(",
"propertyName",
")",
".",
"as",
"(",
"Set",
".",
"class",
")",
")",
";",
"fieldConditions",
".",
"add",
"(",
"getCriteriaBuilder",
"(",
")",
".",
"lt",
"(",
"propertySizeExpression",
",",
"size",
")",
")",
";",
"}"
] |
Add a Field Search Condition that will check if the size of a collection in an entity is less than the specified size.
@param propertyName The name of the collection as defined in the Entity mapping class.
@param size The size that the collection should be less than.
|
[
"Add",
"a",
"Field",
"Search",
"Condition",
"that",
"will",
"check",
"if",
"the",
"size",
"of",
"a",
"collection",
"in",
"an",
"entity",
"is",
"less",
"than",
"the",
"specified",
"size",
"."
] |
2bb23430adab956737d0301cd2ea933f986dd85b
|
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L281-L284
|
154,334
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
|
BaseTable.free
|
public void free()
{
int iOldEditMode = 0;
if (m_record != null) // First, release the record for this table
{
iOldEditMode = this.getRecord().getEditMode();
this.getRecord().setEditMode(iOldEditMode | DBConstants.EDIT_CLOSE_IN_FREE); // This is a cludge... signals tables that this is the last close()!
}
this.close();
if (m_record != null) // First, release the record for this table
this.getRecord().setEditMode(iOldEditMode); // This is a cludge... signals tables that this is the last close()!
super.free(); // Set the record's table reference to null.
if (m_database != null)
m_database.removeTable(this);
m_database = null;
m_dataSource = null;
m_objectID = null;
}
|
java
|
public void free()
{
int iOldEditMode = 0;
if (m_record != null) // First, release the record for this table
{
iOldEditMode = this.getRecord().getEditMode();
this.getRecord().setEditMode(iOldEditMode | DBConstants.EDIT_CLOSE_IN_FREE); // This is a cludge... signals tables that this is the last close()!
}
this.close();
if (m_record != null) // First, release the record for this table
this.getRecord().setEditMode(iOldEditMode); // This is a cludge... signals tables that this is the last close()!
super.free(); // Set the record's table reference to null.
if (m_database != null)
m_database.removeTable(this);
m_database = null;
m_dataSource = null;
m_objectID = null;
}
|
[
"public",
"void",
"free",
"(",
")",
"{",
"int",
"iOldEditMode",
"=",
"0",
";",
"if",
"(",
"m_record",
"!=",
"null",
")",
"// First, release the record for this table",
"{",
"iOldEditMode",
"=",
"this",
".",
"getRecord",
"(",
")",
".",
"getEditMode",
"(",
")",
";",
"this",
".",
"getRecord",
"(",
")",
".",
"setEditMode",
"(",
"iOldEditMode",
"|",
"DBConstants",
".",
"EDIT_CLOSE_IN_FREE",
")",
";",
"// This is a cludge... signals tables that this is the last close()!",
"}",
"this",
".",
"close",
"(",
")",
";",
"if",
"(",
"m_record",
"!=",
"null",
")",
"// First, release the record for this table",
"this",
".",
"getRecord",
"(",
")",
".",
"setEditMode",
"(",
"iOldEditMode",
")",
";",
"// This is a cludge... signals tables that this is the last close()!",
"super",
".",
"free",
"(",
")",
";",
"// Set the record's table reference to null.",
"if",
"(",
"m_database",
"!=",
"null",
")",
"m_database",
".",
"removeTable",
"(",
"this",
")",
";",
"m_database",
"=",
"null",
";",
"m_dataSource",
"=",
"null",
";",
"m_objectID",
"=",
"null",
";",
"}"
] |
Free this table object.
Don't call this directly, freeing the record will free the table correctly.
You never know, another table may have been added to the table chain.
First, closes this table, then removes me from the database.
|
[
"Free",
"this",
"table",
"object",
".",
"Don",
"t",
"call",
"this",
"directly",
"freeing",
"the",
"record",
"will",
"free",
"the",
"table",
"correctly",
".",
"You",
"never",
"know",
"another",
"table",
"may",
"have",
"been",
"added",
"to",
"the",
"table",
"chain",
".",
"First",
"closes",
"this",
"table",
"then",
"removes",
"me",
"from",
"the",
"database",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L144-L163
|
154,335
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
|
BaseTable.addListener
|
public void addListener(Record record, FileListener listener)
{
record.doAddListener(listener);
boolean bOldState = listener.setEnabledListener(false); // To disable recursive forever loop!
BaseListener nextListener = listener.setNextListener(null); // Make sure this is the ONLY listener in the chain to get this call
if (record.getEditMode() == Constants.EDIT_ADD)
{
boolean[] rgbModified = this.getRecord().getModified();
listener.doNewRecord(DBConstants.DISPLAY);
this.getRecord().setModified(rgbModified); // Restore since doNew should not change modified fields.
}
else if ((record.getEditMode() == Constants.EDIT_IN_PROGRESS) || (record.getEditMode() == Constants.EDIT_CURRENT))
listener.doValidRecord(DBConstants.DISPLAY);
listener.setNextListener(nextListener);
listener.setEnabledListener(bOldState); // Renable the listener to eliminate echos
}
|
java
|
public void addListener(Record record, FileListener listener)
{
record.doAddListener(listener);
boolean bOldState = listener.setEnabledListener(false); // To disable recursive forever loop!
BaseListener nextListener = listener.setNextListener(null); // Make sure this is the ONLY listener in the chain to get this call
if (record.getEditMode() == Constants.EDIT_ADD)
{
boolean[] rgbModified = this.getRecord().getModified();
listener.doNewRecord(DBConstants.DISPLAY);
this.getRecord().setModified(rgbModified); // Restore since doNew should not change modified fields.
}
else if ((record.getEditMode() == Constants.EDIT_IN_PROGRESS) || (record.getEditMode() == Constants.EDIT_CURRENT))
listener.doValidRecord(DBConstants.DISPLAY);
listener.setNextListener(nextListener);
listener.setEnabledListener(bOldState); // Renable the listener to eliminate echos
}
|
[
"public",
"void",
"addListener",
"(",
"Record",
"record",
",",
"FileListener",
"listener",
")",
"{",
"record",
".",
"doAddListener",
"(",
"listener",
")",
";",
"boolean",
"bOldState",
"=",
"listener",
".",
"setEnabledListener",
"(",
"false",
")",
";",
"// To disable recursive forever loop!",
"BaseListener",
"nextListener",
"=",
"listener",
".",
"setNextListener",
"(",
"null",
")",
";",
"// Make sure this is the ONLY listener in the chain to get this call",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_ADD",
")",
"{",
"boolean",
"[",
"]",
"rgbModified",
"=",
"this",
".",
"getRecord",
"(",
")",
".",
"getModified",
"(",
")",
";",
"listener",
".",
"doNewRecord",
"(",
"DBConstants",
".",
"DISPLAY",
")",
";",
"this",
".",
"getRecord",
"(",
")",
".",
"setModified",
"(",
"rgbModified",
")",
";",
"// Restore since doNew should not change modified fields.",
"}",
"else",
"if",
"(",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_IN_PROGRESS",
")",
"||",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_CURRENT",
")",
")",
"listener",
".",
"doValidRecord",
"(",
"DBConstants",
".",
"DISPLAY",
")",
";",
"listener",
".",
"setNextListener",
"(",
"nextListener",
")",
";",
"listener",
".",
"setEnabledListener",
"(",
"bOldState",
")",
";",
"// Renable the listener to eliminate echos",
"}"
] |
Adding a file listener to the chain.
This just gives the table an ability to respond to listeners being added.
@param record TODO
@param listener The filter or listener to add to the chain.
|
[
"Adding",
"a",
"file",
"listener",
"to",
"the",
"chain",
".",
"This",
"just",
"gives",
"the",
"table",
"an",
"ability",
"to",
"respond",
"to",
"listeners",
"being",
"added",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L188-L203
|
154,336
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
|
BaseTable.getPhysicalTable
|
private BaseTable getPhysicalTable(PassThruTable table, Record record)
{
BaseTable altTable = table.getNextTable();
if (altTable instanceof PassThruTable)
{
BaseTable physicalTable = getPhysicalTable((PassThruTable)altTable, record);
if (physicalTable != null)
if (physicalTable != altTable)
return physicalTable;
}
else
if (altTable.getDatabase().getDatabaseName(true).equals(record.getTable().getDatabase().getDatabaseName(true)))
return altTable;
Iterator<BaseTable> tables = table.getTables();
while (tables.hasNext())
{
altTable = tables.next();
if (altTable instanceof PassThruTable)
{
BaseTable physicalTable = getPhysicalTable((PassThruTable)altTable, record);
if (physicalTable != null)
if (physicalTable != altTable)
return physicalTable;
}
else
if (altTable.getDatabase().getDatabaseName(true).equals(record.getTable().getDatabase().getDatabaseName(true)))
return altTable;
}
return table;
}
|
java
|
private BaseTable getPhysicalTable(PassThruTable table, Record record)
{
BaseTable altTable = table.getNextTable();
if (altTable instanceof PassThruTable)
{
BaseTable physicalTable = getPhysicalTable((PassThruTable)altTable, record);
if (physicalTable != null)
if (physicalTable != altTable)
return physicalTable;
}
else
if (altTable.getDatabase().getDatabaseName(true).equals(record.getTable().getDatabase().getDatabaseName(true)))
return altTable;
Iterator<BaseTable> tables = table.getTables();
while (tables.hasNext())
{
altTable = tables.next();
if (altTable instanceof PassThruTable)
{
BaseTable physicalTable = getPhysicalTable((PassThruTable)altTable, record);
if (physicalTable != null)
if (physicalTable != altTable)
return physicalTable;
}
else
if (altTable.getDatabase().getDatabaseName(true).equals(record.getTable().getDatabase().getDatabaseName(true)))
return altTable;
}
return table;
}
|
[
"private",
"BaseTable",
"getPhysicalTable",
"(",
"PassThruTable",
"table",
",",
"Record",
"record",
")",
"{",
"BaseTable",
"altTable",
"=",
"table",
".",
"getNextTable",
"(",
")",
";",
"if",
"(",
"altTable",
"instanceof",
"PassThruTable",
")",
"{",
"BaseTable",
"physicalTable",
"=",
"getPhysicalTable",
"(",
"(",
"PassThruTable",
")",
"altTable",
",",
"record",
")",
";",
"if",
"(",
"physicalTable",
"!=",
"null",
")",
"if",
"(",
"physicalTable",
"!=",
"altTable",
")",
"return",
"physicalTable",
";",
"}",
"else",
"if",
"(",
"altTable",
".",
"getDatabase",
"(",
")",
".",
"getDatabaseName",
"(",
"true",
")",
".",
"equals",
"(",
"record",
".",
"getTable",
"(",
")",
".",
"getDatabase",
"(",
")",
".",
"getDatabaseName",
"(",
"true",
")",
")",
")",
"return",
"altTable",
";",
"Iterator",
"<",
"BaseTable",
">",
"tables",
"=",
"table",
".",
"getTables",
"(",
")",
";",
"while",
"(",
"tables",
".",
"hasNext",
"(",
")",
")",
"{",
"altTable",
"=",
"tables",
".",
"next",
"(",
")",
";",
"if",
"(",
"altTable",
"instanceof",
"PassThruTable",
")",
"{",
"BaseTable",
"physicalTable",
"=",
"getPhysicalTable",
"(",
"(",
"PassThruTable",
")",
"altTable",
",",
"record",
")",
";",
"if",
"(",
"physicalTable",
"!=",
"null",
")",
"if",
"(",
"physicalTable",
"!=",
"altTable",
")",
"return",
"physicalTable",
";",
"}",
"else",
"if",
"(",
"altTable",
".",
"getDatabase",
"(",
")",
".",
"getDatabaseName",
"(",
"true",
")",
".",
"equals",
"(",
"record",
".",
"getTable",
"(",
")",
".",
"getDatabase",
"(",
")",
".",
"getDatabaseName",
"(",
"true",
")",
")",
")",
"return",
"altTable",
";",
"}",
"return",
"table",
";",
"}"
] |
Dig down and get the physical table for this record.
@param table
@param record
@return
|
[
"Dig",
"down",
"and",
"get",
"the",
"physical",
"table",
"for",
"this",
"record",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L1231-L1261
|
154,337
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
|
BaseTable.doHasPrevious
|
public boolean doHasPrevious()
{
if ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0)
return false; // Already at BOF (can't be one before)
if ((m_iRecordStatus & DBConstants.RECORD_PREVIOUS_PENDING) != 0)
return true; // Already one waiting
boolean bAtBOF = true;
try {
FieldList record = this.move(DBConstants.PREVIOUS_RECORD);
if (record == null)
bAtBOF = true;
else if ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0)
bAtBOF = true;
else if (this.isTable())
bAtBOF = this.isBOF();
else
bAtBOF = false; // Valid record!
} catch (DBException ex) {
ex.printStackTrace();
}
if (bAtBOF)
return false; // Does not have a next record
m_iRecordStatus |= DBConstants.RECORD_PREVIOUS_PENDING; // If next call is a moveNext(), return unchanged!
return true; // Yes, a next record exists.
}
|
java
|
public boolean doHasPrevious()
{
if ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0)
return false; // Already at BOF (can't be one before)
if ((m_iRecordStatus & DBConstants.RECORD_PREVIOUS_PENDING) != 0)
return true; // Already one waiting
boolean bAtBOF = true;
try {
FieldList record = this.move(DBConstants.PREVIOUS_RECORD);
if (record == null)
bAtBOF = true;
else if ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0)
bAtBOF = true;
else if (this.isTable())
bAtBOF = this.isBOF();
else
bAtBOF = false; // Valid record!
} catch (DBException ex) {
ex.printStackTrace();
}
if (bAtBOF)
return false; // Does not have a next record
m_iRecordStatus |= DBConstants.RECORD_PREVIOUS_PENDING; // If next call is a moveNext(), return unchanged!
return true; // Yes, a next record exists.
}
|
[
"public",
"boolean",
"doHasPrevious",
"(",
")",
"{",
"if",
"(",
"(",
"m_iRecordStatus",
"&",
"DBConstants",
".",
"RECORD_AT_BOF",
")",
"!=",
"0",
")",
"return",
"false",
";",
"// Already at BOF (can't be one before)",
"if",
"(",
"(",
"m_iRecordStatus",
"&",
"DBConstants",
".",
"RECORD_PREVIOUS_PENDING",
")",
"!=",
"0",
")",
"return",
"true",
";",
"// Already one waiting",
"boolean",
"bAtBOF",
"=",
"true",
";",
"try",
"{",
"FieldList",
"record",
"=",
"this",
".",
"move",
"(",
"DBConstants",
".",
"PREVIOUS_RECORD",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"bAtBOF",
"=",
"true",
";",
"else",
"if",
"(",
"(",
"m_iRecordStatus",
"&",
"DBConstants",
".",
"RECORD_AT_BOF",
")",
"!=",
"0",
")",
"bAtBOF",
"=",
"true",
";",
"else",
"if",
"(",
"this",
".",
"isTable",
"(",
")",
")",
"bAtBOF",
"=",
"this",
".",
"isBOF",
"(",
")",
";",
"else",
"bAtBOF",
"=",
"false",
";",
"// Valid record!",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"if",
"(",
"bAtBOF",
")",
"return",
"false",
";",
"// Does not have a next record",
"m_iRecordStatus",
"|=",
"DBConstants",
".",
"RECORD_PREVIOUS_PENDING",
";",
"// If next call is a moveNext(), return unchanged!",
"return",
"true",
";",
"// Yes, a next record exists.",
"}"
] |
Is the first record in the file?
@return false if file position is at first record.
|
[
"Is",
"the",
"first",
"record",
"in",
"the",
"file?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L1367-L1391
|
154,338
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
|
BaseTable.isBOF
|
public boolean isBOF()
{
boolean bFlag = ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0);
if (this.isTable())
{ // If this is a table, it can't handle starting and ending keys.. do it manually
if (bFlag)
return bFlag;
if (this.getRecord().getKeyArea(-1).isModified(DBConstants.START_SELECT_KEY))
{
if (!bFlag)
bFlag = this.getRecord().checkParams(DBConstants.START_SELECT_KEY);
if (bFlag)
m_iRecordStatus |= DBConstants.RECORD_AT_BOF; // At BOF
}
}
return bFlag;
}
|
java
|
public boolean isBOF()
{
boolean bFlag = ((m_iRecordStatus & DBConstants.RECORD_AT_BOF) != 0);
if (this.isTable())
{ // If this is a table, it can't handle starting and ending keys.. do it manually
if (bFlag)
return bFlag;
if (this.getRecord().getKeyArea(-1).isModified(DBConstants.START_SELECT_KEY))
{
if (!bFlag)
bFlag = this.getRecord().checkParams(DBConstants.START_SELECT_KEY);
if (bFlag)
m_iRecordStatus |= DBConstants.RECORD_AT_BOF; // At BOF
}
}
return bFlag;
}
|
[
"public",
"boolean",
"isBOF",
"(",
")",
"{",
"boolean",
"bFlag",
"=",
"(",
"(",
"m_iRecordStatus",
"&",
"DBConstants",
".",
"RECORD_AT_BOF",
")",
"!=",
"0",
")",
";",
"if",
"(",
"this",
".",
"isTable",
"(",
")",
")",
"{",
"// If this is a table, it can't handle starting and ending keys.. do it manually",
"if",
"(",
"bFlag",
")",
"return",
"bFlag",
";",
"if",
"(",
"this",
".",
"getRecord",
"(",
")",
".",
"getKeyArea",
"(",
"-",
"1",
")",
".",
"isModified",
"(",
"DBConstants",
".",
"START_SELECT_KEY",
")",
")",
"{",
"if",
"(",
"!",
"bFlag",
")",
"bFlag",
"=",
"this",
".",
"getRecord",
"(",
")",
".",
"checkParams",
"(",
"DBConstants",
".",
"START_SELECT_KEY",
")",
";",
"if",
"(",
"bFlag",
")",
"m_iRecordStatus",
"|=",
"DBConstants",
".",
"RECORD_AT_BOF",
";",
"// At BOF",
"}",
"}",
"return",
"bFlag",
";",
"}"
] |
Is the record at the Start of the file?
@return true if file position is one before the first record.
|
[
"Is",
"the",
"record",
"at",
"the",
"Start",
"of",
"the",
"file?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L1396-L1412
|
154,339
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
|
BaseTable.doHasNext
|
public boolean doHasNext() throws DBException
{
if ((m_iRecordStatus & DBConstants.RECORD_AT_EOF) != 0)
return false; // Already at EOF, can't be one after
if ((m_iRecordStatus & DBConstants.RECORD_NEXT_PENDING) != 0)
return true; // Already one waiting
boolean bAtEOF = true;
if (!this.isOpen())
this.open(); // Make sure any listeners are called before disabling.
Object[] rgobjEnabledFields = this.getRecord().setEnableNonFilter(null, false, false, false, false, true);
FieldList record = null;
try {
record = this.move(DBConstants.NEXT_RECORD);
if (record == null)
bAtEOF = true;
else if ((m_iRecordStatus & DBConstants.RECORD_AT_EOF) != 0)
bAtEOF = true;
else if (this.isTable())
bAtEOF = this.isEOF();
else
bAtEOF = false; // Valid record!
} catch (DBException ex) {
throw ex;
} finally {
this.getRecord().setEnableNonFilter(rgobjEnabledFields, false, false, false, bAtEOF, true);
}
if (bAtEOF)
return false; // Does not have a next record
m_iRecordStatus |= DBConstants.RECORD_NEXT_PENDING; // If next call is a moveNext(), return unchanged!
return true; // Yes, a next record exists.
}
|
java
|
public boolean doHasNext() throws DBException
{
if ((m_iRecordStatus & DBConstants.RECORD_AT_EOF) != 0)
return false; // Already at EOF, can't be one after
if ((m_iRecordStatus & DBConstants.RECORD_NEXT_PENDING) != 0)
return true; // Already one waiting
boolean bAtEOF = true;
if (!this.isOpen())
this.open(); // Make sure any listeners are called before disabling.
Object[] rgobjEnabledFields = this.getRecord().setEnableNonFilter(null, false, false, false, false, true);
FieldList record = null;
try {
record = this.move(DBConstants.NEXT_RECORD);
if (record == null)
bAtEOF = true;
else if ((m_iRecordStatus & DBConstants.RECORD_AT_EOF) != 0)
bAtEOF = true;
else if (this.isTable())
bAtEOF = this.isEOF();
else
bAtEOF = false; // Valid record!
} catch (DBException ex) {
throw ex;
} finally {
this.getRecord().setEnableNonFilter(rgobjEnabledFields, false, false, false, bAtEOF, true);
}
if (bAtEOF)
return false; // Does not have a next record
m_iRecordStatus |= DBConstants.RECORD_NEXT_PENDING; // If next call is a moveNext(), return unchanged!
return true; // Yes, a next record exists.
}
|
[
"public",
"boolean",
"doHasNext",
"(",
")",
"throws",
"DBException",
"{",
"if",
"(",
"(",
"m_iRecordStatus",
"&",
"DBConstants",
".",
"RECORD_AT_EOF",
")",
"!=",
"0",
")",
"return",
"false",
";",
"// Already at EOF, can't be one after",
"if",
"(",
"(",
"m_iRecordStatus",
"&",
"DBConstants",
".",
"RECORD_NEXT_PENDING",
")",
"!=",
"0",
")",
"return",
"true",
";",
"// Already one waiting",
"boolean",
"bAtEOF",
"=",
"true",
";",
"if",
"(",
"!",
"this",
".",
"isOpen",
"(",
")",
")",
"this",
".",
"open",
"(",
")",
";",
"// Make sure any listeners are called before disabling.",
"Object",
"[",
"]",
"rgobjEnabledFields",
"=",
"this",
".",
"getRecord",
"(",
")",
".",
"setEnableNonFilter",
"(",
"null",
",",
"false",
",",
"false",
",",
"false",
",",
"false",
",",
"true",
")",
";",
"FieldList",
"record",
"=",
"null",
";",
"try",
"{",
"record",
"=",
"this",
".",
"move",
"(",
"DBConstants",
".",
"NEXT_RECORD",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"bAtEOF",
"=",
"true",
";",
"else",
"if",
"(",
"(",
"m_iRecordStatus",
"&",
"DBConstants",
".",
"RECORD_AT_EOF",
")",
"!=",
"0",
")",
"bAtEOF",
"=",
"true",
";",
"else",
"if",
"(",
"this",
".",
"isTable",
"(",
")",
")",
"bAtEOF",
"=",
"this",
".",
"isEOF",
"(",
")",
";",
"else",
"bAtEOF",
"=",
"false",
";",
"// Valid record!",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"throw",
"ex",
";",
"}",
"finally",
"{",
"this",
".",
"getRecord",
"(",
")",
".",
"setEnableNonFilter",
"(",
"rgobjEnabledFields",
",",
"false",
",",
"false",
",",
"false",
",",
"bAtEOF",
",",
"true",
")",
";",
"}",
"if",
"(",
"bAtEOF",
")",
"return",
"false",
";",
"// Does not have a next record",
"m_iRecordStatus",
"|=",
"DBConstants",
".",
"RECORD_NEXT_PENDING",
";",
"// If next call is a moveNext(), return unchanged!",
"return",
"true",
";",
"// Yes, a next record exists.",
"}"
] |
Is the last record in the file?
@return false if file position is at last record.
|
[
"Is",
"the",
"last",
"record",
"in",
"the",
"file?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L1425-L1455
|
154,340
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
|
BaseTable.isEOF
|
public boolean isEOF()
{
boolean bFlag = ((m_iRecordStatus & DBConstants.RECORD_AT_EOF) != 0);
if (this.isTable())
{ // If this is a table, it can't handle starting and ending keys.. do it manually
if (bFlag)
return bFlag;
if (this.getRecord().getKeyArea(-1).isModified(DBConstants.END_SELECT_KEY))
{
if (!bFlag)
bFlag = this.getRecord().checkParams(DBConstants.END_SELECT_KEY);
if (bFlag)
m_iRecordStatus |= DBConstants.RECORD_AT_EOF; // At EOF
}
}
return bFlag;
}
|
java
|
public boolean isEOF()
{
boolean bFlag = ((m_iRecordStatus & DBConstants.RECORD_AT_EOF) != 0);
if (this.isTable())
{ // If this is a table, it can't handle starting and ending keys.. do it manually
if (bFlag)
return bFlag;
if (this.getRecord().getKeyArea(-1).isModified(DBConstants.END_SELECT_KEY))
{
if (!bFlag)
bFlag = this.getRecord().checkParams(DBConstants.END_SELECT_KEY);
if (bFlag)
m_iRecordStatus |= DBConstants.RECORD_AT_EOF; // At EOF
}
}
return bFlag;
}
|
[
"public",
"boolean",
"isEOF",
"(",
")",
"{",
"boolean",
"bFlag",
"=",
"(",
"(",
"m_iRecordStatus",
"&",
"DBConstants",
".",
"RECORD_AT_EOF",
")",
"!=",
"0",
")",
";",
"if",
"(",
"this",
".",
"isTable",
"(",
")",
")",
"{",
"// If this is a table, it can't handle starting and ending keys.. do it manually",
"if",
"(",
"bFlag",
")",
"return",
"bFlag",
";",
"if",
"(",
"this",
".",
"getRecord",
"(",
")",
".",
"getKeyArea",
"(",
"-",
"1",
")",
".",
"isModified",
"(",
"DBConstants",
".",
"END_SELECT_KEY",
")",
")",
"{",
"if",
"(",
"!",
"bFlag",
")",
"bFlag",
"=",
"this",
".",
"getRecord",
"(",
")",
".",
"checkParams",
"(",
"DBConstants",
".",
"END_SELECT_KEY",
")",
";",
"if",
"(",
"bFlag",
")",
"m_iRecordStatus",
"|=",
"DBConstants",
".",
"RECORD_AT_EOF",
";",
"// At EOF",
"}",
"}",
"return",
"bFlag",
";",
"}"
] |
Is the record at the End of the file?
@return true if file position is one after the last record.
|
[
"Is",
"the",
"record",
"at",
"the",
"End",
"of",
"the",
"file?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L1460-L1476
|
154,341
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
|
BaseTable.unlockIfLocked
|
public boolean unlockIfLocked(Record record, Object bookmark) throws DBException
{
if (record != null)
{ // unlock record
BaseApplication app = null;
org.jbundle.model.Task task = null;
if (record.getRecordOwner() != null)
task = record.getRecordOwner().getTask();
if (task != null)
app = (BaseApplication)record.getRecordOwner().getTask().getApplication();
Environment env = null;
if (app != null)
env = app.getEnvironment();
else
env = Environment.getEnvironment(null);
return env.getLockManager().unlockThisRecord(task, record.getDatabaseName(), record.getTableNames(false), bookmark);
}
return true;
}
|
java
|
public boolean unlockIfLocked(Record record, Object bookmark) throws DBException
{
if (record != null)
{ // unlock record
BaseApplication app = null;
org.jbundle.model.Task task = null;
if (record.getRecordOwner() != null)
task = record.getRecordOwner().getTask();
if (task != null)
app = (BaseApplication)record.getRecordOwner().getTask().getApplication();
Environment env = null;
if (app != null)
env = app.getEnvironment();
else
env = Environment.getEnvironment(null);
return env.getLockManager().unlockThisRecord(task, record.getDatabaseName(), record.getTableNames(false), bookmark);
}
return true;
}
|
[
"public",
"boolean",
"unlockIfLocked",
"(",
"Record",
"record",
",",
"Object",
"bookmark",
")",
"throws",
"DBException",
"{",
"if",
"(",
"record",
"!=",
"null",
")",
"{",
"// unlock record",
"BaseApplication",
"app",
"=",
"null",
";",
"org",
".",
"jbundle",
".",
"model",
".",
"Task",
"task",
"=",
"null",
";",
"if",
"(",
"record",
".",
"getRecordOwner",
"(",
")",
"!=",
"null",
")",
"task",
"=",
"record",
".",
"getRecordOwner",
"(",
")",
".",
"getTask",
"(",
")",
";",
"if",
"(",
"task",
"!=",
"null",
")",
"app",
"=",
"(",
"BaseApplication",
")",
"record",
".",
"getRecordOwner",
"(",
")",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
";",
"Environment",
"env",
"=",
"null",
";",
"if",
"(",
"app",
"!=",
"null",
")",
"env",
"=",
"app",
".",
"getEnvironment",
"(",
")",
";",
"else",
"env",
"=",
"Environment",
".",
"getEnvironment",
"(",
"null",
")",
";",
"return",
"env",
".",
"getLockManager",
"(",
")",
".",
"unlockThisRecord",
"(",
"task",
",",
"record",
".",
"getDatabaseName",
"(",
")",
",",
"record",
".",
"getTableNames",
"(",
"false",
")",
",",
"bookmark",
")",
";",
"}",
"return",
"true",
";",
"}"
] |
Unlock this record if it is locked.
@param record The record to unlock.
@param The bookmark to unlock (all if null).
@return true if successful (it is usually okay to ignore this return).
|
[
"Unlock",
"this",
"record",
"if",
"it",
"is",
"locked",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L1561-L1579
|
154,342
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
|
BaseTable.getProperties
|
public Map<String, Object> getProperties()
{
if (this.getRecord() != null)
if (((this.getRecord().getDatabaseType() & DBConstants.MAPPED) != 0)
|| ((this.getRecord().getDatabaseType() & DBConstants.REMOTE_MEMORY) != 0))
{
if (m_properties == null)
m_properties = new Hashtable<String,Object>();
m_properties.put(RecordMessageConstants.TABLE_NAME, this.getRecord().getTableNames(false)); // Don't call setProperty since ClientTable does a remote call
}
return m_properties;
}
|
java
|
public Map<String, Object> getProperties()
{
if (this.getRecord() != null)
if (((this.getRecord().getDatabaseType() & DBConstants.MAPPED) != 0)
|| ((this.getRecord().getDatabaseType() & DBConstants.REMOTE_MEMORY) != 0))
{
if (m_properties == null)
m_properties = new Hashtable<String,Object>();
m_properties.put(RecordMessageConstants.TABLE_NAME, this.getRecord().getTableNames(false)); // Don't call setProperty since ClientTable does a remote call
}
return m_properties;
}
|
[
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getProperties",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getRecord",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"(",
"(",
"this",
".",
"getRecord",
"(",
")",
".",
"getDatabaseType",
"(",
")",
"&",
"DBConstants",
".",
"MAPPED",
")",
"!=",
"0",
")",
"||",
"(",
"(",
"this",
".",
"getRecord",
"(",
")",
".",
"getDatabaseType",
"(",
")",
"&",
"DBConstants",
".",
"REMOTE_MEMORY",
")",
"!=",
"0",
")",
")",
"{",
"if",
"(",
"m_properties",
"==",
"null",
")",
"m_properties",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"m_properties",
".",
"put",
"(",
"RecordMessageConstants",
".",
"TABLE_NAME",
",",
"this",
".",
"getRecord",
"(",
")",
".",
"getTableNames",
"(",
"false",
")",
")",
";",
"// Don't call setProperty since ClientTable does a remote call",
"}",
"return",
"m_properties",
";",
"}"
] |
Get this property for this table.
@param strProperty The property key.
@return The property value.
|
[
"Get",
"this",
"property",
"for",
"this",
"table",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L1615-L1626
|
154,343
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/convert/QueryBitmapConverter.java
|
QueryBitmapConverter.setupDefaultView
|
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
properties = new HashMap<String,Object>();
properties.put(ScreenModel.COMMAND, MenuConstants.FORMLINK);
properties.put(ScreenModel.IMAGE, MenuConstants.FORM);
return BaseField.createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties);
}
|
java
|
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
properties = new HashMap<String,Object>();
properties.put(ScreenModel.COMMAND, MenuConstants.FORMLINK);
properties.put(ScreenModel.IMAGE, MenuConstants.FORM);
return BaseField.createScreenComponent(ScreenModel.CANNED_BOX, targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR), targetScreen, converter, iDisplayFieldDesc, properties);
}
|
[
"public",
"ScreenComponent",
"setupDefaultView",
"(",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"targetScreen",
",",
"Convert",
"converter",
",",
"int",
"iDisplayFieldDesc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"properties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"properties",
".",
"put",
"(",
"ScreenModel",
".",
"COMMAND",
",",
"MenuConstants",
".",
"FORMLINK",
")",
";",
"properties",
".",
"put",
"(",
"ScreenModel",
".",
"IMAGE",
",",
"MenuConstants",
".",
"FORM",
")",
";",
"return",
"BaseField",
".",
"createScreenComponent",
"(",
"ScreenModel",
".",
"CANNED_BOX",
",",
"targetScreen",
".",
"getNextLocation",
"(",
"ScreenConstants",
".",
"RIGHT_OF_LAST",
",",
"ScreenConstants",
".",
"DONT_SET_ANCHOR",
")",
",",
"targetScreen",
",",
"converter",
",",
"iDisplayFieldDesc",
",",
"properties",
")",
";",
"}"
] |
Set up the default control for this field.
A SCannedBox for a query bitmap converter.
@param itsLocation Location of this component on screen (ie., GridBagConstraint).
@param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
@param iDisplayFieldDesc Display the label? (optional).
@return Return the component or ScreenField that is created for this field.
|
[
"Set",
"up",
"the",
"default",
"control",
"for",
"this",
"field",
".",
"A",
"SCannedBox",
"for",
"a",
"query",
"bitmap",
"converter",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/QueryBitmapConverter.java#L115-L121
|
154,344
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/FilterChannel.java
|
FilterChannel.position
|
@Override
public FilterChannel position(long newPosition) throws IOException
{
if (!isOpen())
{
throw new ClosedChannelException();
}
int skip = (int) (newPosition - position());
if (skip < 0)
{
throw new UnsupportedOperationException("backwards position not supported");
}
if (skip > skipBuffer.capacity())
{
throw new UnsupportedOperationException(skip+" skip not supported maxSkipSize="+maxSkipSize);
}
if (skip > 0)
{
if (skipBuffer == null)
{
throw new UnsupportedOperationException("skip not supported maxSkipSize="+maxSkipSize);
}
skipBuffer.clear();
skipBuffer.limit(skip);
if (in != null)
{
read(skipBuffer);
}
else
{
write(skipBuffer);
}
}
return this;
}
|
java
|
@Override
public FilterChannel position(long newPosition) throws IOException
{
if (!isOpen())
{
throw new ClosedChannelException();
}
int skip = (int) (newPosition - position());
if (skip < 0)
{
throw new UnsupportedOperationException("backwards position not supported");
}
if (skip > skipBuffer.capacity())
{
throw new UnsupportedOperationException(skip+" skip not supported maxSkipSize="+maxSkipSize);
}
if (skip > 0)
{
if (skipBuffer == null)
{
throw new UnsupportedOperationException("skip not supported maxSkipSize="+maxSkipSize);
}
skipBuffer.clear();
skipBuffer.limit(skip);
if (in != null)
{
read(skipBuffer);
}
else
{
write(skipBuffer);
}
}
return this;
}
|
[
"@",
"Override",
"public",
"FilterChannel",
"position",
"(",
"long",
"newPosition",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"isOpen",
"(",
")",
")",
"{",
"throw",
"new",
"ClosedChannelException",
"(",
")",
";",
"}",
"int",
"skip",
"=",
"(",
"int",
")",
"(",
"newPosition",
"-",
"position",
"(",
")",
")",
";",
"if",
"(",
"skip",
"<",
"0",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"backwards position not supported\"",
")",
";",
"}",
"if",
"(",
"skip",
">",
"skipBuffer",
".",
"capacity",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"skip",
"+",
"\" skip not supported maxSkipSize=\"",
"+",
"maxSkipSize",
")",
";",
"}",
"if",
"(",
"skip",
">",
"0",
")",
"{",
"if",
"(",
"skipBuffer",
"==",
"null",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"skip not supported maxSkipSize=\"",
"+",
"maxSkipSize",
")",
";",
"}",
"skipBuffer",
".",
"clear",
"(",
")",
";",
"skipBuffer",
".",
"limit",
"(",
"skip",
")",
";",
"if",
"(",
"in",
"!=",
"null",
")",
"{",
"read",
"(",
"skipBuffer",
")",
";",
"}",
"else",
"{",
"write",
"(",
"skipBuffer",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Changes unfiltered position. Only forward direction is allowed with
small skips. This method is for alignment purposes mostly.
@param newPosition
@return
@throws IOException
|
[
"Changes",
"unfiltered",
"position",
".",
"Only",
"forward",
"direction",
"is",
"allowed",
"with",
"small",
"skips",
".",
"This",
"method",
"is",
"for",
"alignment",
"purposes",
"mostly",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/FilterChannel.java#L125-L159
|
154,345
|
biouno/figshare-java-api
|
src/main/java/org/biouno/figshare/FigShareClient.java
|
FigShareClient.getURL
|
private String getURL(String endpoint, int version, String method) {
StringBuilder sb = new StringBuilder();
sb.append(endpoint);
if (!endpoint.endsWith(FORWARD_SLASH)) {
sb.append(FORWARD_SLASH);
}
sb.append(VERSION_PREFIX + version + FORWARD_SLASH + method);
return sb.toString();
}
|
java
|
private String getURL(String endpoint, int version, String method) {
StringBuilder sb = new StringBuilder();
sb.append(endpoint);
if (!endpoint.endsWith(FORWARD_SLASH)) {
sb.append(FORWARD_SLASH);
}
sb.append(VERSION_PREFIX + version + FORWARD_SLASH + method);
return sb.toString();
}
|
[
"private",
"String",
"getURL",
"(",
"String",
"endpoint",
",",
"int",
"version",
",",
"String",
"method",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"endpoint",
")",
";",
"if",
"(",
"!",
"endpoint",
".",
"endsWith",
"(",
"FORWARD_SLASH",
")",
")",
"{",
"sb",
".",
"append",
"(",
"FORWARD_SLASH",
")",
";",
"}",
"sb",
".",
"append",
"(",
"VERSION_PREFIX",
"+",
"version",
"+",
"FORWARD_SLASH",
"+",
"method",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Create the FigShare API URL using the endpoint, version and API method.
@param endpoint endpoint URL
@param version API version
@param method API operation
@return the URL with the version and method
|
[
"Create",
"the",
"FigShare",
"API",
"URL",
"using",
"the",
"endpoint",
"version",
"and",
"API",
"method",
"."
] |
6d447764efe8fa4329d15e339a8601351aade93c
|
https://github.com/biouno/figshare-java-api/blob/6d447764efe8fa4329d15e339a8601351aade93c/src/main/java/org/biouno/figshare/FigShareClient.java#L132-L140
|
154,346
|
biouno/figshare-java-api
|
src/main/java/org/biouno/figshare/FigShareClient.java
|
FigShareClient.to
|
public static FigShareClient to(String endpoint, int version, String clientKey, String clientSecret,
String tokenKey, String tokenSecret) {
return new FigShareClient(endpoint, version, clientKey, clientSecret, tokenKey, tokenSecret);
}
|
java
|
public static FigShareClient to(String endpoint, int version, String clientKey, String clientSecret,
String tokenKey, String tokenSecret) {
return new FigShareClient(endpoint, version, clientKey, clientSecret, tokenKey, tokenSecret);
}
|
[
"public",
"static",
"FigShareClient",
"to",
"(",
"String",
"endpoint",
",",
"int",
"version",
",",
"String",
"clientKey",
",",
"String",
"clientSecret",
",",
"String",
"tokenKey",
",",
"String",
"tokenSecret",
")",
"{",
"return",
"new",
"FigShareClient",
"(",
"endpoint",
",",
"version",
",",
"clientKey",
",",
"clientSecret",
",",
"tokenKey",
",",
"tokenSecret",
")",
";",
"}"
] |
Create a FigShareClient to interface to the FigShare API.
@param endpoint API endpoint
@param version API version
@param clientKey OAuth client key
@param clientSecret OAuth client secret
@param tokenKey OAuth token key
@param tokenSecret OAuth token secret
@return a {@link FigShareClient}
|
[
"Create",
"a",
"FigShareClient",
"to",
"interface",
"to",
"the",
"FigShare",
"API",
"."
] |
6d447764efe8fa4329d15e339a8601351aade93c
|
https://github.com/biouno/figshare-java-api/blob/6d447764efe8fa4329d15e339a8601351aade93c/src/main/java/org/biouno/figshare/FigShareClient.java#L153-L156
|
154,347
|
biouno/figshare-java-api
|
src/main/java/org/biouno/figshare/FigShareClient.java
|
FigShareClient.readArticlesFromJson
|
protected List<Article> readArticlesFromJson(String json) {
Gson gson = new Gson();
JsonParser parser = new JsonParser();
JsonObject array = parser.parse(json).getAsJsonObject();
JsonElement items = array.get("items");
JsonArray itemsArray = items.getAsJsonArray();
List<Article> articles = new LinkedList<>();
for (JsonElement element : itemsArray) {
Article article = gson.fromJson(element, Article.class);
articles.add(article);
}
return articles;
}
|
java
|
protected List<Article> readArticlesFromJson(String json) {
Gson gson = new Gson();
JsonParser parser = new JsonParser();
JsonObject array = parser.parse(json).getAsJsonObject();
JsonElement items = array.get("items");
JsonArray itemsArray = items.getAsJsonArray();
List<Article> articles = new LinkedList<>();
for (JsonElement element : itemsArray) {
Article article = gson.fromJson(element, Article.class);
articles.add(article);
}
return articles;
}
|
[
"protected",
"List",
"<",
"Article",
">",
"readArticlesFromJson",
"(",
"String",
"json",
")",
"{",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"JsonParser",
"parser",
"=",
"new",
"JsonParser",
"(",
")",
";",
"JsonObject",
"array",
"=",
"parser",
".",
"parse",
"(",
"json",
")",
".",
"getAsJsonObject",
"(",
")",
";",
"JsonElement",
"items",
"=",
"array",
".",
"get",
"(",
"\"items\"",
")",
";",
"JsonArray",
"itemsArray",
"=",
"items",
".",
"getAsJsonArray",
"(",
")",
";",
"List",
"<",
"Article",
">",
"articles",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"JsonElement",
"element",
":",
"itemsArray",
")",
"{",
"Article",
"article",
"=",
"gson",
".",
"fromJson",
"(",
"element",
",",
"Article",
".",
"class",
")",
";",
"articles",
".",
"add",
"(",
"article",
")",
";",
"}",
"return",
"articles",
";",
"}"
] |
Get the articles objects from JSON.
@param json JSON
@return articles objects
|
[
"Get",
"the",
"articles",
"objects",
"from",
"JSON",
"."
] |
6d447764efe8fa4329d15e339a8601351aade93c
|
https://github.com/biouno/figshare-java-api/blob/6d447764efe8fa4329d15e339a8601351aade93c/src/main/java/org/biouno/figshare/FigShareClient.java#L204-L216
|
154,348
|
biouno/figshare-java-api
|
src/main/java/org/biouno/figshare/FigShareClient.java
|
FigShareClient.createArticle
|
public Article createArticle(final String title, final String description, final String definedType) {
HttpClient httpClient = null;
try {
final String method = "my_data/articles";
// create an HTTP request to a protected resource
final String url = getURL(endpoint, version, method);
// create an HTTP request to a protected resource
final HttpPost request = new HttpPost(url);
Gson gson = new Gson();
JsonObject payload = new JsonObject();
payload.addProperty("title", title);
payload.addProperty("description", description);
payload.addProperty("defined_type", definedType);
String jsonRequest = gson.toJson(payload);
StringEntity entity = new StringEntity(jsonRequest);
entity.setContentType(JSON_CONTENT_TYPE);
request.setEntity(entity);
// sign the request
consumer.sign(request);
// send the request
httpClient = HttpClientBuilder.create().build();
HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
String json = EntityUtils.toString(responseEntity);
Article article = readArticleFromJson(json);
return article;
} catch (OAuthCommunicationException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthMessageSignerException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthExpectationFailedException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (ClientProtocolException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (IOException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
}
}
|
java
|
public Article createArticle(final String title, final String description, final String definedType) {
HttpClient httpClient = null;
try {
final String method = "my_data/articles";
// create an HTTP request to a protected resource
final String url = getURL(endpoint, version, method);
// create an HTTP request to a protected resource
final HttpPost request = new HttpPost(url);
Gson gson = new Gson();
JsonObject payload = new JsonObject();
payload.addProperty("title", title);
payload.addProperty("description", description);
payload.addProperty("defined_type", definedType);
String jsonRequest = gson.toJson(payload);
StringEntity entity = new StringEntity(jsonRequest);
entity.setContentType(JSON_CONTENT_TYPE);
request.setEntity(entity);
// sign the request
consumer.sign(request);
// send the request
httpClient = HttpClientBuilder.create().build();
HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
String json = EntityUtils.toString(responseEntity);
Article article = readArticleFromJson(json);
return article;
} catch (OAuthCommunicationException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthMessageSignerException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthExpectationFailedException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (ClientProtocolException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (IOException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
}
}
|
[
"public",
"Article",
"createArticle",
"(",
"final",
"String",
"title",
",",
"final",
"String",
"description",
",",
"final",
"String",
"definedType",
")",
"{",
"HttpClient",
"httpClient",
"=",
"null",
";",
"try",
"{",
"final",
"String",
"method",
"=",
"\"my_data/articles\"",
";",
"// create an HTTP request to a protected resource",
"final",
"String",
"url",
"=",
"getURL",
"(",
"endpoint",
",",
"version",
",",
"method",
")",
";",
"// create an HTTP request to a protected resource",
"final",
"HttpPost",
"request",
"=",
"new",
"HttpPost",
"(",
"url",
")",
";",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"JsonObject",
"payload",
"=",
"new",
"JsonObject",
"(",
")",
";",
"payload",
".",
"addProperty",
"(",
"\"title\"",
",",
"title",
")",
";",
"payload",
".",
"addProperty",
"(",
"\"description\"",
",",
"description",
")",
";",
"payload",
".",
"addProperty",
"(",
"\"defined_type\"",
",",
"definedType",
")",
";",
"String",
"jsonRequest",
"=",
"gson",
".",
"toJson",
"(",
"payload",
")",
";",
"StringEntity",
"entity",
"=",
"new",
"StringEntity",
"(",
"jsonRequest",
")",
";",
"entity",
".",
"setContentType",
"(",
"JSON_CONTENT_TYPE",
")",
";",
"request",
".",
"setEntity",
"(",
"entity",
")",
";",
"// sign the request",
"consumer",
".",
"sign",
"(",
"request",
")",
";",
"// send the request",
"httpClient",
"=",
"HttpClientBuilder",
".",
"create",
"(",
")",
".",
"build",
"(",
")",
";",
"HttpResponse",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"request",
")",
";",
"HttpEntity",
"responseEntity",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"String",
"json",
"=",
"EntityUtils",
".",
"toString",
"(",
"responseEntity",
")",
";",
"Article",
"article",
"=",
"readArticleFromJson",
"(",
"json",
")",
";",
"return",
"article",
";",
"}",
"catch",
"(",
"OAuthCommunicationException",
"e",
")",
"{",
"throw",
"new",
"FigShareClientException",
"(",
"\"Failed to get articles: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"OAuthMessageSignerException",
"e",
")",
"{",
"throw",
"new",
"FigShareClientException",
"(",
"\"Failed to get articles: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"OAuthExpectationFailedException",
"e",
")",
"{",
"throw",
"new",
"FigShareClientException",
"(",
"\"Failed to get articles: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"ClientProtocolException",
"e",
")",
"{",
"throw",
"new",
"FigShareClientException",
"(",
"\"Failed to get articles: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"FigShareClientException",
"(",
"\"Failed to get articles: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] |
Create an article.
@param title title
@param description description
@param definedType defined type (e.g. dataset)
@return an {@link Article}
|
[
"Create",
"an",
"article",
"."
] |
6d447764efe8fa4329d15e339a8601351aade93c
|
https://github.com/biouno/figshare-java-api/blob/6d447764efe8fa4329d15e339a8601351aade93c/src/main/java/org/biouno/figshare/FigShareClient.java#L226-L265
|
154,349
|
biouno/figshare-java-api
|
src/main/java/org/biouno/figshare/FigShareClient.java
|
FigShareClient.readArticleFromJson
|
protected Article readArticleFromJson(String json) {
Gson gson = new Gson();
Article article = gson.fromJson(json, Article.class);
return article;
}
|
java
|
protected Article readArticleFromJson(String json) {
Gson gson = new Gson();
Article article = gson.fromJson(json, Article.class);
return article;
}
|
[
"protected",
"Article",
"readArticleFromJson",
"(",
"String",
"json",
")",
"{",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"Article",
"article",
"=",
"gson",
".",
"fromJson",
"(",
"json",
",",
"Article",
".",
"class",
")",
";",
"return",
"article",
";",
"}"
] |
Get the article object from JSON.
@param json JSON
@return article object
|
[
"Get",
"the",
"article",
"object",
"from",
"JSON",
"."
] |
6d447764efe8fa4329d15e339a8601351aade93c
|
https://github.com/biouno/figshare-java-api/blob/6d447764efe8fa4329d15e339a8601351aade93c/src/main/java/org/biouno/figshare/FigShareClient.java#L273-L277
|
154,350
|
biouno/figshare-java-api
|
src/main/java/org/biouno/figshare/FigShareClient.java
|
FigShareClient.uploadFile
|
public org.biouno.figshare.v1.model.File uploadFile(long articleId, File file) {
HttpClient httpClient = null;
try {
final String method = String.format("my_data/articles/%d/files", articleId);
// create an HTTP request to a protected resource
final String url = getURL(endpoint, version, method);
// create an HTTP request to a protected resource
final HttpPut request = new HttpPut(url);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
ContentBody body = new FileBody(file);
FormBodyPart part = FormBodyPartBuilder.create("filedata", body).build();
builder.addPart(part);
HttpEntity entity = builder.build();
request.setEntity(entity);
// sign the request
consumer.sign(request);
// send the request
httpClient = HttpClientBuilder.create().build();
HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
String json = EntityUtils.toString(responseEntity);
org.biouno.figshare.v1.model.File uploadedFile = readFileFromJson(json);
return uploadedFile;
} catch (OAuthCommunicationException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthMessageSignerException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthExpectationFailedException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (ClientProtocolException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (IOException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
}
}
|
java
|
public org.biouno.figshare.v1.model.File uploadFile(long articleId, File file) {
HttpClient httpClient = null;
try {
final String method = String.format("my_data/articles/%d/files", articleId);
// create an HTTP request to a protected resource
final String url = getURL(endpoint, version, method);
// create an HTTP request to a protected resource
final HttpPut request = new HttpPut(url);
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
ContentBody body = new FileBody(file);
FormBodyPart part = FormBodyPartBuilder.create("filedata", body).build();
builder.addPart(part);
HttpEntity entity = builder.build();
request.setEntity(entity);
// sign the request
consumer.sign(request);
// send the request
httpClient = HttpClientBuilder.create().build();
HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
String json = EntityUtils.toString(responseEntity);
org.biouno.figshare.v1.model.File uploadedFile = readFileFromJson(json);
return uploadedFile;
} catch (OAuthCommunicationException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthMessageSignerException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthExpectationFailedException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (ClientProtocolException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (IOException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
}
}
|
[
"public",
"org",
".",
"biouno",
".",
"figshare",
".",
"v1",
".",
"model",
".",
"File",
"uploadFile",
"(",
"long",
"articleId",
",",
"File",
"file",
")",
"{",
"HttpClient",
"httpClient",
"=",
"null",
";",
"try",
"{",
"final",
"String",
"method",
"=",
"String",
".",
"format",
"(",
"\"my_data/articles/%d/files\"",
",",
"articleId",
")",
";",
"// create an HTTP request to a protected resource",
"final",
"String",
"url",
"=",
"getURL",
"(",
"endpoint",
",",
"version",
",",
"method",
")",
";",
"// create an HTTP request to a protected resource",
"final",
"HttpPut",
"request",
"=",
"new",
"HttpPut",
"(",
"url",
")",
";",
"MultipartEntityBuilder",
"builder",
"=",
"MultipartEntityBuilder",
".",
"create",
"(",
")",
";",
"ContentBody",
"body",
"=",
"new",
"FileBody",
"(",
"file",
")",
";",
"FormBodyPart",
"part",
"=",
"FormBodyPartBuilder",
".",
"create",
"(",
"\"filedata\"",
",",
"body",
")",
".",
"build",
"(",
")",
";",
"builder",
".",
"addPart",
"(",
"part",
")",
";",
"HttpEntity",
"entity",
"=",
"builder",
".",
"build",
"(",
")",
";",
"request",
".",
"setEntity",
"(",
"entity",
")",
";",
"// sign the request",
"consumer",
".",
"sign",
"(",
"request",
")",
";",
"// send the request",
"httpClient",
"=",
"HttpClientBuilder",
".",
"create",
"(",
")",
".",
"build",
"(",
")",
";",
"HttpResponse",
"response",
"=",
"httpClient",
".",
"execute",
"(",
"request",
")",
";",
"HttpEntity",
"responseEntity",
"=",
"response",
".",
"getEntity",
"(",
")",
";",
"String",
"json",
"=",
"EntityUtils",
".",
"toString",
"(",
"responseEntity",
")",
";",
"org",
".",
"biouno",
".",
"figshare",
".",
"v1",
".",
"model",
".",
"File",
"uploadedFile",
"=",
"readFileFromJson",
"(",
"json",
")",
";",
"return",
"uploadedFile",
";",
"}",
"catch",
"(",
"OAuthCommunicationException",
"e",
")",
"{",
"throw",
"new",
"FigShareClientException",
"(",
"\"Failed to get articles: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"OAuthMessageSignerException",
"e",
")",
"{",
"throw",
"new",
"FigShareClientException",
"(",
"\"Failed to get articles: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"OAuthExpectationFailedException",
"e",
")",
"{",
"throw",
"new",
"FigShareClientException",
"(",
"\"Failed to get articles: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"ClientProtocolException",
"e",
")",
"{",
"throw",
"new",
"FigShareClientException",
"(",
"\"Failed to get articles: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"FigShareClientException",
"(",
"\"Failed to get articles: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] |
Upload a file to an article.
@param articleId article ID
@param file java.io.File file
@return org.biouno.figshare.v1.model.File uploaded file, without the thumbnail URL
|
[
"Upload",
"a",
"file",
"to",
"an",
"article",
"."
] |
6d447764efe8fa4329d15e339a8601351aade93c
|
https://github.com/biouno/figshare-java-api/blob/6d447764efe8fa4329d15e339a8601351aade93c/src/main/java/org/biouno/figshare/FigShareClient.java#L286-L324
|
154,351
|
biouno/figshare-java-api
|
src/main/java/org/biouno/figshare/FigShareClient.java
|
FigShareClient.readFileFromJson
|
protected org.biouno.figshare.v1.model.File readFileFromJson(String json) {
Gson gson = new Gson();
org.biouno.figshare.v1.model.File file = gson.fromJson(json, org.biouno.figshare.v1.model.File.class);
return file;
}
|
java
|
protected org.biouno.figshare.v1.model.File readFileFromJson(String json) {
Gson gson = new Gson();
org.biouno.figshare.v1.model.File file = gson.fromJson(json, org.biouno.figshare.v1.model.File.class);
return file;
}
|
[
"protected",
"org",
".",
"biouno",
".",
"figshare",
".",
"v1",
".",
"model",
".",
"File",
"readFileFromJson",
"(",
"String",
"json",
")",
"{",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"org",
".",
"biouno",
".",
"figshare",
".",
"v1",
".",
"model",
".",
"File",
"file",
"=",
"gson",
".",
"fromJson",
"(",
"json",
",",
"org",
".",
"biouno",
".",
"figshare",
".",
"v1",
".",
"model",
".",
"File",
".",
"class",
")",
";",
"return",
"file",
";",
"}"
] |
Get a file from a JSON.
@param json JSON
@return a file
|
[
"Get",
"a",
"file",
"from",
"a",
"JSON",
"."
] |
6d447764efe8fa4329d15e339a8601351aade93c
|
https://github.com/biouno/figshare-java-api/blob/6d447764efe8fa4329d15e339a8601351aade93c/src/main/java/org/biouno/figshare/FigShareClient.java#L332-L336
|
154,352
|
microfocus-idol/java-content-parameter-api
|
src/main/java/com/hp/autonomy/aci/content/identifier/id/Id.java
|
Id.compareTo
|
@Override
public int compareTo(final Id id) {
return Integer.valueOf(this.id).compareTo(id.id);
}
|
java
|
@Override
public int compareTo(final Id id) {
return Integer.valueOf(this.id).compareTo(id.id);
}
|
[
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"final",
"Id",
"id",
")",
"{",
"return",
"Integer",
".",
"valueOf",
"(",
"this",
".",
"id",
")",
".",
"compareTo",
"(",
"id",
".",
"id",
")",
";",
"}"
] |
Provides a natural ordering for the Id class such that Ids can be sorted into increasing numerical order.
@param id An id object for comparision
@return {@code -1}, {@code 0} or {@code 1}
|
[
"Provides",
"a",
"natural",
"ordering",
"for",
"the",
"Id",
"class",
"such",
"that",
"Ids",
"can",
"be",
"sorted",
"into",
"increasing",
"numerical",
"order",
"."
] |
8d33dc633f8df2a470a571ac7694e423e7004ad0
|
https://github.com/microfocus-idol/java-content-parameter-api/blob/8d33dc633f8df2a470a571ac7694e423e7004ad0/src/main/java/com/hp/autonomy/aci/content/identifier/id/Id.java#L77-L80
|
154,353
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/model/Post.java
|
Post.modifiedNow
|
public final Post modifiedNow() {
return new Post(id, slug, title, excerpt, content, authorId, author,
publishTimestamp, System.currentTimeMillis(), status, parentId,
guid, commentCount, metadata, type, mimeType, taxonomyTerms, children);
}
|
java
|
public final Post modifiedNow() {
return new Post(id, slug, title, excerpt, content, authorId, author,
publishTimestamp, System.currentTimeMillis(), status, parentId,
guid, commentCount, metadata, type, mimeType, taxonomyTerms, children);
}
|
[
"public",
"final",
"Post",
"modifiedNow",
"(",
")",
"{",
"return",
"new",
"Post",
"(",
"id",
",",
"slug",
",",
"title",
",",
"excerpt",
",",
"content",
",",
"authorId",
",",
"author",
",",
"publishTimestamp",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
",",
"status",
",",
"parentId",
",",
"guid",
",",
"commentCount",
",",
"metadata",
",",
"type",
",",
"mimeType",
",",
"taxonomyTerms",
",",
"children",
")",
";",
"}"
] |
Changes the modified time of a post to the current time.
@return The post with modified time set to the current time.
|
[
"Changes",
"the",
"modified",
"time",
"of",
"a",
"post",
"to",
"the",
"current",
"time",
"."
] |
b9adf6131dfb67899ebff770c9bfeb001cc42f30
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Post.java#L685-L689
|
154,354
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/model/Post.java
|
Post.withContent
|
public final Post withContent(final String content) {
return new Post(id, slug, title, excerpt, content, authorId, author,
publishTimestamp, modifiedTimestamp, status, parentId,
guid, commentCount, metadata, type, mimeType, taxonomyTerms, children);
}
|
java
|
public final Post withContent(final String content) {
return new Post(id, slug, title, excerpt, content, authorId, author,
publishTimestamp, modifiedTimestamp, status, parentId,
guid, commentCount, metadata, type, mimeType, taxonomyTerms, children);
}
|
[
"public",
"final",
"Post",
"withContent",
"(",
"final",
"String",
"content",
")",
"{",
"return",
"new",
"Post",
"(",
"id",
",",
"slug",
",",
"title",
",",
"excerpt",
",",
"content",
",",
"authorId",
",",
"author",
",",
"publishTimestamp",
",",
"modifiedTimestamp",
",",
"status",
",",
"parentId",
",",
"guid",
",",
"commentCount",
",",
"metadata",
",",
"type",
",",
"mimeType",
",",
"taxonomyTerms",
",",
"children",
")",
";",
"}"
] |
Replaces post content.
@param content The new content.
@return The post with content replaced.
|
[
"Replaces",
"post",
"content",
"."
] |
b9adf6131dfb67899ebff770c9bfeb001cc42f30
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Post.java#L696-L700
|
154,355
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/model/Post.java
|
Post.withAuthor
|
public final Post withAuthor(final User user) {
return new Post(id, slug, title, excerpt, content, authorId, user,
publishTimestamp, modifiedTimestamp, status, parentId,
guid, commentCount, metadata, type, mimeType, taxonomyTerms, children);
}
|
java
|
public final Post withAuthor(final User user) {
return new Post(id, slug, title, excerpt, content, authorId, user,
publishTimestamp, modifiedTimestamp, status, parentId,
guid, commentCount, metadata, type, mimeType, taxonomyTerms, children);
}
|
[
"public",
"final",
"Post",
"withAuthor",
"(",
"final",
"User",
"user",
")",
"{",
"return",
"new",
"Post",
"(",
"id",
",",
"slug",
",",
"title",
",",
"excerpt",
",",
"content",
",",
"authorId",
",",
"user",
",",
"publishTimestamp",
",",
"modifiedTimestamp",
",",
"status",
",",
"parentId",
",",
"guid",
",",
"commentCount",
",",
"metadata",
",",
"type",
",",
"mimeType",
",",
"taxonomyTerms",
",",
"children",
")",
";",
"}"
] |
Adds an author to a post.
@param user The user that represents the author.
@return The post with author added.
|
[
"Adds",
"an",
"author",
"to",
"a",
"post",
"."
] |
b9adf6131dfb67899ebff770c9bfeb001cc42f30
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Post.java#L729-L733
|
154,356
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/model/Post.java
|
Post.withTaxonomyTerms
|
public final Post withTaxonomyTerms(final Map<String, List<TaxonomyTerm>> taxonomyTerms) {
ImmutableMap.Builder<String, ImmutableList<TaxonomyTerm>> builder = ImmutableMap.builder();
if(taxonomyTerms != null && taxonomyTerms.size() > 0) {
taxonomyTerms.entrySet().forEach(kv -> builder.put(kv.getKey(), ImmutableList.copyOf(kv.getValue())));
}
return new Post(id, slug, title, excerpt, content, authorId, author,
publishTimestamp, modifiedTimestamp, status, parentId,
guid, commentCount, metadata, type, mimeType, builder.build(), children);
}
|
java
|
public final Post withTaxonomyTerms(final Map<String, List<TaxonomyTerm>> taxonomyTerms) {
ImmutableMap.Builder<String, ImmutableList<TaxonomyTerm>> builder = ImmutableMap.builder();
if(taxonomyTerms != null && taxonomyTerms.size() > 0) {
taxonomyTerms.entrySet().forEach(kv -> builder.put(kv.getKey(), ImmutableList.copyOf(kv.getValue())));
}
return new Post(id, slug, title, excerpt, content, authorId, author,
publishTimestamp, modifiedTimestamp, status, parentId,
guid, commentCount, metadata, type, mimeType, builder.build(), children);
}
|
[
"public",
"final",
"Post",
"withTaxonomyTerms",
"(",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"TaxonomyTerm",
">",
">",
"taxonomyTerms",
")",
"{",
"ImmutableMap",
".",
"Builder",
"<",
"String",
",",
"ImmutableList",
"<",
"TaxonomyTerm",
">",
">",
"builder",
"=",
"ImmutableMap",
".",
"builder",
"(",
")",
";",
"if",
"(",
"taxonomyTerms",
"!=",
"null",
"&&",
"taxonomyTerms",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"taxonomyTerms",
".",
"entrySet",
"(",
")",
".",
"forEach",
"(",
"kv",
"->",
"builder",
".",
"put",
"(",
"kv",
".",
"getKey",
"(",
")",
",",
"ImmutableList",
".",
"copyOf",
"(",
"kv",
".",
"getValue",
"(",
")",
")",
")",
")",
";",
"}",
"return",
"new",
"Post",
"(",
"id",
",",
"slug",
",",
"title",
",",
"excerpt",
",",
"content",
",",
"authorId",
",",
"author",
",",
"publishTimestamp",
",",
"modifiedTimestamp",
",",
"status",
",",
"parentId",
",",
"guid",
",",
"commentCount",
",",
"metadata",
",",
"type",
",",
"mimeType",
",",
"builder",
".",
"build",
"(",
")",
",",
"children",
")",
";",
"}"
] |
Adds taxonomy terms to a post.
@param taxonomyTerms The taxonomy terms.
@return The post with taxonomy terms added.
|
[
"Adds",
"taxonomy",
"terms",
"to",
"a",
"post",
"."
] |
b9adf6131dfb67899ebff770c9bfeb001cc42f30
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Post.java#L740-L748
|
154,357
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/model/Post.java
|
Post.withChildren
|
public final Post withChildren(final List<Post> children) {
return new Post(id, slug, title, excerpt, content, authorId, author,
publishTimestamp, modifiedTimestamp, status, parentId,
guid, commentCount, this.metadata, type, mimeType, taxonomyTerms,
children != null ? ImmutableList.copyOf(children) : ImmutableList.of());
}
|
java
|
public final Post withChildren(final List<Post> children) {
return new Post(id, slug, title, excerpt, content, authorId, author,
publishTimestamp, modifiedTimestamp, status, parentId,
guid, commentCount, this.metadata, type, mimeType, taxonomyTerms,
children != null ? ImmutableList.copyOf(children) : ImmutableList.of());
}
|
[
"public",
"final",
"Post",
"withChildren",
"(",
"final",
"List",
"<",
"Post",
">",
"children",
")",
"{",
"return",
"new",
"Post",
"(",
"id",
",",
"slug",
",",
"title",
",",
"excerpt",
",",
"content",
",",
"authorId",
",",
"author",
",",
"publishTimestamp",
",",
"modifiedTimestamp",
",",
"status",
",",
"parentId",
",",
"guid",
",",
"commentCount",
",",
"this",
".",
"metadata",
",",
"type",
",",
"mimeType",
",",
"taxonomyTerms",
",",
"children",
"!=",
"null",
"?",
"ImmutableList",
".",
"copyOf",
"(",
"children",
")",
":",
"ImmutableList",
".",
"of",
"(",
")",
")",
";",
"}"
] |
Adds children to a post.
@param children The children to add.
@return The post with children added.
|
[
"Adds",
"children",
"to",
"a",
"post",
"."
] |
b9adf6131dfb67899ebff770c9bfeb001cc42f30
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Post.java#L766-L771
|
154,358
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/model/Post.java
|
Post.terms
|
public final ImmutableList<TaxonomyTerm> terms(final String taxonomy) {
ImmutableList<TaxonomyTerm> terms = taxonomyTerms.get(taxonomy);
return terms != null ? terms : ImmutableList.of();
}
|
java
|
public final ImmutableList<TaxonomyTerm> terms(final String taxonomy) {
ImmutableList<TaxonomyTerm> terms = taxonomyTerms.get(taxonomy);
return terms != null ? terms : ImmutableList.of();
}
|
[
"public",
"final",
"ImmutableList",
"<",
"TaxonomyTerm",
">",
"terms",
"(",
"final",
"String",
"taxonomy",
")",
"{",
"ImmutableList",
"<",
"TaxonomyTerm",
">",
"terms",
"=",
"taxonomyTerms",
".",
"get",
"(",
"taxonomy",
")",
";",
"return",
"terms",
"!=",
"null",
"?",
"terms",
":",
"ImmutableList",
".",
"of",
"(",
")",
";",
"}"
] |
An immutable list of terms associated with this post from a specified taxonomy.
@param taxonomy The taxonomy.
@return The list of terms.
|
[
"An",
"immutable",
"list",
"of",
"terms",
"associated",
"with",
"this",
"post",
"from",
"a",
"specified",
"taxonomy",
"."
] |
b9adf6131dfb67899ebff770c9bfeb001cc42f30
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Post.java#L892-L895
|
154,359
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/model/Post.java
|
Post.tags
|
public final ImmutableList<TaxonomyTerm> tags() {
ImmutableList<TaxonomyTerm> tags = taxonomyTerms.get(TAG_TAXONOMY);
return tags != null ? tags : ImmutableList.of();
}
|
java
|
public final ImmutableList<TaxonomyTerm> tags() {
ImmutableList<TaxonomyTerm> tags = taxonomyTerms.get(TAG_TAXONOMY);
return tags != null ? tags : ImmutableList.of();
}
|
[
"public",
"final",
"ImmutableList",
"<",
"TaxonomyTerm",
">",
"tags",
"(",
")",
"{",
"ImmutableList",
"<",
"TaxonomyTerm",
">",
"tags",
"=",
"taxonomyTerms",
".",
"get",
"(",
"TAG_TAXONOMY",
")",
";",
"return",
"tags",
"!=",
"null",
"?",
"tags",
":",
"ImmutableList",
".",
"of",
"(",
")",
";",
"}"
] |
An immutable list of tags associated with this post.
@return The list of tags.
|
[
"An",
"immutable",
"list",
"of",
"tags",
"associated",
"with",
"this",
"post",
"."
] |
b9adf6131dfb67899ebff770c9bfeb001cc42f30
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Post.java#L902-L905
|
154,360
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/model/Post.java
|
Post.categories
|
public final ImmutableList<TaxonomyTerm> categories() {
ImmutableList<TaxonomyTerm> categories = taxonomyTerms.get(CATEGORY_TAXONOMY);
return categories != null ? categories : ImmutableList.of();
}
|
java
|
public final ImmutableList<TaxonomyTerm> categories() {
ImmutableList<TaxonomyTerm> categories = taxonomyTerms.get(CATEGORY_TAXONOMY);
return categories != null ? categories : ImmutableList.of();
}
|
[
"public",
"final",
"ImmutableList",
"<",
"TaxonomyTerm",
">",
"categories",
"(",
")",
"{",
"ImmutableList",
"<",
"TaxonomyTerm",
">",
"categories",
"=",
"taxonomyTerms",
".",
"get",
"(",
"CATEGORY_TAXONOMY",
")",
";",
"return",
"categories",
"!=",
"null",
"?",
"categories",
":",
"ImmutableList",
".",
"of",
"(",
")",
";",
"}"
] |
An immutable list of categories associated with this post.
@return The list of categories.
|
[
"An",
"immutable",
"list",
"of",
"categories",
"associated",
"with",
"this",
"post",
"."
] |
b9adf6131dfb67899ebff770c9bfeb001cc42f30
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Post.java#L911-L914
|
154,361
|
inkstand-io/scribble
|
scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java
|
HttpServerBuilder.contentFrom
|
public HttpServerBuilder contentFrom(String contextRoot, String contentResource){
URL resource = resolver.resolve(contentResource,CallStack.getCallerClass());
resources.put(contextRoot, resource);
return this;
}
|
java
|
public HttpServerBuilder contentFrom(String contextRoot, String contentResource){
URL resource = resolver.resolve(contentResource,CallStack.getCallerClass());
resources.put(contextRoot, resource);
return this;
}
|
[
"public",
"HttpServerBuilder",
"contentFrom",
"(",
"String",
"contextRoot",
",",
"String",
"contentResource",
")",
"{",
"URL",
"resource",
"=",
"resolver",
".",
"resolve",
"(",
"contentResource",
",",
"CallStack",
".",
"getCallerClass",
"(",
")",
")",
";",
"resources",
".",
"put",
"(",
"contextRoot",
",",
"resource",
")",
";",
"return",
"this",
";",
"}"
] |
Defines a ZIP resource on the classpath that provides the static content the server should host.
@param contextRoot
the root path to the content
@param contentResource
the name of the classpath resource denoting a file that should be hosted. If the file denotes a zip file, its
content is hosted instead of the file itself.
The path may be absolute or relative to the caller of the method.
@return
this builder
|
[
"Defines",
"a",
"ZIP",
"resource",
"on",
"the",
"classpath",
"that",
"provides",
"the",
"static",
"content",
"the",
"server",
"should",
"host",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java#L86-L90
|
154,362
|
inkstand-io/scribble
|
scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java
|
HttpServerBuilder.contentFrom
|
public HttpServerBuilder contentFrom(final String contextRoot, final TemporaryFolder folder) {
resources.put(contextRoot, folder);
return this;
}
|
java
|
public HttpServerBuilder contentFrom(final String contextRoot, final TemporaryFolder folder) {
resources.put(contextRoot, folder);
return this;
}
|
[
"public",
"HttpServerBuilder",
"contentFrom",
"(",
"final",
"String",
"contextRoot",
",",
"final",
"TemporaryFolder",
"folder",
")",
"{",
"resources",
".",
"put",
"(",
"contextRoot",
",",
"folder",
")",
";",
"return",
"this",
";",
"}"
] |
Defines a folder resource whose content fill be hosted
rule.
@param contextRoot
the root path to the content
@param folder
the rule that creates the temporary folder that should be hosted by the http server.
@return
this builder
|
[
"Defines",
"a",
"folder",
"resource",
"whose",
"content",
"fill",
"be",
"hosted",
"rule",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java#L119-L122
|
154,363
|
inkstand-io/scribble
|
scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java
|
HttpServerBuilder.contentFrom
|
public HttpServerBuilder contentFrom(final String path, final URL resource) {
resources.put(path, resource);
return this;
}
|
java
|
public HttpServerBuilder contentFrom(final String path, final URL resource) {
resources.put(path, resource);
return this;
}
|
[
"public",
"HttpServerBuilder",
"contentFrom",
"(",
"final",
"String",
"path",
",",
"final",
"URL",
"resource",
")",
"{",
"resources",
".",
"put",
"(",
"path",
",",
"resource",
")",
";",
"return",
"this",
";",
"}"
] |
Defines a file to be hosted on the specified path. The file's content is provided by the specified URL.
@param path
the path where the file is accessible from the server
@param resource
the resource providing the content for the file
@return
this builder
|
[
"Defines",
"a",
"file",
"to",
"be",
"hosted",
"on",
"the",
"specified",
"path",
".",
"The",
"file",
"s",
"content",
"is",
"provided",
"by",
"the",
"specified",
"URL",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java#L133-L136
|
154,364
|
jbundle/jbundle
|
thin/base/screen/splash/src/main/java/org/jbundle/thin/base/screen/splash/Splash.java
|
Splash.main
|
public static void main(String[] args)
{
String splashImage = Splash.getParam(args, SPLASH);
if ((splashImage == null) || (splashImage.length() == 0))
splashImage = DEFAULT_SPLASH;
URL url = Splash.class.getResource(splashImage);
if (url == null)
if (ClassServiceUtility.getClassService().getClassFinder(null) != null)
url = ClassServiceUtility.getClassService().getClassFinder(null).findResourceURL(splashImage, null);
Container container = null;
Splash.splash(container, url);
String main = Splash.getParam(args, MAIN);
if ((main == null) || (main.length() == 0))
main = ROOT_PACKAGE + "Thin";
else if (main.charAt(0) == '.')
main = ROOT_PACKAGE + main.substring(1);
Splash.invokeMain(main, args);
Splash.disposeSplash();
}
|
java
|
public static void main(String[] args)
{
String splashImage = Splash.getParam(args, SPLASH);
if ((splashImage == null) || (splashImage.length() == 0))
splashImage = DEFAULT_SPLASH;
URL url = Splash.class.getResource(splashImage);
if (url == null)
if (ClassServiceUtility.getClassService().getClassFinder(null) != null)
url = ClassServiceUtility.getClassService().getClassFinder(null).findResourceURL(splashImage, null);
Container container = null;
Splash.splash(container, url);
String main = Splash.getParam(args, MAIN);
if ((main == null) || (main.length() == 0))
main = ROOT_PACKAGE + "Thin";
else if (main.charAt(0) == '.')
main = ROOT_PACKAGE + main.substring(1);
Splash.invokeMain(main, args);
Splash.disposeSplash();
}
|
[
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"String",
"splashImage",
"=",
"Splash",
".",
"getParam",
"(",
"args",
",",
"SPLASH",
")",
";",
"if",
"(",
"(",
"splashImage",
"==",
"null",
")",
"||",
"(",
"splashImage",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"splashImage",
"=",
"DEFAULT_SPLASH",
";",
"URL",
"url",
"=",
"Splash",
".",
"class",
".",
"getResource",
"(",
"splashImage",
")",
";",
"if",
"(",
"url",
"==",
"null",
")",
"if",
"(",
"ClassServiceUtility",
".",
"getClassService",
"(",
")",
".",
"getClassFinder",
"(",
"null",
")",
"!=",
"null",
")",
"url",
"=",
"ClassServiceUtility",
".",
"getClassService",
"(",
")",
".",
"getClassFinder",
"(",
"null",
")",
".",
"findResourceURL",
"(",
"splashImage",
",",
"null",
")",
";",
"Container",
"container",
"=",
"null",
";",
"Splash",
".",
"splash",
"(",
"container",
",",
"url",
")",
";",
"String",
"main",
"=",
"Splash",
".",
"getParam",
"(",
"args",
",",
"MAIN",
")",
";",
"if",
"(",
"(",
"main",
"==",
"null",
")",
"||",
"(",
"main",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"main",
"=",
"ROOT_PACKAGE",
"+",
"\"Thin\"",
";",
"else",
"if",
"(",
"main",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"main",
"=",
"ROOT_PACKAGE",
"+",
"main",
".",
"substring",
"(",
"1",
")",
";",
"Splash",
".",
"invokeMain",
"(",
"main",
",",
"args",
")",
";",
"Splash",
".",
"disposeSplash",
"(",
")",
";",
"}"
] |
Display splash, and launch app.
@param args the command line arguments
|
[
"Display",
"splash",
"and",
"launch",
"app",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/splash/src/main/java/org/jbundle/thin/base/screen/splash/Splash.java#L68-L87
|
154,365
|
jbundle/jbundle
|
thin/base/screen/splash/src/main/java/org/jbundle/thin/base/screen/splash/Splash.java
|
Splash.paint
|
public void paint(Graphics g)
{
g.drawImage(image, 0, 0, this);
// Notify method splash that the window has been painted.
if (! paintCalled) {
paintCalled = true;
synchronized (this)
{
notifyAll();
}
}
}
|
java
|
public void paint(Graphics g)
{
g.drawImage(image, 0, 0, this);
// Notify method splash that the window has been painted.
if (! paintCalled) {
paintCalled = true;
synchronized (this)
{
notifyAll();
}
}
}
|
[
"public",
"void",
"paint",
"(",
"Graphics",
"g",
")",
"{",
"g",
".",
"drawImage",
"(",
"image",
",",
"0",
",",
"0",
",",
"this",
")",
";",
"// Notify method splash that the window has been painted.",
"if",
"(",
"!",
"paintCalled",
")",
"{",
"paintCalled",
"=",
"true",
";",
"synchronized",
"(",
"this",
")",
"{",
"notifyAll",
"(",
")",
";",
"}",
"}",
"}"
] |
Paints the image on the window.
|
[
"Paints",
"the",
"image",
"on",
"the",
"window",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/splash/src/main/java/org/jbundle/thin/base/screen/splash/Splash.java#L161-L173
|
154,366
|
jbundle/jbundle
|
thin/base/screen/splash/src/main/java/org/jbundle/thin/base/screen/splash/Splash.java
|
Splash.disposeSplash
|
public static void disposeSplash() {
if (instance != null) {
Container container = instance;
while ((container = container.getParent()) != null)
{
if (container instanceof Window)
((Window)container).dispose();
}
instance = null;
}
}
|
java
|
public static void disposeSplash() {
if (instance != null) {
Container container = instance;
while ((container = container.getParent()) != null)
{
if (container instanceof Window)
((Window)container).dispose();
}
instance = null;
}
}
|
[
"public",
"static",
"void",
"disposeSplash",
"(",
")",
"{",
"if",
"(",
"instance",
"!=",
"null",
")",
"{",
"Container",
"container",
"=",
"instance",
";",
"while",
"(",
"(",
"container",
"=",
"container",
".",
"getParent",
"(",
")",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"container",
"instanceof",
"Window",
")",
"(",
"(",
"Window",
")",
"container",
")",
".",
"dispose",
"(",
")",
";",
"}",
"instance",
"=",
"null",
";",
"}",
"}"
] |
Closes the splash window.
|
[
"Closes",
"the",
"splash",
"window",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/splash/src/main/java/org/jbundle/thin/base/screen/splash/Splash.java#L238-L248
|
154,367
|
jbundle/jbundle
|
thin/base/screen/splash/src/main/java/org/jbundle/thin/base/screen/splash/Splash.java
|
Splash.invokeMain
|
public static void invokeMain(String className, String[] args) {
try {
Class<?> clazz = null;
if (ClassServiceUtility.getClassService().getClassFinder(null) != null)
clazz = ClassServiceUtility.getClassService().getClassFinder(null).findClass(className, null);
if (clazz == null)
clazz = Class.forName(className);
Method method = clazz.getMethod("main", PARAMS);
Object[] objArgs = new Object[] {args};
method.invoke(null, objArgs);
} catch (Exception e) {
e.printStackTrace();
}
}
|
java
|
public static void invokeMain(String className, String[] args) {
try {
Class<?> clazz = null;
if (ClassServiceUtility.getClassService().getClassFinder(null) != null)
clazz = ClassServiceUtility.getClassService().getClassFinder(null).findClass(className, null);
if (clazz == null)
clazz = Class.forName(className);
Method method = clazz.getMethod("main", PARAMS);
Object[] objArgs = new Object[] {args};
method.invoke(null, objArgs);
} catch (Exception e) {
e.printStackTrace();
}
}
|
[
"public",
"static",
"void",
"invokeMain",
"(",
"String",
"className",
",",
"String",
"[",
"]",
"args",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"null",
";",
"if",
"(",
"ClassServiceUtility",
".",
"getClassService",
"(",
")",
".",
"getClassFinder",
"(",
"null",
")",
"!=",
"null",
")",
"clazz",
"=",
"ClassServiceUtility",
".",
"getClassService",
"(",
")",
".",
"getClassFinder",
"(",
"null",
")",
".",
"findClass",
"(",
"className",
",",
"null",
")",
";",
"if",
"(",
"clazz",
"==",
"null",
")",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"Method",
"method",
"=",
"clazz",
".",
"getMethod",
"(",
"\"main\"",
",",
"PARAMS",
")",
";",
"Object",
"[",
"]",
"objArgs",
"=",
"new",
"Object",
"[",
"]",
"{",
"args",
"}",
";",
"method",
".",
"invoke",
"(",
"null",
",",
"objArgs",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
Invokes the main method of the provided class name.
@param args the command line arguments
|
[
"Invokes",
"the",
"main",
"method",
"of",
"the",
"provided",
"class",
"name",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/splash/src/main/java/org/jbundle/thin/base/screen/splash/Splash.java#L254-L268
|
154,368
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/Polygon.java
|
Polygon.isInside
|
public boolean isInside(double testx, double testy)
{
if (!bounds.isInside(testx, testy))
{
return false;
}
return isRawHit(points, testx, testy);
}
|
java
|
public boolean isInside(double testx, double testy)
{
if (!bounds.isInside(testx, testy))
{
return false;
}
return isRawHit(points, testx, testy);
}
|
[
"public",
"boolean",
"isInside",
"(",
"double",
"testx",
",",
"double",
"testy",
")",
"{",
"if",
"(",
"!",
"bounds",
".",
"isInside",
"(",
"testx",
",",
"testy",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"isRawHit",
"(",
"points",
",",
"testx",
",",
"testy",
")",
";",
"}"
] |
Returns true if point is inside a polygon.
@param testx
@param testy
@return
@see <a href="http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html">PNPOLY - Point Inclusion in Polygon Test W. Randolph Franklin (WRF)</a>
|
[
"Returns",
"true",
"if",
"point",
"is",
"inside",
"a",
"polygon",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Polygon.java#L72-L79
|
154,369
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/Polygon.java
|
Polygon.isConvex
|
public static boolean isConvex(double[] data, int points)
{
if (points < 3)
{
return true;
}
for (int i1 = 0; i1 < points; i1++)
{
int i2 = (i1 + 1) % points;
int i3 = (i2 + 1) % points;
double x1 = data[2 * i1];
double y1 = data[2 * i1 + 1];
double x2 = data[2 * i2];
double y2 = data[2 * i2 + 1];
double x3 = data[2 * i3];
double y3 = data[2 * i3 + 1];
if (Vectors.isClockwise(x1, y1, x2, y2, x3, y3))
{
return false;
}
}
return true;
}
|
java
|
public static boolean isConvex(double[] data, int points)
{
if (points < 3)
{
return true;
}
for (int i1 = 0; i1 < points; i1++)
{
int i2 = (i1 + 1) % points;
int i3 = (i2 + 1) % points;
double x1 = data[2 * i1];
double y1 = data[2 * i1 + 1];
double x2 = data[2 * i2];
double y2 = data[2 * i2 + 1];
double x3 = data[2 * i3];
double y3 = data[2 * i3 + 1];
if (Vectors.isClockwise(x1, y1, x2, y2, x3, y3))
{
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"isConvex",
"(",
"double",
"[",
"]",
"data",
",",
"int",
"points",
")",
"{",
"if",
"(",
"points",
"<",
"3",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"int",
"i1",
"=",
"0",
";",
"i1",
"<",
"points",
";",
"i1",
"++",
")",
"{",
"int",
"i2",
"=",
"(",
"i1",
"+",
"1",
")",
"%",
"points",
";",
"int",
"i3",
"=",
"(",
"i2",
"+",
"1",
")",
"%",
"points",
";",
"double",
"x1",
"=",
"data",
"[",
"2",
"*",
"i1",
"]",
";",
"double",
"y1",
"=",
"data",
"[",
"2",
"*",
"i1",
"+",
"1",
"]",
";",
"double",
"x2",
"=",
"data",
"[",
"2",
"*",
"i2",
"]",
";",
"double",
"y2",
"=",
"data",
"[",
"2",
"*",
"i2",
"+",
"1",
"]",
";",
"double",
"x3",
"=",
"data",
"[",
"2",
"*",
"i3",
"]",
";",
"double",
"y3",
"=",
"data",
"[",
"2",
"*",
"i3",
"+",
"1",
"]",
";",
"if",
"(",
"Vectors",
".",
"isClockwise",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
",",
"x3",
",",
"y3",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Returns true if polygon is convex.
@param data x1, y1, x2, y2, ...
@param points Number of points (xi, yi)
@return
|
[
"Returns",
"true",
"if",
"polygon",
"is",
"convex",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Polygon.java#L156-L178
|
154,370
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/stream/FloatGenerator.java
|
FloatGenerator.provide
|
public boolean provide(float value)
{
FloatReference ref = new FloatReference(value);
boolean res = queue.offer(ref);
return res;
}
|
java
|
public boolean provide(float value)
{
FloatReference ref = new FloatReference(value);
boolean res = queue.offer(ref);
return res;
}
|
[
"public",
"boolean",
"provide",
"(",
"float",
"value",
")",
"{",
"FloatReference",
"ref",
"=",
"new",
"FloatReference",
"(",
"value",
")",
";",
"boolean",
"res",
"=",
"queue",
".",
"offer",
"(",
"ref",
")",
";",
"return",
"res",
";",
"}"
] |
Provides new item to the generator
@param value
|
[
"Provides",
"new",
"item",
"to",
"the",
"generator"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/stream/FloatGenerator.java#L39-L44
|
154,371
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/stream/FloatGenerator.java
|
FloatGenerator.generate
|
public float generate()
{
try
{
FloatReference ref = queue.take();
float value = ref.getValue();
return value;
}
catch (InterruptedException ex)
{
throw new IllegalArgumentException(ex);
}
}
|
java
|
public float generate()
{
try
{
FloatReference ref = queue.take();
float value = ref.getValue();
return value;
}
catch (InterruptedException ex)
{
throw new IllegalArgumentException(ex);
}
}
|
[
"public",
"float",
"generate",
"(",
")",
"{",
"try",
"{",
"FloatReference",
"ref",
"=",
"queue",
".",
"take",
"(",
")",
";",
"float",
"value",
"=",
"ref",
".",
"getValue",
"(",
")",
";",
"return",
"value",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"ex",
")",
";",
"}",
"}"
] |
Returns item provided in different thread
@return
|
[
"Returns",
"item",
"provided",
"in",
"different",
"thread"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/stream/FloatGenerator.java#L49-L61
|
154,372
|
sdorra/ldap-unit
|
src/main/java/com/github/sdorra/ldap/LDAPRule.java
|
LDAPRule.getConnectionProperties
|
@SuppressWarnings("UseOfObsoleteCollectionType")
public Hashtable<String, String> getConnectionProperties()
{
StringBuilder url = new StringBuilder("ldap://");
url.append(host).append(":").append(String.valueOf(port)).append("/");
Hashtable<String, String> props = new Hashtable<String, String>(11);
props.put(LdapContext.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
props.put(LdapContext.PROVIDER_URL, url.toString());
props.put(LdapContext.SECURITY_AUTHENTICATION, "simple");
props.put(LdapContext.SECURITY_PRINCIPAL, additionalBindDN);
props.put(LdapContext.SECURITY_CREDENTIALS, additionalBindPassword);
return props;
}
|
java
|
@SuppressWarnings("UseOfObsoleteCollectionType")
public Hashtable<String, String> getConnectionProperties()
{
StringBuilder url = new StringBuilder("ldap://");
url.append(host).append(":").append(String.valueOf(port)).append("/");
Hashtable<String, String> props = new Hashtable<String, String>(11);
props.put(LdapContext.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
props.put(LdapContext.PROVIDER_URL, url.toString());
props.put(LdapContext.SECURITY_AUTHENTICATION, "simple");
props.put(LdapContext.SECURITY_PRINCIPAL, additionalBindDN);
props.put(LdapContext.SECURITY_CREDENTIALS, additionalBindPassword);
return props;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"UseOfObsoleteCollectionType\"",
")",
"public",
"Hashtable",
"<",
"String",
",",
"String",
">",
"getConnectionProperties",
"(",
")",
"{",
"StringBuilder",
"url",
"=",
"new",
"StringBuilder",
"(",
"\"ldap://\"",
")",
";",
"url",
".",
"append",
"(",
"host",
")",
".",
"append",
"(",
"\":\"",
")",
".",
"append",
"(",
"String",
".",
"valueOf",
"(",
"port",
")",
")",
".",
"append",
"(",
"\"/\"",
")",
";",
"Hashtable",
"<",
"String",
",",
"String",
">",
"props",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"String",
">",
"(",
"11",
")",
";",
"props",
".",
"put",
"(",
"LdapContext",
".",
"INITIAL_CONTEXT_FACTORY",
",",
"\"com.sun.jndi.ldap.LdapCtxFactory\"",
")",
";",
"props",
".",
"put",
"(",
"LdapContext",
".",
"PROVIDER_URL",
",",
"url",
".",
"toString",
"(",
")",
")",
";",
"props",
".",
"put",
"(",
"LdapContext",
".",
"SECURITY_AUTHENTICATION",
",",
"\"simple\"",
")",
";",
"props",
".",
"put",
"(",
"LdapContext",
".",
"SECURITY_PRINCIPAL",
",",
"additionalBindDN",
")",
";",
"props",
".",
"put",
"(",
"LdapContext",
".",
"SECURITY_CREDENTIALS",
",",
"additionalBindPassword",
")",
";",
"return",
"props",
";",
"}"
] |
Returns jndi properties for the in memory directory server.
@return jndi properties
|
[
"Returns",
"jndi",
"properties",
"for",
"the",
"in",
"memory",
"directory",
"server",
"."
] |
864c1766d304345bcfe6f3428d52db2132532bb2
|
https://github.com/sdorra/ldap-unit/blob/864c1766d304345bcfe6f3428d52db2132532bb2/src/main/java/com/github/sdorra/ldap/LDAPRule.java#L150-L167
|
154,373
|
jbundle/jbundle
|
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/EMailTrxMessageIn.java
|
EMailTrxMessageIn.isEndChar
|
public boolean isEndChar(char chChar)
{
if ((chChar == '\n')
|| (chChar == '\r')
|| (chChar == JAVA_NEW_LINE))
return true;
if (chChar == '<')
return true;
return false;
}
|
java
|
public boolean isEndChar(char chChar)
{
if ((chChar == '\n')
|| (chChar == '\r')
|| (chChar == JAVA_NEW_LINE))
return true;
if (chChar == '<')
return true;
return false;
}
|
[
"public",
"boolean",
"isEndChar",
"(",
"char",
"chChar",
")",
"{",
"if",
"(",
"(",
"chChar",
"==",
"'",
"'",
")",
"||",
"(",
"chChar",
"==",
"'",
"'",
")",
"||",
"(",
"chChar",
"==",
"JAVA_NEW_LINE",
")",
")",
"return",
"true",
";",
"if",
"(",
"chChar",
"==",
"'",
"'",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] |
Is this the ending character of the property?
|
[
"Is",
"this",
"the",
"ending",
"character",
"of",
"the",
"property?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/EMailTrxMessageIn.java#L131-L140
|
154,374
|
jbundle/jbundle
|
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/EMailTrxMessageIn.java
|
EMailTrxMessageIn.getEMailParams
|
public Map<String,Object> getEMailParams(String strMessage)
{
Map<String,Object> properties = new Hashtable<String,Object>();
int iIndex = this.getStartNextPropertyKey(-1, strMessage);
while (iIndex != -1)
{
int iIndexEnd = strMessage.indexOf(END_OF_KEY_CHAR, iIndex);
if (iIndexEnd == -1)
break;
String strKey = strMessage.substring(iIndex, iIndexEnd);
if (strKey.indexOf(' ') != -1)
strKey = strKey.substring(strKey.lastIndexOf(' ') + 1);
iIndex = this.getStartNextPropertyKey(iIndexEnd + 1, strMessage);
if (iIndex >= iIndexEnd)
{
for (iIndexEnd = iIndexEnd + 1; iIndexEnd < iIndex; iIndexEnd++)
{
char chChar = strMessage.charAt(iIndexEnd);
if (!this.isLeadingWhitespace(chChar))
break; // Start of value
}
if (iIndex == -1)
break;
for (int i = iIndex - 1; i >= iIndexEnd; i--)
{
char chChar = strMessage.charAt(i);
if (!this.isLeadingWhitespace(chChar))
{
String strValue = strMessage.substring(iIndexEnd, i + 1);
this.putProperty(properties, strKey, strValue);
break;
}
}
}
}
return properties;
}
|
java
|
public Map<String,Object> getEMailParams(String strMessage)
{
Map<String,Object> properties = new Hashtable<String,Object>();
int iIndex = this.getStartNextPropertyKey(-1, strMessage);
while (iIndex != -1)
{
int iIndexEnd = strMessage.indexOf(END_OF_KEY_CHAR, iIndex);
if (iIndexEnd == -1)
break;
String strKey = strMessage.substring(iIndex, iIndexEnd);
if (strKey.indexOf(' ') != -1)
strKey = strKey.substring(strKey.lastIndexOf(' ') + 1);
iIndex = this.getStartNextPropertyKey(iIndexEnd + 1, strMessage);
if (iIndex >= iIndexEnd)
{
for (iIndexEnd = iIndexEnd + 1; iIndexEnd < iIndex; iIndexEnd++)
{
char chChar = strMessage.charAt(iIndexEnd);
if (!this.isLeadingWhitespace(chChar))
break; // Start of value
}
if (iIndex == -1)
break;
for (int i = iIndex - 1; i >= iIndexEnd; i--)
{
char chChar = strMessage.charAt(i);
if (!this.isLeadingWhitespace(chChar))
{
String strValue = strMessage.substring(iIndexEnd, i + 1);
this.putProperty(properties, strKey, strValue);
break;
}
}
}
}
return properties;
}
|
[
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getEMailParams",
"(",
"String",
"strMessage",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"int",
"iIndex",
"=",
"this",
".",
"getStartNextPropertyKey",
"(",
"-",
"1",
",",
"strMessage",
")",
";",
"while",
"(",
"iIndex",
"!=",
"-",
"1",
")",
"{",
"int",
"iIndexEnd",
"=",
"strMessage",
".",
"indexOf",
"(",
"END_OF_KEY_CHAR",
",",
"iIndex",
")",
";",
"if",
"(",
"iIndexEnd",
"==",
"-",
"1",
")",
"break",
";",
"String",
"strKey",
"=",
"strMessage",
".",
"substring",
"(",
"iIndex",
",",
"iIndexEnd",
")",
";",
"if",
"(",
"strKey",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"strKey",
"=",
"strKey",
".",
"substring",
"(",
"strKey",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"iIndex",
"=",
"this",
".",
"getStartNextPropertyKey",
"(",
"iIndexEnd",
"+",
"1",
",",
"strMessage",
")",
";",
"if",
"(",
"iIndex",
">=",
"iIndexEnd",
")",
"{",
"for",
"(",
"iIndexEnd",
"=",
"iIndexEnd",
"+",
"1",
";",
"iIndexEnd",
"<",
"iIndex",
";",
"iIndexEnd",
"++",
")",
"{",
"char",
"chChar",
"=",
"strMessage",
".",
"charAt",
"(",
"iIndexEnd",
")",
";",
"if",
"(",
"!",
"this",
".",
"isLeadingWhitespace",
"(",
"chChar",
")",
")",
"break",
";",
"// Start of value",
"}",
"if",
"(",
"iIndex",
"==",
"-",
"1",
")",
"break",
";",
"for",
"(",
"int",
"i",
"=",
"iIndex",
"-",
"1",
";",
"i",
">=",
"iIndexEnd",
";",
"i",
"--",
")",
"{",
"char",
"chChar",
"=",
"strMessage",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"!",
"this",
".",
"isLeadingWhitespace",
"(",
"chChar",
")",
")",
"{",
"String",
"strValue",
"=",
"strMessage",
".",
"substring",
"(",
"iIndexEnd",
",",
"i",
"+",
"1",
")",
";",
"this",
".",
"putProperty",
"(",
"properties",
",",
"strKey",
",",
"strValue",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"return",
"properties",
";",
"}"
] |
Scan through this message and get the params to descriptions map.
@param externalMessage The received message to be converted to internal form.
@return The map of params to descriptions.
|
[
"Scan",
"through",
"this",
"message",
"and",
"get",
"the",
"params",
"to",
"descriptions",
"map",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/EMailTrxMessageIn.java#L146-L182
|
154,375
|
jbundle/jbundle
|
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/EMailTrxMessageIn.java
|
EMailTrxMessageIn.getStartNextPropertyKey
|
public int getStartNextPropertyKey(int iIndex, String strMessage)
{
for (iIndex = iIndex + 1; iIndex < strMessage.length(); iIndex++)
{
char chChar = strMessage.charAt(iIndex);
if (this.isEndChar(chChar))
break;
}
if (iIndex >= strMessage.length())
return -1;
int iNextProperty = strMessage.indexOf(END_OF_KEY_CHAR, iIndex);
if (iNextProperty == -1)
return -1; // Not found
for (int i = iNextProperty - 1; i >= 0; i--)
{
char chChar = strMessage.charAt(i);
if (this.isEndChar(chChar))
{ // Key always starts on a new line.
for (int k = i + 1; k < strMessage.length(); k++)
{ // Now go forward to the first character.
chChar = strMessage.charAt(k);
if (!this.isLeadingWhitespace(chChar))
{
return k;
}
}
}
}
return -1;
}
|
java
|
public int getStartNextPropertyKey(int iIndex, String strMessage)
{
for (iIndex = iIndex + 1; iIndex < strMessage.length(); iIndex++)
{
char chChar = strMessage.charAt(iIndex);
if (this.isEndChar(chChar))
break;
}
if (iIndex >= strMessage.length())
return -1;
int iNextProperty = strMessage.indexOf(END_OF_KEY_CHAR, iIndex);
if (iNextProperty == -1)
return -1; // Not found
for (int i = iNextProperty - 1; i >= 0; i--)
{
char chChar = strMessage.charAt(i);
if (this.isEndChar(chChar))
{ // Key always starts on a new line.
for (int k = i + 1; k < strMessage.length(); k++)
{ // Now go forward to the first character.
chChar = strMessage.charAt(k);
if (!this.isLeadingWhitespace(chChar))
{
return k;
}
}
}
}
return -1;
}
|
[
"public",
"int",
"getStartNextPropertyKey",
"(",
"int",
"iIndex",
",",
"String",
"strMessage",
")",
"{",
"for",
"(",
"iIndex",
"=",
"iIndex",
"+",
"1",
";",
"iIndex",
"<",
"strMessage",
".",
"length",
"(",
")",
";",
"iIndex",
"++",
")",
"{",
"char",
"chChar",
"=",
"strMessage",
".",
"charAt",
"(",
"iIndex",
")",
";",
"if",
"(",
"this",
".",
"isEndChar",
"(",
"chChar",
")",
")",
"break",
";",
"}",
"if",
"(",
"iIndex",
">=",
"strMessage",
".",
"length",
"(",
")",
")",
"return",
"-",
"1",
";",
"int",
"iNextProperty",
"=",
"strMessage",
".",
"indexOf",
"(",
"END_OF_KEY_CHAR",
",",
"iIndex",
")",
";",
"if",
"(",
"iNextProperty",
"==",
"-",
"1",
")",
"return",
"-",
"1",
";",
"// Not found",
"for",
"(",
"int",
"i",
"=",
"iNextProperty",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"char",
"chChar",
"=",
"strMessage",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"this",
".",
"isEndChar",
"(",
"chChar",
")",
")",
"{",
"// Key always starts on a new line.",
"for",
"(",
"int",
"k",
"=",
"i",
"+",
"1",
";",
"k",
"<",
"strMessage",
".",
"length",
"(",
")",
";",
"k",
"++",
")",
"{",
"// Now go forward to the first character.",
"chChar",
"=",
"strMessage",
".",
"charAt",
"(",
"k",
")",
";",
"if",
"(",
"!",
"this",
".",
"isLeadingWhitespace",
"(",
"chChar",
")",
")",
"{",
"return",
"k",
";",
"}",
"}",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
Get the next property key after this location.
@param iIndex start at this location +1.
@param strMessage The message to search through.
@return The position of this property key (or -1 if EOF).
|
[
"Get",
"the",
"next",
"property",
"key",
"after",
"this",
"location",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/EMailTrxMessageIn.java#L212-L241
|
154,376
|
pressgang-ccms/PressGangCCMSQuery
|
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFieldFilter.java
|
BaseFieldFilter.resetAllValues
|
protected void resetAllValues() {
logic = new FilterFieldStringData(CommonFilterConstants.LOGIC_FILTER_VAR, CommonFilterConstants.LOGIC_FILTER_VAR_DESC);
filterVars.clear();
filterVars.add(logic);
}
|
java
|
protected void resetAllValues() {
logic = new FilterFieldStringData(CommonFilterConstants.LOGIC_FILTER_VAR, CommonFilterConstants.LOGIC_FILTER_VAR_DESC);
filterVars.clear();
filterVars.add(logic);
}
|
[
"protected",
"void",
"resetAllValues",
"(",
")",
"{",
"logic",
"=",
"new",
"FilterFieldStringData",
"(",
"CommonFilterConstants",
".",
"LOGIC_FILTER_VAR",
",",
"CommonFilterConstants",
".",
"LOGIC_FILTER_VAR_DESC",
")",
";",
"filterVars",
".",
"clear",
"(",
")",
";",
"filterVars",
".",
"add",
"(",
"logic",
")",
";",
"}"
] |
Reset all of the Field Variables to their default values.
|
[
"Reset",
"all",
"of",
"the",
"Field",
"Variables",
"to",
"their",
"default",
"values",
"."
] |
2bb23430adab956737d0301cd2ea933f986dd85b
|
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFieldFilter.java#L60-L65
|
154,377
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/util/ByteUtil.java
|
ByteUtil.appendByte
|
public static byte[] appendByte(byte[] bytes, byte b) {
byte[] result = Arrays.copyOf(bytes, bytes.length + 1);
result[result.length - 1] = b;
return result;
}
|
java
|
public static byte[] appendByte(byte[] bytes, byte b) {
byte[] result = Arrays.copyOf(bytes, bytes.length + 1);
result[result.length - 1] = b;
return result;
}
|
[
"public",
"static",
"byte",
"[",
"]",
"appendByte",
"(",
"byte",
"[",
"]",
"bytes",
",",
"byte",
"b",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"Arrays",
".",
"copyOf",
"(",
"bytes",
",",
"bytes",
".",
"length",
"+",
"1",
")",
";",
"result",
"[",
"result",
".",
"length",
"-",
"1",
"]",
"=",
"b",
";",
"return",
"result",
";",
"}"
] |
Creates a copy of bytes and appends b to the end of it
@param bytes
bytes data
@param b
append byte
@return appended byte[]
|
[
"Creates",
"a",
"copy",
"of",
"bytes",
"and",
"appends",
"b",
"to",
"the",
"end",
"of",
"it"
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L46-L50
|
154,378
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/util/ByteUtil.java
|
ByteUtil.matchingNibbleLength
|
public static int matchingNibbleLength(byte[] a, byte[] b) {
int i = 0;
int length = a.length < b.length ? a.length : b.length;
while (i < length) {
if (a[i] != b[i])
return i;
i++;
}
return i;
}
|
java
|
public static int matchingNibbleLength(byte[] a, byte[] b) {
int i = 0;
int length = a.length < b.length ? a.length : b.length;
while (i < length) {
if (a[i] != b[i])
return i;
i++;
}
return i;
}
|
[
"public",
"static",
"int",
"matchingNibbleLength",
"(",
"byte",
"[",
"]",
"a",
",",
"byte",
"[",
"]",
"b",
")",
"{",
"int",
"i",
"=",
"0",
";",
"int",
"length",
"=",
"a",
".",
"length",
"<",
"b",
".",
"length",
"?",
"a",
".",
"length",
":",
"b",
".",
"length",
";",
"while",
"(",
"i",
"<",
"length",
")",
"{",
"if",
"(",
"a",
"[",
"i",
"]",
"!=",
"b",
"[",
"i",
"]",
")",
"return",
"i",
";",
"i",
"++",
";",
"}",
"return",
"i",
";",
"}"
] |
Returns the amount of nibbles that match each other from 0 ... amount will
never be larger than smallest input
@param a
first input
@param b
second input
@return Number of bytes that match
|
[
"Returns",
"the",
"amount",
"of",
"nibbles",
"that",
"match",
"each",
"other",
"from",
"0",
"...",
"amount",
"will",
"never",
"be",
"larger",
"than",
"smallest",
"input"
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L135-L144
|
154,379
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/util/ByteUtil.java
|
ByteUtil.longToBytesNoLeadZeroes
|
public static byte[] longToBytesNoLeadZeroes(long val) {
// todo: improve performance by while strip numbers until (long >> 8 == 0)
if (val == 0)
return EMPTY_BYTE_ARRAY;
byte[] data = ByteBuffer.allocate(8).putLong(val).array();
return stripLeadingZeroes(data);
}
|
java
|
public static byte[] longToBytesNoLeadZeroes(long val) {
// todo: improve performance by while strip numbers until (long >> 8 == 0)
if (val == 0)
return EMPTY_BYTE_ARRAY;
byte[] data = ByteBuffer.allocate(8).putLong(val).array();
return stripLeadingZeroes(data);
}
|
[
"public",
"static",
"byte",
"[",
"]",
"longToBytesNoLeadZeroes",
"(",
"long",
"val",
")",
"{",
"// todo: improve performance by while strip numbers until (long >> 8 == 0)",
"if",
"(",
"val",
"==",
"0",
")",
"return",
"EMPTY_BYTE_ARRAY",
";",
"byte",
"[",
"]",
"data",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"8",
")",
".",
"putLong",
"(",
"val",
")",
".",
"array",
"(",
")",
";",
"return",
"stripLeadingZeroes",
"(",
"data",
")",
";",
"}"
] |
Converts a long value into a byte array.
@param val
- long value to convert
@return decimal value with leading byte that are zeroes striped
|
[
"Converts",
"a",
"long",
"value",
"into",
"a",
"byte",
"array",
"."
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L164-L173
|
154,380
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/util/ByteUtil.java
|
ByteUtil.nibblesToPrettyString
|
public static String nibblesToPrettyString(byte[] nibbles) {
StringBuilder builder = new StringBuilder();
for (byte nibble : nibbles) {
final String nibbleString = oneByteToHexString(nibble);
builder.append("\\x").append(nibbleString);
}
return builder.toString();
}
|
java
|
public static String nibblesToPrettyString(byte[] nibbles) {
StringBuilder builder = new StringBuilder();
for (byte nibble : nibbles) {
final String nibbleString = oneByteToHexString(nibble);
builder.append("\\x").append(nibbleString);
}
return builder.toString();
}
|
[
"public",
"static",
"String",
"nibblesToPrettyString",
"(",
"byte",
"[",
"]",
"nibbles",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"byte",
"nibble",
":",
"nibbles",
")",
"{",
"final",
"String",
"nibbleString",
"=",
"oneByteToHexString",
"(",
"nibble",
")",
";",
"builder",
".",
"append",
"(",
"\"\\\\x\"",
")",
".",
"append",
"(",
"nibbleString",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] |
Turn nibbles to a pretty looking output string
Example. [ 1, 2, 3, 4, 5 ] becomes '\x11\x23\x45'
@param nibbles
- getting byte of data [ 04 ] and turning it to a '\x04'
representation
@return pretty string of nibbles
|
[
"Turn",
"nibbles",
"to",
"a",
"pretty",
"looking",
"output",
"string"
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L287-L294
|
154,381
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/util/ByteUtil.java
|
ByteUtil.numBytes
|
public static int numBytes(String val) {
BigInteger bInt = new BigInteger(val);
int bytes = 0;
while (!bInt.equals(BigInteger.ZERO)) {
bInt = bInt.shiftRight(8);
++bytes;
}
if (bytes == 0)
++bytes;
return bytes;
}
|
java
|
public static int numBytes(String val) {
BigInteger bInt = new BigInteger(val);
int bytes = 0;
while (!bInt.equals(BigInteger.ZERO)) {
bInt = bInt.shiftRight(8);
++bytes;
}
if (bytes == 0)
++bytes;
return bytes;
}
|
[
"public",
"static",
"int",
"numBytes",
"(",
"String",
"val",
")",
"{",
"BigInteger",
"bInt",
"=",
"new",
"BigInteger",
"(",
"val",
")",
";",
"int",
"bytes",
"=",
"0",
";",
"while",
"(",
"!",
"bInt",
".",
"equals",
"(",
"BigInteger",
".",
"ZERO",
")",
")",
"{",
"bInt",
"=",
"bInt",
".",
"shiftRight",
"(",
"8",
")",
";",
"++",
"bytes",
";",
"}",
"if",
"(",
"bytes",
"==",
"0",
")",
"++",
"bytes",
";",
"return",
"bytes",
";",
"}"
] |
Calculate the number of bytes need to encode the number
@param val
- number
@return number of min bytes used to encode the number
|
[
"Calculate",
"the",
"number",
"of",
"bytes",
"need",
"to",
"encode",
"the",
"number"
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L310-L322
|
154,382
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/util/ByteUtil.java
|
ByteUtil.encodeDataList
|
public static byte[] encodeDataList(Object... args) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (Object arg : args) {
byte[] val = encodeValFor32Bits(arg);
try {
baos.write(val);
} catch (IOException e) {
throw new Error("Happen something that should never happen ", e);
}
}
return baos.toByteArray();
}
|
java
|
public static byte[] encodeDataList(Object... args) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (Object arg : args) {
byte[] val = encodeValFor32Bits(arg);
try {
baos.write(val);
} catch (IOException e) {
throw new Error("Happen something that should never happen ", e);
}
}
return baos.toByteArray();
}
|
[
"public",
"static",
"byte",
"[",
"]",
"encodeDataList",
"(",
"Object",
"...",
"args",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"for",
"(",
"Object",
"arg",
":",
"args",
")",
"{",
"byte",
"[",
"]",
"val",
"=",
"encodeValFor32Bits",
"(",
"arg",
")",
";",
"try",
"{",
"baos",
".",
"write",
"(",
"val",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"Happen something that should never happen \"",
",",
"e",
")",
";",
"}",
"}",
"return",
"baos",
".",
"toByteArray",
"(",
")",
";",
"}"
] |
encode the values and concatenate together
@param args
Object
@return byte[]
|
[
"encode",
"the",
"values",
"and",
"concatenate",
"together"
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L362-L373
|
154,383
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/util/ByteUtil.java
|
ByteUtil.increment
|
public static boolean increment(byte[] bytes) {
final int startIndex = 0;
int i;
for (i = bytes.length - 1; i >= startIndex; i--) {
bytes[i]++;
if (bytes[i] != 0)
break;
}
// we return false when all bytes are 0 again
return (i >= startIndex || bytes[startIndex] != 0);
}
|
java
|
public static boolean increment(byte[] bytes) {
final int startIndex = 0;
int i;
for (i = bytes.length - 1; i >= startIndex; i--) {
bytes[i]++;
if (bytes[i] != 0)
break;
}
// we return false when all bytes are 0 again
return (i >= startIndex || bytes[startIndex] != 0);
}
|
[
"public",
"static",
"boolean",
"increment",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"final",
"int",
"startIndex",
"=",
"0",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"bytes",
".",
"length",
"-",
"1",
";",
"i",
">=",
"startIndex",
";",
"i",
"--",
")",
"{",
"bytes",
"[",
"i",
"]",
"++",
";",
"if",
"(",
"bytes",
"[",
"i",
"]",
"!=",
"0",
")",
"break",
";",
"}",
"// we return false when all bytes are 0 again",
"return",
"(",
"i",
">=",
"startIndex",
"||",
"bytes",
"[",
"startIndex",
"]",
"!=",
"0",
")",
";",
"}"
] |
increment byte array as a number until max is reached
@param bytes
byte[]
@return boolean
|
[
"increment",
"byte",
"array",
"as",
"a",
"number",
"until",
"max",
"is",
"reached"
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L412-L422
|
154,384
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/util/ByteUtil.java
|
ByteUtil.copyToArray
|
public static byte[] copyToArray(BigInteger value) {
byte[] src = ByteUtil.bigIntegerToBytes(value);
byte[] dest = ByteBuffer.allocate(32).array();
System.arraycopy(src, 0, dest, dest.length - src.length, src.length);
return dest;
}
|
java
|
public static byte[] copyToArray(BigInteger value) {
byte[] src = ByteUtil.bigIntegerToBytes(value);
byte[] dest = ByteBuffer.allocate(32).array();
System.arraycopy(src, 0, dest, dest.length - src.length, src.length);
return dest;
}
|
[
"public",
"static",
"byte",
"[",
"]",
"copyToArray",
"(",
"BigInteger",
"value",
")",
"{",
"byte",
"[",
"]",
"src",
"=",
"ByteUtil",
".",
"bigIntegerToBytes",
"(",
"value",
")",
";",
"byte",
"[",
"]",
"dest",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"32",
")",
".",
"array",
"(",
")",
";",
"System",
".",
"arraycopy",
"(",
"src",
",",
"0",
",",
"dest",
",",
"dest",
".",
"length",
"-",
"src",
".",
"length",
",",
"src",
".",
"length",
")",
";",
"return",
"dest",
";",
"}"
] |
Utility function to copy a byte array into a new byte array with given size.
If the src length is smaller than the given size, the result will be
left-padded with zeros.
@param value
- a BigInteger with a maximum value of 2^256-1
@return Byte array of given size with a copy of the <code>src</code>
|
[
"Utility",
"function",
"to",
"copy",
"a",
"byte",
"array",
"into",
"a",
"new",
"byte",
"array",
"with",
"given",
"size",
".",
"If",
"the",
"src",
"length",
"is",
"smaller",
"than",
"the",
"given",
"size",
"the",
"result",
"will",
"be",
"left",
"-",
"padded",
"with",
"zeros",
"."
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L433-L438
|
154,385
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/util/ByteUtil.java
|
ByteUtil.xorAlignRight
|
public static byte[] xorAlignRight(byte[] b1, byte[] b2) {
if (b1.length > b2.length) {
byte[] b2_ = new byte[b1.length];
System.arraycopy(b2, 0, b2_, b1.length - b2.length, b2.length);
b2 = b2_;
} else if (b2.length > b1.length) {
byte[] b1_ = new byte[b2.length];
System.arraycopy(b1, 0, b1_, b2.length - b1.length, b1.length);
b1 = b1_;
}
return xor(b1, b2);
}
|
java
|
public static byte[] xorAlignRight(byte[] b1, byte[] b2) {
if (b1.length > b2.length) {
byte[] b2_ = new byte[b1.length];
System.arraycopy(b2, 0, b2_, b1.length - b2.length, b2.length);
b2 = b2_;
} else if (b2.length > b1.length) {
byte[] b1_ = new byte[b2.length];
System.arraycopy(b1, 0, b1_, b2.length - b1.length, b1.length);
b1 = b1_;
}
return xor(b1, b2);
}
|
[
"public",
"static",
"byte",
"[",
"]",
"xorAlignRight",
"(",
"byte",
"[",
"]",
"b1",
",",
"byte",
"[",
"]",
"b2",
")",
"{",
"if",
"(",
"b1",
".",
"length",
">",
"b2",
".",
"length",
")",
"{",
"byte",
"[",
"]",
"b2_",
"=",
"new",
"byte",
"[",
"b1",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"b2",
",",
"0",
",",
"b2_",
",",
"b1",
".",
"length",
"-",
"b2",
".",
"length",
",",
"b2",
".",
"length",
")",
";",
"b2",
"=",
"b2_",
";",
"}",
"else",
"if",
"(",
"b2",
".",
"length",
">",
"b1",
".",
"length",
")",
"{",
"byte",
"[",
"]",
"b1_",
"=",
"new",
"byte",
"[",
"b2",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"b1",
",",
"0",
",",
"b1_",
",",
"b2",
".",
"length",
"-",
"b1",
".",
"length",
",",
"b1",
".",
"length",
")",
";",
"b1",
"=",
"b1_",
";",
"}",
"return",
"xor",
"(",
"b1",
",",
"b2",
")",
";",
"}"
] |
XORs byte arrays of different lengths by aligning length of the shortest via
adding zeros at beginning
@param b1
b1
@param b2
b2
@return xorAlignRight
|
[
"XORs",
"byte",
"arrays",
"of",
"different",
"lengths",
"by",
"aligning",
"length",
"of",
"the",
"shortest",
"via",
"adding",
"zeros",
"at",
"beginning"
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L510-L522
|
154,386
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/util/ByteUtil.java
|
ByteUtil.hexStringToBytes
|
public static byte[] hexStringToBytes(String data) {
if (data == null)
return EMPTY_BYTE_ARRAY;
if (data.startsWith("0x"))
data = data.substring(2);
return Hex.decode(data);
}
|
java
|
public static byte[] hexStringToBytes(String data) {
if (data == null)
return EMPTY_BYTE_ARRAY;
if (data.startsWith("0x"))
data = data.substring(2);
return Hex.decode(data);
}
|
[
"public",
"static",
"byte",
"[",
"]",
"hexStringToBytes",
"(",
"String",
"data",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"return",
"EMPTY_BYTE_ARRAY",
";",
"if",
"(",
"data",
".",
"startsWith",
"(",
"\"0x\"",
")",
")",
"data",
"=",
"data",
".",
"substring",
"(",
"2",
")",
";",
"return",
"Hex",
".",
"decode",
"(",
"data",
")",
";",
"}"
] |
Converts string hex representation to data bytes
@param data
String like '0xa5e..' or just 'a5e..'
@return decoded bytes array
|
[
"Converts",
"string",
"hex",
"representation",
"to",
"data",
"bytes"
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L661-L667
|
154,387
|
openengsb-labs/labs-endtoend
|
core/src/main/java/org/openengsb/labs/endtoend/util/MavenConfigurationHelper.java
|
MavenConfigurationHelper.getConfig
|
public static MavenConfiguration getConfig(final File settingsFile, final Properties props) throws Exception {
props.setProperty(ServiceConstants.PID + MavenConstants.PROPERTY_SETTINGS_FILE, settingsFile.toURI()
.toASCIIString());
final MavenConfigurationImpl config = new MavenConfigurationImpl(new PropertiesPropertyResolver(props),
ServiceConstants.PID);
final MavenSettings settings = new MavenSettingsImpl(settingsFile.toURI().toURL());
config.setSettings(settings);
return config;
}
|
java
|
public static MavenConfiguration getConfig(final File settingsFile, final Properties props) throws Exception {
props.setProperty(ServiceConstants.PID + MavenConstants.PROPERTY_SETTINGS_FILE, settingsFile.toURI()
.toASCIIString());
final MavenConfigurationImpl config = new MavenConfigurationImpl(new PropertiesPropertyResolver(props),
ServiceConstants.PID);
final MavenSettings settings = new MavenSettingsImpl(settingsFile.toURI().toURL());
config.setSettings(settings);
return config;
}
|
[
"public",
"static",
"MavenConfiguration",
"getConfig",
"(",
"final",
"File",
"settingsFile",
",",
"final",
"Properties",
"props",
")",
"throws",
"Exception",
"{",
"props",
".",
"setProperty",
"(",
"ServiceConstants",
".",
"PID",
"+",
"MavenConstants",
".",
"PROPERTY_SETTINGS_FILE",
",",
"settingsFile",
".",
"toURI",
"(",
")",
".",
"toASCIIString",
"(",
")",
")",
";",
"final",
"MavenConfigurationImpl",
"config",
"=",
"new",
"MavenConfigurationImpl",
"(",
"new",
"PropertiesPropertyResolver",
"(",
"props",
")",
",",
"ServiceConstants",
".",
"PID",
")",
";",
"final",
"MavenSettings",
"settings",
"=",
"new",
"MavenSettingsImpl",
"(",
"settingsFile",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
")",
";",
"config",
".",
"setSettings",
"(",
"settings",
")",
";",
"return",
"config",
";",
"}"
] |
Load settings.xml file and apply custom properties.
|
[
"Load",
"settings",
".",
"xml",
"file",
"and",
"apply",
"custom",
"properties",
"."
] |
5604227b47cd9f45f1757256ca0fd0ddf5ac5871
|
https://github.com/openengsb-labs/labs-endtoend/blob/5604227b47cd9f45f1757256ca0fd0ddf5ac5871/core/src/main/java/org/openengsb/labs/endtoend/util/MavenConfigurationHelper.java#L20-L34
|
154,388
|
openengsb-labs/labs-endtoend
|
core/src/main/java/org/openengsb/labs/endtoend/util/MavenConfigurationHelper.java
|
MavenConfigurationHelper.getMavenHome
|
public static File getMavenHome() throws Exception {
final String command;
switch (OS.current()) {
case LINUX:
case MAC:
command = "mvn";
break;
case WINDOWS:
command = "mvn.bat";
break;
default:
throw new IllegalStateException("invalid o/s");
}
String pathVar = System.getenv("PATH");
String[] pathArray = pathVar.split(File.pathSeparator);
for (String path : pathArray) {
File file = new File(path, command);
if (file.exists() && file.isFile() && file.canExecute()) {
/** unwrap symbolic links */
File exec = file.getCanonicalFile();
/** assume ${maven.home}/bin/exec convention */
File home = exec.getParentFile().getParentFile();
return home;
}
}
throw new IllegalStateException("Maven home not found.");
}
|
java
|
public static File getMavenHome() throws Exception {
final String command;
switch (OS.current()) {
case LINUX:
case MAC:
command = "mvn";
break;
case WINDOWS:
command = "mvn.bat";
break;
default:
throw new IllegalStateException("invalid o/s");
}
String pathVar = System.getenv("PATH");
String[] pathArray = pathVar.split(File.pathSeparator);
for (String path : pathArray) {
File file = new File(path, command);
if (file.exists() && file.isFile() && file.canExecute()) {
/** unwrap symbolic links */
File exec = file.getCanonicalFile();
/** assume ${maven.home}/bin/exec convention */
File home = exec.getParentFile().getParentFile();
return home;
}
}
throw new IllegalStateException("Maven home not found.");
}
|
[
"public",
"static",
"File",
"getMavenHome",
"(",
")",
"throws",
"Exception",
"{",
"final",
"String",
"command",
";",
"switch",
"(",
"OS",
".",
"current",
"(",
")",
")",
"{",
"case",
"LINUX",
":",
"case",
"MAC",
":",
"command",
"=",
"\"mvn\"",
";",
"break",
";",
"case",
"WINDOWS",
":",
"command",
"=",
"\"mvn.bat\"",
";",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalStateException",
"(",
"\"invalid o/s\"",
")",
";",
"}",
"String",
"pathVar",
"=",
"System",
".",
"getenv",
"(",
"\"PATH\"",
")",
";",
"String",
"[",
"]",
"pathArray",
"=",
"pathVar",
".",
"split",
"(",
"File",
".",
"pathSeparator",
")",
";",
"for",
"(",
"String",
"path",
":",
"pathArray",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
",",
"command",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
"&&",
"file",
".",
"isFile",
"(",
")",
"&&",
"file",
".",
"canExecute",
"(",
")",
")",
"{",
"/** unwrap symbolic links */",
"File",
"exec",
"=",
"file",
".",
"getCanonicalFile",
"(",
")",
";",
"/** assume ${maven.home}/bin/exec convention */",
"File",
"home",
"=",
"exec",
".",
"getParentFile",
"(",
")",
".",
"getParentFile",
"(",
")",
";",
"return",
"home",
";",
"}",
"}",
"throw",
"new",
"IllegalStateException",
"(",
"\"Maven home not found.\"",
")",
";",
"}"
] |
Discover maven home from executable on PATH, using conventions.
|
[
"Discover",
"maven",
"home",
"from",
"executable",
"on",
"PATH",
"using",
"conventions",
"."
] |
5604227b47cd9f45f1757256ca0fd0ddf5ac5871
|
https://github.com/openengsb-labs/labs-endtoend/blob/5604227b47cd9f45f1757256ca0fd0ddf5ac5871/core/src/main/java/org/openengsb/labs/endtoend/util/MavenConfigurationHelper.java#L39-L65
|
154,389
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/time/MutableClock.java
|
MutableClock.getZonedDateTime
|
public ZonedDateTime getZonedDateTime()
{
return ZonedDateTime.of(
get(ChronoField.YEAR),
get(ChronoField.MONTH_OF_YEAR),
get(ChronoField.DAY_OF_MONTH),
get(ChronoField.HOUR_OF_DAY),
get(ChronoField.MINUTE_OF_HOUR),
get(ChronoField.SECOND_OF_MINUTE),
get(ChronoField.NANO_OF_SECOND),
clock.getZone());
}
|
java
|
public ZonedDateTime getZonedDateTime()
{
return ZonedDateTime.of(
get(ChronoField.YEAR),
get(ChronoField.MONTH_OF_YEAR),
get(ChronoField.DAY_OF_MONTH),
get(ChronoField.HOUR_OF_DAY),
get(ChronoField.MINUTE_OF_HOUR),
get(ChronoField.SECOND_OF_MINUTE),
get(ChronoField.NANO_OF_SECOND),
clock.getZone());
}
|
[
"public",
"ZonedDateTime",
"getZonedDateTime",
"(",
")",
"{",
"return",
"ZonedDateTime",
".",
"of",
"(",
"get",
"(",
"ChronoField",
".",
"YEAR",
")",
",",
"get",
"(",
"ChronoField",
".",
"MONTH_OF_YEAR",
")",
",",
"get",
"(",
"ChronoField",
".",
"DAY_OF_MONTH",
")",
",",
"get",
"(",
"ChronoField",
".",
"HOUR_OF_DAY",
")",
",",
"get",
"(",
"ChronoField",
".",
"MINUTE_OF_HOUR",
")",
",",
"get",
"(",
"ChronoField",
".",
"SECOND_OF_MINUTE",
")",
",",
"get",
"(",
"ChronoField",
".",
"NANO_OF_SECOND",
")",
",",
"clock",
".",
"getZone",
"(",
")",
")",
";",
"}"
] |
Returns ZonedDateTime created from latest update.
@return
|
[
"Returns",
"ZonedDateTime",
"created",
"from",
"latest",
"update",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/time/MutableClock.java#L127-L138
|
154,390
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/time/MutableClock.java
|
MutableClock.setMillis
|
public void setMillis(long millis)
{
ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneOffset.UTC);
set(zonedDateTime);
}
|
java
|
public void setMillis(long millis)
{
ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneOffset.UTC);
set(zonedDateTime);
}
|
[
"public",
"void",
"setMillis",
"(",
"long",
"millis",
")",
"{",
"ZonedDateTime",
"zonedDateTime",
"=",
"ZonedDateTime",
".",
"ofInstant",
"(",
"Instant",
".",
"ofEpochMilli",
"(",
"millis",
")",
",",
"ZoneOffset",
".",
"UTC",
")",
";",
"set",
"(",
"zonedDateTime",
")",
";",
"}"
] |
Sets time by using milli seconds from epoch.
@param millis
|
[
"Sets",
"time",
"by",
"using",
"milli",
"seconds",
"from",
"epoch",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/time/MutableClock.java#L143-L147
|
154,391
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/ClassProject.java
|
ClassProject.getFileName
|
public String getFileName(String strFileName, String strPackage, CodeType codeType, boolean fullPath, boolean sourcePath)
{
ProgramControl recProgramControl = (ProgramControl)this.getRecordOwner().getRecord(ProgramControl.PROGRAM_CONTROL_FILE);
if (recProgramControl == null)
recProgramControl = new ProgramControl(this.findRecordOwner());
String packagePath = DBConstants.BLANK;
if (strPackage != null)
{
strPackage = this.getFullPackage(codeType, strPackage);
packagePath = strPackage.replace('.', '/') + "/";
}
String strFileRoot = DBConstants.BLANK;
if (fullPath)
{
strFileRoot = recProgramControl.getBasePath();
if (!strFileRoot.endsWith("/"))
strFileRoot += "/";
}
String strSourcePath = null;
if (sourcePath)
{
strSourcePath = recProgramControl.getField(ProgramControl.SOURCE_DIRECTORY).toString();
if (codeType == CodeType.RESOURCE_PROPERTIES)
if (!recProgramControl.getField(ProgramControl.RESOURCES_DIRECTORY).isNull())
strSourcePath = recProgramControl.getField(ProgramControl.RESOURCES_DIRECTORY).toString();
}
else
strSourcePath = recProgramControl.getField(ProgramControl.CLASS_DIRECTORY).toString();
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
{
String strSrcPath = this.getPath(codeType, false);
if (strSrcPath.length() > 0)
{
if (!strSrcPath.endsWith("/"))
strSrcPath += "/";
if (!strSrcPath.endsWith(strSourcePath))
strSourcePath = strSrcPath + strSourcePath;
else
strSourcePath = strSrcPath;
}
}
if (strFileName == null)
strFileName = DBConstants.BLANK;
if (strFileName.length() > 0)
if (strFileName.indexOf(".") == -1)
{
if (codeType == CodeType.RESOURCE_PROPERTIES)
strFileName = strFileName + ".properties";
else
strFileName = strFileName + ".java";
}
strFileName = strFileRoot + strSourcePath + packagePath + strFileName;
return strFileName;
}
|
java
|
public String getFileName(String strFileName, String strPackage, CodeType codeType, boolean fullPath, boolean sourcePath)
{
ProgramControl recProgramControl = (ProgramControl)this.getRecordOwner().getRecord(ProgramControl.PROGRAM_CONTROL_FILE);
if (recProgramControl == null)
recProgramControl = new ProgramControl(this.findRecordOwner());
String packagePath = DBConstants.BLANK;
if (strPackage != null)
{
strPackage = this.getFullPackage(codeType, strPackage);
packagePath = strPackage.replace('.', '/') + "/";
}
String strFileRoot = DBConstants.BLANK;
if (fullPath)
{
strFileRoot = recProgramControl.getBasePath();
if (!strFileRoot.endsWith("/"))
strFileRoot += "/";
}
String strSourcePath = null;
if (sourcePath)
{
strSourcePath = recProgramControl.getField(ProgramControl.SOURCE_DIRECTORY).toString();
if (codeType == CodeType.RESOURCE_PROPERTIES)
if (!recProgramControl.getField(ProgramControl.RESOURCES_DIRECTORY).isNull())
strSourcePath = recProgramControl.getField(ProgramControl.RESOURCES_DIRECTORY).toString();
}
else
strSourcePath = recProgramControl.getField(ProgramControl.CLASS_DIRECTORY).toString();
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
{
String strSrcPath = this.getPath(codeType, false);
if (strSrcPath.length() > 0)
{
if (!strSrcPath.endsWith("/"))
strSrcPath += "/";
if (!strSrcPath.endsWith(strSourcePath))
strSourcePath = strSrcPath + strSourcePath;
else
strSourcePath = strSrcPath;
}
}
if (strFileName == null)
strFileName = DBConstants.BLANK;
if (strFileName.length() > 0)
if (strFileName.indexOf(".") == -1)
{
if (codeType == CodeType.RESOURCE_PROPERTIES)
strFileName = strFileName + ".properties";
else
strFileName = strFileName + ".java";
}
strFileName = strFileRoot + strSourcePath + packagePath + strFileName;
return strFileName;
}
|
[
"public",
"String",
"getFileName",
"(",
"String",
"strFileName",
",",
"String",
"strPackage",
",",
"CodeType",
"codeType",
",",
"boolean",
"fullPath",
",",
"boolean",
"sourcePath",
")",
"{",
"ProgramControl",
"recProgramControl",
"=",
"(",
"ProgramControl",
")",
"this",
".",
"getRecordOwner",
"(",
")",
".",
"getRecord",
"(",
"ProgramControl",
".",
"PROGRAM_CONTROL_FILE",
")",
";",
"if",
"(",
"recProgramControl",
"==",
"null",
")",
"recProgramControl",
"=",
"new",
"ProgramControl",
"(",
"this",
".",
"findRecordOwner",
"(",
")",
")",
";",
"String",
"packagePath",
"=",
"DBConstants",
".",
"BLANK",
";",
"if",
"(",
"strPackage",
"!=",
"null",
")",
"{",
"strPackage",
"=",
"this",
".",
"getFullPackage",
"(",
"codeType",
",",
"strPackage",
")",
";",
"packagePath",
"=",
"strPackage",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\"/\"",
";",
"}",
"String",
"strFileRoot",
"=",
"DBConstants",
".",
"BLANK",
";",
"if",
"(",
"fullPath",
")",
"{",
"strFileRoot",
"=",
"recProgramControl",
".",
"getBasePath",
"(",
")",
";",
"if",
"(",
"!",
"strFileRoot",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"strFileRoot",
"+=",
"\"/\"",
";",
"}",
"String",
"strSourcePath",
"=",
"null",
";",
"if",
"(",
"sourcePath",
")",
"{",
"strSourcePath",
"=",
"recProgramControl",
".",
"getField",
"(",
"ProgramControl",
".",
"SOURCE_DIRECTORY",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"codeType",
"==",
"CodeType",
".",
"RESOURCE_PROPERTIES",
")",
"if",
"(",
"!",
"recProgramControl",
".",
"getField",
"(",
"ProgramControl",
".",
"RESOURCES_DIRECTORY",
")",
".",
"isNull",
"(",
")",
")",
"strSourcePath",
"=",
"recProgramControl",
".",
"getField",
"(",
"ProgramControl",
".",
"RESOURCES_DIRECTORY",
")",
".",
"toString",
"(",
")",
";",
"}",
"else",
"strSourcePath",
"=",
"recProgramControl",
".",
"getField",
"(",
"ProgramControl",
".",
"CLASS_DIRECTORY",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"(",
"this",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_CURRENT",
")",
"||",
"(",
"this",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_IN_PROGRESS",
")",
")",
"{",
"String",
"strSrcPath",
"=",
"this",
".",
"getPath",
"(",
"codeType",
",",
"false",
")",
";",
"if",
"(",
"strSrcPath",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"!",
"strSrcPath",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"strSrcPath",
"+=",
"\"/\"",
";",
"if",
"(",
"!",
"strSrcPath",
".",
"endsWith",
"(",
"strSourcePath",
")",
")",
"strSourcePath",
"=",
"strSrcPath",
"+",
"strSourcePath",
";",
"else",
"strSourcePath",
"=",
"strSrcPath",
";",
"}",
"}",
"if",
"(",
"strFileName",
"==",
"null",
")",
"strFileName",
"=",
"DBConstants",
".",
"BLANK",
";",
"if",
"(",
"strFileName",
".",
"length",
"(",
")",
">",
"0",
")",
"if",
"(",
"strFileName",
".",
"indexOf",
"(",
"\".\"",
")",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"codeType",
"==",
"CodeType",
".",
"RESOURCE_PROPERTIES",
")",
"strFileName",
"=",
"strFileName",
"+",
"\".properties\"",
";",
"else",
"strFileName",
"=",
"strFileName",
"+",
"\".java\"",
";",
"}",
"strFileName",
"=",
"strFileRoot",
"+",
"strSourcePath",
"+",
"packagePath",
"+",
"strFileName",
";",
"return",
"strFileName",
";",
"}"
] |
Get the path to this file name.
@param strFileName The filename to find (If blank, just get the path to the root package; If null, path to project source).
@param strPackage The relative package to this file name (If null, no package, if blank, default package path)
@param codeType The code type
@param fullPath If true, full path; if false relative to top-level project
@return The path to this package.
|
[
"Get",
"the",
"path",
"to",
"this",
"file",
"name",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/ClassProject.java#L257-L313
|
154,392
|
microfocus-idol/java-view-proxy-components
|
hod/src/main/java/com/hp/autonomy/frontend/view/hod/HodViewServiceImpl.java
|
HodViewServiceImpl.formatRawContent
|
private InputStream formatRawContent(final Document document) throws IOException {
final String body = "<h1>" + escapeAndAddLineBreaks(resolveTitle(document)) + "</h1>"
+ "<p>" + escapeAndAddLineBreaks(document.getContent()) + "</p>";
return IOUtils.toInputStream(body, StandardCharsets.UTF_8);
}
|
java
|
private InputStream formatRawContent(final Document document) throws IOException {
final String body = "<h1>" + escapeAndAddLineBreaks(resolveTitle(document)) + "</h1>"
+ "<p>" + escapeAndAddLineBreaks(document.getContent()) + "</p>";
return IOUtils.toInputStream(body, StandardCharsets.UTF_8);
}
|
[
"private",
"InputStream",
"formatRawContent",
"(",
"final",
"Document",
"document",
")",
"throws",
"IOException",
"{",
"final",
"String",
"body",
"=",
"\"<h1>\"",
"+",
"escapeAndAddLineBreaks",
"(",
"resolveTitle",
"(",
"document",
")",
")",
"+",
"\"</h1>\"",
"+",
"\"<p>\"",
"+",
"escapeAndAddLineBreaks",
"(",
"document",
".",
"getContent",
"(",
")",
")",
"+",
"\"</p>\"",
";",
"return",
"IOUtils",
".",
"toInputStream",
"(",
"body",
",",
"StandardCharsets",
".",
"UTF_8",
")",
";",
"}"
] |
Format the document's content for display in a browser
|
[
"Format",
"the",
"document",
"s",
"content",
"for",
"display",
"in",
"a",
"browser"
] |
d338c38fb9fb78adcc1887c4b23617372c06c651
|
https://github.com/microfocus-idol/java-view-proxy-components/blob/d338c38fb9fb78adcc1887c4b23617372c06c651/hod/src/main/java/com/hp/autonomy/frontend/view/hod/HodViewServiceImpl.java#L92-L97
|
154,393
|
amlinv/amq-topo-utils
|
src/main/java/com/amlinv/activemq/topo/discovery/MBeanDestinationDiscoverer.java
|
MBeanDestinationDiscoverer.pollOnce
|
public void pollOnce () throws IOException {
MBeanAccessConnection connection = this.mBeanAccessConnectionFactory.createConnection();
//
// Set of Queues known at start in order to detect Queues lost. This set may contain queues already known to
// have been lost.
//
Set<String> remainingQueues = new HashSet<>(this.registry.keys());
try {
ObjectName destinationPattern =
this.jmxActiveMQUtil.getDestinationObjectName(this.brokerName, "*", this.destinationType);
Set<ObjectName> found = connection.queryNames(destinationPattern, null);
//
// Iterate over the mbean names matching the pattern, extract the destination name, and process.
//
for ( ObjectName oneDestOName : found ) {
String destName = this.jmxActiveMQUtil.extractDestinationName(oneDestOName);
this.onFoundDestination(destName);
remainingQueues.remove(destName);
}
//
// Mark any queues remaining in the expected queue set as not known by the broker.
//
for ( String missingQueue : remainingQueues ) {
DestinationState destState = this.registry.get(missingQueue);
if ( destState != null ) {
// Remove now if not known by any broker.
if ( ! destState.existsAnyBroker() ) {
this.registry.remove(missingQueue);
} else {
destState.putBrokerInfo(this.brokerId, false);
}
}
}
} catch (MalformedObjectNameException monExc) {
throw new RuntimeException("unexpected object name failure for destinationType=" + this.destinationType,
monExc);
} finally {
this.safeClose(connection);
}
}
|
java
|
public void pollOnce () throws IOException {
MBeanAccessConnection connection = this.mBeanAccessConnectionFactory.createConnection();
//
// Set of Queues known at start in order to detect Queues lost. This set may contain queues already known to
// have been lost.
//
Set<String> remainingQueues = new HashSet<>(this.registry.keys());
try {
ObjectName destinationPattern =
this.jmxActiveMQUtil.getDestinationObjectName(this.brokerName, "*", this.destinationType);
Set<ObjectName> found = connection.queryNames(destinationPattern, null);
//
// Iterate over the mbean names matching the pattern, extract the destination name, and process.
//
for ( ObjectName oneDestOName : found ) {
String destName = this.jmxActiveMQUtil.extractDestinationName(oneDestOName);
this.onFoundDestination(destName);
remainingQueues.remove(destName);
}
//
// Mark any queues remaining in the expected queue set as not known by the broker.
//
for ( String missingQueue : remainingQueues ) {
DestinationState destState = this.registry.get(missingQueue);
if ( destState != null ) {
// Remove now if not known by any broker.
if ( ! destState.existsAnyBroker() ) {
this.registry.remove(missingQueue);
} else {
destState.putBrokerInfo(this.brokerId, false);
}
}
}
} catch (MalformedObjectNameException monExc) {
throw new RuntimeException("unexpected object name failure for destinationType=" + this.destinationType,
monExc);
} finally {
this.safeClose(connection);
}
}
|
[
"public",
"void",
"pollOnce",
"(",
")",
"throws",
"IOException",
"{",
"MBeanAccessConnection",
"connection",
"=",
"this",
".",
"mBeanAccessConnectionFactory",
".",
"createConnection",
"(",
")",
";",
"//",
"// Set of Queues known at start in order to detect Queues lost. This set may contain queues already known to",
"// have been lost.",
"//",
"Set",
"<",
"String",
">",
"remainingQueues",
"=",
"new",
"HashSet",
"<>",
"(",
"this",
".",
"registry",
".",
"keys",
"(",
")",
")",
";",
"try",
"{",
"ObjectName",
"destinationPattern",
"=",
"this",
".",
"jmxActiveMQUtil",
".",
"getDestinationObjectName",
"(",
"this",
".",
"brokerName",
",",
"\"*\"",
",",
"this",
".",
"destinationType",
")",
";",
"Set",
"<",
"ObjectName",
">",
"found",
"=",
"connection",
".",
"queryNames",
"(",
"destinationPattern",
",",
"null",
")",
";",
"//",
"// Iterate over the mbean names matching the pattern, extract the destination name, and process.",
"//",
"for",
"(",
"ObjectName",
"oneDestOName",
":",
"found",
")",
"{",
"String",
"destName",
"=",
"this",
".",
"jmxActiveMQUtil",
".",
"extractDestinationName",
"(",
"oneDestOName",
")",
";",
"this",
".",
"onFoundDestination",
"(",
"destName",
")",
";",
"remainingQueues",
".",
"remove",
"(",
"destName",
")",
";",
"}",
"//",
"// Mark any queues remaining in the expected queue set as not known by the broker.",
"//",
"for",
"(",
"String",
"missingQueue",
":",
"remainingQueues",
")",
"{",
"DestinationState",
"destState",
"=",
"this",
".",
"registry",
".",
"get",
"(",
"missingQueue",
")",
";",
"if",
"(",
"destState",
"!=",
"null",
")",
"{",
"// Remove now if not known by any broker.",
"if",
"(",
"!",
"destState",
".",
"existsAnyBroker",
"(",
")",
")",
"{",
"this",
".",
"registry",
".",
"remove",
"(",
"missingQueue",
")",
";",
"}",
"else",
"{",
"destState",
".",
"putBrokerInfo",
"(",
"this",
".",
"brokerId",
",",
"false",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"MalformedObjectNameException",
"monExc",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"unexpected object name failure for destinationType=\"",
"+",
"this",
".",
"destinationType",
",",
"monExc",
")",
";",
"}",
"finally",
"{",
"this",
".",
"safeClose",
"(",
"connection",
")",
";",
"}",
"}"
] |
Poll for destinations and update the registry with new destinations found, and clean out destinations not found
and not existing on any broker.
@throws IOException
|
[
"Poll",
"for",
"destinations",
"and",
"update",
"the",
"registry",
"with",
"new",
"destinations",
"found",
"and",
"clean",
"out",
"destinations",
"not",
"found",
"and",
"not",
"existing",
"on",
"any",
"broker",
"."
] |
4d82d5735d59f9c95e149362a09ea4d27d9ac4ac
|
https://github.com/amlinv/amq-topo-utils/blob/4d82d5735d59f9c95e149362a09ea4d27d9ac4ac/src/main/java/com/amlinv/activemq/topo/discovery/MBeanDestinationDiscoverer.java#L116-L161
|
154,394
|
amlinv/amq-topo-utils
|
src/main/java/com/amlinv/activemq/topo/discovery/MBeanDestinationDiscoverer.java
|
MBeanDestinationDiscoverer.onFoundDestination
|
protected void onFoundDestination (String destName) {
if ( ( destName != null ) && ( ! destName.isEmpty() ) ) {
DestinationState destState =
this.registry.putIfAbsent(destName, new DestinationState(destName, this.brokerId));
//
// If it was already there, mark it as seen now by the broker.
//
if ( destState != null ) {
destState.putBrokerInfo(this.brokerId, true);
}
}
}
|
java
|
protected void onFoundDestination (String destName) {
if ( ( destName != null ) && ( ! destName.isEmpty() ) ) {
DestinationState destState =
this.registry.putIfAbsent(destName, new DestinationState(destName, this.brokerId));
//
// If it was already there, mark it as seen now by the broker.
//
if ( destState != null ) {
destState.putBrokerInfo(this.brokerId, true);
}
}
}
|
[
"protected",
"void",
"onFoundDestination",
"(",
"String",
"destName",
")",
"{",
"if",
"(",
"(",
"destName",
"!=",
"null",
")",
"&&",
"(",
"!",
"destName",
".",
"isEmpty",
"(",
")",
")",
")",
"{",
"DestinationState",
"destState",
"=",
"this",
".",
"registry",
".",
"putIfAbsent",
"(",
"destName",
",",
"new",
"DestinationState",
"(",
"destName",
",",
"this",
".",
"brokerId",
")",
")",
";",
"//",
"// If it was already there, mark it as seen now by the broker.",
"//",
"if",
"(",
"destState",
"!=",
"null",
")",
"{",
"destState",
".",
"putBrokerInfo",
"(",
"this",
".",
"brokerId",
",",
"true",
")",
";",
"}",
"}",
"}"
] |
For the destination represented by the named mbean, add the destination to the registry.
@param destName name of the destination.
|
[
"For",
"the",
"destination",
"represented",
"by",
"the",
"named",
"mbean",
"add",
"the",
"destination",
"to",
"the",
"registry",
"."
] |
4d82d5735d59f9c95e149362a09ea4d27d9ac4ac
|
https://github.com/amlinv/amq-topo-utils/blob/4d82d5735d59f9c95e149362a09ea4d27d9ac4ac/src/main/java/com/amlinv/activemq/topo/discovery/MBeanDestinationDiscoverer.java#L168-L180
|
154,395
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java
|
TableSession.set
|
public void set(Object data, int iOpenMode) throws DBException, RemoteException
{
Record record = this.getMainRecord();
int iOldOpenMode = record.getOpenMode();
try {
Utility.getLogger().info("EJB Set");
synchronized (this.getTask())
{
record.setOpenMode((iOldOpenMode & ~DBConstants.LOCK_TYPE_MASK) | (iOpenMode & DBConstants.LOCK_TYPE_MASK)); // Use client's lock data
if (record.getEditMode() == Constants.EDIT_CURRENT)
record.edit();
Record recordBase = record.getTable().getCurrentTable().getRecord();
int iFieldTypes = this.getFieldTypes(recordBase);
int iErrorCode = this.moveBufferToFields(data, iFieldTypes, recordBase);
if (iErrorCode != DBConstants.NORMAL_RETURN)
; //?
if (DBConstants.TRUE.equals(record.getTable().getProperty(DBParams.SUPRESSREMOTEDBMESSAGES)))
record.setSupressRemoteMessages(true);
record.getTable().set(recordBase);
}
} catch (DBException ex) {
throw ex;
} catch (Exception ex) {
ex.printStackTrace();
throw new DBException(ex.getMessage());
} finally {
record.setSupressRemoteMessages(false);
this.getMainRecord().setOpenMode(iOldOpenMode);
}
}
|
java
|
public void set(Object data, int iOpenMode) throws DBException, RemoteException
{
Record record = this.getMainRecord();
int iOldOpenMode = record.getOpenMode();
try {
Utility.getLogger().info("EJB Set");
synchronized (this.getTask())
{
record.setOpenMode((iOldOpenMode & ~DBConstants.LOCK_TYPE_MASK) | (iOpenMode & DBConstants.LOCK_TYPE_MASK)); // Use client's lock data
if (record.getEditMode() == Constants.EDIT_CURRENT)
record.edit();
Record recordBase = record.getTable().getCurrentTable().getRecord();
int iFieldTypes = this.getFieldTypes(recordBase);
int iErrorCode = this.moveBufferToFields(data, iFieldTypes, recordBase);
if (iErrorCode != DBConstants.NORMAL_RETURN)
; //?
if (DBConstants.TRUE.equals(record.getTable().getProperty(DBParams.SUPRESSREMOTEDBMESSAGES)))
record.setSupressRemoteMessages(true);
record.getTable().set(recordBase);
}
} catch (DBException ex) {
throw ex;
} catch (Exception ex) {
ex.printStackTrace();
throw new DBException(ex.getMessage());
} finally {
record.setSupressRemoteMessages(false);
this.getMainRecord().setOpenMode(iOldOpenMode);
}
}
|
[
"public",
"void",
"set",
"(",
"Object",
"data",
",",
"int",
"iOpenMode",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"int",
"iOldOpenMode",
"=",
"record",
".",
"getOpenMode",
"(",
")",
";",
"try",
"{",
"Utility",
".",
"getLogger",
"(",
")",
".",
"info",
"(",
"\"EJB Set\"",
")",
";",
"synchronized",
"(",
"this",
".",
"getTask",
"(",
")",
")",
"{",
"record",
".",
"setOpenMode",
"(",
"(",
"iOldOpenMode",
"&",
"~",
"DBConstants",
".",
"LOCK_TYPE_MASK",
")",
"|",
"(",
"iOpenMode",
"&",
"DBConstants",
".",
"LOCK_TYPE_MASK",
")",
")",
";",
"// Use client's lock data",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_CURRENT",
")",
"record",
".",
"edit",
"(",
")",
";",
"Record",
"recordBase",
"=",
"record",
".",
"getTable",
"(",
")",
".",
"getCurrentTable",
"(",
")",
".",
"getRecord",
"(",
")",
";",
"int",
"iFieldTypes",
"=",
"this",
".",
"getFieldTypes",
"(",
"recordBase",
")",
";",
"int",
"iErrorCode",
"=",
"this",
".",
"moveBufferToFields",
"(",
"data",
",",
"iFieldTypes",
",",
"recordBase",
")",
";",
"if",
"(",
"iErrorCode",
"!=",
"DBConstants",
".",
"NORMAL_RETURN",
")",
";",
"//?",
"if",
"(",
"DBConstants",
".",
"TRUE",
".",
"equals",
"(",
"record",
".",
"getTable",
"(",
")",
".",
"getProperty",
"(",
"DBParams",
".",
"SUPRESSREMOTEDBMESSAGES",
")",
")",
")",
"record",
".",
"setSupressRemoteMessages",
"(",
"true",
")",
";",
"record",
".",
"getTable",
"(",
")",
".",
"set",
"(",
"recordBase",
")",
";",
"}",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"throw",
"ex",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"DBException",
"(",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"finally",
"{",
"record",
".",
"setSupressRemoteMessages",
"(",
"false",
")",
";",
"this",
".",
"getMainRecord",
"(",
")",
".",
"setOpenMode",
"(",
"iOldOpenMode",
")",
";",
"}",
"}"
] |
Update the current record.
This method has some wierd code to emulate the way behaviors are called on a write.
@param The data to update.
@exception DBException File exception.
|
[
"Update",
"the",
"current",
"record",
".",
"This",
"method",
"has",
"some",
"wierd",
"code",
"to",
"emulate",
"the",
"way",
"behaviors",
"are",
"called",
"on",
"a",
"write",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java#L354-L383
|
154,396
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java
|
TableSession.getAtRow
|
private Object getAtRow(int iRowIndex) throws DBException
{
try {
Utility.getLogger().info("get row " + iRowIndex);
GridTable gridTable = this.getGridTable(this.getMainRecord());
gridTable.getCurrentTable().getRecord().setEditMode(Constants.EDIT_NONE);
Record record = (Record)gridTable.get(iRowIndex);
int iRecordStatus = DBConstants.RECORD_NORMAL;
if (record == null)
{
if (iRowIndex >= 0)
iRecordStatus = DBConstants.RECORD_AT_EOF;
else
iRecordStatus = DBConstants.RECORD_AT_BOF;
}
else
{
if (record.getEditMode() == DBConstants.EDIT_NONE)
iRecordStatus = DBConstants.RECORD_NEW; // Deleted record.
if (record.getEditMode() == DBConstants.EDIT_ADD)
iRecordStatus = DBConstants.RECORD_NEW;
}
if (iRecordStatus == DBConstants.NORMAL_RETURN)
{
Record recordBase = this.getMainRecord().getTable().getCurrentTable().getRecord();
int iFieldTypes = this.getFieldTypes(recordBase);
BaseBuffer buffer = new VectorBuffer(null, iFieldTypes);
buffer.fieldsToBuffer(recordBase, iFieldTypes);
return buffer.getPhysicalData();
}
else
return new Integer(iRecordStatus);
} catch (DBException ex) {
throw ex;
} catch (Exception ex) {
ex.printStackTrace();
throw new DBException(ex.getMessage());
}
}
|
java
|
private Object getAtRow(int iRowIndex) throws DBException
{
try {
Utility.getLogger().info("get row " + iRowIndex);
GridTable gridTable = this.getGridTable(this.getMainRecord());
gridTable.getCurrentTable().getRecord().setEditMode(Constants.EDIT_NONE);
Record record = (Record)gridTable.get(iRowIndex);
int iRecordStatus = DBConstants.RECORD_NORMAL;
if (record == null)
{
if (iRowIndex >= 0)
iRecordStatus = DBConstants.RECORD_AT_EOF;
else
iRecordStatus = DBConstants.RECORD_AT_BOF;
}
else
{
if (record.getEditMode() == DBConstants.EDIT_NONE)
iRecordStatus = DBConstants.RECORD_NEW; // Deleted record.
if (record.getEditMode() == DBConstants.EDIT_ADD)
iRecordStatus = DBConstants.RECORD_NEW;
}
if (iRecordStatus == DBConstants.NORMAL_RETURN)
{
Record recordBase = this.getMainRecord().getTable().getCurrentTable().getRecord();
int iFieldTypes = this.getFieldTypes(recordBase);
BaseBuffer buffer = new VectorBuffer(null, iFieldTypes);
buffer.fieldsToBuffer(recordBase, iFieldTypes);
return buffer.getPhysicalData();
}
else
return new Integer(iRecordStatus);
} catch (DBException ex) {
throw ex;
} catch (Exception ex) {
ex.printStackTrace();
throw new DBException(ex.getMessage());
}
}
|
[
"private",
"Object",
"getAtRow",
"(",
"int",
"iRowIndex",
")",
"throws",
"DBException",
"{",
"try",
"{",
"Utility",
".",
"getLogger",
"(",
")",
".",
"info",
"(",
"\"get row \"",
"+",
"iRowIndex",
")",
";",
"GridTable",
"gridTable",
"=",
"this",
".",
"getGridTable",
"(",
"this",
".",
"getMainRecord",
"(",
")",
")",
";",
"gridTable",
".",
"getCurrentTable",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"setEditMode",
"(",
"Constants",
".",
"EDIT_NONE",
")",
";",
"Record",
"record",
"=",
"(",
"Record",
")",
"gridTable",
".",
"get",
"(",
"iRowIndex",
")",
";",
"int",
"iRecordStatus",
"=",
"DBConstants",
".",
"RECORD_NORMAL",
";",
"if",
"(",
"record",
"==",
"null",
")",
"{",
"if",
"(",
"iRowIndex",
">=",
"0",
")",
"iRecordStatus",
"=",
"DBConstants",
".",
"RECORD_AT_EOF",
";",
"else",
"iRecordStatus",
"=",
"DBConstants",
".",
"RECORD_AT_BOF",
";",
"}",
"else",
"{",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_NONE",
")",
"iRecordStatus",
"=",
"DBConstants",
".",
"RECORD_NEW",
";",
"// Deleted record.",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_ADD",
")",
"iRecordStatus",
"=",
"DBConstants",
".",
"RECORD_NEW",
";",
"}",
"if",
"(",
"iRecordStatus",
"==",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"{",
"Record",
"recordBase",
"=",
"this",
".",
"getMainRecord",
"(",
")",
".",
"getTable",
"(",
")",
".",
"getCurrentTable",
"(",
")",
".",
"getRecord",
"(",
")",
";",
"int",
"iFieldTypes",
"=",
"this",
".",
"getFieldTypes",
"(",
"recordBase",
")",
";",
"BaseBuffer",
"buffer",
"=",
"new",
"VectorBuffer",
"(",
"null",
",",
"iFieldTypes",
")",
";",
"buffer",
".",
"fieldsToBuffer",
"(",
"recordBase",
",",
"iFieldTypes",
")",
";",
"return",
"buffer",
".",
"getPhysicalData",
"(",
")",
";",
"}",
"else",
"return",
"new",
"Integer",
"(",
"iRecordStatus",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"throw",
"ex",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"DBException",
"(",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] |
Retreive this relative record in the table.
This method is used exclusively by the get method to read a single row of a grid table.
@param iRowIndex The row to retrieve.
@return The record or an error code as an Integer.
@exception DBException File exception.
@exception RemoteException RMI exception.
|
[
"Retreive",
"this",
"relative",
"record",
"in",
"the",
"table",
".",
"This",
"method",
"is",
"used",
"exclusively",
"by",
"the",
"get",
"method",
"to",
"read",
"a",
"single",
"row",
"of",
"a",
"grid",
"table",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java#L740-L780
|
154,397
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java
|
TableSession.makeFieldList
|
public org.jbundle.thin.base.db.FieldList makeFieldList(String strFieldsToInclude) throws RemoteException
{
synchronized (this.getTask())
{
FieldList fieldList = new FieldList(null);
Record record = this.getMainRecord();
boolean bAllSelected = record.isAllSelected();
if (SELECTED.equalsIgnoreCase(strFieldsToInclude))
bAllSelected = false;
if (bAllSelected)
m_iFieldTypes = BaseBuffer.PHYSICAL_FIELDS;
else
m_iFieldTypes = BaseBuffer.SELECTED_FIELDS; // Pass all selected (thin will need them).
if (SELECTED.equalsIgnoreCase(strFieldsToInclude))
m_iFieldTypes = BaseBuffer.SELECTED_FIELDS; // Pass all selected (including virtual)
for (int iFieldSeq = 0; iFieldSeq < record.getFieldCount(); iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
if ((m_iFieldTypes == BaseBuffer.PHYSICAL_FIELDS) || (m_iFieldTypes == BaseBuffer.DATA_FIELDS))
if (field.isVirtual())
continue; // Do not use virtual fields
if ((m_iFieldTypes == BaseBuffer.DATA_FIELDS) || (m_iFieldTypes == BaseBuffer.SELECTED_FIELDS))
if (!field.isSelected())
continue; // If not all fields are selected, only build the selected fields.
FieldInfo fieldInfo = new FieldInfo(fieldList, field.getFieldName(), field.getMaxLength(), field.getFieldDesc(), field.getDefault());
fieldInfo.setDataClass(field.getDataClass());
}
// for (int iKeyFieldSeq = 0; iKeyFieldSeq < record.getKeyAreaCount(); iKeyFieldSeq++)
int iKeyFieldSeq = 0;
{
KeyArea keyArea = record.getKeyArea(iKeyFieldSeq);
KeyAreaInfo keyAreaInfo = new KeyAreaInfo(fieldList, keyArea.getUniqueKeyCode(), keyArea.getKeyName());
int iKeyField = 0;
keyAreaInfo.addKeyField(keyArea.getField(iKeyField).getFieldName(), keyArea.getKeyOrder(iKeyField));
}
return fieldList;
}
}
|
java
|
public org.jbundle.thin.base.db.FieldList makeFieldList(String strFieldsToInclude) throws RemoteException
{
synchronized (this.getTask())
{
FieldList fieldList = new FieldList(null);
Record record = this.getMainRecord();
boolean bAllSelected = record.isAllSelected();
if (SELECTED.equalsIgnoreCase(strFieldsToInclude))
bAllSelected = false;
if (bAllSelected)
m_iFieldTypes = BaseBuffer.PHYSICAL_FIELDS;
else
m_iFieldTypes = BaseBuffer.SELECTED_FIELDS; // Pass all selected (thin will need them).
if (SELECTED.equalsIgnoreCase(strFieldsToInclude))
m_iFieldTypes = BaseBuffer.SELECTED_FIELDS; // Pass all selected (including virtual)
for (int iFieldSeq = 0; iFieldSeq < record.getFieldCount(); iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
if ((m_iFieldTypes == BaseBuffer.PHYSICAL_FIELDS) || (m_iFieldTypes == BaseBuffer.DATA_FIELDS))
if (field.isVirtual())
continue; // Do not use virtual fields
if ((m_iFieldTypes == BaseBuffer.DATA_FIELDS) || (m_iFieldTypes == BaseBuffer.SELECTED_FIELDS))
if (!field.isSelected())
continue; // If not all fields are selected, only build the selected fields.
FieldInfo fieldInfo = new FieldInfo(fieldList, field.getFieldName(), field.getMaxLength(), field.getFieldDesc(), field.getDefault());
fieldInfo.setDataClass(field.getDataClass());
}
// for (int iKeyFieldSeq = 0; iKeyFieldSeq < record.getKeyAreaCount(); iKeyFieldSeq++)
int iKeyFieldSeq = 0;
{
KeyArea keyArea = record.getKeyArea(iKeyFieldSeq);
KeyAreaInfo keyAreaInfo = new KeyAreaInfo(fieldList, keyArea.getUniqueKeyCode(), keyArea.getKeyName());
int iKeyField = 0;
keyAreaInfo.addKeyField(keyArea.getField(iKeyField).getFieldName(), keyArea.getKeyOrder(iKeyField));
}
return fieldList;
}
}
|
[
"public",
"org",
".",
"jbundle",
".",
"thin",
".",
"base",
".",
"db",
".",
"FieldList",
"makeFieldList",
"(",
"String",
"strFieldsToInclude",
")",
"throws",
"RemoteException",
"{",
"synchronized",
"(",
"this",
".",
"getTask",
"(",
")",
")",
"{",
"FieldList",
"fieldList",
"=",
"new",
"FieldList",
"(",
"null",
")",
";",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"boolean",
"bAllSelected",
"=",
"record",
".",
"isAllSelected",
"(",
")",
";",
"if",
"(",
"SELECTED",
".",
"equalsIgnoreCase",
"(",
"strFieldsToInclude",
")",
")",
"bAllSelected",
"=",
"false",
";",
"if",
"(",
"bAllSelected",
")",
"m_iFieldTypes",
"=",
"BaseBuffer",
".",
"PHYSICAL_FIELDS",
";",
"else",
"m_iFieldTypes",
"=",
"BaseBuffer",
".",
"SELECTED_FIELDS",
";",
"// Pass all selected (thin will need them).",
"if",
"(",
"SELECTED",
".",
"equalsIgnoreCase",
"(",
"strFieldsToInclude",
")",
")",
"m_iFieldTypes",
"=",
"BaseBuffer",
".",
"SELECTED_FIELDS",
";",
"// Pass all selected (including virtual)",
"for",
"(",
"int",
"iFieldSeq",
"=",
"0",
";",
"iFieldSeq",
"<",
"record",
".",
"getFieldCount",
"(",
")",
";",
"iFieldSeq",
"++",
")",
"{",
"BaseField",
"field",
"=",
"record",
".",
"getField",
"(",
"iFieldSeq",
")",
";",
"if",
"(",
"(",
"m_iFieldTypes",
"==",
"BaseBuffer",
".",
"PHYSICAL_FIELDS",
")",
"||",
"(",
"m_iFieldTypes",
"==",
"BaseBuffer",
".",
"DATA_FIELDS",
")",
")",
"if",
"(",
"field",
".",
"isVirtual",
"(",
")",
")",
"continue",
";",
"// Do not use virtual fields",
"if",
"(",
"(",
"m_iFieldTypes",
"==",
"BaseBuffer",
".",
"DATA_FIELDS",
")",
"||",
"(",
"m_iFieldTypes",
"==",
"BaseBuffer",
".",
"SELECTED_FIELDS",
")",
")",
"if",
"(",
"!",
"field",
".",
"isSelected",
"(",
")",
")",
"continue",
";",
"// If not all fields are selected, only build the selected fields.",
"FieldInfo",
"fieldInfo",
"=",
"new",
"FieldInfo",
"(",
"fieldList",
",",
"field",
".",
"getFieldName",
"(",
")",
",",
"field",
".",
"getMaxLength",
"(",
")",
",",
"field",
".",
"getFieldDesc",
"(",
")",
",",
"field",
".",
"getDefault",
"(",
")",
")",
";",
"fieldInfo",
".",
"setDataClass",
"(",
"field",
".",
"getDataClass",
"(",
")",
")",
";",
"}",
"// for (int iKeyFieldSeq = 0; iKeyFieldSeq < record.getKeyAreaCount(); iKeyFieldSeq++)",
"int",
"iKeyFieldSeq",
"=",
"0",
";",
"{",
"KeyArea",
"keyArea",
"=",
"record",
".",
"getKeyArea",
"(",
"iKeyFieldSeq",
")",
";",
"KeyAreaInfo",
"keyAreaInfo",
"=",
"new",
"KeyAreaInfo",
"(",
"fieldList",
",",
"keyArea",
".",
"getUniqueKeyCode",
"(",
")",
",",
"keyArea",
".",
"getKeyName",
"(",
")",
")",
";",
"int",
"iKeyField",
"=",
"0",
";",
"keyAreaInfo",
".",
"addKeyField",
"(",
"keyArea",
".",
"getField",
"(",
"iKeyField",
")",
".",
"getFieldName",
"(",
")",
",",
"keyArea",
".",
"getKeyOrder",
"(",
"iKeyField",
")",
")",
";",
"}",
"return",
"fieldList",
";",
"}",
"}"
] |
Make a thin FieldList for this table.
@param strFieldsToInclude The fields to include in this field list (Pass the string [PHYSICAL] or SELECTED).
@return The thin FieldList for this record.
Usually used for special queries that don't have a field list available.
|
[
"Make",
"a",
"thin",
"FieldList",
"for",
"this",
"table",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java#L798-L835
|
154,398
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java
|
TableSession.cleanBuffer
|
public void cleanBuffer(BaseBuffer buffer, Record record)
{
Vector<Object> vector = (Vector)buffer.getPhysicalData();
int iCurrentIndex = 0;
buffer.resetPosition(); // Start at the first field
int iFieldCount = record.getFieldCount(); // Number of fields to read in
for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= iFieldCount + Constants.MAIN_FIELD - 1; iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
if (!buffer.skipField(field))
{
if (field.isModified())
vector.set(iCurrentIndex, BaseBuffer.DATA_SKIP); // If target modified don't move data
//? else if (record.getEditMode() == DBConstants.EDIT_ADD)
// if (field.getDefault() == vector.get(iCurrentIndex))
// vector.set(iCurrentIndex, BaseBuffer.DATA_SKIP); // On Add if data is the default, don't set.
iCurrentIndex++;
}
}
}
|
java
|
public void cleanBuffer(BaseBuffer buffer, Record record)
{
Vector<Object> vector = (Vector)buffer.getPhysicalData();
int iCurrentIndex = 0;
buffer.resetPosition(); // Start at the first field
int iFieldCount = record.getFieldCount(); // Number of fields to read in
for (int iFieldSeq = Constants.MAIN_FIELD; iFieldSeq <= iFieldCount + Constants.MAIN_FIELD - 1; iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
if (!buffer.skipField(field))
{
if (field.isModified())
vector.set(iCurrentIndex, BaseBuffer.DATA_SKIP); // If target modified don't move data
//? else if (record.getEditMode() == DBConstants.EDIT_ADD)
// if (field.getDefault() == vector.get(iCurrentIndex))
// vector.set(iCurrentIndex, BaseBuffer.DATA_SKIP); // On Add if data is the default, don't set.
iCurrentIndex++;
}
}
}
|
[
"public",
"void",
"cleanBuffer",
"(",
"BaseBuffer",
"buffer",
",",
"Record",
"record",
")",
"{",
"Vector",
"<",
"Object",
">",
"vector",
"=",
"(",
"Vector",
")",
"buffer",
".",
"getPhysicalData",
"(",
")",
";",
"int",
"iCurrentIndex",
"=",
"0",
";",
"buffer",
".",
"resetPosition",
"(",
")",
";",
"// Start at the first field",
"int",
"iFieldCount",
"=",
"record",
".",
"getFieldCount",
"(",
")",
";",
"// Number of fields to read in",
"for",
"(",
"int",
"iFieldSeq",
"=",
"Constants",
".",
"MAIN_FIELD",
";",
"iFieldSeq",
"<=",
"iFieldCount",
"+",
"Constants",
".",
"MAIN_FIELD",
"-",
"1",
";",
"iFieldSeq",
"++",
")",
"{",
"BaseField",
"field",
"=",
"record",
".",
"getField",
"(",
"iFieldSeq",
")",
";",
"if",
"(",
"!",
"buffer",
".",
"skipField",
"(",
"field",
")",
")",
"{",
"if",
"(",
"field",
".",
"isModified",
"(",
")",
")",
"vector",
".",
"set",
"(",
"iCurrentIndex",
",",
"BaseBuffer",
".",
"DATA_SKIP",
")",
";",
"// If target modified don't move data",
"//? else if (record.getEditMode() == DBConstants.EDIT_ADD)",
"// if (field.getDefault() == vector.get(iCurrentIndex))",
"// vector.set(iCurrentIndex, BaseBuffer.DATA_SKIP); // On Add if data is the default, don't set.",
"iCurrentIndex",
"++",
";",
"}",
"}",
"}"
] |
Clean the buffer of fields that will change a field that has been modified by the client.
@param buffer The Vector buffer to clean.
@param record The target Record.
|
[
"Clean",
"the",
"buffer",
"of",
"fields",
"that",
"will",
"change",
"a",
"field",
"that",
"has",
"been",
"modified",
"by",
"the",
"client",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java#L926-L945
|
154,399
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java
|
TableSession.getMasterSlave
|
public int getMasterSlave()
{
int iMasterSlave = super.getMasterSlave();
if (iMasterSlave == RecordOwner.MASTER)
if (this.getClass() == org.jbundle.base.remote.db.TableSession.class)
return RecordOwner.SLAVE; // Auto-created session is the Slave session (Unless it was overridden)
return iMasterSlave;
}
|
java
|
public int getMasterSlave()
{
int iMasterSlave = super.getMasterSlave();
if (iMasterSlave == RecordOwner.MASTER)
if (this.getClass() == org.jbundle.base.remote.db.TableSession.class)
return RecordOwner.SLAVE; // Auto-created session is the Slave session (Unless it was overridden)
return iMasterSlave;
}
|
[
"public",
"int",
"getMasterSlave",
"(",
")",
"{",
"int",
"iMasterSlave",
"=",
"super",
".",
"getMasterSlave",
"(",
")",
";",
"if",
"(",
"iMasterSlave",
"==",
"RecordOwner",
".",
"MASTER",
")",
"if",
"(",
"this",
".",
"getClass",
"(",
")",
"==",
"org",
".",
"jbundle",
".",
"base",
".",
"remote",
".",
"db",
".",
"TableSession",
".",
"class",
")",
"return",
"RecordOwner",
".",
"SLAVE",
";",
"// Auto-created session is the Slave session (Unless it was overridden)",
"return",
"iMasterSlave",
";",
"}"
] |
Is this recordowner the master or slave.
The slave is typically the TableSessionObject that is created to manage a ClientTable.
@return The MASTER/SLAVE flag.
|
[
"Is",
"this",
"recordowner",
"the",
"master",
"or",
"slave",
".",
"The",
"slave",
"is",
"typically",
"the",
"TableSessionObject",
"that",
"is",
"created",
"to",
"manage",
"a",
"ClientTable",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java#L1054-L1061
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.