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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
153,000
|
tvesalainen/util
|
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
|
RPMBuilder.addProvide
|
@Override
public RPMBuilder addProvide(String name, String version, Condition... dependency)
{
addString(RPMTAG_PROVIDENAME, name);
addString(RPMTAG_PROVIDEVERSION, version);
addInt32(RPMTAG_PROVIDEFLAGS, Dependency.or(dependency));
ensureVersionReq(version);
return this;
}
|
java
|
@Override
public RPMBuilder addProvide(String name, String version, Condition... dependency)
{
addString(RPMTAG_PROVIDENAME, name);
addString(RPMTAG_PROVIDEVERSION, version);
addInt32(RPMTAG_PROVIDEFLAGS, Dependency.or(dependency));
ensureVersionReq(version);
return this;
}
|
[
"@",
"Override",
"public",
"RPMBuilder",
"addProvide",
"(",
"String",
"name",
",",
"String",
"version",
",",
"Condition",
"...",
"dependency",
")",
"{",
"addString",
"(",
"RPMTAG_PROVIDENAME",
",",
"name",
")",
";",
"addString",
"(",
"RPMTAG_PROVIDEVERSION",
",",
"version",
")",
";",
"addInt32",
"(",
"RPMTAG_PROVIDEFLAGS",
",",
"Dependency",
".",
"or",
"(",
"dependency",
")",
")",
";",
"ensureVersionReq",
"(",
"version",
")",
";",
"return",
"this",
";",
"}"
] |
Add RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION and RPMTAG_PROVIDEFLAGS
@param name
@param version
@param dependency
@return
|
[
"Add",
"RPMTAG_PROVIDENAME",
"RPMTAG_PROVIDEVERSION",
"and",
"RPMTAG_PROVIDEFLAGS"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L254-L262
|
153,001
|
tvesalainen/util
|
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
|
RPMBuilder.addRequire
|
@Override
public RPMBuilder addRequire(String name, String version, Condition... dependency)
{
addString(RPMTAG_REQUIRENAME, name);
addString(RPMTAG_REQUIREVERSION, version);
addInt32(RPMTAG_REQUIREFLAGS, Dependency.or(dependency));
ensureVersionReq(version);
return this;
}
|
java
|
@Override
public RPMBuilder addRequire(String name, String version, Condition... dependency)
{
addString(RPMTAG_REQUIRENAME, name);
addString(RPMTAG_REQUIREVERSION, version);
addInt32(RPMTAG_REQUIREFLAGS, Dependency.or(dependency));
ensureVersionReq(version);
return this;
}
|
[
"@",
"Override",
"public",
"RPMBuilder",
"addRequire",
"(",
"String",
"name",
",",
"String",
"version",
",",
"Condition",
"...",
"dependency",
")",
"{",
"addString",
"(",
"RPMTAG_REQUIRENAME",
",",
"name",
")",
";",
"addString",
"(",
"RPMTAG_REQUIREVERSION",
",",
"version",
")",
";",
"addInt32",
"(",
"RPMTAG_REQUIREFLAGS",
",",
"Dependency",
".",
"or",
"(",
"dependency",
")",
")",
";",
"ensureVersionReq",
"(",
"version",
")",
";",
"return",
"this",
";",
"}"
] |
Add RPMTAG_REQUIRENAME, RPMTAG_REQUIREVERSION and RPMTAG_REQUIREFLAGS
@param name
@param version
@param dependency
@return
|
[
"Add",
"RPMTAG_REQUIRENAME",
"RPMTAG_REQUIREVERSION",
"and",
"RPMTAG_REQUIREFLAGS"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L270-L278
|
153,002
|
tvesalainen/util
|
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
|
RPMBuilder.addConflict
|
@Override
public RPMBuilder addConflict(String name, String version, Condition... dependency)
{
addString(RPMTAG_CONFLICTNAME, name);
addString(RPMTAG_CONFLICTVERSION, version);
addInt32(RPMTAG_CONFLICTFLAGS, Dependency.or(dependency));
ensureVersionReq(version);
return this;
}
|
java
|
@Override
public RPMBuilder addConflict(String name, String version, Condition... dependency)
{
addString(RPMTAG_CONFLICTNAME, name);
addString(RPMTAG_CONFLICTVERSION, version);
addInt32(RPMTAG_CONFLICTFLAGS, Dependency.or(dependency));
ensureVersionReq(version);
return this;
}
|
[
"@",
"Override",
"public",
"RPMBuilder",
"addConflict",
"(",
"String",
"name",
",",
"String",
"version",
",",
"Condition",
"...",
"dependency",
")",
"{",
"addString",
"(",
"RPMTAG_CONFLICTNAME",
",",
"name",
")",
";",
"addString",
"(",
"RPMTAG_CONFLICTVERSION",
",",
"version",
")",
";",
"addInt32",
"(",
"RPMTAG_CONFLICTFLAGS",
",",
"Dependency",
".",
"or",
"(",
"dependency",
")",
")",
";",
"ensureVersionReq",
"(",
"version",
")",
";",
"return",
"this",
";",
"}"
] |
Add RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION and RPMTAG_CONFLICTFLAGS
@param name
@param version
@param dependency
@return
|
[
"Add",
"RPMTAG_CONFLICTNAME",
"RPMTAG_CONFLICTVERSION",
"and",
"RPMTAG_CONFLICTFLAGS"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L295-L303
|
153,003
|
tvesalainen/util
|
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
|
RPMBuilder.addFile
|
@Override
public FileBuilder addFile(Path source, Path target) throws IOException
{
checkTarget(target);
FileBuilder fb = new FileBuilder();
fb.target = target;
fb.size = (int) Files.size(source);
try (FileChannel fc = FileChannel.open(source, READ))
{
fb.content = fc.map(FileChannel.MapMode.READ_ONLY, 0, fb.size);
}
FileTime fileTime = Files.getLastModifiedTime(source);
fb.time = (int)fileTime.to(TimeUnit.SECONDS);
fb.compressFilename();
fileBuilders.add(fb);
return fb;
}
|
java
|
@Override
public FileBuilder addFile(Path source, Path target) throws IOException
{
checkTarget(target);
FileBuilder fb = new FileBuilder();
fb.target = target;
fb.size = (int) Files.size(source);
try (FileChannel fc = FileChannel.open(source, READ))
{
fb.content = fc.map(FileChannel.MapMode.READ_ONLY, 0, fb.size);
}
FileTime fileTime = Files.getLastModifiedTime(source);
fb.time = (int)fileTime.to(TimeUnit.SECONDS);
fb.compressFilename();
fileBuilders.add(fb);
return fb;
}
|
[
"@",
"Override",
"public",
"FileBuilder",
"addFile",
"(",
"Path",
"source",
",",
"Path",
"target",
")",
"throws",
"IOException",
"{",
"checkTarget",
"(",
"target",
")",
";",
"FileBuilder",
"fb",
"=",
"new",
"FileBuilder",
"(",
")",
";",
"fb",
".",
"target",
"=",
"target",
";",
"fb",
".",
"size",
"=",
"(",
"int",
")",
"Files",
".",
"size",
"(",
"source",
")",
";",
"try",
"(",
"FileChannel",
"fc",
"=",
"FileChannel",
".",
"open",
"(",
"source",
",",
"READ",
")",
")",
"{",
"fb",
".",
"content",
"=",
"fc",
".",
"map",
"(",
"FileChannel",
".",
"MapMode",
".",
"READ_ONLY",
",",
"0",
",",
"fb",
".",
"size",
")",
";",
"}",
"FileTime",
"fileTime",
"=",
"Files",
".",
"getLastModifiedTime",
"(",
"source",
")",
";",
"fb",
".",
"time",
"=",
"(",
"int",
")",
"fileTime",
".",
"to",
"(",
"TimeUnit",
".",
"SECONDS",
")",
";",
"fb",
".",
"compressFilename",
"(",
")",
";",
"fileBuilders",
".",
"add",
"(",
"fb",
")",
";",
"return",
"fb",
";",
"}"
] |
Add file to package from path.
@param source
@param target Target path like /opt/application/bin/foo
@return
@throws IOException
|
[
"Add",
"file",
"to",
"package",
"from",
"path",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L340-L356
|
153,004
|
tvesalainen/util
|
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
|
RPMBuilder.addFile
|
@Override
public FileBuilder addFile(ByteBuffer content, Path target) throws IOException
{
checkTarget(target);
FileBuilder fb = new FileBuilder();
fb.content = content;
fb.target = target;
fb.size = content.limit();
fb.compressFilename();
fileBuilders.add(fb);
return fb;
}
|
java
|
@Override
public FileBuilder addFile(ByteBuffer content, Path target) throws IOException
{
checkTarget(target);
FileBuilder fb = new FileBuilder();
fb.content = content;
fb.target = target;
fb.size = content.limit();
fb.compressFilename();
fileBuilders.add(fb);
return fb;
}
|
[
"@",
"Override",
"public",
"FileBuilder",
"addFile",
"(",
"ByteBuffer",
"content",
",",
"Path",
"target",
")",
"throws",
"IOException",
"{",
"checkTarget",
"(",
"target",
")",
";",
"FileBuilder",
"fb",
"=",
"new",
"FileBuilder",
"(",
")",
";",
"fb",
".",
"content",
"=",
"content",
";",
"fb",
".",
"target",
"=",
"target",
";",
"fb",
".",
"size",
"=",
"content",
".",
"limit",
"(",
")",
";",
"fb",
".",
"compressFilename",
"(",
")",
";",
"fileBuilders",
".",
"add",
"(",
"fb",
")",
";",
"return",
"fb",
";",
"}"
] |
Add file to package from content
@param content
@param target Target path like /opt/application/bin/foo
@return
@throws IOException
|
[
"Add",
"file",
"to",
"package",
"from",
"content"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L364-L375
|
153,005
|
tvesalainen/util
|
rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java
|
RPMBuilder.build
|
@Override
public Path build(Path dir) throws IOException
{
String name = getName();
lead = new Lead(name);
addProvide(getString(RPMTAG_NAME), getString(RPMTAG_VERSION), Condition.EQUAL);
addRequireInt("rpmlib(CompressedFileNames)", "3.0.4-1", Dependency.EQUAL, Dependency.LESS, Dependency.RPMLIB);
addInt32(RPMTAG_SIZE, getInt32Array(RPMTAG_FILESIZES).stream().collect(Collectors.summingInt((i) -> i)));
// trailer
CPIO cpio = new CPIO();
cpio.namesize = 11;
fileRecords.add(new FileRecord(cpio, "TRAILER!!!", ByteBuffer.allocate(0)));
// header
ByteBuffer hdr = DynamicByteBuffer.create(Integer.MAX_VALUE);
hdr.order(ByteOrder.BIG_ENDIAN);
header.save(hdr);
hdr.flip();
// payload
ByteBuffer payload = DynamicByteBuffer.create(Integer.MAX_VALUE);
payload.order(ByteOrder.BIG_ENDIAN);
try (final FilterByteBuffer fbb = new FilterByteBuffer(payload, null, GZIPOutputStream::new))
{
for (FileRecord fr : fileRecords)
{
fr.save(fbb);
}
}
payload.flip();
// signature
MessageDigest md5;
try
{
md5 = MessageDigest.getInstance("MD5");
}
catch (NoSuchAlgorithmException ex)
{
throw new IOException(ex);
}
ByteBuffer dupHdr = hdr.duplicate();
md5.update(dupHdr);
ByteBuffer dupPayload = payload.duplicate();
md5.update(dupPayload);
byte[] digest = md5.digest();
setBin(RPMSIGTAG_MD5, digest);
addInt32(RPMSIGTAG_SIZE, hdr.limit() + payload.limit());
checkRequiredTags();
ByteBuffer rpm = DynamicByteBuffer.create(Integer.MAX_VALUE);
rpm.order(ByteOrder.BIG_ENDIAN);
lead.save(rpm);
signature.save(rpm);
align(rpm, 8);
rpm.put(hdr);
rpm.put(payload);
rpm.flip();
Path path = dir.resolve("lsb-" + name + ".rpm");
try (final FileChannel fc = FileChannel.open(path, StandardOpenOption.READ, StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING))
{
fc.write(rpm);
}
return path;
}
|
java
|
@Override
public Path build(Path dir) throws IOException
{
String name = getName();
lead = new Lead(name);
addProvide(getString(RPMTAG_NAME), getString(RPMTAG_VERSION), Condition.EQUAL);
addRequireInt("rpmlib(CompressedFileNames)", "3.0.4-1", Dependency.EQUAL, Dependency.LESS, Dependency.RPMLIB);
addInt32(RPMTAG_SIZE, getInt32Array(RPMTAG_FILESIZES).stream().collect(Collectors.summingInt((i) -> i)));
// trailer
CPIO cpio = new CPIO();
cpio.namesize = 11;
fileRecords.add(new FileRecord(cpio, "TRAILER!!!", ByteBuffer.allocate(0)));
// header
ByteBuffer hdr = DynamicByteBuffer.create(Integer.MAX_VALUE);
hdr.order(ByteOrder.BIG_ENDIAN);
header.save(hdr);
hdr.flip();
// payload
ByteBuffer payload = DynamicByteBuffer.create(Integer.MAX_VALUE);
payload.order(ByteOrder.BIG_ENDIAN);
try (final FilterByteBuffer fbb = new FilterByteBuffer(payload, null, GZIPOutputStream::new))
{
for (FileRecord fr : fileRecords)
{
fr.save(fbb);
}
}
payload.flip();
// signature
MessageDigest md5;
try
{
md5 = MessageDigest.getInstance("MD5");
}
catch (NoSuchAlgorithmException ex)
{
throw new IOException(ex);
}
ByteBuffer dupHdr = hdr.duplicate();
md5.update(dupHdr);
ByteBuffer dupPayload = payload.duplicate();
md5.update(dupPayload);
byte[] digest = md5.digest();
setBin(RPMSIGTAG_MD5, digest);
addInt32(RPMSIGTAG_SIZE, hdr.limit() + payload.limit());
checkRequiredTags();
ByteBuffer rpm = DynamicByteBuffer.create(Integer.MAX_VALUE);
rpm.order(ByteOrder.BIG_ENDIAN);
lead.save(rpm);
signature.save(rpm);
align(rpm, 8);
rpm.put(hdr);
rpm.put(payload);
rpm.flip();
Path path = dir.resolve("lsb-" + name + ".rpm");
try (final FileChannel fc = FileChannel.open(path, StandardOpenOption.READ, StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING))
{
fc.write(rpm);
}
return path;
}
|
[
"@",
"Override",
"public",
"Path",
"build",
"(",
"Path",
"dir",
")",
"throws",
"IOException",
"{",
"String",
"name",
"=",
"getName",
"(",
")",
";",
"lead",
"=",
"new",
"Lead",
"(",
"name",
")",
";",
"addProvide",
"(",
"getString",
"(",
"RPMTAG_NAME",
")",
",",
"getString",
"(",
"RPMTAG_VERSION",
")",
",",
"Condition",
".",
"EQUAL",
")",
";",
"addRequireInt",
"(",
"\"rpmlib(CompressedFileNames)\"",
",",
"\"3.0.4-1\"",
",",
"Dependency",
".",
"EQUAL",
",",
"Dependency",
".",
"LESS",
",",
"Dependency",
".",
"RPMLIB",
")",
";",
"addInt32",
"(",
"RPMTAG_SIZE",
",",
"getInt32Array",
"(",
"RPMTAG_FILESIZES",
")",
".",
"stream",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"summingInt",
"(",
"(",
"i",
")",
"-",
">",
"i",
")",
")",
")",
";",
"// trailer",
"CPIO",
"cpio",
"=",
"new",
"CPIO",
"(",
")",
";",
"cpio",
".",
"namesize",
"=",
"11",
";",
"fileRecords",
".",
"add",
"(",
"new",
"FileRecord",
"(",
"cpio",
",",
"\"TRAILER!!!\"",
",",
"ByteBuffer",
".",
"allocate",
"(",
"0",
")",
")",
")",
";",
"// header",
"ByteBuffer",
"hdr",
"=",
"DynamicByteBuffer",
".",
"create",
"(",
"Integer",
".",
"MAX_VALUE",
")",
";",
"hdr",
".",
"order",
"(",
"ByteOrder",
".",
"BIG_ENDIAN",
")",
";",
"header",
".",
"save",
"(",
"hdr",
")",
";",
"hdr",
".",
"flip",
"(",
")",
";",
"// payload",
"ByteBuffer",
"payload",
"=",
"DynamicByteBuffer",
".",
"create",
"(",
"Integer",
".",
"MAX_VALUE",
")",
";",
"payload",
".",
"order",
"(",
"ByteOrder",
".",
"BIG_ENDIAN",
")",
";",
"try",
"(",
"final",
"FilterByteBuffer",
"fbb",
"=",
"new",
"FilterByteBuffer",
"(",
"payload",
",",
"null",
",",
"GZIPOutputStream",
"::",
"new",
")",
")",
"{",
"for",
"(",
"FileRecord",
"fr",
":",
"fileRecords",
")",
"{",
"fr",
".",
"save",
"(",
"fbb",
")",
";",
"}",
"}",
"payload",
".",
"flip",
"(",
")",
";",
"// signature",
"MessageDigest",
"md5",
";",
"try",
"{",
"md5",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"ex",
")",
"{",
"throw",
"new",
"IOException",
"(",
"ex",
")",
";",
"}",
"ByteBuffer",
"dupHdr",
"=",
"hdr",
".",
"duplicate",
"(",
")",
";",
"md5",
".",
"update",
"(",
"dupHdr",
")",
";",
"ByteBuffer",
"dupPayload",
"=",
"payload",
".",
"duplicate",
"(",
")",
";",
"md5",
".",
"update",
"(",
"dupPayload",
")",
";",
"byte",
"[",
"]",
"digest",
"=",
"md5",
".",
"digest",
"(",
")",
";",
"setBin",
"(",
"RPMSIGTAG_MD5",
",",
"digest",
")",
";",
"addInt32",
"(",
"RPMSIGTAG_SIZE",
",",
"hdr",
".",
"limit",
"(",
")",
"+",
"payload",
".",
"limit",
"(",
")",
")",
";",
"checkRequiredTags",
"(",
")",
";",
"ByteBuffer",
"rpm",
"=",
"DynamicByteBuffer",
".",
"create",
"(",
"Integer",
".",
"MAX_VALUE",
")",
";",
"rpm",
".",
"order",
"(",
"ByteOrder",
".",
"BIG_ENDIAN",
")",
";",
"lead",
".",
"save",
"(",
"rpm",
")",
";",
"signature",
".",
"save",
"(",
"rpm",
")",
";",
"align",
"(",
"rpm",
",",
"8",
")",
";",
"rpm",
".",
"put",
"(",
"hdr",
")",
";",
"rpm",
".",
"put",
"(",
"payload",
")",
";",
"rpm",
".",
"flip",
"(",
")",
";",
"Path",
"path",
"=",
"dir",
".",
"resolve",
"(",
"\"lsb-\"",
"+",
"name",
"+",
"\".rpm\"",
")",
";",
"try",
"(",
"final",
"FileChannel",
"fc",
"=",
"FileChannel",
".",
"open",
"(",
"path",
",",
"StandardOpenOption",
".",
"READ",
",",
"StandardOpenOption",
".",
"WRITE",
",",
"StandardOpenOption",
".",
"CREATE",
",",
"StandardOpenOption",
".",
"TRUNCATE_EXISTING",
")",
")",
"{",
"fc",
".",
"write",
"(",
"rpm",
")",
";",
"}",
"return",
"path",
";",
"}"
] |
Creates RPM file in dir. Returns Path of created file.
@param dir
@return
@throws IOException
|
[
"Creates",
"RPM",
"file",
"in",
"dir",
".",
"Returns",
"Path",
"of",
"created",
"file",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/rpm/RPMBuilder.java#L424-L484
|
153,006
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/CheckRangeHandler.java
|
CheckRangeHandler.doSetData
|
public int doSetData(Object data, boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
if (data != null)
{
iErrorCode = this.getFieldCopy().setData(data, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE);
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode; // Never!
if (!this.getFieldCopy().equals(this.getOwner()))
{ // Only check if the value changes
// Get this value
double dValue = ((NumberField)this.getFieldCopy()).getValue();
// Check the range
Task task = null;
BaseApplication application = null;
if (this.getOwner().getRecord().getRecordOwner() != null)
task = this.getOwner().getRecord().getRecordOwner().getTask();
if (task != null)
application = (BaseApplication)task.getApplication();
//if (application == null)
// application = (BaseApplication)BaseApplet.getSharedInstance().getApplication();
if (m_dStartRange != Double.MIN_VALUE) if (dValue < m_dStartRange)
return task.setLastError(MessageFormat.format(application.getResources(ResourceConstants.ERROR_RESOURCE, true).getString(TOO_SMALL), m_dStartRange));
if (m_dEndRange != Double.MAX_VALUE) if (dValue > m_dEndRange)
return task.setLastError(MessageFormat.format(application.getResources(ResourceConstants.ERROR_RESOURCE, true).getString(TOO_LARGE), m_dEndRange));
}
}
return super.doSetData(data, bDisplayOption, iMoveMode); // Move; it's okay
}
|
java
|
public int doSetData(Object data, boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = DBConstants.NORMAL_RETURN;
if (data != null)
{
iErrorCode = this.getFieldCopy().setData(data, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE);
if (iErrorCode != DBConstants.NORMAL_RETURN)
return iErrorCode; // Never!
if (!this.getFieldCopy().equals(this.getOwner()))
{ // Only check if the value changes
// Get this value
double dValue = ((NumberField)this.getFieldCopy()).getValue();
// Check the range
Task task = null;
BaseApplication application = null;
if (this.getOwner().getRecord().getRecordOwner() != null)
task = this.getOwner().getRecord().getRecordOwner().getTask();
if (task != null)
application = (BaseApplication)task.getApplication();
//if (application == null)
// application = (BaseApplication)BaseApplet.getSharedInstance().getApplication();
if (m_dStartRange != Double.MIN_VALUE) if (dValue < m_dStartRange)
return task.setLastError(MessageFormat.format(application.getResources(ResourceConstants.ERROR_RESOURCE, true).getString(TOO_SMALL), m_dStartRange));
if (m_dEndRange != Double.MAX_VALUE) if (dValue > m_dEndRange)
return task.setLastError(MessageFormat.format(application.getResources(ResourceConstants.ERROR_RESOURCE, true).getString(TOO_LARGE), m_dEndRange));
}
}
return super.doSetData(data, bDisplayOption, iMoveMode); // Move; it's okay
}
|
[
"public",
"int",
"doSetData",
"(",
"Object",
"data",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"iErrorCode",
"=",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"iErrorCode",
"=",
"this",
".",
"getFieldCopy",
"(",
")",
".",
"setData",
"(",
"data",
",",
"DBConstants",
".",
"DONT_DISPLAY",
",",
"DBConstants",
".",
"READ_MOVE",
")",
";",
"if",
"(",
"iErrorCode",
"!=",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"return",
"iErrorCode",
";",
"// Never!",
"if",
"(",
"!",
"this",
".",
"getFieldCopy",
"(",
")",
".",
"equals",
"(",
"this",
".",
"getOwner",
"(",
")",
")",
")",
"{",
"// Only check if the value changes",
"// Get this value",
"double",
"dValue",
"=",
"(",
"(",
"NumberField",
")",
"this",
".",
"getFieldCopy",
"(",
")",
")",
".",
"getValue",
"(",
")",
";",
"// Check the range",
"Task",
"task",
"=",
"null",
";",
"BaseApplication",
"application",
"=",
"null",
";",
"if",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
"!=",
"null",
")",
"task",
"=",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
".",
"getTask",
"(",
")",
";",
"if",
"(",
"task",
"!=",
"null",
")",
"application",
"=",
"(",
"BaseApplication",
")",
"task",
".",
"getApplication",
"(",
")",
";",
"//if (application == null)",
"// application = (BaseApplication)BaseApplet.getSharedInstance().getApplication();",
"if",
"(",
"m_dStartRange",
"!=",
"Double",
".",
"MIN_VALUE",
")",
"if",
"(",
"dValue",
"<",
"m_dStartRange",
")",
"return",
"task",
".",
"setLastError",
"(",
"MessageFormat",
".",
"format",
"(",
"application",
".",
"getResources",
"(",
"ResourceConstants",
".",
"ERROR_RESOURCE",
",",
"true",
")",
".",
"getString",
"(",
"TOO_SMALL",
")",
",",
"m_dStartRange",
")",
")",
";",
"if",
"(",
"m_dEndRange",
"!=",
"Double",
".",
"MAX_VALUE",
")",
"if",
"(",
"dValue",
">",
"m_dEndRange",
")",
"return",
"task",
".",
"setLastError",
"(",
"MessageFormat",
".",
"format",
"(",
"application",
".",
"getResources",
"(",
"ResourceConstants",
".",
"ERROR_RESOURCE",
",",
"true",
")",
".",
"getString",
"(",
"TOO_LARGE",
")",
",",
"m_dEndRange",
")",
")",
";",
"}",
"}",
"return",
"super",
".",
"doSetData",
"(",
"data",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"// Move; it's okay",
"}"
] |
Move the physical binary data to this field.
If this value is out of range, return an error.
@param objData the raw data to set the basefield to.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
|
[
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"field",
".",
"If",
"this",
"value",
"is",
"out",
"of",
"range",
"return",
"an",
"error",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/CheckRangeHandler.java#L113-L141
|
153,007
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/SStaticString.java
|
SStaticString.setString
|
public void setString(String string)
{
m_StaticString = string;
if (this.getScreenFieldView().getControl() != null)
this.getScreenFieldView().setComponentState(this.getScreenFieldView().getControl(), string);
}
|
java
|
public void setString(String string)
{
m_StaticString = string;
if (this.getScreenFieldView().getControl() != null)
this.getScreenFieldView().setComponentState(this.getScreenFieldView().getControl(), string);
}
|
[
"public",
"void",
"setString",
"(",
"String",
"string",
")",
"{",
"m_StaticString",
"=",
"string",
";",
"if",
"(",
"this",
".",
"getScreenFieldView",
"(",
")",
".",
"getControl",
"(",
")",
"!=",
"null",
")",
"this",
".",
"getScreenFieldView",
"(",
")",
".",
"setComponentState",
"(",
"this",
".",
"getScreenFieldView",
"(",
")",
".",
"getControl",
"(",
")",
",",
"string",
")",
";",
"}"
] |
Set the static string for this label.
@param string The static string.
|
[
"Set",
"the",
"static",
"string",
"for",
"this",
"label",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/SStaticString.java#L92-L97
|
153,008
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/DisableOnFieldHandler.java
|
DisableOnFieldHandler.fieldChanged
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
boolean bFlag = this.compareFieldToString();
if (m_bDisableIfMatch)
bFlag = !bFlag;
m_fldToDisable.setEnabled(bFlag);
return DBConstants.NORMAL_RETURN;
}
|
java
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
boolean bFlag = this.compareFieldToString();
if (m_bDisableIfMatch)
bFlag = !bFlag;
m_fldToDisable.setEnabled(bFlag);
return DBConstants.NORMAL_RETURN;
}
|
[
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"boolean",
"bFlag",
"=",
"this",
".",
"compareFieldToString",
"(",
")",
";",
"if",
"(",
"m_bDisableIfMatch",
")",
"bFlag",
"=",
"!",
"bFlag",
";",
"m_fldToDisable",
".",
"setEnabled",
"(",
"bFlag",
")",
";",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"}"
] |
The Field has Changed.
If the target string matches this field, disable the target field.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
Disable field if criteria met.
|
[
"The",
"Field",
"has",
"Changed",
".",
"If",
"the",
"target",
"string",
"matches",
"this",
"field",
"disable",
"the",
"target",
"field",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/DisableOnFieldHandler.java#L109-L116
|
153,009
|
DependencyWatcher/agent
|
src/main/java/com/dependencywatcher/collector/DataArchiver.java
|
DataArchiver.collect
|
public void collect(Path file) throws IOException {
Path targetPath = tempDir.resolve(projectRoot.relativize(file));
Files.createDirectories(targetPath.getParent());
Files.copy(file, targetPath);
}
|
java
|
public void collect(Path file) throws IOException {
Path targetPath = tempDir.resolve(projectRoot.relativize(file));
Files.createDirectories(targetPath.getParent());
Files.copy(file, targetPath);
}
|
[
"public",
"void",
"collect",
"(",
"Path",
"file",
")",
"throws",
"IOException",
"{",
"Path",
"targetPath",
"=",
"tempDir",
".",
"resolve",
"(",
"projectRoot",
".",
"relativize",
"(",
"file",
")",
")",
";",
"Files",
".",
"createDirectories",
"(",
"targetPath",
".",
"getParent",
"(",
")",
")",
";",
"Files",
".",
"copy",
"(",
"file",
",",
"targetPath",
")",
";",
"}"
] |
Add the given file to the data archive
@param file
File to add
@throws IOException
|
[
"Add",
"the",
"given",
"file",
"to",
"the",
"data",
"archive"
] |
6a082650275f9555993f5607d1f0bbe7aceceee1
|
https://github.com/DependencyWatcher/agent/blob/6a082650275f9555993f5607d1f0bbe7aceceee1/src/main/java/com/dependencywatcher/collector/DataArchiver.java#L42-L46
|
153,010
|
DependencyWatcher/agent
|
src/main/java/com/dependencywatcher/collector/DataArchiver.java
|
DataArchiver.add
|
public void add(String file, String contents) throws IOException {
FileUtils.writeStringToFile(tempDir.resolve(file).toFile(), contents);
}
|
java
|
public void add(String file, String contents) throws IOException {
FileUtils.writeStringToFile(tempDir.resolve(file).toFile(), contents);
}
|
[
"public",
"void",
"add",
"(",
"String",
"file",
",",
"String",
"contents",
")",
"throws",
"IOException",
"{",
"FileUtils",
".",
"writeStringToFile",
"(",
"tempDir",
".",
"resolve",
"(",
"file",
")",
".",
"toFile",
"(",
")",
",",
"contents",
")",
";",
"}"
] |
Create new file in the data archive
@param file File name
@param contents File contents
@throws IOException
|
[
"Create",
"new",
"file",
"in",
"the",
"data",
"archive"
] |
6a082650275f9555993f5607d1f0bbe7aceceee1
|
https://github.com/DependencyWatcher/agent/blob/6a082650275f9555993f5607d1f0bbe7aceceee1/src/main/java/com/dependencywatcher/collector/DataArchiver.java#L56-L58
|
153,011
|
DependencyWatcher/agent
|
src/main/java/com/dependencywatcher/collector/DataArchiver.java
|
DataArchiver.createArchive
|
public File createArchive() throws IOException, ZipException {
File tmpFile = File.createTempFile("dw-data", ".zip");
try {
tmpFile.delete();
ZipFile zipFile = new ZipFile(tmpFile.getAbsoluteFile());
ZipParameters parameters = new ZipParameters();
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_ULTRA);
parameters.setIncludeRootFolder(false);
zipFile.addFolder(tempDir.toFile(), parameters);
} finally {
dispose();
}
return tmpFile;
}
|
java
|
public File createArchive() throws IOException, ZipException {
File tmpFile = File.createTempFile("dw-data", ".zip");
try {
tmpFile.delete();
ZipFile zipFile = new ZipFile(tmpFile.getAbsoluteFile());
ZipParameters parameters = new ZipParameters();
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_ULTRA);
parameters.setIncludeRootFolder(false);
zipFile.addFolder(tempDir.toFile(), parameters);
} finally {
dispose();
}
return tmpFile;
}
|
[
"public",
"File",
"createArchive",
"(",
")",
"throws",
"IOException",
",",
"ZipException",
"{",
"File",
"tmpFile",
"=",
"File",
".",
"createTempFile",
"(",
"\"dw-data\"",
",",
"\".zip\"",
")",
";",
"try",
"{",
"tmpFile",
".",
"delete",
"(",
")",
";",
"ZipFile",
"zipFile",
"=",
"new",
"ZipFile",
"(",
"tmpFile",
".",
"getAbsoluteFile",
"(",
")",
")",
";",
"ZipParameters",
"parameters",
"=",
"new",
"ZipParameters",
"(",
")",
";",
"parameters",
".",
"setCompressionLevel",
"(",
"Zip4jConstants",
".",
"DEFLATE_LEVEL_ULTRA",
")",
";",
"parameters",
".",
"setIncludeRootFolder",
"(",
"false",
")",
";",
"zipFile",
".",
"addFolder",
"(",
"tempDir",
".",
"toFile",
"(",
")",
",",
"parameters",
")",
";",
"}",
"finally",
"{",
"dispose",
"(",
")",
";",
"}",
"return",
"tmpFile",
";",
"}"
] |
Creates archive containing collected data
@return Zip file
@throws IOException
@throws ZipException
|
[
"Creates",
"archive",
"containing",
"collected",
"data"
] |
6a082650275f9555993f5607d1f0bbe7aceceee1
|
https://github.com/DependencyWatcher/agent/blob/6a082650275f9555993f5607d1f0bbe7aceceee1/src/main/java/com/dependencywatcher/collector/DataArchiver.java#L67-L82
|
153,012
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/FileUtil.java
|
FileUtil.lines
|
public static final Stream<String> lines(InputStream is, Charset cs)
{
return StreamSupport.stream(new StringSplitIterator(is, cs), false);
}
|
java
|
public static final Stream<String> lines(InputStream is, Charset cs)
{
return StreamSupport.stream(new StringSplitIterator(is, cs), false);
}
|
[
"public",
"static",
"final",
"Stream",
"<",
"String",
">",
"lines",
"(",
"InputStream",
"is",
",",
"Charset",
"cs",
")",
"{",
"return",
"StreamSupport",
".",
"stream",
"(",
"new",
"StringSplitIterator",
"(",
"is",
",",
"cs",
")",
",",
"false",
")",
";",
"}"
] |
Reads InputStream as stream of lines. Line separator is '\n' while '\r'
is simply ignored.
@param is
@param cs
@return
|
[
"Reads",
"InputStream",
"as",
"stream",
"of",
"lines",
".",
"Line",
"separator",
"is",
"\\",
"n",
"while",
"\\",
"r",
"is",
"simply",
"ignored",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/FileUtil.java#L70-L73
|
153,013
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/FileUtil.java
|
FileUtil.readAllBytes
|
public static final byte[] readAllBytes(InputStream is) throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buf = new byte[4096];
int rc = is.read(buf);
while (rc != -1)
{
baos.write(buf, 0, rc);
rc = is.read(buf);
}
return baos.toByteArray();
}
|
java
|
public static final byte[] readAllBytes(InputStream is) throws IOException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buf = new byte[4096];
int rc = is.read(buf);
while (rc != -1)
{
baos.write(buf, 0, rc);
rc = is.read(buf);
}
return baos.toByteArray();
}
|
[
"public",
"static",
"final",
"byte",
"[",
"]",
"readAllBytes",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"4096",
"]",
";",
"int",
"rc",
"=",
"is",
".",
"read",
"(",
"buf",
")",
";",
"while",
"(",
"rc",
"!=",
"-",
"1",
")",
"{",
"baos",
".",
"write",
"(",
"buf",
",",
"0",
",",
"rc",
")",
";",
"rc",
"=",
"is",
".",
"read",
"(",
"buf",
")",
";",
"}",
"return",
"baos",
".",
"toByteArray",
"(",
")",
";",
"}"
] |
Read all bytes from InputStream and returns them as byte array.
InputStream is not closed after call.
@param is
@return
@throws IOException
|
[
"Read",
"all",
"bytes",
"from",
"InputStream",
"and",
"returns",
"them",
"as",
"byte",
"array",
".",
"InputStream",
"is",
"not",
"closed",
"after",
"call",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/FileUtil.java#L144-L155
|
153,014
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/FileUtil.java
|
FileUtil.buffer
|
public static final BufferedInputStream buffer(InputStream is)
{
if (is instanceof BufferedInputStream)
{
return (BufferedInputStream) is;
}
else
{
return new BufferedInputStream(is);
}
}
|
java
|
public static final BufferedInputStream buffer(InputStream is)
{
if (is instanceof BufferedInputStream)
{
return (BufferedInputStream) is;
}
else
{
return new BufferedInputStream(is);
}
}
|
[
"public",
"static",
"final",
"BufferedInputStream",
"buffer",
"(",
"InputStream",
"is",
")",
"{",
"if",
"(",
"is",
"instanceof",
"BufferedInputStream",
")",
"{",
"return",
"(",
"BufferedInputStream",
")",
"is",
";",
"}",
"else",
"{",
"return",
"new",
"BufferedInputStream",
"(",
"is",
")",
";",
"}",
"}"
] |
Wraps InputStream with BufferedInputStream if is is not BufferedInputStream.
If it is returns is.
@param is
@return
|
[
"Wraps",
"InputStream",
"with",
"BufferedInputStream",
"if",
"is",
"is",
"not",
"BufferedInputStream",
".",
"If",
"it",
"is",
"returns",
"is",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/FileUtil.java#L199-L209
|
153,015
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/FileUtil.java
|
FileUtil.copyResource
|
public static final void copyResource(String source, Path target, Class<?> cls) throws IOException
{
try (InputStream is = cls.getResourceAsStream(source))
{
Files.copy(is, target, REPLACE_EXISTING);
}
}
|
java
|
public static final void copyResource(String source, Path target, Class<?> cls) throws IOException
{
try (InputStream is = cls.getResourceAsStream(source))
{
Files.copy(is, target, REPLACE_EXISTING);
}
}
|
[
"public",
"static",
"final",
"void",
"copyResource",
"(",
"String",
"source",
",",
"Path",
"target",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"is",
"=",
"cls",
".",
"getResourceAsStream",
"(",
"source",
")",
")",
"{",
"Files",
".",
"copy",
"(",
"is",
",",
"target",
",",
"REPLACE_EXISTING",
")",
";",
"}",
"}"
] |
Copies class resource to path
@param source As in getResourceAsStream
@param target Target file
@param cls A class for finding class loader.
@throws IOException
@see java.lang.Class#getResourceAsStream(java.lang.String)
|
[
"Copies",
"class",
"resource",
"to",
"path"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/FileUtil.java#L218-L224
|
153,016
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/FileUtil.java
|
FileUtil.setTimes
|
public static final void setTimes(FileTime lastModifiedTime, FileTime lastAccessTime, FileTime createTime, Path... files) throws IOException
{
for (Path file : files)
{
BasicFileAttributeView view = Files.getFileAttributeView(file, BasicFileAttributeView.class);
view.setTimes(lastModifiedTime, lastAccessTime, createTime);
}
}
|
java
|
public static final void setTimes(FileTime lastModifiedTime, FileTime lastAccessTime, FileTime createTime, Path... files) throws IOException
{
for (Path file : files)
{
BasicFileAttributeView view = Files.getFileAttributeView(file, BasicFileAttributeView.class);
view.setTimes(lastModifiedTime, lastAccessTime, createTime);
}
}
|
[
"public",
"static",
"final",
"void",
"setTimes",
"(",
"FileTime",
"lastModifiedTime",
",",
"FileTime",
"lastAccessTime",
",",
"FileTime",
"createTime",
",",
"Path",
"...",
"files",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Path",
"file",
":",
"files",
")",
"{",
"BasicFileAttributeView",
"view",
"=",
"Files",
".",
"getFileAttributeView",
"(",
"file",
",",
"BasicFileAttributeView",
".",
"class",
")",
";",
"view",
".",
"setTimes",
"(",
"lastModifiedTime",
",",
"lastAccessTime",
",",
"createTime",
")",
";",
"}",
"}"
] |
Set files times. Non null times are changed.
@param lastModifiedTime Can be null
@param lastAccessTime Can be null
@param createTime Can be null
@param files
@throws IOException
|
[
"Set",
"files",
"times",
".",
"Non",
"null",
"times",
"are",
"changed",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/FileUtil.java#L245-L252
|
153,017
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentLoader.java
|
XMLContentLoader.loadContent
|
public Node loadContent(final Session session, final URL contentDef) {
final SAXParserFactory factory = this.getSAXParserFactory();
try {
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
final SAXParser parser = factory.newSAXParser();
final InputSource source = new InputSource(contentDef.openStream());
final XMLContentHandler handler = new XMLContentHandler(session);
parser.parse(source, handler);
return handler.getRootNode();
} catch (ParserConfigurationException | SAXException | IOException e) {
throw new AssertionError("Loading Content to JCR Repository failed", e);
}
}
|
java
|
public Node loadContent(final Session session, final URL contentDef) {
final SAXParserFactory factory = this.getSAXParserFactory();
try {
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
final SAXParser parser = factory.newSAXParser();
final InputSource source = new InputSource(contentDef.openStream());
final XMLContentHandler handler = new XMLContentHandler(session);
parser.parse(source, handler);
return handler.getRootNode();
} catch (ParserConfigurationException | SAXException | IOException e) {
throw new AssertionError("Loading Content to JCR Repository failed", e);
}
}
|
[
"public",
"Node",
"loadContent",
"(",
"final",
"Session",
"session",
",",
"final",
"URL",
"contentDef",
")",
"{",
"final",
"SAXParserFactory",
"factory",
"=",
"this",
".",
"getSAXParserFactory",
"(",
")",
";",
"try",
"{",
"factory",
".",
"setFeature",
"(",
"\"http://apache.org/xml/features/disallow-doctype-decl\"",
",",
"true",
")",
";",
"final",
"SAXParser",
"parser",
"=",
"factory",
".",
"newSAXParser",
"(",
")",
";",
"final",
"InputSource",
"source",
"=",
"new",
"InputSource",
"(",
"contentDef",
".",
"openStream",
"(",
")",
")",
";",
"final",
"XMLContentHandler",
"handler",
"=",
"new",
"XMLContentHandler",
"(",
"session",
")",
";",
"parser",
".",
"parse",
"(",
"source",
",",
"handler",
")",
";",
"return",
"handler",
".",
"getRootNode",
"(",
")",
";",
"}",
"catch",
"(",
"ParserConfigurationException",
"|",
"SAXException",
"|",
"IOException",
"e",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"Loading Content to JCR Repository failed\"",
",",
"e",
")",
";",
"}",
"}"
] |
Loads the content from the specified contentDefinition into the JCRRepository, using the specified session.
@param session
the session used to import the date. The user bound to the session must have the required privileges to
perform the import operation.
@param contentDef
|
[
"Loads",
"the",
"content",
"from",
"the",
"specified",
"contentDefinition",
"into",
"the",
"JCRRepository",
"using",
"the",
"specified",
"session",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentLoader.java#L54-L67
|
153,018
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java
|
Selection.sortDescending
|
public static <E extends Comparable<E>> void sortDescending(List<E> list) {
int index = 0;
E value = null;
for(int i = 1; i < list.size(); i++) {
index = i;
value = list.remove(index);
while(index > 0 && value.compareTo(list.get(index - 1)) > 0) {
list.add(index, list.get(index - 1));
index--;
}
list.add(index, value);
}
}
|
java
|
public static <E extends Comparable<E>> void sortDescending(List<E> list) {
int index = 0;
E value = null;
for(int i = 1; i < list.size(); i++) {
index = i;
value = list.remove(index);
while(index > 0 && value.compareTo(list.get(index - 1)) > 0) {
list.add(index, list.get(index - 1));
index--;
}
list.add(index, value);
}
}
|
[
"public",
"static",
"<",
"E",
"extends",
"Comparable",
"<",
"E",
">",
">",
"void",
"sortDescending",
"(",
"List",
"<",
"E",
">",
"list",
")",
"{",
"int",
"index",
"=",
"0",
";",
"E",
"value",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"list",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"index",
"=",
"i",
";",
"value",
"=",
"list",
".",
"remove",
"(",
"index",
")",
";",
"while",
"(",
"index",
">",
"0",
"&&",
"value",
".",
"compareTo",
"(",
"list",
".",
"get",
"(",
"index",
"-",
"1",
")",
")",
">",
"0",
")",
"{",
"list",
".",
"add",
"(",
"index",
",",
"list",
".",
"get",
"(",
"index",
"-",
"1",
")",
")",
";",
"index",
"--",
";",
"}",
"list",
".",
"add",
"(",
"index",
",",
"value",
")",
";",
"}",
"}"
] |
Sort the list in descending order using this algorithm. The run time of this algorithm depends on the
implementation of the list since it has elements added and removed from it.
@param <E> the type of elements in this list.
@param list the list that we want to sort
|
[
"Sort",
"the",
"list",
"in",
"descending",
"order",
"using",
"this",
"algorithm",
".",
"The",
"run",
"time",
"of",
"this",
"algorithm",
"depends",
"on",
"the",
"implementation",
"of",
"the",
"list",
"since",
"it",
"has",
"elements",
"added",
"and",
"removed",
"from",
"it",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java#L270-L286
|
153,019
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java
|
Selection.sortDescending
|
public static void sortDescending(byte[] byteArray) {
int index = 0;
byte value = 0;
for(int i = 1; i < byteArray.length; i++) {
index = i;
value = byteArray[index];
while(index > 0 && value > byteArray[index - 1]) {
byteArray[index] = byteArray[index - 1];
index--;
}
byteArray[index] = value;
}
}
|
java
|
public static void sortDescending(byte[] byteArray) {
int index = 0;
byte value = 0;
for(int i = 1; i < byteArray.length; i++) {
index = i;
value = byteArray[index];
while(index > 0 && value > byteArray[index - 1]) {
byteArray[index] = byteArray[index - 1];
index--;
}
byteArray[index] = value;
}
}
|
[
"public",
"static",
"void",
"sortDescending",
"(",
"byte",
"[",
"]",
"byteArray",
")",
"{",
"int",
"index",
"=",
"0",
";",
"byte",
"value",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"byteArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"index",
"=",
"i",
";",
"value",
"=",
"byteArray",
"[",
"index",
"]",
";",
"while",
"(",
"index",
">",
"0",
"&&",
"value",
">",
"byteArray",
"[",
"index",
"-",
"1",
"]",
")",
"{",
"byteArray",
"[",
"index",
"]",
"=",
"byteArray",
"[",
"index",
"-",
"1",
"]",
";",
"index",
"--",
";",
"}",
"byteArray",
"[",
"index",
"]",
"=",
"value",
";",
"}",
"}"
] |
Sort the byte array in descending order using this algorithm.
@param byteArray the array of bytes that we want to sort
|
[
"Sort",
"the",
"byte",
"array",
"in",
"descending",
"order",
"using",
"this",
"algorithm",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java#L315-L331
|
153,020
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java
|
Selection.sortDescending
|
public static void sortDescending(char[] charArray) {
int index = 0;
char value = 0;
for(int i = 1; i < charArray.length; i++) {
index = i;
value = charArray[index];
while(index > 0 && value > charArray[index - 1]) {
charArray[index] = charArray[index - 1];
index--;
}
charArray[index] = value;
}
}
|
java
|
public static void sortDescending(char[] charArray) {
int index = 0;
char value = 0;
for(int i = 1; i < charArray.length; i++) {
index = i;
value = charArray[index];
while(index > 0 && value > charArray[index - 1]) {
charArray[index] = charArray[index - 1];
index--;
}
charArray[index] = value;
}
}
|
[
"public",
"static",
"void",
"sortDescending",
"(",
"char",
"[",
"]",
"charArray",
")",
"{",
"int",
"index",
"=",
"0",
";",
"char",
"value",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"charArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"index",
"=",
"i",
";",
"value",
"=",
"charArray",
"[",
"index",
"]",
";",
"while",
"(",
"index",
">",
"0",
"&&",
"value",
">",
"charArray",
"[",
"index",
"-",
"1",
"]",
")",
"{",
"charArray",
"[",
"index",
"]",
"=",
"charArray",
"[",
"index",
"-",
"1",
"]",
";",
"index",
"--",
";",
"}",
"charArray",
"[",
"index",
"]",
"=",
"value",
";",
"}",
"}"
] |
Sort the char array in descending order using this algorithm.
@param charArray the array of chars that we want to sort
|
[
"Sort",
"the",
"char",
"array",
"in",
"descending",
"order",
"using",
"this",
"algorithm",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java#L337-L353
|
153,021
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java
|
Selection.sortDescending
|
public static void sortDescending(double[] doubleArray) {
int index = 0;
double value = 0;
for(int i = 1; i < doubleArray.length; i++) {
index = i;
value = doubleArray[index];
while(index > 0 && value > doubleArray[index - 1]) {
doubleArray[index] = doubleArray[index - 1];
index--;
}
doubleArray[index] = value;
}
}
|
java
|
public static void sortDescending(double[] doubleArray) {
int index = 0;
double value = 0;
for(int i = 1; i < doubleArray.length; i++) {
index = i;
value = doubleArray[index];
while(index > 0 && value > doubleArray[index - 1]) {
doubleArray[index] = doubleArray[index - 1];
index--;
}
doubleArray[index] = value;
}
}
|
[
"public",
"static",
"void",
"sortDescending",
"(",
"double",
"[",
"]",
"doubleArray",
")",
"{",
"int",
"index",
"=",
"0",
";",
"double",
"value",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"doubleArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"index",
"=",
"i",
";",
"value",
"=",
"doubleArray",
"[",
"index",
"]",
";",
"while",
"(",
"index",
">",
"0",
"&&",
"value",
">",
"doubleArray",
"[",
"index",
"-",
"1",
"]",
")",
"{",
"doubleArray",
"[",
"index",
"]",
"=",
"doubleArray",
"[",
"index",
"-",
"1",
"]",
";",
"index",
"--",
";",
"}",
"doubleArray",
"[",
"index",
"]",
"=",
"value",
";",
"}",
"}"
] |
Sort the double array in descending order using this algorithm.
@param doubleArray the array of double that we want to sort
|
[
"Sort",
"the",
"double",
"array",
"in",
"descending",
"order",
"using",
"this",
"algorithm",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java#L359-L375
|
153,022
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java
|
Selection.sortDescending
|
public static void sortDescending(float[] floatArray) {
int index = 0;
float value = 0;
for(int i = 1; i < floatArray.length; i++) {
index = i;
value = floatArray[index];
while(index > 0 && value > floatArray[index - 1]) {
floatArray[index] = floatArray[index - 1];
index--;
}
floatArray[index] = value;
}
}
|
java
|
public static void sortDescending(float[] floatArray) {
int index = 0;
float value = 0;
for(int i = 1; i < floatArray.length; i++) {
index = i;
value = floatArray[index];
while(index > 0 && value > floatArray[index - 1]) {
floatArray[index] = floatArray[index - 1];
index--;
}
floatArray[index] = value;
}
}
|
[
"public",
"static",
"void",
"sortDescending",
"(",
"float",
"[",
"]",
"floatArray",
")",
"{",
"int",
"index",
"=",
"0",
";",
"float",
"value",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"floatArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"index",
"=",
"i",
";",
"value",
"=",
"floatArray",
"[",
"index",
"]",
";",
"while",
"(",
"index",
">",
"0",
"&&",
"value",
">",
"floatArray",
"[",
"index",
"-",
"1",
"]",
")",
"{",
"floatArray",
"[",
"index",
"]",
"=",
"floatArray",
"[",
"index",
"-",
"1",
"]",
";",
"index",
"--",
";",
"}",
"floatArray",
"[",
"index",
"]",
"=",
"value",
";",
"}",
"}"
] |
Sort the float array in descending order using this algorithm.
@param floatArray the array of float that we want to sort
|
[
"Sort",
"the",
"float",
"array",
"in",
"descending",
"order",
"using",
"this",
"algorithm",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java#L381-L397
|
153,023
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java
|
Selection.sortDescending
|
public static void sortDescending(long[] longArray) {
int index = 0;
long value = 0;
for(int i = 1; i < longArray.length; i++) {
index = i;
value = longArray[index];
while(index > 0 && value > longArray[index - 1]) {
longArray[index] = longArray[index - 1];
index--;
}
longArray[index] = value;
}
}
|
java
|
public static void sortDescending(long[] longArray) {
int index = 0;
long value = 0;
for(int i = 1; i < longArray.length; i++) {
index = i;
value = longArray[index];
while(index > 0 && value > longArray[index - 1]) {
longArray[index] = longArray[index - 1];
index--;
}
longArray[index] = value;
}
}
|
[
"public",
"static",
"void",
"sortDescending",
"(",
"long",
"[",
"]",
"longArray",
")",
"{",
"int",
"index",
"=",
"0",
";",
"long",
"value",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"longArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"index",
"=",
"i",
";",
"value",
"=",
"longArray",
"[",
"index",
"]",
";",
"while",
"(",
"index",
">",
"0",
"&&",
"value",
">",
"longArray",
"[",
"index",
"-",
"1",
"]",
")",
"{",
"longArray",
"[",
"index",
"]",
"=",
"longArray",
"[",
"index",
"-",
"1",
"]",
";",
"index",
"--",
";",
"}",
"longArray",
"[",
"index",
"]",
"=",
"value",
";",
"}",
"}"
] |
Sort the long array in descending order using this algorithm.
@param longArray the array of longs that we want to sort
|
[
"Sort",
"the",
"long",
"array",
"in",
"descending",
"order",
"using",
"this",
"algorithm",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java#L403-L419
|
153,024
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java
|
Selection.sortDescending
|
public static void sortDescending(short[] shortArray) {
int index = 0;
short value = 0;
for(int i = 1; i < shortArray.length; i++) {
index = i;
value = shortArray[index];
while(index > 0 && value > shortArray[index - 1]) {
shortArray[index] = shortArray[index - 1];
index--;
}
shortArray[index] = value;
}
}
|
java
|
public static void sortDescending(short[] shortArray) {
int index = 0;
short value = 0;
for(int i = 1; i < shortArray.length; i++) {
index = i;
value = shortArray[index];
while(index > 0 && value > shortArray[index - 1]) {
shortArray[index] = shortArray[index - 1];
index--;
}
shortArray[index] = value;
}
}
|
[
"public",
"static",
"void",
"sortDescending",
"(",
"short",
"[",
"]",
"shortArray",
")",
"{",
"int",
"index",
"=",
"0",
";",
"short",
"value",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"shortArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"index",
"=",
"i",
";",
"value",
"=",
"shortArray",
"[",
"index",
"]",
";",
"while",
"(",
"index",
">",
"0",
"&&",
"value",
">",
"shortArray",
"[",
"index",
"-",
"1",
"]",
")",
"{",
"shortArray",
"[",
"index",
"]",
"=",
"shortArray",
"[",
"index",
"-",
"1",
"]",
";",
"index",
"--",
";",
"}",
"shortArray",
"[",
"index",
"]",
"=",
"value",
";",
"}",
"}"
] |
Sort the short array in descending order using this algorithm.
@param shortArray the array of shorts that we want to sort
|
[
"Sort",
"the",
"short",
"array",
"in",
"descending",
"order",
"using",
"this",
"algorithm",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/quadratic/Selection.java#L425-L441
|
153,025
|
glookast/commons-timecode
|
src/main/java/com/glookast/commons/timecode/Timecode.java
|
Timecode.valueOf
|
public static Timecode valueOf(String timecode) throws IllegalArgumentException
{
Timecode tc = new Timecode();
return (Timecode) tc.parse(timecode);
}
|
java
|
public static Timecode valueOf(String timecode) throws IllegalArgumentException
{
Timecode tc = new Timecode();
return (Timecode) tc.parse(timecode);
}
|
[
"public",
"static",
"Timecode",
"valueOf",
"(",
"String",
"timecode",
")",
"throws",
"IllegalArgumentException",
"{",
"Timecode",
"tc",
"=",
"new",
"Timecode",
"(",
")",
";",
"return",
"(",
"Timecode",
")",
"tc",
".",
"parse",
"(",
"timecode",
")",
";",
"}"
] |
Returns a Timecode instance for given Timecode storage string. Will return an invalid timecode in case the storage string represents an invalid Timecode
@param timecode
@return the timecode
@throws IllegalArgumentException
|
[
"Returns",
"a",
"Timecode",
"instance",
"for",
"given",
"Timecode",
"storage",
"string",
".",
"Will",
"return",
"an",
"invalid",
"timecode",
"in",
"case",
"the",
"storage",
"string",
"represents",
"an",
"invalid",
"Timecode"
] |
ec2f682a51d1cc435d0b42d80de48ff15adb4ee8
|
https://github.com/glookast/commons-timecode/blob/ec2f682a51d1cc435d0b42d80de48ff15adb4ee8/src/main/java/com/glookast/commons/timecode/Timecode.java#L82-L86
|
153,026
|
nwillc/almost-functional
|
src/main/java/almost/functional/utils/Iterables.java
|
Iterables.forEach
|
public static <T> void forEach(final Iterable<T> iterable, final Consumer<? super T> consumer) {
checkNotNull(iterable, "forEach must have a valid iterable");
checkNotNull(consumer, "forEach must have a valid consumer");
for (T t : iterable) {
consumer.accept(t);
}
}
|
java
|
public static <T> void forEach(final Iterable<T> iterable, final Consumer<? super T> consumer) {
checkNotNull(iterable, "forEach must have a valid iterable");
checkNotNull(consumer, "forEach must have a valid consumer");
for (T t : iterable) {
consumer.accept(t);
}
}
|
[
"public",
"static",
"<",
"T",
">",
"void",
"forEach",
"(",
"final",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"final",
"Consumer",
"<",
"?",
"super",
"T",
">",
"consumer",
")",
"{",
"checkNotNull",
"(",
"iterable",
",",
"\"forEach must have a valid iterable\"",
")",
";",
"checkNotNull",
"(",
"consumer",
",",
"\"forEach must have a valid consumer\"",
")",
";",
"for",
"(",
"T",
"t",
":",
"iterable",
")",
"{",
"consumer",
".",
"accept",
"(",
"t",
")",
";",
"}",
"}"
] |
Accept a consumer for each element of an iterable.
@param consumer the consumer to accept for each element
@param <T> the type of the iterable and consumer
@param iterable the iterable
|
[
"Accept",
"a",
"consumer",
"for",
"each",
"element",
"of",
"an",
"iterable",
"."
] |
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
|
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Iterables.java#L43-L50
|
153,027
|
nwillc/almost-functional
|
src/main/java/almost/functional/utils/Iterables.java
|
Iterables.reduce
|
public static <T, R> R reduce(final Iterable<T> iterable, final R initial, final BiFunction<R, ? super T, R> accumulator) {
checkNotNull(iterable, "reduce must have a non null iterable");
checkNotNull(accumulator, "reduce must have a non null function");
R returnValue = initial;
for (T r : iterable) {
returnValue = accumulator.apply(returnValue, r);
}
return returnValue;
}
|
java
|
public static <T, R> R reduce(final Iterable<T> iterable, final R initial, final BiFunction<R, ? super T, R> accumulator) {
checkNotNull(iterable, "reduce must have a non null iterable");
checkNotNull(accumulator, "reduce must have a non null function");
R returnValue = initial;
for (T r : iterable) {
returnValue = accumulator.apply(returnValue, r);
}
return returnValue;
}
|
[
"public",
"static",
"<",
"T",
",",
"R",
">",
"R",
"reduce",
"(",
"final",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"final",
"R",
"initial",
",",
"final",
"BiFunction",
"<",
"R",
",",
"?",
"super",
"T",
",",
"R",
">",
"accumulator",
")",
"{",
"checkNotNull",
"(",
"iterable",
",",
"\"reduce must have a non null iterable\"",
")",
";",
"checkNotNull",
"(",
"accumulator",
",",
"\"reduce must have a non null function\"",
")",
";",
"R",
"returnValue",
"=",
"initial",
";",
"for",
"(",
"T",
"r",
":",
"iterable",
")",
"{",
"returnValue",
"=",
"accumulator",
".",
"apply",
"(",
"returnValue",
",",
"r",
")",
";",
"}",
"return",
"returnValue",
";",
"}"
] |
Perform a reduction of an iterable, using an initial value, and a two argument function. The function
is applied to each element using the last result as the first argument and the element as the second.
@param <T> type of the iterable elements and accumulator's second argument
@param <R> type returned by reduce, the accumulator and it's first argument
@param iterable the iterable.
@param initial the initial value of the first argument.
@param accumulator the two argument function.
@return the final result of the function.
@since 1.5
|
[
"Perform",
"a",
"reduction",
"of",
"an",
"iterable",
"using",
"an",
"initial",
"value",
"and",
"a",
"two",
"argument",
"function",
".",
"The",
"function",
"is",
"applied",
"to",
"each",
"element",
"using",
"the",
"last",
"result",
"as",
"the",
"first",
"argument",
"and",
"the",
"element",
"as",
"the",
"second",
"."
] |
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
|
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Iterables.java#L64-L73
|
153,028
|
nwillc/almost-functional
|
src/main/java/almost/functional/utils/Iterables.java
|
Iterables.find
|
public static <T> Optional<T> find(final Iterable<? extends T> iterable, final Predicate<? super T> predicate) {
checkNotNull(iterable, "iterable may not be null");
checkNotNull(predicate, "the predicate may not be null");
for (T t : iterable) {
if (predicate.test(t)) {
return of(t);
}
}
return Optional.empty();
}
|
java
|
public static <T> Optional<T> find(final Iterable<? extends T> iterable, final Predicate<? super T> predicate) {
checkNotNull(iterable, "iterable may not be null");
checkNotNull(predicate, "the predicate may not be null");
for (T t : iterable) {
if (predicate.test(t)) {
return of(t);
}
}
return Optional.empty();
}
|
[
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"find",
"(",
"final",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"iterable",
",",
"final",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"checkNotNull",
"(",
"iterable",
",",
"\"iterable may not be null\"",
")",
";",
"checkNotNull",
"(",
"predicate",
",",
"\"the predicate may not be null\"",
")",
";",
"for",
"(",
"T",
"t",
":",
"iterable",
")",
"{",
"if",
"(",
"predicate",
".",
"test",
"(",
"t",
")",
")",
"{",
"return",
"of",
"(",
"t",
")",
";",
"}",
"}",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}"
] |
Apply a predicate to an iterable, returning an optional of the first element where the predicate is true,
or empty if no true is found.
@param iterable the iterable to traverse
@param predicate the predicate to test
@param <T> they type of the iterable and predicate
@return an optional of the first element where the predicate is true, or empty if no true is found.
|
[
"Apply",
"a",
"predicate",
"to",
"an",
"iterable",
"returning",
"an",
"optional",
"of",
"the",
"first",
"element",
"where",
"the",
"predicate",
"is",
"true",
"or",
"empty",
"if",
"no",
"true",
"is",
"found",
"."
] |
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
|
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Iterables.java#L84-L93
|
153,029
|
nwillc/almost-functional
|
src/main/java/almost/functional/utils/Iterables.java
|
Iterables.any
|
public static <T> boolean any(final Iterable<T> iterable, final Predicate<? super T> predicate) {
return find(iterable, predicate).isPresent();
}
|
java
|
public static <T> boolean any(final Iterable<T> iterable, final Predicate<? super T> predicate) {
return find(iterable, predicate).isPresent();
}
|
[
"public",
"static",
"<",
"T",
">",
"boolean",
"any",
"(",
"final",
"Iterable",
"<",
"T",
">",
"iterable",
",",
"final",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"return",
"find",
"(",
"iterable",
",",
"predicate",
")",
".",
"isPresent",
"(",
")",
";",
"}"
] |
Determine if any element of an iterable matches a given predicate.
@param iterable the iterable to traverse
@param predicate the predicate to test
@param <T> the type of the iterable and predicate
@return true if any element matches the predicate, otherwise false.
|
[
"Determine",
"if",
"any",
"element",
"of",
"an",
"iterable",
"matches",
"a",
"given",
"predicate",
"."
] |
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
|
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Iterables.java#L103-L105
|
153,030
|
nwillc/almost-functional
|
src/main/java/almost/functional/utils/Iterables.java
|
Iterables.map
|
public static <F, T> Iterable<T> map(final Iterable<F> fromIterable, final Function<? super F, ? extends T> function) {
checkNotNull(fromIterable, "iterable must be non null");
checkNotNull(function, "map function must be non null");
return new Iterable<T>() {
@Override
public Iterator<T> iterator() {
final Iterator<F> fromIterator = fromIterable.iterator();
return new ImmutableIterator<T>() {
@Override
public boolean hasNext() {
return fromIterator.hasNext();
}
@Override
public T next() {
return function.apply(fromIterator.next());
}
};
}
};
}
|
java
|
public static <F, T> Iterable<T> map(final Iterable<F> fromIterable, final Function<? super F, ? extends T> function) {
checkNotNull(fromIterable, "iterable must be non null");
checkNotNull(function, "map function must be non null");
return new Iterable<T>() {
@Override
public Iterator<T> iterator() {
final Iterator<F> fromIterator = fromIterable.iterator();
return new ImmutableIterator<T>() {
@Override
public boolean hasNext() {
return fromIterator.hasNext();
}
@Override
public T next() {
return function.apply(fromIterator.next());
}
};
}
};
}
|
[
"public",
"static",
"<",
"F",
",",
"T",
">",
"Iterable",
"<",
"T",
">",
"map",
"(",
"final",
"Iterable",
"<",
"F",
">",
"fromIterable",
",",
"final",
"Function",
"<",
"?",
"super",
"F",
",",
"?",
"extends",
"T",
">",
"function",
")",
"{",
"checkNotNull",
"(",
"fromIterable",
",",
"\"iterable must be non null\"",
")",
";",
"checkNotNull",
"(",
"function",
",",
"\"map function must be non null\"",
")",
";",
"return",
"new",
"Iterable",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
")",
"{",
"final",
"Iterator",
"<",
"F",
">",
"fromIterator",
"=",
"fromIterable",
".",
"iterator",
"(",
")",
";",
"return",
"new",
"ImmutableIterator",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"return",
"fromIterator",
".",
"hasNext",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"T",
"next",
"(",
")",
"{",
"return",
"function",
".",
"apply",
"(",
"fromIterator",
".",
"next",
"(",
")",
")",
";",
"}",
"}",
";",
"}",
"}",
";",
"}"
] |
Create an iterable that maps an existing iterable to a new one by applying a function to each of it's elements.
@param fromIterable the iterable to be transformed
@param function the function to apply to the elements
@param <F> the type of the original elements, and the argument to the function
@param <T> the type of the resulting iterable, and the result of the function
@return an iterable that transforms an existing iterable by applying a function to each or it's elements.
|
[
"Create",
"an",
"iterable",
"that",
"maps",
"an",
"existing",
"iterable",
"to",
"a",
"new",
"one",
"by",
"applying",
"a",
"function",
"to",
"each",
"of",
"it",
"s",
"elements",
"."
] |
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
|
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Iterables.java#L128-L148
|
153,031
|
nwillc/almost-functional
|
src/main/java/almost/functional/utils/Iterables.java
|
Iterables.filter
|
public static <T> Iterable<T> filter(final Iterable<T> fromIterable, final Predicate<? super T> predicate) {
checkNotNull(fromIterable, "iterable must be non null");
checkNotNull(predicate, "predicate must be non null");
return new SupplierIterable<T>(new Supplier<Optional<T>>() {
private final Iterator<T> fromIterator = fromIterable.iterator();
public Optional<T> get() {
while (fromIterator.hasNext()) {
final T value = fromIterator.next();
if (predicate.test(value)) {
return of(value);
}
}
return Optional.empty();
}
});
}
|
java
|
public static <T> Iterable<T> filter(final Iterable<T> fromIterable, final Predicate<? super T> predicate) {
checkNotNull(fromIterable, "iterable must be non null");
checkNotNull(predicate, "predicate must be non null");
return new SupplierIterable<T>(new Supplier<Optional<T>>() {
private final Iterator<T> fromIterator = fromIterable.iterator();
public Optional<T> get() {
while (fromIterator.hasNext()) {
final T value = fromIterator.next();
if (predicate.test(value)) {
return of(value);
}
}
return Optional.empty();
}
});
}
|
[
"public",
"static",
"<",
"T",
">",
"Iterable",
"<",
"T",
">",
"filter",
"(",
"final",
"Iterable",
"<",
"T",
">",
"fromIterable",
",",
"final",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"checkNotNull",
"(",
"fromIterable",
",",
"\"iterable must be non null\"",
")",
";",
"checkNotNull",
"(",
"predicate",
",",
"\"predicate must be non null\"",
")",
";",
"return",
"new",
"SupplierIterable",
"<",
"T",
">",
"(",
"new",
"Supplier",
"<",
"Optional",
"<",
"T",
">",
">",
"(",
")",
"{",
"private",
"final",
"Iterator",
"<",
"T",
">",
"fromIterator",
"=",
"fromIterable",
".",
"iterator",
"(",
")",
";",
"public",
"Optional",
"<",
"T",
">",
"get",
"(",
")",
"{",
"while",
"(",
"fromIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"final",
"T",
"value",
"=",
"fromIterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"predicate",
".",
"test",
"(",
"value",
")",
")",
"{",
"return",
"of",
"(",
"value",
")",
";",
"}",
"}",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Create an iterable that filters an existing iterable based on a predicate.
@param fromIterable Iterable being filtered
@param predicate the predicate to base inclusion upon, true cases are included, false excluded
@param <T> the type of the elements
@return iterable of filtered elements
|
[
"Create",
"an",
"iterable",
"that",
"filters",
"an",
"existing",
"iterable",
"based",
"on",
"a",
"predicate",
"."
] |
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
|
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Iterables.java#L158-L174
|
153,032
|
nwillc/almost-functional
|
src/main/java/almost/functional/utils/Iterables.java
|
Iterables.iterable
|
public static <E> Iterable<E> iterable(final Enumeration<E> enumeration) {
checkNotNull(enumeration, "Can not create an Iterable from a null enumeration");
return new Iterable<E>() {
public Iterator<E> iterator() {
return new ImmutableIterator<E>() {
public boolean hasNext() {
return enumeration.hasMoreElements();
}
public E next() {
return enumeration.nextElement();
}
};
}
};
}
|
java
|
public static <E> Iterable<E> iterable(final Enumeration<E> enumeration) {
checkNotNull(enumeration, "Can not create an Iterable from a null enumeration");
return new Iterable<E>() {
public Iterator<E> iterator() {
return new ImmutableIterator<E>() {
public boolean hasNext() {
return enumeration.hasMoreElements();
}
public E next() {
return enumeration.nextElement();
}
};
}
};
}
|
[
"public",
"static",
"<",
"E",
">",
"Iterable",
"<",
"E",
">",
"iterable",
"(",
"final",
"Enumeration",
"<",
"E",
">",
"enumeration",
")",
"{",
"checkNotNull",
"(",
"enumeration",
",",
"\"Can not create an Iterable from a null enumeration\"",
")",
";",
"return",
"new",
"Iterable",
"<",
"E",
">",
"(",
")",
"{",
"public",
"Iterator",
"<",
"E",
">",
"iterator",
"(",
")",
"{",
"return",
"new",
"ImmutableIterator",
"<",
"E",
">",
"(",
")",
"{",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"return",
"enumeration",
".",
"hasMoreElements",
"(",
")",
";",
"}",
"public",
"E",
"next",
"(",
")",
"{",
"return",
"enumeration",
".",
"nextElement",
"(",
")",
";",
"}",
"}",
";",
"}",
"}",
";",
"}"
] |
Convert an enumeration to an iterator.
@param enumeration the enumeration to make into an Iterator
@param <E> type of the enumeration
@return An Iterable
@throws java.lang.NullPointerException if enumeration is null
|
[
"Convert",
"an",
"enumeration",
"to",
"an",
"iterator",
"."
] |
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
|
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Iterables.java#L184-L199
|
153,033
|
nwillc/almost-functional
|
src/main/java/almost/functional/utils/Iterables.java
|
Iterables.get
|
public static <E> Optional<E> get(final Iterable<E> iterable, final int position) {
checkNotNull(iterable, "Get requires an iterable");
if (position < 0) {
return Optional.empty();
}
int iterablePosition = 0;
for (E anIterable : iterable) {
if (iterablePosition == position) {
return of(anIterable);
}
iterablePosition++;
}
return Optional.empty();
}
|
java
|
public static <E> Optional<E> get(final Iterable<E> iterable, final int position) {
checkNotNull(iterable, "Get requires an iterable");
if (position < 0) {
return Optional.empty();
}
int iterablePosition = 0;
for (E anIterable : iterable) {
if (iterablePosition == position) {
return of(anIterable);
}
iterablePosition++;
}
return Optional.empty();
}
|
[
"public",
"static",
"<",
"E",
">",
"Optional",
"<",
"E",
">",
"get",
"(",
"final",
"Iterable",
"<",
"E",
">",
"iterable",
",",
"final",
"int",
"position",
")",
"{",
"checkNotNull",
"(",
"iterable",
",",
"\"Get requires an iterable\"",
")",
";",
"if",
"(",
"position",
"<",
"0",
")",
"{",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"int",
"iterablePosition",
"=",
"0",
";",
"for",
"(",
"E",
"anIterable",
":",
"iterable",
")",
"{",
"if",
"(",
"iterablePosition",
"==",
"position",
")",
"{",
"return",
"of",
"(",
"anIterable",
")",
";",
"}",
"iterablePosition",
"++",
";",
"}",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}"
] |
Return an optional of an element from a specified position in an iterable. If the position is out of bounds
an empty optional is returned. Positions start at 0.
@param iterable the iterable
@param position the position
@param <E> the type of the elements
@return an optional from the given position, or empty if out of bounds
@since 1.7
|
[
"Return",
"an",
"optional",
"of",
"an",
"element",
"from",
"a",
"specified",
"position",
"in",
"an",
"iterable",
".",
"If",
"the",
"position",
"is",
"out",
"of",
"bounds",
"an",
"empty",
"optional",
"is",
"returned",
".",
"Positions",
"start",
"at",
"0",
"."
] |
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
|
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Iterables.java#L211-L226
|
153,034
|
nwillc/almost-functional
|
src/main/java/almost/functional/utils/Iterables.java
|
Iterables.last
|
public static <E> Optional<E> last(final Iterable<E> iterable) {
checkNotNull(iterable, "last requires a non null iterable");
final Iterator<E> iterator = iterable.iterator();
if (!iterator.hasNext()) {
return Optional.empty();
}
E lastElement;
do {
lastElement = iterator.next();
} while (iterator.hasNext());
return Optional.of(lastElement);
}
|
java
|
public static <E> Optional<E> last(final Iterable<E> iterable) {
checkNotNull(iterable, "last requires a non null iterable");
final Iterator<E> iterator = iterable.iterator();
if (!iterator.hasNext()) {
return Optional.empty();
}
E lastElement;
do {
lastElement = iterator.next();
} while (iterator.hasNext());
return Optional.of(lastElement);
}
|
[
"public",
"static",
"<",
"E",
">",
"Optional",
"<",
"E",
">",
"last",
"(",
"final",
"Iterable",
"<",
"E",
">",
"iterable",
")",
"{",
"checkNotNull",
"(",
"iterable",
",",
"\"last requires a non null iterable\"",
")",
";",
"final",
"Iterator",
"<",
"E",
">",
"iterator",
"=",
"iterable",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"!",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}",
"E",
"lastElement",
";",
"do",
"{",
"lastElement",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"}",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
";",
"return",
"Optional",
".",
"of",
"(",
"lastElement",
")",
";",
"}"
] |
Return the last element of an iterable, or empty if the iterable is empty.
@param iterable the iterable
@param <E> type of the iterable elements
@return Optional of the last element, or empty if nothing in the iterable
|
[
"Return",
"the",
"last",
"element",
"of",
"an",
"iterable",
"or",
"empty",
"if",
"the",
"iterable",
"is",
"empty",
"."
] |
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
|
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/utils/Iterables.java#L235-L248
|
153,035
|
tsweets/jdefault
|
src/main/java/org/beer30/jdefault/JDefaultInternet.java
|
JDefaultInternet.ipV4Address
|
public static String ipV4Address() {
StringBuffer sb = new StringBuffer();
sb.append(JDefaultNumber.randomIntBetweenTwoNumbers(2, 254) + "");
sb.append(".");
sb.append(JDefaultNumber.randomIntBetweenTwoNumbers(2, 254) + "");
sb.append(".");
sb.append(JDefaultNumber.randomIntBetweenTwoNumbers(2, 254) + "");
sb.append(".");
sb.append(JDefaultNumber.randomIntBetweenTwoNumbers(2, 254) + "");
return sb.toString();
}
|
java
|
public static String ipV4Address() {
StringBuffer sb = new StringBuffer();
sb.append(JDefaultNumber.randomIntBetweenTwoNumbers(2, 254) + "");
sb.append(".");
sb.append(JDefaultNumber.randomIntBetweenTwoNumbers(2, 254) + "");
sb.append(".");
sb.append(JDefaultNumber.randomIntBetweenTwoNumbers(2, 254) + "");
sb.append(".");
sb.append(JDefaultNumber.randomIntBetweenTwoNumbers(2, 254) + "");
return sb.toString();
}
|
[
"public",
"static",
"String",
"ipV4Address",
"(",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sb",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomIntBetweenTwoNumbers",
"(",
"2",
",",
"254",
")",
"+",
"\"\"",
")",
";",
"sb",
".",
"append",
"(",
"\".\"",
")",
";",
"sb",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomIntBetweenTwoNumbers",
"(",
"2",
",",
"254",
")",
"+",
"\"\"",
")",
";",
"sb",
".",
"append",
"(",
"\".\"",
")",
";",
"sb",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomIntBetweenTwoNumbers",
"(",
"2",
",",
"254",
")",
"+",
"\"\"",
")",
";",
"sb",
".",
"append",
"(",
"\".\"",
")",
";",
"sb",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomIntBetweenTwoNumbers",
"(",
"2",
",",
"254",
")",
"+",
"\"\"",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
generates a random IPv4 ip address like 192.168.2.100
@return ip address string
|
[
"generates",
"a",
"random",
"IPv4",
"ip",
"address",
"like",
"192",
".",
"168",
".",
"2",
".",
"100"
] |
1793ab8e1337e930f31e362071db4af0c3978b70
|
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultInternet.java#L140-L152
|
153,036
|
tsweets/jdefault
|
src/main/java/org/beer30/jdefault/JDefaultInternet.java
|
JDefaultInternet.userName
|
public static String userName() {
return fixNonWord(StringUtils.left(JDefaultName.firstName(), 1).toLowerCase() + JDefaultName.lastName().toLowerCase() + JDefaultNumber.randomNumberString(2));
}
|
java
|
public static String userName() {
return fixNonWord(StringUtils.left(JDefaultName.firstName(), 1).toLowerCase() + JDefaultName.lastName().toLowerCase() + JDefaultNumber.randomNumberString(2));
}
|
[
"public",
"static",
"String",
"userName",
"(",
")",
"{",
"return",
"fixNonWord",
"(",
"StringUtils",
".",
"left",
"(",
"JDefaultName",
".",
"firstName",
"(",
")",
",",
"1",
")",
".",
"toLowerCase",
"(",
")",
"+",
"JDefaultName",
".",
"lastName",
"(",
")",
".",
"toLowerCase",
"(",
")",
"+",
"JDefaultNumber",
".",
"randomNumberString",
"(",
"2",
")",
")",
";",
"}"
] |
generates a random username in the format of Firstname intial + lastname + random 2 digit
ie tjones67
@return
|
[
"generates",
"a",
"random",
"username",
"in",
"the",
"format",
"of",
"Firstname",
"intial",
"+",
"lastname",
"+",
"random",
"2",
"digit",
"ie",
"tjones67"
] |
1793ab8e1337e930f31e362071db4af0c3978b70
|
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultInternet.java#L221-L223
|
153,037
|
arxanchain/java-common
|
src/main/java/com/arxanfintech/common/rest/Api.java
|
Api.NewHttpClient
|
public CloseableHttpClient NewHttpClient() throws Exception {
SSLContext sslcontext = SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext);
this.httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build();
return this.httpclient;
}
|
java
|
public CloseableHttpClient NewHttpClient() throws Exception {
SSLContext sslcontext = SSLContexts.custom().loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext);
this.httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build();
return this.httpclient;
}
|
[
"public",
"CloseableHttpClient",
"NewHttpClient",
"(",
")",
"throws",
"Exception",
"{",
"SSLContext",
"sslcontext",
"=",
"SSLContexts",
".",
"custom",
"(",
")",
".",
"loadTrustMaterial",
"(",
"null",
",",
"new",
"TrustSelfSignedStrategy",
"(",
")",
")",
".",
"build",
"(",
")",
";",
"SSLConnectionSocketFactory",
"sslsf",
"=",
"new",
"SSLConnectionSocketFactory",
"(",
"sslcontext",
")",
";",
"this",
".",
"httpclient",
"=",
"HttpClients",
".",
"custom",
"(",
")",
".",
"setSSLSocketFactory",
"(",
"sslsf",
")",
".",
"build",
"(",
")",
";",
"return",
"this",
".",
"httpclient",
";",
"}"
] |
create http client
|
[
"create",
"http",
"client"
] |
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
|
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/rest/Api.java#L113-L118
|
153,038
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/BaseSource.java
|
BaseSource.hasNext
|
public boolean hasNext()
{
try {
if (!this.parseNextLine())
{
try {
m_record.addNew();
} catch (DBException e) {
e.printStackTrace();
}
m_record.close();
m_reader.close();
return false;
}
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
|
java
|
public boolean hasNext()
{
try {
if (!this.parseNextLine())
{
try {
m_record.addNew();
} catch (DBException e) {
e.printStackTrace();
}
m_record.close();
m_reader.close();
return false;
}
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
|
[
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"this",
".",
"parseNextLine",
"(",
")",
")",
"{",
"try",
"{",
"m_record",
".",
"addNew",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"m_record",
".",
"close",
"(",
")",
";",
"m_reader",
".",
"close",
"(",
")",
";",
"return",
"false",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"true",
";",
"}"
] |
HasNext Method.
|
[
"HasNext",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/BaseSource.java#L60-L79
|
153,039
|
js-lib-com/commons
|
src/main/java/js/io/WriterOutputStream.java
|
WriterOutputStream.flushCharactersBuffer
|
private void flushCharactersBuffer() throws IOException
{
if(charactersBuffer.position() > 0) {
writer.write(charactersBuffer.array(), 0, charactersBuffer.position());
charactersBuffer.rewind();
}
}
|
java
|
private void flushCharactersBuffer() throws IOException
{
if(charactersBuffer.position() > 0) {
writer.write(charactersBuffer.array(), 0, charactersBuffer.position());
charactersBuffer.rewind();
}
}
|
[
"private",
"void",
"flushCharactersBuffer",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"charactersBuffer",
".",
"position",
"(",
")",
">",
"0",
")",
"{",
"writer",
".",
"write",
"(",
"charactersBuffer",
".",
"array",
"(",
")",
",",
"0",
",",
"charactersBuffer",
".",
"position",
"(",
")",
")",
";",
"charactersBuffer",
".",
"rewind",
"(",
")",
";",
"}",
"}"
] |
Flush characters buffer to underlying writer.
@throws IOException if write operation on underlying writer fails.
|
[
"Flush",
"characters",
"buffer",
"to",
"underlying",
"writer",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/WriterOutputStream.java#L182-L188
|
153,040
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/view/ScreenFieldViewAdapter.java
|
ScreenFieldViewAdapter.setFieldState
|
public int setFieldState(Object objValue, boolean bDisplayOption, int iMoveMode)
{
if (this.getScreenField().getConverter() == null)
return DBConstants.NORMAL_RETURN;
if (!(objValue instanceof String))
return this.getScreenField().getConverter().setData(objValue, bDisplayOption, iMoveMode);
else
return this.getScreenField().getConverter().setString((String)objValue, bDisplayOption, iMoveMode);
}
|
java
|
public int setFieldState(Object objValue, boolean bDisplayOption, int iMoveMode)
{
if (this.getScreenField().getConverter() == null)
return DBConstants.NORMAL_RETURN;
if (!(objValue instanceof String))
return this.getScreenField().getConverter().setData(objValue, bDisplayOption, iMoveMode);
else
return this.getScreenField().getConverter().setString((String)objValue, bDisplayOption, iMoveMode);
}
|
[
"public",
"int",
"setFieldState",
"(",
"Object",
"objValue",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"this",
".",
"getScreenField",
"(",
")",
".",
"getConverter",
"(",
")",
"==",
"null",
")",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"if",
"(",
"!",
"(",
"objValue",
"instanceof",
"String",
")",
")",
"return",
"this",
".",
"getScreenField",
"(",
")",
".",
"getConverter",
"(",
")",
".",
"setData",
"(",
"objValue",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"else",
"return",
"this",
".",
"getScreenField",
"(",
")",
".",
"getConverter",
"(",
")",
".",
"setString",
"(",
"(",
"String",
")",
"objValue",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] |
Set the field to this state. State is defined by the component.
@param objValue The value to set the field to (class of object depends on the control).
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return Error code.
|
[
"Set",
"the",
"field",
"to",
"this",
"state",
".",
"State",
"is",
"defined",
"by",
"the",
"component",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/ScreenFieldViewAdapter.java#L197-L205
|
153,041
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/view/ScreenFieldViewAdapter.java
|
ScreenFieldViewAdapter.getFirstToUpper
|
public static char getFirstToUpper(String string, char chDefault)
{
if ((string != null) && (string.length() > 0))
chDefault = Character.toUpperCase(string.charAt(0));
return chDefault;
}
|
java
|
public static char getFirstToUpper(String string, char chDefault)
{
if ((string != null) && (string.length() > 0))
chDefault = Character.toUpperCase(string.charAt(0));
return chDefault;
}
|
[
"public",
"static",
"char",
"getFirstToUpper",
"(",
"String",
"string",
",",
"char",
"chDefault",
")",
"{",
"if",
"(",
"(",
"string",
"!=",
"null",
")",
"&&",
"(",
"string",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"chDefault",
"=",
"Character",
".",
"toUpperCase",
"(",
"string",
".",
"charAt",
"(",
"0",
")",
")",
";",
"return",
"chDefault",
";",
"}"
] |
Return the first char of this string converted to upper case.
@param The string to get the first char to upper.
@param chDefault If the string is empty, return this.
@return The first char in the string converted to upper.
|
[
"Return",
"the",
"first",
"char",
"of",
"this",
"string",
"converted",
"to",
"upper",
"case",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/ScreenFieldViewAdapter.java#L698-L703
|
153,042
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/view/ScreenFieldViewAdapter.java
|
ScreenFieldViewAdapter.getMainRecord
|
public Record getMainRecord()
{
if (this.getScreenField() instanceof BasePanel)
return ((BasePanel)this.getScreenField()).getMainRecord();
else
return this.getScreenField().getParentScreen().getMainRecord();
}
|
java
|
public Record getMainRecord()
{
if (this.getScreenField() instanceof BasePanel)
return ((BasePanel)this.getScreenField()).getMainRecord();
else
return this.getScreenField().getParentScreen().getMainRecord();
}
|
[
"public",
"Record",
"getMainRecord",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getScreenField",
"(",
")",
"instanceof",
"BasePanel",
")",
"return",
"(",
"(",
"BasePanel",
")",
"this",
".",
"getScreenField",
"(",
")",
")",
".",
"getMainRecord",
"(",
")",
";",
"else",
"return",
"this",
".",
"getScreenField",
"(",
")",
".",
"getParentScreen",
"(",
")",
".",
"getMainRecord",
"(",
")",
";",
"}"
] |
Convenience method to get the model's main record.
@return The model's main record.
|
[
"Convenience",
"method",
"to",
"get",
"the",
"model",
"s",
"main",
"record",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/ScreenFieldViewAdapter.java#L729-L735
|
153,043
|
jbundle/jbundle
|
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java
|
JdbcTable.init
|
public void init(BaseDatabase database, Record record)
{
super.init(database, record);
m_iRow = -1; // resultSet row 0 = First row.
m_iEOFRow = Integer.MAX_VALUE; // Last valid row.
m_iLastOrder = -1;
}
|
java
|
public void init(BaseDatabase database, Record record)
{
super.init(database, record);
m_iRow = -1; // resultSet row 0 = First row.
m_iEOFRow = Integer.MAX_VALUE; // Last valid row.
m_iLastOrder = -1;
}
|
[
"public",
"void",
"init",
"(",
"BaseDatabase",
"database",
",",
"Record",
"record",
")",
"{",
"super",
".",
"init",
"(",
"database",
",",
"record",
")",
";",
"m_iRow",
"=",
"-",
"1",
";",
"// resultSet row 0 = First row.",
"m_iEOFRow",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"// Last valid row.",
"m_iLastOrder",
"=",
"-",
"1",
";",
"}"
] |
Init this table.
@param database The database to add this table to.
@param record The record to connect to this table.
|
[
"Init",
"this",
"table",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java#L157-L163
|
153,044
|
jbundle/jbundle
|
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java
|
JdbcTable.close
|
public void close()
{
super.close(); // Write the current record, etc.
try {
if (this.lockOnDBTrxType(null, DBConstants.AFTER_REFRESH_TYPE, false)) // AFTER_REFRESH_TYPE = Close since there is no close
this.unlockIfLocked(this.getRecord(), null); // Release any locks
} catch (DBException ex) {
ex.printStackTrace();
}
try {
if (m_seekResultSet != null)
m_seekResultSet.close();
m_seekResultSet = null;
if (m_selectResultSet != null)
m_selectResultSet.close();
m_selectResultSet = null;
if (m_autoSequenceResultSet != null)
m_autoSequenceResultSet.close();
m_autoSequenceResultSet = null;
if (m_queryStatement != null)
m_queryStatement.close();
m_queryStatement = null;
if (m_updateStatement != null)
m_updateStatement.close();
m_updateStatement = null;
if (m_seekStatement != null)
m_seekStatement.close();
m_seekStatement = null;
} catch (SQLException e) {
e.printStackTrace(); // No error on close
}
m_iRow = -1;
m_iEOFRow = Integer.MAX_VALUE; // Last valid row.
m_strStmtLastSQL = null; // Last SQL string.
m_strLastSQL = null; // Last SQL string.
m_strStmtLastSeekSQL = null; // Last SQL string.
}
|
java
|
public void close()
{
super.close(); // Write the current record, etc.
try {
if (this.lockOnDBTrxType(null, DBConstants.AFTER_REFRESH_TYPE, false)) // AFTER_REFRESH_TYPE = Close since there is no close
this.unlockIfLocked(this.getRecord(), null); // Release any locks
} catch (DBException ex) {
ex.printStackTrace();
}
try {
if (m_seekResultSet != null)
m_seekResultSet.close();
m_seekResultSet = null;
if (m_selectResultSet != null)
m_selectResultSet.close();
m_selectResultSet = null;
if (m_autoSequenceResultSet != null)
m_autoSequenceResultSet.close();
m_autoSequenceResultSet = null;
if (m_queryStatement != null)
m_queryStatement.close();
m_queryStatement = null;
if (m_updateStatement != null)
m_updateStatement.close();
m_updateStatement = null;
if (m_seekStatement != null)
m_seekStatement.close();
m_seekStatement = null;
} catch (SQLException e) {
e.printStackTrace(); // No error on close
}
m_iRow = -1;
m_iEOFRow = Integer.MAX_VALUE; // Last valid row.
m_strStmtLastSQL = null; // Last SQL string.
m_strLastSQL = null; // Last SQL string.
m_strStmtLastSeekSQL = null; // Last SQL string.
}
|
[
"public",
"void",
"close",
"(",
")",
"{",
"super",
".",
"close",
"(",
")",
";",
"// Write the current record, etc.",
"try",
"{",
"if",
"(",
"this",
".",
"lockOnDBTrxType",
"(",
"null",
",",
"DBConstants",
".",
"AFTER_REFRESH_TYPE",
",",
"false",
")",
")",
"// AFTER_REFRESH_TYPE = Close since there is no close",
"this",
".",
"unlockIfLocked",
"(",
"this",
".",
"getRecord",
"(",
")",
",",
"null",
")",
";",
"// Release any locks",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"try",
"{",
"if",
"(",
"m_seekResultSet",
"!=",
"null",
")",
"m_seekResultSet",
".",
"close",
"(",
")",
";",
"m_seekResultSet",
"=",
"null",
";",
"if",
"(",
"m_selectResultSet",
"!=",
"null",
")",
"m_selectResultSet",
".",
"close",
"(",
")",
";",
"m_selectResultSet",
"=",
"null",
";",
"if",
"(",
"m_autoSequenceResultSet",
"!=",
"null",
")",
"m_autoSequenceResultSet",
".",
"close",
"(",
")",
";",
"m_autoSequenceResultSet",
"=",
"null",
";",
"if",
"(",
"m_queryStatement",
"!=",
"null",
")",
"m_queryStatement",
".",
"close",
"(",
")",
";",
"m_queryStatement",
"=",
"null",
";",
"if",
"(",
"m_updateStatement",
"!=",
"null",
")",
"m_updateStatement",
".",
"close",
"(",
")",
";",
"m_updateStatement",
"=",
"null",
";",
"if",
"(",
"m_seekStatement",
"!=",
"null",
")",
"m_seekStatement",
".",
"close",
"(",
")",
";",
"m_seekStatement",
"=",
"null",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"// No error on close",
"}",
"m_iRow",
"=",
"-",
"1",
";",
"m_iEOFRow",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"// Last valid row.",
"m_strStmtLastSQL",
"=",
"null",
";",
"// Last SQL string.",
"m_strLastSQL",
"=",
"null",
";",
"// Last SQL string.",
"m_strStmtLastSeekSQL",
"=",
"null",
";",
"// Last SQL string.",
"}"
] |
Close this table.
|
[
"Close",
"this",
"table",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java#L174-L212
|
153,045
|
jbundle/jbundle
|
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java
|
JdbcTable.getLastSQLStatement
|
public String getLastSQLStatement(int iType)
{
switch (iType)
{
case DBConstants.SQL_UPDATE_TYPE:
case DBConstants.SQL_INSERT_TABLE_TYPE:
case DBConstants.SQL_DELETE_TYPE:
return m_strLastSQL;
case DBConstants.SQL_AUTOSEQUENCE_TYPE:
case DBConstants.SQL_SEEK_TYPE:
if (!SHARE_STATEMENTS)
return m_strStmtLastSeekSQL;
case DBConstants.SQL_SELECT_TYPE:
case DBConstants.SQL_CREATE_TYPE:
default:
return m_strStmtLastSQL;
}
}
|
java
|
public String getLastSQLStatement(int iType)
{
switch (iType)
{
case DBConstants.SQL_UPDATE_TYPE:
case DBConstants.SQL_INSERT_TABLE_TYPE:
case DBConstants.SQL_DELETE_TYPE:
return m_strLastSQL;
case DBConstants.SQL_AUTOSEQUENCE_TYPE:
case DBConstants.SQL_SEEK_TYPE:
if (!SHARE_STATEMENTS)
return m_strStmtLastSeekSQL;
case DBConstants.SQL_SELECT_TYPE:
case DBConstants.SQL_CREATE_TYPE:
default:
return m_strStmtLastSQL;
}
}
|
[
"public",
"String",
"getLastSQLStatement",
"(",
"int",
"iType",
")",
"{",
"switch",
"(",
"iType",
")",
"{",
"case",
"DBConstants",
".",
"SQL_UPDATE_TYPE",
":",
"case",
"DBConstants",
".",
"SQL_INSERT_TABLE_TYPE",
":",
"case",
"DBConstants",
".",
"SQL_DELETE_TYPE",
":",
"return",
"m_strLastSQL",
";",
"case",
"DBConstants",
".",
"SQL_AUTOSEQUENCE_TYPE",
":",
"case",
"DBConstants",
".",
"SQL_SEEK_TYPE",
":",
"if",
"(",
"!",
"SHARE_STATEMENTS",
")",
"return",
"m_strStmtLastSeekSQL",
";",
"case",
"DBConstants",
".",
"SQL_SELECT_TYPE",
":",
"case",
"DBConstants",
".",
"SQL_CREATE_TYPE",
":",
"default",
":",
"return",
"m_strStmtLastSQL",
";",
"}",
"}"
] |
Get the last SQL string for this statement type
|
[
"Get",
"the",
"last",
"SQL",
"string",
"for",
"this",
"statement",
"type"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java#L387-L404
|
153,046
|
jbundle/jbundle
|
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java
|
JdbcTable.setResultSet
|
public void setResultSet(ResultSet resultSet, int iType)
{
if (this.getResultSet(iType) != null)
{ // If this is a new resultSet for my current statement, close the old resultSet.
try {
this.getResultSet(iType).close();
} catch (SQLException e) {
e.printStackTrace(); // Never
}
}
switch (iType)
{
case DBConstants.SQL_SEEK_TYPE:
if (!SHARE_STATEMENTS)
{
m_seekResultSet = resultSet;
break;
}
case DBConstants.SQL_SELECT_TYPE:
case DBConstants.SQL_CREATE_TYPE:
m_selectResultSet = resultSet;
break;
case DBConstants.SQL_AUTOSEQUENCE_TYPE:
m_autoSequenceResultSet = resultSet;
break;
case DBConstants.SQL_UPDATE_TYPE:
case DBConstants.SQL_INSERT_TABLE_TYPE:
case DBConstants.SQL_DELETE_TYPE:
default:
// Never
break;
}
m_iResultSetType = iType;
if (iType == DBConstants.SQL_SELECT_TYPE)
{
m_iRow = -1; // Starting from a new query
m_iEOFRow = Integer.MAX_VALUE;
}
}
|
java
|
public void setResultSet(ResultSet resultSet, int iType)
{
if (this.getResultSet(iType) != null)
{ // If this is a new resultSet for my current statement, close the old resultSet.
try {
this.getResultSet(iType).close();
} catch (SQLException e) {
e.printStackTrace(); // Never
}
}
switch (iType)
{
case DBConstants.SQL_SEEK_TYPE:
if (!SHARE_STATEMENTS)
{
m_seekResultSet = resultSet;
break;
}
case DBConstants.SQL_SELECT_TYPE:
case DBConstants.SQL_CREATE_TYPE:
m_selectResultSet = resultSet;
break;
case DBConstants.SQL_AUTOSEQUENCE_TYPE:
m_autoSequenceResultSet = resultSet;
break;
case DBConstants.SQL_UPDATE_TYPE:
case DBConstants.SQL_INSERT_TABLE_TYPE:
case DBConstants.SQL_DELETE_TYPE:
default:
// Never
break;
}
m_iResultSetType = iType;
if (iType == DBConstants.SQL_SELECT_TYPE)
{
m_iRow = -1; // Starting from a new query
m_iEOFRow = Integer.MAX_VALUE;
}
}
|
[
"public",
"void",
"setResultSet",
"(",
"ResultSet",
"resultSet",
",",
"int",
"iType",
")",
"{",
"if",
"(",
"this",
".",
"getResultSet",
"(",
"iType",
")",
"!=",
"null",
")",
"{",
"// If this is a new resultSet for my current statement, close the old resultSet.",
"try",
"{",
"this",
".",
"getResultSet",
"(",
"iType",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"// Never",
"}",
"}",
"switch",
"(",
"iType",
")",
"{",
"case",
"DBConstants",
".",
"SQL_SEEK_TYPE",
":",
"if",
"(",
"!",
"SHARE_STATEMENTS",
")",
"{",
"m_seekResultSet",
"=",
"resultSet",
";",
"break",
";",
"}",
"case",
"DBConstants",
".",
"SQL_SELECT_TYPE",
":",
"case",
"DBConstants",
".",
"SQL_CREATE_TYPE",
":",
"m_selectResultSet",
"=",
"resultSet",
";",
"break",
";",
"case",
"DBConstants",
".",
"SQL_AUTOSEQUENCE_TYPE",
":",
"m_autoSequenceResultSet",
"=",
"resultSet",
";",
"break",
";",
"case",
"DBConstants",
".",
"SQL_UPDATE_TYPE",
":",
"case",
"DBConstants",
".",
"SQL_INSERT_TABLE_TYPE",
":",
"case",
"DBConstants",
".",
"SQL_DELETE_TYPE",
":",
"default",
":",
"// Never",
"break",
";",
"}",
"m_iResultSetType",
"=",
"iType",
";",
"if",
"(",
"iType",
"==",
"DBConstants",
".",
"SQL_SELECT_TYPE",
")",
"{",
"m_iRow",
"=",
"-",
"1",
";",
"// Starting from a new query",
"m_iEOFRow",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"}",
"}"
] |
Set the ResultSet for this select or seek statement type.
@param resultSet The resultSet to set.
@return The old resultSet.
|
[
"Set",
"the",
"ResultSet",
"for",
"this",
"select",
"or",
"seek",
"statement",
"type",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java#L472-L510
|
153,047
|
jbundle/jbundle
|
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java
|
JdbcTable.readNextToTarget
|
public int readNextToTarget(int iTargetPosition, int iRelPosition) throws DBException
{
int iRecordStatus = DBConstants.RECORD_NORMAL;
boolean bMore = true;
ResultSet resultSet = (ResultSet)this.getResultSet();
while (m_iRow < iTargetPosition)
{ // Spin until you get to the row or hit EOF
try {
bMore = resultSet.next();
if (!bMore)
{
m_iEOFRow = m_iRow; // Last physical row = this row - 1.
break; // Hit EOF
}
m_iRow++; // Current row
} catch (SQLException e) {
DBException dbEx = this.getDatabase().convertError(e);
int iErrorCode = dbEx.getErrorCode();
if ((iRelPosition == DBConstants.FIRST_RECORD) || ((iRelPosition == DBConstants.LAST_RECORD)))
if (iErrorCode == DBConstants.INVALID_RECORD)
return (DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF | DBConstants.RECORD_AT_EOF); // Move first - no records
throw dbEx;
}
}
if ((m_iRow == -1) || (iTargetPosition == -1))
iRecordStatus |= DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF;
if (!bMore)
{
iRecordStatus |= DBConstants.RECORD_AT_EOF;
int iEOFRow = m_iEOFRow; // Save for a sec
this.setResultSet(null, DBConstants.SQL_SELECT_TYPE); // Can't use anymore
m_iEOFRow = iEOFRow; // I do know the EOF
}
return iRecordStatus;
}
|
java
|
public int readNextToTarget(int iTargetPosition, int iRelPosition) throws DBException
{
int iRecordStatus = DBConstants.RECORD_NORMAL;
boolean bMore = true;
ResultSet resultSet = (ResultSet)this.getResultSet();
while (m_iRow < iTargetPosition)
{ // Spin until you get to the row or hit EOF
try {
bMore = resultSet.next();
if (!bMore)
{
m_iEOFRow = m_iRow; // Last physical row = this row - 1.
break; // Hit EOF
}
m_iRow++; // Current row
} catch (SQLException e) {
DBException dbEx = this.getDatabase().convertError(e);
int iErrorCode = dbEx.getErrorCode();
if ((iRelPosition == DBConstants.FIRST_RECORD) || ((iRelPosition == DBConstants.LAST_RECORD)))
if (iErrorCode == DBConstants.INVALID_RECORD)
return (DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF | DBConstants.RECORD_AT_EOF); // Move first - no records
throw dbEx;
}
}
if ((m_iRow == -1) || (iTargetPosition == -1))
iRecordStatus |= DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF;
if (!bMore)
{
iRecordStatus |= DBConstants.RECORD_AT_EOF;
int iEOFRow = m_iEOFRow; // Save for a sec
this.setResultSet(null, DBConstants.SQL_SELECT_TYPE); // Can't use anymore
m_iEOFRow = iEOFRow; // I do know the EOF
}
return iRecordStatus;
}
|
[
"public",
"int",
"readNextToTarget",
"(",
"int",
"iTargetPosition",
",",
"int",
"iRelPosition",
")",
"throws",
"DBException",
"{",
"int",
"iRecordStatus",
"=",
"DBConstants",
".",
"RECORD_NORMAL",
";",
"boolean",
"bMore",
"=",
"true",
";",
"ResultSet",
"resultSet",
"=",
"(",
"ResultSet",
")",
"this",
".",
"getResultSet",
"(",
")",
";",
"while",
"(",
"m_iRow",
"<",
"iTargetPosition",
")",
"{",
"// Spin until you get to the row or hit EOF",
"try",
"{",
"bMore",
"=",
"resultSet",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"bMore",
")",
"{",
"m_iEOFRow",
"=",
"m_iRow",
";",
"// Last physical row = this row - 1.",
"break",
";",
"// Hit EOF",
"}",
"m_iRow",
"++",
";",
"// Current row",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"DBException",
"dbEx",
"=",
"this",
".",
"getDatabase",
"(",
")",
".",
"convertError",
"(",
"e",
")",
";",
"int",
"iErrorCode",
"=",
"dbEx",
".",
"getErrorCode",
"(",
")",
";",
"if",
"(",
"(",
"iRelPosition",
"==",
"DBConstants",
".",
"FIRST_RECORD",
")",
"||",
"(",
"(",
"iRelPosition",
"==",
"DBConstants",
".",
"LAST_RECORD",
")",
")",
")",
"if",
"(",
"iErrorCode",
"==",
"DBConstants",
".",
"INVALID_RECORD",
")",
"return",
"(",
"DBConstants",
".",
"RECORD_INVALID",
"|",
"DBConstants",
".",
"RECORD_AT_BOF",
"|",
"DBConstants",
".",
"RECORD_AT_EOF",
")",
";",
"// Move first - no records",
"throw",
"dbEx",
";",
"}",
"}",
"if",
"(",
"(",
"m_iRow",
"==",
"-",
"1",
")",
"||",
"(",
"iTargetPosition",
"==",
"-",
"1",
")",
")",
"iRecordStatus",
"|=",
"DBConstants",
".",
"RECORD_INVALID",
"|",
"DBConstants",
".",
"RECORD_AT_BOF",
";",
"if",
"(",
"!",
"bMore",
")",
"{",
"iRecordStatus",
"|=",
"DBConstants",
".",
"RECORD_AT_EOF",
";",
"int",
"iEOFRow",
"=",
"m_iEOFRow",
";",
"// Save for a sec",
"this",
".",
"setResultSet",
"(",
"null",
",",
"DBConstants",
".",
"SQL_SELECT_TYPE",
")",
";",
"// Can't use anymore",
"m_iEOFRow",
"=",
"iEOFRow",
";",
"// I do know the EOF",
"}",
"return",
"iRecordStatus",
";",
"}"
] |
Read next until you get to this position.
@param iTargetPosition The position to read to.
@param iRelPosition The relative position I'm reading to (in case of first or last).
@exception DBException File exception.
|
[
"Read",
"next",
"until",
"you",
"get",
"to",
"this",
"position",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java#L1128-L1162
|
153,048
|
marssa/footprint
|
src/main/java/org/marssa/footprint/datatypes/decimal/pressure/APressure.java
|
APressure.getKPa
|
public MDecimal getKPa() {
MDecimal result = new MDecimal(currentUnit.getConverterTo(KILO(PASCAL))
.convert(doubleValue()));
logger.trace(MMarker.GETTER, "Converting from {} to Kilo Pascals : {}",
currentUnit, result);
return result;
}
|
java
|
public MDecimal getKPa() {
MDecimal result = new MDecimal(currentUnit.getConverterTo(KILO(PASCAL))
.convert(doubleValue()));
logger.trace(MMarker.GETTER, "Converting from {} to Kilo Pascals : {}",
currentUnit, result);
return result;
}
|
[
"public",
"MDecimal",
"getKPa",
"(",
")",
"{",
"MDecimal",
"result",
"=",
"new",
"MDecimal",
"(",
"currentUnit",
".",
"getConverterTo",
"(",
"KILO",
"(",
"PASCAL",
")",
")",
".",
"convert",
"(",
"doubleValue",
"(",
")",
")",
")",
";",
"logger",
".",
"trace",
"(",
"MMarker",
".",
"GETTER",
",",
"\"Converting from {} to Kilo Pascals : {}\"",
",",
"currentUnit",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
get Kilo Pascals
@return
|
[
"get",
"Kilo",
"Pascals"
] |
2ca953c14f46adc320927c87c5ce1c36eb6c82de
|
https://github.com/marssa/footprint/blob/2ca953c14f46adc320927c87c5ce1c36eb6c82de/src/main/java/org/marssa/footprint/datatypes/decimal/pressure/APressure.java#L114-L120
|
153,049
|
marssa/footprint
|
src/main/java/org/marssa/footprint/datatypes/decimal/pressure/APressure.java
|
APressure.getMMHg
|
public MDecimal getMMHg() {
MDecimal result = new MDecimal(currentUnit.getConverterTo(
MILLIMETER_OF_MERCURY).convert(doubleValue()));
logger.trace(MMarker.GETTER,
"Converting from {} to millimetres of Mecrcury : {}",
currentUnit, result);
return result;
}
|
java
|
public MDecimal getMMHg() {
MDecimal result = new MDecimal(currentUnit.getConverterTo(
MILLIMETER_OF_MERCURY).convert(doubleValue()));
logger.trace(MMarker.GETTER,
"Converting from {} to millimetres of Mecrcury : {}",
currentUnit, result);
return result;
}
|
[
"public",
"MDecimal",
"getMMHg",
"(",
")",
"{",
"MDecimal",
"result",
"=",
"new",
"MDecimal",
"(",
"currentUnit",
".",
"getConverterTo",
"(",
"MILLIMETER_OF_MERCURY",
")",
".",
"convert",
"(",
"doubleValue",
"(",
")",
")",
")",
";",
"logger",
".",
"trace",
"(",
"MMarker",
".",
"GETTER",
",",
"\"Converting from {} to millimetres of Mecrcury : {}\"",
",",
"currentUnit",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
get millimetres Mercury
|
[
"get",
"millimetres",
"Mercury"
] |
2ca953c14f46adc320927c87c5ce1c36eb6c82de
|
https://github.com/marssa/footprint/blob/2ca953c14f46adc320927c87c5ce1c36eb6c82de/src/main/java/org/marssa/footprint/datatypes/decimal/pressure/APressure.java#L125-L132
|
153,050
|
tvesalainen/util
|
ham/src/main/java/org/vesalainen/ham/AudioReader.java
|
AudioReader.getNextFrequency
|
public float getNextFrequency(float delta) throws IOException
{
float last = frequencyCounter.getFrequency();
float min = last-delta;
float max = last+delta;
while (true)
{
int sample = getSample();
if (frequencyCounter.update(sample))
{
float next = frequencyCounter.getFrequency();
if (next > max || next < min)
{
return next;
}
}
}
}
|
java
|
public float getNextFrequency(float delta) throws IOException
{
float last = frequencyCounter.getFrequency();
float min = last-delta;
float max = last+delta;
while (true)
{
int sample = getSample();
if (frequencyCounter.update(sample))
{
float next = frequencyCounter.getFrequency();
if (next > max || next < min)
{
return next;
}
}
}
}
|
[
"public",
"float",
"getNextFrequency",
"(",
"float",
"delta",
")",
"throws",
"IOException",
"{",
"float",
"last",
"=",
"frequencyCounter",
".",
"getFrequency",
"(",
")",
";",
"float",
"min",
"=",
"last",
"-",
"delta",
";",
"float",
"max",
"=",
"last",
"+",
"delta",
";",
"while",
"(",
"true",
")",
"{",
"int",
"sample",
"=",
"getSample",
"(",
")",
";",
"if",
"(",
"frequencyCounter",
".",
"update",
"(",
"sample",
")",
")",
"{",
"float",
"next",
"=",
"frequencyCounter",
".",
"getFrequency",
"(",
")",
";",
"if",
"(",
"next",
">",
"max",
"||",
"next",
"<",
"min",
")",
"{",
"return",
"next",
";",
"}",
"}",
"}",
"}"
] |
Returns next frequency that deviates more than delta from previous.
@param delta
@return
@throws IOException
|
[
"Returns",
"next",
"frequency",
"that",
"deviates",
"more",
"than",
"delta",
"from",
"previous",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/AudioReader.java#L154-L171
|
153,051
|
tvesalainen/util
|
ham/src/main/java/org/vesalainen/ham/AudioReader.java
|
AudioReader.getHalfWave
|
public float getHalfWave() throws IOException
{
while (true)
{
int sample = getSample();
if (frequencyCounter.update(sample))
{
return frequencyCounter.getFrequency();
}
}
}
|
java
|
public float getHalfWave() throws IOException
{
while (true)
{
int sample = getSample();
if (frequencyCounter.update(sample))
{
return frequencyCounter.getFrequency();
}
}
}
|
[
"public",
"float",
"getHalfWave",
"(",
")",
"throws",
"IOException",
"{",
"while",
"(",
"true",
")",
"{",
"int",
"sample",
"=",
"getSample",
"(",
")",
";",
"if",
"(",
"frequencyCounter",
".",
"update",
"(",
"sample",
")",
")",
"{",
"return",
"frequencyCounter",
".",
"getFrequency",
"(",
")",
";",
"}",
"}",
"}"
] |
Reads one half-wave and returns frequency
@return
@throws IOException
|
[
"Reads",
"one",
"half",
"-",
"wave",
"and",
"returns",
"frequency"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/ham/src/main/java/org/vesalainen/ham/AudioReader.java#L177-L187
|
153,052
|
caspervg/SC4D-LEX4J
|
lex4j/src/main/java/net/caspervg/lex4j/bean/DependencyList.java
|
DependencyList.asList
|
public List<Dependency> asList(boolean withChildren) {
if (withChildren) {
return new ArrayList<>(asSet());
} else {
if (list != null) {
return new ArrayList<>(list);
} else {
return new ArrayList<>();
}
}
}
|
java
|
public List<Dependency> asList(boolean withChildren) {
if (withChildren) {
return new ArrayList<>(asSet());
} else {
if (list != null) {
return new ArrayList<>(list);
} else {
return new ArrayList<>();
}
}
}
|
[
"public",
"List",
"<",
"Dependency",
">",
"asList",
"(",
"boolean",
"withChildren",
")",
"{",
"if",
"(",
"withChildren",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"asSet",
"(",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"list",
")",
";",
"}",
"else",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"}",
"}"
] |
Returns the dependencies as a list
@param withChildren also include child dependencies in the result
@return list of the dependencies
|
[
"Returns",
"the",
"dependencies",
"as",
"a",
"list"
] |
3d086ec70c817119a88573c2e23af27276cdb1d6
|
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/bean/DependencyList.java#L61-L71
|
153,053
|
caspervg/SC4D-LEX4J
|
lex4j/src/main/java/net/caspervg/lex4j/bean/DependencyList.java
|
DependencyList.asSet
|
public Set<Dependency> asSet(boolean withChildren) {
if (withChildren) {
Set<Dependency> dependencySet = new HashSet<>();
List<Dependency> dependencyList = asList(false);
dependencySet.addAll(dependencyList);
for (Dependency dependency : dependencyList) {
if (dependency.isInternal()) {
dependencySet.addAll(dependency.getDependencies().asSet());
}
}
return dependencySet;
} else {
return new HashSet<>(list);
}
}
|
java
|
public Set<Dependency> asSet(boolean withChildren) {
if (withChildren) {
Set<Dependency> dependencySet = new HashSet<>();
List<Dependency> dependencyList = asList(false);
dependencySet.addAll(dependencyList);
for (Dependency dependency : dependencyList) {
if (dependency.isInternal()) {
dependencySet.addAll(dependency.getDependencies().asSet());
}
}
return dependencySet;
} else {
return new HashSet<>(list);
}
}
|
[
"public",
"Set",
"<",
"Dependency",
">",
"asSet",
"(",
"boolean",
"withChildren",
")",
"{",
"if",
"(",
"withChildren",
")",
"{",
"Set",
"<",
"Dependency",
">",
"dependencySet",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"List",
"<",
"Dependency",
">",
"dependencyList",
"=",
"asList",
"(",
"false",
")",
";",
"dependencySet",
".",
"addAll",
"(",
"dependencyList",
")",
";",
"for",
"(",
"Dependency",
"dependency",
":",
"dependencyList",
")",
"{",
"if",
"(",
"dependency",
".",
"isInternal",
"(",
")",
")",
"{",
"dependencySet",
".",
"addAll",
"(",
"dependency",
".",
"getDependencies",
"(",
")",
".",
"asSet",
"(",
")",
")",
";",
"}",
"}",
"return",
"dependencySet",
";",
"}",
"else",
"{",
"return",
"new",
"HashSet",
"<>",
"(",
"list",
")",
";",
"}",
"}"
] |
Returns the dependencies as a set
@param withChildren also include child dependencies in the result
@return set of the dependencies
|
[
"Returns",
"the",
"dependencies",
"as",
"a",
"set"
] |
3d086ec70c817119a88573c2e23af27276cdb1d6
|
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/bean/DependencyList.java#L88-L104
|
153,054
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsStorageEngine.java
|
CommonsStorageEngine.insert
|
@Override
public final void insert(ClusterName targetCluster, TableMetadata targetTable, Row row, boolean isNotExists)
throws UnsupportedException, ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Inserting one row in table [" + targetTable.getName().getName() + "] in cluster ["
+ targetCluster.getName() + "]");
}
insert(targetTable, row, isNotExists, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("One row has been inserted successfully in table [" + targetTable.getName().getName()
+ "] in cluster [" + targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
java
|
@Override
public final void insert(ClusterName targetCluster, TableMetadata targetTable, Row row, boolean isNotExists)
throws UnsupportedException, ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Inserting one row in table [" + targetTable.getName().getName() + "] in cluster ["
+ targetCluster.getName() + "]");
}
insert(targetTable, row, isNotExists, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("One row has been inserted successfully in table [" + targetTable.getName().getName()
+ "] in cluster [" + targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"insert",
"(",
"ClusterName",
"targetCluster",
",",
"TableMetadata",
"targetTable",
",",
"Row",
"row",
",",
"boolean",
"isNotExists",
")",
"throws",
"UnsupportedException",
",",
"ExecutionException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Inserting one row in table [\"",
"+",
"targetTable",
".",
"getName",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"insert",
"(",
"targetTable",
",",
"row",
",",
"isNotExists",
",",
"connectionHandler",
".",
"getConnection",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"One row has been inserted successfully in table [\"",
"+",
"targetTable",
".",
"getName",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"finally",
"{",
"connectionHandler",
".",
"endJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
Insert a single row in a table.
@param targetCluster Target cluster.
@param targetTable Target table metadata including fully qualified including catalog.
@param row The row to be inserted.
@param isNotExists Insert only if primary key doesn't exist yet.
@throws UnsupportedException If the required set of operations are not supported by the connector.
@throws ExecutionException if the execution fails.
|
[
"Insert",
"a",
"single",
"row",
"in",
"a",
"table",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsStorageEngine.java#L73-L92
|
153,055
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsStorageEngine.java
|
CommonsStorageEngine.update
|
@Override
public final void update(ClusterName targetCluster, TableName tableName, Collection<Relation> assignments,
Collection<Filter> whereClauses) throws UnsupportedException, ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug(
"Updating table [" + tableName.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
update(tableName, assignments, whereClauses, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("The table [" + tableName.getName() + "] has been updated successfully in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
java
|
@Override
public final void update(ClusterName targetCluster, TableName tableName, Collection<Relation> assignments,
Collection<Filter> whereClauses) throws UnsupportedException, ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug(
"Updating table [" + tableName.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
update(tableName, assignments, whereClauses, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("The table [" + tableName.getName() + "] has been updated successfully in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"update",
"(",
"ClusterName",
"targetCluster",
",",
"TableName",
"tableName",
",",
"Collection",
"<",
"Relation",
">",
"assignments",
",",
"Collection",
"<",
"Filter",
">",
"whereClauses",
")",
"throws",
"UnsupportedException",
",",
"ExecutionException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Updating table [\"",
"+",
"tableName",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"update",
"(",
"tableName",
",",
"assignments",
",",
"whereClauses",
",",
"connectionHandler",
".",
"getConnection",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"The table [\"",
"+",
"tableName",
".",
"getName",
"(",
")",
"+",
"\"] has been updated successfully in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"finally",
"{",
"connectionHandler",
".",
"endJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
This method updates data of a table according to some conditions.
@param targetCluster the target cluster to insert.
@param tableName Target table name including fully qualified including catalog.
@param assignments Operations to be executed for every row.
@param whereClauses Where clauses.
@throws ExecutionException if an error occurs during the connection.
@throws UnsupportedException
|
[
"This",
"method",
"updates",
"data",
"of",
"a",
"table",
"according",
"to",
"some",
"conditions",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsStorageEngine.java#L136-L155
|
153,056
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsStorageEngine.java
|
CommonsStorageEngine.truncate
|
@Override
public final void truncate(ClusterName targetCluster, TableName tableName) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug(
"Tuncating table [" + tableName.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
truncate(tableName, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("The table [" + tableName.getName() + "] has been successfully truncated in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
java
|
@Override
public final void truncate(ClusterName targetCluster, TableName tableName) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug(
"Tuncating table [" + tableName.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
truncate(tableName, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("The table [" + tableName.getName() + "] has been successfully truncated in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"truncate",
"(",
"ClusterName",
"targetCluster",
",",
"TableName",
"tableName",
")",
"throws",
"UnsupportedException",
",",
"ExecutionException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Tuncating table [\"",
"+",
"tableName",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"truncate",
"(",
"tableName",
",",
"connectionHandler",
".",
"getConnection",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"The table [\"",
"+",
"tableName",
".",
"getName",
"(",
")",
"+",
"\"] has been successfully truncated in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"finally",
"{",
"connectionHandler",
".",
"endJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
This method deletes all the rows of a table.
@param targetCluster Target cluster.
@param tableName Target table name including fully qualified including catalog.
@throws UnsupportedException
@throws ExecutionException
|
[
"This",
"method",
"deletes",
"all",
"the",
"rows",
"of",
"a",
"table",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsStorageEngine.java#L196-L215
|
153,057
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/manual/convert/ConvertCode.java
|
ConvertCode.getDestPath
|
public File getDestPath(String sourcePath)
{
String destPathname = DBConstants.BLANK;
String dirPrefix = this.getProperty(DIR_PREFIX);
String sourceDir = this.getProperty(SOURCE_DIR);
String destDir = this.getProperty(DEST_DIR);
int startPath = sourcePath.indexOf(sourceDir);
// Now add the start of the source path
if ((dirPrefix != null) && (sourceDir != null) && (sourceDir.length() > 0) && (sourcePath.indexOf(dirPrefix) == 0))
destPathname += dirPrefix;
else
{
if ((!destDir.startsWith("/")) && (!destDir.startsWith(File.separator)))
{
if (startPath == 0)
{
int iEndStartPath = sourceDir.lastIndexOf(File.separator);
if (iEndStartPath == -1)
iEndStartPath = sourceDir.lastIndexOf('/');
if (iEndStartPath > 0)
destPathname += sourceDir.substring(0, iEndStartPath + 1);
}
}
}
destPathname = Utility.addToPath(destPathname, destDir);
if (startPath != -1)
destPathname = Utility.addToPath(destPathname, sourcePath.substring(startPath + sourceDir.length()));
return new File(destPathname);
}
|
java
|
public File getDestPath(String sourcePath)
{
String destPathname = DBConstants.BLANK;
String dirPrefix = this.getProperty(DIR_PREFIX);
String sourceDir = this.getProperty(SOURCE_DIR);
String destDir = this.getProperty(DEST_DIR);
int startPath = sourcePath.indexOf(sourceDir);
// Now add the start of the source path
if ((dirPrefix != null) && (sourceDir != null) && (sourceDir.length() > 0) && (sourcePath.indexOf(dirPrefix) == 0))
destPathname += dirPrefix;
else
{
if ((!destDir.startsWith("/")) && (!destDir.startsWith(File.separator)))
{
if (startPath == 0)
{
int iEndStartPath = sourceDir.lastIndexOf(File.separator);
if (iEndStartPath == -1)
iEndStartPath = sourceDir.lastIndexOf('/');
if (iEndStartPath > 0)
destPathname += sourceDir.substring(0, iEndStartPath + 1);
}
}
}
destPathname = Utility.addToPath(destPathname, destDir);
if (startPath != -1)
destPathname = Utility.addToPath(destPathname, sourcePath.substring(startPath + sourceDir.length()));
return new File(destPathname);
}
|
[
"public",
"File",
"getDestPath",
"(",
"String",
"sourcePath",
")",
"{",
"String",
"destPathname",
"=",
"DBConstants",
".",
"BLANK",
";",
"String",
"dirPrefix",
"=",
"this",
".",
"getProperty",
"(",
"DIR_PREFIX",
")",
";",
"String",
"sourceDir",
"=",
"this",
".",
"getProperty",
"(",
"SOURCE_DIR",
")",
";",
"String",
"destDir",
"=",
"this",
".",
"getProperty",
"(",
"DEST_DIR",
")",
";",
"int",
"startPath",
"=",
"sourcePath",
".",
"indexOf",
"(",
"sourceDir",
")",
";",
"// Now add the start of the source path",
"if",
"(",
"(",
"dirPrefix",
"!=",
"null",
")",
"&&",
"(",
"sourceDir",
"!=",
"null",
")",
"&&",
"(",
"sourceDir",
".",
"length",
"(",
")",
">",
"0",
")",
"&&",
"(",
"sourcePath",
".",
"indexOf",
"(",
"dirPrefix",
")",
"==",
"0",
")",
")",
"destPathname",
"+=",
"dirPrefix",
";",
"else",
"{",
"if",
"(",
"(",
"!",
"destDir",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"&&",
"(",
"!",
"destDir",
".",
"startsWith",
"(",
"File",
".",
"separator",
")",
")",
")",
"{",
"if",
"(",
"startPath",
"==",
"0",
")",
"{",
"int",
"iEndStartPath",
"=",
"sourceDir",
".",
"lastIndexOf",
"(",
"File",
".",
"separator",
")",
";",
"if",
"(",
"iEndStartPath",
"==",
"-",
"1",
")",
"iEndStartPath",
"=",
"sourceDir",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"iEndStartPath",
">",
"0",
")",
"destPathname",
"+=",
"sourceDir",
".",
"substring",
"(",
"0",
",",
"iEndStartPath",
"+",
"1",
")",
";",
"}",
"}",
"}",
"destPathname",
"=",
"Utility",
".",
"addToPath",
"(",
"destPathname",
",",
"destDir",
")",
";",
"if",
"(",
"startPath",
"!=",
"-",
"1",
")",
"destPathname",
"=",
"Utility",
".",
"addToPath",
"(",
"destPathname",
",",
"sourcePath",
".",
"substring",
"(",
"startPath",
"+",
"sourceDir",
".",
"length",
"(",
")",
")",
")",
";",
"return",
"new",
"File",
"(",
"destPathname",
")",
";",
"}"
] |
Get the destination pathname.
@param sourcePath The path to the source file
@return The path to place the destination file
|
[
"Get",
"the",
"destination",
"pathname",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/manual/convert/ConvertCode.java#L194-L227
|
153,058
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/manual/convert/ConvertCode.java
|
ConvertCode.getScanListener
|
public ScanListener getScanListener()
{
if (m_listener == null)
{
String strClassName = this.getProperty(LISTENER_CLASS);
if (strClassName == null)
strClassName = ReplaceScanListener.class.getName();
m_listener = (ScanListener)ClassServiceUtility.getClassService().makeObjectFromClassName(strClassName);
if (m_listener != null)
((BaseScanListener)m_listener).init(this, null);
else
System.exit(0);
}
return m_listener;
}
|
java
|
public ScanListener getScanListener()
{
if (m_listener == null)
{
String strClassName = this.getProperty(LISTENER_CLASS);
if (strClassName == null)
strClassName = ReplaceScanListener.class.getName();
m_listener = (ScanListener)ClassServiceUtility.getClassService().makeObjectFromClassName(strClassName);
if (m_listener != null)
((BaseScanListener)m_listener).init(this, null);
else
System.exit(0);
}
return m_listener;
}
|
[
"public",
"ScanListener",
"getScanListener",
"(",
")",
"{",
"if",
"(",
"m_listener",
"==",
"null",
")",
"{",
"String",
"strClassName",
"=",
"this",
".",
"getProperty",
"(",
"LISTENER_CLASS",
")",
";",
"if",
"(",
"strClassName",
"==",
"null",
")",
"strClassName",
"=",
"ReplaceScanListener",
".",
"class",
".",
"getName",
"(",
")",
";",
"m_listener",
"=",
"(",
"ScanListener",
")",
"ClassServiceUtility",
".",
"getClassService",
"(",
")",
".",
"makeObjectFromClassName",
"(",
"strClassName",
")",
";",
"if",
"(",
"m_listener",
"!=",
"null",
")",
"(",
"(",
"BaseScanListener",
")",
"m_listener",
")",
".",
"init",
"(",
"this",
",",
"null",
")",
";",
"else",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"return",
"m_listener",
";",
"}"
] |
Get the scan listener.
@returns listener
|
[
"Get",
"the",
"scan",
"listener",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/manual/convert/ConvertCode.java#L240-L254
|
153,059
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/manual/convert/ConvertCode.java
|
ConvertCode.getFullPath
|
public String getFullPath(String pathToFix)
{
String dirPrefix = this.getProperty(DIR_PREFIX);
if (dirPrefix == null)
dirPrefix = Utility.addToPath(System.getProperty("user.home"), "workspace/tourgeek/src/com/tourgeek");
if (pathToFix == null)
pathToFix = dirPrefix;
else
if ((!pathToFix.startsWith("/")) && (!pathToFix.startsWith(".")) && (!pathToFix.startsWith(File.separator)))
pathToFix = Utility.addToPath(dirPrefix, pathToFix);
return pathToFix;
}
|
java
|
public String getFullPath(String pathToFix)
{
String dirPrefix = this.getProperty(DIR_PREFIX);
if (dirPrefix == null)
dirPrefix = Utility.addToPath(System.getProperty("user.home"), "workspace/tourgeek/src/com/tourgeek");
if (pathToFix == null)
pathToFix = dirPrefix;
else
if ((!pathToFix.startsWith("/")) && (!pathToFix.startsWith(".")) && (!pathToFix.startsWith(File.separator)))
pathToFix = Utility.addToPath(dirPrefix, pathToFix);
return pathToFix;
}
|
[
"public",
"String",
"getFullPath",
"(",
"String",
"pathToFix",
")",
"{",
"String",
"dirPrefix",
"=",
"this",
".",
"getProperty",
"(",
"DIR_PREFIX",
")",
";",
"if",
"(",
"dirPrefix",
"==",
"null",
")",
"dirPrefix",
"=",
"Utility",
".",
"addToPath",
"(",
"System",
".",
"getProperty",
"(",
"\"user.home\"",
")",
",",
"\"workspace/tourgeek/src/com/tourgeek\"",
")",
";",
"if",
"(",
"pathToFix",
"==",
"null",
")",
"pathToFix",
"=",
"dirPrefix",
";",
"else",
"if",
"(",
"(",
"!",
"pathToFix",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"&&",
"(",
"!",
"pathToFix",
".",
"startsWith",
"(",
"\".\"",
")",
")",
"&&",
"(",
"!",
"pathToFix",
".",
"startsWith",
"(",
"File",
".",
"separator",
")",
")",
")",
"pathToFix",
"=",
"Utility",
".",
"addToPath",
"(",
"dirPrefix",
",",
"pathToFix",
")",
";",
"return",
"pathToFix",
";",
"}"
] |
Get the full path name.
@param pathToFix
@return
|
[
"Get",
"the",
"full",
"path",
"name",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/manual/convert/ConvertCode.java#L260-L271
|
153,060
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/zip/ZipExtensions.java
|
ZipExtensions.addFile
|
private static void addFile(final File file, final File dirToZip, final ZipOutputStream zos)
throws IOException
{
final String absolutePath = file.getAbsolutePath();
final int index = absolutePath.indexOf(dirToZip.getName());
final String zipEntryName = absolutePath.substring(index, absolutePath.length());
final byte[] b = new byte[(int)file.length()];
final ZipEntry cpZipEntry = new ZipEntry(zipEntryName);
zos.putNextEntry(cpZipEntry);
zos.write(b, 0, (int)file.length());
zos.closeEntry();
}
|
java
|
private static void addFile(final File file, final File dirToZip, final ZipOutputStream zos)
throws IOException
{
final String absolutePath = file.getAbsolutePath();
final int index = absolutePath.indexOf(dirToZip.getName());
final String zipEntryName = absolutePath.substring(index, absolutePath.length());
final byte[] b = new byte[(int)file.length()];
final ZipEntry cpZipEntry = new ZipEntry(zipEntryName);
zos.putNextEntry(cpZipEntry);
zos.write(b, 0, (int)file.length());
zos.closeEntry();
}
|
[
"private",
"static",
"void",
"addFile",
"(",
"final",
"File",
"file",
",",
"final",
"File",
"dirToZip",
",",
"final",
"ZipOutputStream",
"zos",
")",
"throws",
"IOException",
"{",
"final",
"String",
"absolutePath",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"final",
"int",
"index",
"=",
"absolutePath",
".",
"indexOf",
"(",
"dirToZip",
".",
"getName",
"(",
")",
")",
";",
"final",
"String",
"zipEntryName",
"=",
"absolutePath",
".",
"substring",
"(",
"index",
",",
"absolutePath",
".",
"length",
"(",
")",
")",
";",
"final",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"(",
"int",
")",
"file",
".",
"length",
"(",
")",
"]",
";",
"final",
"ZipEntry",
"cpZipEntry",
"=",
"new",
"ZipEntry",
"(",
"zipEntryName",
")",
";",
"zos",
".",
"putNextEntry",
"(",
"cpZipEntry",
")",
";",
"zos",
".",
"write",
"(",
"b",
",",
"0",
",",
"(",
"int",
")",
"file",
".",
"length",
"(",
")",
")",
";",
"zos",
".",
"closeEntry",
"(",
")",
";",
"}"
] |
Adds the file.
@param file
the file
@param dirToZip
the dir to zip
@param zos
the zos
@throws IOException
Signals that an I/O exception has occurred.
|
[
"Adds",
"the",
"file",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/zip/ZipExtensions.java#L69-L80
|
153,061
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/zip/ZipExtensions.java
|
ZipExtensions.isZip
|
public static boolean isZip(final String filename)
{
for (final String element : FileConst.ZIP_EXTENSIONS)
{
if (filename.endsWith(element))
{
return true;
}
}
return false;
}
|
java
|
public static boolean isZip(final String filename)
{
for (final String element : FileConst.ZIP_EXTENSIONS)
{
if (filename.endsWith(element))
{
return true;
}
}
return false;
}
|
[
"public",
"static",
"boolean",
"isZip",
"(",
"final",
"String",
"filename",
")",
"{",
"for",
"(",
"final",
"String",
"element",
":",
"FileConst",
".",
"ZIP_EXTENSIONS",
")",
"{",
"if",
"(",
"filename",
".",
"endsWith",
"(",
"element",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks if the given filename is a zip-file.
@param filename
The filename to check.
@return True if the filename is a zip-file otherwise false.
|
[
"Checks",
"if",
"the",
"given",
"filename",
"is",
"a",
"zip",
"-",
"file",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/zip/ZipExtensions.java#L124-L134
|
153,062
|
glookast/commons-timecode
|
src/main/java/com/glookast/commons/timecode/AbstractMutableTimecode.java
|
AbstractMutableTimecode.setTimecodeBase
|
public void setTimecodeBase(int timecodeBase)
{
if (timecodeBase < 0) {
timecodeBase = 0;
}
if (this.timecodeBase > 0 && timecodeBase != this.timecodeBase) {
this.frames = (int) Math.round((double) this.frames * timecodeBase / this.timecodeBase);
}
this.timecodeBase = timecodeBase;
innerSetDropFrame(this.dropFrame);
}
|
java
|
public void setTimecodeBase(int timecodeBase)
{
if (timecodeBase < 0) {
timecodeBase = 0;
}
if (this.timecodeBase > 0 && timecodeBase != this.timecodeBase) {
this.frames = (int) Math.round((double) this.frames * timecodeBase / this.timecodeBase);
}
this.timecodeBase = timecodeBase;
innerSetDropFrame(this.dropFrame);
}
|
[
"public",
"void",
"setTimecodeBase",
"(",
"int",
"timecodeBase",
")",
"{",
"if",
"(",
"timecodeBase",
"<",
"0",
")",
"{",
"timecodeBase",
"=",
"0",
";",
"}",
"if",
"(",
"this",
".",
"timecodeBase",
">",
"0",
"&&",
"timecodeBase",
"!=",
"this",
".",
"timecodeBase",
")",
"{",
"this",
".",
"frames",
"=",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"(",
"double",
")",
"this",
".",
"frames",
"*",
"timecodeBase",
"/",
"this",
".",
"timecodeBase",
")",
";",
"}",
"this",
".",
"timecodeBase",
"=",
"timecodeBase",
";",
"innerSetDropFrame",
"(",
"this",
".",
"dropFrame",
")",
";",
"}"
] |
Changes timecode base of the timecode
@param timecodeBase
|
[
"Changes",
"timecode",
"base",
"of",
"the",
"timecode"
] |
ec2f682a51d1cc435d0b42d80de48ff15adb4ee8
|
https://github.com/glookast/commons-timecode/blob/ec2f682a51d1cc435d0b42d80de48ff15adb4ee8/src/main/java/com/glookast/commons/timecode/AbstractMutableTimecode.java#L57-L69
|
153,063
|
glookast/commons-timecode
|
src/main/java/com/glookast/commons/timecode/AbstractMutableTimecode.java
|
AbstractMutableTimecode.setHMSF
|
public void setHMSF(int hours, int minutes, int seconds, int frames)
{
innerSetHMSF(hours, minutes, seconds, frames);
}
|
java
|
public void setHMSF(int hours, int minutes, int seconds, int frames)
{
innerSetHMSF(hours, minutes, seconds, frames);
}
|
[
"public",
"void",
"setHMSF",
"(",
"int",
"hours",
",",
"int",
"minutes",
",",
"int",
"seconds",
",",
"int",
"frames",
")",
"{",
"innerSetHMSF",
"(",
"hours",
",",
"minutes",
",",
"seconds",
",",
"frames",
")",
";",
"}"
] |
Sets the timecode to the provided hours, minutes, seconds and frames
@param hours
@param minutes
@param seconds
@param frames
|
[
"Sets",
"the",
"timecode",
"to",
"the",
"provided",
"hours",
"minutes",
"seconds",
"and",
"frames"
] |
ec2f682a51d1cc435d0b42d80de48ff15adb4ee8
|
https://github.com/glookast/commons-timecode/blob/ec2f682a51d1cc435d0b42d80de48ff15adb4ee8/src/main/java/com/glookast/commons/timecode/AbstractMutableTimecode.java#L98-L101
|
153,064
|
jbundle/jbundle
|
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TableProxy.java
|
TableProxy.open
|
public void open(String strKeyArea, int iOpenMode, boolean bDirection, String strFields, Object objInitialKey, Object objEndKey, byte[] byBehaviorData) throws DBException, RemoteException
{
BaseTransport transport = this.createProxyTransport(OPEN);
transport.addParam(KEY, strKeyArea);
transport.addParam(OPEN_MODE, iOpenMode);
transport.addParam(DIRECTION, bDirection);
transport.addParam(FIELDS, strFields);
transport.addParam(INITIAL_KEY, objInitialKey);
transport.addParam(END_KEY, objEndKey);
transport.addParam(BEHAVIOR_DATA, byBehaviorData);
Object strReturn = transport.sendMessageAndGetReply();
Object objReturn = transport.convertReturnObject(strReturn);
this.checkDBException(objReturn);
}
|
java
|
public void open(String strKeyArea, int iOpenMode, boolean bDirection, String strFields, Object objInitialKey, Object objEndKey, byte[] byBehaviorData) throws DBException, RemoteException
{
BaseTransport transport = this.createProxyTransport(OPEN);
transport.addParam(KEY, strKeyArea);
transport.addParam(OPEN_MODE, iOpenMode);
transport.addParam(DIRECTION, bDirection);
transport.addParam(FIELDS, strFields);
transport.addParam(INITIAL_KEY, objInitialKey);
transport.addParam(END_KEY, objEndKey);
transport.addParam(BEHAVIOR_DATA, byBehaviorData);
Object strReturn = transport.sendMessageAndGetReply();
Object objReturn = transport.convertReturnObject(strReturn);
this.checkDBException(objReturn);
}
|
[
"public",
"void",
"open",
"(",
"String",
"strKeyArea",
",",
"int",
"iOpenMode",
",",
"boolean",
"bDirection",
",",
"String",
"strFields",
",",
"Object",
"objInitialKey",
",",
"Object",
"objEndKey",
",",
"byte",
"[",
"]",
"byBehaviorData",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"BaseTransport",
"transport",
"=",
"this",
".",
"createProxyTransport",
"(",
"OPEN",
")",
";",
"transport",
".",
"addParam",
"(",
"KEY",
",",
"strKeyArea",
")",
";",
"transport",
".",
"addParam",
"(",
"OPEN_MODE",
",",
"iOpenMode",
")",
";",
"transport",
".",
"addParam",
"(",
"DIRECTION",
",",
"bDirection",
")",
";",
"transport",
".",
"addParam",
"(",
"FIELDS",
",",
"strFields",
")",
";",
"transport",
".",
"addParam",
"(",
"INITIAL_KEY",
",",
"objInitialKey",
")",
";",
"transport",
".",
"addParam",
"(",
"END_KEY",
",",
"objEndKey",
")",
";",
"transport",
".",
"addParam",
"(",
"BEHAVIOR_DATA",
",",
"byBehaviorData",
")",
";",
"Object",
"strReturn",
"=",
"transport",
".",
"sendMessageAndGetReply",
"(",
")",
";",
"Object",
"objReturn",
"=",
"transport",
".",
"convertReturnObject",
"(",
"strReturn",
")",
";",
"this",
".",
"checkDBException",
"(",
"objReturn",
")",
";",
"}"
] |
Open - Receive to this server and send the response.
@exception Exception File exception.
|
[
"Open",
"-",
"Receive",
"to",
"this",
"server",
"and",
"send",
"the",
"response",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TableProxy.java#L64-L77
|
153,065
|
jbundle/jbundle
|
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TableProxy.java
|
TableProxy.makeFieldList
|
public org.jbundle.thin.base.db.FieldList makeFieldList(String strFieldsToInclude) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(MAKE_FIELD_LIST);
transport.addParam(FIELDS, strFieldsToInclude);
Object strReturn = transport.sendMessageAndGetReply();
Object objReturn = transport.convertReturnObject(strReturn);
return (org.jbundle.thin.base.db.FieldList)objReturn;
}
|
java
|
public org.jbundle.thin.base.db.FieldList makeFieldList(String strFieldsToInclude) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(MAKE_FIELD_LIST);
transport.addParam(FIELDS, strFieldsToInclude);
Object strReturn = transport.sendMessageAndGetReply();
Object objReturn = transport.convertReturnObject(strReturn);
return (org.jbundle.thin.base.db.FieldList)objReturn;
}
|
[
"public",
"org",
".",
"jbundle",
".",
"thin",
".",
"base",
".",
"db",
".",
"FieldList",
"makeFieldList",
"(",
"String",
"strFieldsToInclude",
")",
"throws",
"RemoteException",
"{",
"BaseTransport",
"transport",
"=",
"this",
".",
"createProxyTransport",
"(",
"MAKE_FIELD_LIST",
")",
";",
"transport",
".",
"addParam",
"(",
"FIELDS",
",",
"strFieldsToInclude",
")",
";",
"Object",
"strReturn",
"=",
"transport",
".",
"sendMessageAndGetReply",
"(",
")",
";",
"Object",
"objReturn",
"=",
"transport",
".",
"convertReturnObject",
"(",
"strReturn",
")",
";",
"return",
"(",
"org",
".",
"jbundle",
".",
"thin",
".",
"base",
".",
"db",
".",
"FieldList",
")",
"objReturn",
";",
"}"
] |
Make a thin FieldList for this table.
Usually used for special queries that don't have a field list available.
@return The new serialized fieldlist.
|
[
"Make",
"a",
"thin",
"FieldList",
"for",
"this",
"table",
".",
"Usually",
"used",
"for",
"special",
"queries",
"that",
"don",
"t",
"have",
"a",
"field",
"list",
"available",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TableProxy.java#L254-L261
|
153,066
|
krotscheck/data-file-reader
|
data-file-reader-json/src/main/java/net/krotscheck/dfr/json/JSONDataEncoder.java
|
JSONDataEncoder.dispose
|
@Override
public void dispose() {
try {
if (generator != null) {
generator.writeEndArray();
generator.close();
}
this.getWriter().close();
} catch (IOException ioe) {
logger.error("Unable to close writer", ioe);
logger.trace(ioe.getMessage(), ioe);
} finally {
generator = null;
this.setWriter(null);
}
}
|
java
|
@Override
public void dispose() {
try {
if (generator != null) {
generator.writeEndArray();
generator.close();
}
this.getWriter().close();
} catch (IOException ioe) {
logger.error("Unable to close writer", ioe);
logger.trace(ioe.getMessage(), ioe);
} finally {
generator = null;
this.setWriter(null);
}
}
|
[
"@",
"Override",
"public",
"void",
"dispose",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"generator",
"!=",
"null",
")",
"{",
"generator",
".",
"writeEndArray",
"(",
")",
";",
"generator",
".",
"close",
"(",
")",
";",
"}",
"this",
".",
"getWriter",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"logger",
".",
"error",
"(",
"\"Unable to close writer\"",
",",
"ioe",
")",
";",
"logger",
".",
"trace",
"(",
"ioe",
".",
"getMessage",
"(",
")",
",",
"ioe",
")",
";",
"}",
"finally",
"{",
"generator",
"=",
"null",
";",
"this",
".",
"setWriter",
"(",
"null",
")",
";",
"}",
"}"
] |
Closes the output writer.
|
[
"Closes",
"the",
"output",
"writer",
"."
] |
b9a85bd07dc9f9b8291ffbfb6945443d96371811
|
https://github.com/krotscheck/data-file-reader/blob/b9a85bd07dc9f9b8291ffbfb6945443d96371811/data-file-reader-json/src/main/java/net/krotscheck/dfr/json/JSONDataEncoder.java#L69-L84
|
153,067
|
Joe0/Feather
|
src/main/java/com/joepritzel/feather/strategy/publish/Sequential.java
|
Sequential.consideringHierarchy
|
private boolean consideringHierarchy(Publish p) {
boolean sent = false;
for (Entry<Class<?>, List<SubscriberParent>> e : p.mapping.entrySet()) {
if (e.getKey().isAssignableFrom(p.message.getClass())) {
for (SubscriberParent parent : e.getValue()) {
if (!predicateApplies(parent.getSubscriber(), p.message)) {
continue;
}
parent.getSubscriber().receiveO(p.message);
sent = true;
}
}
}
return sent;
}
|
java
|
private boolean consideringHierarchy(Publish p) {
boolean sent = false;
for (Entry<Class<?>, List<SubscriberParent>> e : p.mapping.entrySet()) {
if (e.getKey().isAssignableFrom(p.message.getClass())) {
for (SubscriberParent parent : e.getValue()) {
if (!predicateApplies(parent.getSubscriber(), p.message)) {
continue;
}
parent.getSubscriber().receiveO(p.message);
sent = true;
}
}
}
return sent;
}
|
[
"private",
"boolean",
"consideringHierarchy",
"(",
"Publish",
"p",
")",
"{",
"boolean",
"sent",
"=",
"false",
";",
"for",
"(",
"Entry",
"<",
"Class",
"<",
"?",
">",
",",
"List",
"<",
"SubscriberParent",
">",
">",
"e",
":",
"p",
".",
"mapping",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"e",
".",
"getKey",
"(",
")",
".",
"isAssignableFrom",
"(",
"p",
".",
"message",
".",
"getClass",
"(",
")",
")",
")",
"{",
"for",
"(",
"SubscriberParent",
"parent",
":",
"e",
".",
"getValue",
"(",
")",
")",
"{",
"if",
"(",
"!",
"predicateApplies",
"(",
"parent",
".",
"getSubscriber",
"(",
")",
",",
"p",
".",
"message",
")",
")",
"{",
"continue",
";",
"}",
"parent",
".",
"getSubscriber",
"(",
")",
".",
"receiveO",
"(",
"p",
".",
"message",
")",
";",
"sent",
"=",
"true",
";",
"}",
"}",
"}",
"return",
"sent",
";",
"}"
] |
Iterates through the subscribers, considering the type hierarchy, and
invokes the receiveO method.
@param p
- The publish object.
@return If a message was published to at least one subscriber, then it
will return true. Otherwise, false.
|
[
"Iterates",
"through",
"the",
"subscribers",
"considering",
"the",
"type",
"hierarchy",
"and",
"invokes",
"the",
"receiveO",
"method",
"."
] |
d17b1bc38326b8b86f1068898a59c8a34678d499
|
https://github.com/Joe0/Feather/blob/d17b1bc38326b8b86f1068898a59c8a34678d499/src/main/java/com/joepritzel/feather/strategy/publish/Sequential.java#L58-L72
|
153,068
|
Joe0/Feather
|
src/main/java/com/joepritzel/feather/strategy/publish/Sequential.java
|
Sequential.normal
|
private boolean normal(Publish p) {
boolean sent = false;
List<SubscriberParent> list = p.mapping.get(p.message.getClass());
if (list == null) {
return false;
}
for (SubscriberParent sp : list) {
Subscriber<?> s = sp.getSubscriber();
if (!predicateApplies(s, p.message)) {
continue;
}
s.receiveO(p.message);
sent = true;
}
return sent;
}
|
java
|
private boolean normal(Publish p) {
boolean sent = false;
List<SubscriberParent> list = p.mapping.get(p.message.getClass());
if (list == null) {
return false;
}
for (SubscriberParent sp : list) {
Subscriber<?> s = sp.getSubscriber();
if (!predicateApplies(s, p.message)) {
continue;
}
s.receiveO(p.message);
sent = true;
}
return sent;
}
|
[
"private",
"boolean",
"normal",
"(",
"Publish",
"p",
")",
"{",
"boolean",
"sent",
"=",
"false",
";",
"List",
"<",
"SubscriberParent",
">",
"list",
"=",
"p",
".",
"mapping",
".",
"get",
"(",
"p",
".",
"message",
".",
"getClass",
"(",
")",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"SubscriberParent",
"sp",
":",
"list",
")",
"{",
"Subscriber",
"<",
"?",
">",
"s",
"=",
"sp",
".",
"getSubscriber",
"(",
")",
";",
"if",
"(",
"!",
"predicateApplies",
"(",
"s",
",",
"p",
".",
"message",
")",
")",
"{",
"continue",
";",
"}",
"s",
".",
"receiveO",
"(",
"p",
".",
"message",
")",
";",
"sent",
"=",
"true",
";",
"}",
"return",
"sent",
";",
"}"
] |
Iterates through the subscribers invoking the receiveO method.
@param p
- The publish object.
@return If a message was published to at least one subscriber, then it
will return true. Otherwise, false.
|
[
"Iterates",
"through",
"the",
"subscribers",
"invoking",
"the",
"receiveO",
"method",
"."
] |
d17b1bc38326b8b86f1068898a59c8a34678d499
|
https://github.com/Joe0/Feather/blob/d17b1bc38326b8b86f1068898a59c8a34678d499/src/main/java/com/joepritzel/feather/strategy/publish/Sequential.java#L82-L97
|
153,069
|
Joe0/Feather
|
src/main/java/com/joepritzel/feather/strategy/publish/Sequential.java
|
Sequential.predicateApplies
|
private boolean predicateApplies(Subscriber<?> s, Object message) {
if (s instanceof PredicatedSubscriber
&& !((PredicatedSubscriber<?>) s).appliesO(message)) {
return false;
}
return true;
}
|
java
|
private boolean predicateApplies(Subscriber<?> s, Object message) {
if (s instanceof PredicatedSubscriber
&& !((PredicatedSubscriber<?>) s).appliesO(message)) {
return false;
}
return true;
}
|
[
"private",
"boolean",
"predicateApplies",
"(",
"Subscriber",
"<",
"?",
">",
"s",
",",
"Object",
"message",
")",
"{",
"if",
"(",
"s",
"instanceof",
"PredicatedSubscriber",
"&&",
"!",
"(",
"(",
"PredicatedSubscriber",
"<",
"?",
">",
")",
"s",
")",
".",
"appliesO",
"(",
"message",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Checks to see if the subscriber is a predicated subscriber, and if it
applies.
@param s
- The subscriber to check.
@param message
- The message to check.
@return If the subscriber is not predicated or it is and applies, then it
returns true. If it's a predicated subscriber, and it doesn't
apply, then it returns false.
|
[
"Checks",
"to",
"see",
"if",
"the",
"subscriber",
"is",
"a",
"predicated",
"subscriber",
"and",
"if",
"it",
"applies",
"."
] |
d17b1bc38326b8b86f1068898a59c8a34678d499
|
https://github.com/Joe0/Feather/blob/d17b1bc38326b8b86f1068898a59c8a34678d499/src/main/java/com/joepritzel/feather/strategy/publish/Sequential.java#L111-L117
|
153,070
|
jbundle/jbundle
|
base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java
|
NameValue.isEmpty
|
public boolean isEmpty()
{
if (m_filter != null)
return false; // Not empty
if (m_mapNameValue != null)
if (m_mapNameValue.size() != 0)
return false; // Not empty;
return true;
}
|
java
|
public boolean isEmpty()
{
if (m_filter != null)
return false; // Not empty
if (m_mapNameValue != null)
if (m_mapNameValue.size() != 0)
return false; // Not empty;
return true;
}
|
[
"public",
"boolean",
"isEmpty",
"(",
")",
"{",
"if",
"(",
"m_filter",
"!=",
"null",
")",
"return",
"false",
";",
"// Not empty",
"if",
"(",
"m_mapNameValue",
"!=",
"null",
")",
"if",
"(",
"m_mapNameValue",
".",
"size",
"(",
")",
"!=",
"0",
")",
"return",
"false",
";",
"// Not empty;",
"return",
"true",
";",
"}"
] |
Is this node empty.
@return true if it is empty.
|
[
"Is",
"this",
"node",
"empty",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java#L94-L102
|
153,071
|
jbundle/jbundle
|
base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java
|
NameValue.getValueMap
|
public Map<String,NameValue> getValueMap(boolean bAddIfNotFound)
{
if (m_mapNameValue == null)
if (bAddIfNotFound)
m_mapNameValue = new Hashtable<String,NameValue>();
return m_mapNameValue;
}
|
java
|
public Map<String,NameValue> getValueMap(boolean bAddIfNotFound)
{
if (m_mapNameValue == null)
if (bAddIfNotFound)
m_mapNameValue = new Hashtable<String,NameValue>();
return m_mapNameValue;
}
|
[
"public",
"Map",
"<",
"String",
",",
"NameValue",
">",
"getValueMap",
"(",
"boolean",
"bAddIfNotFound",
")",
"{",
"if",
"(",
"m_mapNameValue",
"==",
"null",
")",
"if",
"(",
"bAddIfNotFound",
")",
"m_mapNameValue",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"NameValue",
">",
"(",
")",
";",
"return",
"m_mapNameValue",
";",
"}"
] |
Get the next Lower nodes.
@param bAddIfNotFound If true, set up a new value map if not set up yet.
@return The value map.
|
[
"Get",
"the",
"next",
"Lower",
"nodes",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java#L154-L160
|
153,072
|
jbundle/jbundle
|
base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java
|
NameValue.removeNameValueNode
|
public boolean removeNameValueNode(NameValue node)
{
Map<String,NameValue> map = this.getValueMap(false);
if (map == null)
return false; // Error
return (map.remove(node.getKey()) == node);
}
|
java
|
public boolean removeNameValueNode(NameValue node)
{
Map<String,NameValue> map = this.getValueMap(false);
if (map == null)
return false; // Error
return (map.remove(node.getKey()) == node);
}
|
[
"public",
"boolean",
"removeNameValueNode",
"(",
"NameValue",
"node",
")",
"{",
"Map",
"<",
"String",
",",
"NameValue",
">",
"map",
"=",
"this",
".",
"getValueMap",
"(",
"false",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"return",
"false",
";",
"// Error",
"return",
"(",
"map",
".",
"remove",
"(",
"node",
".",
"getKey",
"(",
")",
")",
"==",
"node",
")",
";",
"}"
] |
Add this node to my value map.
@param node The node to add.
|
[
"Add",
"this",
"node",
"to",
"my",
"value",
"map",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java#L173-L179
|
153,073
|
jbundle/jbundle
|
base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java
|
NameValue.addThisMessageFilter
|
public void addThisMessageFilter(BaseMessageFilter filter)
{
if (m_filter == null)
m_filter = filter;
else
{
if (m_filter instanceof BaseMessageFilter)
{
BaseMessageFilter filterFirst = (BaseMessageFilter)m_filter;
m_filter = new Hashtable<String,Object>();
((Map)m_filter).put(filterFirst.getFilterID(), filterFirst);
}
((Map)m_filter).put(filter.getFilterID(), filter);
}
}
|
java
|
public void addThisMessageFilter(BaseMessageFilter filter)
{
if (m_filter == null)
m_filter = filter;
else
{
if (m_filter instanceof BaseMessageFilter)
{
BaseMessageFilter filterFirst = (BaseMessageFilter)m_filter;
m_filter = new Hashtable<String,Object>();
((Map)m_filter).put(filterFirst.getFilterID(), filterFirst);
}
((Map)m_filter).put(filter.getFilterID(), filter);
}
}
|
[
"public",
"void",
"addThisMessageFilter",
"(",
"BaseMessageFilter",
"filter",
")",
"{",
"if",
"(",
"m_filter",
"==",
"null",
")",
"m_filter",
"=",
"filter",
";",
"else",
"{",
"if",
"(",
"m_filter",
"instanceof",
"BaseMessageFilter",
")",
"{",
"BaseMessageFilter",
"filterFirst",
"=",
"(",
"BaseMessageFilter",
")",
"m_filter",
";",
"m_filter",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"(",
"(",
"Map",
")",
"m_filter",
")",
".",
"put",
"(",
"filterFirst",
".",
"getFilterID",
"(",
")",
",",
"filterFirst",
")",
";",
"}",
"(",
"(",
"Map",
")",
"m_filter",
")",
".",
"put",
"(",
"filter",
".",
"getFilterID",
"(",
")",
",",
"filter",
")",
";",
"}",
"}"
] |
Set the owner of this value.
|
[
"Set",
"the",
"owner",
"of",
"this",
"value",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java#L200-L214
|
153,074
|
jbundle/jbundle
|
base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java
|
NameValue.removeThisMessageFilter
|
public boolean removeThisMessageFilter(BaseMessageFilter filter)
{
if (m_filter instanceof BaseMessageFilter)
{
if (m_filter != filter) // Should be this one.
return false; // Error
m_filter = null;
return true; // Success
}
else
return (((Map)m_filter).remove(filter.getFilterID()) != null);
}
|
java
|
public boolean removeThisMessageFilter(BaseMessageFilter filter)
{
if (m_filter instanceof BaseMessageFilter)
{
if (m_filter != filter) // Should be this one.
return false; // Error
m_filter = null;
return true; // Success
}
else
return (((Map)m_filter).remove(filter.getFilterID()) != null);
}
|
[
"public",
"boolean",
"removeThisMessageFilter",
"(",
"BaseMessageFilter",
"filter",
")",
"{",
"if",
"(",
"m_filter",
"instanceof",
"BaseMessageFilter",
")",
"{",
"if",
"(",
"m_filter",
"!=",
"filter",
")",
"// Should be this one.",
"return",
"false",
";",
"// Error",
"m_filter",
"=",
"null",
";",
"return",
"true",
";",
"// Success",
"}",
"else",
"return",
"(",
"(",
"(",
"Map",
")",
"m_filter",
")",
".",
"remove",
"(",
"filter",
".",
"getFilterID",
"(",
")",
")",
"!=",
"null",
")",
";",
"}"
] |
Remove this filter from the filter list.
@param filter The filter to remove.
|
[
"Remove",
"this",
"filter",
"from",
"the",
"filter",
"list",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java#L219-L230
|
153,075
|
jbundle/jbundle
|
base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java
|
NameValue.getFilterIterator
|
public Iterator getFilterIterator()
{
if (m_filter instanceof Map)
return ((Map)m_filter).values().iterator();
else if (m_filter != null)
return new OneFilterIterator();
else
return null; // Okay
}
|
java
|
public Iterator getFilterIterator()
{
if (m_filter instanceof Map)
return ((Map)m_filter).values().iterator();
else if (m_filter != null)
return new OneFilterIterator();
else
return null; // Okay
}
|
[
"public",
"Iterator",
"getFilterIterator",
"(",
")",
"{",
"if",
"(",
"m_filter",
"instanceof",
"Map",
")",
"return",
"(",
"(",
"Map",
")",
"m_filter",
")",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"else",
"if",
"(",
"m_filter",
"!=",
"null",
")",
"return",
"new",
"OneFilterIterator",
"(",
")",
";",
"else",
"return",
"null",
";",
"// Okay",
"}"
] |
Get the list of filters for this leaf node.
|
[
"Get",
"the",
"list",
"of",
"filters",
"for",
"this",
"leaf",
"node",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java#L234-L242
|
153,076
|
inkstand-io/scribble
|
scribble-net/src/main/java/io/inkstand/scribble/net/ResourceAvailabilityMatcher.java
|
ResourceAvailabilityMatcher.isAvailable
|
protected boolean isAvailable(URL url) {
try (InputStream inputStream = url.openStream()) {
return true;
} catch (IOException e) { //NOSONAR
LOG.debug("URL {} not available", url, e);
return false;
}
}
|
java
|
protected boolean isAvailable(URL url) {
try (InputStream inputStream = url.openStream()) {
return true;
} catch (IOException e) { //NOSONAR
LOG.debug("URL {} not available", url, e);
return false;
}
}
|
[
"protected",
"boolean",
"isAvailable",
"(",
"URL",
"url",
")",
"{",
"try",
"(",
"InputStream",
"inputStream",
"=",
"url",
".",
"openStream",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"//NOSONAR",
"LOG",
".",
"debug",
"(",
"\"URL {} not available\"",
",",
"url",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Checks the availability of a URL by openening a reading stream on it.
@param url
the url to check
@return <code>true</code> if the URL can be read
|
[
"Checks",
"the",
"availability",
"of",
"a",
"URL",
"by",
"openening",
"a",
"reading",
"stream",
"on",
"it",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-net/src/main/java/io/inkstand/scribble/net/ResourceAvailabilityMatcher.java#L92-L100
|
153,077
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/navi/SimpleStats.java
|
SimpleStats.add
|
public void add(double value)
{
max = Math.max(max, value);
min = Math.min(min, value);
if (count == 0)
{
average = value;
}
else
{
average = count*average/(count+1) + value/(count+1);
deviationSquare = count*deviationSquare/(count+1) + Math.pow(value-average, 2)/(count+1);
}
count++;
}
|
java
|
public void add(double value)
{
max = Math.max(max, value);
min = Math.min(min, value);
if (count == 0)
{
average = value;
}
else
{
average = count*average/(count+1) + value/(count+1);
deviationSquare = count*deviationSquare/(count+1) + Math.pow(value-average, 2)/(count+1);
}
count++;
}
|
[
"public",
"void",
"add",
"(",
"double",
"value",
")",
"{",
"max",
"=",
"Math",
".",
"max",
"(",
"max",
",",
"value",
")",
";",
"min",
"=",
"Math",
".",
"min",
"(",
"min",
",",
"value",
")",
";",
"if",
"(",
"count",
"==",
"0",
")",
"{",
"average",
"=",
"value",
";",
"}",
"else",
"{",
"average",
"=",
"count",
"*",
"average",
"/",
"(",
"count",
"+",
"1",
")",
"+",
"value",
"/",
"(",
"count",
"+",
"1",
")",
";",
"deviationSquare",
"=",
"count",
"*",
"deviationSquare",
"/",
"(",
"count",
"+",
"1",
")",
"+",
"Math",
".",
"pow",
"(",
"value",
"-",
"average",
",",
"2",
")",
"/",
"(",
"count",
"+",
"1",
")",
";",
"}",
"count",
"++",
";",
"}"
] |
Add a new value.
@param value
|
[
"Add",
"a",
"new",
"value",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/SimpleStats.java#L109-L123
|
153,078
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/navi/SimpleStats.java
|
SimpleStats.clear
|
public void clear()
{
count = 0;
average = 0;
max = Double.MIN_VALUE;
min = Double.MAX_VALUE;
deviationSquare = 0;
}
|
java
|
public void clear()
{
count = 0;
average = 0;
max = Double.MIN_VALUE;
min = Double.MAX_VALUE;
deviationSquare = 0;
}
|
[
"public",
"void",
"clear",
"(",
")",
"{",
"count",
"=",
"0",
";",
"average",
"=",
"0",
";",
"max",
"=",
"Double",
".",
"MIN_VALUE",
";",
"min",
"=",
"Double",
".",
"MAX_VALUE",
";",
"deviationSquare",
"=",
"0",
";",
"}"
] |
Clears the added values.
|
[
"Clears",
"the",
"added",
"values",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/SimpleStats.java#L167-L174
|
153,079
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/sel/ChannelSelector.java
|
ChannelSelector.select
|
public int select(long timeout) throws IOException
{
fine("select("+timeout+")");
lock.lock();
try
{
ensureAllRunning();
try
{
SelKey sk = queue.poll(timeout, TimeUnit.MILLISECONDS);
if (sk != null)
{
selectedKeys.add(sk);
queue.drainTo(selectedKeys);
selectedKeys.remove(WAKEUP_KEY);
return selectedKeys.size();
}
else
{
fine("select() timeout");
return 0;
}
}
catch (InterruptedException ex)
{
fine("select() interrupted");
return 0;
}
}
finally
{
lock.unlock();
}
}
|
java
|
public int select(long timeout) throws IOException
{
fine("select("+timeout+")");
lock.lock();
try
{
ensureAllRunning();
try
{
SelKey sk = queue.poll(timeout, TimeUnit.MILLISECONDS);
if (sk != null)
{
selectedKeys.add(sk);
queue.drainTo(selectedKeys);
selectedKeys.remove(WAKEUP_KEY);
return selectedKeys.size();
}
else
{
fine("select() timeout");
return 0;
}
}
catch (InterruptedException ex)
{
fine("select() interrupted");
return 0;
}
}
finally
{
lock.unlock();
}
}
|
[
"public",
"int",
"select",
"(",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"fine",
"(",
"\"select(\"",
"+",
"timeout",
"+",
"\")\"",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"ensureAllRunning",
"(",
")",
";",
"try",
"{",
"SelKey",
"sk",
"=",
"queue",
".",
"poll",
"(",
"timeout",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"if",
"(",
"sk",
"!=",
"null",
")",
"{",
"selectedKeys",
".",
"add",
"(",
"sk",
")",
";",
"queue",
".",
"drainTo",
"(",
"selectedKeys",
")",
";",
"selectedKeys",
".",
"remove",
"(",
"WAKEUP_KEY",
")",
";",
"return",
"selectedKeys",
".",
"size",
"(",
")",
";",
"}",
"else",
"{",
"fine",
"(",
"\"select() timeout\"",
")",
";",
"return",
"0",
";",
"}",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"fine",
"(",
"\"select() interrupted\"",
")",
";",
"return",
"0",
";",
"}",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Selects and waits .
@param timeout Milliseconds.
@return
@throws IOException
|
[
"Selects",
"and",
"waits",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/sel/ChannelSelector.java#L194-L227
|
153,080
|
marssa/footprint
|
src/main/java/org/marssa/footprint/datatypes/decimal/speed/ASpeed.java
|
ASpeed.getMPH
|
public MDecimal getMPH() {
MDecimal result = new MDecimal(currentUnit.getConverterTo(
MILES_PER_HOUR).convert(doubleValue()));
logger.trace(MMarker.GETTER, "Converting from {} to MPS : {}",
currentUnit, result);
return result;
}
|
java
|
public MDecimal getMPH() {
MDecimal result = new MDecimal(currentUnit.getConverterTo(
MILES_PER_HOUR).convert(doubleValue()));
logger.trace(MMarker.GETTER, "Converting from {} to MPS : {}",
currentUnit, result);
return result;
}
|
[
"public",
"MDecimal",
"getMPH",
"(",
")",
"{",
"MDecimal",
"result",
"=",
"new",
"MDecimal",
"(",
"currentUnit",
".",
"getConverterTo",
"(",
"MILES_PER_HOUR",
")",
".",
"convert",
"(",
"doubleValue",
"(",
")",
")",
")",
";",
"logger",
".",
"trace",
"(",
"MMarker",
".",
"GETTER",
",",
"\"Converting from {} to MPS : {}\"",
",",
"currentUnit",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Miles per hour
@return
@see javax.measure.unit.NonSI.MILES_PER_HOUR
|
[
"Miles",
"per",
"hour"
] |
2ca953c14f46adc320927c87c5ce1c36eb6c82de
|
https://github.com/marssa/footprint/blob/2ca953c14f46adc320927c87c5ce1c36eb6c82de/src/main/java/org/marssa/footprint/datatypes/decimal/speed/ASpeed.java#L109-L115
|
153,081
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.restoreFieldParam
|
public static void restoreFieldParam(PropertyOwner propertyOwner, Field field)
{
String strFieldName = field.getFieldName();
if (propertyOwner.getProperty(strFieldName) != null)
field.setString((String)propertyOwner.getProperty(strFieldName));
}
|
java
|
public static void restoreFieldParam(PropertyOwner propertyOwner, Field field)
{
String strFieldName = field.getFieldName();
if (propertyOwner.getProperty(strFieldName) != null)
field.setString((String)propertyOwner.getProperty(strFieldName));
}
|
[
"public",
"static",
"void",
"restoreFieldParam",
"(",
"PropertyOwner",
"propertyOwner",
",",
"Field",
"field",
")",
"{",
"String",
"strFieldName",
"=",
"field",
".",
"getFieldName",
"(",
")",
";",
"if",
"(",
"propertyOwner",
".",
"getProperty",
"(",
"strFieldName",
")",
"!=",
"null",
")",
"field",
".",
"setString",
"(",
"(",
"String",
")",
"propertyOwner",
".",
"getProperty",
"(",
"strFieldName",
")",
")",
";",
"}"
] |
RestoreProductParam Method.
|
[
"RestoreProductParam",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L78-L83
|
153,082
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.propertiesToURL
|
public static String propertiesToURL(String strURL, Map<String,Object> properties)
{
if (properties != null)
{
for (String strKey : properties.keySet())
{
Object strValue = properties.get(strKey);
strURL = Utility.addURLParam(strURL, strKey.toString(), strValue.toString());
}
}
return strURL;
}
|
java
|
public static String propertiesToURL(String strURL, Map<String,Object> properties)
{
if (properties != null)
{
for (String strKey : properties.keySet())
{
Object strValue = properties.get(strKey);
strURL = Utility.addURLParam(strURL, strKey.toString(), strValue.toString());
}
}
return strURL;
}
|
[
"public",
"static",
"String",
"propertiesToURL",
"(",
"String",
"strURL",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"strKey",
":",
"properties",
".",
"keySet",
"(",
")",
")",
"{",
"Object",
"strValue",
"=",
"properties",
".",
"get",
"(",
"strKey",
")",
";",
"strURL",
"=",
"Utility",
".",
"addURLParam",
"(",
"strURL",
",",
"strKey",
".",
"toString",
"(",
")",
",",
"strValue",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"return",
"strURL",
";",
"}"
] |
Add to this URL using all the properties in this property list.
@param strURL The original URL string.
@param properties The properties to add (key/value pairs).
@return The new URL string.
|
[
"Add",
"to",
"this",
"URL",
"using",
"all",
"the",
"properties",
"in",
"this",
"property",
"list",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L90-L101
|
153,083
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.propertiesToArgs
|
public static String[] propertiesToArgs(Map<String,Object> properties)
{
if (properties == null)
return null;
String[] rgArgs = new String[properties.size()];
int i = 0;
for (String strKey : properties.keySet())
{
Object strValue = properties.get(strKey);
rgArgs[i++] = strKey.toString() + '=' + strValue.toString();
}
return rgArgs;
}
|
java
|
public static String[] propertiesToArgs(Map<String,Object> properties)
{
if (properties == null)
return null;
String[] rgArgs = new String[properties.size()];
int i = 0;
for (String strKey : properties.keySet())
{
Object strValue = properties.get(strKey);
rgArgs[i++] = strKey.toString() + '=' + strValue.toString();
}
return rgArgs;
}
|
[
"public",
"static",
"String",
"[",
"]",
"propertiesToArgs",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"return",
"null",
";",
"String",
"[",
"]",
"rgArgs",
"=",
"new",
"String",
"[",
"properties",
".",
"size",
"(",
")",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"String",
"strKey",
":",
"properties",
".",
"keySet",
"(",
")",
")",
"{",
"Object",
"strValue",
"=",
"properties",
".",
"get",
"(",
"strKey",
")",
";",
"rgArgs",
"[",
"i",
"++",
"]",
"=",
"strKey",
".",
"toString",
"(",
")",
"+",
"'",
"'",
"+",
"strValue",
".",
"toString",
"(",
")",
";",
"}",
"return",
"rgArgs",
";",
"}"
] |
Create an argument list using all the properties in this property list.
@param properties The properties to convert.
@return A string array with entries of key=value.
|
[
"Create",
"an",
"argument",
"list",
"using",
"all",
"the",
"properties",
"in",
"this",
"property",
"list",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L107-L119
|
153,084
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.getStringInputStream
|
public static InputStream getStringInputStream(String string)
{
InputStream is = null;
try {
ByteArrayOutputStream ba = new ByteArrayOutputStream();
DataOutputStream os = new DataOutputStream(ba);
os.writeUTF(string);
os.flush();
is = new ByteArrayInputStream(ba.toByteArray());
} catch (IOException ex) {
ex.printStackTrace();
}
return is;
}
|
java
|
public static InputStream getStringInputStream(String string)
{
InputStream is = null;
try {
ByteArrayOutputStream ba = new ByteArrayOutputStream();
DataOutputStream os = new DataOutputStream(ba);
os.writeUTF(string);
os.flush();
is = new ByteArrayInputStream(ba.toByteArray());
} catch (IOException ex) {
ex.printStackTrace();
}
return is;
}
|
[
"public",
"static",
"InputStream",
"getStringInputStream",
"(",
"String",
"string",
")",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"ByteArrayOutputStream",
"ba",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"DataOutputStream",
"os",
"=",
"new",
"DataOutputStream",
"(",
"ba",
")",
";",
"os",
".",
"writeUTF",
"(",
"string",
")",
";",
"os",
".",
"flush",
"(",
")",
";",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"ba",
".",
"toByteArray",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"is",
";",
"}"
] |
A utility method to get an UTF-8 Input stream from a string.
@param string The string to be converted to an InputStream.
@return The input stream.
|
[
"A",
"utility",
"method",
"to",
"get",
"an",
"UTF",
"-",
"8",
"Input",
"stream",
"from",
"a",
"string",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L314-L327
|
153,085
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.endTag
|
public static String endTag(String string)
{
if (string.indexOf(' ') != -1)
string = string.substring(0, string.indexOf(' '));
return "</" + string + '>';
}
|
java
|
public static String endTag(String string)
{
if (string.indexOf(' ') != -1)
string = string.substring(0, string.indexOf(' '));
return "</" + string + '>';
}
|
[
"public",
"static",
"String",
"endTag",
"(",
"String",
"string",
")",
"{",
"if",
"(",
"string",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"string",
"=",
"string",
".",
"substring",
"(",
"0",
",",
"string",
".",
"indexOf",
"(",
"'",
"'",
")",
")",
";",
"return",
"\"</\"",
"+",
"string",
"+",
"'",
"'",
";",
"}"
] |
Change this string to a XML end Text string.
@param string The tag to enclose as an xml tag.
@return The ending XML tag.
|
[
"Change",
"this",
"string",
"to",
"a",
"XML",
"end",
"Text",
"string",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L417-L422
|
153,086
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.getAsFormattedString
|
public static String getAsFormattedString(Map<String,Object> map, String strKey, Class<?> classData, Object objDefault)
{
Object objData = map.get(strKey);
try {
return Converter.formatObjectToString(objData, classData, objDefault);
} catch (Exception ex) {
return null;
}
}
|
java
|
public static String getAsFormattedString(Map<String,Object> map, String strKey, Class<?> classData, Object objDefault)
{
Object objData = map.get(strKey);
try {
return Converter.formatObjectToString(objData, classData, objDefault);
} catch (Exception ex) {
return null;
}
}
|
[
"public",
"static",
"String",
"getAsFormattedString",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
",",
"String",
"strKey",
",",
"Class",
"<",
"?",
">",
"classData",
",",
"Object",
"objDefault",
")",
"{",
"Object",
"objData",
"=",
"map",
".",
"get",
"(",
"strKey",
")",
";",
"try",
"{",
"return",
"Converter",
".",
"formatObjectToString",
"(",
"objData",
",",
"classData",
",",
"objDefault",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"return",
"null",
";",
"}",
"}"
] |
Get this item from the map and convert it to the target class.
Convert this object to an formatted string.
@param map The map to pull the param from.
@param strKey The property key.
@param classData The java class to convert the data to.
@param objDefault The default value.
@return The propety value in the correct class.
|
[
"Get",
"this",
"item",
"from",
"the",
"map",
"and",
"convert",
"it",
"to",
"the",
"target",
"class",
".",
"Convert",
"this",
"object",
"to",
"an",
"formatted",
"string",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L479-L487
|
153,087
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.mapToProperties
|
public static Properties mapToProperties(Map<String,Object> map)
{
Properties properties = new Properties();
Iterator<? extends Map.Entry<?, ?>> i = map.entrySet().iterator();
while (i.hasNext()) {
Map.Entry<?, ?> e = i.next();
properties.setProperty((String)e.getKey(), (e.getValue() != null) ? e.getValue().toString() : DBConstants.BLANK);
}
return properties;
}
|
java
|
public static Properties mapToProperties(Map<String,Object> map)
{
Properties properties = new Properties();
Iterator<? extends Map.Entry<?, ?>> i = map.entrySet().iterator();
while (i.hasNext()) {
Map.Entry<?, ?> e = i.next();
properties.setProperty((String)e.getKey(), (e.getValue() != null) ? e.getValue().toString() : DBConstants.BLANK);
}
return properties;
}
|
[
"public",
"static",
"Properties",
"mapToProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"Iterator",
"<",
"?",
"extends",
"Map",
".",
"Entry",
"<",
"?",
",",
"?",
">",
">",
"i",
"=",
"map",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"Map",
".",
"Entry",
"<",
"?",
",",
"?",
">",
"e",
"=",
"i",
".",
"next",
"(",
")",
";",
"properties",
".",
"setProperty",
"(",
"(",
"String",
")",
"e",
".",
"getKey",
"(",
")",
",",
"(",
"e",
".",
"getValue",
"(",
")",
"!=",
"null",
")",
"?",
"e",
".",
"getValue",
"(",
")",
".",
"toString",
"(",
")",
":",
"DBConstants",
".",
"BLANK",
")",
";",
"}",
"return",
"properties",
";",
"}"
] |
Convert map to properties.
@param map
@return
|
[
"Convert",
"map",
"to",
"properties",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L580-L589
|
153,088
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.copyAppProperties
|
public static Map<String, Object> copyAppProperties(Map<String, Object> properties, Map<String, Object> appProperties)
{
if (appProperties != null)
{
appProperties = Utility.putAllIfNew(new HashMap<String, Object>(), appProperties);
if (appProperties.get(Params.APP_NAME) != null)
appProperties.remove(Params.APP_NAME);
//if (appProperties.get(Params.MESSAGE_SERVER) != null)
// appProperties.remove(Params.MESSAGE_SERVER);
if (appProperties.get(DBParams.FREEIFDONE) != null)
appProperties.remove(DBParams.FREEIFDONE);
if (appProperties.get(MessageConstants.MESSAGE_FILTER) != null)
appProperties.remove(MessageConstants.MESSAGE_FILTER);
}
return Utility.putAllIfNew(properties, appProperties);
}
|
java
|
public static Map<String, Object> copyAppProperties(Map<String, Object> properties, Map<String, Object> appProperties)
{
if (appProperties != null)
{
appProperties = Utility.putAllIfNew(new HashMap<String, Object>(), appProperties);
if (appProperties.get(Params.APP_NAME) != null)
appProperties.remove(Params.APP_NAME);
//if (appProperties.get(Params.MESSAGE_SERVER) != null)
// appProperties.remove(Params.MESSAGE_SERVER);
if (appProperties.get(DBParams.FREEIFDONE) != null)
appProperties.remove(DBParams.FREEIFDONE);
if (appProperties.get(MessageConstants.MESSAGE_FILTER) != null)
appProperties.remove(MessageConstants.MESSAGE_FILTER);
}
return Utility.putAllIfNew(properties, appProperties);
}
|
[
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"copyAppProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"appProperties",
")",
"{",
"if",
"(",
"appProperties",
"!=",
"null",
")",
"{",
"appProperties",
"=",
"Utility",
".",
"putAllIfNew",
"(",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
",",
"appProperties",
")",
";",
"if",
"(",
"appProperties",
".",
"get",
"(",
"Params",
".",
"APP_NAME",
")",
"!=",
"null",
")",
"appProperties",
".",
"remove",
"(",
"Params",
".",
"APP_NAME",
")",
";",
"//if (appProperties.get(Params.MESSAGE_SERVER) != null)",
"// appProperties.remove(Params.MESSAGE_SERVER);",
"if",
"(",
"appProperties",
".",
"get",
"(",
"DBParams",
".",
"FREEIFDONE",
")",
"!=",
"null",
")",
"appProperties",
".",
"remove",
"(",
"DBParams",
".",
"FREEIFDONE",
")",
";",
"if",
"(",
"appProperties",
".",
"get",
"(",
"MessageConstants",
".",
"MESSAGE_FILTER",
")",
"!=",
"null",
")",
"appProperties",
".",
"remove",
"(",
"MessageConstants",
".",
"MESSAGE_FILTER",
")",
";",
"}",
"return",
"Utility",
".",
"putAllIfNew",
"(",
"properties",
",",
"appProperties",
")",
";",
"}"
] |
Copy the application properties to this map.
@param properties
@param appProperties
@return
|
[
"Copy",
"the",
"application",
"properties",
"to",
"this",
"map",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L628-L643
|
153,089
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.getRecordOwner
|
public static RecordOwner getRecordOwner(RecordOwnerParent recordOwnerParent)
{
if (recordOwnerParent instanceof RecordOwner)
return (RecordOwner)recordOwnerParent; // Duh
RecordOwner recordOwner = null;
if (recordOwnerParent != null)
if (recordOwnerParent.getTask() != null)
if (recordOwnerParent.getTask().getApplication() != null)
recordOwner = (RecordOwner)recordOwnerParent.getTask().getApplication().getSystemRecordOwner();
return recordOwner;
}
|
java
|
public static RecordOwner getRecordOwner(RecordOwnerParent recordOwnerParent)
{
if (recordOwnerParent instanceof RecordOwner)
return (RecordOwner)recordOwnerParent; // Duh
RecordOwner recordOwner = null;
if (recordOwnerParent != null)
if (recordOwnerParent.getTask() != null)
if (recordOwnerParent.getTask().getApplication() != null)
recordOwner = (RecordOwner)recordOwnerParent.getTask().getApplication().getSystemRecordOwner();
return recordOwner;
}
|
[
"public",
"static",
"RecordOwner",
"getRecordOwner",
"(",
"RecordOwnerParent",
"recordOwnerParent",
")",
"{",
"if",
"(",
"recordOwnerParent",
"instanceof",
"RecordOwner",
")",
"return",
"(",
"RecordOwner",
")",
"recordOwnerParent",
";",
"// Duh",
"RecordOwner",
"recordOwner",
"=",
"null",
";",
"if",
"(",
"recordOwnerParent",
"!=",
"null",
")",
"if",
"(",
"recordOwnerParent",
".",
"getTask",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"recordOwnerParent",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
"!=",
"null",
")",
"recordOwner",
"=",
"(",
"RecordOwner",
")",
"recordOwnerParent",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
".",
"getSystemRecordOwner",
"(",
")",
";",
"return",
"recordOwner",
";",
"}"
] |
Get a recordowner from this recordOwnerParent.
This method does a deep search using the listeners and the database connections to find a recordowner.
@param record
@return
|
[
"Get",
"a",
"recordowner",
"from",
"this",
"recordOwnerParent",
".",
"This",
"method",
"does",
"a",
"deep",
"search",
"using",
"the",
"listeners",
"and",
"the",
"database",
"connections",
"to",
"find",
"a",
"recordowner",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L698-L708
|
153,090
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.getServletPath
|
public static String getServletPath(Task task, String strServletParam)
{
String strServletName = null;
if (strServletParam == null)
strServletParam = Params.SERVLET;
if (task != null)
strServletName = task.getProperty(strServletParam);
if ((strServletName == null) || (strServletName.length() == 0))
{
strServletName = Constants.DEFAULT_SERVLET;
//? if (this.getTask() instanceof RemoteRecordOwner)
//? strServletName = strServletName + "xsl"; // Special case - if task is a session, servlet should be appxsl
if (Params.XHTMLSERVLET.equalsIgnoreCase(strServletParam))
strServletName = Constants.DEFAULT_XHTML_SERVLET;
}
return strServletName;
}
|
java
|
public static String getServletPath(Task task, String strServletParam)
{
String strServletName = null;
if (strServletParam == null)
strServletParam = Params.SERVLET;
if (task != null)
strServletName = task.getProperty(strServletParam);
if ((strServletName == null) || (strServletName.length() == 0))
{
strServletName = Constants.DEFAULT_SERVLET;
//? if (this.getTask() instanceof RemoteRecordOwner)
//? strServletName = strServletName + "xsl"; // Special case - if task is a session, servlet should be appxsl
if (Params.XHTMLSERVLET.equalsIgnoreCase(strServletParam))
strServletName = Constants.DEFAULT_XHTML_SERVLET;
}
return strServletName;
}
|
[
"public",
"static",
"String",
"getServletPath",
"(",
"Task",
"task",
",",
"String",
"strServletParam",
")",
"{",
"String",
"strServletName",
"=",
"null",
";",
"if",
"(",
"strServletParam",
"==",
"null",
")",
"strServletParam",
"=",
"Params",
".",
"SERVLET",
";",
"if",
"(",
"task",
"!=",
"null",
")",
"strServletName",
"=",
"task",
".",
"getProperty",
"(",
"strServletParam",
")",
";",
"if",
"(",
"(",
"strServletName",
"==",
"null",
")",
"||",
"(",
"strServletName",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"strServletName",
"=",
"Constants",
".",
"DEFAULT_SERVLET",
";",
"//? if (this.getTask() instanceof RemoteRecordOwner)",
"//? strServletName = strServletName + \"xsl\"; // Special case - if task is a session, servlet should be appxsl",
"if",
"(",
"Params",
".",
"XHTMLSERVLET",
".",
"equalsIgnoreCase",
"(",
"strServletParam",
")",
")",
"strServletName",
"=",
"Constants",
".",
"DEFAULT_XHTML_SERVLET",
";",
"}",
"return",
"strServletName",
";",
"}"
] |
Get the path to the target servlet.
@param strServletParam The servlet type (html or xml)
@return the servlet path.
|
[
"Get",
"the",
"path",
"to",
"the",
"target",
"servlet",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L846-L862
|
153,091
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Utility.java
|
Utility.getSystemSuffix
|
public static String getSystemSuffix(String suffix, String defaultSuffix)
{
if (defaultSuffix == null)
defaultSuffix = DEFAULT_SYSTEM_SUFFIX;
if (suffix == null)
suffix = defaultSuffix;
for (int i = suffix.length() - 2; i > 0; i--)
{ // Only use last word
if (!Character.isLetterOrDigit(suffix.charAt(i)))
{
suffix = suffix.substring(i + 1); // Typical to pass groupId
break;
}
}
return suffix;
}
|
java
|
public static String getSystemSuffix(String suffix, String defaultSuffix)
{
if (defaultSuffix == null)
defaultSuffix = DEFAULT_SYSTEM_SUFFIX;
if (suffix == null)
suffix = defaultSuffix;
for (int i = suffix.length() - 2; i > 0; i--)
{ // Only use last word
if (!Character.isLetterOrDigit(suffix.charAt(i)))
{
suffix = suffix.substring(i + 1); // Typical to pass groupId
break;
}
}
return suffix;
}
|
[
"public",
"static",
"String",
"getSystemSuffix",
"(",
"String",
"suffix",
",",
"String",
"defaultSuffix",
")",
"{",
"if",
"(",
"defaultSuffix",
"==",
"null",
")",
"defaultSuffix",
"=",
"DEFAULT_SYSTEM_SUFFIX",
";",
"if",
"(",
"suffix",
"==",
"null",
")",
"suffix",
"=",
"defaultSuffix",
";",
"for",
"(",
"int",
"i",
"=",
"suffix",
".",
"length",
"(",
")",
"-",
"2",
";",
"i",
">",
"0",
";",
"i",
"--",
")",
"{",
"// Only use last word",
"if",
"(",
"!",
"Character",
".",
"isLetterOrDigit",
"(",
"suffix",
".",
"charAt",
"(",
"i",
")",
")",
")",
"{",
"suffix",
"=",
"suffix",
".",
"substring",
"(",
"i",
"+",
"1",
")",
";",
"// Typical to pass groupId",
"break",
";",
"}",
"}",
"return",
"suffix",
";",
"}"
] |
Get the system suffix, fix it and return it.
@return
|
[
"Get",
"the",
"system",
"suffix",
"fix",
"it",
"and",
"return",
"it",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L868-L883
|
153,092
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java
|
ScreenPrinter.onPrint
|
public static boolean onPrint(Component component, boolean bPrintHeader)
{
PrinterJob job = PrinterJob.getPrinterJob();
ScreenPrinter fapp = new ScreenPrinter(component, bPrintHeader);
job.setPrintable(fapp);
if (job.printDialog ())
fapp.printJob(job);
return true;
}
|
java
|
public static boolean onPrint(Component component, boolean bPrintHeader)
{
PrinterJob job = PrinterJob.getPrinterJob();
ScreenPrinter fapp = new ScreenPrinter(component, bPrintHeader);
job.setPrintable(fapp);
if (job.printDialog ())
fapp.printJob(job);
return true;
}
|
[
"public",
"static",
"boolean",
"onPrint",
"(",
"Component",
"component",
",",
"boolean",
"bPrintHeader",
")",
"{",
"PrinterJob",
"job",
"=",
"PrinterJob",
".",
"getPrinterJob",
"(",
")",
";",
"ScreenPrinter",
"fapp",
"=",
"new",
"ScreenPrinter",
"(",
"component",
",",
"bPrintHeader",
")",
";",
"job",
".",
"setPrintable",
"(",
"fapp",
")",
";",
"if",
"(",
"job",
".",
"printDialog",
"(",
")",
")",
"fapp",
".",
"printJob",
"(",
"job",
")",
";",
"return",
"true",
";",
"}"
] |
Print the current screen.
@return true.
|
[
"Print",
"the",
"current",
"screen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java#L57-L65
|
153,093
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java
|
ScreenPrinter.printJob
|
public void printJob(PrinterJob job)
{
Frame frame = this.getFrame();
dialog = new PrintDialog(frame, false);
dialog.pack();
if (frame != null)
this.centerDialogInFrame(dialog, frame);
Map<String,Object> map = new Hashtable<String,Object>();
map.put("job", job);
SyncPageWorker thread = new SyncPageWorker(dialog, map)
{
public void runPageLoader()
{
Thread swingPageLoader = new Thread("SwingPageLoader")
{
public void run()
{
((PrintDialog)m_syncPage).setVisible(true);
}
};
SwingUtilities.invokeLater(swingPageLoader);
}
public void afterPageDisplay()
{
Thread swingPageLoader = new Thread("SwingPageLoader")
{
public void run()
{
try {
PrinterJob job = (PrinterJob)get("job");
job.print();
} catch (PrinterException ex) {
ex.printStackTrace ();
}
((PrintDialog)m_syncPage).setVisible(false);
}
};
SwingUtilities.invokeLater(swingPageLoader);
}
};
thread.start();
}
|
java
|
public void printJob(PrinterJob job)
{
Frame frame = this.getFrame();
dialog = new PrintDialog(frame, false);
dialog.pack();
if (frame != null)
this.centerDialogInFrame(dialog, frame);
Map<String,Object> map = new Hashtable<String,Object>();
map.put("job", job);
SyncPageWorker thread = new SyncPageWorker(dialog, map)
{
public void runPageLoader()
{
Thread swingPageLoader = new Thread("SwingPageLoader")
{
public void run()
{
((PrintDialog)m_syncPage).setVisible(true);
}
};
SwingUtilities.invokeLater(swingPageLoader);
}
public void afterPageDisplay()
{
Thread swingPageLoader = new Thread("SwingPageLoader")
{
public void run()
{
try {
PrinterJob job = (PrinterJob)get("job");
job.print();
} catch (PrinterException ex) {
ex.printStackTrace ();
}
((PrintDialog)m_syncPage).setVisible(false);
}
};
SwingUtilities.invokeLater(swingPageLoader);
}
};
thread.start();
}
|
[
"public",
"void",
"printJob",
"(",
"PrinterJob",
"job",
")",
"{",
"Frame",
"frame",
"=",
"this",
".",
"getFrame",
"(",
")",
";",
"dialog",
"=",
"new",
"PrintDialog",
"(",
"frame",
",",
"false",
")",
";",
"dialog",
".",
"pack",
"(",
")",
";",
"if",
"(",
"frame",
"!=",
"null",
")",
"this",
".",
"centerDialogInFrame",
"(",
"dialog",
",",
"frame",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"map",
".",
"put",
"(",
"\"job\"",
",",
"job",
")",
";",
"SyncPageWorker",
"thread",
"=",
"new",
"SyncPageWorker",
"(",
"dialog",
",",
"map",
")",
"{",
"public",
"void",
"runPageLoader",
"(",
")",
"{",
"Thread",
"swingPageLoader",
"=",
"new",
"Thread",
"(",
"\"SwingPageLoader\"",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"(",
"(",
"PrintDialog",
")",
"m_syncPage",
")",
".",
"setVisible",
"(",
"true",
")",
";",
"}",
"}",
";",
"SwingUtilities",
".",
"invokeLater",
"(",
"swingPageLoader",
")",
";",
"}",
"public",
"void",
"afterPageDisplay",
"(",
")",
"{",
"Thread",
"swingPageLoader",
"=",
"new",
"Thread",
"(",
"\"SwingPageLoader\"",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"PrinterJob",
"job",
"=",
"(",
"PrinterJob",
")",
"get",
"(",
"\"job\"",
")",
";",
"job",
".",
"print",
"(",
")",
";",
"}",
"catch",
"(",
"PrinterException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"(",
"(",
"PrintDialog",
")",
"m_syncPage",
")",
".",
"setVisible",
"(",
"false",
")",
";",
"}",
"}",
";",
"SwingUtilities",
".",
"invokeLater",
"(",
"swingPageLoader",
")",
";",
"}",
"}",
";",
"thread",
".",
"start",
"(",
")",
";",
"}"
] |
Print this job.
@param job
|
[
"Print",
"this",
"job",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java#L70-L114
|
153,094
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java
|
ScreenPrinter.print
|
public int print(Graphics g, PageFormat pageFormat, int pageIndex)
{
Graphics2D g2d = (Graphics2D)g;
if (firstTime)
{
m_componentPrint = new ComponentPrint(null);
m_componentPrint.surveyComponents(m_component);
m_paperPrint = new PaperPrint(null);
m_paperPrint.surveyPage(pageFormat, g2d, m_bPrintHeader);
firstTime = false;
}
// Print this page
int pageHeight = m_paperPrint.getPrintableHeight();
double scale = Math.min(1.0, ((double)m_paperPrint.getPrintableWidth() / (double)m_componentPrint.getMaxComponentWidth()));
m_paperPrint.setCurrentYLocation(0);
m_componentPrint.setPageHeight((int)(pageHeight / scale));
boolean pageDone = m_componentPrint.setCurrentYLocation(pageIndex, 0);
while (!pageDone)
{
Component component = m_componentPrint.getCurrentComponent();
int componentCurrentYLocation = m_componentPrint.getCurrentYLocation();
int componentHeightOnPage = m_componentPrint.getComponentPageHeight();
if (this.isCancelled())
return NO_SUCH_PAGE; // Done, No more pages
if (component == null)
{
if (m_paperPrint.getCurrentYLocation() == 0)
return NO_SUCH_PAGE; // No more pages
else
break; // End of components (last page)
}
if (m_paperPrint.getCurrentYLocation() == 0)
{ // First time through
if (m_bPrintHeader)
{
m_paperPrint.printHeader(g2d, m_componentPrint.getTitle());
m_paperPrint.printFooter(g2d, "Page " + (pageIndex + 1));
}
this.setDialogMessage("Printing page " + (pageIndex + 1));
}
int xShift = m_paperPrint.getXOffset();
int yShift = m_paperPrint.getYOffset() - (int)(componentCurrentYLocation * scale);
g2d.setClip(m_paperPrint.getXOffset(), m_paperPrint.getYOffset(), m_paperPrint.getPrintableWidth(), (int)(componentHeightOnPage * scale));
g2d.translate(xShift, yShift);
g2d.scale(scale, scale);
disableDoubleBuffering(component);
component.paint(g2d);
enableDoubleBuffering(component);
g2d.scale(1 / scale, 1 / scale);
g2d.translate(-xShift, -yShift);
m_paperPrint.addCurrentYLocation((int)(componentHeightOnPage * scale));
pageDone = m_componentPrint.addCurrentYLocation(componentHeightOnPage);
}
return PAGE_EXISTS;
}
|
java
|
public int print(Graphics g, PageFormat pageFormat, int pageIndex)
{
Graphics2D g2d = (Graphics2D)g;
if (firstTime)
{
m_componentPrint = new ComponentPrint(null);
m_componentPrint.surveyComponents(m_component);
m_paperPrint = new PaperPrint(null);
m_paperPrint.surveyPage(pageFormat, g2d, m_bPrintHeader);
firstTime = false;
}
// Print this page
int pageHeight = m_paperPrint.getPrintableHeight();
double scale = Math.min(1.0, ((double)m_paperPrint.getPrintableWidth() / (double)m_componentPrint.getMaxComponentWidth()));
m_paperPrint.setCurrentYLocation(0);
m_componentPrint.setPageHeight((int)(pageHeight / scale));
boolean pageDone = m_componentPrint.setCurrentYLocation(pageIndex, 0);
while (!pageDone)
{
Component component = m_componentPrint.getCurrentComponent();
int componentCurrentYLocation = m_componentPrint.getCurrentYLocation();
int componentHeightOnPage = m_componentPrint.getComponentPageHeight();
if (this.isCancelled())
return NO_SUCH_PAGE; // Done, No more pages
if (component == null)
{
if (m_paperPrint.getCurrentYLocation() == 0)
return NO_SUCH_PAGE; // No more pages
else
break; // End of components (last page)
}
if (m_paperPrint.getCurrentYLocation() == 0)
{ // First time through
if (m_bPrintHeader)
{
m_paperPrint.printHeader(g2d, m_componentPrint.getTitle());
m_paperPrint.printFooter(g2d, "Page " + (pageIndex + 1));
}
this.setDialogMessage("Printing page " + (pageIndex + 1));
}
int xShift = m_paperPrint.getXOffset();
int yShift = m_paperPrint.getYOffset() - (int)(componentCurrentYLocation * scale);
g2d.setClip(m_paperPrint.getXOffset(), m_paperPrint.getYOffset(), m_paperPrint.getPrintableWidth(), (int)(componentHeightOnPage * scale));
g2d.translate(xShift, yShift);
g2d.scale(scale, scale);
disableDoubleBuffering(component);
component.paint(g2d);
enableDoubleBuffering(component);
g2d.scale(1 / scale, 1 / scale);
g2d.translate(-xShift, -yShift);
m_paperPrint.addCurrentYLocation((int)(componentHeightOnPage * scale));
pageDone = m_componentPrint.addCurrentYLocation(componentHeightOnPage);
}
return PAGE_EXISTS;
}
|
[
"public",
"int",
"print",
"(",
"Graphics",
"g",
",",
"PageFormat",
"pageFormat",
",",
"int",
"pageIndex",
")",
"{",
"Graphics2D",
"g2d",
"=",
"(",
"Graphics2D",
")",
"g",
";",
"if",
"(",
"firstTime",
")",
"{",
"m_componentPrint",
"=",
"new",
"ComponentPrint",
"(",
"null",
")",
";",
"m_componentPrint",
".",
"surveyComponents",
"(",
"m_component",
")",
";",
"m_paperPrint",
"=",
"new",
"PaperPrint",
"(",
"null",
")",
";",
"m_paperPrint",
".",
"surveyPage",
"(",
"pageFormat",
",",
"g2d",
",",
"m_bPrintHeader",
")",
";",
"firstTime",
"=",
"false",
";",
"}",
"// Print this page",
"int",
"pageHeight",
"=",
"m_paperPrint",
".",
"getPrintableHeight",
"(",
")",
";",
"double",
"scale",
"=",
"Math",
".",
"min",
"(",
"1.0",
",",
"(",
"(",
"double",
")",
"m_paperPrint",
".",
"getPrintableWidth",
"(",
")",
"/",
"(",
"double",
")",
"m_componentPrint",
".",
"getMaxComponentWidth",
"(",
")",
")",
")",
";",
"m_paperPrint",
".",
"setCurrentYLocation",
"(",
"0",
")",
";",
"m_componentPrint",
".",
"setPageHeight",
"(",
"(",
"int",
")",
"(",
"pageHeight",
"/",
"scale",
")",
")",
";",
"boolean",
"pageDone",
"=",
"m_componentPrint",
".",
"setCurrentYLocation",
"(",
"pageIndex",
",",
"0",
")",
";",
"while",
"(",
"!",
"pageDone",
")",
"{",
"Component",
"component",
"=",
"m_componentPrint",
".",
"getCurrentComponent",
"(",
")",
";",
"int",
"componentCurrentYLocation",
"=",
"m_componentPrint",
".",
"getCurrentYLocation",
"(",
")",
";",
"int",
"componentHeightOnPage",
"=",
"m_componentPrint",
".",
"getComponentPageHeight",
"(",
")",
";",
"if",
"(",
"this",
".",
"isCancelled",
"(",
")",
")",
"return",
"NO_SUCH_PAGE",
";",
"// Done, No more pages",
"if",
"(",
"component",
"==",
"null",
")",
"{",
"if",
"(",
"m_paperPrint",
".",
"getCurrentYLocation",
"(",
")",
"==",
"0",
")",
"return",
"NO_SUCH_PAGE",
";",
"// No more pages",
"else",
"break",
";",
"// End of components (last page)",
"}",
"if",
"(",
"m_paperPrint",
".",
"getCurrentYLocation",
"(",
")",
"==",
"0",
")",
"{",
"// First time through",
"if",
"(",
"m_bPrintHeader",
")",
"{",
"m_paperPrint",
".",
"printHeader",
"(",
"g2d",
",",
"m_componentPrint",
".",
"getTitle",
"(",
")",
")",
";",
"m_paperPrint",
".",
"printFooter",
"(",
"g2d",
",",
"\"Page \"",
"+",
"(",
"pageIndex",
"+",
"1",
")",
")",
";",
"}",
"this",
".",
"setDialogMessage",
"(",
"\"Printing page \"",
"+",
"(",
"pageIndex",
"+",
"1",
")",
")",
";",
"}",
"int",
"xShift",
"=",
"m_paperPrint",
".",
"getXOffset",
"(",
")",
";",
"int",
"yShift",
"=",
"m_paperPrint",
".",
"getYOffset",
"(",
")",
"-",
"(",
"int",
")",
"(",
"componentCurrentYLocation",
"*",
"scale",
")",
";",
"g2d",
".",
"setClip",
"(",
"m_paperPrint",
".",
"getXOffset",
"(",
")",
",",
"m_paperPrint",
".",
"getYOffset",
"(",
")",
",",
"m_paperPrint",
".",
"getPrintableWidth",
"(",
")",
",",
"(",
"int",
")",
"(",
"componentHeightOnPage",
"*",
"scale",
")",
")",
";",
"g2d",
".",
"translate",
"(",
"xShift",
",",
"yShift",
")",
";",
"g2d",
".",
"scale",
"(",
"scale",
",",
"scale",
")",
";",
"disableDoubleBuffering",
"(",
"component",
")",
";",
"component",
".",
"paint",
"(",
"g2d",
")",
";",
"enableDoubleBuffering",
"(",
"component",
")",
";",
"g2d",
".",
"scale",
"(",
"1",
"/",
"scale",
",",
"1",
"/",
"scale",
")",
";",
"g2d",
".",
"translate",
"(",
"-",
"xShift",
",",
"-",
"yShift",
")",
";",
"m_paperPrint",
".",
"addCurrentYLocation",
"(",
"(",
"int",
")",
"(",
"componentHeightOnPage",
"*",
"scale",
")",
")",
";",
"pageDone",
"=",
"m_componentPrint",
".",
"addCurrentYLocation",
"(",
"componentHeightOnPage",
")",
";",
"}",
"return",
"PAGE_EXISTS",
";",
"}"
] |
Print this page.
|
[
"Print",
"this",
"page",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java#L153-L216
|
153,095
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java
|
ScreenPrinter.disableDoubleBuffering
|
public static void disableDoubleBuffering(Component c)
{
RepaintManager currentManager = RepaintManager.currentManager(c);
currentManager.setDoubleBufferingEnabled(false);
}
|
java
|
public static void disableDoubleBuffering(Component c)
{
RepaintManager currentManager = RepaintManager.currentManager(c);
currentManager.setDoubleBufferingEnabled(false);
}
|
[
"public",
"static",
"void",
"disableDoubleBuffering",
"(",
"Component",
"c",
")",
"{",
"RepaintManager",
"currentManager",
"=",
"RepaintManager",
".",
"currentManager",
"(",
"c",
")",
";",
"currentManager",
".",
"setDoubleBufferingEnabled",
"(",
"false",
")",
";",
"}"
] |
Turn the cache off, so printing will work.
@param c Component.
|
[
"Turn",
"the",
"cache",
"off",
"so",
"printing",
"will",
"work",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java#L256-L260
|
153,096
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java
|
ScreenPrinter.enableDoubleBuffering
|
public static void enableDoubleBuffering(Component c)
{
RepaintManager currentManager = RepaintManager.currentManager(c);
currentManager.setDoubleBufferingEnabled(true);
}
|
java
|
public static void enableDoubleBuffering(Component c)
{
RepaintManager currentManager = RepaintManager.currentManager(c);
currentManager.setDoubleBufferingEnabled(true);
}
|
[
"public",
"static",
"void",
"enableDoubleBuffering",
"(",
"Component",
"c",
")",
"{",
"RepaintManager",
"currentManager",
"=",
"RepaintManager",
".",
"currentManager",
"(",
"c",
")",
";",
"currentManager",
".",
"setDoubleBufferingEnabled",
"(",
"true",
")",
";",
"}"
] |
Turn the cache back on.
@param c Component.
|
[
"Turn",
"the",
"cache",
"back",
"on",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java#L265-L269
|
153,097
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java
|
ScreenPrinter.centerDialogInFrame
|
public void centerDialogInFrame(Dialog dialog, Frame frame)
{
dialog.setLocation(frame.getX() + (frame.getWidth() - dialog.getWidth()) / 2, frame.getY() + (frame.getHeight() - dialog.getHeight()) / 2);
}
|
java
|
public void centerDialogInFrame(Dialog dialog, Frame frame)
{
dialog.setLocation(frame.getX() + (frame.getWidth() - dialog.getWidth()) / 2, frame.getY() + (frame.getHeight() - dialog.getHeight()) / 2);
}
|
[
"public",
"void",
"centerDialogInFrame",
"(",
"Dialog",
"dialog",
",",
"Frame",
"frame",
")",
"{",
"dialog",
".",
"setLocation",
"(",
"frame",
".",
"getX",
"(",
")",
"+",
"(",
"frame",
".",
"getWidth",
"(",
")",
"-",
"dialog",
".",
"getWidth",
"(",
")",
")",
"/",
"2",
",",
"frame",
".",
"getY",
"(",
")",
"+",
"(",
"frame",
".",
"getHeight",
"(",
")",
"-",
"dialog",
".",
"getHeight",
"(",
")",
")",
"/",
"2",
")",
";",
"}"
] |
Center this dialog in the frame.
|
[
"Center",
"this",
"dialog",
"in",
"the",
"frame",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/print/ScreenPrinter.java#L273-L276
|
153,098
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/util/buff/ByteBuffer.java
|
ByteBuffer.free
|
public void free()
{
super.free();
m_baOut = null;
m_daOut = null;
m_baIn = null;
m_daIn = null;
}
|
java
|
public void free()
{
super.free();
m_baOut = null;
m_daOut = null;
m_baIn = null;
m_daIn = null;
}
|
[
"public",
"void",
"free",
"(",
")",
"{",
"super",
".",
"free",
"(",
")",
";",
"m_baOut",
"=",
"null",
";",
"m_daOut",
"=",
"null",
";",
"m_baIn",
"=",
"null",
";",
"m_daIn",
"=",
"null",
";",
"}"
] |
Release the objects connected to this buffer.
|
[
"Release",
"the",
"objects",
"connected",
"to",
"this",
"buffer",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/buff/ByteBuffer.java#L104-L111
|
153,099
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/util/buff/ByteBuffer.java
|
ByteBuffer.resetPosition
|
public void resetPosition()
{
try {
if (m_daIn != null)
m_daIn.reset();
else if (m_baOut != null)
{
byte[] byInput = m_baOut.toByteArray();
this.setPhysicalData(byInput);
}
super.resetPosition();
} catch (IOException ex) {
ex.printStackTrace();
}
}
|
java
|
public void resetPosition()
{
try {
if (m_daIn != null)
m_daIn.reset();
else if (m_baOut != null)
{
byte[] byInput = m_baOut.toByteArray();
this.setPhysicalData(byInput);
}
super.resetPosition();
} catch (IOException ex) {
ex.printStackTrace();
}
}
|
[
"public",
"void",
"resetPosition",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"m_daIn",
"!=",
"null",
")",
"m_daIn",
".",
"reset",
"(",
")",
";",
"else",
"if",
"(",
"m_baOut",
"!=",
"null",
")",
"{",
"byte",
"[",
"]",
"byInput",
"=",
"m_baOut",
".",
"toByteArray",
"(",
")",
";",
"this",
".",
"setPhysicalData",
"(",
"byInput",
")",
";",
"}",
"super",
".",
"resetPosition",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
Set the position to the start for GetXXXX methods.
|
[
"Set",
"the",
"position",
"to",
"the",
"start",
"for",
"GetXXXX",
"methods",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/buff/ByteBuffer.java#L201-L215
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.