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,600
|
watchrabbit/rabbit-commons
|
src/main/java/com/watchrabbit/commons/sleep/Sleep.java
|
Sleep.sleep
|
public static void sleep(long timeout, TimeUnit unit) throws SystemException {
suppress((Long sleepTimeout) -> Thread.sleep(sleepTimeout))
.accept(TimeUnit.MILLISECONDS.convert(timeout, unit));
}
|
java
|
public static void sleep(long timeout, TimeUnit unit) throws SystemException {
suppress((Long sleepTimeout) -> Thread.sleep(sleepTimeout))
.accept(TimeUnit.MILLISECONDS.convert(timeout, unit));
}
|
[
"public",
"static",
"void",
"sleep",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"SystemException",
"{",
"suppress",
"(",
"(",
"Long",
"sleepTimeout",
")",
"->",
"Thread",
".",
"sleep",
"(",
"sleepTimeout",
")",
")",
".",
"accept",
"(",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"timeout",
",",
"unit",
")",
")",
";",
"}"
] |
Causes the current thread to wait until the specified waiting time
elapses.
<p>
Any {@code InterruptedException}'s are suppress and logged. Any
{@code Exception}'s thrown by callable are propagate as SystemException
@param timeout the maximum time to wait
@param unit the time unit of the {@code timeout} argument
@throws SystemException if callable throws exception
|
[
"Causes",
"the",
"current",
"thread",
"to",
"wait",
"until",
"the",
"specified",
"waiting",
"time",
"elapses",
"."
] |
b11c9f804b5ab70b9264635c34a02f5029bd2a5d
|
https://github.com/watchrabbit/rabbit-commons/blob/b11c9f804b5ab70b9264635c34a02f5029bd2a5d/src/main/java/com/watchrabbit/commons/sleep/Sleep.java#L42-L45
|
153,601
|
watchrabbit/rabbit-commons
|
src/main/java/com/watchrabbit/commons/sleep/Sleep.java
|
Sleep.untilEmpty
|
public static <T extends Collection> T untilEmpty(Callable<T> callable, long timeout, TimeUnit unit) {
return SleepBuilder.<T>sleep()
.withComparer(argument -> argument.isEmpty())
.withTimeout(timeout, unit)
.withStatement(callable)
.build();
}
|
java
|
public static <T extends Collection> T untilEmpty(Callable<T> callable, long timeout, TimeUnit unit) {
return SleepBuilder.<T>sleep()
.withComparer(argument -> argument.isEmpty())
.withTimeout(timeout, unit)
.withStatement(callable)
.build();
}
|
[
"public",
"static",
"<",
"T",
"extends",
"Collection",
">",
"T",
"untilEmpty",
"(",
"Callable",
"<",
"T",
">",
"callable",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"SleepBuilder",
".",
"<",
"T",
">",
"sleep",
"(",
")",
".",
"withComparer",
"(",
"argument",
"->",
"argument",
".",
"isEmpty",
"(",
")",
")",
".",
"withTimeout",
"(",
"timeout",
",",
"unit",
")",
".",
"withStatement",
"(",
"callable",
")",
".",
"build",
"(",
")",
";",
"}"
] |
Causes the current thread to wait until the callable is returning empty
collection, or the specified waiting time elapses.
<p>
If the callable returns not empty collection then this method returns
immediately with the value returned by callable.
<p>
Any {@code InterruptedException}'s are suppress and logged. Any
{@code Exception}'s thrown by callable are propagate as SystemException
@param callable callable checked by this method
@param timeout the maximum time to wait
@param unit the time unit of the {@code timeout} argument
@return value returned by callable method
@throws SystemException if callable throws exception
|
[
"Causes",
"the",
"current",
"thread",
"to",
"wait",
"until",
"the",
"callable",
"is",
"returning",
"empty",
"collection",
"or",
"the",
"specified",
"waiting",
"time",
"elapses",
"."
] |
b11c9f804b5ab70b9264635c34a02f5029bd2a5d
|
https://github.com/watchrabbit/rabbit-commons/blob/b11c9f804b5ab70b9264635c34a02f5029bd2a5d/src/main/java/com/watchrabbit/commons/sleep/Sleep.java#L169-L175
|
153,602
|
jkyamog/DeDS
|
mobile-dds/src/main/java/nz/net/catalyst/mobile/dds/WurflCapabilityServiceImpl.java
|
WurflCapabilityServiceImpl.init
|
public void init() {
// before running init check to see if attributes has been injected/set
if (wurflDirPath == null)
throw new IllegalStateException ("wurflDirPath not properly set");
// look for wurfl file and patches
File wurflDir = new File(wurflDirPath);
// if file does not exists, it might be relative to the servlet
if (!wurflDir.exists() && servletContext != null)
wurflDir = new File(servletContext.getRealPath(wurflDirPath));
// check again
if (!wurflDir.exists())
throw new IllegalArgumentException("wurflDirPath " + wurflDir.getAbsolutePath() + " does not exists");
if (!wurflDir.isDirectory())
throw new IllegalArgumentException("wurflDirPath " + wurflDir.getAbsolutePath() + " is not a directory");
ArrayList<File> patchFiles = new ArrayList<File> ();
logger.info("search for wurfl file and patches on: " + wurflDir.getAbsolutePath());
for (String filePath:wurflDir.list()) {
File file = new File(wurflDir.getAbsoluteFile() + "/" + filePath);
if (WURFL_FILENAME.equals(file.getName())) {
wurflFile = file;
logger.debug("wurfl file: " + wurflFile.getAbsolutePath());
} else if (file.getName().endsWith(".xml")) {
patchFiles.add(file);
logger.debug("wurfl patch file: " + file.getAbsolutePath());
}
}
this.wurflPatchFiles = patchFiles.toArray(new File[] {});
// initialize wurfl holder
this.wurflHolder = new CustomWURFLHolder(this.wurflFile, this.wurflPatchFiles);
startWatchingFiles();
this.statusInfo = getNewStatusInfo("");
}
|
java
|
public void init() {
// before running init check to see if attributes has been injected/set
if (wurflDirPath == null)
throw new IllegalStateException ("wurflDirPath not properly set");
// look for wurfl file and patches
File wurflDir = new File(wurflDirPath);
// if file does not exists, it might be relative to the servlet
if (!wurflDir.exists() && servletContext != null)
wurflDir = new File(servletContext.getRealPath(wurflDirPath));
// check again
if (!wurflDir.exists())
throw new IllegalArgumentException("wurflDirPath " + wurflDir.getAbsolutePath() + " does not exists");
if (!wurflDir.isDirectory())
throw new IllegalArgumentException("wurflDirPath " + wurflDir.getAbsolutePath() + " is not a directory");
ArrayList<File> patchFiles = new ArrayList<File> ();
logger.info("search for wurfl file and patches on: " + wurflDir.getAbsolutePath());
for (String filePath:wurflDir.list()) {
File file = new File(wurflDir.getAbsoluteFile() + "/" + filePath);
if (WURFL_FILENAME.equals(file.getName())) {
wurflFile = file;
logger.debug("wurfl file: " + wurflFile.getAbsolutePath());
} else if (file.getName().endsWith(".xml")) {
patchFiles.add(file);
logger.debug("wurfl patch file: " + file.getAbsolutePath());
}
}
this.wurflPatchFiles = patchFiles.toArray(new File[] {});
// initialize wurfl holder
this.wurflHolder = new CustomWURFLHolder(this.wurflFile, this.wurflPatchFiles);
startWatchingFiles();
this.statusInfo = getNewStatusInfo("");
}
|
[
"public",
"void",
"init",
"(",
")",
"{",
"// before running init check to see if attributes has been injected/set",
"if",
"(",
"wurflDirPath",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"wurflDirPath not properly set\"",
")",
";",
"// look for wurfl file and patches",
"File",
"wurflDir",
"=",
"new",
"File",
"(",
"wurflDirPath",
")",
";",
"// if file does not exists, it might be relative to the servlet",
"if",
"(",
"!",
"wurflDir",
".",
"exists",
"(",
")",
"&&",
"servletContext",
"!=",
"null",
")",
"wurflDir",
"=",
"new",
"File",
"(",
"servletContext",
".",
"getRealPath",
"(",
"wurflDirPath",
")",
")",
";",
"// check again",
"if",
"(",
"!",
"wurflDir",
".",
"exists",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"wurflDirPath \"",
"+",
"wurflDir",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" does not exists\"",
")",
";",
"if",
"(",
"!",
"wurflDir",
".",
"isDirectory",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"wurflDirPath \"",
"+",
"wurflDir",
".",
"getAbsolutePath",
"(",
")",
"+",
"\" is not a directory\"",
")",
";",
"ArrayList",
"<",
"File",
">",
"patchFiles",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"logger",
".",
"info",
"(",
"\"search for wurfl file and patches on: \"",
"+",
"wurflDir",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"for",
"(",
"String",
"filePath",
":",
"wurflDir",
".",
"list",
"(",
")",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"wurflDir",
".",
"getAbsoluteFile",
"(",
")",
"+",
"\"/\"",
"+",
"filePath",
")",
";",
"if",
"(",
"WURFL_FILENAME",
".",
"equals",
"(",
"file",
".",
"getName",
"(",
")",
")",
")",
"{",
"wurflFile",
"=",
"file",
";",
"logger",
".",
"debug",
"(",
"\"wurfl file: \"",
"+",
"wurflFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"file",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\".xml\"",
")",
")",
"{",
"patchFiles",
".",
"add",
"(",
"file",
")",
";",
"logger",
".",
"debug",
"(",
"\"wurfl patch file: \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"}",
"this",
".",
"wurflPatchFiles",
"=",
"patchFiles",
".",
"toArray",
"(",
"new",
"File",
"[",
"]",
"{",
"}",
")",
";",
"// initialize wurfl holder",
"this",
".",
"wurflHolder",
"=",
"new",
"CustomWURFLHolder",
"(",
"this",
".",
"wurflFile",
",",
"this",
".",
"wurflPatchFiles",
")",
";",
"startWatchingFiles",
"(",
")",
";",
"this",
".",
"statusInfo",
"=",
"getNewStatusInfo",
"(",
"\"\"",
")",
";",
"}"
] |
init will properly initialize this service. this would look for wurfl files
and instantiate a wurfl holder
|
[
"init",
"will",
"properly",
"initialize",
"this",
"service",
".",
"this",
"would",
"look",
"for",
"wurfl",
"files",
"and",
"instantiate",
"a",
"wurfl",
"holder"
] |
d8cf6a294a23daa8e8a92073827c73b1befe3fa1
|
https://github.com/jkyamog/DeDS/blob/d8cf6a294a23daa8e8a92073827c73b1befe3fa1/mobile-dds/src/main/java/nz/net/catalyst/mobile/dds/WurflCapabilityServiceImpl.java#L76-L115
|
153,603
|
jkyamog/DeDS
|
mobile-dds/src/main/java/nz/net/catalyst/mobile/dds/WurflCapabilityServiceImpl.java
|
WurflCapabilityServiceImpl.startWatchingFiles
|
protected synchronized void startWatchingFiles() {
famList.clear();
FilesystemAlterationMonitor fam = new FilesystemAlterationMonitor();
FileChangeListener wurflListener = new WurflFileListener();
fam.addListener(wurflFile, wurflListener);
fam.start();
famList.add(fam);
logger.debug("watching " + wurflFile.getAbsolutePath());
for (File patchFile : wurflPatchFiles) {
fam = new FilesystemAlterationMonitor();
FileChangeListener wurflPatchListener = new WurflFileListener();
fam.addListener(patchFile, wurflPatchListener);
fam.start();
famList.add(fam);
logger.debug("watching " + patchFile.getAbsolutePath());
}
}
|
java
|
protected synchronized void startWatchingFiles() {
famList.clear();
FilesystemAlterationMonitor fam = new FilesystemAlterationMonitor();
FileChangeListener wurflListener = new WurflFileListener();
fam.addListener(wurflFile, wurflListener);
fam.start();
famList.add(fam);
logger.debug("watching " + wurflFile.getAbsolutePath());
for (File patchFile : wurflPatchFiles) {
fam = new FilesystemAlterationMonitor();
FileChangeListener wurflPatchListener = new WurflFileListener();
fam.addListener(patchFile, wurflPatchListener);
fam.start();
famList.add(fam);
logger.debug("watching " + patchFile.getAbsolutePath());
}
}
|
[
"protected",
"synchronized",
"void",
"startWatchingFiles",
"(",
")",
"{",
"famList",
".",
"clear",
"(",
")",
";",
"FilesystemAlterationMonitor",
"fam",
"=",
"new",
"FilesystemAlterationMonitor",
"(",
")",
";",
"FileChangeListener",
"wurflListener",
"=",
"new",
"WurflFileListener",
"(",
")",
";",
"fam",
".",
"addListener",
"(",
"wurflFile",
",",
"wurflListener",
")",
";",
"fam",
".",
"start",
"(",
")",
";",
"famList",
".",
"add",
"(",
"fam",
")",
";",
"logger",
".",
"debug",
"(",
"\"watching \"",
"+",
"wurflFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"for",
"(",
"File",
"patchFile",
":",
"wurflPatchFiles",
")",
"{",
"fam",
"=",
"new",
"FilesystemAlterationMonitor",
"(",
")",
";",
"FileChangeListener",
"wurflPatchListener",
"=",
"new",
"WurflFileListener",
"(",
")",
";",
"fam",
".",
"addListener",
"(",
"patchFile",
",",
"wurflPatchListener",
")",
";",
"fam",
".",
"start",
"(",
")",
";",
"famList",
".",
"add",
"(",
"fam",
")",
";",
"logger",
".",
"debug",
"(",
"\"watching \"",
"+",
"patchFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"}"
] |
create listeners and monitors for wurfl and its patches
|
[
"create",
"listeners",
"and",
"monitors",
"for",
"wurfl",
"and",
"its",
"patches"
] |
d8cf6a294a23daa8e8a92073827c73b1befe3fa1
|
https://github.com/jkyamog/DeDS/blob/d8cf6a294a23daa8e8a92073827c73b1befe3fa1/mobile-dds/src/main/java/nz/net/catalyst/mobile/dds/WurflCapabilityServiceImpl.java#L179-L198
|
153,604
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java
|
DeleteFileExtensions.checkFile
|
public static Exception checkFile(final File file)
{
Exception ex = null;
String error = null;
// check if the file does not exists...
if (!file.exists())
{
error = "The " + file + " does not exists.";
ex = new FileDoesNotExistException(error);
return ex;
}
// check if the file is not a directory...
if (!file.isDirectory())
{
error = "The " + file + " is not a directory.";
ex = new FileIsNotADirectoryException(error);
return ex;
}
final File[] ff = file.listFiles();
// If the file is null
if (ff == null)
{ // it is security restricted
error = "The " + file + " could not list the content.";
ex = new DirectoryHasNoContentException(error);
}
return ex;
}
|
java
|
public static Exception checkFile(final File file)
{
Exception ex = null;
String error = null;
// check if the file does not exists...
if (!file.exists())
{
error = "The " + file + " does not exists.";
ex = new FileDoesNotExistException(error);
return ex;
}
// check if the file is not a directory...
if (!file.isDirectory())
{
error = "The " + file + " is not a directory.";
ex = new FileIsNotADirectoryException(error);
return ex;
}
final File[] ff = file.listFiles();
// If the file is null
if (ff == null)
{ // it is security restricted
error = "The " + file + " could not list the content.";
ex = new DirectoryHasNoContentException(error);
}
return ex;
}
|
[
"public",
"static",
"Exception",
"checkFile",
"(",
"final",
"File",
"file",
")",
"{",
"Exception",
"ex",
"=",
"null",
";",
"String",
"error",
"=",
"null",
";",
"// check if the file does not exists...",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"error",
"=",
"\"The \"",
"+",
"file",
"+",
"\" does not exists.\"",
";",
"ex",
"=",
"new",
"FileDoesNotExistException",
"(",
"error",
")",
";",
"return",
"ex",
";",
"}",
"// check if the file is not a directory...",
"if",
"(",
"!",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"error",
"=",
"\"The \"",
"+",
"file",
"+",
"\" is not a directory.\"",
";",
"ex",
"=",
"new",
"FileIsNotADirectoryException",
"(",
"error",
")",
";",
"return",
"ex",
";",
"}",
"final",
"File",
"[",
"]",
"ff",
"=",
"file",
".",
"listFiles",
"(",
")",
";",
"// If the file is null",
"if",
"(",
"ff",
"==",
"null",
")",
"{",
"// it is security restricted",
"error",
"=",
"\"The \"",
"+",
"file",
"+",
"\" could not list the content.\"",
";",
"ex",
"=",
"new",
"DirectoryHasNoContentException",
"(",
"error",
")",
";",
"}",
"return",
"ex",
";",
"}"
] |
Checks the File if it is a directory or if its exists or if it is empty.
@param file
The File to check.
@return Null if nothing is wrong otherwise an Exception.
|
[
"Checks",
"the",
"File",
"if",
"it",
"is",
"a",
"directory",
"or",
"if",
"its",
"exists",
"or",
"if",
"it",
"is",
"empty",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java#L60-L87
|
153,605
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java
|
DeleteFileExtensions.delete
|
public static void delete(final @NonNull File file) throws IOException
{
if (file.isDirectory())
{
DeleteFileExtensions.deleteAllFiles(file);
}
else
{
String error = null;
// If the file is not deleted
if (!file.delete())
{
error = "Cannot delete the File " + file.getAbsolutePath() + ".";
throw new IOException(error);
}
}
}
|
java
|
public static void delete(final @NonNull File file) throws IOException
{
if (file.isDirectory())
{
DeleteFileExtensions.deleteAllFiles(file);
}
else
{
String error = null;
// If the file is not deleted
if (!file.delete())
{
error = "Cannot delete the File " + file.getAbsolutePath() + ".";
throw new IOException(error);
}
}
}
|
[
"public",
"static",
"void",
"delete",
"(",
"final",
"@",
"NonNull",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"DeleteFileExtensions",
".",
"deleteAllFiles",
"(",
"file",
")",
";",
"}",
"else",
"{",
"String",
"error",
"=",
"null",
";",
"// If the file is not deleted",
"if",
"(",
"!",
"file",
".",
"delete",
"(",
")",
")",
"{",
"error",
"=",
"\"Cannot delete the File \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
"+",
"\".\"",
";",
"throw",
"new",
"IOException",
"(",
"error",
")",
";",
"}",
"}",
"}"
] |
Tries to delete a file and if its a directory than its deletes all the sub-directories.
@param file
The File to delete.
@throws IOException
Signals that an I/O exception has occurred.
|
[
"Tries",
"to",
"delete",
"a",
"file",
"and",
"if",
"its",
"a",
"directory",
"than",
"its",
"deletes",
"all",
"the",
"sub",
"-",
"directories",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java#L115-L133
|
153,606
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java
|
DeleteFileExtensions.deleteAllFiles
|
public static void deleteAllFiles(final File file) throws IOException
{
String error = null;
if (!file.exists())
{
return;
}
final Exception ex = checkFile(file);
if (ex != null)
{
try
{
throw ex;
}
catch (final Exception e)
{
e.printStackTrace();
}
}
DeleteFileExtensions.deleteFiles(file);
if (!file.delete())
{
error = "Cannot delete the File " + file.getAbsolutePath() + ".";
throw new IOException(error);
}
}
|
java
|
public static void deleteAllFiles(final File file) throws IOException
{
String error = null;
if (!file.exists())
{
return;
}
final Exception ex = checkFile(file);
if (ex != null)
{
try
{
throw ex;
}
catch (final Exception e)
{
e.printStackTrace();
}
}
DeleteFileExtensions.deleteFiles(file);
if (!file.delete())
{
error = "Cannot delete the File " + file.getAbsolutePath() + ".";
throw new IOException(error);
}
}
|
[
"public",
"static",
"void",
"deleteAllFiles",
"(",
"final",
"File",
"file",
")",
"throws",
"IOException",
"{",
"String",
"error",
"=",
"null",
";",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"return",
";",
"}",
"final",
"Exception",
"ex",
"=",
"checkFile",
"(",
"file",
")",
";",
"if",
"(",
"ex",
"!=",
"null",
")",
"{",
"try",
"{",
"throw",
"ex",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"DeleteFileExtensions",
".",
"deleteFiles",
"(",
"file",
")",
";",
"if",
"(",
"!",
"file",
".",
"delete",
"(",
")",
")",
"{",
"error",
"=",
"\"Cannot delete the File \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
"+",
"\".\"",
";",
"throw",
"new",
"IOException",
"(",
"error",
")",
";",
"}",
"}"
] |
Deletes the File and if it is an directory it deletes his sub-directories recursively.
@param file
The File to delete.
@throws IOException
Signals that an I/O exception has occurred.
|
[
"Deletes",
"the",
"File",
"and",
"if",
"it",
"is",
"an",
"directory",
"it",
"deletes",
"his",
"sub",
"-",
"directories",
"recursively",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java#L144-L171
|
153,607
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java
|
DeleteFileExtensions.deleteAllFilesWithSuffix
|
public static void deleteAllFilesWithSuffix(final File file, final String theSuffix)
throws IOException
{
final String filePath = file.getAbsolutePath();
final String suffix[] = { theSuffix };
final List<File> files = FileSearchExtensions.findFiles(filePath, suffix);
final int fileCount = files.size();
for (int i = 0; i < fileCount; i++)
{
DeleteFileExtensions.deleteFile(files.get(i));
}
}
|
java
|
public static void deleteAllFilesWithSuffix(final File file, final String theSuffix)
throws IOException
{
final String filePath = file.getAbsolutePath();
final String suffix[] = { theSuffix };
final List<File> files = FileSearchExtensions.findFiles(filePath, suffix);
final int fileCount = files.size();
for (int i = 0; i < fileCount; i++)
{
DeleteFileExtensions.deleteFile(files.get(i));
}
}
|
[
"public",
"static",
"void",
"deleteAllFilesWithSuffix",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"theSuffix",
")",
"throws",
"IOException",
"{",
"final",
"String",
"filePath",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"final",
"String",
"suffix",
"[",
"]",
"=",
"{",
"theSuffix",
"}",
";",
"final",
"List",
"<",
"File",
">",
"files",
"=",
"FileSearchExtensions",
".",
"findFiles",
"(",
"filePath",
",",
"suffix",
")",
";",
"final",
"int",
"fileCount",
"=",
"files",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fileCount",
";",
"i",
"++",
")",
"{",
"DeleteFileExtensions",
".",
"deleteFile",
"(",
"files",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"}"
] |
Deletes all files with the given suffix recursively.
@param file
The directory from where to delete the files wiht the given suffix.
@param theSuffix
The suffix from the files to delete.
@throws IOException
Signals that an I/O exception has occurred.
|
[
"Deletes",
"all",
"files",
"with",
"the",
"given",
"suffix",
"recursively",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java#L184-L195
|
153,608
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java
|
DeleteFileExtensions.deleteFiles
|
public static void deleteFiles(final File file) throws IOException
{
final File[] ff = file.listFiles();
if (ff != null)
{
for (final File f : ff)
{
DeleteFileExtensions.delete(f);
}
}
}
|
java
|
public static void deleteFiles(final File file) throws IOException
{
final File[] ff = file.listFiles();
if (ff != null)
{
for (final File f : ff)
{
DeleteFileExtensions.delete(f);
}
}
}
|
[
"public",
"static",
"void",
"deleteFiles",
"(",
"final",
"File",
"file",
")",
"throws",
"IOException",
"{",
"final",
"File",
"[",
"]",
"ff",
"=",
"file",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"ff",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"File",
"f",
":",
"ff",
")",
"{",
"DeleteFileExtensions",
".",
"delete",
"(",
"f",
")",
";",
"}",
"}",
"}"
] |
Tries to delete all files in the Directory.
@param file
The Directory to delete files.
@throws IOException
Signals that an I/O exception has occurred.
|
[
"Tries",
"to",
"delete",
"all",
"files",
"in",
"the",
"Directory",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java#L220-L230
|
153,609
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java
|
DeleteFileExtensions.deleteFilesWithFileFilter
|
public static void deleteFilesWithFileFilter(final File source,
final FileFilter includeFileFilter)
throws FileIsNotADirectoryException, IOException, FileIsSecurityRestrictedException
{
DeleteFileExtensions.deleteFilesWithFileFilter(source, includeFileFilter, null);
}
|
java
|
public static void deleteFilesWithFileFilter(final File source,
final FileFilter includeFileFilter)
throws FileIsNotADirectoryException, IOException, FileIsSecurityRestrictedException
{
DeleteFileExtensions.deleteFilesWithFileFilter(source, includeFileFilter, null);
}
|
[
"public",
"static",
"void",
"deleteFilesWithFileFilter",
"(",
"final",
"File",
"source",
",",
"final",
"FileFilter",
"includeFileFilter",
")",
"throws",
"FileIsNotADirectoryException",
",",
"IOException",
",",
"FileIsSecurityRestrictedException",
"{",
"DeleteFileExtensions",
".",
"deleteFilesWithFileFilter",
"(",
"source",
",",
"includeFileFilter",
",",
"null",
")",
";",
"}"
] |
Tries to delete all files that match to the given includeFileFilter from the given source
directory.
@param source
The source directory.
@param includeFileFilter
The FileFilter for the files to be deleted. If null all files will be deleted.
@throws FileIsNotADirectoryException
Is thrown if the destination file is a directory.
@throws IOException
Is thrown if an error occurs by reading or writing.
@throws FileIsSecurityRestrictedException
Is thrown if the source file is security restricted.
|
[
"Tries",
"to",
"delete",
"all",
"files",
"that",
"match",
"to",
"the",
"given",
"includeFileFilter",
"from",
"the",
"given",
"source",
"directory",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java#L248-L253
|
153,610
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java
|
DeleteFileExtensions.deleteFilesWithFileFilter
|
public static void deleteFilesWithFileFilter(final File source,
final FileFilter includeFileFilter, final FileFilter excludeFileFilter)
throws FileIsNotADirectoryException, IOException, FileIsSecurityRestrictedException
{
if (!source.isDirectory())
{
throw new FileIsNotADirectoryException(
"Source file '" + source.getAbsolutePath() + "' is not a directory.");
}
File[] includeFilesArray;
if (null != includeFileFilter)
{
includeFilesArray = source.listFiles(includeFileFilter);
}
else
{
includeFilesArray = source.listFiles();
}
if (null != includeFilesArray)
{
File[] excludeFilesArray = null;
List<File> excludeFilesList = null;
if (null != excludeFileFilter)
{
excludeFilesArray = source.listFiles(excludeFileFilter);
excludeFilesList = Arrays.asList(excludeFilesArray);
}
// if excludeFilesList is not null and not empty
if (null != excludeFilesList && !excludeFilesList.isEmpty())
{
for (final File element : includeFilesArray)
{
final File currentFile = element;
// if the excludeFilesList does not contain the current file do copy...
if (!excludeFilesList.contains(currentFile))
{
if (currentFile.isDirectory())
{
// delete directory recursive...
deleteFilesWithFileFilter(currentFile, includeFileFilter,
excludeFileFilter);
}
else
{ // delete file
deleteFile(currentFile);
}
} // otherwise do not delete the current file...
}
}
else
{ // otherwise delete all files and directories
for (final File currentFile : includeFilesArray)
{
if (currentFile.isDirectory())
{
// delete directory recursive...
deleteFilesWithFileFilter(currentFile, includeFileFilter,
excludeFileFilter);
}
else
{ // delete file
deleteFile(currentFile);
}
}
}
}
else
{
throw new FileIsSecurityRestrictedException(
"File '" + source.getAbsolutePath() + "' is security restricted.");
}
}
|
java
|
public static void deleteFilesWithFileFilter(final File source,
final FileFilter includeFileFilter, final FileFilter excludeFileFilter)
throws FileIsNotADirectoryException, IOException, FileIsSecurityRestrictedException
{
if (!source.isDirectory())
{
throw new FileIsNotADirectoryException(
"Source file '" + source.getAbsolutePath() + "' is not a directory.");
}
File[] includeFilesArray;
if (null != includeFileFilter)
{
includeFilesArray = source.listFiles(includeFileFilter);
}
else
{
includeFilesArray = source.listFiles();
}
if (null != includeFilesArray)
{
File[] excludeFilesArray = null;
List<File> excludeFilesList = null;
if (null != excludeFileFilter)
{
excludeFilesArray = source.listFiles(excludeFileFilter);
excludeFilesList = Arrays.asList(excludeFilesArray);
}
// if excludeFilesList is not null and not empty
if (null != excludeFilesList && !excludeFilesList.isEmpty())
{
for (final File element : includeFilesArray)
{
final File currentFile = element;
// if the excludeFilesList does not contain the current file do copy...
if (!excludeFilesList.contains(currentFile))
{
if (currentFile.isDirectory())
{
// delete directory recursive...
deleteFilesWithFileFilter(currentFile, includeFileFilter,
excludeFileFilter);
}
else
{ // delete file
deleteFile(currentFile);
}
} // otherwise do not delete the current file...
}
}
else
{ // otherwise delete all files and directories
for (final File currentFile : includeFilesArray)
{
if (currentFile.isDirectory())
{
// delete directory recursive...
deleteFilesWithFileFilter(currentFile, includeFileFilter,
excludeFileFilter);
}
else
{ // delete file
deleteFile(currentFile);
}
}
}
}
else
{
throw new FileIsSecurityRestrictedException(
"File '" + source.getAbsolutePath() + "' is security restricted.");
}
}
|
[
"public",
"static",
"void",
"deleteFilesWithFileFilter",
"(",
"final",
"File",
"source",
",",
"final",
"FileFilter",
"includeFileFilter",
",",
"final",
"FileFilter",
"excludeFileFilter",
")",
"throws",
"FileIsNotADirectoryException",
",",
"IOException",
",",
"FileIsSecurityRestrictedException",
"{",
"if",
"(",
"!",
"source",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"FileIsNotADirectoryException",
"(",
"\"Source file '\"",
"+",
"source",
".",
"getAbsolutePath",
"(",
")",
"+",
"\"' is not a directory.\"",
")",
";",
"}",
"File",
"[",
"]",
"includeFilesArray",
";",
"if",
"(",
"null",
"!=",
"includeFileFilter",
")",
"{",
"includeFilesArray",
"=",
"source",
".",
"listFiles",
"(",
"includeFileFilter",
")",
";",
"}",
"else",
"{",
"includeFilesArray",
"=",
"source",
".",
"listFiles",
"(",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"includeFilesArray",
")",
"{",
"File",
"[",
"]",
"excludeFilesArray",
"=",
"null",
";",
"List",
"<",
"File",
">",
"excludeFilesList",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"excludeFileFilter",
")",
"{",
"excludeFilesArray",
"=",
"source",
".",
"listFiles",
"(",
"excludeFileFilter",
")",
";",
"excludeFilesList",
"=",
"Arrays",
".",
"asList",
"(",
"excludeFilesArray",
")",
";",
"}",
"// if excludeFilesList is not null and not empty",
"if",
"(",
"null",
"!=",
"excludeFilesList",
"&&",
"!",
"excludeFilesList",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"final",
"File",
"element",
":",
"includeFilesArray",
")",
"{",
"final",
"File",
"currentFile",
"=",
"element",
";",
"// if the excludeFilesList does not contain the current file do copy...",
"if",
"(",
"!",
"excludeFilesList",
".",
"contains",
"(",
"currentFile",
")",
")",
"{",
"if",
"(",
"currentFile",
".",
"isDirectory",
"(",
")",
")",
"{",
"// delete directory recursive...",
"deleteFilesWithFileFilter",
"(",
"currentFile",
",",
"includeFileFilter",
",",
"excludeFileFilter",
")",
";",
"}",
"else",
"{",
"// delete file",
"deleteFile",
"(",
"currentFile",
")",
";",
"}",
"}",
"// otherwise do not delete the current file...",
"}",
"}",
"else",
"{",
"// otherwise delete all files and directories",
"for",
"(",
"final",
"File",
"currentFile",
":",
"includeFilesArray",
")",
"{",
"if",
"(",
"currentFile",
".",
"isDirectory",
"(",
")",
")",
"{",
"// delete directory recursive...",
"deleteFilesWithFileFilter",
"(",
"currentFile",
",",
"includeFileFilter",
",",
"excludeFileFilter",
")",
";",
"}",
"else",
"{",
"// delete file",
"deleteFile",
"(",
"currentFile",
")",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"throw",
"new",
"FileIsSecurityRestrictedException",
"(",
"\"File '\"",
"+",
"source",
".",
"getAbsolutePath",
"(",
")",
"+",
"\"' is security restricted.\"",
")",
";",
"}",
"}"
] |
Tries to delete all files that match to the given includeFileFilter and does not delete the
files that match the excludeFileFilter from the given source directory.
@param source
The source directory.
@param includeFileFilter
The FileFilter for the files to be deleted. If null all files will be deleted.
@param excludeFileFilter
The FileFilter for the files to be not deleted. If null no files will be excluded
by delete process.
@throws FileIsNotADirectoryException
Is thrown if the destination file is a directory.
@throws IOException
Is thrown if an error occurs by reading or writing.
@throws FileIsSecurityRestrictedException
Is thrown if the source file is security restricted.
|
[
"Tries",
"to",
"delete",
"all",
"files",
"that",
"match",
"to",
"the",
"given",
"includeFileFilter",
"and",
"does",
"not",
"delete",
"the",
"files",
"that",
"match",
"the",
"excludeFileFilter",
"from",
"the",
"given",
"source",
"directory",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java#L274-L347
|
153,611
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java
|
DeleteFileExtensions.deleteFilesWithFilenameFilter
|
public static void deleteFilesWithFilenameFilter(final File source,
final FilenameFilter includeFilenameFilter)
throws FileIsNotADirectoryException, IOException, FileIsSecurityRestrictedException
{
DeleteFileExtensions.deleteFilesWithFilenameFilter(source, includeFilenameFilter, null);
}
|
java
|
public static void deleteFilesWithFilenameFilter(final File source,
final FilenameFilter includeFilenameFilter)
throws FileIsNotADirectoryException, IOException, FileIsSecurityRestrictedException
{
DeleteFileExtensions.deleteFilesWithFilenameFilter(source, includeFilenameFilter, null);
}
|
[
"public",
"static",
"void",
"deleteFilesWithFilenameFilter",
"(",
"final",
"File",
"source",
",",
"final",
"FilenameFilter",
"includeFilenameFilter",
")",
"throws",
"FileIsNotADirectoryException",
",",
"IOException",
",",
"FileIsSecurityRestrictedException",
"{",
"DeleteFileExtensions",
".",
"deleteFilesWithFilenameFilter",
"(",
"source",
",",
"includeFilenameFilter",
",",
"null",
")",
";",
"}"
] |
Tries to delete all files that match to the given includeFilenameFilter from the given source
directory.
@param source
The source directory.
@param includeFilenameFilter
The FilenameFilter for the files to be deleted. If null all files will be deleted.
@throws FileIsNotADirectoryException
Is thrown if the destination file is a directory.
@throws IOException
Is thrown if an error occurs by reading or writing.
@throws FileIsSecurityRestrictedException
Is thrown if the source file is security restricted.
|
[
"Tries",
"to",
"delete",
"all",
"files",
"that",
"match",
"to",
"the",
"given",
"includeFilenameFilter",
"from",
"the",
"given",
"source",
"directory",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java#L365-L370
|
153,612
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java
|
DeleteFileExtensions.deleteFilesWithFilenameFilter
|
public static void deleteFilesWithFilenameFilter(final File source,
final FilenameFilter includeFilenameFilter, final FilenameFilter excludeFilenameFilter)
throws FileIsNotADirectoryException, IOException, FileIsSecurityRestrictedException
{
if (!source.isDirectory())
{
throw new FileIsNotADirectoryException(
"Source file '" + source.getAbsolutePath() + "' is not a directory.");
}
File[] includeFilesArray;
if (null != includeFilenameFilter)
{
includeFilesArray = source.listFiles(includeFilenameFilter);
}
else
{
includeFilesArray = source.listFiles();
}
if (null != includeFilesArray)
{
File[] excludeFilesArray = null;
List<File> excludeFilesList = null;
if (null != excludeFilenameFilter)
{
excludeFilesArray = source.listFiles(excludeFilenameFilter);
excludeFilesList = Arrays.asList(excludeFilesArray);
}
// if excludeFilesList is not null and not empty
if (null != excludeFilesList && !excludeFilesList.isEmpty())
{
for (final File element : includeFilesArray)
{
final File currentFile = element;
// if the excludeFilesList does not contain the current file do copy...
if (!excludeFilesList.contains(currentFile))
{
if (currentFile.isDirectory())
{
// delete directory recursive...
deleteFilesWithFilenameFilter(currentFile, includeFilenameFilter,
excludeFilenameFilter);
}
else
{ // delete file
deleteFile(currentFile);
}
} // otherwise do not delete the current file...
}
}
else
{ // otherwise delete all files and directories
for (final File currentFile : includeFilesArray)
{
if (currentFile.isDirectory())
{
// delete directory recursive...
deleteFilesWithFilenameFilter(currentFile, includeFilenameFilter,
excludeFilenameFilter);
}
else
{ // delete file
deleteFile(currentFile);
}
}
}
}
else
{
throw new FileIsSecurityRestrictedException(
"File '" + source.getAbsolutePath() + "' is security restricted.");
}
}
|
java
|
public static void deleteFilesWithFilenameFilter(final File source,
final FilenameFilter includeFilenameFilter, final FilenameFilter excludeFilenameFilter)
throws FileIsNotADirectoryException, IOException, FileIsSecurityRestrictedException
{
if (!source.isDirectory())
{
throw new FileIsNotADirectoryException(
"Source file '" + source.getAbsolutePath() + "' is not a directory.");
}
File[] includeFilesArray;
if (null != includeFilenameFilter)
{
includeFilesArray = source.listFiles(includeFilenameFilter);
}
else
{
includeFilesArray = source.listFiles();
}
if (null != includeFilesArray)
{
File[] excludeFilesArray = null;
List<File> excludeFilesList = null;
if (null != excludeFilenameFilter)
{
excludeFilesArray = source.listFiles(excludeFilenameFilter);
excludeFilesList = Arrays.asList(excludeFilesArray);
}
// if excludeFilesList is not null and not empty
if (null != excludeFilesList && !excludeFilesList.isEmpty())
{
for (final File element : includeFilesArray)
{
final File currentFile = element;
// if the excludeFilesList does not contain the current file do copy...
if (!excludeFilesList.contains(currentFile))
{
if (currentFile.isDirectory())
{
// delete directory recursive...
deleteFilesWithFilenameFilter(currentFile, includeFilenameFilter,
excludeFilenameFilter);
}
else
{ // delete file
deleteFile(currentFile);
}
} // otherwise do not delete the current file...
}
}
else
{ // otherwise delete all files and directories
for (final File currentFile : includeFilesArray)
{
if (currentFile.isDirectory())
{
// delete directory recursive...
deleteFilesWithFilenameFilter(currentFile, includeFilenameFilter,
excludeFilenameFilter);
}
else
{ // delete file
deleteFile(currentFile);
}
}
}
}
else
{
throw new FileIsSecurityRestrictedException(
"File '" + source.getAbsolutePath() + "' is security restricted.");
}
}
|
[
"public",
"static",
"void",
"deleteFilesWithFilenameFilter",
"(",
"final",
"File",
"source",
",",
"final",
"FilenameFilter",
"includeFilenameFilter",
",",
"final",
"FilenameFilter",
"excludeFilenameFilter",
")",
"throws",
"FileIsNotADirectoryException",
",",
"IOException",
",",
"FileIsSecurityRestrictedException",
"{",
"if",
"(",
"!",
"source",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"FileIsNotADirectoryException",
"(",
"\"Source file '\"",
"+",
"source",
".",
"getAbsolutePath",
"(",
")",
"+",
"\"' is not a directory.\"",
")",
";",
"}",
"File",
"[",
"]",
"includeFilesArray",
";",
"if",
"(",
"null",
"!=",
"includeFilenameFilter",
")",
"{",
"includeFilesArray",
"=",
"source",
".",
"listFiles",
"(",
"includeFilenameFilter",
")",
";",
"}",
"else",
"{",
"includeFilesArray",
"=",
"source",
".",
"listFiles",
"(",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"includeFilesArray",
")",
"{",
"File",
"[",
"]",
"excludeFilesArray",
"=",
"null",
";",
"List",
"<",
"File",
">",
"excludeFilesList",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"excludeFilenameFilter",
")",
"{",
"excludeFilesArray",
"=",
"source",
".",
"listFiles",
"(",
"excludeFilenameFilter",
")",
";",
"excludeFilesList",
"=",
"Arrays",
".",
"asList",
"(",
"excludeFilesArray",
")",
";",
"}",
"// if excludeFilesList is not null and not empty",
"if",
"(",
"null",
"!=",
"excludeFilesList",
"&&",
"!",
"excludeFilesList",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"final",
"File",
"element",
":",
"includeFilesArray",
")",
"{",
"final",
"File",
"currentFile",
"=",
"element",
";",
"// if the excludeFilesList does not contain the current file do copy...",
"if",
"(",
"!",
"excludeFilesList",
".",
"contains",
"(",
"currentFile",
")",
")",
"{",
"if",
"(",
"currentFile",
".",
"isDirectory",
"(",
")",
")",
"{",
"// delete directory recursive...",
"deleteFilesWithFilenameFilter",
"(",
"currentFile",
",",
"includeFilenameFilter",
",",
"excludeFilenameFilter",
")",
";",
"}",
"else",
"{",
"// delete file",
"deleteFile",
"(",
"currentFile",
")",
";",
"}",
"}",
"// otherwise do not delete the current file...",
"}",
"}",
"else",
"{",
"// otherwise delete all files and directories",
"for",
"(",
"final",
"File",
"currentFile",
":",
"includeFilesArray",
")",
"{",
"if",
"(",
"currentFile",
".",
"isDirectory",
"(",
")",
")",
"{",
"// delete directory recursive...",
"deleteFilesWithFilenameFilter",
"(",
"currentFile",
",",
"includeFilenameFilter",
",",
"excludeFilenameFilter",
")",
";",
"}",
"else",
"{",
"// delete file",
"deleteFile",
"(",
"currentFile",
")",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"throw",
"new",
"FileIsSecurityRestrictedException",
"(",
"\"File '\"",
"+",
"source",
".",
"getAbsolutePath",
"(",
")",
"+",
"\"' is security restricted.\"",
")",
";",
"}",
"}"
] |
Tries to delete all files that match to the given includeFilenameFilter and does not delete
the files that match the excludeFilenameFilter from the given source directory.
@param source
The source directory.
@param includeFilenameFilter
The FilenameFilter for the files to be deleted. If null all files will be deleted.
@param excludeFilenameFilter
The FilenameFilter for the files to be not deleted. If null no files will be
excluded by delete process.
@throws FileIsNotADirectoryException
Is thrown if the destination file is a directory.
@throws IOException
Is thrown if an error occurs by reading or writing.
@throws FileIsSecurityRestrictedException
Is thrown if the source file is security restricted.
|
[
"Tries",
"to",
"delete",
"all",
"files",
"that",
"match",
"to",
"the",
"given",
"includeFilenameFilter",
"and",
"does",
"not",
"delete",
"the",
"files",
"that",
"match",
"the",
"excludeFilenameFilter",
"from",
"the",
"given",
"source",
"directory",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/delete/DeleteFileExtensions.java#L391-L464
|
153,613
|
incodehq-legacy/incode-module-base
|
dom/src/main/java/org/incode/module/base/dom/valuetypes/AbstractInterval.java
|
AbstractInterval.contains
|
public boolean contains(final LocalDate date) {
if (date == null){
return false;
}
if (endDate() == null) {
if (startDate() == null) {
return true;
}
if (date.isEqual(startDate()) || date.isAfter(startDate())) {
return true;
}
return false;
}
return asInterval().contains(date.toInterval());
}
|
java
|
public boolean contains(final LocalDate date) {
if (date == null){
return false;
}
if (endDate() == null) {
if (startDate() == null) {
return true;
}
if (date.isEqual(startDate()) || date.isAfter(startDate())) {
return true;
}
return false;
}
return asInterval().contains(date.toInterval());
}
|
[
"public",
"boolean",
"contains",
"(",
"final",
"LocalDate",
"date",
")",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"endDate",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"startDate",
"(",
")",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"date",
".",
"isEqual",
"(",
"startDate",
"(",
")",
")",
"||",
"date",
".",
"isAfter",
"(",
"startDate",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"return",
"asInterval",
"(",
")",
".",
"contains",
"(",
"date",
".",
"toInterval",
"(",
")",
")",
";",
"}"
] |
Does this date contain the specified time interval.
@param date
@return
|
[
"Does",
"this",
"date",
"contain",
"the",
"specified",
"time",
"interval",
"."
] |
8dfbf946c26423adf6d3e751698968b035c4ef11
|
https://github.com/incodehq-legacy/incode-module-base/blob/8dfbf946c26423adf6d3e751698968b035c4ef11/dom/src/main/java/org/incode/module/base/dom/valuetypes/AbstractInterval.java#L106-L120
|
153,614
|
incodehq-legacy/incode-module-base
|
dom/src/main/java/org/incode/module/base/dom/valuetypes/AbstractInterval.java
|
AbstractInterval.days
|
public int days() {
if (isInfinite()) {
return 0;
}
Period p = new Period(asInterval(), PeriodType.days());
return p.getDays();
}
|
java
|
public int days() {
if (isInfinite()) {
return 0;
}
Period p = new Period(asInterval(), PeriodType.days());
return p.getDays();
}
|
[
"public",
"int",
"days",
"(",
")",
"{",
"if",
"(",
"isInfinite",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"Period",
"p",
"=",
"new",
"Period",
"(",
"asInterval",
"(",
")",
",",
"PeriodType",
".",
"days",
"(",
")",
")",
";",
"return",
"p",
".",
"getDays",
"(",
")",
";",
"}"
] |
The duration in days
@return
|
[
"The",
"duration",
"in",
"days"
] |
8dfbf946c26423adf6d3e751698968b035c4ef11
|
https://github.com/incodehq-legacy/incode-module-base/blob/8dfbf946c26423adf6d3e751698968b035c4ef11/dom/src/main/java/org/incode/module/base/dom/valuetypes/AbstractInterval.java#L137-L143
|
153,615
|
incodehq-legacy/incode-module-base
|
dom/src/main/java/org/incode/module/base/dom/valuetypes/AbstractInterval.java
|
AbstractInterval.dateToString
|
protected String dateToString(LocalDate localDate, String format) {
return localDate == null ? "----------" : localDate.toString(format);
}
|
java
|
protected String dateToString(LocalDate localDate, String format) {
return localDate == null ? "----------" : localDate.toString(format);
}
|
[
"protected",
"String",
"dateToString",
"(",
"LocalDate",
"localDate",
",",
"String",
"format",
")",
"{",
"return",
"localDate",
"==",
"null",
"?",
"\"----------\"",
":",
"localDate",
".",
"toString",
"(",
"format",
")",
";",
"}"
] |
For benefit of subclass toString implementations.
|
[
"For",
"benefit",
"of",
"subclass",
"toString",
"implementations",
"."
] |
8dfbf946c26423adf6d3e751698968b035c4ef11
|
https://github.com/incodehq-legacy/incode-module-base/blob/8dfbf946c26423adf6d3e751698968b035c4ef11/dom/src/main/java/org/incode/module/base/dom/valuetypes/AbstractInterval.java#L179-L181
|
153,616
|
incodehq-legacy/incode-module-base
|
dom/src/main/java/org/incode/module/base/dom/valuetypes/AbstractInterval.java
|
AbstractInterval.overlap
|
@SuppressWarnings("unchecked")
public T overlap(final T otherInterval) {
if (otherInterval == null) {
return null;
}
if (otherInterval.isInfinite()) {
return (T)this;
}
if (this.isInfinite()) {
return otherInterval;
}
final Interval thisAsInterval = asInterval();
final Interval otherAsInterval = otherInterval.asInterval();
Interval overlap = thisAsInterval.overlap(otherAsInterval);
if (overlap == null) {
return null;
}
return newInterval(overlap);
}
|
java
|
@SuppressWarnings("unchecked")
public T overlap(final T otherInterval) {
if (otherInterval == null) {
return null;
}
if (otherInterval.isInfinite()) {
return (T)this;
}
if (this.isInfinite()) {
return otherInterval;
}
final Interval thisAsInterval = asInterval();
final Interval otherAsInterval = otherInterval.asInterval();
Interval overlap = thisAsInterval.overlap(otherAsInterval);
if (overlap == null) {
return null;
}
return newInterval(overlap);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"overlap",
"(",
"final",
"T",
"otherInterval",
")",
"{",
"if",
"(",
"otherInterval",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"otherInterval",
".",
"isInfinite",
"(",
")",
")",
"{",
"return",
"(",
"T",
")",
"this",
";",
"}",
"if",
"(",
"this",
".",
"isInfinite",
"(",
")",
")",
"{",
"return",
"otherInterval",
";",
"}",
"final",
"Interval",
"thisAsInterval",
"=",
"asInterval",
"(",
")",
";",
"final",
"Interval",
"otherAsInterval",
"=",
"otherInterval",
".",
"asInterval",
"(",
")",
";",
"Interval",
"overlap",
"=",
"thisAsInterval",
".",
"overlap",
"(",
"otherAsInterval",
")",
";",
"if",
"(",
"overlap",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"newInterval",
"(",
"overlap",
")",
";",
"}"
] |
Gets the overlap between this interval and another interval.
@param otherInterval
@return
|
[
"Gets",
"the",
"overlap",
"between",
"this",
"interval",
"and",
"another",
"interval",
"."
] |
8dfbf946c26423adf6d3e751698968b035c4ef11
|
https://github.com/incodehq-legacy/incode-module-base/blob/8dfbf946c26423adf6d3e751698968b035c4ef11/dom/src/main/java/org/incode/module/base/dom/valuetypes/AbstractInterval.java#L189-L207
|
153,617
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/navi/ElasticChain.java
|
ElasticChain.horizontalForce
|
public double horizontalForce(Double T, double d)
{
return AE*Math.sqrt(Math.pow(T/AE+1, 2)-2*w*d/AE)-AE;
}
|
java
|
public double horizontalForce(Double T, double d)
{
return AE*Math.sqrt(Math.pow(T/AE+1, 2)-2*w*d/AE)-AE;
}
|
[
"public",
"double",
"horizontalForce",
"(",
"Double",
"T",
",",
"double",
"d",
")",
"{",
"return",
"AE",
"*",
"Math",
".",
"sqrt",
"(",
"Math",
".",
"pow",
"(",
"T",
"/",
"AE",
"+",
"1",
",",
"2",
")",
"-",
"2",
"*",
"w",
"*",
"d",
"/",
"AE",
")",
"-",
"AE",
";",
"}"
] |
Horizontal force for a given fairlead tension T
@param T Fairlead tension
@param d depth
@return
|
[
"Horizontal",
"force",
"for",
"a",
"given",
"fairlead",
"tension",
"T"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/ElasticChain.java#L50-L53
|
153,618
|
jbundle/jbundle
|
base/model/src/main/java/org/jbundle/base/model/Resources.java
|
Resources.getKey
|
public String getKey(String strValue)
{
for (String key : m_resourceBundle.keySet())
{
String strKeyValue = m_resourceBundle.getString(key);
if (strValue.startsWith(strKeyValue))
return key;
}
return strValue; // Can't find it, try the value
}
|
java
|
public String getKey(String strValue)
{
for (String key : m_resourceBundle.keySet())
{
String strKeyValue = m_resourceBundle.getString(key);
if (strValue.startsWith(strKeyValue))
return key;
}
return strValue; // Can't find it, try the value
}
|
[
"public",
"String",
"getKey",
"(",
"String",
"strValue",
")",
"{",
"for",
"(",
"String",
"key",
":",
"m_resourceBundle",
".",
"keySet",
"(",
")",
")",
"{",
"String",
"strKeyValue",
"=",
"m_resourceBundle",
".",
"getString",
"(",
"key",
")",
";",
"if",
"(",
"strValue",
".",
"startsWith",
"(",
"strKeyValue",
")",
")",
"return",
"key",
";",
"}",
"return",
"strValue",
";",
"// Can't find it, try the value",
"}"
] |
From the value, find the key.
Does a reverse-lookup for the key from this value.
This is useful for foreign-language buttons that do a command using their english name.
@param strValue The value to search for.
@returns The key associated with this value (or this value if not found).
|
[
"From",
"the",
"value",
"find",
"the",
"key",
".",
"Does",
"a",
"reverse",
"-",
"lookup",
"for",
"the",
"key",
"from",
"this",
"value",
".",
"This",
"is",
"useful",
"for",
"foreign",
"-",
"language",
"buttons",
"that",
"do",
"a",
"command",
"using",
"their",
"english",
"name",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Resources.java#L110-L119
|
153,619
|
jkyamog/DeDS
|
mobile-dds/src/main/java/nz/net/catalyst/mobile/dds/RequestInfo.java
|
RequestInfo.getRequestInfo
|
public static RequestInfo getRequestInfo(HttpServletRequest request) {
RequestInfo requestInfo = (RequestInfo) request.getAttribute(REQUEST_INFO);
if (requestInfo == null) {
requestInfo = new RequestInfo(request);
request.setAttribute(REQUEST_INFO, requestInfo);
}
return requestInfo;
}
|
java
|
public static RequestInfo getRequestInfo(HttpServletRequest request) {
RequestInfo requestInfo = (RequestInfo) request.getAttribute(REQUEST_INFO);
if (requestInfo == null) {
requestInfo = new RequestInfo(request);
request.setAttribute(REQUEST_INFO, requestInfo);
}
return requestInfo;
}
|
[
"public",
"static",
"RequestInfo",
"getRequestInfo",
"(",
"HttpServletRequest",
"request",
")",
"{",
"RequestInfo",
"requestInfo",
"=",
"(",
"RequestInfo",
")",
"request",
".",
"getAttribute",
"(",
"REQUEST_INFO",
")",
";",
"if",
"(",
"requestInfo",
"==",
"null",
")",
"{",
"requestInfo",
"=",
"new",
"RequestInfo",
"(",
"request",
")",
";",
"request",
".",
"setAttribute",
"(",
"REQUEST_INFO",
",",
"requestInfo",
")",
";",
"}",
"return",
"requestInfo",
";",
"}"
] |
this either creates a new RequestInfo or gets the cached instance from the
reqeust
@param request
@return
|
[
"this",
"either",
"creates",
"a",
"new",
"RequestInfo",
"or",
"gets",
"the",
"cached",
"instance",
"from",
"the",
"reqeust"
] |
d8cf6a294a23daa8e8a92073827c73b1befe3fa1
|
https://github.com/jkyamog/DeDS/blob/d8cf6a294a23daa8e8a92073827c73b1befe3fa1/mobile-dds/src/main/java/nz/net/catalyst/mobile/dds/RequestInfo.java#L83-L91
|
153,620
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/message/event/ModelMessageHandler.java
|
ModelMessageHandler.handleMessage
|
public int handleMessage(BaseMessage message)
{
Map<String,Object> properties = new HashMap<String,Object>();
String strMessageType = (String)message.get(MessageConstants.MESSAGE_TYPE_PARAM);
String strStartIndex = (String)message.get(START_INDEX_PARAM);
String strEndIndex = (String)message.get(END_INDEX_PARAM);
if (strMessageType != null)
properties.put(MessageConstants.MESSAGE_TYPE_PARAM, strMessageType);
if (strStartIndex != null)
properties.put(START_INDEX_PARAM, strStartIndex);
if (strEndIndex != null)
properties.put(END_INDEX_PARAM, strEndIndex);
Map<String,Object> propertiesHdr = null;
if (message.getMessageHeader() != null)
propertiesHdr = message.getMessageHeader().getProperties();
if (propertiesHdr != null)
properties.putAll(propertiesHdr); // Merge them to simplify access
if (properties != null)
{
strMessageType = (String)properties.get(MessageConstants.MESSAGE_TYPE_PARAM);
try {
int iMessageType = Integer.parseInt(strMessageType);
if ((Constants.AFTER_ADD_TYPE == iMessageType)
|| (Constants.AFTER_DELETE_TYPE == iMessageType)
|| (Constants.AFTER_UPDATE_TYPE == iMessageType))
{
SwingUtilities.invokeLater(new UpdateGridTable(properties));
}
} catch (NumberFormatException ex) {
// Ignore
}
}
return super.handleMessage(message);
}
|
java
|
public int handleMessage(BaseMessage message)
{
Map<String,Object> properties = new HashMap<String,Object>();
String strMessageType = (String)message.get(MessageConstants.MESSAGE_TYPE_PARAM);
String strStartIndex = (String)message.get(START_INDEX_PARAM);
String strEndIndex = (String)message.get(END_INDEX_PARAM);
if (strMessageType != null)
properties.put(MessageConstants.MESSAGE_TYPE_PARAM, strMessageType);
if (strStartIndex != null)
properties.put(START_INDEX_PARAM, strStartIndex);
if (strEndIndex != null)
properties.put(END_INDEX_PARAM, strEndIndex);
Map<String,Object> propertiesHdr = null;
if (message.getMessageHeader() != null)
propertiesHdr = message.getMessageHeader().getProperties();
if (propertiesHdr != null)
properties.putAll(propertiesHdr); // Merge them to simplify access
if (properties != null)
{
strMessageType = (String)properties.get(MessageConstants.MESSAGE_TYPE_PARAM);
try {
int iMessageType = Integer.parseInt(strMessageType);
if ((Constants.AFTER_ADD_TYPE == iMessageType)
|| (Constants.AFTER_DELETE_TYPE == iMessageType)
|| (Constants.AFTER_UPDATE_TYPE == iMessageType))
{
SwingUtilities.invokeLater(new UpdateGridTable(properties));
}
} catch (NumberFormatException ex) {
// Ignore
}
}
return super.handleMessage(message);
}
|
[
"public",
"int",
"handleMessage",
"(",
"BaseMessage",
"message",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"String",
"strMessageType",
"=",
"(",
"String",
")",
"message",
".",
"get",
"(",
"MessageConstants",
".",
"MESSAGE_TYPE_PARAM",
")",
";",
"String",
"strStartIndex",
"=",
"(",
"String",
")",
"message",
".",
"get",
"(",
"START_INDEX_PARAM",
")",
";",
"String",
"strEndIndex",
"=",
"(",
"String",
")",
"message",
".",
"get",
"(",
"END_INDEX_PARAM",
")",
";",
"if",
"(",
"strMessageType",
"!=",
"null",
")",
"properties",
".",
"put",
"(",
"MessageConstants",
".",
"MESSAGE_TYPE_PARAM",
",",
"strMessageType",
")",
";",
"if",
"(",
"strStartIndex",
"!=",
"null",
")",
"properties",
".",
"put",
"(",
"START_INDEX_PARAM",
",",
"strStartIndex",
")",
";",
"if",
"(",
"strEndIndex",
"!=",
"null",
")",
"properties",
".",
"put",
"(",
"END_INDEX_PARAM",
",",
"strEndIndex",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"propertiesHdr",
"=",
"null",
";",
"if",
"(",
"message",
".",
"getMessageHeader",
"(",
")",
"!=",
"null",
")",
"propertiesHdr",
"=",
"message",
".",
"getMessageHeader",
"(",
")",
".",
"getProperties",
"(",
")",
";",
"if",
"(",
"propertiesHdr",
"!=",
"null",
")",
"properties",
".",
"putAll",
"(",
"propertiesHdr",
")",
";",
"// Merge them to simplify access",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"strMessageType",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"MessageConstants",
".",
"MESSAGE_TYPE_PARAM",
")",
";",
"try",
"{",
"int",
"iMessageType",
"=",
"Integer",
".",
"parseInt",
"(",
"strMessageType",
")",
";",
"if",
"(",
"(",
"Constants",
".",
"AFTER_ADD_TYPE",
"==",
"iMessageType",
")",
"||",
"(",
"Constants",
".",
"AFTER_DELETE_TYPE",
"==",
"iMessageType",
")",
"||",
"(",
"Constants",
".",
"AFTER_UPDATE_TYPE",
"==",
"iMessageType",
")",
")",
"{",
"SwingUtilities",
".",
"invokeLater",
"(",
"new",
"UpdateGridTable",
"(",
"properties",
")",
")",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"// Ignore",
"}",
"}",
"return",
"super",
".",
"handleMessage",
"(",
"message",
")",
";",
"}"
] |
Handle this message.
Update the model depending of the message.
@param message The message to handle.
|
[
"Handle",
"this",
"message",
".",
"Update",
"the",
"model",
"depending",
"of",
"the",
"message",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/message/event/ModelMessageHandler.java#L92-L125
|
153,621
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java
|
ClassInfo.getLink
|
public String getLink()
{
String strType = this.getField(ClassInfo.CLASS_TYPE).getString();
String strLink = this.getField(ClassInfo.CLASS_NAME).getString();
if (this.getField(ClassInfo.CLASS_PACKAGE).getLength() > 0)
strLink = DBConstants.ROOT_PACKAGE + this.getField(ClassInfo.CLASS_PACKAGE).toString() + "." + strLink;
if (strType.equalsIgnoreCase("screen"))
strLink = HtmlConstants.SERVLET_LINK + "?screen=" + strLink;
else if (strType.equalsIgnoreCase("record"))
strLink = HtmlConstants.SERVLET_LINK + "?record=" + strLink;
return strLink;
}
|
java
|
public String getLink()
{
String strType = this.getField(ClassInfo.CLASS_TYPE).getString();
String strLink = this.getField(ClassInfo.CLASS_NAME).getString();
if (this.getField(ClassInfo.CLASS_PACKAGE).getLength() > 0)
strLink = DBConstants.ROOT_PACKAGE + this.getField(ClassInfo.CLASS_PACKAGE).toString() + "." + strLink;
if (strType.equalsIgnoreCase("screen"))
strLink = HtmlConstants.SERVLET_LINK + "?screen=" + strLink;
else if (strType.equalsIgnoreCase("record"))
strLink = HtmlConstants.SERVLET_LINK + "?record=" + strLink;
return strLink;
}
|
[
"public",
"String",
"getLink",
"(",
")",
"{",
"String",
"strType",
"=",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_TYPE",
")",
".",
"getString",
"(",
")",
";",
"String",
"strLink",
"=",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"getString",
"(",
")",
";",
"if",
"(",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_PACKAGE",
")",
".",
"getLength",
"(",
")",
">",
"0",
")",
"strLink",
"=",
"DBConstants",
".",
"ROOT_PACKAGE",
"+",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_PACKAGE",
")",
".",
"toString",
"(",
")",
"+",
"\".\"",
"+",
"strLink",
";",
"if",
"(",
"strType",
".",
"equalsIgnoreCase",
"(",
"\"screen\"",
")",
")",
"strLink",
"=",
"HtmlConstants",
".",
"SERVLET_LINK",
"+",
"\"?screen=\"",
"+",
"strLink",
";",
"else",
"if",
"(",
"strType",
".",
"equalsIgnoreCase",
"(",
"\"record\"",
")",
")",
"strLink",
"=",
"HtmlConstants",
".",
"SERVLET_LINK",
"+",
"\"?record=\"",
"+",
"strLink",
";",
"return",
"strLink",
";",
"}"
] |
Get the link that will run this class.
|
[
"Get",
"the",
"link",
"that",
"will",
"run",
"this",
"class",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java#L215-L226
|
153,622
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java
|
ClassInfo.readClassInfo
|
public ClassInfoModel readClassInfo(PropertyOwner recordOwner, String className)
{
String strParamRecord = null;
String strParamScreenType = null;
String strParamMenu = null;
String strParamHelp = null;
if (className == null)
{
strParamRecord = recordOwner.getProperty(DBParams.RECORD); // Display record
className = recordOwner.getProperty(DBParams.SCREEN); // Display screen
strParamScreenType = recordOwner.getProperty(DBParams.COMMAND); // Display record
strParamMenu = recordOwner.getProperty(DBParams.MENU); // Display record
strParamHelp = recordOwner.getProperty(DBParams.HELP); // Display record
}
if (className == null)
className = DBConstants.BLANK;
if ((className.length() == 0) || (className.equals("Screen")) || (className.equals("GridScreen")))
{
if (strParamRecord != null) if (strParamRecord.length() > 0)
className = strParamRecord; // Use desc of record class if standard screen
}
try {
this.setKeyArea(DBConstants.PRIMARY_KEY);
if (className.lastIndexOf('.') != -1)
className = className.substring(className.lastIndexOf('.') + 1);
this.getField(ClassInfo.CLASS_NAME).setString(className);
boolean bSuccess = false;
this.setKeyArea(ClassInfo.CLASS_NAME_KEY);
if (className.length() > 0)
bSuccess = this.seek("=");
if (!bSuccess)
{ // Not found, use standard screen maintenance screen
if ((strParamMenu != null) && (strParamMenu.length() > 0))
this.getField(ClassInfo.CLASS_NAME).setString("MenuScreen");
else if ((strParamRecord != null) && (strParamRecord.length() > 0))
{
if ((strParamScreenType != null) && (strParamScreenType.length() > 0) && (strParamScreenType.equalsIgnoreCase(ThinMenuConstants.FORM)))
this.getField(ClassInfo.CLASS_NAME).setString("Screen");
else
this.getField(ClassInfo.CLASS_NAME).setString("GridScreen");
}
else
this.getField(ClassInfo.CLASS_NAME).setString(strParamHelp);
if (!bSuccess)
bSuccess = this.seek("=");
}
} catch (DBException e) {
e.printStackTrace();
return null;
}
return this;
}
|
java
|
public ClassInfoModel readClassInfo(PropertyOwner recordOwner, String className)
{
String strParamRecord = null;
String strParamScreenType = null;
String strParamMenu = null;
String strParamHelp = null;
if (className == null)
{
strParamRecord = recordOwner.getProperty(DBParams.RECORD); // Display record
className = recordOwner.getProperty(DBParams.SCREEN); // Display screen
strParamScreenType = recordOwner.getProperty(DBParams.COMMAND); // Display record
strParamMenu = recordOwner.getProperty(DBParams.MENU); // Display record
strParamHelp = recordOwner.getProperty(DBParams.HELP); // Display record
}
if (className == null)
className = DBConstants.BLANK;
if ((className.length() == 0) || (className.equals("Screen")) || (className.equals("GridScreen")))
{
if (strParamRecord != null) if (strParamRecord.length() > 0)
className = strParamRecord; // Use desc of record class if standard screen
}
try {
this.setKeyArea(DBConstants.PRIMARY_KEY);
if (className.lastIndexOf('.') != -1)
className = className.substring(className.lastIndexOf('.') + 1);
this.getField(ClassInfo.CLASS_NAME).setString(className);
boolean bSuccess = false;
this.setKeyArea(ClassInfo.CLASS_NAME_KEY);
if (className.length() > 0)
bSuccess = this.seek("=");
if (!bSuccess)
{ // Not found, use standard screen maintenance screen
if ((strParamMenu != null) && (strParamMenu.length() > 0))
this.getField(ClassInfo.CLASS_NAME).setString("MenuScreen");
else if ((strParamRecord != null) && (strParamRecord.length() > 0))
{
if ((strParamScreenType != null) && (strParamScreenType.length() > 0) && (strParamScreenType.equalsIgnoreCase(ThinMenuConstants.FORM)))
this.getField(ClassInfo.CLASS_NAME).setString("Screen");
else
this.getField(ClassInfo.CLASS_NAME).setString("GridScreen");
}
else
this.getField(ClassInfo.CLASS_NAME).setString(strParamHelp);
if (!bSuccess)
bSuccess = this.seek("=");
}
} catch (DBException e) {
e.printStackTrace();
return null;
}
return this;
}
|
[
"public",
"ClassInfoModel",
"readClassInfo",
"(",
"PropertyOwner",
"recordOwner",
",",
"String",
"className",
")",
"{",
"String",
"strParamRecord",
"=",
"null",
";",
"String",
"strParamScreenType",
"=",
"null",
";",
"String",
"strParamMenu",
"=",
"null",
";",
"String",
"strParamHelp",
"=",
"null",
";",
"if",
"(",
"className",
"==",
"null",
")",
"{",
"strParamRecord",
"=",
"recordOwner",
".",
"getProperty",
"(",
"DBParams",
".",
"RECORD",
")",
";",
"// Display record",
"className",
"=",
"recordOwner",
".",
"getProperty",
"(",
"DBParams",
".",
"SCREEN",
")",
";",
"// Display screen",
"strParamScreenType",
"=",
"recordOwner",
".",
"getProperty",
"(",
"DBParams",
".",
"COMMAND",
")",
";",
"// Display record",
"strParamMenu",
"=",
"recordOwner",
".",
"getProperty",
"(",
"DBParams",
".",
"MENU",
")",
";",
"// Display record",
"strParamHelp",
"=",
"recordOwner",
".",
"getProperty",
"(",
"DBParams",
".",
"HELP",
")",
";",
"// Display record",
"}",
"if",
"(",
"className",
"==",
"null",
")",
"className",
"=",
"DBConstants",
".",
"BLANK",
";",
"if",
"(",
"(",
"className",
".",
"length",
"(",
")",
"==",
"0",
")",
"||",
"(",
"className",
".",
"equals",
"(",
"\"Screen\"",
")",
")",
"||",
"(",
"className",
".",
"equals",
"(",
"\"GridScreen\"",
")",
")",
")",
"{",
"if",
"(",
"strParamRecord",
"!=",
"null",
")",
"if",
"(",
"strParamRecord",
".",
"length",
"(",
")",
">",
"0",
")",
"className",
"=",
"strParamRecord",
";",
"// Use desc of record class if standard screen",
"}",
"try",
"{",
"this",
".",
"setKeyArea",
"(",
"DBConstants",
".",
"PRIMARY_KEY",
")",
";",
"if",
"(",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"className",
"=",
"className",
".",
"substring",
"(",
"className",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"setString",
"(",
"className",
")",
";",
"boolean",
"bSuccess",
"=",
"false",
";",
"this",
".",
"setKeyArea",
"(",
"ClassInfo",
".",
"CLASS_NAME_KEY",
")",
";",
"if",
"(",
"className",
".",
"length",
"(",
")",
">",
"0",
")",
"bSuccess",
"=",
"this",
".",
"seek",
"(",
"\"=\"",
")",
";",
"if",
"(",
"!",
"bSuccess",
")",
"{",
"// Not found, use standard screen maintenance screen",
"if",
"(",
"(",
"strParamMenu",
"!=",
"null",
")",
"&&",
"(",
"strParamMenu",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"setString",
"(",
"\"MenuScreen\"",
")",
";",
"else",
"if",
"(",
"(",
"strParamRecord",
"!=",
"null",
")",
"&&",
"(",
"strParamRecord",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"{",
"if",
"(",
"(",
"strParamScreenType",
"!=",
"null",
")",
"&&",
"(",
"strParamScreenType",
".",
"length",
"(",
")",
">",
"0",
")",
"&&",
"(",
"strParamScreenType",
".",
"equalsIgnoreCase",
"(",
"ThinMenuConstants",
".",
"FORM",
")",
")",
")",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"setString",
"(",
"\"Screen\"",
")",
";",
"else",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"setString",
"(",
"\"GridScreen\"",
")",
";",
"}",
"else",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"setString",
"(",
"strParamHelp",
")",
";",
"if",
"(",
"!",
"bSuccess",
")",
"bSuccess",
"=",
"this",
".",
"seek",
"(",
"\"=\"",
")",
";",
"}",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"null",
";",
"}",
"return",
"this",
";",
"}"
] |
Read the ClassInfoService record
@param recordOwner The record owner to use to create the this record AND to optionally get the classinfo.
@param className if non-null read this class name, if null, use the recordowner properties to figure out the class.
@param getRecord If true, read the record.
.
|
[
"Read",
"the",
"ClassInfoService",
"record"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java#L234-L288
|
153,623
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java
|
ClassInfo.getPackageName
|
public String getPackageName(ClassProject.CodeType codeType)
{
if (codeType == null)
codeType = ClassProject.CodeType.THICK;
String packageName = this.getField(ClassInfo.CLASS_PACKAGE).toString();
ClassProject classProject = (ClassProject)((ReferenceField)this.getField(ClassInfo.CLASS_PROJECT_ID)).getReference();
if (classProject != null)
if ((classProject.getEditMode() == DBConstants.EDIT_IN_PROGRESS) || (classProject.getEditMode() == DBConstants.EDIT_CURRENT))
packageName = classProject.getFullPackage(codeType, packageName);
return packageName;
}
|
java
|
public String getPackageName(ClassProject.CodeType codeType)
{
if (codeType == null)
codeType = ClassProject.CodeType.THICK;
String packageName = this.getField(ClassInfo.CLASS_PACKAGE).toString();
ClassProject classProject = (ClassProject)((ReferenceField)this.getField(ClassInfo.CLASS_PROJECT_ID)).getReference();
if (classProject != null)
if ((classProject.getEditMode() == DBConstants.EDIT_IN_PROGRESS) || (classProject.getEditMode() == DBConstants.EDIT_CURRENT))
packageName = classProject.getFullPackage(codeType, packageName);
return packageName;
}
|
[
"public",
"String",
"getPackageName",
"(",
"ClassProject",
".",
"CodeType",
"codeType",
")",
"{",
"if",
"(",
"codeType",
"==",
"null",
")",
"codeType",
"=",
"ClassProject",
".",
"CodeType",
".",
"THICK",
";",
"String",
"packageName",
"=",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_PACKAGE",
")",
".",
"toString",
"(",
")",
";",
"ClassProject",
"classProject",
"=",
"(",
"ClassProject",
")",
"(",
"(",
"ReferenceField",
")",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_PROJECT_ID",
")",
")",
".",
"getReference",
"(",
")",
";",
"if",
"(",
"classProject",
"!=",
"null",
")",
"if",
"(",
"(",
"classProject",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_IN_PROGRESS",
")",
"||",
"(",
"classProject",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_CURRENT",
")",
")",
"packageName",
"=",
"classProject",
".",
"getFullPackage",
"(",
"codeType",
",",
"packageName",
")",
";",
"return",
"packageName",
";",
"}"
] |
Get the full class name.
|
[
"Get",
"the",
"full",
"class",
"name",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java#L292-L302
|
153,624
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java
|
ClassInfo.getFullClassName
|
public String getFullClassName()
{
String className = this.getField(ClassInfo.CLASS_NAME).toString();
ClassProject classProject = (ClassProject)((ReferenceField)this.getField(ClassInfo.CLASS_PROJECT_ID)).getReference();
String packageName = classProject.getFullPackage(ClassProject.CodeType.THICK, this.getField(ClassInfo.CLASS_PACKAGE).toString());
if (!packageName.endsWith("."))
if (!className.endsWith("."))
className = "." + className;
return packageName + className;
}
|
java
|
public String getFullClassName()
{
String className = this.getField(ClassInfo.CLASS_NAME).toString();
ClassProject classProject = (ClassProject)((ReferenceField)this.getField(ClassInfo.CLASS_PROJECT_ID)).getReference();
String packageName = classProject.getFullPackage(ClassProject.CodeType.THICK, this.getField(ClassInfo.CLASS_PACKAGE).toString());
if (!packageName.endsWith("."))
if (!className.endsWith("."))
className = "." + className;
return packageName + className;
}
|
[
"public",
"String",
"getFullClassName",
"(",
")",
"{",
"String",
"className",
"=",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"toString",
"(",
")",
";",
"ClassProject",
"classProject",
"=",
"(",
"ClassProject",
")",
"(",
"(",
"ReferenceField",
")",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_PROJECT_ID",
")",
")",
".",
"getReference",
"(",
")",
";",
"String",
"packageName",
"=",
"classProject",
".",
"getFullPackage",
"(",
"ClassProject",
".",
"CodeType",
".",
"THICK",
",",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_PACKAGE",
")",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"!",
"packageName",
".",
"endsWith",
"(",
"\".\"",
")",
")",
"if",
"(",
"!",
"className",
".",
"endsWith",
"(",
"\".\"",
")",
")",
"className",
"=",
"\".\"",
"+",
"className",
";",
"return",
"packageName",
"+",
"className",
";",
"}"
] |
GetFullClassName Method.
|
[
"GetFullClassName",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java#L313-L322
|
153,625
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java
|
ClassInfo.printHtmlTechInfo
|
public void printHtmlTechInfo(PrintWriter out, String strTag, String strParams, String strData)
{
FieldData fieldInfo = new FieldData(this.findRecordOwner());
String strClass = this.getClassName();
fieldInfo.setKeyArea(FieldData.FIELD_FILE_NAME_KEY);
fieldInfo.addListener(new StringSubFileFilter(strClass, fieldInfo.getField(FieldData.FIELD_FILE_NAME), null, null, null, null));
try {
out.println("<table border=1>");
out.println("<tr>");
out.println("<th>" + fieldInfo.getField(FieldData.FIELD_NAME).getFieldDesc() + "</th>");
out.println("<th>" + fieldInfo.getField(FieldData.FIELD_CLASS).getFieldDesc() + "</th>");
out.println("<th>" + fieldInfo.getField(FieldData.BASE_FIELD_NAME).getFieldDesc() + "</th>");
out.println("<th>" + fieldInfo.getField(FieldData.MAXIMUM_LENGTH).getFieldDesc() + "</th>");
out.println("<th>" + fieldInfo.getField(FieldData.FIELD_DESCRIPTION).getFieldDesc() + "</th>");
out.println("</tr>");
while (fieldInfo.hasNext())
{
fieldInfo.next();
out.println("<tr>");
out.println("<td> " + fieldInfo.getField(FieldData.FIELD_NAME).toString() + "</td>");
out.println("<td> " + fieldInfo.getField(FieldData.FIELD_CLASS).toString() + "</td>");
out.println("<td> " + fieldInfo.getField(FieldData.BASE_FIELD_NAME).toString() + "</td>");
out.println("<td> " + fieldInfo.getField(FieldData.MAXIMUM_LENGTH).toString() + "</td>");
out.println("<td> " + fieldInfo.getField(FieldData.FIELD_DESCRIPTION).toString() + "</td>");
out.println("</tr>");
}
out.println("</table>");
} catch (DBException ex) {
ex.printStackTrace();
}
fieldInfo.free();
fieldInfo = null;
}
|
java
|
public void printHtmlTechInfo(PrintWriter out, String strTag, String strParams, String strData)
{
FieldData fieldInfo = new FieldData(this.findRecordOwner());
String strClass = this.getClassName();
fieldInfo.setKeyArea(FieldData.FIELD_FILE_NAME_KEY);
fieldInfo.addListener(new StringSubFileFilter(strClass, fieldInfo.getField(FieldData.FIELD_FILE_NAME), null, null, null, null));
try {
out.println("<table border=1>");
out.println("<tr>");
out.println("<th>" + fieldInfo.getField(FieldData.FIELD_NAME).getFieldDesc() + "</th>");
out.println("<th>" + fieldInfo.getField(FieldData.FIELD_CLASS).getFieldDesc() + "</th>");
out.println("<th>" + fieldInfo.getField(FieldData.BASE_FIELD_NAME).getFieldDesc() + "</th>");
out.println("<th>" + fieldInfo.getField(FieldData.MAXIMUM_LENGTH).getFieldDesc() + "</th>");
out.println("<th>" + fieldInfo.getField(FieldData.FIELD_DESCRIPTION).getFieldDesc() + "</th>");
out.println("</tr>");
while (fieldInfo.hasNext())
{
fieldInfo.next();
out.println("<tr>");
out.println("<td> " + fieldInfo.getField(FieldData.FIELD_NAME).toString() + "</td>");
out.println("<td> " + fieldInfo.getField(FieldData.FIELD_CLASS).toString() + "</td>");
out.println("<td> " + fieldInfo.getField(FieldData.BASE_FIELD_NAME).toString() + "</td>");
out.println("<td> " + fieldInfo.getField(FieldData.MAXIMUM_LENGTH).toString() + "</td>");
out.println("<td> " + fieldInfo.getField(FieldData.FIELD_DESCRIPTION).toString() + "</td>");
out.println("</tr>");
}
out.println("</table>");
} catch (DBException ex) {
ex.printStackTrace();
}
fieldInfo.free();
fieldInfo = null;
}
|
[
"public",
"void",
"printHtmlTechInfo",
"(",
"PrintWriter",
"out",
",",
"String",
"strTag",
",",
"String",
"strParams",
",",
"String",
"strData",
")",
"{",
"FieldData",
"fieldInfo",
"=",
"new",
"FieldData",
"(",
"this",
".",
"findRecordOwner",
"(",
")",
")",
";",
"String",
"strClass",
"=",
"this",
".",
"getClassName",
"(",
")",
";",
"fieldInfo",
".",
"setKeyArea",
"(",
"FieldData",
".",
"FIELD_FILE_NAME_KEY",
")",
";",
"fieldInfo",
".",
"addListener",
"(",
"new",
"StringSubFileFilter",
"(",
"strClass",
",",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"FIELD_FILE_NAME",
")",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
")",
")",
";",
"try",
"{",
"out",
".",
"println",
"(",
"\"<table border=1>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<tr>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<th>\"",
"+",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"FIELD_NAME",
")",
".",
"getFieldDesc",
"(",
")",
"+",
"\"</th>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<th>\"",
"+",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"FIELD_CLASS",
")",
".",
"getFieldDesc",
"(",
")",
"+",
"\"</th>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<th>\"",
"+",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"BASE_FIELD_NAME",
")",
".",
"getFieldDesc",
"(",
")",
"+",
"\"</th>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<th>\"",
"+",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"MAXIMUM_LENGTH",
")",
".",
"getFieldDesc",
"(",
")",
"+",
"\"</th>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<th>\"",
"+",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"FIELD_DESCRIPTION",
")",
".",
"getFieldDesc",
"(",
")",
"+",
"\"</th>\"",
")",
";",
"out",
".",
"println",
"(",
"\"</tr>\"",
")",
";",
"while",
"(",
"fieldInfo",
".",
"hasNext",
"(",
")",
")",
"{",
"fieldInfo",
".",
"next",
"(",
")",
";",
"out",
".",
"println",
"(",
"\"<tr>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<td> \"",
"+",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"FIELD_NAME",
")",
".",
"toString",
"(",
")",
"+",
"\"</td>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<td> \"",
"+",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"FIELD_CLASS",
")",
".",
"toString",
"(",
")",
"+",
"\"</td>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<td> \"",
"+",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"BASE_FIELD_NAME",
")",
".",
"toString",
"(",
")",
"+",
"\"</td>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<td> \"",
"+",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"MAXIMUM_LENGTH",
")",
".",
"toString",
"(",
")",
"+",
"\"</td>\"",
")",
";",
"out",
".",
"println",
"(",
"\"<td> \"",
"+",
"fieldInfo",
".",
"getField",
"(",
"FieldData",
".",
"FIELD_DESCRIPTION",
")",
".",
"toString",
"(",
")",
"+",
"\"</td>\"",
")",
";",
"out",
".",
"println",
"(",
"\"</tr>\"",
")",
";",
"}",
"out",
".",
"println",
"(",
"\"</table>\"",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"fieldInfo",
".",
"free",
"(",
")",
";",
"fieldInfo",
"=",
"null",
";",
"}"
] |
PrintHtmlTechInfo Method.
|
[
"PrintHtmlTechInfo",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java#L375-L409
|
153,626
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java
|
ClassInfo.isARecord
|
public boolean isARecord(boolean isAFile)
{
Record recFileHdr = (Record)this.getRecordOwner().getRecord(FileHdr.FILE_HDR_FILE);
if (recFileHdr == null)
{
recFileHdr = new FileHdr(this.getRecordOwner());
this.addListener(new FreeOnFreeHandler(recFileHdr));
}
if (!recFileHdr.getField(FileHdr.FILE_NAME).equals(this.getField(ClassInfo.CLASS_NAME)))
{
try {
recFileHdr.addNew();
recFileHdr.getField(FileHdr.FILE_NAME).moveFieldToThis(this.getField(ClassInfo.CLASS_NAME));
int oldKeyArea = recFileHdr.getDefaultOrder();
recFileHdr.setKeyArea(FileHdr.FILE_NAME_KEY);
recFileHdr.seek(null);
recFileHdr.setKeyArea(oldKeyArea);
} catch (Exception e) {
e.printStackTrace();
}
}
if ((recFileHdr.getEditMode() == DBConstants.EDIT_CURRENT) && (this.getField(ClassInfo.CLASS_NAME).toString().equals(recFileHdr.getField(FileHdr.FILE_NAME).getString())))
return true; // This is a file
if (isAFile)
return false; // Just looking for files
if (!"Record".equalsIgnoreCase(this.getField(ClassInfo.CLASS_TYPE).toString()))
return false; // If this isn't a physical file, don't build it.
if (this.getField(ClassInfo.BASE_CLASS_NAME).toString().contains("ScreenRecord"))
return false;
if ("Interface".equalsIgnoreCase(this.getField(ClassInfo.CLASS_TYPE).toString())) // An interface doesn't have an interface
return false; // If this isn't a physical file, don't build it.
if (RESOURCE_CLASS.equals(this.getField(ClassInfo.BASE_CLASS_NAME).toString()))
return false; // Resource only class
return true; // This is a record
}
|
java
|
public boolean isARecord(boolean isAFile)
{
Record recFileHdr = (Record)this.getRecordOwner().getRecord(FileHdr.FILE_HDR_FILE);
if (recFileHdr == null)
{
recFileHdr = new FileHdr(this.getRecordOwner());
this.addListener(new FreeOnFreeHandler(recFileHdr));
}
if (!recFileHdr.getField(FileHdr.FILE_NAME).equals(this.getField(ClassInfo.CLASS_NAME)))
{
try {
recFileHdr.addNew();
recFileHdr.getField(FileHdr.FILE_NAME).moveFieldToThis(this.getField(ClassInfo.CLASS_NAME));
int oldKeyArea = recFileHdr.getDefaultOrder();
recFileHdr.setKeyArea(FileHdr.FILE_NAME_KEY);
recFileHdr.seek(null);
recFileHdr.setKeyArea(oldKeyArea);
} catch (Exception e) {
e.printStackTrace();
}
}
if ((recFileHdr.getEditMode() == DBConstants.EDIT_CURRENT) && (this.getField(ClassInfo.CLASS_NAME).toString().equals(recFileHdr.getField(FileHdr.FILE_NAME).getString())))
return true; // This is a file
if (isAFile)
return false; // Just looking for files
if (!"Record".equalsIgnoreCase(this.getField(ClassInfo.CLASS_TYPE).toString()))
return false; // If this isn't a physical file, don't build it.
if (this.getField(ClassInfo.BASE_CLASS_NAME).toString().contains("ScreenRecord"))
return false;
if ("Interface".equalsIgnoreCase(this.getField(ClassInfo.CLASS_TYPE).toString())) // An interface doesn't have an interface
return false; // If this isn't a physical file, don't build it.
if (RESOURCE_CLASS.equals(this.getField(ClassInfo.BASE_CLASS_NAME).toString()))
return false; // Resource only class
return true; // This is a record
}
|
[
"public",
"boolean",
"isARecord",
"(",
"boolean",
"isAFile",
")",
"{",
"Record",
"recFileHdr",
"=",
"(",
"Record",
")",
"this",
".",
"getRecordOwner",
"(",
")",
".",
"getRecord",
"(",
"FileHdr",
".",
"FILE_HDR_FILE",
")",
";",
"if",
"(",
"recFileHdr",
"==",
"null",
")",
"{",
"recFileHdr",
"=",
"new",
"FileHdr",
"(",
"this",
".",
"getRecordOwner",
"(",
")",
")",
";",
"this",
".",
"addListener",
"(",
"new",
"FreeOnFreeHandler",
"(",
"recFileHdr",
")",
")",
";",
"}",
"if",
"(",
"!",
"recFileHdr",
".",
"getField",
"(",
"FileHdr",
".",
"FILE_NAME",
")",
".",
"equals",
"(",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
")",
")",
"{",
"try",
"{",
"recFileHdr",
".",
"addNew",
"(",
")",
";",
"recFileHdr",
".",
"getField",
"(",
"FileHdr",
".",
"FILE_NAME",
")",
".",
"moveFieldToThis",
"(",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
")",
";",
"int",
"oldKeyArea",
"=",
"recFileHdr",
".",
"getDefaultOrder",
"(",
")",
";",
"recFileHdr",
".",
"setKeyArea",
"(",
"FileHdr",
".",
"FILE_NAME_KEY",
")",
";",
"recFileHdr",
".",
"seek",
"(",
"null",
")",
";",
"recFileHdr",
".",
"setKeyArea",
"(",
"oldKeyArea",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"if",
"(",
"(",
"recFileHdr",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_CURRENT",
")",
"&&",
"(",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"recFileHdr",
".",
"getField",
"(",
"FileHdr",
".",
"FILE_NAME",
")",
".",
"getString",
"(",
")",
")",
")",
")",
"return",
"true",
";",
"// This is a file",
"if",
"(",
"isAFile",
")",
"return",
"false",
";",
"// Just looking for files",
"if",
"(",
"!",
"\"Record\"",
".",
"equalsIgnoreCase",
"(",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_TYPE",
")",
".",
"toString",
"(",
")",
")",
")",
"return",
"false",
";",
"// If this isn't a physical file, don't build it.",
"if",
"(",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"BASE_CLASS_NAME",
")",
".",
"toString",
"(",
")",
".",
"contains",
"(",
"\"ScreenRecord\"",
")",
")",
"return",
"false",
";",
"if",
"(",
"\"Interface\"",
".",
"equalsIgnoreCase",
"(",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_TYPE",
")",
".",
"toString",
"(",
")",
")",
")",
"// An interface doesn't have an interface",
"return",
"false",
";",
"// If this isn't a physical file, don't build it.",
"if",
"(",
"RESOURCE_CLASS",
".",
"equals",
"(",
"this",
".",
"getField",
"(",
"ClassInfo",
".",
"BASE_CLASS_NAME",
")",
".",
"toString",
"(",
")",
")",
")",
"return",
"false",
";",
"// Resource only class",
"return",
"true",
";",
"// This is a record",
"}"
] |
IsARecord Method.
|
[
"IsARecord",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/ClassInfo.java#L466-L500
|
153,627
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/SaxHtmlHandler.java
|
SaxHtmlHandler.startDocument
|
public void startDocument(String namespaceURI, String localName, String qName, Attributes attr) throws SAXException
{
startTable = false;
col = 0;
row = 0;
}
|
java
|
public void startDocument(String namespaceURI, String localName, String qName, Attributes attr) throws SAXException
{
startTable = false;
col = 0;
row = 0;
}
|
[
"public",
"void",
"startDocument",
"(",
"String",
"namespaceURI",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"attr",
")",
"throws",
"SAXException",
"{",
"startTable",
"=",
"false",
";",
"col",
"=",
"0",
";",
"row",
"=",
"0",
";",
"}"
] |
StartDocument Method.
|
[
"StartDocument",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/SaxHtmlHandler.java#L63-L68
|
153,628
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/SaxHtmlHandler.java
|
SaxHtmlHandler.startElement
|
public void startElement(String namespaceURI, String localName, String qName, Attributes attr)
{
if (localName.equalsIgnoreCase(TABLE))
{
String strClass = attr.getValue("", "class");
if (strClass != null)
if (strClass.equalsIgnoreCase("table-in")) // NO NO NO
{
startTable = true;
row = -1;
}
}
else if (startTable)
{
if (localName.equalsIgnoreCase(TR))
{
row++;
col = -1;
}
else if (localName.equalsIgnoreCase(TD))
{
col++;
}
}
}
|
java
|
public void startElement(String namespaceURI, String localName, String qName, Attributes attr)
{
if (localName.equalsIgnoreCase(TABLE))
{
String strClass = attr.getValue("", "class");
if (strClass != null)
if (strClass.equalsIgnoreCase("table-in")) // NO NO NO
{
startTable = true;
row = -1;
}
}
else if (startTable)
{
if (localName.equalsIgnoreCase(TR))
{
row++;
col = -1;
}
else if (localName.equalsIgnoreCase(TD))
{
col++;
}
}
}
|
[
"public",
"void",
"startElement",
"(",
"String",
"namespaceURI",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"attr",
")",
"{",
"if",
"(",
"localName",
".",
"equalsIgnoreCase",
"(",
"TABLE",
")",
")",
"{",
"String",
"strClass",
"=",
"attr",
".",
"getValue",
"(",
"\"\"",
",",
"\"class\"",
")",
";",
"if",
"(",
"strClass",
"!=",
"null",
")",
"if",
"(",
"strClass",
".",
"equalsIgnoreCase",
"(",
"\"table-in\"",
")",
")",
"// NO NO NO",
"{",
"startTable",
"=",
"true",
";",
"row",
"=",
"-",
"1",
";",
"}",
"}",
"else",
"if",
"(",
"startTable",
")",
"{",
"if",
"(",
"localName",
".",
"equalsIgnoreCase",
"(",
"TR",
")",
")",
"{",
"row",
"++",
";",
"col",
"=",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"localName",
".",
"equalsIgnoreCase",
"(",
"TD",
")",
")",
"{",
"col",
"++",
";",
"}",
"}",
"}"
] |
StartElement Method.
|
[
"StartElement",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/SaxHtmlHandler.java#L79-L103
|
153,629
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/SaxHtmlHandler.java
|
SaxHtmlHandler.endElement
|
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
{
if (localName.equalsIgnoreCase(TABLE))
{
if (startTable)
if (m_record.getEditMode() == DBConstants.EDIT_ADD)
{
try {
m_record.add();
} catch (DBException e) {
e.printStackTrace();
}
}
startTable = false;
}
}
|
java
|
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
{
if (localName.equalsIgnoreCase(TABLE))
{
if (startTable)
if (m_record.getEditMode() == DBConstants.EDIT_ADD)
{
try {
m_record.add();
} catch (DBException e) {
e.printStackTrace();
}
}
startTable = false;
}
}
|
[
"public",
"void",
"endElement",
"(",
"String",
"namespaceURI",
",",
"String",
"localName",
",",
"String",
"qName",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"localName",
".",
"equalsIgnoreCase",
"(",
"TABLE",
")",
")",
"{",
"if",
"(",
"startTable",
")",
"if",
"(",
"m_record",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_ADD",
")",
"{",
"try",
"{",
"m_record",
".",
"add",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"startTable",
"=",
"false",
";",
"}",
"}"
] |
EndElement Method.
|
[
"EndElement",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/SaxHtmlHandler.java#L107-L122
|
153,630
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/SaxHtmlHandler.java
|
SaxHtmlHandler.characters
|
public void characters(char[] ch, int start, int length) throws SAXException
{
if (startTable)
{
try {
String string = new String(ch, start, length);
for (int i = string.length() - 1; i >= 0; i--)
{ // Trim trailing spaces
int x = Character.getNumericValue(string.charAt(i));
if ((Character.isWhitespace(string.charAt(i))) || (x == -1))
string = string.substring(0, string.length() - 1);
else
break;
}
if (row == 0)
{
new StringField(m_record, string, -1, string, null);
}
else
{
if (col == 0)
{
if (m_record.getEditMode() == DBConstants.EDIT_ADD)
m_record.add();
m_record.addNew();
}
m_record.getField(col + 1).setString(string);
}
} catch (DBException e) {
e.printStackTrace();
}
}
}
|
java
|
public void characters(char[] ch, int start, int length) throws SAXException
{
if (startTable)
{
try {
String string = new String(ch, start, length);
for (int i = string.length() - 1; i >= 0; i--)
{ // Trim trailing spaces
int x = Character.getNumericValue(string.charAt(i));
if ((Character.isWhitespace(string.charAt(i))) || (x == -1))
string = string.substring(0, string.length() - 1);
else
break;
}
if (row == 0)
{
new StringField(m_record, string, -1, string, null);
}
else
{
if (col == 0)
{
if (m_record.getEditMode() == DBConstants.EDIT_ADD)
m_record.add();
m_record.addNew();
}
m_record.getField(col + 1).setString(string);
}
} catch (DBException e) {
e.printStackTrace();
}
}
}
|
[
"public",
"void",
"characters",
"(",
"char",
"[",
"]",
"ch",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"startTable",
")",
"{",
"try",
"{",
"String",
"string",
"=",
"new",
"String",
"(",
"ch",
",",
"start",
",",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"string",
".",
"length",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"// Trim trailing spaces",
"int",
"x",
"=",
"Character",
".",
"getNumericValue",
"(",
"string",
".",
"charAt",
"(",
"i",
")",
")",
";",
"if",
"(",
"(",
"Character",
".",
"isWhitespace",
"(",
"string",
".",
"charAt",
"(",
"i",
")",
")",
")",
"||",
"(",
"x",
"==",
"-",
"1",
")",
")",
"string",
"=",
"string",
".",
"substring",
"(",
"0",
",",
"string",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"else",
"break",
";",
"}",
"if",
"(",
"row",
"==",
"0",
")",
"{",
"new",
"StringField",
"(",
"m_record",
",",
"string",
",",
"-",
"1",
",",
"string",
",",
"null",
")",
";",
"}",
"else",
"{",
"if",
"(",
"col",
"==",
"0",
")",
"{",
"if",
"(",
"m_record",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_ADD",
")",
"m_record",
".",
"add",
"(",
")",
";",
"m_record",
".",
"addNew",
"(",
")",
";",
"}",
"m_record",
".",
"getField",
"(",
"col",
"+",
"1",
")",
".",
"setString",
"(",
"string",
")",
";",
"}",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}"
] |
Characters Method.
|
[
"Characters",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/SaxHtmlHandler.java#L126-L158
|
153,631
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/navi/AnchorageSimulator.java
|
AnchorageSimulator.simulate
|
public void simulate(LocationSource locationSource, long period, boolean isDaemon) throws IOException
{
this.locationSource = locationSource;
dis = new DataInputStream(new BufferedInputStream(url.openStream()));
if (timer == null)
{
timer = new Timer("AnchorageSimulator", isDaemon);
}
timer.scheduleAtFixedRate(this, 0, period);
}
|
java
|
public void simulate(LocationSource locationSource, long period, boolean isDaemon) throws IOException
{
this.locationSource = locationSource;
dis = new DataInputStream(new BufferedInputStream(url.openStream()));
if (timer == null)
{
timer = new Timer("AnchorageSimulator", isDaemon);
}
timer.scheduleAtFixedRate(this, 0, period);
}
|
[
"public",
"void",
"simulate",
"(",
"LocationSource",
"locationSource",
",",
"long",
"period",
",",
"boolean",
"isDaemon",
")",
"throws",
"IOException",
"{",
"this",
".",
"locationSource",
"=",
"locationSource",
";",
"dis",
"=",
"new",
"DataInputStream",
"(",
"new",
"BufferedInputStream",
"(",
"url",
".",
"openStream",
"(",
")",
")",
")",
";",
"if",
"(",
"timer",
"==",
"null",
")",
"{",
"timer",
"=",
"new",
"Timer",
"(",
"\"AnchorageSimulator\"",
",",
"isDaemon",
")",
";",
"}",
"timer",
".",
"scheduleAtFixedRate",
"(",
"this",
",",
"0",
",",
"period",
")",
";",
"}"
] |
Starts simulating anchorige.
@param locationSource
@param period Update rate in millis.
@param isDaemon Sets timer thread. In single thread this should be false.
This parament is used only if external Timer was not provided!
@throws IOException
|
[
"Starts",
"simulating",
"anchorige",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/AnchorageSimulator.java#L61-L70
|
153,632
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/Merger.java
|
Merger.iterator
|
public static <T> Iterator<T> iterator(Queue<T> queue)
{
return new XIteratorImpl<>(()->!queue.isEmpty(), queue::remove);
}
|
java
|
public static <T> Iterator<T> iterator(Queue<T> queue)
{
return new XIteratorImpl<>(()->!queue.isEmpty(), queue::remove);
}
|
[
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
"Queue",
"<",
"T",
">",
"queue",
")",
"{",
"return",
"new",
"XIteratorImpl",
"<>",
"(",
"(",
")",
"->",
"!",
"queue",
".",
"isEmpty",
"(",
")",
",",
"queue",
"::",
"remove",
")",
";",
"}"
] |
Returns Queue as iterator. Calls isEmpty and remove methods
@param <T>
@param queue
@return
|
[
"Returns",
"Queue",
"as",
"iterator",
".",
"Calls",
"isEmpty",
"and",
"remove",
"methods"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/Merger.java#L118-L121
|
153,633
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/Merger.java
|
Merger.iterator
|
public static <T> Iterator<T> iterator(BlockingQueue<T> queue)
{
return iterator(queue, Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
|
java
|
public static <T> Iterator<T> iterator(BlockingQueue<T> queue)
{
return iterator(queue, Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
|
[
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
"BlockingQueue",
"<",
"T",
">",
"queue",
")",
"{",
"return",
"iterator",
"(",
"queue",
",",
"Long",
".",
"MAX_VALUE",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}"
] |
Returns Queue as iterator. Calls poll method
@param <T>
@param queue
@return
|
[
"Returns",
"Queue",
"as",
"iterator",
".",
"Calls",
"poll",
"method"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/Merger.java#L128-L131
|
153,634
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/Merger.java
|
Merger.iterator
|
public static <T> Iterator<T> iterator(BlockingQueue<T> queue, long time, TimeUnit unit)
{
return new XIteratorImpl<>(()->true, ()->
{
try
{
T item = queue.poll(time, unit);
if (item == null)
{
throw new NoSuchElementException("timeout");
}
return item;
}
catch (InterruptedException ex)
{
throw new NoSuchElementException("interrupted");
}
});
}
|
java
|
public static <T> Iterator<T> iterator(BlockingQueue<T> queue, long time, TimeUnit unit)
{
return new XIteratorImpl<>(()->true, ()->
{
try
{
T item = queue.poll(time, unit);
if (item == null)
{
throw new NoSuchElementException("timeout");
}
return item;
}
catch (InterruptedException ex)
{
throw new NoSuchElementException("interrupted");
}
});
}
|
[
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
"BlockingQueue",
"<",
"T",
">",
"queue",
",",
"long",
"time",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"new",
"XIteratorImpl",
"<>",
"(",
"(",
")",
"->",
"true",
",",
"(",
")",
"->",
"{",
"try",
"{",
"T",
"item",
"=",
"queue",
".",
"poll",
"(",
"time",
",",
"unit",
")",
";",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"(",
"\"timeout\"",
")",
";",
"}",
"return",
"item",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"(",
"\"interrupted\"",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Returns Queue as iterator. Calls poll method. When timeout throws
NoSuchElementException which will remove it from merger.
@param <T>
@param queue
@param time
@param unit
@return
|
[
"Returns",
"Queue",
"as",
"iterator",
".",
"Calls",
"poll",
"method",
".",
"When",
"timeout",
"throws",
"NoSuchElementException",
"which",
"will",
"remove",
"it",
"from",
"merger",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/Merger.java#L141-L159
|
153,635
|
microfocus-idol/java-configuration-impl
|
src/main/java/com/hp/autonomy/frontend/configuration/SimpleComponent.java
|
SimpleComponent.merge
|
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public C merge(final C other) {
return (C) ConfigurationUtils.defaultMerge((ConfigurationComponent) this, (ConfigurationComponent) other);
}
|
java
|
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public C merge(final C other) {
return (C) ConfigurationUtils.defaultMerge((ConfigurationComponent) this, (ConfigurationComponent) other);
}
|
[
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"@",
"Override",
"public",
"C",
"merge",
"(",
"final",
"C",
"other",
")",
"{",
"return",
"(",
"C",
")",
"ConfigurationUtils",
".",
"defaultMerge",
"(",
"(",
"ConfigurationComponent",
")",
"this",
",",
"(",
"ConfigurationComponent",
")",
"other",
")",
";",
"}"
] |
Performs a default merge operation between current bean instance and defaults instance
@param other The configuration to merge with.
@return the merged configuration
|
[
"Performs",
"a",
"default",
"merge",
"operation",
"between",
"current",
"bean",
"instance",
"and",
"defaults",
"instance"
] |
cd9d744cacfaaae3c76cacc211e65742bbc7b00a
|
https://github.com/microfocus-idol/java-configuration-impl/blob/cd9d744cacfaaae3c76cacc211e65742bbc7b00a/src/main/java/com/hp/autonomy/frontend/configuration/SimpleComponent.java#L18-L22
|
153,636
|
microfocus-idol/java-configuration-impl
|
src/main/java/com/hp/autonomy/frontend/configuration/SimpleComponent.java
|
SimpleComponent.basicValidate
|
@SuppressWarnings("rawtypes")
@Override
public void basicValidate(final String section) throws ConfigException {
ConfigurationUtils.defaultValidate((ConfigurationComponent) this, section);
}
|
java
|
@SuppressWarnings("rawtypes")
@Override
public void basicValidate(final String section) throws ConfigException {
ConfigurationUtils.defaultValidate((ConfigurationComponent) this, section);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"@",
"Override",
"public",
"void",
"basicValidate",
"(",
"final",
"String",
"section",
")",
"throws",
"ConfigException",
"{",
"ConfigurationUtils",
".",
"defaultValidate",
"(",
"(",
"ConfigurationComponent",
")",
"this",
",",
"section",
")",
";",
"}"
] |
Skeleton validation, triggering validate on any subComponents
@param section the configuration section; should often be hard-coded
@throws ConfigException validation failure
|
[
"Skeleton",
"validation",
"triggering",
"validate",
"on",
"any",
"subComponents"
] |
cd9d744cacfaaae3c76cacc211e65742bbc7b00a
|
https://github.com/microfocus-idol/java-configuration-impl/blob/cd9d744cacfaaae3c76cacc211e65742bbc7b00a/src/main/java/com/hp/autonomy/frontend/configuration/SimpleComponent.java#L30-L34
|
153,637
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/stream/Streams.java
|
Streams.reducingStream
|
public static final IntStream reducingStream(IntStream stream, ReducingFunction func)
{
return StreamSupport.intStream(new ReducingSpliterator(stream, func), false);
}
|
java
|
public static final IntStream reducingStream(IntStream stream, ReducingFunction func)
{
return StreamSupport.intStream(new ReducingSpliterator(stream, func), false);
}
|
[
"public",
"static",
"final",
"IntStream",
"reducingStream",
"(",
"IntStream",
"stream",
",",
"ReducingFunction",
"func",
")",
"{",
"return",
"StreamSupport",
".",
"intStream",
"(",
"new",
"ReducingSpliterator",
"(",
"stream",
",",
"func",
")",
",",
"false",
")",
";",
"}"
] |
Converts Stream to Stream where one or more int items are mapped to
one int item. Mapping is done by func method. Func must return
true after calling consumer method. Otherwise behavior is unpredictable.
@param stream
@param func
@return
@throws IllegalStateException if Stream ends when mapping is unfinished.
@deprecated This is not tested at all!!!
|
[
"Converts",
"Stream",
"to",
"Stream",
"where",
"one",
"or",
"more",
"int",
"items",
"are",
"mapped",
"to",
"one",
"int",
"item",
".",
"Mapping",
"is",
"done",
"by",
"func",
"method",
".",
"Func",
"must",
"return",
"true",
"after",
"calling",
"consumer",
"method",
".",
"Otherwise",
"behavior",
"is",
"unpredictable",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/stream/Streams.java#L52-L55
|
153,638
|
js-lib-com/net-client
|
src/main/java/js/net/client/encoder/StreamValueReader.java
|
StreamValueReader.getInstance
|
public static Closeable getInstance(InputStream inputStream, Type type) throws IOException {
Params.notNull(inputStream, "Input stream");
// TODO: construct instance reflexively to allow for user defined input stream
// an user defined input stream should have a constructor with a single parameter of type InputStream
if (type == InputStream.class) {
return inputStream;
}
if (type == ZipInputStream.class) {
return new ZipInputStream(inputStream);
}
if (type == JarInputStream.class) {
return new JarInputStream(inputStream);
}
if (type == FilesInputStream.class) {
return new FilesInputStream(inputStream);
}
if (type == Reader.class || type == InputStreamReader.class) {
return new InputStreamReader(inputStream, "UTF-8");
}
if (type == BufferedReader.class) {
return new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
}
if (type == LineNumberReader.class) {
return new LineNumberReader(new InputStreamReader(inputStream, "UTF-8"));
}
if (type == PushbackReader.class) {
return new PushbackReader(new InputStreamReader(inputStream, "UTF-8"));
}
throw new IllegalArgumentException(String.format("Unsupported stream type |%s|.", type));
}
|
java
|
public static Closeable getInstance(InputStream inputStream, Type type) throws IOException {
Params.notNull(inputStream, "Input stream");
// TODO: construct instance reflexively to allow for user defined input stream
// an user defined input stream should have a constructor with a single parameter of type InputStream
if (type == InputStream.class) {
return inputStream;
}
if (type == ZipInputStream.class) {
return new ZipInputStream(inputStream);
}
if (type == JarInputStream.class) {
return new JarInputStream(inputStream);
}
if (type == FilesInputStream.class) {
return new FilesInputStream(inputStream);
}
if (type == Reader.class || type == InputStreamReader.class) {
return new InputStreamReader(inputStream, "UTF-8");
}
if (type == BufferedReader.class) {
return new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
}
if (type == LineNumberReader.class) {
return new LineNumberReader(new InputStreamReader(inputStream, "UTF-8"));
}
if (type == PushbackReader.class) {
return new PushbackReader(new InputStreamReader(inputStream, "UTF-8"));
}
throw new IllegalArgumentException(String.format("Unsupported stream type |%s|.", type));
}
|
[
"public",
"static",
"Closeable",
"getInstance",
"(",
"InputStream",
"inputStream",
",",
"Type",
"type",
")",
"throws",
"IOException",
"{",
"Params",
".",
"notNull",
"(",
"inputStream",
",",
"\"Input stream\"",
")",
";",
"// TODO: construct instance reflexively to allow for user defined input stream\r",
"// an user defined input stream should have a constructor with a single parameter of type InputStream\r",
"if",
"(",
"type",
"==",
"InputStream",
".",
"class",
")",
"{",
"return",
"inputStream",
";",
"}",
"if",
"(",
"type",
"==",
"ZipInputStream",
".",
"class",
")",
"{",
"return",
"new",
"ZipInputStream",
"(",
"inputStream",
")",
";",
"}",
"if",
"(",
"type",
"==",
"JarInputStream",
".",
"class",
")",
"{",
"return",
"new",
"JarInputStream",
"(",
"inputStream",
")",
";",
"}",
"if",
"(",
"type",
"==",
"FilesInputStream",
".",
"class",
")",
"{",
"return",
"new",
"FilesInputStream",
"(",
"inputStream",
")",
";",
"}",
"if",
"(",
"type",
"==",
"Reader",
".",
"class",
"||",
"type",
"==",
"InputStreamReader",
".",
"class",
")",
"{",
"return",
"new",
"InputStreamReader",
"(",
"inputStream",
",",
"\"UTF-8\"",
")",
";",
"}",
"if",
"(",
"type",
"==",
"BufferedReader",
".",
"class",
")",
"{",
"return",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"inputStream",
",",
"\"UTF-8\"",
")",
")",
";",
"}",
"if",
"(",
"type",
"==",
"LineNumberReader",
".",
"class",
")",
"{",
"return",
"new",
"LineNumberReader",
"(",
"new",
"InputStreamReader",
"(",
"inputStream",
",",
"\"UTF-8\"",
")",
")",
";",
"}",
"if",
"(",
"type",
"==",
"PushbackReader",
".",
"class",
")",
"{",
"return",
"new",
"PushbackReader",
"(",
"new",
"InputStreamReader",
"(",
"inputStream",
",",
"\"UTF-8\"",
")",
")",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Unsupported stream type |%s|.\"",
",",
"type",
")",
")",
";",
"}"
] |
Create stream of requested type wrapping given input stream. Both returned bytes and character streams are closeable.
@param inputStream input stream to wrap,
@param type the type of stream, byte or character.
@return newly create stream.
@throws IOException if newly stream creation fails.
|
[
"Create",
"stream",
"of",
"requested",
"type",
"wrapping",
"given",
"input",
"stream",
".",
"Both",
"returned",
"bytes",
"and",
"character",
"streams",
"are",
"closeable",
"."
] |
0489f85d8baa1be1ff115aa79929e0cf05d4c72d
|
https://github.com/js-lib-com/net-client/blob/0489f85d8baa1be1ff115aa79929e0cf05d4c72d/src/main/java/js/net/client/encoder/StreamValueReader.java#L39-L70
|
153,639
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/StringField.java
|
StringField.getSQLType
|
public String getSQLType(boolean bIncludeLength, Map<String, Object> properties)
{
String strType = (String)properties.get(DBSQLTypes.STRING);
if (strType == null)
strType = "VARCHAR"; // The default SQL Type
if (this.getMaxLength() < 127)
{
String strStart = (String)properties.get("LONGSTRINGSTART");
if (strStart != null)
{
int iStart = Integer.parseInt(strStart);
if (iStart < this.getMaxLength())
strType = (String)properties.get("LONGSTRING");
}
}
if (bIncludeLength)
strType += "(" + Integer.toString(this.getMaxLength()) + ")";
return strType;
}
|
java
|
public String getSQLType(boolean bIncludeLength, Map<String, Object> properties)
{
String strType = (String)properties.get(DBSQLTypes.STRING);
if (strType == null)
strType = "VARCHAR"; // The default SQL Type
if (this.getMaxLength() < 127)
{
String strStart = (String)properties.get("LONGSTRINGSTART");
if (strStart != null)
{
int iStart = Integer.parseInt(strStart);
if (iStart < this.getMaxLength())
strType = (String)properties.get("LONGSTRING");
}
}
if (bIncludeLength)
strType += "(" + Integer.toString(this.getMaxLength()) + ")";
return strType;
}
|
[
"public",
"String",
"getSQLType",
"(",
"boolean",
"bIncludeLength",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"String",
"strType",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"DBSQLTypes",
".",
"STRING",
")",
";",
"if",
"(",
"strType",
"==",
"null",
")",
"strType",
"=",
"\"VARCHAR\"",
";",
"// The default SQL Type",
"if",
"(",
"this",
".",
"getMaxLength",
"(",
")",
"<",
"127",
")",
"{",
"String",
"strStart",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"\"LONGSTRINGSTART\"",
")",
";",
"if",
"(",
"strStart",
"!=",
"null",
")",
"{",
"int",
"iStart",
"=",
"Integer",
".",
"parseInt",
"(",
"strStart",
")",
";",
"if",
"(",
"iStart",
"<",
"this",
".",
"getMaxLength",
"(",
")",
")",
"strType",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"\"LONGSTRING\"",
")",
";",
"}",
"}",
"if",
"(",
"bIncludeLength",
")",
"strType",
"+=",
"\"(\"",
"+",
"Integer",
".",
"toString",
"(",
"this",
".",
"getMaxLength",
"(",
")",
")",
"+",
"\")\"",
";",
"return",
"strType",
";",
"}"
] |
Get the SQL type of this field.
Typically STRING, VARCHAR, or LONGSTRING if over 127 chars.
@param bIncludeLength Include the field length in this description.
@param properties Database properties to determine the SQL type.
|
[
"Get",
"the",
"SQL",
"type",
"of",
"this",
"field",
".",
"Typically",
"STRING",
"VARCHAR",
"or",
"LONGSTRING",
"if",
"over",
"127",
"chars",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/StringField.java#L101-L119
|
153,640
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/StringField.java
|
StringField.setString
|
public int setString(String strString, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
int iMaxLength = this.getMaxLength();
if (strString != null) if (strString.length() > iMaxLength)
strString = strString.substring(0, iMaxLength);
if (strString == null)
strString = Constants.BLANK; // To set a null internally, you must call setData directly
return this.setData(strString, bDisplayOption, iMoveMode);
}
|
java
|
public int setString(String strString, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
int iMaxLength = this.getMaxLength();
if (strString != null) if (strString.length() > iMaxLength)
strString = strString.substring(0, iMaxLength);
if (strString == null)
strString = Constants.BLANK; // To set a null internally, you must call setData directly
return this.setData(strString, bDisplayOption, iMoveMode);
}
|
[
"public",
"int",
"setString",
"(",
"String",
"strString",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"// init this field override for other value",
"{",
"int",
"iMaxLength",
"=",
"this",
".",
"getMaxLength",
"(",
")",
";",
"if",
"(",
"strString",
"!=",
"null",
")",
"if",
"(",
"strString",
".",
"length",
"(",
")",
">",
"iMaxLength",
")",
"strString",
"=",
"strString",
".",
"substring",
"(",
"0",
",",
"iMaxLength",
")",
";",
"if",
"(",
"strString",
"==",
"null",
")",
"strString",
"=",
"Constants",
".",
"BLANK",
";",
"// To set a null internally, you must call setData directly",
"return",
"this",
".",
"setData",
"(",
"strString",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] |
Convert and move string to this field.
Data is already in string format, so just move it!
@param bState the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code.
|
[
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
".",
"Data",
"is",
"already",
"in",
"string",
"format",
"so",
"just",
"move",
"it!"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/StringField.java#L153-L161
|
153,641
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/util/StreamOut.java
|
StreamOut.writeit
|
public void writeit(String strTemp)
{
String strTabs = "";
int i = 0;
for (i = 0; i < m_iTabs; i++)
{
strTabs += "\t";
}
if (m_bTabOnNextLine) if ((strTemp.length() > 0) && (strTemp.charAt(0) != '\n'))
strTemp = strTabs + strTemp;
m_bTabOnNextLine = false;
int iIndex = 0;
int iIndex2;
while (iIndex != -1)
{
iIndex = strTemp.indexOf('\n', iIndex);
if ((iIndex != -1) && (iIndex < strTemp.length() - 1))
{
iIndex2 = iIndex + 1;
if (iIndex > 1) if (strTemp.charAt(iIndex) == '\r')
iIndex--;
strTemp = strTemp.substring(0, iIndex+1) + strTabs + strTemp.substring(iIndex2, strTemp.length());
iIndex = iIndex + 2;
}
else
iIndex = -1;
}
iIndex = 0;
while (iIndex != -1)
{
iIndex = strTemp.indexOf('\r', iIndex);
if (iIndex != -1)
strTemp = strTemp.substring(0, iIndex) + strTemp.substring(iIndex + 1, strTemp.length());
}
strTemp = this.tabsToSpaces(strTemp);
this.print(strTemp);
if (strTemp.length() > 0) if (strTemp.charAt(strTemp.length() - 1) == '\n');
m_bTabOnNextLine = true;
}
|
java
|
public void writeit(String strTemp)
{
String strTabs = "";
int i = 0;
for (i = 0; i < m_iTabs; i++)
{
strTabs += "\t";
}
if (m_bTabOnNextLine) if ((strTemp.length() > 0) && (strTemp.charAt(0) != '\n'))
strTemp = strTabs + strTemp;
m_bTabOnNextLine = false;
int iIndex = 0;
int iIndex2;
while (iIndex != -1)
{
iIndex = strTemp.indexOf('\n', iIndex);
if ((iIndex != -1) && (iIndex < strTemp.length() - 1))
{
iIndex2 = iIndex + 1;
if (iIndex > 1) if (strTemp.charAt(iIndex) == '\r')
iIndex--;
strTemp = strTemp.substring(0, iIndex+1) + strTabs + strTemp.substring(iIndex2, strTemp.length());
iIndex = iIndex + 2;
}
else
iIndex = -1;
}
iIndex = 0;
while (iIndex != -1)
{
iIndex = strTemp.indexOf('\r', iIndex);
if (iIndex != -1)
strTemp = strTemp.substring(0, iIndex) + strTemp.substring(iIndex + 1, strTemp.length());
}
strTemp = this.tabsToSpaces(strTemp);
this.print(strTemp);
if (strTemp.length() > 0) if (strTemp.charAt(strTemp.length() - 1) == '\n');
m_bTabOnNextLine = true;
}
|
[
"public",
"void",
"writeit",
"(",
"String",
"strTemp",
")",
"{",
"String",
"strTabs",
"=",
"\"\"",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"m_iTabs",
";",
"i",
"++",
")",
"{",
"strTabs",
"+=",
"\"\\t\"",
";",
"}",
"if",
"(",
"m_bTabOnNextLine",
")",
"if",
"(",
"(",
"strTemp",
".",
"length",
"(",
")",
">",
"0",
")",
"&&",
"(",
"strTemp",
".",
"charAt",
"(",
"0",
")",
"!=",
"'",
"'",
")",
")",
"strTemp",
"=",
"strTabs",
"+",
"strTemp",
";",
"m_bTabOnNextLine",
"=",
"false",
";",
"int",
"iIndex",
"=",
"0",
";",
"int",
"iIndex2",
";",
"while",
"(",
"iIndex",
"!=",
"-",
"1",
")",
"{",
"iIndex",
"=",
"strTemp",
".",
"indexOf",
"(",
"'",
"'",
",",
"iIndex",
")",
";",
"if",
"(",
"(",
"iIndex",
"!=",
"-",
"1",
")",
"&&",
"(",
"iIndex",
"<",
"strTemp",
".",
"length",
"(",
")",
"-",
"1",
")",
")",
"{",
"iIndex2",
"=",
"iIndex",
"+",
"1",
";",
"if",
"(",
"iIndex",
">",
"1",
")",
"if",
"(",
"strTemp",
".",
"charAt",
"(",
"iIndex",
")",
"==",
"'",
"'",
")",
"iIndex",
"--",
";",
"strTemp",
"=",
"strTemp",
".",
"substring",
"(",
"0",
",",
"iIndex",
"+",
"1",
")",
"+",
"strTabs",
"+",
"strTemp",
".",
"substring",
"(",
"iIndex2",
",",
"strTemp",
".",
"length",
"(",
")",
")",
";",
"iIndex",
"=",
"iIndex",
"+",
"2",
";",
"}",
"else",
"iIndex",
"=",
"-",
"1",
";",
"}",
"iIndex",
"=",
"0",
";",
"while",
"(",
"iIndex",
"!=",
"-",
"1",
")",
"{",
"iIndex",
"=",
"strTemp",
".",
"indexOf",
"(",
"'",
"'",
",",
"iIndex",
")",
";",
"if",
"(",
"iIndex",
"!=",
"-",
"1",
")",
"strTemp",
"=",
"strTemp",
".",
"substring",
"(",
"0",
",",
"iIndex",
")",
"+",
"strTemp",
".",
"substring",
"(",
"iIndex",
"+",
"1",
",",
"strTemp",
".",
"length",
"(",
")",
")",
";",
"}",
"strTemp",
"=",
"this",
".",
"tabsToSpaces",
"(",
"strTemp",
")",
";",
"this",
".",
"print",
"(",
"strTemp",
")",
";",
"if",
"(",
"strTemp",
".",
"length",
"(",
")",
">",
"0",
")",
"if",
"(",
"strTemp",
".",
"charAt",
"(",
"strTemp",
".",
"length",
"(",
")",
"-",
"1",
")",
"==",
"'",
"'",
")",
";",
"m_bTabOnNextLine",
"=",
"true",
";",
"}"
] |
Writeit Method.
|
[
"Writeit",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/util/StreamOut.java#L67-L105
|
153,642
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/ClassIntrospectorImpl.java
|
ClassIntrospectorImpl.getDeclaredInterfaces
|
@Override
public Set<Class<?>> getDeclaredInterfaces(ClassFilter filter) {
return ClassUtils.getDeclaredInterfaces(target, filter);
}
|
java
|
@Override
public Set<Class<?>> getDeclaredInterfaces(ClassFilter filter) {
return ClassUtils.getDeclaredInterfaces(target, filter);
}
|
[
"@",
"Override",
"public",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"getDeclaredInterfaces",
"(",
"ClassFilter",
"filter",
")",
"{",
"return",
"ClassUtils",
".",
"getDeclaredInterfaces",
"(",
"target",
",",
"filter",
")",
";",
"}"
] |
Returns a set of interfaces that that passes the supplied filter.
@param filter The class filter to use.
@return all Interface classes from clazz that passes the filter.
|
[
"Returns",
"a",
"set",
"of",
"interfaces",
"that",
"that",
"passes",
"the",
"supplied",
"filter",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/ClassIntrospectorImpl.java#L232-L235
|
153,643
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/ClassIntrospectorImpl.java
|
ClassIntrospectorImpl.getDeclaredFields
|
@Override
public Set<Field> getDeclaredFields(FieldFilter filter) {
return FieldUtils.getDeclaredFields(target, filter);
}
|
java
|
@Override
public Set<Field> getDeclaredFields(FieldFilter filter) {
return FieldUtils.getDeclaredFields(target, filter);
}
|
[
"@",
"Override",
"public",
"Set",
"<",
"Field",
">",
"getDeclaredFields",
"(",
"FieldFilter",
"filter",
")",
"{",
"return",
"FieldUtils",
".",
"getDeclaredFields",
"(",
"target",
",",
"filter",
")",
";",
"}"
] |
Returns a set of all fields matching the supplied filter
declared in the target class.
@param filter Filter to use.
@return All matching fields declared by the target class.
|
[
"Returns",
"a",
"set",
"of",
"all",
"fields",
"matching",
"the",
"supplied",
"filter",
"declared",
"in",
"the",
"target",
"class",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/ClassIntrospectorImpl.java#L248-L251
|
153,644
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java
|
AbstractNotification.setParam
|
public int setParam(String param, Object value) {
int i = findParam(param);
if (value == null && i < 0) {
return i;
}
if (i < 0) {
i = extraInfo.length;
extraInfo = Arrays.copyOf(extraInfo, i + 1);
}
if (value == null) {
extraInfo = (String[]) ArrayUtils.remove(extraInfo, i);
} else {
extraInfo[i] = param + "=" + value;
}
return i;
}
|
java
|
public int setParam(String param, Object value) {
int i = findParam(param);
if (value == null && i < 0) {
return i;
}
if (i < 0) {
i = extraInfo.length;
extraInfo = Arrays.copyOf(extraInfo, i + 1);
}
if (value == null) {
extraInfo = (String[]) ArrayUtils.remove(extraInfo, i);
} else {
extraInfo[i] = param + "=" + value;
}
return i;
}
|
[
"public",
"int",
"setParam",
"(",
"String",
"param",
",",
"Object",
"value",
")",
"{",
"int",
"i",
"=",
"findParam",
"(",
"param",
")",
";",
"if",
"(",
"value",
"==",
"null",
"&&",
"i",
"<",
"0",
")",
"{",
"return",
"i",
";",
"}",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"i",
"=",
"extraInfo",
".",
"length",
";",
"extraInfo",
"=",
"Arrays",
".",
"copyOf",
"(",
"extraInfo",
",",
"i",
"+",
"1",
")",
";",
"}",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"extraInfo",
"=",
"(",
"String",
"[",
"]",
")",
"ArrayUtils",
".",
"remove",
"(",
"extraInfo",
",",
"i",
")",
";",
"}",
"else",
"{",
"extraInfo",
"[",
"i",
"]",
"=",
"param",
"+",
"\"=\"",
"+",
"value",
";",
"}",
"return",
"i",
";",
"}"
] |
Sets the value for a parameter in extra info.
@param param Parameter name.
@param value Parameter value (null to remove).
@return Index of parameter in extra info.
|
[
"Sets",
"the",
"value",
"for",
"a",
"parameter",
"in",
"extra",
"info",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java#L274-L293
|
153,645
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java
|
AbstractNotification.getDisplayText
|
public String getDisplayText() {
StringBuilder sb = new StringBuilder();
appendText(sb, getPatientName(), "patient");
appendText(sb, getSubject(), "subject");
appendText(sb, getSenderName(), "sender");
appendText(sb, DateUtil.formatDate(getDeliveryDate()), "delivered");
appendText(sb, getPriority().toString(), "priority");
appendText(sb, "dummy", isActionable() ? "actionable" : "infoonly");
appendText(sb, "dummy", canDelete() ? "delete.yes" : "delete.no");
if (message != null && !message.isEmpty()) {
sb.append("\n");
for (String text : message) {
sb.append(text).append("\n");
}
}
return sb.toString();
}
|
java
|
public String getDisplayText() {
StringBuilder sb = new StringBuilder();
appendText(sb, getPatientName(), "patient");
appendText(sb, getSubject(), "subject");
appendText(sb, getSenderName(), "sender");
appendText(sb, DateUtil.formatDate(getDeliveryDate()), "delivered");
appendText(sb, getPriority().toString(), "priority");
appendText(sb, "dummy", isActionable() ? "actionable" : "infoonly");
appendText(sb, "dummy", canDelete() ? "delete.yes" : "delete.no");
if (message != null && !message.isEmpty()) {
sb.append("\n");
for (String text : message) {
sb.append(text).append("\n");
}
}
return sb.toString();
}
|
[
"public",
"String",
"getDisplayText",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"appendText",
"(",
"sb",
",",
"getPatientName",
"(",
")",
",",
"\"patient\"",
")",
";",
"appendText",
"(",
"sb",
",",
"getSubject",
"(",
")",
",",
"\"subject\"",
")",
";",
"appendText",
"(",
"sb",
",",
"getSenderName",
"(",
")",
",",
"\"sender\"",
")",
";",
"appendText",
"(",
"sb",
",",
"DateUtil",
".",
"formatDate",
"(",
"getDeliveryDate",
"(",
")",
")",
",",
"\"delivered\"",
")",
";",
"appendText",
"(",
"sb",
",",
"getPriority",
"(",
")",
".",
"toString",
"(",
")",
",",
"\"priority\"",
")",
";",
"appendText",
"(",
"sb",
",",
"\"dummy\"",
",",
"isActionable",
"(",
")",
"?",
"\"actionable\"",
":",
"\"infoonly\"",
")",
";",
"appendText",
"(",
"sb",
",",
"\"dummy\"",
",",
"canDelete",
"(",
")",
"?",
"\"delete.yes\"",
":",
"\"delete.no\"",
")",
";",
"if",
"(",
"message",
"!=",
"null",
"&&",
"!",
"message",
".",
"isEmpty",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"for",
"(",
"String",
"text",
":",
"message",
")",
"{",
"sb",
".",
"append",
"(",
"text",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns the display text for this notification.
@return Display text.
|
[
"Returns",
"the",
"display",
"text",
"for",
"this",
"notification",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java#L300-L318
|
153,646
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java
|
AbstractNotification.appendText
|
private void appendText(StringBuilder sb, String text, String format) {
if (text != null && !text.isEmpty()) {
format = "@vistanotification.detail." + format + ".label";
sb.append(StrUtil.formatMessage(format, text)).append("\n");
}
}
|
java
|
private void appendText(StringBuilder sb, String text, String format) {
if (text != null && !text.isEmpty()) {
format = "@vistanotification.detail." + format + ".label";
sb.append(StrUtil.formatMessage(format, text)).append("\n");
}
}
|
[
"private",
"void",
"appendText",
"(",
"StringBuilder",
"sb",
",",
"String",
"text",
",",
"String",
"format",
")",
"{",
"if",
"(",
"text",
"!=",
"null",
"&&",
"!",
"text",
".",
"isEmpty",
"(",
")",
")",
"{",
"format",
"=",
"\"@vistanotification.detail.\"",
"+",
"format",
"+",
"\".label\"",
";",
"sb",
".",
"append",
"(",
"StrUtil",
".",
"formatMessage",
"(",
"format",
",",
"text",
")",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}",
"}"
] |
Appends a text element if it is not null or empty.
@param sb String builder.
@param text Text value to append.
@param format Format specifier.
|
[
"Appends",
"a",
"text",
"element",
"if",
"it",
"is",
"not",
"null",
"or",
"empty",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/AbstractNotification.java#L327-L332
|
153,647
|
OwlPlatform/java-owl-solver
|
src/main/java/com/owlplatform/solver/protocol/messages/SubscriptionMessage.java
|
SubscriptionMessage.getLengthPrefix
|
public int getLengthPrefix() {
// Message ID
int length = 1;
// Number of rules
length += 4;
if (this.rules != null) {
for (SubscriptionRequestRule rule : this.rules) {
// Physical Layer
++length;
// Transmitters
length += 4 + rule.getNumTransmitters()
* Transmitter.TRANSMITTER_ID_SIZE * 2;
// Update interval
length += 8;
}
}
return length;
}
|
java
|
public int getLengthPrefix() {
// Message ID
int length = 1;
// Number of rules
length += 4;
if (this.rules != null) {
for (SubscriptionRequestRule rule : this.rules) {
// Physical Layer
++length;
// Transmitters
length += 4 + rule.getNumTransmitters()
* Transmitter.TRANSMITTER_ID_SIZE * 2;
// Update interval
length += 8;
}
}
return length;
}
|
[
"public",
"int",
"getLengthPrefix",
"(",
")",
"{",
"// Message ID",
"int",
"length",
"=",
"1",
";",
"// Number of rules",
"length",
"+=",
"4",
";",
"if",
"(",
"this",
".",
"rules",
"!=",
"null",
")",
"{",
"for",
"(",
"SubscriptionRequestRule",
"rule",
":",
"this",
".",
"rules",
")",
"{",
"// Physical Layer",
"++",
"length",
";",
"// Transmitters",
"length",
"+=",
"4",
"+",
"rule",
".",
"getNumTransmitters",
"(",
")",
"*",
"Transmitter",
".",
"TRANSMITTER_ID_SIZE",
"*",
"2",
";",
"// Update interval",
"length",
"+=",
"8",
";",
"}",
"}",
"return",
"length",
";",
"}"
] |
Returns the length prefix value for this message, as encoded according to
the Solver-Aggregator protocol.
@return the length prefix for this message.
|
[
"Returns",
"the",
"length",
"prefix",
"value",
"for",
"this",
"message",
"as",
"encoded",
"according",
"to",
"the",
"Solver",
"-",
"Aggregator",
"protocol",
"."
] |
53a1faabd63613c716203922cd52f871e5fedb9b
|
https://github.com/OwlPlatform/java-owl-solver/blob/53a1faabd63613c716203922cd52f871e5fedb9b/src/main/java/com/owlplatform/solver/protocol/messages/SubscriptionMessage.java#L54-L73
|
153,648
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/ReComputeFieldHandler.java
|
ReComputeFieldHandler.fieldChanged
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
double srcValue = ((NumberField)this.getOwner()).getValue();
BaseField fldTarget = this.getFieldTarget();
if (this.getOwner().isNull()) // If null, set the target to null
return fldTarget.moveFieldToThis(this.getOwner(), bDisplayOption, iMoveMode); // zero out the field
boolean[] rgbListeners = null;
if (m_bDisableTarget)
rgbListeners = fldTarget.setEnableListeners(false);
int iErrorCode = fldTarget.setValue(this.computeValue(srcValue), bDisplayOption, iMoveMode);
if (m_bDisableTarget)
fldTarget.setEnableListeners(rgbListeners);
return iErrorCode;
}
|
java
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
double srcValue = ((NumberField)this.getOwner()).getValue();
BaseField fldTarget = this.getFieldTarget();
if (this.getOwner().isNull()) // If null, set the target to null
return fldTarget.moveFieldToThis(this.getOwner(), bDisplayOption, iMoveMode); // zero out the field
boolean[] rgbListeners = null;
if (m_bDisableTarget)
rgbListeners = fldTarget.setEnableListeners(false);
int iErrorCode = fldTarget.setValue(this.computeValue(srcValue), bDisplayOption, iMoveMode);
if (m_bDisableTarget)
fldTarget.setEnableListeners(rgbListeners);
return iErrorCode;
}
|
[
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"double",
"srcValue",
"=",
"(",
"(",
"NumberField",
")",
"this",
".",
"getOwner",
"(",
")",
")",
".",
"getValue",
"(",
")",
";",
"BaseField",
"fldTarget",
"=",
"this",
".",
"getFieldTarget",
"(",
")",
";",
"if",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"isNull",
"(",
")",
")",
"// If null, set the target to null",
"return",
"fldTarget",
".",
"moveFieldToThis",
"(",
"this",
".",
"getOwner",
"(",
")",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"// zero out the field",
"boolean",
"[",
"]",
"rgbListeners",
"=",
"null",
";",
"if",
"(",
"m_bDisableTarget",
")",
"rgbListeners",
"=",
"fldTarget",
".",
"setEnableListeners",
"(",
"false",
")",
";",
"int",
"iErrorCode",
"=",
"fldTarget",
".",
"setValue",
"(",
"this",
".",
"computeValue",
"(",
"srcValue",
")",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"if",
"(",
"m_bDisableTarget",
")",
"fldTarget",
".",
"setEnableListeners",
"(",
"rgbListeners",
")",
";",
"return",
"iErrorCode",
";",
"}"
] |
The Field has Changed.
Get the value of this listener's owner, pass it to the computeValue method and
set the returned value to 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).
Field changed, re-compute the value in this field.
|
[
"The",
"Field",
"has",
"Changed",
".",
"Get",
"the",
"value",
"of",
"this",
"listener",
"s",
"owner",
"pass",
"it",
"to",
"the",
"computeValue",
"method",
"and",
"set",
"the",
"returned",
"value",
"to",
"the",
"target",
"field",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReComputeFieldHandler.java#L129-L142
|
153,649
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/ReComputeFieldHandler.java
|
ReComputeFieldHandler.getFieldTarget
|
public BaseField getFieldTarget()
{
BaseField fldTarget = m_fldTarget;
if (fldTarget == null)
if (targetFieldName != null)
fldTarget = (NumberField)(this.getOwner().getRecord().getField(targetFieldName));
if (fldTarget == null)
fldTarget = this.getOwner();
return fldTarget;
}
|
java
|
public BaseField getFieldTarget()
{
BaseField fldTarget = m_fldTarget;
if (fldTarget == null)
if (targetFieldName != null)
fldTarget = (NumberField)(this.getOwner().getRecord().getField(targetFieldName));
if (fldTarget == null)
fldTarget = this.getOwner();
return fldTarget;
}
|
[
"public",
"BaseField",
"getFieldTarget",
"(",
")",
"{",
"BaseField",
"fldTarget",
"=",
"m_fldTarget",
";",
"if",
"(",
"fldTarget",
"==",
"null",
")",
"if",
"(",
"targetFieldName",
"!=",
"null",
")",
"fldTarget",
"=",
"(",
"NumberField",
")",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getField",
"(",
"targetFieldName",
")",
")",
";",
"if",
"(",
"fldTarget",
"==",
"null",
")",
"fldTarget",
"=",
"this",
".",
"getOwner",
"(",
")",
";",
"return",
"fldTarget",
";",
"}"
] |
Get the field target.
|
[
"Get",
"the",
"field",
"target",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ReComputeFieldHandler.java#L146-L155
|
153,650
|
eliwan/ew-profiling
|
profiling-core/src/main/java/be/eliwan/profiling/service/ProfilingContainer.java
|
ProfilingContainer.start
|
@PostConstruct
public void start() {
threadFactory = Executors.defaultThreadFactory();
disruptor = new Disruptor<>(Registration.FACTORY,
ringSize,
threadFactory,
ProducerType.MULTI,
new BlockingWaitStrategy());
disruptor.handleEventsWith(new ContainerEventHandler());
ringBuffer = disruptor.start();
}
|
java
|
@PostConstruct
public void start() {
threadFactory = Executors.defaultThreadFactory();
disruptor = new Disruptor<>(Registration.FACTORY,
ringSize,
threadFactory,
ProducerType.MULTI,
new BlockingWaitStrategy());
disruptor.handleEventsWith(new ContainerEventHandler());
ringBuffer = disruptor.start();
}
|
[
"@",
"PostConstruct",
"public",
"void",
"start",
"(",
")",
"{",
"threadFactory",
"=",
"Executors",
".",
"defaultThreadFactory",
"(",
")",
";",
"disruptor",
"=",
"new",
"Disruptor",
"<>",
"(",
"Registration",
".",
"FACTORY",
",",
"ringSize",
",",
"threadFactory",
",",
"ProducerType",
".",
"MULTI",
",",
"new",
"BlockingWaitStrategy",
"(",
")",
")",
";",
"disruptor",
".",
"handleEventsWith",
"(",
"new",
"ContainerEventHandler",
"(",
")",
")",
";",
"ringBuffer",
"=",
"disruptor",
".",
"start",
"(",
")",
";",
"}"
] |
Set up the disruptor service to have a single consumer which aggregates the data.
|
[
"Set",
"up",
"the",
"disruptor",
"service",
"to",
"have",
"a",
"single",
"consumer",
"which",
"aggregates",
"the",
"data",
"."
] |
3315a0038de967fceb2f4be3c29393857d7b15a2
|
https://github.com/eliwan/ew-profiling/blob/3315a0038de967fceb2f4be3c29393857d7b15a2/profiling-core/src/main/java/be/eliwan/profiling/service/ProfilingContainer.java#L61-L71
|
153,651
|
jbundle/jbundle
|
thin/base/screen/cal/sample/basic/src/main/java/org/jbundle/thin/base/screen/cal/sample/basic/CalendarProduct.java
|
CalendarProduct.getMealDesc
|
public String getMealDesc(Date date)
{
if (!date.before(m_startTime)) if (!date.after(m_endTime))
return m_strMeals;
return null;
}
|
java
|
public String getMealDesc(Date date)
{
if (!date.before(m_startTime)) if (!date.after(m_endTime))
return m_strMeals;
return null;
}
|
[
"public",
"String",
"getMealDesc",
"(",
"Date",
"date",
")",
"{",
"if",
"(",
"!",
"date",
".",
"before",
"(",
"m_startTime",
")",
")",
"if",
"(",
"!",
"date",
".",
"after",
"(",
"m_endTime",
")",
")",
"return",
"m_strMeals",
";",
"return",
"null",
";",
"}"
] |
Get the meal description on this date.
|
[
"Get",
"the",
"meal",
"description",
"on",
"this",
"date",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/sample/basic/src/main/java/org/jbundle/thin/base/screen/cal/sample/basic/CalendarProduct.java#L100-L105
|
153,652
|
tsweets/jdefault
|
src/main/java/org/beer30/jdefault/JDefaultBusiness.java
|
JDefaultBusiness.creditCardExpiryDate
|
public static Date creditCardExpiryDate() {
DateTime dateTime = new DateTime();
DateTime addedMonths = dateTime.plusMonths(JDefaultNumber.randomIntBetweenTwoNumbers(24, 48));
return addedMonths.dayOfMonth().withMaximumValue().toDate();
}
|
java
|
public static Date creditCardExpiryDate() {
DateTime dateTime = new DateTime();
DateTime addedMonths = dateTime.plusMonths(JDefaultNumber.randomIntBetweenTwoNumbers(24, 48));
return addedMonths.dayOfMonth().withMaximumValue().toDate();
}
|
[
"public",
"static",
"Date",
"creditCardExpiryDate",
"(",
")",
"{",
"DateTime",
"dateTime",
"=",
"new",
"DateTime",
"(",
")",
";",
"DateTime",
"addedMonths",
"=",
"dateTime",
".",
"plusMonths",
"(",
"JDefaultNumber",
".",
"randomIntBetweenTwoNumbers",
"(",
"24",
",",
"48",
")",
")",
";",
"return",
"addedMonths",
".",
"dayOfMonth",
"(",
")",
".",
"withMaximumValue",
"(",
")",
".",
"toDate",
"(",
")",
";",
"}"
] |
Typically Cards are good for 3 years. Will create a random date between 24 and 48 months
@return date
|
[
"Typically",
"Cards",
"are",
"good",
"for",
"3",
"years",
".",
"Will",
"create",
"a",
"random",
"date",
"between",
"24",
"and",
"48",
"months"
] |
1793ab8e1337e930f31e362071db4af0c3978b70
|
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultBusiness.java#L38-L42
|
153,653
|
tsweets/jdefault
|
src/main/java/org/beer30/jdefault/JDefaultBusiness.java
|
JDefaultBusiness.creditCardNumber
|
public static String creditCardNumber(JDefaultCreditCardType type) {
String ccNumber = null;
switch (type) {
case VISA: {
StringBuffer tempCC = new StringBuffer("4");
tempCC.append(JDefaultNumber.randomNumberString(14));
ccNumber = tempCC.append(+generateCheckDigit(tempCC.toString())).toString();
break;
}
case MASTERCARD: {
StringBuffer tempCC = new StringBuffer("5");
tempCC.append(JDefaultNumber.randomIntBetweenTwoNumbers(1, 5));
tempCC.append(JDefaultNumber.randomNumberString(13));
ccNumber = tempCC.append(+generateCheckDigit(tempCC.toString())).toString();
break;
}
case AMEX: {
StringBuffer tempCC = new StringBuffer("3");
tempCC.append(JDefaultNumber.randomIntBetweenTwoNumbers(4, 7));
tempCC.append(JDefaultNumber.randomNumberString(12));
ccNumber = tempCC.append(+generateCheckDigit(tempCC.toString())).toString();
break;
}
case DISCOVER: {
StringBuffer tempCC = new StringBuffer("6011");
tempCC.append(JDefaultNumber.randomNumberString(11));
ccNumber = tempCC.append(+generateCheckDigit(tempCC.toString())).toString();
break;
}
}
return ccNumber;
}
|
java
|
public static String creditCardNumber(JDefaultCreditCardType type) {
String ccNumber = null;
switch (type) {
case VISA: {
StringBuffer tempCC = new StringBuffer("4");
tempCC.append(JDefaultNumber.randomNumberString(14));
ccNumber = tempCC.append(+generateCheckDigit(tempCC.toString())).toString();
break;
}
case MASTERCARD: {
StringBuffer tempCC = new StringBuffer("5");
tempCC.append(JDefaultNumber.randomIntBetweenTwoNumbers(1, 5));
tempCC.append(JDefaultNumber.randomNumberString(13));
ccNumber = tempCC.append(+generateCheckDigit(tempCC.toString())).toString();
break;
}
case AMEX: {
StringBuffer tempCC = new StringBuffer("3");
tempCC.append(JDefaultNumber.randomIntBetweenTwoNumbers(4, 7));
tempCC.append(JDefaultNumber.randomNumberString(12));
ccNumber = tempCC.append(+generateCheckDigit(tempCC.toString())).toString();
break;
}
case DISCOVER: {
StringBuffer tempCC = new StringBuffer("6011");
tempCC.append(JDefaultNumber.randomNumberString(11));
ccNumber = tempCC.append(+generateCheckDigit(tempCC.toString())).toString();
break;
}
}
return ccNumber;
}
|
[
"public",
"static",
"String",
"creditCardNumber",
"(",
"JDefaultCreditCardType",
"type",
")",
"{",
"String",
"ccNumber",
"=",
"null",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"VISA",
":",
"{",
"StringBuffer",
"tempCC",
"=",
"new",
"StringBuffer",
"(",
"\"4\"",
")",
";",
"tempCC",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomNumberString",
"(",
"14",
")",
")",
";",
"ccNumber",
"=",
"tempCC",
".",
"append",
"(",
"+",
"generateCheckDigit",
"(",
"tempCC",
".",
"toString",
"(",
")",
")",
")",
".",
"toString",
"(",
")",
";",
"break",
";",
"}",
"case",
"MASTERCARD",
":",
"{",
"StringBuffer",
"tempCC",
"=",
"new",
"StringBuffer",
"(",
"\"5\"",
")",
";",
"tempCC",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomIntBetweenTwoNumbers",
"(",
"1",
",",
"5",
")",
")",
";",
"tempCC",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomNumberString",
"(",
"13",
")",
")",
";",
"ccNumber",
"=",
"tempCC",
".",
"append",
"(",
"+",
"generateCheckDigit",
"(",
"tempCC",
".",
"toString",
"(",
")",
")",
")",
".",
"toString",
"(",
")",
";",
"break",
";",
"}",
"case",
"AMEX",
":",
"{",
"StringBuffer",
"tempCC",
"=",
"new",
"StringBuffer",
"(",
"\"3\"",
")",
";",
"tempCC",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomIntBetweenTwoNumbers",
"(",
"4",
",",
"7",
")",
")",
";",
"tempCC",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomNumberString",
"(",
"12",
")",
")",
";",
"ccNumber",
"=",
"tempCC",
".",
"append",
"(",
"+",
"generateCheckDigit",
"(",
"tempCC",
".",
"toString",
"(",
")",
")",
")",
".",
"toString",
"(",
")",
";",
"break",
";",
"}",
"case",
"DISCOVER",
":",
"{",
"StringBuffer",
"tempCC",
"=",
"new",
"StringBuffer",
"(",
"\"6011\"",
")",
";",
"tempCC",
".",
"append",
"(",
"JDefaultNumber",
".",
"randomNumberString",
"(",
"11",
")",
")",
";",
"ccNumber",
"=",
"tempCC",
".",
"append",
"(",
"+",
"generateCheckDigit",
"(",
"tempCC",
".",
"toString",
"(",
")",
")",
")",
".",
"toString",
"(",
")",
";",
"break",
";",
"}",
"}",
"return",
"ccNumber",
";",
"}"
] |
Create a Credit Card number for different types of cards. The number that is generated can pass through a
Luhn verification process, since the proper check digit is calculated.
@param type of credit card number to create
@return credit card number string
|
[
"Create",
"a",
"Credit",
"Card",
"number",
"for",
"different",
"types",
"of",
"cards",
".",
"The",
"number",
"that",
"is",
"generated",
"can",
"pass",
"through",
"a",
"Luhn",
"verification",
"process",
"since",
"the",
"proper",
"check",
"digit",
"is",
"calculated",
"."
] |
1793ab8e1337e930f31e362071db4af0c3978b70
|
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultBusiness.java#L51-L82
|
153,654
|
tsweets/jdefault
|
src/main/java/org/beer30/jdefault/JDefaultBusiness.java
|
JDefaultBusiness.money
|
public static Double money(int maxDollars) {
int dollars = RandomUtils.nextInt(maxDollars + 1);
int cents = RandomUtils.nextInt(100);
Double d = new Double(dollars + "." + cents);
return d;
}
|
java
|
public static Double money(int maxDollars) {
int dollars = RandomUtils.nextInt(maxDollars + 1);
int cents = RandomUtils.nextInt(100);
Double d = new Double(dollars + "." + cents);
return d;
}
|
[
"public",
"static",
"Double",
"money",
"(",
"int",
"maxDollars",
")",
"{",
"int",
"dollars",
"=",
"RandomUtils",
".",
"nextInt",
"(",
"maxDollars",
"+",
"1",
")",
";",
"int",
"cents",
"=",
"RandomUtils",
".",
"nextInt",
"(",
"100",
")",
";",
"Double",
"d",
"=",
"new",
"Double",
"(",
"dollars",
"+",
"\".\"",
"+",
"cents",
")",
";",
"return",
"d",
";",
"}"
] |
Random dollar amount starting at zero
@param maxDollars to return
@return double value of random money
|
[
"Random",
"dollar",
"amount",
"starting",
"at",
"zero"
] |
1793ab8e1337e930f31e362071db4af0c3978b70
|
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultBusiness.java#L121-L126
|
153,655
|
ArpNetworking/metrics-incubator-extra
|
src/main/java/com/arpnetworking/metrics/incubator/impl/ReadWriteLockedReference.java
|
ReadWriteLockedReference.getAndSetReference
|
public T getAndSetReference(final T newValue) {
_lock.writeLock().lock();
final T oldReference = _reference.getAndSet(newValue);
_lock.writeLock().unlock();
return oldReference;
}
|
java
|
public T getAndSetReference(final T newValue) {
_lock.writeLock().lock();
final T oldReference = _reference.getAndSet(newValue);
_lock.writeLock().unlock();
return oldReference;
}
|
[
"public",
"T",
"getAndSetReference",
"(",
"final",
"T",
"newValue",
")",
"{",
"_lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"final",
"T",
"oldReference",
"=",
"_reference",
".",
"getAndSet",
"(",
"newValue",
")",
";",
"_lock",
".",
"writeLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"return",
"oldReference",
";",
"}"
] |
Replaces the held reference safely.
@param newValue the new reference
@return the old reference
|
[
"Replaces",
"the",
"held",
"reference",
"safely",
"."
] |
6a0fe67b8eb714e0c4097d24383e6e7936bc1e2f
|
https://github.com/ArpNetworking/metrics-incubator-extra/blob/6a0fe67b8eb714e0c4097d24383e6e7936bc1e2f/src/main/java/com/arpnetworking/metrics/incubator/impl/ReadWriteLockedReference.java#L68-L73
|
153,656
|
inkstand-io/scribble
|
scribble-core/src/main/java/io/inkstand/scribble/rules/ExternalResource.java
|
ExternalResource.apply
|
@Override
public Statement apply(final Statement base, final Description description) {
if (description.isSuite()) {
return super.apply(classStatement(base), description);
}
return super.apply(statement(base), description);
}
|
java
|
@Override
public Statement apply(final Statement base, final Description description) {
if (description.isSuite()) {
return super.apply(classStatement(base), description);
}
return super.apply(statement(base), description);
}
|
[
"@",
"Override",
"public",
"Statement",
"apply",
"(",
"final",
"Statement",
"base",
",",
"final",
"Description",
"description",
")",
"{",
"if",
"(",
"description",
".",
"isSuite",
"(",
")",
")",
"{",
"return",
"super",
".",
"apply",
"(",
"classStatement",
"(",
"base",
")",
",",
"description",
")",
";",
"}",
"return",
"super",
".",
"apply",
"(",
"statement",
"(",
"base",
")",
",",
"description",
")",
";",
"}"
] |
Verifies if the caller is a Suite and triggers the beforeClass and afterClass behavior.
|
[
"Verifies",
"if",
"the",
"caller",
"is",
"a",
"Suite",
"and",
"triggers",
"the",
"beforeClass",
"and",
"afterClass",
"behavior",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-core/src/main/java/io/inkstand/scribble/rules/ExternalResource.java#L42-L48
|
153,657
|
AlexLandau/gdl-validation
|
src/main/java/net/alloyggp/griddle/validator/ValidatorConfiguration.java
|
ValidatorConfiguration.createExperimental
|
public static ValidatorConfiguration createExperimental() {
Map<Check, Level> checks = getStandardChecks();
checks.put(GdlArityCheck.INSTANCE, Level.ERROR);
checks.put(GdlNotInRuleHeadCheck.INSTANCE, Level.ERROR);
checks.put(UnrecognizedGdlArgumentCheck.INSTANCE, Level.WARNING);
// (gdl random)
checks.put(GdlRandomGoalCheck.INSTANCE, Level.ERROR);
return new ValidatorConfiguration(checks);
}
|
java
|
public static ValidatorConfiguration createExperimental() {
Map<Check, Level> checks = getStandardChecks();
checks.put(GdlArityCheck.INSTANCE, Level.ERROR);
checks.put(GdlNotInRuleHeadCheck.INSTANCE, Level.ERROR);
checks.put(UnrecognizedGdlArgumentCheck.INSTANCE, Level.WARNING);
// (gdl random)
checks.put(GdlRandomGoalCheck.INSTANCE, Level.ERROR);
return new ValidatorConfiguration(checks);
}
|
[
"public",
"static",
"ValidatorConfiguration",
"createExperimental",
"(",
")",
"{",
"Map",
"<",
"Check",
",",
"Level",
">",
"checks",
"=",
"getStandardChecks",
"(",
")",
";",
"checks",
".",
"put",
"(",
"GdlArityCheck",
".",
"INSTANCE",
",",
"Level",
".",
"ERROR",
")",
";",
"checks",
".",
"put",
"(",
"GdlNotInRuleHeadCheck",
".",
"INSTANCE",
",",
"Level",
".",
"ERROR",
")",
";",
"checks",
".",
"put",
"(",
"UnrecognizedGdlArgumentCheck",
".",
"INSTANCE",
",",
"Level",
".",
"WARNING",
")",
";",
"// (gdl random)",
"checks",
".",
"put",
"(",
"GdlRandomGoalCheck",
".",
"INSTANCE",
",",
"Level",
".",
"ERROR",
")",
";",
"return",
"new",
"ValidatorConfiguration",
"(",
"checks",
")",
";",
"}"
] |
This validator includes support for the experimental GDL keyword and associated
GDL variants.
|
[
"This",
"validator",
"includes",
"support",
"for",
"the",
"experimental",
"GDL",
"keyword",
"and",
"associated",
"GDL",
"variants",
"."
] |
ec87cc9fdd8af32d79aa7d130b7cb062f29834fb
|
https://github.com/AlexLandau/gdl-validation/blob/ec87cc9fdd8af32d79aa7d130b7cb062f29834fb/src/main/java/net/alloyggp/griddle/validator/ValidatorConfiguration.java#L56-L67
|
153,658
|
CrazyOrr/RollingLogger
|
src/main/java/com/github/crazyorr/rollinglogger/RollingLogger.java
|
RollingLogger.getLogFileIndex
|
private int getLogFileIndex(String fileName) {
int fileIndex = 0;
try {
fileIndex = Integer.parseInt(fileName.substring(fileName
.lastIndexOf(COUNT_SEPARATOR) + 1));
} catch (NumberFormatException e) {
e.printStackTrace();
}
return fileIndex;
}
|
java
|
private int getLogFileIndex(String fileName) {
int fileIndex = 0;
try {
fileIndex = Integer.parseInt(fileName.substring(fileName
.lastIndexOf(COUNT_SEPARATOR) + 1));
} catch (NumberFormatException e) {
e.printStackTrace();
}
return fileIndex;
}
|
[
"private",
"int",
"getLogFileIndex",
"(",
"String",
"fileName",
")",
"{",
"int",
"fileIndex",
"=",
"0",
";",
"try",
"{",
"fileIndex",
"=",
"Integer",
".",
"parseInt",
"(",
"fileName",
".",
"substring",
"(",
"fileName",
".",
"lastIndexOf",
"(",
"COUNT_SEPARATOR",
")",
"+",
"1",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"fileIndex",
";",
"}"
] |
Get the log file index from the composed log file name.
@param fileName
Log file name with index appended
@return Log file index
|
[
"Get",
"the",
"log",
"file",
"index",
"from",
"the",
"composed",
"log",
"file",
"name",
"."
] |
5203ba7424a932e58f374ca5cbfa31175715ed82
|
https://github.com/CrazyOrr/RollingLogger/blob/5203ba7424a932e58f374ca5cbfa31175715ed82/src/main/java/com/github/crazyorr/rollinglogger/RollingLogger.java#L197-L206
|
153,659
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/sort/linearlogarithmic/Merge.java
|
Merge.sort
|
private static <E extends Comparable<E>> void sort(List<E> list, int start, int end, boolean descending) {
if(start == end) {
return ;
}
int middle = (start + end) >> 1;
Merge.sort(list, start, middle, descending);
Merge.sort(list, middle + 1, end, descending);
if(descending) {
Merge.mergeDescending(list, start, middle, end);
}
else {
Merge.merge(list, start, middle, end);
}
}
|
java
|
private static <E extends Comparable<E>> void sort(List<E> list, int start, int end, boolean descending) {
if(start == end) {
return ;
}
int middle = (start + end) >> 1;
Merge.sort(list, start, middle, descending);
Merge.sort(list, middle + 1, end, descending);
if(descending) {
Merge.mergeDescending(list, start, middle, end);
}
else {
Merge.merge(list, start, middle, end);
}
}
|
[
"private",
"static",
"<",
"E",
"extends",
"Comparable",
"<",
"E",
">",
">",
"void",
"sort",
"(",
"List",
"<",
"E",
">",
"list",
",",
"int",
"start",
",",
"int",
"end",
",",
"boolean",
"descending",
")",
"{",
"if",
"(",
"start",
"==",
"end",
")",
"{",
"return",
";",
"}",
"int",
"middle",
"=",
"(",
"start",
"+",
"end",
")",
">>",
"1",
";",
"Merge",
".",
"sort",
"(",
"list",
",",
"start",
",",
"middle",
",",
"descending",
")",
";",
"Merge",
".",
"sort",
"(",
"list",
",",
"middle",
"+",
"1",
",",
"end",
",",
"descending",
")",
";",
"if",
"(",
"descending",
")",
"{",
"Merge",
".",
"mergeDescending",
"(",
"list",
",",
"start",
",",
"middle",
",",
"end",
")",
";",
"}",
"else",
"{",
"Merge",
".",
"merge",
"(",
"list",
",",
"start",
",",
"middle",
",",
"end",
")",
";",
"}",
"}"
] |
Sort routine that recursively calls itself after splitting the original list
in half. This routine is used for both ascending and descending sort since
the work done is similar. The only difference is when calling the merge
routine.
@param <E> the type of elements in this list.
@param list list that we want to sort
@param start index of the starting point to sort
@param end index of the end point to sort
@param descending boolean value that determines if we want to do descending sort
|
[
"Sort",
"routine",
"that",
"recursively",
"calls",
"itself",
"after",
"splitting",
"the",
"original",
"list",
"in",
"half",
".",
"This",
"routine",
"is",
"used",
"for",
"both",
"ascending",
"and",
"descending",
"sort",
"since",
"the",
"work",
"done",
"is",
"similar",
".",
"The",
"only",
"difference",
"is",
"when",
"calling",
"the",
"merge",
"routine",
"."
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/linearlogarithmic/Merge.java#L1099-L1115
|
153,660
|
nwillc/almost-functional
|
src/main/java/almost/functional/ImmutableIterator.java
|
ImmutableIterator.makeImmutable
|
public static <E> ImmutableIterator<E> makeImmutable(final Iterator<E> iterator) {
return new ImmutableIterator<E>() {
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public E next() {
return iterator.next();
}
};
}
|
java
|
public static <E> ImmutableIterator<E> makeImmutable(final Iterator<E> iterator) {
return new ImmutableIterator<E>() {
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public E next() {
return iterator.next();
}
};
}
|
[
"public",
"static",
"<",
"E",
">",
"ImmutableIterator",
"<",
"E",
">",
"makeImmutable",
"(",
"final",
"Iterator",
"<",
"E",
">",
"iterator",
")",
"{",
"return",
"new",
"ImmutableIterator",
"<",
"E",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"return",
"iterator",
".",
"hasNext",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"E",
"next",
"(",
")",
"{",
"return",
"iterator",
".",
"next",
"(",
")",
";",
"}",
"}",
";",
"}"
] |
Make an iterator immutable.
@param iterator the iterator
@param <E> the type the iterator returns
@return an immutable iterator
|
[
"Make",
"an",
"iterator",
"immutable",
"."
] |
a6cc7c73b2be475ed1bce5128c24b2eb9c27d666
|
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/ImmutableIterator.java#L37-L49
|
153,661
|
js-lib-com/commons
|
src/main/java/js/io/FilesOutputStream.java
|
FilesOutputStream.addFile
|
public void addFile(File file) throws IOException {
if (!file.exists()) {
throw new IllegalArgumentException(String.format("File |%s| does not exist.", file));
}
if (file.isDirectory()) {
throw new IllegalArgumentException(String.format("File |%s| is a directory.", file));
}
addFileEntry(file.getPath(), new FileInputStream(file));
}
|
java
|
public void addFile(File file) throws IOException {
if (!file.exists()) {
throw new IllegalArgumentException(String.format("File |%s| does not exist.", file));
}
if (file.isDirectory()) {
throw new IllegalArgumentException(String.format("File |%s| is a directory.", file));
}
addFileEntry(file.getPath(), new FileInputStream(file));
}
|
[
"public",
"void",
"addFile",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"File |%s| does not exist.\"",
",",
"file",
")",
")",
";",
"}",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"File |%s| is a directory.\"",
",",
"file",
")",
")",
";",
"}",
"addFileEntry",
"(",
"file",
".",
"getPath",
"(",
")",
",",
"new",
"FileInputStream",
"(",
"file",
")",
")",
";",
"}"
] |
Inject file content into archive using file relative path as archive entry name. File to add is relative to a common base
directory. All files from this archive should be part of that base directory hierarchy; it is user code responsibility to
enforce this constrain.
@param file file to add to this archive.
@throws IllegalArgumentException if <code>file</code> does not exist or is a directory.
@throws IOException if archive writing operation fails.
|
[
"Inject",
"file",
"content",
"into",
"archive",
"using",
"file",
"relative",
"path",
"as",
"archive",
"entry",
"name",
".",
"File",
"to",
"add",
"is",
"relative",
"to",
"a",
"common",
"base",
"directory",
".",
"All",
"files",
"from",
"this",
"archive",
"should",
"be",
"part",
"of",
"that",
"base",
"directory",
"hierarchy",
";",
"it",
"is",
"user",
"code",
"responsibility",
"to",
"enforce",
"this",
"constrain",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesOutputStream.java#L144-L152
|
153,662
|
js-lib-com/commons
|
src/main/java/js/io/FilesOutputStream.java
|
FilesOutputStream.addFileEntry
|
private void addFileEntry(String entryName, InputStream inputStream) throws IOException {
// write lazily the manifest before adding the first file
if (manifest != null) {
addManifestEntry();
}
ZipEntry entry = new ZipEntry(entryName);
filesArchive.putNextEntry(entry);
inputStream = new BufferedInputStream(inputStream);
try {
byte[] buffer = new byte[BUFFER_SIZE];
for (;;) {
int bytesRead = inputStream.read(buffer);
if (bytesRead <= 0) {
break;
}
write(buffer, 0, bytesRead);
}
} finally {
Files.close(inputStream);
filesArchive.closeEntry();
}
}
|
java
|
private void addFileEntry(String entryName, InputStream inputStream) throws IOException {
// write lazily the manifest before adding the first file
if (manifest != null) {
addManifestEntry();
}
ZipEntry entry = new ZipEntry(entryName);
filesArchive.putNextEntry(entry);
inputStream = new BufferedInputStream(inputStream);
try {
byte[] buffer = new byte[BUFFER_SIZE];
for (;;) {
int bytesRead = inputStream.read(buffer);
if (bytesRead <= 0) {
break;
}
write(buffer, 0, bytesRead);
}
} finally {
Files.close(inputStream);
filesArchive.closeEntry();
}
}
|
[
"private",
"void",
"addFileEntry",
"(",
"String",
"entryName",
",",
"InputStream",
"inputStream",
")",
"throws",
"IOException",
"{",
"// write lazily the manifest before adding the first file\r",
"if",
"(",
"manifest",
"!=",
"null",
")",
"{",
"addManifestEntry",
"(",
")",
";",
"}",
"ZipEntry",
"entry",
"=",
"new",
"ZipEntry",
"(",
"entryName",
")",
";",
"filesArchive",
".",
"putNextEntry",
"(",
"entry",
")",
";",
"inputStream",
"=",
"new",
"BufferedInputStream",
"(",
"inputStream",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"BUFFER_SIZE",
"]",
";",
"for",
"(",
";",
";",
")",
"{",
"int",
"bytesRead",
"=",
"inputStream",
".",
"read",
"(",
"buffer",
")",
";",
"if",
"(",
"bytesRead",
"<=",
"0",
")",
"{",
"break",
";",
"}",
"write",
"(",
"buffer",
",",
"0",
",",
"bytesRead",
")",
";",
"}",
"}",
"finally",
"{",
"Files",
".",
"close",
"(",
"inputStream",
")",
";",
"filesArchive",
".",
"closeEntry",
"(",
")",
";",
"}",
"}"
] |
Add file entry to this files archive. This method takes care to lazily write manifest just before first file entry.
@param entryName entry name,
@param inputStream file content.
@throws IOException if file entry write fails.
|
[
"Add",
"file",
"entry",
"to",
"this",
"files",
"archive",
".",
"This",
"method",
"takes",
"care",
"to",
"lazily",
"write",
"manifest",
"just",
"before",
"first",
"file",
"entry",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesOutputStream.java#L191-L214
|
153,663
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseFrame.java
|
JBaseFrame.free
|
public void free()
{
if (this.getContentPane().getComponentCount() > 0)
if (this.getContentPane().getComponent(0) instanceof BaseApplet)
((BaseApplet)this.getContentPane().getComponent(0)).free();
this.dispose();
}
|
java
|
public void free()
{
if (this.getContentPane().getComponentCount() > 0)
if (this.getContentPane().getComponent(0) instanceof BaseApplet)
((BaseApplet)this.getContentPane().getComponent(0)).free();
this.dispose();
}
|
[
"public",
"void",
"free",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getContentPane",
"(",
")",
".",
"getComponentCount",
"(",
")",
">",
"0",
")",
"if",
"(",
"this",
".",
"getContentPane",
"(",
")",
".",
"getComponent",
"(",
"0",
")",
"instanceof",
"BaseApplet",
")",
"(",
"(",
"BaseApplet",
")",
"this",
".",
"getContentPane",
"(",
")",
".",
"getComponent",
"(",
"0",
")",
")",
".",
"free",
"(",
")",
";",
"this",
".",
"dispose",
"(",
")",
";",
"}"
] |
Close this frame and free the baseApplet.
|
[
"Close",
"this",
"frame",
"and",
"free",
"the",
"baseApplet",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseFrame.java#L71-L77
|
153,664
|
krotscheck/data-file-reader
|
data-file-reader-bson/src/main/java/net/krotscheck/dfr/bson/BSONDataEncoder.java
|
BSONDataEncoder.dispose
|
@Override
protected void dispose() {
try {
if (generator != null) {
generator.writeEndArray();
generator.close();
}
this.getOutputStream().close();
} catch (IOException ioe) {
logger.error("Unable to close stream", ioe);
logger.trace(ioe.getMessage(), ioe);
} finally {
generator = null;
this.setOutputStream(null);
}
}
|
java
|
@Override
protected void dispose() {
try {
if (generator != null) {
generator.writeEndArray();
generator.close();
}
this.getOutputStream().close();
} catch (IOException ioe) {
logger.error("Unable to close stream", ioe);
logger.trace(ioe.getMessage(), ioe);
} finally {
generator = null;
this.setOutputStream(null);
}
}
|
[
"@",
"Override",
"protected",
"void",
"dispose",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"generator",
"!=",
"null",
")",
"{",
"generator",
".",
"writeEndArray",
"(",
")",
";",
"generator",
".",
"close",
"(",
")",
";",
"}",
"this",
".",
"getOutputStream",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"logger",
".",
"error",
"(",
"\"Unable to close stream\"",
",",
"ioe",
")",
";",
"logger",
".",
"trace",
"(",
"ioe",
".",
"getMessage",
"(",
")",
",",
"ioe",
")",
";",
"}",
"finally",
"{",
"generator",
"=",
"null",
";",
"this",
".",
"setOutputStream",
"(",
"null",
")",
";",
"}",
"}"
] |
Closes the output stream.
|
[
"Closes",
"the",
"output",
"stream",
"."
] |
b9a85bd07dc9f9b8291ffbfb6945443d96371811
|
https://github.com/krotscheck/data-file-reader/blob/b9a85bd07dc9f9b8291ffbfb6945443d96371811/data-file-reader-bson/src/main/java/net/krotscheck/dfr/bson/BSONDataEncoder.java#L72-L87
|
153,665
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/HtmlSource.java
|
HtmlSource.parseNextLine
|
public boolean parseNextLine()
{
if (firstTime)
{
firstTime = false;
// Obtain an instance of an XMLReader implementation from a system property
try {
XMLReader parser = org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
// Set the ContentHandler...
parser.setContentHandler( m_handler );
// Parse the file...
parser.parse( new InputSource( m_reader ));
} catch (IOException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
}
m_record.close();
}
try {
return m_record.hasNext();
} catch (DBException e) {
e.printStackTrace();
}
return false;
}
|
java
|
public boolean parseNextLine()
{
if (firstTime)
{
firstTime = false;
// Obtain an instance of an XMLReader implementation from a system property
try {
XMLReader parser = org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
// Set the ContentHandler...
parser.setContentHandler( m_handler );
// Parse the file...
parser.parse( new InputSource( m_reader ));
} catch (IOException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
}
m_record.close();
}
try {
return m_record.hasNext();
} catch (DBException e) {
e.printStackTrace();
}
return false;
}
|
[
"public",
"boolean",
"parseNextLine",
"(",
")",
"{",
"if",
"(",
"firstTime",
")",
"{",
"firstTime",
"=",
"false",
";",
"// Obtain an instance of an XMLReader implementation from a system property",
"try",
"{",
"XMLReader",
"parser",
"=",
"org",
".",
"xml",
".",
"sax",
".",
"helpers",
".",
"XMLReaderFactory",
".",
"createXMLReader",
"(",
")",
";",
"// Set the ContentHandler...",
"parser",
".",
"setContentHandler",
"(",
"m_handler",
")",
";",
"// Parse the file...",
"parser",
".",
"parse",
"(",
"new",
"InputSource",
"(",
"m_reader",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"SAXException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"m_record",
".",
"close",
"(",
")",
";",
"}",
"try",
"{",
"return",
"m_record",
".",
"hasNext",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Parse the next line and return false at EOF.
|
[
"Parse",
"the",
"next",
"line",
"and",
"return",
"false",
"at",
"EOF",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/HtmlSource.java#L60-L90
|
153,666
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java
|
JBasePanel.free
|
public void free()
{
if (this.getTargetScreen(JBaseFrame.class) != null)
((JBaseFrame)this.getTargetScreen(JBaseFrame.class)).setTitle(null);
this.freeSubComponents(this);
}
|
java
|
public void free()
{
if (this.getTargetScreen(JBaseFrame.class) != null)
((JBaseFrame)this.getTargetScreen(JBaseFrame.class)).setTitle(null);
this.freeSubComponents(this);
}
|
[
"public",
"void",
"free",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getTargetScreen",
"(",
"JBaseFrame",
".",
"class",
")",
"!=",
"null",
")",
"(",
"(",
"JBaseFrame",
")",
"this",
".",
"getTargetScreen",
"(",
"JBaseFrame",
".",
"class",
")",
")",
".",
"setTitle",
"(",
"null",
")",
";",
"this",
".",
"freeSubComponents",
"(",
"this",
")",
";",
"}"
] |
Free the resources held by this object.
This method calls freeSubComponents for this.
|
[
"Free",
"the",
"resources",
"held",
"by",
"this",
"object",
".",
"This",
"method",
"calls",
"freeSubComponents",
"for",
"this",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java#L104-L109
|
153,667
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java
|
JBasePanel.getSubScreen
|
public static Component getSubScreen(Container container, Class<?> targetClass)
{
for (int i = container.getComponentCount() - 1; i >= 0; i--)
{ // Go backwards to do toolbars, menubars last.
Component component = container.getComponent(i);
if (targetClass.isAssignableFrom(component.getClass()))
return component;
if (component instanceof Container)
{
component = JBasePanel.getSubScreen((Container)component, targetClass);
if (component != null)
return component;
}
}
return null;
}
|
java
|
public static Component getSubScreen(Container container, Class<?> targetClass)
{
for (int i = container.getComponentCount() - 1; i >= 0; i--)
{ // Go backwards to do toolbars, menubars last.
Component component = container.getComponent(i);
if (targetClass.isAssignableFrom(component.getClass()))
return component;
if (component instanceof Container)
{
component = JBasePanel.getSubScreen((Container)component, targetClass);
if (component != null)
return component;
}
}
return null;
}
|
[
"public",
"static",
"Component",
"getSubScreen",
"(",
"Container",
"container",
",",
"Class",
"<",
"?",
">",
"targetClass",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"container",
".",
"getComponentCount",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"// Go backwards to do toolbars, menubars last.",
"Component",
"component",
"=",
"container",
".",
"getComponent",
"(",
"i",
")",
";",
"if",
"(",
"targetClass",
".",
"isAssignableFrom",
"(",
"component",
".",
"getClass",
"(",
")",
")",
")",
"return",
"component",
";",
"if",
"(",
"component",
"instanceof",
"Container",
")",
"{",
"component",
"=",
"JBasePanel",
".",
"getSubScreen",
"(",
"(",
"Container",
")",
"component",
",",
"targetClass",
")",
";",
"if",
"(",
"component",
"!=",
"null",
")",
"return",
"component",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Climb down through the panel hierarchy until you find a component of this class.
@param component The (non-inclusive) component to start climbing down to find this class.
@param targetClass The class type to find (or inherited).
@return The first parent down the tree to match this class (or null).
|
[
"Climb",
"down",
"through",
"the",
"panel",
"hierarchy",
"until",
"you",
"find",
"a",
"component",
"of",
"this",
"class",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java#L391-L406
|
153,668
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java
|
JBasePanel.getComponentByName
|
public Component getComponentByName(String strName, Container parent)
{
for (int i = 0; i < parent.getComponentCount(); i++)
{
Component component = parent.getComponent(i);
if (strName.equals(component.getName()))
return component;
if (component instanceof Container)
{
component = this.getComponentByName(strName, (Container)component);
if (component != null)
return component;
}
}
return null; // Not found
}
|
java
|
public Component getComponentByName(String strName, Container parent)
{
for (int i = 0; i < parent.getComponentCount(); i++)
{
Component component = parent.getComponent(i);
if (strName.equals(component.getName()))
return component;
if (component instanceof Container)
{
component = this.getComponentByName(strName, (Container)component);
if (component != null)
return component;
}
}
return null; // Not found
}
|
[
"public",
"Component",
"getComponentByName",
"(",
"String",
"strName",
",",
"Container",
"parent",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parent",
".",
"getComponentCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"Component",
"component",
"=",
"parent",
".",
"getComponent",
"(",
"i",
")",
";",
"if",
"(",
"strName",
".",
"equals",
"(",
"component",
".",
"getName",
"(",
")",
")",
")",
"return",
"component",
";",
"if",
"(",
"component",
"instanceof",
"Container",
")",
"{",
"component",
"=",
"this",
".",
"getComponentByName",
"(",
"strName",
",",
"(",
"Container",
")",
"component",
")",
";",
"if",
"(",
"component",
"!=",
"null",
")",
"return",
"component",
";",
"}",
"}",
"return",
"null",
";",
"// Not found",
"}"
] |
Get the sub-component with this name.
@param strName The name I'm looking for.
@param parent The container to start the search from.
@return The component with this name (or null).
|
[
"Get",
"the",
"sub",
"-",
"component",
"with",
"this",
"name",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java#L422-L437
|
153,669
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java
|
JBasePanel.addScrollbars
|
public JPanel addScrollbars(JComponent screen)
{
Dimension dimension = screen.getPreferredSize();
if ((dimension.height == 0) && (dimension.width == 0))
dimension = JScreenConstants.PREFERRED_SCREEN_SIZE;
else if ((screen.getBounds().width != 0) && (screen.getBounds().height != 0))
{
dimension.width = screen.getBounds().width;
dimension.height = screen.getBounds().height;
}
dimension.width = Math.max(JScreenConstants.MIN_SCREEN_SIZE.width, Math.min(dimension.width + 20, JScreenConstants.PREFERRED_SCREEN_SIZE.width));
dimension.height = Math.max(JScreenConstants.MIN_SCREEN_SIZE.height, Math.min(dimension.height + 20, JScreenConstants.PREFERRED_SCREEN_SIZE.height));
JScrollPane scrollpane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
if (dimension != null)
scrollpane.setPreferredSize(dimension);
scrollpane.setAlignmentX(Component.LEFT_ALIGNMENT);
scrollpane.getViewport().add(screen);
JPanel panel = new JPanel();
panel.setAlignmentX(Component.LEFT_ALIGNMENT);
panel.add(scrollpane);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setOpaque(false);
screen.setOpaque(false);
scrollpane.setOpaque(false);
scrollpane.getViewport().setOpaque(false);
return panel;
}
|
java
|
public JPanel addScrollbars(JComponent screen)
{
Dimension dimension = screen.getPreferredSize();
if ((dimension.height == 0) && (dimension.width == 0))
dimension = JScreenConstants.PREFERRED_SCREEN_SIZE;
else if ((screen.getBounds().width != 0) && (screen.getBounds().height != 0))
{
dimension.width = screen.getBounds().width;
dimension.height = screen.getBounds().height;
}
dimension.width = Math.max(JScreenConstants.MIN_SCREEN_SIZE.width, Math.min(dimension.width + 20, JScreenConstants.PREFERRED_SCREEN_SIZE.width));
dimension.height = Math.max(JScreenConstants.MIN_SCREEN_SIZE.height, Math.min(dimension.height + 20, JScreenConstants.PREFERRED_SCREEN_SIZE.height));
JScrollPane scrollpane = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
if (dimension != null)
scrollpane.setPreferredSize(dimension);
scrollpane.setAlignmentX(Component.LEFT_ALIGNMENT);
scrollpane.getViewport().add(screen);
JPanel panel = new JPanel();
panel.setAlignmentX(Component.LEFT_ALIGNMENT);
panel.add(scrollpane);
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.setOpaque(false);
screen.setOpaque(false);
scrollpane.setOpaque(false);
scrollpane.getViewport().setOpaque(false);
return panel;
}
|
[
"public",
"JPanel",
"addScrollbars",
"(",
"JComponent",
"screen",
")",
"{",
"Dimension",
"dimension",
"=",
"screen",
".",
"getPreferredSize",
"(",
")",
";",
"if",
"(",
"(",
"dimension",
".",
"height",
"==",
"0",
")",
"&&",
"(",
"dimension",
".",
"width",
"==",
"0",
")",
")",
"dimension",
"=",
"JScreenConstants",
".",
"PREFERRED_SCREEN_SIZE",
";",
"else",
"if",
"(",
"(",
"screen",
".",
"getBounds",
"(",
")",
".",
"width",
"!=",
"0",
")",
"&&",
"(",
"screen",
".",
"getBounds",
"(",
")",
".",
"height",
"!=",
"0",
")",
")",
"{",
"dimension",
".",
"width",
"=",
"screen",
".",
"getBounds",
"(",
")",
".",
"width",
";",
"dimension",
".",
"height",
"=",
"screen",
".",
"getBounds",
"(",
")",
".",
"height",
";",
"}",
"dimension",
".",
"width",
"=",
"Math",
".",
"max",
"(",
"JScreenConstants",
".",
"MIN_SCREEN_SIZE",
".",
"width",
",",
"Math",
".",
"min",
"(",
"dimension",
".",
"width",
"+",
"20",
",",
"JScreenConstants",
".",
"PREFERRED_SCREEN_SIZE",
".",
"width",
")",
")",
";",
"dimension",
".",
"height",
"=",
"Math",
".",
"max",
"(",
"JScreenConstants",
".",
"MIN_SCREEN_SIZE",
".",
"height",
",",
"Math",
".",
"min",
"(",
"dimension",
".",
"height",
"+",
"20",
",",
"JScreenConstants",
".",
"PREFERRED_SCREEN_SIZE",
".",
"height",
")",
")",
";",
"JScrollPane",
"scrollpane",
"=",
"new",
"JScrollPane",
"(",
"ScrollPaneConstants",
".",
"VERTICAL_SCROLLBAR_AS_NEEDED",
",",
"ScrollPaneConstants",
".",
"HORIZONTAL_SCROLLBAR_AS_NEEDED",
")",
";",
"if",
"(",
"dimension",
"!=",
"null",
")",
"scrollpane",
".",
"setPreferredSize",
"(",
"dimension",
")",
";",
"scrollpane",
".",
"setAlignmentX",
"(",
"Component",
".",
"LEFT_ALIGNMENT",
")",
";",
"scrollpane",
".",
"getViewport",
"(",
")",
".",
"add",
"(",
"screen",
")",
";",
"JPanel",
"panel",
"=",
"new",
"JPanel",
"(",
")",
";",
"panel",
".",
"setAlignmentX",
"(",
"Component",
".",
"LEFT_ALIGNMENT",
")",
";",
"panel",
".",
"add",
"(",
"scrollpane",
")",
";",
"panel",
".",
"setLayout",
"(",
"new",
"BoxLayout",
"(",
"panel",
",",
"BoxLayout",
".",
"Y_AXIS",
")",
")",
";",
"panel",
".",
"setOpaque",
"(",
"false",
")",
";",
"screen",
".",
"setOpaque",
"(",
"false",
")",
";",
"scrollpane",
".",
"setOpaque",
"(",
"false",
")",
";",
"scrollpane",
".",
"getViewport",
"(",
")",
".",
"setOpaque",
"(",
"false",
")",
";",
"return",
"panel",
";",
"}"
] |
Add a scrollpane to this component and return the component with
the scroller and this screen in it.
@param screen The screen to add a scroller around.
|
[
"Add",
"a",
"scrollpane",
"to",
"this",
"component",
"and",
"return",
"the",
"component",
"with",
"the",
"scroller",
"and",
"this",
"screen",
"in",
"it",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java#L481-L507
|
153,670
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java
|
JBasePanel.getToolbarParent
|
public JBasePanel getToolbarParent()
{
JBasePanel parent = (JBasePanel)this.getTargetScreen(JBasePanel.class);
if (parent == null)
if (m_parent instanceof JBasePanel)
parent = (JBasePanel)m_parent;
if (parent == null)
return this;
return parent.getToolbarParent();
}
|
java
|
public JBasePanel getToolbarParent()
{
JBasePanel parent = (JBasePanel)this.getTargetScreen(JBasePanel.class);
if (parent == null)
if (m_parent instanceof JBasePanel)
parent = (JBasePanel)m_parent;
if (parent == null)
return this;
return parent.getToolbarParent();
}
|
[
"public",
"JBasePanel",
"getToolbarParent",
"(",
")",
"{",
"JBasePanel",
"parent",
"=",
"(",
"JBasePanel",
")",
"this",
".",
"getTargetScreen",
"(",
"JBasePanel",
".",
"class",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"if",
"(",
"m_parent",
"instanceof",
"JBasePanel",
")",
"parent",
"=",
"(",
"JBasePanel",
")",
"m_parent",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"return",
"this",
";",
"return",
"parent",
".",
"getToolbarParent",
"(",
")",
";",
"}"
] |
Get the highest level parent that is a JBasePanel.
This is where a toolbar or menubar should be added.
@return The top level parent (if none, return this).
|
[
"Get",
"the",
"highest",
"level",
"parent",
"that",
"is",
"a",
"JBasePanel",
".",
"This",
"is",
"where",
"a",
"toolbar",
"or",
"menubar",
"should",
"be",
"added",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java#L513-L522
|
153,671
|
jbundle/jbundle
|
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java
|
JBasePanel.addToolbar
|
public JPanel addToolbar(JComponent screen, JComponent toolbar)
{
JPanel panelMain = new JPanel();
panelMain.setOpaque(false);
panelMain.setLayout(new BoxLayout(panelMain, BoxLayout.Y_AXIS));
panelMain.add(toolbar);
toolbar.setAlignmentX(0);
panelMain.add(screen);
screen.setAlignmentX(0);
return panelMain;
}
|
java
|
public JPanel addToolbar(JComponent screen, JComponent toolbar)
{
JPanel panelMain = new JPanel();
panelMain.setOpaque(false);
panelMain.setLayout(new BoxLayout(panelMain, BoxLayout.Y_AXIS));
panelMain.add(toolbar);
toolbar.setAlignmentX(0);
panelMain.add(screen);
screen.setAlignmentX(0);
return panelMain;
}
|
[
"public",
"JPanel",
"addToolbar",
"(",
"JComponent",
"screen",
",",
"JComponent",
"toolbar",
")",
"{",
"JPanel",
"panelMain",
"=",
"new",
"JPanel",
"(",
")",
";",
"panelMain",
".",
"setOpaque",
"(",
"false",
")",
";",
"panelMain",
".",
"setLayout",
"(",
"new",
"BoxLayout",
"(",
"panelMain",
",",
"BoxLayout",
".",
"Y_AXIS",
")",
")",
";",
"panelMain",
".",
"add",
"(",
"toolbar",
")",
";",
"toolbar",
".",
"setAlignmentX",
"(",
"0",
")",
";",
"panelMain",
".",
"add",
"(",
"screen",
")",
";",
"screen",
".",
"setAlignmentX",
"(",
"0",
")",
";",
"return",
"panelMain",
";",
"}"
] |
Add this toolbar to this panel and return the new main panel.
@param screen The screen to add a toolbar to.
@param toolbar The toolbar to add.
@return The new panel with these two components in them.
|
[
"Add",
"this",
"toolbar",
"to",
"this",
"panel",
"and",
"return",
"the",
"new",
"main",
"panel",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java#L571-L581
|
153,672
|
jeroenvanmaanen/bridge-pattern
|
src/main/java/org/leialearns/bridge/FactoryAccessor.java
|
FactoryAccessor.set
|
public void set(BridgeFactory factory) {
if (factory.getNearType() != nearType) {
throw new IllegalArgumentException("Type mismatch: " + nearType + ": " + factory.getNearType());
}
factorySetting.set(factory);
}
|
java
|
public void set(BridgeFactory factory) {
if (factory.getNearType() != nearType) {
throw new IllegalArgumentException("Type mismatch: " + nearType + ": " + factory.getNearType());
}
factorySetting.set(factory);
}
|
[
"public",
"void",
"set",
"(",
"BridgeFactory",
"factory",
")",
"{",
"if",
"(",
"factory",
".",
"getNearType",
"(",
")",
"!=",
"nearType",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Type mismatch: \"",
"+",
"nearType",
"+",
"\": \"",
"+",
"factory",
".",
"getNearType",
"(",
")",
")",
";",
"}",
"factorySetting",
".",
"set",
"(",
"factory",
")",
";",
"}"
] |
Sets the bridge factory to use with this accessor. The near type of the given bridge factory has to match
the near type of this bridge accessor.
@param factory The bridge factory to set
|
[
"Sets",
"the",
"bridge",
"factory",
"to",
"use",
"with",
"this",
"accessor",
".",
"The",
"near",
"type",
"of",
"the",
"given",
"bridge",
"factory",
"has",
"to",
"match",
"the",
"near",
"type",
"of",
"this",
"bridge",
"accessor",
"."
] |
55bd2de8cff800a1a97e26e97d3600e6dfb00b59
|
https://github.com/jeroenvanmaanen/bridge-pattern/blob/55bd2de8cff800a1a97e26e97d3600e6dfb00b59/src/main/java/org/leialearns/bridge/FactoryAccessor.java#L33-L38
|
153,673
|
jeroenvanmaanen/bridge-pattern
|
src/main/java/org/leialearns/bridge/FactoryAccessor.java
|
FactoryAccessor.get
|
public BridgeFactory get() {
BridgeFactory result;
try {
result = factorySetting.get();
} catch (RuntimeException exception) {
RuntimeException wrapper = new IllegalStateException("Missing factory for: " + display(nearType), exception);
logger.trace("Stack trace", wrapper);
throw wrapper;
}
return result;
}
|
java
|
public BridgeFactory get() {
BridgeFactory result;
try {
result = factorySetting.get();
} catch (RuntimeException exception) {
RuntimeException wrapper = new IllegalStateException("Missing factory for: " + display(nearType), exception);
logger.trace("Stack trace", wrapper);
throw wrapper;
}
return result;
}
|
[
"public",
"BridgeFactory",
"get",
"(",
")",
"{",
"BridgeFactory",
"result",
";",
"try",
"{",
"result",
"=",
"factorySetting",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"exception",
")",
"{",
"RuntimeException",
"wrapper",
"=",
"new",
"IllegalStateException",
"(",
"\"Missing factory for: \"",
"+",
"display",
"(",
"nearType",
")",
",",
"exception",
")",
";",
"logger",
".",
"trace",
"(",
"\"Stack trace\"",
",",
"wrapper",
")",
";",
"throw",
"wrapper",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns the bridge factory for this accessor.
@return The bridge factory for this accessor
|
[
"Returns",
"the",
"bridge",
"factory",
"for",
"this",
"accessor",
"."
] |
55bd2de8cff800a1a97e26e97d3600e6dfb00b59
|
https://github.com/jeroenvanmaanen/bridge-pattern/blob/55bd2de8cff800a1a97e26e97d3600e6dfb00b59/src/main/java/org/leialearns/bridge/FactoryAccessor.java#L44-L54
|
153,674
|
jeroenvanmaanen/bridge-pattern
|
src/main/java/org/leialearns/bridge/FactoryAccessor.java
|
FactoryAccessor.getNearObject
|
public NT getNearObject(Object farObject) {
return nearType.cast(factorySetting.get().getNearObject(farObject));
}
|
java
|
public NT getNearObject(Object farObject) {
return nearType.cast(factorySetting.get().getNearObject(farObject));
}
|
[
"public",
"NT",
"getNearObject",
"(",
"Object",
"farObject",
")",
"{",
"return",
"nearType",
".",
"cast",
"(",
"factorySetting",
".",
"get",
"(",
")",
".",
"getNearObject",
"(",
"farObject",
")",
")",
";",
"}"
] |
Returns the near object that corresponds to the given far object. The types must match the bridge factory
associated with this accessor and the bridge factory must be set.
@param farObject The far object to look up
@return The corresponding near object
|
[
"Returns",
"the",
"near",
"object",
"that",
"corresponds",
"to",
"the",
"given",
"far",
"object",
".",
"The",
"types",
"must",
"match",
"the",
"bridge",
"factory",
"associated",
"with",
"this",
"accessor",
"and",
"the",
"bridge",
"factory",
"must",
"be",
"set",
"."
] |
55bd2de8cff800a1a97e26e97d3600e6dfb00b59
|
https://github.com/jeroenvanmaanen/bridge-pattern/blob/55bd2de8cff800a1a97e26e97d3600e6dfb00b59/src/main/java/org/leialearns/bridge/FactoryAccessor.java#L70-L72
|
153,675
|
evandor/unitprofiler
|
unitprofiler.core/src/main/java/de/twenty11/unitprofile/callback/ProfilerCallback.java
|
ProfilerCallback.start
|
public static MethodInvocation start(String objectName, String methodName, int lineNumber) {
bigMessage("Starting profiling... " + objectName + "#" + methodName + " (" + lineNumber + ")");
if (profiling()) {
logger.error("Profiling was already started for '{}'", callstack.getFirst().getCls() + "#"
+ callstack.getFirst().getMethod());
throw new IllegalStateException();
}
MethodDescriptor methodDescriptor = new MethodDescriptor(objectName, methodName, lineNumber);
MethodInvocation rootInvocation = new MethodInvocation(methodDescriptor);
invocations.add(rootInvocation);
callstack.add(rootInvocation);
Agent.setRootInvocation(rootInvocation);
return rootInvocation;
}
|
java
|
public static MethodInvocation start(String objectName, String methodName, int lineNumber) {
bigMessage("Starting profiling... " + objectName + "#" + methodName + " (" + lineNumber + ")");
if (profiling()) {
logger.error("Profiling was already started for '{}'", callstack.getFirst().getCls() + "#"
+ callstack.getFirst().getMethod());
throw new IllegalStateException();
}
MethodDescriptor methodDescriptor = new MethodDescriptor(objectName, methodName, lineNumber);
MethodInvocation rootInvocation = new MethodInvocation(methodDescriptor);
invocations.add(rootInvocation);
callstack.add(rootInvocation);
Agent.setRootInvocation(rootInvocation);
return rootInvocation;
}
|
[
"public",
"static",
"MethodInvocation",
"start",
"(",
"String",
"objectName",
",",
"String",
"methodName",
",",
"int",
"lineNumber",
")",
"{",
"bigMessage",
"(",
"\"Starting profiling... \"",
"+",
"objectName",
"+",
"\"#\"",
"+",
"methodName",
"+",
"\" (\"",
"+",
"lineNumber",
"+",
"\")\"",
")",
";",
"if",
"(",
"profiling",
"(",
")",
")",
"{",
"logger",
".",
"error",
"(",
"\"Profiling was already started for '{}'\"",
",",
"callstack",
".",
"getFirst",
"(",
")",
".",
"getCls",
"(",
")",
"+",
"\"#\"",
"+",
"callstack",
".",
"getFirst",
"(",
")",
".",
"getMethod",
"(",
")",
")",
";",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"MethodDescriptor",
"methodDescriptor",
"=",
"new",
"MethodDescriptor",
"(",
"objectName",
",",
"methodName",
",",
"lineNumber",
")",
";",
"MethodInvocation",
"rootInvocation",
"=",
"new",
"MethodInvocation",
"(",
"methodDescriptor",
")",
";",
"invocations",
".",
"add",
"(",
"rootInvocation",
")",
";",
"callstack",
".",
"add",
"(",
"rootInvocation",
")",
";",
"Agent",
".",
"setRootInvocation",
"(",
"rootInvocation",
")",
";",
"return",
"rootInvocation",
";",
"}"
] |
the first invocation for this profiling session.
@param objectName
@param methodName
@return
|
[
"the",
"first",
"invocation",
"for",
"this",
"profiling",
"session",
"."
] |
a875635d0f45ca7f9694c5e9c815109877d056b5
|
https://github.com/evandor/unitprofiler/blob/a875635d0f45ca7f9694c5e9c815109877d056b5/unitprofiler.core/src/main/java/de/twenty11/unitprofile/callback/ProfilerCallback.java#L40-L54
|
153,676
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java
|
BaseSession.getMainRecord
|
public Record getMainRecord()
{
Record record = super.getMainRecord();
if (record == null) if (m_sessionObjectParent != null)
record = ((BaseSession)m_sessionObjectParent).getMainRecord(); // Look thru the parent window now
return record;
}
|
java
|
public Record getMainRecord()
{
Record record = super.getMainRecord();
if (record == null) if (m_sessionObjectParent != null)
record = ((BaseSession)m_sessionObjectParent).getMainRecord(); // Look thru the parent window now
return record;
}
|
[
"public",
"Record",
"getMainRecord",
"(",
")",
"{",
"Record",
"record",
"=",
"super",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"if",
"(",
"m_sessionObjectParent",
"!=",
"null",
")",
"record",
"=",
"(",
"(",
"BaseSession",
")",
"m_sessionObjectParent",
")",
".",
"getMainRecord",
"(",
")",
";",
"// Look thru the parent window now",
"return",
"record",
";",
"}"
] |
Get the main record for this session.
@return The main record (or null if none).
|
[
"Get",
"the",
"main",
"record",
"for",
"this",
"session",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java#L167-L173
|
153,677
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java
|
BaseSession.getScreenRecord
|
public Record getScreenRecord()
{
Record record = super.getScreenRecord();
if (record == null) if (m_sessionObjectParent != null)
record = ((BaseSession)m_sessionObjectParent).getScreenRecord(); // Look thru the parent window now
return record;
}
|
java
|
public Record getScreenRecord()
{
Record record = super.getScreenRecord();
if (record == null) if (m_sessionObjectParent != null)
record = ((BaseSession)m_sessionObjectParent).getScreenRecord(); // Look thru the parent window now
return record;
}
|
[
"public",
"Record",
"getScreenRecord",
"(",
")",
"{",
"Record",
"record",
"=",
"super",
".",
"getScreenRecord",
"(",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"if",
"(",
"m_sessionObjectParent",
"!=",
"null",
")",
"record",
"=",
"(",
"(",
"BaseSession",
")",
"m_sessionObjectParent",
")",
".",
"getScreenRecord",
"(",
")",
";",
"// Look thru the parent window now",
"return",
"record",
";",
"}"
] |
Get the screen query.
@return The screen record (or null if none).
|
[
"Get",
"the",
"screen",
"query",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java#L190-L196
|
153,678
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java
|
BaseSession.setRecordCurrent
|
public Record setRecordCurrent()
{
Record recordMain = this.getMainRecord();
try {
if (recordMain != null)
{
if (m_objectID != null)
{ // Read the request
if (recordMain.setHandle(m_objectID, DBConstants.BOOKMARK_HANDLE) != null)
recordMain.edit();
else
m_objectID = null;
}
if (m_objectID == null)
if ((recordMain.getEditMode() != DBConstants.EDIT_CURRENT) && (recordMain.getEditMode() != DBConstants.EDIT_IN_PROGRESS)) // If the record is current, don't touch it.
{
recordMain.addNew();
}
}
} catch (DBException ex) {
Debug.print(ex);
ex.printStackTrace();
m_objectID = null;
}
if (m_objectID == null)
return null;
else
return recordMain;
}
|
java
|
public Record setRecordCurrent()
{
Record recordMain = this.getMainRecord();
try {
if (recordMain != null)
{
if (m_objectID != null)
{ // Read the request
if (recordMain.setHandle(m_objectID, DBConstants.BOOKMARK_HANDLE) != null)
recordMain.edit();
else
m_objectID = null;
}
if (m_objectID == null)
if ((recordMain.getEditMode() != DBConstants.EDIT_CURRENT) && (recordMain.getEditMode() != DBConstants.EDIT_IN_PROGRESS)) // If the record is current, don't touch it.
{
recordMain.addNew();
}
}
} catch (DBException ex) {
Debug.print(ex);
ex.printStackTrace();
m_objectID = null;
}
if (m_objectID == null)
return null;
else
return recordMain;
}
|
[
"public",
"Record",
"setRecordCurrent",
"(",
")",
"{",
"Record",
"recordMain",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"try",
"{",
"if",
"(",
"recordMain",
"!=",
"null",
")",
"{",
"if",
"(",
"m_objectID",
"!=",
"null",
")",
"{",
"// Read the request",
"if",
"(",
"recordMain",
".",
"setHandle",
"(",
"m_objectID",
",",
"DBConstants",
".",
"BOOKMARK_HANDLE",
")",
"!=",
"null",
")",
"recordMain",
".",
"edit",
"(",
")",
";",
"else",
"m_objectID",
"=",
"null",
";",
"}",
"if",
"(",
"m_objectID",
"==",
"null",
")",
"if",
"(",
"(",
"recordMain",
".",
"getEditMode",
"(",
")",
"!=",
"DBConstants",
".",
"EDIT_CURRENT",
")",
"&&",
"(",
"recordMain",
".",
"getEditMode",
"(",
")",
"!=",
"DBConstants",
".",
"EDIT_IN_PROGRESS",
")",
")",
"// If the record is current, don't touch it.",
"{",
"recordMain",
".",
"addNew",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"Debug",
".",
"print",
"(",
"ex",
")",
";",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"m_objectID",
"=",
"null",
";",
"}",
"if",
"(",
"m_objectID",
"==",
"null",
")",
"return",
"null",
";",
"else",
"return",
"recordMain",
";",
"}"
] |
Set the record to the bookmark passed in.
@return the record with the bookmark set to the initial value.
|
[
"Set",
"the",
"record",
"to",
"the",
"bookmark",
"passed",
"in",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java#L221-L249
|
153,679
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java
|
BaseSession.addSessionObject
|
public void addSessionObject(BaseSession sessionObject)
{
if (sessionObject == null)
return;
if (m_vSessionObjectList == null)
m_vSessionObjectList = new Vector<BaseSession>();
m_vSessionObjectList.addElement(sessionObject);
}
|
java
|
public void addSessionObject(BaseSession sessionObject)
{
if (sessionObject == null)
return;
if (m_vSessionObjectList == null)
m_vSessionObjectList = new Vector<BaseSession>();
m_vSessionObjectList.addElement(sessionObject);
}
|
[
"public",
"void",
"addSessionObject",
"(",
"BaseSession",
"sessionObject",
")",
"{",
"if",
"(",
"sessionObject",
"==",
"null",
")",
"return",
";",
"if",
"(",
"m_vSessionObjectList",
"==",
"null",
")",
"m_vSessionObjectList",
"=",
"new",
"Vector",
"<",
"BaseSession",
">",
"(",
")",
";",
"m_vSessionObjectList",
".",
"addElement",
"(",
"sessionObject",
")",
";",
"}"
] |
Add this sub-session to this session.
@param sessionObject The session to add.
|
[
"Add",
"this",
"sub",
"-",
"session",
"to",
"this",
"session",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java#L273-L280
|
153,680
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java
|
BaseSession.removeSessionObject
|
public boolean removeSessionObject(BaseSession sessionObject)
{
if (m_vSessionObjectList == null)
return false;
boolean bFlag = m_vSessionObjectList.removeElement(sessionObject);
return bFlag;
}
|
java
|
public boolean removeSessionObject(BaseSession sessionObject)
{
if (m_vSessionObjectList == null)
return false;
boolean bFlag = m_vSessionObjectList.removeElement(sessionObject);
return bFlag;
}
|
[
"public",
"boolean",
"removeSessionObject",
"(",
"BaseSession",
"sessionObject",
")",
"{",
"if",
"(",
"m_vSessionObjectList",
"==",
"null",
")",
"return",
"false",
";",
"boolean",
"bFlag",
"=",
"m_vSessionObjectList",
".",
"removeElement",
"(",
"sessionObject",
")",
";",
"return",
"bFlag",
";",
"}"
] |
Remove this sub-session from this session.
@param sessionObject The session to remove.
@return true If successful.
|
[
"Remove",
"this",
"sub",
"-",
"session",
"from",
"this",
"session",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java#L286-L292
|
153,681
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java
|
BaseSession.getSessionObjectAt
|
public BaseSession getSessionObjectAt(int iIndex)
{
if (m_vSessionObjectList == null)
return null;
return (BaseSession)m_vSessionObjectList.elementAt(iIndex);
}
|
java
|
public BaseSession getSessionObjectAt(int iIndex)
{
if (m_vSessionObjectList == null)
return null;
return (BaseSession)m_vSessionObjectList.elementAt(iIndex);
}
|
[
"public",
"BaseSession",
"getSessionObjectAt",
"(",
"int",
"iIndex",
")",
"{",
"if",
"(",
"m_vSessionObjectList",
"==",
"null",
")",
"return",
"null",
";",
"return",
"(",
"BaseSession",
")",
"m_vSessionObjectList",
".",
"elementAt",
"(",
"iIndex",
")",
";",
"}"
] |
Get the sub-session at this location.
@param iIndex index.
@return The sub-session (or null).
|
[
"Get",
"the",
"sub",
"-",
"session",
"at",
"this",
"location",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java#L308-L313
|
153,682
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java
|
BaseSession.getFieldData
|
public Map<String,Object> getFieldData(Map<String,Object> properties)
{
Map<String, Object> propReturn = null;
if (properties != null)
{
propReturn = new Hashtable<String, Object>();
for (int i = 1; ; i++)
{
String strFieldNumber = DBParams.FIELD + Integer.toString(i);
String strFieldName = (String)properties.get(strFieldNumber);
if (strFieldName == null)
break; // Done.
Record record = this.getMainRecord();
if (strFieldName.indexOf('.') != -1)
{
record = this.getRecord(strFieldName.substring(0, strFieldName.indexOf('.')));
strFieldName = strFieldName.substring(strFieldName.indexOf('.') + 1);
}
BaseField field = null;
if (record != null)
field = record.getField(strFieldName);
if (field != null)
propReturn.put(strFieldNumber, field.getData());
}
}
return propReturn;
}
|
java
|
public Map<String,Object> getFieldData(Map<String,Object> properties)
{
Map<String, Object> propReturn = null;
if (properties != null)
{
propReturn = new Hashtable<String, Object>();
for (int i = 1; ; i++)
{
String strFieldNumber = DBParams.FIELD + Integer.toString(i);
String strFieldName = (String)properties.get(strFieldNumber);
if (strFieldName == null)
break; // Done.
Record record = this.getMainRecord();
if (strFieldName.indexOf('.') != -1)
{
record = this.getRecord(strFieldName.substring(0, strFieldName.indexOf('.')));
strFieldName = strFieldName.substring(strFieldName.indexOf('.') + 1);
}
BaseField field = null;
if (record != null)
field = record.getField(strFieldName);
if (field != null)
propReturn.put(strFieldNumber, field.getData());
}
}
return propReturn;
}
|
[
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getFieldData",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"propReturn",
"=",
"null",
";",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"propReturn",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
";",
"i",
"++",
")",
"{",
"String",
"strFieldNumber",
"=",
"DBParams",
".",
"FIELD",
"+",
"Integer",
".",
"toString",
"(",
"i",
")",
";",
"String",
"strFieldName",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"strFieldNumber",
")",
";",
"if",
"(",
"strFieldName",
"==",
"null",
")",
"break",
";",
"// Done.",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"strFieldName",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"{",
"record",
"=",
"this",
".",
"getRecord",
"(",
"strFieldName",
".",
"substring",
"(",
"0",
",",
"strFieldName",
".",
"indexOf",
"(",
"'",
"'",
")",
")",
")",
";",
"strFieldName",
"=",
"strFieldName",
".",
"substring",
"(",
"strFieldName",
".",
"indexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"}",
"BaseField",
"field",
"=",
"null",
";",
"if",
"(",
"record",
"!=",
"null",
")",
"field",
"=",
"record",
".",
"getField",
"(",
"strFieldName",
")",
";",
"if",
"(",
"field",
"!=",
"null",
")",
"propReturn",
".",
"put",
"(",
"strFieldNumber",
",",
"field",
".",
"getData",
"(",
")",
")",
";",
"}",
"}",
"return",
"propReturn",
";",
"}"
] |
GetFieldData Method.
|
[
"GetFieldData",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java#L393-L419
|
153,683
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java
|
BaseSession.getDatabaseSession
|
public DatabaseSession getDatabaseSession(BaseDatabase database)
{
for (int iFieldSeq = 0; iFieldSeq < this.getSessionObjectCount(); iFieldSeq++)
{ // See if any of my children want to handle this command
if (this.getSessionObjectAt(iFieldSeq).getDatabaseSession(database) != null)
return this.getSessionObjectAt(iFieldSeq).getDatabaseSession(database);
}
return null; // Not found
}
|
java
|
public DatabaseSession getDatabaseSession(BaseDatabase database)
{
for (int iFieldSeq = 0; iFieldSeq < this.getSessionObjectCount(); iFieldSeq++)
{ // See if any of my children want to handle this command
if (this.getSessionObjectAt(iFieldSeq).getDatabaseSession(database) != null)
return this.getSessionObjectAt(iFieldSeq).getDatabaseSession(database);
}
return null; // Not found
}
|
[
"public",
"DatabaseSession",
"getDatabaseSession",
"(",
"BaseDatabase",
"database",
")",
"{",
"for",
"(",
"int",
"iFieldSeq",
"=",
"0",
";",
"iFieldSeq",
"<",
"this",
".",
"getSessionObjectCount",
"(",
")",
";",
"iFieldSeq",
"++",
")",
"{",
"// See if any of my children want to handle this command",
"if",
"(",
"this",
".",
"getSessionObjectAt",
"(",
"iFieldSeq",
")",
".",
"getDatabaseSession",
"(",
"database",
")",
"!=",
"null",
")",
"return",
"this",
".",
"getSessionObjectAt",
"(",
"iFieldSeq",
")",
".",
"getDatabaseSession",
"(",
"database",
")",
";",
"}",
"return",
"null",
";",
"// Not found",
"}"
] |
If this database is in my database list, return this object.
@param database The database to lookup.
@return this if successful.
|
[
"If",
"this",
"database",
"is",
"in",
"my",
"database",
"list",
"return",
"this",
"object",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/BaseSession.java#L425-L433
|
153,684
|
jbundle/jbundle
|
thin/opt/location/src/main/java/org/jbundle/thin/opt/location/JTreePanel.java
|
JTreePanel.mySingleClick
|
public NodeData mySingleClick(int selRow, TreePath selPath)
{
Object[] x = selPath.getPath();
DynamicTreeNode nodeCurrent = (DynamicTreeNode)x[x.length - 1]; // Last one in list
NodeData data = (NodeData)nodeCurrent.getUserObject();
String strDescription = data.toString();
String strID = data.getID();
String strRecord = data.getRecordName();
this.firePropertyChange(m_strLocationRecordParam, null, strRecord);
this.firePropertyChange(m_strLocationIDParam, null, strID);
this.firePropertyChange(m_strLocationParam, null, strDescription);
return data;
}
|
java
|
public NodeData mySingleClick(int selRow, TreePath selPath)
{
Object[] x = selPath.getPath();
DynamicTreeNode nodeCurrent = (DynamicTreeNode)x[x.length - 1]; // Last one in list
NodeData data = (NodeData)nodeCurrent.getUserObject();
String strDescription = data.toString();
String strID = data.getID();
String strRecord = data.getRecordName();
this.firePropertyChange(m_strLocationRecordParam, null, strRecord);
this.firePropertyChange(m_strLocationIDParam, null, strID);
this.firePropertyChange(m_strLocationParam, null, strDescription);
return data;
}
|
[
"public",
"NodeData",
"mySingleClick",
"(",
"int",
"selRow",
",",
"TreePath",
"selPath",
")",
"{",
"Object",
"[",
"]",
"x",
"=",
"selPath",
".",
"getPath",
"(",
")",
";",
"DynamicTreeNode",
"nodeCurrent",
"=",
"(",
"DynamicTreeNode",
")",
"x",
"[",
"x",
".",
"length",
"-",
"1",
"]",
";",
"// Last one in list",
"NodeData",
"data",
"=",
"(",
"NodeData",
")",
"nodeCurrent",
".",
"getUserObject",
"(",
")",
";",
"String",
"strDescription",
"=",
"data",
".",
"toString",
"(",
")",
";",
"String",
"strID",
"=",
"data",
".",
"getID",
"(",
")",
";",
"String",
"strRecord",
"=",
"data",
".",
"getRecordName",
"(",
")",
";",
"this",
".",
"firePropertyChange",
"(",
"m_strLocationRecordParam",
",",
"null",
",",
"strRecord",
")",
";",
"this",
".",
"firePropertyChange",
"(",
"m_strLocationIDParam",
",",
"null",
",",
"strID",
")",
";",
"this",
".",
"firePropertyChange",
"(",
"m_strLocationParam",
",",
"null",
",",
"strDescription",
")",
";",
"return",
"data",
";",
"}"
] |
User selected item.
|
[
"User",
"selected",
"item",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/location/src/main/java/org/jbundle/thin/opt/location/JTreePanel.java#L136-L148
|
153,685
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlInOut.java
|
XmlInOut.run
|
public void run()
{
Record record = this.getMainRecord();
String strFileName = this.getProperty("filename");
String strImport = this.getProperty("import");
if (strFileName == null)
strFileName = strImport;
String strExport = this.getProperty("export");
if (strFileName == null)
strFileName = strExport;
m_bOverwriteDups = false;
if ((DBConstants.TRUE.equalsIgnoreCase(this.getProperty("overwritedups")))
|| (DBConstants.YES.equalsIgnoreCase(this.getProperty("overwritedups"))))
m_bOverwriteDups = true;
boolean bSuccess = false;
if (strImport != null)
bSuccess = this.importXML(record.getTable(), strFileName, null);
else
bSuccess = this.exportXML(record.getTable(), strFileName);
if (!bSuccess)
System.exit(1);
}
|
java
|
public void run()
{
Record record = this.getMainRecord();
String strFileName = this.getProperty("filename");
String strImport = this.getProperty("import");
if (strFileName == null)
strFileName = strImport;
String strExport = this.getProperty("export");
if (strFileName == null)
strFileName = strExport;
m_bOverwriteDups = false;
if ((DBConstants.TRUE.equalsIgnoreCase(this.getProperty("overwritedups")))
|| (DBConstants.YES.equalsIgnoreCase(this.getProperty("overwritedups"))))
m_bOverwriteDups = true;
boolean bSuccess = false;
if (strImport != null)
bSuccess = this.importXML(record.getTable(), strFileName, null);
else
bSuccess = this.exportXML(record.getTable(), strFileName);
if (!bSuccess)
System.exit(1);
}
|
[
"public",
"void",
"run",
"(",
")",
"{",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"String",
"strFileName",
"=",
"this",
".",
"getProperty",
"(",
"\"filename\"",
")",
";",
"String",
"strImport",
"=",
"this",
".",
"getProperty",
"(",
"\"import\"",
")",
";",
"if",
"(",
"strFileName",
"==",
"null",
")",
"strFileName",
"=",
"strImport",
";",
"String",
"strExport",
"=",
"this",
".",
"getProperty",
"(",
"\"export\"",
")",
";",
"if",
"(",
"strFileName",
"==",
"null",
")",
"strFileName",
"=",
"strExport",
";",
"m_bOverwriteDups",
"=",
"false",
";",
"if",
"(",
"(",
"DBConstants",
".",
"TRUE",
".",
"equalsIgnoreCase",
"(",
"this",
".",
"getProperty",
"(",
"\"overwritedups\"",
")",
")",
")",
"||",
"(",
"DBConstants",
".",
"YES",
".",
"equalsIgnoreCase",
"(",
"this",
".",
"getProperty",
"(",
"\"overwritedups\"",
")",
")",
")",
")",
"m_bOverwriteDups",
"=",
"true",
";",
"boolean",
"bSuccess",
"=",
"false",
";",
"if",
"(",
"strImport",
"!=",
"null",
")",
"bSuccess",
"=",
"this",
".",
"importXML",
"(",
"record",
".",
"getTable",
"(",
")",
",",
"strFileName",
",",
"null",
")",
";",
"else",
"bSuccess",
"=",
"this",
".",
"exportXML",
"(",
"record",
".",
"getTable",
"(",
")",
",",
"strFileName",
")",
";",
"if",
"(",
"!",
"bSuccess",
")",
"System",
".",
"exit",
"(",
"1",
")",
";",
"}"
] |
Run this process given the parameters passed in on initialization.
|
[
"Run",
"this",
"process",
"given",
"the",
"parameters",
"passed",
"in",
"on",
"initialization",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlInOut.java#L186-L207
|
153,686
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlInOut.java
|
XmlInOut.importXML
|
public boolean importXML(BaseTable table, String filename, InputStream inStream)
{
Record record = table.getRecord();
XmlInOut.enableAllBehaviors(record, false, false);
DocumentBuilder db = Utility.getDocumentBuilder();
DocumentBuilder stringdb = Utility.getDocumentBuilder();
// Parse the input file
Document doc = null;
try {
synchronized (db)
{
if (inStream != null)
doc = db.parse(inStream);
else
doc = db.parse(new File(filename));
}
} catch (FileNotFoundException e) {
Utility.getLogger().info("Table input file not found: " + filename);
return false; // Error
} catch (SAXException e) {
Debug.print(e);
return false; // Error
} catch (IOException e) {
Debug.print(e);
return false; // Error
} catch (Exception e) {
Debug.print(e);
return false; // Error
}
try {
String databaseName = null;
int iEndDB = filename.lastIndexOf(System.getProperty("file.separator", "/"));
if (iEndDB == -1)
iEndDB = filename.lastIndexOf('/');
if (iEndDB != -1)
{
int iStartDB = filename.lastIndexOf(System.getProperty("file.separator", "/"), iEndDB - 1);
if (iStartDB == -1)
iStartDB = filename.lastIndexOf('/', iEndDB - 1);
iStartDB++; // Start
databaseName = filename.substring(iStartDB, iEndDB);
}
if (record == null)
this.parseXSL(); // Parse the XSL/DTD and create the tables and structures
Element elParent = doc.getDocumentElement();
RecordParser parser = new RecordParser(elParent);
while (parser.next(stringdb) != null)
{
Node elChild = parser.getChildNode();
String strName = parser.getName();
this.parseRecord(stringdb, (Element)elChild, strName, databaseName, table, null, false);
}
} catch (Throwable t) {
t.printStackTrace();
return false; // Error
}
XmlInOut.enableAllBehaviors(record, true, true);
return true; // Success
}
|
java
|
public boolean importXML(BaseTable table, String filename, InputStream inStream)
{
Record record = table.getRecord();
XmlInOut.enableAllBehaviors(record, false, false);
DocumentBuilder db = Utility.getDocumentBuilder();
DocumentBuilder stringdb = Utility.getDocumentBuilder();
// Parse the input file
Document doc = null;
try {
synchronized (db)
{
if (inStream != null)
doc = db.parse(inStream);
else
doc = db.parse(new File(filename));
}
} catch (FileNotFoundException e) {
Utility.getLogger().info("Table input file not found: " + filename);
return false; // Error
} catch (SAXException e) {
Debug.print(e);
return false; // Error
} catch (IOException e) {
Debug.print(e);
return false; // Error
} catch (Exception e) {
Debug.print(e);
return false; // Error
}
try {
String databaseName = null;
int iEndDB = filename.lastIndexOf(System.getProperty("file.separator", "/"));
if (iEndDB == -1)
iEndDB = filename.lastIndexOf('/');
if (iEndDB != -1)
{
int iStartDB = filename.lastIndexOf(System.getProperty("file.separator", "/"), iEndDB - 1);
if (iStartDB == -1)
iStartDB = filename.lastIndexOf('/', iEndDB - 1);
iStartDB++; // Start
databaseName = filename.substring(iStartDB, iEndDB);
}
if (record == null)
this.parseXSL(); // Parse the XSL/DTD and create the tables and structures
Element elParent = doc.getDocumentElement();
RecordParser parser = new RecordParser(elParent);
while (parser.next(stringdb) != null)
{
Node elChild = parser.getChildNode();
String strName = parser.getName();
this.parseRecord(stringdb, (Element)elChild, strName, databaseName, table, null, false);
}
} catch (Throwable t) {
t.printStackTrace();
return false; // Error
}
XmlInOut.enableAllBehaviors(record, true, true);
return true; // Success
}
|
[
"public",
"boolean",
"importXML",
"(",
"BaseTable",
"table",
",",
"String",
"filename",
",",
"InputStream",
"inStream",
")",
"{",
"Record",
"record",
"=",
"table",
".",
"getRecord",
"(",
")",
";",
"XmlInOut",
".",
"enableAllBehaviors",
"(",
"record",
",",
"false",
",",
"false",
")",
";",
"DocumentBuilder",
"db",
"=",
"Utility",
".",
"getDocumentBuilder",
"(",
")",
";",
"DocumentBuilder",
"stringdb",
"=",
"Utility",
".",
"getDocumentBuilder",
"(",
")",
";",
"// Parse the input file",
"Document",
"doc",
"=",
"null",
";",
"try",
"{",
"synchronized",
"(",
"db",
")",
"{",
"if",
"(",
"inStream",
"!=",
"null",
")",
"doc",
"=",
"db",
".",
"parse",
"(",
"inStream",
")",
";",
"else",
"doc",
"=",
"db",
".",
"parse",
"(",
"new",
"File",
"(",
"filename",
")",
")",
";",
"}",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"Utility",
".",
"getLogger",
"(",
")",
".",
"info",
"(",
"\"Table input file not found: \"",
"+",
"filename",
")",
";",
"return",
"false",
";",
"// Error",
"}",
"catch",
"(",
"SAXException",
"e",
")",
"{",
"Debug",
".",
"print",
"(",
"e",
")",
";",
"return",
"false",
";",
"// Error",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Debug",
".",
"print",
"(",
"e",
")",
";",
"return",
"false",
";",
"// Error",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"Debug",
".",
"print",
"(",
"e",
")",
";",
"return",
"false",
";",
"// Error",
"}",
"try",
"{",
"String",
"databaseName",
"=",
"null",
";",
"int",
"iEndDB",
"=",
"filename",
".",
"lastIndexOf",
"(",
"System",
".",
"getProperty",
"(",
"\"file.separator\"",
",",
"\"/\"",
")",
")",
";",
"if",
"(",
"iEndDB",
"==",
"-",
"1",
")",
"iEndDB",
"=",
"filename",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"iEndDB",
"!=",
"-",
"1",
")",
"{",
"int",
"iStartDB",
"=",
"filename",
".",
"lastIndexOf",
"(",
"System",
".",
"getProperty",
"(",
"\"file.separator\"",
",",
"\"/\"",
")",
",",
"iEndDB",
"-",
"1",
")",
";",
"if",
"(",
"iStartDB",
"==",
"-",
"1",
")",
"iStartDB",
"=",
"filename",
".",
"lastIndexOf",
"(",
"'",
"'",
",",
"iEndDB",
"-",
"1",
")",
";",
"iStartDB",
"++",
";",
"// Start",
"databaseName",
"=",
"filename",
".",
"substring",
"(",
"iStartDB",
",",
"iEndDB",
")",
";",
"}",
"if",
"(",
"record",
"==",
"null",
")",
"this",
".",
"parseXSL",
"(",
")",
";",
"// Parse the XSL/DTD and create the tables and structures",
"Element",
"elParent",
"=",
"doc",
".",
"getDocumentElement",
"(",
")",
";",
"RecordParser",
"parser",
"=",
"new",
"RecordParser",
"(",
"elParent",
")",
";",
"while",
"(",
"parser",
".",
"next",
"(",
"stringdb",
")",
"!=",
"null",
")",
"{",
"Node",
"elChild",
"=",
"parser",
".",
"getChildNode",
"(",
")",
";",
"String",
"strName",
"=",
"parser",
".",
"getName",
"(",
")",
";",
"this",
".",
"parseRecord",
"(",
"stringdb",
",",
"(",
"Element",
")",
"elChild",
",",
"strName",
",",
"databaseName",
",",
"table",
",",
"null",
",",
"false",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"t",
".",
"printStackTrace",
"(",
")",
";",
"return",
"false",
";",
"// Error",
"}",
"XmlInOut",
".",
"enableAllBehaviors",
"(",
"record",
",",
"true",
",",
"true",
")",
";",
"return",
"true",
";",
"// Success",
"}"
] |
Parses this XML text and place it in new records.
@param record The record to place this parsed XML into (If this is null, the file name is supplied in the XML).
@param filename The XML file to parse.
|
[
"Parses",
"this",
"XML",
"text",
"and",
"place",
"it",
"in",
"new",
"records",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlInOut.java#L369-L430
|
153,687
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlInOut.java
|
XmlInOut.enableAllBehaviors
|
public static void enableAllBehaviors(Record record, boolean bEnableRecordBehaviors, boolean bEnableFieldBehaviors)
{
if (record == null)
return;
record.setEnableListeners(bEnableRecordBehaviors); // Disable all file behaviors
for (int iFieldSeq = 0; iFieldSeq < record.getFieldCount(); iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
field.setEnableListeners(bEnableFieldBehaviors);
}
}
|
java
|
public static void enableAllBehaviors(Record record, boolean bEnableRecordBehaviors, boolean bEnableFieldBehaviors)
{
if (record == null)
return;
record.setEnableListeners(bEnableRecordBehaviors); // Disable all file behaviors
for (int iFieldSeq = 0; iFieldSeq < record.getFieldCount(); iFieldSeq++)
{
BaseField field = record.getField(iFieldSeq);
field.setEnableListeners(bEnableFieldBehaviors);
}
}
|
[
"public",
"static",
"void",
"enableAllBehaviors",
"(",
"Record",
"record",
",",
"boolean",
"bEnableRecordBehaviors",
",",
"boolean",
"bEnableFieldBehaviors",
")",
"{",
"if",
"(",
"record",
"==",
"null",
")",
"return",
";",
"record",
".",
"setEnableListeners",
"(",
"bEnableRecordBehaviors",
")",
";",
"// Disable all file behaviors",
"for",
"(",
"int",
"iFieldSeq",
"=",
"0",
";",
"iFieldSeq",
"<",
"record",
".",
"getFieldCount",
"(",
")",
";",
"iFieldSeq",
"++",
")",
"{",
"BaseField",
"field",
"=",
"record",
".",
"getField",
"(",
"iFieldSeq",
")",
";",
"field",
".",
"setEnableListeners",
"(",
"bEnableFieldBehaviors",
")",
";",
"}",
"}"
] |
Enable or disable all the behaviors.
@param record The target record.
@param bEnableRecordBehaviors Enable/disable all the record behaviors.
@param bEnableFieldBehaviors Enable/disable all the field behaviors.
|
[
"Enable",
"or",
"disable",
"all",
"the",
"behaviors",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlInOut.java#L624-L634
|
153,688
|
jbundle/jbundle
|
app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/PackagesScanListener.java
|
PackagesScanListener.directoryContainsFiles
|
public boolean directoryContainsFiles(File fileDir)
{
boolean containsFiles = false;
File[] files = fileDir.listFiles();
if (files != null)
{
for (File file : files)
{
if (!file.isDirectory())
containsFiles = true;
}
}
return containsFiles;
}
|
java
|
public boolean directoryContainsFiles(File fileDir)
{
boolean containsFiles = false;
File[] files = fileDir.listFiles();
if (files != null)
{
for (File file : files)
{
if (!file.isDirectory())
containsFiles = true;
}
}
return containsFiles;
}
|
[
"public",
"boolean",
"directoryContainsFiles",
"(",
"File",
"fileDir",
")",
"{",
"boolean",
"containsFiles",
"=",
"false",
";",
"File",
"[",
"]",
"files",
"=",
"fileDir",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"files",
"!=",
"null",
")",
"{",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"if",
"(",
"!",
"file",
".",
"isDirectory",
"(",
")",
")",
"containsFiles",
"=",
"true",
";",
"}",
"}",
"return",
"containsFiles",
";",
"}"
] |
Get the projectID if this directory has any files in it.
Otherwise, return 0 meaning I don't have to specify this package.
|
[
"Get",
"the",
"projectID",
"if",
"this",
"directory",
"has",
"any",
"files",
"in",
"it",
".",
"Otherwise",
"return",
"0",
"meaning",
"I",
"don",
"t",
"have",
"to",
"specify",
"this",
"package",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/PackagesScanListener.java#L172-L185
|
153,689
|
FitLayout/classify
|
src/main/java/org/fit/layout/classify/ColorAnalyzer.java
|
ColorAnalyzer.getColorPercentage
|
public double getColorPercentage(Color color)
{
if (color == null)
return 0;
else
{
Integer num = colors.get(colorKey(color));
if (num == null) num = 0;
if (totalLength == 0)
return 0;
else
return (double) num / totalLength;
}
}
|
java
|
public double getColorPercentage(Color color)
{
if (color == null)
return 0;
else
{
Integer num = colors.get(colorKey(color));
if (num == null) num = 0;
if (totalLength == 0)
return 0;
else
return (double) num / totalLength;
}
}
|
[
"public",
"double",
"getColorPercentage",
"(",
"Color",
"color",
")",
"{",
"if",
"(",
"color",
"==",
"null",
")",
"return",
"0",
";",
"else",
"{",
"Integer",
"num",
"=",
"colors",
".",
"get",
"(",
"colorKey",
"(",
"color",
")",
")",
";",
"if",
"(",
"num",
"==",
"null",
")",
"num",
"=",
"0",
";",
"if",
"(",
"totalLength",
"==",
"0",
")",
"return",
"0",
";",
"else",
"return",
"(",
"double",
")",
"num",
"/",
"totalLength",
";",
"}",
"}"
] |
Obtains the percentage of the text that has the given color.
@param color the color to be tested.
@return the percentage (0..1)
|
[
"Obtains",
"the",
"percentage",
"of",
"the",
"text",
"that",
"has",
"the",
"given",
"color",
"."
] |
0b43ceb2f0be4e6d26263491893884d811f0d605
|
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/ColorAnalyzer.java#L44-L57
|
153,690
|
FitLayout/classify
|
src/main/java/org/fit/layout/classify/ColorAnalyzer.java
|
ColorAnalyzer.getColorPercentage
|
public double getColorPercentage(Area node)
{
int tlen = 0;
double sum = 0;
for (Box box : node.getBoxes())
{
int len = letterLength(box.getText());
if (len > 0)
{
sum += getColorPercentage(box.getColor()) * len;
tlen += len;
}
}
for (int i = 0; i < node.getChildCount(); i++)
{
Area child = node.getChildAt(i);
int nlen = letterLength(child.getText());
tlen += nlen;
sum += getColorPercentage(child) * nlen;
}
if (tlen == 0)
return 0;
else
return sum / tlen;
}
|
java
|
public double getColorPercentage(Area node)
{
int tlen = 0;
double sum = 0;
for (Box box : node.getBoxes())
{
int len = letterLength(box.getText());
if (len > 0)
{
sum += getColorPercentage(box.getColor()) * len;
tlen += len;
}
}
for (int i = 0; i < node.getChildCount(); i++)
{
Area child = node.getChildAt(i);
int nlen = letterLength(child.getText());
tlen += nlen;
sum += getColorPercentage(child) * nlen;
}
if (tlen == 0)
return 0;
else
return sum / tlen;
}
|
[
"public",
"double",
"getColorPercentage",
"(",
"Area",
"node",
")",
"{",
"int",
"tlen",
"=",
"0",
";",
"double",
"sum",
"=",
"0",
";",
"for",
"(",
"Box",
"box",
":",
"node",
".",
"getBoxes",
"(",
")",
")",
"{",
"int",
"len",
"=",
"letterLength",
"(",
"box",
".",
"getText",
"(",
")",
")",
";",
"if",
"(",
"len",
">",
"0",
")",
"{",
"sum",
"+=",
"getColorPercentage",
"(",
"box",
".",
"getColor",
"(",
")",
")",
"*",
"len",
";",
"tlen",
"+=",
"len",
";",
"}",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"node",
".",
"getChildCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"Area",
"child",
"=",
"node",
".",
"getChildAt",
"(",
"i",
")",
";",
"int",
"nlen",
"=",
"letterLength",
"(",
"child",
".",
"getText",
"(",
")",
")",
";",
"tlen",
"+=",
"nlen",
";",
"sum",
"+=",
"getColorPercentage",
"(",
"child",
")",
"*",
"nlen",
";",
"}",
"if",
"(",
"tlen",
"==",
"0",
")",
"return",
"0",
";",
"else",
"return",
"sum",
"/",
"tlen",
";",
"}"
] |
Obtains the average percentage of all the text that has the given color.
@param color the color to be tested.
@return the percentage (0..1)
|
[
"Obtains",
"the",
"average",
"percentage",
"of",
"all",
"the",
"text",
"that",
"has",
"the",
"given",
"color",
"."
] |
0b43ceb2f0be4e6d26263491893884d811f0d605
|
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/ColorAnalyzer.java#L64-L90
|
153,691
|
aequologica/geppaequo
|
geppaequo-config/src/main/java/net/aequologica/neo/geppaequo/config/ConfigManager.java
|
ConfigManager.set
|
public void set(final String originalKey, final Object object) {
final String key = applicationName + "." + originalKey;
if (object == null || (object instanceof String && ((String) object).length() == 0)) {
// remove
application.setConfig(application.getConfig().withoutPath(key));
} else {
// create or update
ConfigValue value = ConfigValueFactory.fromAnyRef(object, "modified at runtime ");
application.setConfig(application.getConfig().withValue(key, value));
}
// merge global config (no reloading)
config = application.getConfig().withFallback(user.getConfig()).withFallback(system.getConfig());
}
|
java
|
public void set(final String originalKey, final Object object) {
final String key = applicationName + "." + originalKey;
if (object == null || (object instanceof String && ((String) object).length() == 0)) {
// remove
application.setConfig(application.getConfig().withoutPath(key));
} else {
// create or update
ConfigValue value = ConfigValueFactory.fromAnyRef(object, "modified at runtime ");
application.setConfig(application.getConfig().withValue(key, value));
}
// merge global config (no reloading)
config = application.getConfig().withFallback(user.getConfig()).withFallback(system.getConfig());
}
|
[
"public",
"void",
"set",
"(",
"final",
"String",
"originalKey",
",",
"final",
"Object",
"object",
")",
"{",
"final",
"String",
"key",
"=",
"applicationName",
"+",
"\".\"",
"+",
"originalKey",
";",
"if",
"(",
"object",
"==",
"null",
"||",
"(",
"object",
"instanceof",
"String",
"&&",
"(",
"(",
"String",
")",
"object",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"// remove",
"application",
".",
"setConfig",
"(",
"application",
".",
"getConfig",
"(",
")",
".",
"withoutPath",
"(",
"key",
")",
")",
";",
"}",
"else",
"{",
"// create or update",
"ConfigValue",
"value",
"=",
"ConfigValueFactory",
".",
"fromAnyRef",
"(",
"object",
",",
"\"modified at runtime \"",
")",
";",
"application",
".",
"setConfig",
"(",
"application",
".",
"getConfig",
"(",
")",
".",
"withValue",
"(",
"key",
",",
"value",
")",
")",
";",
"}",
"// merge global config (no reloading)",
"config",
"=",
"application",
".",
"getConfig",
"(",
")",
".",
"withFallback",
"(",
"user",
".",
"getConfig",
"(",
")",
")",
".",
"withFallback",
"(",
"system",
".",
"getConfig",
"(",
")",
")",
";",
"}"
] |
will throw exception if key is not found
|
[
"will",
"throw",
"exception",
"if",
"key",
"is",
"not",
"found"
] |
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
|
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-config/src/main/java/net/aequologica/neo/geppaequo/config/ConfigManager.java#L74-L86
|
153,692
|
aequologica/geppaequo
|
geppaequo-config/src/main/java/net/aequologica/neo/geppaequo/config/ConfigManager.java
|
ConfigManager.loadConfigs
|
void loadConfigs() throws IOException {
application.loadConfig();
user.loadConfig();
system.loadConfig();
config = application.getConfig().withFallback(user.getConfig()).withFallback(system.getConfig());
dump2debugLog("MERGED", config);
}
|
java
|
void loadConfigs() throws IOException {
application.loadConfig();
user.loadConfig();
system.loadConfig();
config = application.getConfig().withFallback(user.getConfig()).withFallback(system.getConfig());
dump2debugLog("MERGED", config);
}
|
[
"void",
"loadConfigs",
"(",
")",
"throws",
"IOException",
"{",
"application",
".",
"loadConfig",
"(",
")",
";",
"user",
".",
"loadConfig",
"(",
")",
";",
"system",
".",
"loadConfig",
"(",
")",
";",
"config",
"=",
"application",
".",
"getConfig",
"(",
")",
".",
"withFallback",
"(",
"user",
".",
"getConfig",
"(",
")",
")",
".",
"withFallback",
"(",
"system",
".",
"getConfig",
"(",
")",
")",
";",
"dump2debugLog",
"(",
"\"MERGED\"",
",",
"config",
")",
";",
"}"
] |
THE BIG LOAD AND MERGE
|
[
"THE",
"BIG",
"LOAD",
"AND",
"MERGE"
] |
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
|
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-config/src/main/java/net/aequologica/neo/geppaequo/config/ConfigManager.java#L96-L104
|
153,693
|
aequologica/geppaequo
|
geppaequo-config/src/main/java/net/aequologica/neo/geppaequo/config/ConfigManager.java
|
ConfigManager.dumpConfig
|
static void dumpConfig(final String name, final Config config, final PrintWriter printWriter) {
if (printWriter == null) {
throw new IllegalArgumentException("writer argument cannot be null");
}
printWriter.println();
printWriter.println("^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^");
printWriter.println(name + " " + config.root().origin());
printWriter.println(config.root().render(configRenderOptions));
printWriter.flush();
}
|
java
|
static void dumpConfig(final String name, final Config config, final PrintWriter printWriter) {
if (printWriter == null) {
throw new IllegalArgumentException("writer argument cannot be null");
}
printWriter.println();
printWriter.println("^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^");
printWriter.println(name + " " + config.root().origin());
printWriter.println(config.root().render(configRenderOptions));
printWriter.flush();
}
|
[
"static",
"void",
"dumpConfig",
"(",
"final",
"String",
"name",
",",
"final",
"Config",
"config",
",",
"final",
"PrintWriter",
"printWriter",
")",
"{",
"if",
"(",
"printWriter",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"writer argument cannot be null\"",
")",
";",
"}",
"printWriter",
".",
"println",
"(",
")",
";",
"printWriter",
".",
"println",
"(",
"\"^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^\"",
")",
";",
"printWriter",
".",
"println",
"(",
"name",
"+",
"\" \"",
"+",
"config",
".",
"root",
"(",
")",
".",
"origin",
"(",
")",
")",
";",
"printWriter",
".",
"println",
"(",
"config",
".",
"root",
"(",
")",
".",
"render",
"(",
"configRenderOptions",
")",
")",
";",
"printWriter",
".",
"flush",
"(",
")",
";",
"}"
] |
end of class ConfigSource
|
[
"end",
"of",
"class",
"ConfigSource"
] |
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
|
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-config/src/main/java/net/aequologica/neo/geppaequo/config/ConfigManager.java#L204-L215
|
153,694
|
aequologica/geppaequo
|
geppaequo-config/src/main/java/net/aequologica/neo/geppaequo/config/ConfigManager.java
|
ConfigManager.reader2String
|
private static String reader2String(final Reader reader) throws IOException {
final StringBuilder stringBuilder = new StringBuilder();
try (BufferedReader bufferedReader = new BufferedReader(reader)) {
String line = null;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line);
stringBuilder.append("\n"); // I know, if the original data
// stream has no ending line feed,
// this will add one...
}
}
return stringBuilder.toString();
}
|
java
|
private static String reader2String(final Reader reader) throws IOException {
final StringBuilder stringBuilder = new StringBuilder();
try (BufferedReader bufferedReader = new BufferedReader(reader)) {
String line = null;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line);
stringBuilder.append("\n"); // I know, if the original data
// stream has no ending line feed,
// this will add one...
}
}
return stringBuilder.toString();
}
|
[
"private",
"static",
"String",
"reader2String",
"(",
"final",
"Reader",
"reader",
")",
"throws",
"IOException",
"{",
"final",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"(",
"BufferedReader",
"bufferedReader",
"=",
"new",
"BufferedReader",
"(",
"reader",
")",
")",
"{",
"String",
"line",
"=",
"null",
";",
"while",
"(",
"(",
"line",
"=",
"bufferedReader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"stringBuilder",
".",
"append",
"(",
"line",
")",
";",
"stringBuilder",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"// I know, if the original data",
"// stream has no ending line feed,",
"// this will add one...",
"}",
"}",
"return",
"stringBuilder",
".",
"toString",
"(",
")",
";",
"}"
] |
convert Reader to String
|
[
"convert",
"Reader",
"to",
"String"
] |
b72e5f6356535fd045a931f8c544d4a8ea6e35a2
|
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-config/src/main/java/net/aequologica/neo/geppaequo/config/ConfigManager.java#L500-L514
|
153,695
|
jbundle/jbundle
|
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcDatabase.java
|
JdbcDatabase.init
|
public void init(DatabaseOwner databaseOwner, String strDbName, int iDatabaseType, Map<String, Object> properties)
{
super.init(databaseOwner, strDbName, iDatabaseType, properties);
// Typically, JDBC databases do not support locking (Change to "true" otherwise on JDBC open)
this.setProperty(SQLParams.EDIT_DB_PROPERTY, SQLParams.DB_EDIT_NOT_SUPPORTED);
m_bAutosequenceSupport = false; // JDBC databases generally do not support identity, and usually I don't use this capability.
// The following settings are true because JDBC is always running over a LAN (and the server version should send and receive messages).
this.setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.TRUE); // Sent by server version
this.setProperty(DBParams.CREATE_REMOTE_FILTER, DBConstants.TRUE); // Yes, for remote tables
this.setProperty(DBParams.UPDATE_REMOTE_FILTER, DBConstants.TRUE); // Updated by server version
}
|
java
|
public void init(DatabaseOwner databaseOwner, String strDbName, int iDatabaseType, Map<String, Object> properties)
{
super.init(databaseOwner, strDbName, iDatabaseType, properties);
// Typically, JDBC databases do not support locking (Change to "true" otherwise on JDBC open)
this.setProperty(SQLParams.EDIT_DB_PROPERTY, SQLParams.DB_EDIT_NOT_SUPPORTED);
m_bAutosequenceSupport = false; // JDBC databases generally do not support identity, and usually I don't use this capability.
// The following settings are true because JDBC is always running over a LAN (and the server version should send and receive messages).
this.setProperty(DBParams.MESSAGES_TO_REMOTE, DBConstants.TRUE); // Sent by server version
this.setProperty(DBParams.CREATE_REMOTE_FILTER, DBConstants.TRUE); // Yes, for remote tables
this.setProperty(DBParams.UPDATE_REMOTE_FILTER, DBConstants.TRUE); // Updated by server version
}
|
[
"public",
"void",
"init",
"(",
"DatabaseOwner",
"databaseOwner",
",",
"String",
"strDbName",
",",
"int",
"iDatabaseType",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"super",
".",
"init",
"(",
"databaseOwner",
",",
"strDbName",
",",
"iDatabaseType",
",",
"properties",
")",
";",
"// Typically, JDBC databases do not support locking (Change to \"true\" otherwise on JDBC open)",
"this",
".",
"setProperty",
"(",
"SQLParams",
".",
"EDIT_DB_PROPERTY",
",",
"SQLParams",
".",
"DB_EDIT_NOT_SUPPORTED",
")",
";",
"m_bAutosequenceSupport",
"=",
"false",
";",
"// JDBC databases generally do not support identity, and usually I don't use this capability.",
"// The following settings are true because JDBC is always running over a LAN (and the server version should send and receive messages).",
"this",
".",
"setProperty",
"(",
"DBParams",
".",
"MESSAGES_TO_REMOTE",
",",
"DBConstants",
".",
"TRUE",
")",
";",
"// Sent by server version",
"this",
".",
"setProperty",
"(",
"DBParams",
".",
"CREATE_REMOTE_FILTER",
",",
"DBConstants",
".",
"TRUE",
")",
";",
"// Yes, for remote tables",
"this",
".",
"setProperty",
"(",
"DBParams",
".",
"UPDATE_REMOTE_FILTER",
",",
"DBConstants",
".",
"TRUE",
")",
";",
"// Updated by server version",
"}"
] |
Initialize this database and add it to the databaseOwner.
@param databaseOwner My databaseOwner.
@param iDatabaseType The database type (LOCAL/REMOTE).
@param strDBName The database name.
|
[
"Initialize",
"this",
"database",
"and",
"add",
"it",
"to",
"the",
"databaseOwner",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcDatabase.java#L140-L151
|
153,696
|
jbundle/jbundle
|
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcDatabase.java
|
JdbcDatabase.fixDatabaseProductName
|
public String fixDatabaseProductName(String strDatabaseProductName)
{
if (strDatabaseProductName == null)
return null;
if (strDatabaseProductName.lastIndexOf(' ') != -1)
strDatabaseProductName = strDatabaseProductName.substring(strDatabaseProductName.lastIndexOf(' ') + 1);
return strDatabaseProductName.toLowerCase();
}
|
java
|
public String fixDatabaseProductName(String strDatabaseProductName)
{
if (strDatabaseProductName == null)
return null;
if (strDatabaseProductName.lastIndexOf(' ') != -1)
strDatabaseProductName = strDatabaseProductName.substring(strDatabaseProductName.lastIndexOf(' ') + 1);
return strDatabaseProductName.toLowerCase();
}
|
[
"public",
"String",
"fixDatabaseProductName",
"(",
"String",
"strDatabaseProductName",
")",
"{",
"if",
"(",
"strDatabaseProductName",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"strDatabaseProductName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"strDatabaseProductName",
"=",
"strDatabaseProductName",
".",
"substring",
"(",
"strDatabaseProductName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"return",
"strDatabaseProductName",
".",
"toLowerCase",
"(",
")",
";",
"}"
] |
Fix the database product name.
@param strDatabaseProductName
@return
|
[
"Fix",
"the",
"database",
"product",
"name",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcDatabase.java#L227-L234
|
153,697
|
jbundle/jbundle
|
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcDatabase.java
|
JdbcDatabase.close
|
public void close()
{
super.close(); // Do any inherrited
try {
if (m_JDBCConnection != null)
m_JDBCConnection.close();
} catch (SQLException ex) {
// Ignore error
}
m_JDBCConnection = null;
}
|
java
|
public void close()
{
super.close(); // Do any inherrited
try {
if (m_JDBCConnection != null)
m_JDBCConnection.close();
} catch (SQLException ex) {
// Ignore error
}
m_JDBCConnection = null;
}
|
[
"public",
"void",
"close",
"(",
")",
"{",
"super",
".",
"close",
"(",
")",
";",
"// Do any inherrited",
"try",
"{",
"if",
"(",
"m_JDBCConnection",
"!=",
"null",
")",
"m_JDBCConnection",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"// Ignore error",
"}",
"m_JDBCConnection",
"=",
"null",
";",
"}"
] |
Close the physical database.
|
[
"Close",
"the",
"physical",
"database",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcDatabase.java#L342-L352
|
153,698
|
jbundle/jbundle
|
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcDatabase.java
|
JdbcDatabase.initConnection
|
public void initConnection()
{
try {
boolean bAutoCommit = true;
if (DBConstants.FALSE.equalsIgnoreCase(this.getProperty(SQLParams.AUTO_COMMIT_PARAM)))
bAutoCommit = false;
m_JDBCConnection.setAutoCommit(bAutoCommit);
DatabaseMetaData dma = m_JDBCConnection.getMetaData();
String strDatabaseProductName = dma.getDatabaseProductName();
Utility.getLogger().info("DB Name: " + strDatabaseProductName);
this.setProperty(SQLParams.INTERNAL_DB_NAME, strDatabaseProductName);
this.setupDatabaseProperties(); // If I haven't read the db properties, read them now!
String strDateQuote = this.getProperty(SQLParams.SQL_DATE_QUOTE);
if ((strDateQuote != null) && (strDateQuote.length() > 0))
DateTimeField.setSQLQuote(strDateQuote.charAt(0));
Converter.initGlobals();
String strFormat = this.getProperty(SQLParams.SQL_DATE_FORMAT);
if (strFormat != null)
Converter.gDateSqlFormat = new java.text.SimpleDateFormat(strFormat);
strFormat = this.getProperty(SQLParams.SQL_TIME_FORMAT);
if (strFormat != null)
Converter.gTimeSqlFormat = new java.text.SimpleDateFormat(strFormat);
strFormat = this.getProperty(SQLParams.SQL_DATETIME_FORMAT);
if (strFormat != null)
Converter.gDateTimeSqlFormat = new java.text.SimpleDateFormat(strFormat);
if (DBConstants.TRUE.equals(this.getProperty(SQLParams.SHARE_JDBC_CONNECTION)))
m_sharedConnection = m_JDBCConnection; // HACK - Only one DB open at a time (pointbase)!
Utility.getLogger().info("Connected to db: " + this.getDatabaseName(true));
}
catch (SQLException ex)
{
// Ignore errors to these non-essential calls; // Probably "DB Not found"
}
}
|
java
|
public void initConnection()
{
try {
boolean bAutoCommit = true;
if (DBConstants.FALSE.equalsIgnoreCase(this.getProperty(SQLParams.AUTO_COMMIT_PARAM)))
bAutoCommit = false;
m_JDBCConnection.setAutoCommit(bAutoCommit);
DatabaseMetaData dma = m_JDBCConnection.getMetaData();
String strDatabaseProductName = dma.getDatabaseProductName();
Utility.getLogger().info("DB Name: " + strDatabaseProductName);
this.setProperty(SQLParams.INTERNAL_DB_NAME, strDatabaseProductName);
this.setupDatabaseProperties(); // If I haven't read the db properties, read them now!
String strDateQuote = this.getProperty(SQLParams.SQL_DATE_QUOTE);
if ((strDateQuote != null) && (strDateQuote.length() > 0))
DateTimeField.setSQLQuote(strDateQuote.charAt(0));
Converter.initGlobals();
String strFormat = this.getProperty(SQLParams.SQL_DATE_FORMAT);
if (strFormat != null)
Converter.gDateSqlFormat = new java.text.SimpleDateFormat(strFormat);
strFormat = this.getProperty(SQLParams.SQL_TIME_FORMAT);
if (strFormat != null)
Converter.gTimeSqlFormat = new java.text.SimpleDateFormat(strFormat);
strFormat = this.getProperty(SQLParams.SQL_DATETIME_FORMAT);
if (strFormat != null)
Converter.gDateTimeSqlFormat = new java.text.SimpleDateFormat(strFormat);
if (DBConstants.TRUE.equals(this.getProperty(SQLParams.SHARE_JDBC_CONNECTION)))
m_sharedConnection = m_JDBCConnection; // HACK - Only one DB open at a time (pointbase)!
Utility.getLogger().info("Connected to db: " + this.getDatabaseName(true));
}
catch (SQLException ex)
{
// Ignore errors to these non-essential calls; // Probably "DB Not found"
}
}
|
[
"public",
"void",
"initConnection",
"(",
")",
"{",
"try",
"{",
"boolean",
"bAutoCommit",
"=",
"true",
";",
"if",
"(",
"DBConstants",
".",
"FALSE",
".",
"equalsIgnoreCase",
"(",
"this",
".",
"getProperty",
"(",
"SQLParams",
".",
"AUTO_COMMIT_PARAM",
")",
")",
")",
"bAutoCommit",
"=",
"false",
";",
"m_JDBCConnection",
".",
"setAutoCommit",
"(",
"bAutoCommit",
")",
";",
"DatabaseMetaData",
"dma",
"=",
"m_JDBCConnection",
".",
"getMetaData",
"(",
")",
";",
"String",
"strDatabaseProductName",
"=",
"dma",
".",
"getDatabaseProductName",
"(",
")",
";",
"Utility",
".",
"getLogger",
"(",
")",
".",
"info",
"(",
"\"DB Name: \"",
"+",
"strDatabaseProductName",
")",
";",
"this",
".",
"setProperty",
"(",
"SQLParams",
".",
"INTERNAL_DB_NAME",
",",
"strDatabaseProductName",
")",
";",
"this",
".",
"setupDatabaseProperties",
"(",
")",
";",
"// If I haven't read the db properties, read them now!",
"String",
"strDateQuote",
"=",
"this",
".",
"getProperty",
"(",
"SQLParams",
".",
"SQL_DATE_QUOTE",
")",
";",
"if",
"(",
"(",
"strDateQuote",
"!=",
"null",
")",
"&&",
"(",
"strDateQuote",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"DateTimeField",
".",
"setSQLQuote",
"(",
"strDateQuote",
".",
"charAt",
"(",
"0",
")",
")",
";",
"Converter",
".",
"initGlobals",
"(",
")",
";",
"String",
"strFormat",
"=",
"this",
".",
"getProperty",
"(",
"SQLParams",
".",
"SQL_DATE_FORMAT",
")",
";",
"if",
"(",
"strFormat",
"!=",
"null",
")",
"Converter",
".",
"gDateSqlFormat",
"=",
"new",
"java",
".",
"text",
".",
"SimpleDateFormat",
"(",
"strFormat",
")",
";",
"strFormat",
"=",
"this",
".",
"getProperty",
"(",
"SQLParams",
".",
"SQL_TIME_FORMAT",
")",
";",
"if",
"(",
"strFormat",
"!=",
"null",
")",
"Converter",
".",
"gTimeSqlFormat",
"=",
"new",
"java",
".",
"text",
".",
"SimpleDateFormat",
"(",
"strFormat",
")",
";",
"strFormat",
"=",
"this",
".",
"getProperty",
"(",
"SQLParams",
".",
"SQL_DATETIME_FORMAT",
")",
";",
"if",
"(",
"strFormat",
"!=",
"null",
")",
"Converter",
".",
"gDateTimeSqlFormat",
"=",
"new",
"java",
".",
"text",
".",
"SimpleDateFormat",
"(",
"strFormat",
")",
";",
"if",
"(",
"DBConstants",
".",
"TRUE",
".",
"equals",
"(",
"this",
".",
"getProperty",
"(",
"SQLParams",
".",
"SHARE_JDBC_CONNECTION",
")",
")",
")",
"m_sharedConnection",
"=",
"m_JDBCConnection",
";",
"// HACK - Only one DB open at a time (pointbase)!",
"Utility",
".",
"getLogger",
"(",
")",
".",
"info",
"(",
"\"Connected to db: \"",
"+",
"this",
".",
"getDatabaseName",
"(",
"true",
")",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"// Ignore errors to these non-essential calls; // Probably \"DB Not found\"",
"}",
"}"
] |
Setup the new connection.
|
[
"Setup",
"the",
"new",
"connection",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcDatabase.java#L635-L668
|
153,699
|
jbundle/jbundle
|
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcDatabase.java
|
JdbcDatabase.create
|
public boolean create(String strDatabaseName) throws DBException
{
try {
String strDBName = this.getProperty(SQLParams.INTERNAL_DB_NAME);
int iDatabaseType = DBConstants.SYSTEM_DATABASE;
DatabaseOwner env = this.getDatabaseOwner();
JdbcDatabase db = (JdbcDatabase)env.getDatabase(strDBName, iDatabaseType, null); // Do NOT pass properties when opening system database
Statement queryStatement = db.getJDBCConnection().createStatement();
String strSQL = "create database " + strDatabaseName + ";";
queryStatement.execute(strSQL);
queryStatement.close();
db.free();
String oldValue = this.getProperty(DBConstants.CREATE_DB_IF_NOT_FOUND);
this.setProperty(DBConstants.CREATE_DB_IF_NOT_FOUND, DBConstants.FALSE);
this.close(); // Since I don't know what kind of connection this is.
this.setupDBConnection();
this.setProperty(DBConstants.CREATE_DB_IF_NOT_FOUND, oldValue);
if (this.getProperty(DBConstants.LOAD_INITIAL_DATA) != null)
if ((this.getDatabaseType() & (DBConstants.SHARED_DATA | DBConstants.USER_DATA)) == DBConstants.SHARED_DATA) // Yes, only shared data can have DatabaseInfo
{
DatabaseInfo recDatabaseInfo = new DatabaseInfo();
try {
recDatabaseInfo.setDatabaseName(this.getDatabaseName(false));
recDatabaseInfo.setTable(this.doMakeTable(recDatabaseInfo)); // This makes a jdbc table
recDatabaseInfo.init(null); // This should create the table if an archive exists
} catch (Exception ex) {
// Ignore
} finally {
recDatabaseInfo.free();
}
}
return true; // Success
} catch (SQLException ex) {
ex.printStackTrace();
}
return super.create(strDatabaseName); // Error, not found
}
|
java
|
public boolean create(String strDatabaseName) throws DBException
{
try {
String strDBName = this.getProperty(SQLParams.INTERNAL_DB_NAME);
int iDatabaseType = DBConstants.SYSTEM_DATABASE;
DatabaseOwner env = this.getDatabaseOwner();
JdbcDatabase db = (JdbcDatabase)env.getDatabase(strDBName, iDatabaseType, null); // Do NOT pass properties when opening system database
Statement queryStatement = db.getJDBCConnection().createStatement();
String strSQL = "create database " + strDatabaseName + ";";
queryStatement.execute(strSQL);
queryStatement.close();
db.free();
String oldValue = this.getProperty(DBConstants.CREATE_DB_IF_NOT_FOUND);
this.setProperty(DBConstants.CREATE_DB_IF_NOT_FOUND, DBConstants.FALSE);
this.close(); // Since I don't know what kind of connection this is.
this.setupDBConnection();
this.setProperty(DBConstants.CREATE_DB_IF_NOT_FOUND, oldValue);
if (this.getProperty(DBConstants.LOAD_INITIAL_DATA) != null)
if ((this.getDatabaseType() & (DBConstants.SHARED_DATA | DBConstants.USER_DATA)) == DBConstants.SHARED_DATA) // Yes, only shared data can have DatabaseInfo
{
DatabaseInfo recDatabaseInfo = new DatabaseInfo();
try {
recDatabaseInfo.setDatabaseName(this.getDatabaseName(false));
recDatabaseInfo.setTable(this.doMakeTable(recDatabaseInfo)); // This makes a jdbc table
recDatabaseInfo.init(null); // This should create the table if an archive exists
} catch (Exception ex) {
// Ignore
} finally {
recDatabaseInfo.free();
}
}
return true; // Success
} catch (SQLException ex) {
ex.printStackTrace();
}
return super.create(strDatabaseName); // Error, not found
}
|
[
"public",
"boolean",
"create",
"(",
"String",
"strDatabaseName",
")",
"throws",
"DBException",
"{",
"try",
"{",
"String",
"strDBName",
"=",
"this",
".",
"getProperty",
"(",
"SQLParams",
".",
"INTERNAL_DB_NAME",
")",
";",
"int",
"iDatabaseType",
"=",
"DBConstants",
".",
"SYSTEM_DATABASE",
";",
"DatabaseOwner",
"env",
"=",
"this",
".",
"getDatabaseOwner",
"(",
")",
";",
"JdbcDatabase",
"db",
"=",
"(",
"JdbcDatabase",
")",
"env",
".",
"getDatabase",
"(",
"strDBName",
",",
"iDatabaseType",
",",
"null",
")",
";",
"// Do NOT pass properties when opening system database",
"Statement",
"queryStatement",
"=",
"db",
".",
"getJDBCConnection",
"(",
")",
".",
"createStatement",
"(",
")",
";",
"String",
"strSQL",
"=",
"\"create database \"",
"+",
"strDatabaseName",
"+",
"\";\"",
";",
"queryStatement",
".",
"execute",
"(",
"strSQL",
")",
";",
"queryStatement",
".",
"close",
"(",
")",
";",
"db",
".",
"free",
"(",
")",
";",
"String",
"oldValue",
"=",
"this",
".",
"getProperty",
"(",
"DBConstants",
".",
"CREATE_DB_IF_NOT_FOUND",
")",
";",
"this",
".",
"setProperty",
"(",
"DBConstants",
".",
"CREATE_DB_IF_NOT_FOUND",
",",
"DBConstants",
".",
"FALSE",
")",
";",
"this",
".",
"close",
"(",
")",
";",
"// Since I don't know what kind of connection this is.",
"this",
".",
"setupDBConnection",
"(",
")",
";",
"this",
".",
"setProperty",
"(",
"DBConstants",
".",
"CREATE_DB_IF_NOT_FOUND",
",",
"oldValue",
")",
";",
"if",
"(",
"this",
".",
"getProperty",
"(",
"DBConstants",
".",
"LOAD_INITIAL_DATA",
")",
"!=",
"null",
")",
"if",
"(",
"(",
"this",
".",
"getDatabaseType",
"(",
")",
"&",
"(",
"DBConstants",
".",
"SHARED_DATA",
"|",
"DBConstants",
".",
"USER_DATA",
")",
")",
"==",
"DBConstants",
".",
"SHARED_DATA",
")",
"// Yes, only shared data can have DatabaseInfo",
"{",
"DatabaseInfo",
"recDatabaseInfo",
"=",
"new",
"DatabaseInfo",
"(",
")",
";",
"try",
"{",
"recDatabaseInfo",
".",
"setDatabaseName",
"(",
"this",
".",
"getDatabaseName",
"(",
"false",
")",
")",
";",
"recDatabaseInfo",
".",
"setTable",
"(",
"this",
".",
"doMakeTable",
"(",
"recDatabaseInfo",
")",
")",
";",
"// This makes a jdbc table",
"recDatabaseInfo",
".",
"init",
"(",
"null",
")",
";",
"// This should create the table if an archive exists",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"// Ignore",
"}",
"finally",
"{",
"recDatabaseInfo",
".",
"free",
"(",
")",
";",
"}",
"}",
"return",
"true",
";",
"// Success",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"super",
".",
"create",
"(",
"strDatabaseName",
")",
";",
"// Error, not found",
"}"
] |
Create a new empty database using the definition in the record.
@exception DBException Open errors passed from SQL.
@return true if successful.
|
[
"Create",
"a",
"new",
"empty",
"database",
"using",
"the",
"definition",
"in",
"the",
"record",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcDatabase.java#L704-L746
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.