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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
152,100
|
pressgang-ccms/PressGangCCMSBuilder
|
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanDocBookBuilder.java
|
PublicanDocBookBuilder.applyPublicanCfgOverrides
|
private String applyPublicanCfgOverrides(final BuildData buildData, final String publicanCfg) {
final Map<String, String> publicanCfgOverrides = buildData.getBuildOptions().getPublicanCfgOverrides();
String retValue = publicanCfg;
// Loop over each override and remove any entries that may exist and then append the new entry
for (final Map.Entry<String, String> publicanCfgOverrideEntry : publicanCfgOverrides.entrySet()) {
retValue = retValue.replaceFirst(publicanCfgOverrideEntry.getKey() + "\\s*:.*?(\\r)?\\n", "");
retValue += publicanCfgOverrideEntry.getKey() + ": " + publicanCfgOverrideEntry.getValue() + "\n";
}
return retValue;
}
|
java
|
private String applyPublicanCfgOverrides(final BuildData buildData, final String publicanCfg) {
final Map<String, String> publicanCfgOverrides = buildData.getBuildOptions().getPublicanCfgOverrides();
String retValue = publicanCfg;
// Loop over each override and remove any entries that may exist and then append the new entry
for (final Map.Entry<String, String> publicanCfgOverrideEntry : publicanCfgOverrides.entrySet()) {
retValue = retValue.replaceFirst(publicanCfgOverrideEntry.getKey() + "\\s*:.*?(\\r)?\\n", "");
retValue += publicanCfgOverrideEntry.getKey() + ": " + publicanCfgOverrideEntry.getValue() + "\n";
}
return retValue;
}
|
[
"private",
"String",
"applyPublicanCfgOverrides",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"String",
"publicanCfg",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"publicanCfgOverrides",
"=",
"buildData",
".",
"getBuildOptions",
"(",
")",
".",
"getPublicanCfgOverrides",
"(",
")",
";",
"String",
"retValue",
"=",
"publicanCfg",
";",
"// Loop over each override and remove any entries that may exist and then append the new entry",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"publicanCfgOverrideEntry",
":",
"publicanCfgOverrides",
".",
"entrySet",
"(",
")",
")",
"{",
"retValue",
"=",
"retValue",
".",
"replaceFirst",
"(",
"publicanCfgOverrideEntry",
".",
"getKey",
"(",
")",
"+",
"\"\\\\s*:.*?(\\\\r)?\\\\n\"",
",",
"\"\"",
")",
";",
"retValue",
"+=",
"publicanCfgOverrideEntry",
".",
"getKey",
"(",
")",
"+",
"\": \"",
"+",
"publicanCfgOverrideEntry",
".",
"getValue",
"(",
")",
"+",
"\"\\n\"",
";",
"}",
"return",
"retValue",
";",
"}"
] |
Applies custom user overrides to the publican.cfg file.
@param publicanCfg
@return
|
[
"Applies",
"custom",
"user",
"overrides",
"to",
"the",
"publican",
".",
"cfg",
"file",
"."
] |
5436d36ba1b3c5baa246b270e5fc350e6778bce8
|
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanDocBookBuilder.java#L269-L280
|
152,101
|
jbundle/jbundle
|
main/db/src/main/java/org/jbundle/main/db/Menus.java
|
Menus.addLinkTag
|
public StringBuffer addLinkTag(StringBuffer sb)
{
int iIndex = sb.lastIndexOf(Utility.endTag(this.getTableNames(false)));
if (iIndex != -1)
{
String strLink = Utility.encodeXML(this.getLink());
String strHelpLink = strLink;
if (strLink.indexOf('?') != -1) // Always
strHelpLink = "?" + DBParams.HELP + "=" + "&" + strLink.substring(strLink.indexOf('?') + 1);
sb.insert(iIndex,
Utility.startTag(XMLTags.LINK) +
strLink +
Utility.endTag(XMLTags.LINK) + XmlUtilities.NEWLINE +
Utility.startTag(XMLTags.HELPLINK) +
strHelpLink +
Utility.endTag(XMLTags.HELPLINK) + XmlUtilities.NEWLINE);
}
return sb;
}
|
java
|
public StringBuffer addLinkTag(StringBuffer sb)
{
int iIndex = sb.lastIndexOf(Utility.endTag(this.getTableNames(false)));
if (iIndex != -1)
{
String strLink = Utility.encodeXML(this.getLink());
String strHelpLink = strLink;
if (strLink.indexOf('?') != -1) // Always
strHelpLink = "?" + DBParams.HELP + "=" + "&" + strLink.substring(strLink.indexOf('?') + 1);
sb.insert(iIndex,
Utility.startTag(XMLTags.LINK) +
strLink +
Utility.endTag(XMLTags.LINK) + XmlUtilities.NEWLINE +
Utility.startTag(XMLTags.HELPLINK) +
strHelpLink +
Utility.endTag(XMLTags.HELPLINK) + XmlUtilities.NEWLINE);
}
return sb;
}
|
[
"public",
"StringBuffer",
"addLinkTag",
"(",
"StringBuffer",
"sb",
")",
"{",
"int",
"iIndex",
"=",
"sb",
".",
"lastIndexOf",
"(",
"Utility",
".",
"endTag",
"(",
"this",
".",
"getTableNames",
"(",
"false",
")",
")",
")",
";",
"if",
"(",
"iIndex",
"!=",
"-",
"1",
")",
"{",
"String",
"strLink",
"=",
"Utility",
".",
"encodeXML",
"(",
"this",
".",
"getLink",
"(",
")",
")",
";",
"String",
"strHelpLink",
"=",
"strLink",
";",
"if",
"(",
"strLink",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"// Always",
"strHelpLink",
"=",
"\"?\"",
"+",
"DBParams",
".",
"HELP",
"+",
"\"=\"",
"+",
"\"&\"",
"+",
"strLink",
".",
"substring",
"(",
"strLink",
".",
"indexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"sb",
".",
"insert",
"(",
"iIndex",
",",
"Utility",
".",
"startTag",
"(",
"XMLTags",
".",
"LINK",
")",
"+",
"strLink",
"+",
"Utility",
".",
"endTag",
"(",
"XMLTags",
".",
"LINK",
")",
"+",
"XmlUtilities",
".",
"NEWLINE",
"+",
"Utility",
".",
"startTag",
"(",
"XMLTags",
".",
"HELPLINK",
")",
"+",
"strHelpLink",
"+",
"Utility",
".",
"endTag",
"(",
"XMLTags",
".",
"HELPLINK",
")",
"+",
"XmlUtilities",
".",
"NEWLINE",
")",
";",
"}",
"return",
"sb",
";",
"}"
] |
Add a tag to this XML for the menu link.
|
[
"Add",
"a",
"tag",
"to",
"this",
"XML",
"for",
"the",
"menu",
"link",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/Menus.java#L277-L295
|
152,102
|
jbundle/jbundle
|
main/db/src/main/java/org/jbundle/main/db/Menus.java
|
Menus.getSubMenuXML
|
public String getSubMenuXML()
{
StringBuffer sbMenuArea = new StringBuffer();
if (this.getEditMode() == Constants.EDIT_CURRENT)
{
if (this.getField(Menus.ICON_RESOURCE).isNull())
{
String strIcon = this.getField(Menus.TYPE).toString();
if (strIcon.length() > 0)
strIcon = strIcon.substring(0, 1).toUpperCase() + strIcon.substring(1);
this.getField(Menus.ICON_RESOURCE).setString(strIcon);
}
sbMenuArea.append(XmlUtilities.createXMLStringRecord(this));
sbMenuArea = this.addLinkTag(sbMenuArea);
}
if (sbMenuArea.length() == 0)
sbMenuArea.append(
Utility.startTag(this.getTableNames(false)) +
" <Name>Name</Name>" +
" <Description>Description</Description>" +
" <Program>Program</Program>" +
" <Params>Params</Params>" +
" <IconResource>IconResource</IconResource>" +
" <Keywords>Keywords</Keywords>" +
" <Html>Html</Html>" +
Utility.endTag(this.getTableNames(false)));
StringBuffer sbContentArea = new StringBuffer();
sbContentArea.append(Utility.startTag(XMLTags.MENU_LIST));
try {
String strMenu = this.getField(Menus.ID).toString();
this.setKeyArea(Menus.PARENT_FOLDER_ID_KEY);
FileListener behavior = new StringSubFileFilter(strMenu, this.getField(Menus.PARENT_FOLDER_ID), null, null, null, null);
this.addListener(behavior);
this.close();
while (this.hasNext())
{
this.next();
if (this.getField(Menus.ICON_RESOURCE).isNull())
{
String strIcon = this.getField(Menus.TYPE).toString();
if (strIcon.length() > 0)
strIcon = strIcon.substring(0, 1).toUpperCase() + strIcon.substring(1);
this.getField(Menus.ICON_RESOURCE).setString(strIcon);
}
StringBuffer sbMenuItem = new StringBuffer();
sbMenuItem.append(XmlUtilities.createXMLStringRecord(this));
sbMenuItem = this.addLinkTag(sbMenuItem);
sbContentArea.append(sbMenuItem);
}
this.removeListener(behavior, true);
} catch (DBException ex) {
ex.printStackTrace();
}
sbContentArea.append(Utility.endTag(XMLTags.MENU_LIST));
sbMenuArea.insert(sbMenuArea.lastIndexOf(Utility.endTag(this.getTableNames(false))), sbContentArea);
return sbMenuArea.toString();
}
|
java
|
public String getSubMenuXML()
{
StringBuffer sbMenuArea = new StringBuffer();
if (this.getEditMode() == Constants.EDIT_CURRENT)
{
if (this.getField(Menus.ICON_RESOURCE).isNull())
{
String strIcon = this.getField(Menus.TYPE).toString();
if (strIcon.length() > 0)
strIcon = strIcon.substring(0, 1).toUpperCase() + strIcon.substring(1);
this.getField(Menus.ICON_RESOURCE).setString(strIcon);
}
sbMenuArea.append(XmlUtilities.createXMLStringRecord(this));
sbMenuArea = this.addLinkTag(sbMenuArea);
}
if (sbMenuArea.length() == 0)
sbMenuArea.append(
Utility.startTag(this.getTableNames(false)) +
" <Name>Name</Name>" +
" <Description>Description</Description>" +
" <Program>Program</Program>" +
" <Params>Params</Params>" +
" <IconResource>IconResource</IconResource>" +
" <Keywords>Keywords</Keywords>" +
" <Html>Html</Html>" +
Utility.endTag(this.getTableNames(false)));
StringBuffer sbContentArea = new StringBuffer();
sbContentArea.append(Utility.startTag(XMLTags.MENU_LIST));
try {
String strMenu = this.getField(Menus.ID).toString();
this.setKeyArea(Menus.PARENT_FOLDER_ID_KEY);
FileListener behavior = new StringSubFileFilter(strMenu, this.getField(Menus.PARENT_FOLDER_ID), null, null, null, null);
this.addListener(behavior);
this.close();
while (this.hasNext())
{
this.next();
if (this.getField(Menus.ICON_RESOURCE).isNull())
{
String strIcon = this.getField(Menus.TYPE).toString();
if (strIcon.length() > 0)
strIcon = strIcon.substring(0, 1).toUpperCase() + strIcon.substring(1);
this.getField(Menus.ICON_RESOURCE).setString(strIcon);
}
StringBuffer sbMenuItem = new StringBuffer();
sbMenuItem.append(XmlUtilities.createXMLStringRecord(this));
sbMenuItem = this.addLinkTag(sbMenuItem);
sbContentArea.append(sbMenuItem);
}
this.removeListener(behavior, true);
} catch (DBException ex) {
ex.printStackTrace();
}
sbContentArea.append(Utility.endTag(XMLTags.MENU_LIST));
sbMenuArea.insert(sbMenuArea.lastIndexOf(Utility.endTag(this.getTableNames(false))), sbContentArea);
return sbMenuArea.toString();
}
|
[
"public",
"String",
"getSubMenuXML",
"(",
")",
"{",
"StringBuffer",
"sbMenuArea",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"this",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_CURRENT",
")",
"{",
"if",
"(",
"this",
".",
"getField",
"(",
"Menus",
".",
"ICON_RESOURCE",
")",
".",
"isNull",
"(",
")",
")",
"{",
"String",
"strIcon",
"=",
"this",
".",
"getField",
"(",
"Menus",
".",
"TYPE",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"strIcon",
".",
"length",
"(",
")",
">",
"0",
")",
"strIcon",
"=",
"strIcon",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
")",
"+",
"strIcon",
".",
"substring",
"(",
"1",
")",
";",
"this",
".",
"getField",
"(",
"Menus",
".",
"ICON_RESOURCE",
")",
".",
"setString",
"(",
"strIcon",
")",
";",
"}",
"sbMenuArea",
".",
"append",
"(",
"XmlUtilities",
".",
"createXMLStringRecord",
"(",
"this",
")",
")",
";",
"sbMenuArea",
"=",
"this",
".",
"addLinkTag",
"(",
"sbMenuArea",
")",
";",
"}",
"if",
"(",
"sbMenuArea",
".",
"length",
"(",
")",
"==",
"0",
")",
"sbMenuArea",
".",
"append",
"(",
"Utility",
".",
"startTag",
"(",
"this",
".",
"getTableNames",
"(",
"false",
")",
")",
"+",
"\" <Name>Name</Name>\"",
"+",
"\" <Description>Description</Description>\"",
"+",
"\" <Program>Program</Program>\"",
"+",
"\" <Params>Params</Params>\"",
"+",
"\" <IconResource>IconResource</IconResource>\"",
"+",
"\" <Keywords>Keywords</Keywords>\"",
"+",
"\" <Html>Html</Html>\"",
"+",
"Utility",
".",
"endTag",
"(",
"this",
".",
"getTableNames",
"(",
"false",
")",
")",
")",
";",
"StringBuffer",
"sbContentArea",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sbContentArea",
".",
"append",
"(",
"Utility",
".",
"startTag",
"(",
"XMLTags",
".",
"MENU_LIST",
")",
")",
";",
"try",
"{",
"String",
"strMenu",
"=",
"this",
".",
"getField",
"(",
"Menus",
".",
"ID",
")",
".",
"toString",
"(",
")",
";",
"this",
".",
"setKeyArea",
"(",
"Menus",
".",
"PARENT_FOLDER_ID_KEY",
")",
";",
"FileListener",
"behavior",
"=",
"new",
"StringSubFileFilter",
"(",
"strMenu",
",",
"this",
".",
"getField",
"(",
"Menus",
".",
"PARENT_FOLDER_ID",
")",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"this",
".",
"addListener",
"(",
"behavior",
")",
";",
"this",
".",
"close",
"(",
")",
";",
"while",
"(",
"this",
".",
"hasNext",
"(",
")",
")",
"{",
"this",
".",
"next",
"(",
")",
";",
"if",
"(",
"this",
".",
"getField",
"(",
"Menus",
".",
"ICON_RESOURCE",
")",
".",
"isNull",
"(",
")",
")",
"{",
"String",
"strIcon",
"=",
"this",
".",
"getField",
"(",
"Menus",
".",
"TYPE",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"strIcon",
".",
"length",
"(",
")",
">",
"0",
")",
"strIcon",
"=",
"strIcon",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
")",
"+",
"strIcon",
".",
"substring",
"(",
"1",
")",
";",
"this",
".",
"getField",
"(",
"Menus",
".",
"ICON_RESOURCE",
")",
".",
"setString",
"(",
"strIcon",
")",
";",
"}",
"StringBuffer",
"sbMenuItem",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sbMenuItem",
".",
"append",
"(",
"XmlUtilities",
".",
"createXMLStringRecord",
"(",
"this",
")",
")",
";",
"sbMenuItem",
"=",
"this",
".",
"addLinkTag",
"(",
"sbMenuItem",
")",
";",
"sbContentArea",
".",
"append",
"(",
"sbMenuItem",
")",
";",
"}",
"this",
".",
"removeListener",
"(",
"behavior",
",",
"true",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"sbContentArea",
".",
"append",
"(",
"Utility",
".",
"endTag",
"(",
"XMLTags",
".",
"MENU_LIST",
")",
")",
";",
"sbMenuArea",
".",
"insert",
"(",
"sbMenuArea",
".",
"lastIndexOf",
"(",
"Utility",
".",
"endTag",
"(",
"this",
".",
"getTableNames",
"(",
"false",
")",
")",
")",
",",
"sbContentArea",
")",
";",
"return",
"sbMenuArea",
".",
"toString",
"(",
")",
";",
"}"
] |
Get the XML for this menu item and it's sub-menus.
|
[
"Get",
"the",
"XML",
"for",
"this",
"menu",
"item",
"and",
"it",
"s",
"sub",
"-",
"menus",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/Menus.java#L299-L358
|
152,103
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/FloatField.java
|
FloatField.getSQLType
|
public String getSQLType(boolean bIncludeLength, Map<String, Object> properties)
{
String strType = (String)properties.get(DBSQLTypes.FLOAT);
if (strType == null)
strType = DBSQLTypes.FLOAT; // The default SQL Type (Byte)
return strType; // The default SQL Type
}
|
java
|
public String getSQLType(boolean bIncludeLength, Map<String, Object> properties)
{
String strType = (String)properties.get(DBSQLTypes.FLOAT);
if (strType == null)
strType = DBSQLTypes.FLOAT; // The default SQL Type (Byte)
return strType; // The default SQL Type
}
|
[
"public",
"String",
"getSQLType",
"(",
"boolean",
"bIncludeLength",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"String",
"strType",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"DBSQLTypes",
".",
"FLOAT",
")",
";",
"if",
"(",
"strType",
"==",
"null",
")",
"strType",
"=",
"DBSQLTypes",
".",
"FLOAT",
";",
"// The default SQL Type (Byte)",
"return",
"strType",
";",
"// The default SQL Type",
"}"
] |
Get the SQL type of this field.
Typically FLOAT.
@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",
"FLOAT",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/FloatField.java#L315-L321
|
152,104
|
FitLayout/tools
|
src/main/java/org/fit/layout/process/ScriptableProcessor.java
|
ScriptableProcessor.drawToImage
|
public void drawToImage(String path)
{
try
{
ImageOutputDisplay disp = new ImageOutputDisplay(getPage().getWidth(), getPage().getHeight());
disp.drawPage(getPage());
disp.saveTo(path);
} catch (IOException e) {
log.error("Couldn't write to " + path + ": " + e.getMessage());
}
}
|
java
|
public void drawToImage(String path)
{
try
{
ImageOutputDisplay disp = new ImageOutputDisplay(getPage().getWidth(), getPage().getHeight());
disp.drawPage(getPage());
disp.saveTo(path);
} catch (IOException e) {
log.error("Couldn't write to " + path + ": " + e.getMessage());
}
}
|
[
"public",
"void",
"drawToImage",
"(",
"String",
"path",
")",
"{",
"try",
"{",
"ImageOutputDisplay",
"disp",
"=",
"new",
"ImageOutputDisplay",
"(",
"getPage",
"(",
")",
".",
"getWidth",
"(",
")",
",",
"getPage",
"(",
")",
".",
"getHeight",
"(",
")",
")",
";",
"disp",
".",
"drawPage",
"(",
"getPage",
"(",
")",
")",
";",
"disp",
".",
"saveTo",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Couldn't write to \"",
"+",
"path",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] |
Draws the current page to an image file.
@param path The path to the destination image file.
|
[
"Draws",
"the",
"current",
"page",
"to",
"an",
"image",
"file",
"."
] |
43a8e3f4ddf21a031d3ab7247b8d37310bda4856
|
https://github.com/FitLayout/tools/blob/43a8e3f4ddf21a031d3ab7247b8d37310bda4856/src/main/java/org/fit/layout/process/ScriptableProcessor.java#L187-L197
|
152,105
|
FitLayout/tools
|
src/main/java/org/fit/layout/process/ScriptableProcessor.java
|
ScriptableProcessor.drawToImageWithAreas
|
public void drawToImageWithAreas(String path, String areaNames)
{
try
{
ImageOutputDisplay disp = new ImageOutputDisplay(getPage().getWidth(), getPage().getHeight());
disp.drawPage(getPage());
showAreas(disp, getAreaTree().getRoot(), areaNames);
disp.saveTo(path);
} catch (IOException e) {
log.error("Couldn't write to " + path + ": " + e.getMessage());
}
}
|
java
|
public void drawToImageWithAreas(String path, String areaNames)
{
try
{
ImageOutputDisplay disp = new ImageOutputDisplay(getPage().getWidth(), getPage().getHeight());
disp.drawPage(getPage());
showAreas(disp, getAreaTree().getRoot(), areaNames);
disp.saveTo(path);
} catch (IOException e) {
log.error("Couldn't write to " + path + ": " + e.getMessage());
}
}
|
[
"public",
"void",
"drawToImageWithAreas",
"(",
"String",
"path",
",",
"String",
"areaNames",
")",
"{",
"try",
"{",
"ImageOutputDisplay",
"disp",
"=",
"new",
"ImageOutputDisplay",
"(",
"getPage",
"(",
")",
".",
"getWidth",
"(",
")",
",",
"getPage",
"(",
")",
".",
"getHeight",
"(",
")",
")",
";",
"disp",
".",
"drawPage",
"(",
"getPage",
"(",
")",
")",
";",
"showAreas",
"(",
"disp",
",",
"getAreaTree",
"(",
")",
".",
"getRoot",
"(",
")",
",",
"areaNames",
")",
";",
"disp",
".",
"saveTo",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Couldn't write to \"",
"+",
"path",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] |
Draws the page to an image file and marks selected areas in the image.
@param path The path to the destination image file.
@param areaNames A substring of the names of areas that should be marked in the image. When set to {@code null}, all the areas are marked.
|
[
"Draws",
"the",
"page",
"to",
"an",
"image",
"file",
"and",
"marks",
"selected",
"areas",
"in",
"the",
"image",
"."
] |
43a8e3f4ddf21a031d3ab7247b8d37310bda4856
|
https://github.com/FitLayout/tools/blob/43a8e3f4ddf21a031d3ab7247b8d37310bda4856/src/main/java/org/fit/layout/process/ScriptableProcessor.java#L204-L215
|
152,106
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/MergeData.java
|
MergeData.mergeSourceRecord
|
public void mergeSourceRecord(Record recSource, Record recDest)
{
try {
boolean bFound = this.readDestRecord(recSource, recDest);
if (!bFound)
recDest.addNew();
else
recDest.edit();
this.mergeSourceData(recSource, recDest, bFound);
if (recDest.isModified())
{
if (recDest.getEditMode() == DBConstants.EDIT_ADD)
{
boolean bAutoSequence = true;
if (!recDest.getCounterField().isNull())
bAutoSequence = false;
recDest.setAutoSequence(bAutoSequence);
recDest.add();
recDest.setAutoSequence(true);
}
else if (recDest.getEditMode() == DBConstants.EDIT_IN_PROGRESS)
recDest.set();
}
} catch (DBException e) {
e.printStackTrace();
}
}
|
java
|
public void mergeSourceRecord(Record recSource, Record recDest)
{
try {
boolean bFound = this.readDestRecord(recSource, recDest);
if (!bFound)
recDest.addNew();
else
recDest.edit();
this.mergeSourceData(recSource, recDest, bFound);
if (recDest.isModified())
{
if (recDest.getEditMode() == DBConstants.EDIT_ADD)
{
boolean bAutoSequence = true;
if (!recDest.getCounterField().isNull())
bAutoSequence = false;
recDest.setAutoSequence(bAutoSequence);
recDest.add();
recDest.setAutoSequence(true);
}
else if (recDest.getEditMode() == DBConstants.EDIT_IN_PROGRESS)
recDest.set();
}
} catch (DBException e) {
e.printStackTrace();
}
}
|
[
"public",
"void",
"mergeSourceRecord",
"(",
"Record",
"recSource",
",",
"Record",
"recDest",
")",
"{",
"try",
"{",
"boolean",
"bFound",
"=",
"this",
".",
"readDestRecord",
"(",
"recSource",
",",
"recDest",
")",
";",
"if",
"(",
"!",
"bFound",
")",
"recDest",
".",
"addNew",
"(",
")",
";",
"else",
"recDest",
".",
"edit",
"(",
")",
";",
"this",
".",
"mergeSourceData",
"(",
"recSource",
",",
"recDest",
",",
"bFound",
")",
";",
"if",
"(",
"recDest",
".",
"isModified",
"(",
")",
")",
"{",
"if",
"(",
"recDest",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_ADD",
")",
"{",
"boolean",
"bAutoSequence",
"=",
"true",
";",
"if",
"(",
"!",
"recDest",
".",
"getCounterField",
"(",
")",
".",
"isNull",
"(",
")",
")",
"bAutoSequence",
"=",
"false",
";",
"recDest",
".",
"setAutoSequence",
"(",
"bAutoSequence",
")",
";",
"recDest",
".",
"add",
"(",
")",
";",
"recDest",
".",
"setAutoSequence",
"(",
"true",
")",
";",
"}",
"else",
"if",
"(",
"recDest",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_IN_PROGRESS",
")",
"recDest",
".",
"set",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] |
MergeSourceRecord Method.
|
[
"MergeSourceRecord",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/MergeData.java#L71-L97
|
152,107
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/MergeData.java
|
MergeData.mergeSourceData
|
public void mergeSourceData(Record recSource, Record recDest, boolean bFound)
{
for (int iFieldSeq = 0; iFieldSeq < recSource.getFieldCount(); iFieldSeq++)
{
BaseField fldSource = recSource.getField(iFieldSeq);
BaseField fldDest = recDest.getField(fldSource.getFieldName());
if (fldDest != null)
if (!fldSource.isNull())
fldDest.moveFieldToThis(fldSource);
}
}
|
java
|
public void mergeSourceData(Record recSource, Record recDest, boolean bFound)
{
for (int iFieldSeq = 0; iFieldSeq < recSource.getFieldCount(); iFieldSeq++)
{
BaseField fldSource = recSource.getField(iFieldSeq);
BaseField fldDest = recDest.getField(fldSource.getFieldName());
if (fldDest != null)
if (!fldSource.isNull())
fldDest.moveFieldToThis(fldSource);
}
}
|
[
"public",
"void",
"mergeSourceData",
"(",
"Record",
"recSource",
",",
"Record",
"recDest",
",",
"boolean",
"bFound",
")",
"{",
"for",
"(",
"int",
"iFieldSeq",
"=",
"0",
";",
"iFieldSeq",
"<",
"recSource",
".",
"getFieldCount",
"(",
")",
";",
"iFieldSeq",
"++",
")",
"{",
"BaseField",
"fldSource",
"=",
"recSource",
".",
"getField",
"(",
"iFieldSeq",
")",
";",
"BaseField",
"fldDest",
"=",
"recDest",
".",
"getField",
"(",
"fldSource",
".",
"getFieldName",
"(",
")",
")",
";",
"if",
"(",
"fldDest",
"!=",
"null",
")",
"if",
"(",
"!",
"fldSource",
".",
"isNull",
"(",
")",
")",
"fldDest",
".",
"moveFieldToThis",
"(",
"fldSource",
")",
";",
"}",
"}"
] |
Merge this source record with the destination record.
@param recSource
@param recDest.
|
[
"Merge",
"this",
"source",
"record",
"with",
"the",
"destination",
"record",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/MergeData.java#L122-L132
|
152,108
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/MergeData.java
|
MergeData.readDestRecord
|
public boolean readDestRecord(FieldList recSource, Record recDest)
{
FieldInfo fldSecond = recSource.getField("Name");
if (fldSecond == null)
fldSecond = recSource.getField("Description");
if (fldSecond == null)
return false;
recDest = BaseFixData.getRecordFromDescription(fldSecond.toString(), fldSecond.getFieldName(), recDest);
return (recDest != null);
}
|
java
|
public boolean readDestRecord(FieldList recSource, Record recDest)
{
FieldInfo fldSecond = recSource.getField("Name");
if (fldSecond == null)
fldSecond = recSource.getField("Description");
if (fldSecond == null)
return false;
recDest = BaseFixData.getRecordFromDescription(fldSecond.toString(), fldSecond.getFieldName(), recDest);
return (recDest != null);
}
|
[
"public",
"boolean",
"readDestRecord",
"(",
"FieldList",
"recSource",
",",
"Record",
"recDest",
")",
"{",
"FieldInfo",
"fldSecond",
"=",
"recSource",
".",
"getField",
"(",
"\"Name\"",
")",
";",
"if",
"(",
"fldSecond",
"==",
"null",
")",
"fldSecond",
"=",
"recSource",
".",
"getField",
"(",
"\"Description\"",
")",
";",
"if",
"(",
"fldSecond",
"==",
"null",
")",
"return",
"false",
";",
"recDest",
"=",
"BaseFixData",
".",
"getRecordFromDescription",
"(",
"fldSecond",
".",
"toString",
"(",
")",
",",
"fldSecond",
".",
"getFieldName",
"(",
")",
",",
"recDest",
")",
";",
"return",
"(",
"recDest",
"!=",
"null",
")",
";",
"}"
] |
Given this source record, read the destination record.
@param recSource The source record
@param recDest The destination record
@return True if found.
|
[
"Given",
"this",
"source",
"record",
"read",
"the",
"destination",
"record",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/MergeData.java#L139-L148
|
152,109
|
trellis-ldp-archive/trellis-io-jena
|
src/main/java/org/trellisldp/io/impl/HtmlData.java
|
HtmlData.getCss
|
public List<String> getCss() {
return stream(properties.getOrDefault("css", "").split(","))
.map(String::trim).filter(x -> x.length() > 0).collect(toList());
}
|
java
|
public List<String> getCss() {
return stream(properties.getOrDefault("css", "").split(","))
.map(String::trim).filter(x -> x.length() > 0).collect(toList());
}
|
[
"public",
"List",
"<",
"String",
">",
"getCss",
"(",
")",
"{",
"return",
"stream",
"(",
"properties",
".",
"getOrDefault",
"(",
"\"css\"",
",",
"\"\"",
")",
".",
"split",
"(",
"\",\"",
")",
")",
".",
"map",
"(",
"String",
"::",
"trim",
")",
".",
"filter",
"(",
"x",
"->",
"x",
".",
"length",
"(",
")",
">",
"0",
")",
".",
"collect",
"(",
"toList",
"(",
")",
")",
";",
"}"
] |
Get any CSS document URLs
@return a list of any CSS documents
|
[
"Get",
"any",
"CSS",
"document",
"URLs"
] |
3a06f8f8e7b6fc83fb659cb61217810f813967e8
|
https://github.com/trellis-ldp-archive/trellis-io-jena/blob/3a06f8f8e7b6fc83fb659cb61217810f813967e8/src/main/java/org/trellisldp/io/impl/HtmlData.java#L80-L83
|
152,110
|
isisaddons-legacy/isis-module-settings
|
dom/src/main/java/org/isisaddons/module/settings/dom/ApplicationSettingRepository.java
|
ApplicationSettingRepository.newBoolean
|
@Programmatic
public ApplicationSettingJdo newBoolean(
final String key,
final String description,
final Boolean value) {
return newSetting(key, description, SettingType.BOOLEAN, Boolean.toString(value != null && value));
}
|
java
|
@Programmatic
public ApplicationSettingJdo newBoolean(
final String key,
final String description,
final Boolean value) {
return newSetting(key, description, SettingType.BOOLEAN, Boolean.toString(value != null && value));
}
|
[
"@",
"Programmatic",
"public",
"ApplicationSettingJdo",
"newBoolean",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"description",
",",
"final",
"Boolean",
"value",
")",
"{",
"return",
"newSetting",
"(",
"key",
",",
"description",
",",
"SettingType",
".",
"BOOLEAN",
",",
"Boolean",
".",
"toString",
"(",
"value",
"!=",
"null",
"&&",
"value",
")",
")",
";",
"}"
] |
region > newBoolean
|
[
"region",
">",
"newBoolean"
] |
e56c4e4a828b37381e7af7426c1cf1b26739f23e
|
https://github.com/isisaddons-legacy/isis-module-settings/blob/e56c4e4a828b37381e7af7426c1cf1b26739f23e/dom/src/main/java/org/isisaddons/module/settings/dom/ApplicationSettingRepository.java#L120-L126
|
152,111
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/SebContextWait.java
|
SebContextWait.untilTrue
|
public void untilTrue(Predicate<SebContext> isTrue) {
super.until(new com.google.common.base.Predicate<SebContext>() {
@Override
public boolean apply(SebContext input) {
return isTrue.test(input);
}
});
}
|
java
|
public void untilTrue(Predicate<SebContext> isTrue) {
super.until(new com.google.common.base.Predicate<SebContext>() {
@Override
public boolean apply(SebContext input) {
return isTrue.test(input);
}
});
}
|
[
"public",
"void",
"untilTrue",
"(",
"Predicate",
"<",
"SebContext",
">",
"isTrue",
")",
"{",
"super",
".",
"until",
"(",
"new",
"com",
".",
"google",
".",
"common",
".",
"base",
".",
"Predicate",
"<",
"SebContext",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"SebContext",
"input",
")",
"{",
"return",
"isTrue",
".",
"test",
"(",
"input",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Until method using predicate functional interface. It solves ambiguity
when using basic until method without typed parameter.
Repeatedly applies this instance's input value to the given predicate
until the timeout expires or the predicate evaluates to true.
@param isTrue
The predicate to wait on.
@throws TimeoutException
If the timeout expires.
|
[
"Until",
"method",
"using",
"predicate",
"functional",
"interface",
".",
"It",
"solves",
"ambiguity",
"when",
"using",
"basic",
"until",
"method",
"without",
"typed",
"parameter",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/SebContextWait.java#L93-L100
|
152,112
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/SebContextWait.java
|
SebContextWait.untilValid
|
public <V> V untilValid(Function<SebContext, V> isTrue) {
return super.until(new com.google.common.base.Function<SebContext, V>() {
@Override
public V apply(SebContext input) {
return isTrue.apply(input);
}
});
}
|
java
|
public <V> V untilValid(Function<SebContext, V> isTrue) {
return super.until(new com.google.common.base.Function<SebContext, V>() {
@Override
public V apply(SebContext input) {
return isTrue.apply(input);
}
});
}
|
[
"public",
"<",
"V",
">",
"V",
"untilValid",
"(",
"Function",
"<",
"SebContext",
",",
"V",
">",
"isTrue",
")",
"{",
"return",
"super",
".",
"until",
"(",
"new",
"com",
".",
"google",
".",
"common",
".",
"base",
".",
"Function",
"<",
"SebContext",
",",
"V",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"V",
"apply",
"(",
"SebContext",
"input",
")",
"{",
"return",
"isTrue",
".",
"apply",
"(",
"input",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Until method using function functional interface. It solves ambiguity
when using basic until method without typed parameter.
Repeatedly applies this instance's input value to the given function
until one of the following occurs:
<ol>
<li>the function returns neither null nor false,</li>
<li>the function throws an unignored exception,</li>
<li>the timeout expires,
<li>
<li>the current thread is interrupted</li>
</ol>
@param isTrue
the parameter to pass to the {@link ExpectedCondition}
@param <V>
The function's expected return type.
@return The functions' return value if the function returned something
different from null or false before the timeout expired.
@throws TimeoutException
If the timeout expires.
|
[
"Until",
"method",
"using",
"function",
"functional",
"interface",
".",
"It",
"solves",
"ambiguity",
"when",
"using",
"basic",
"until",
"method",
"without",
"typed",
"parameter",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/SebContextWait.java#L125-L132
|
152,113
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/SebContextWait.java
|
SebContextWait.sleep
|
public SebContextWait sleep() {
try {
sleeper.sleep(timeout);
return this;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new WebDriverException(e);
}
}
|
java
|
public SebContextWait sleep() {
try {
sleeper.sleep(timeout);
return this;
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new WebDriverException(e);
}
}
|
[
"public",
"SebContextWait",
"sleep",
"(",
")",
"{",
"try",
"{",
"sleeper",
".",
"sleep",
"(",
"timeout",
")",
";",
"return",
"this",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"throw",
"new",
"WebDriverException",
"(",
"e",
")",
";",
"}",
"}"
] |
Sleeps for defined timeout without checking for any
condition.
|
[
"Sleeps",
"for",
"defined",
"timeout",
"without",
"checking",
"for",
"any",
"condition",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/SebContextWait.java#L138-L146
|
152,114
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.freeAllSFields
|
public void freeAllSFields(boolean bIncludeToolScreens)
{
int iToolScreens = 0;
while (this.getSFieldCount() > iToolScreens)
{ // First, get rid of all child screens.
ScreenField sField = this.getSField(iToolScreens);
if ((!bIncludeToolScreens) && (sField instanceof ToolScreen))
iToolScreens++;
else
sField.free();
}
}
|
java
|
public void freeAllSFields(boolean bIncludeToolScreens)
{
int iToolScreens = 0;
while (this.getSFieldCount() > iToolScreens)
{ // First, get rid of all child screens.
ScreenField sField = this.getSField(iToolScreens);
if ((!bIncludeToolScreens) && (sField instanceof ToolScreen))
iToolScreens++;
else
sField.free();
}
}
|
[
"public",
"void",
"freeAllSFields",
"(",
"boolean",
"bIncludeToolScreens",
")",
"{",
"int",
"iToolScreens",
"=",
"0",
";",
"while",
"(",
"this",
".",
"getSFieldCount",
"(",
")",
">",
"iToolScreens",
")",
"{",
"// First, get rid of all child screens.",
"ScreenField",
"sField",
"=",
"this",
".",
"getSField",
"(",
"iToolScreens",
")",
";",
"if",
"(",
"(",
"!",
"bIncludeToolScreens",
")",
"&&",
"(",
"sField",
"instanceof",
"ToolScreen",
")",
")",
"iToolScreens",
"++",
";",
"else",
"sField",
".",
"free",
"(",
")",
";",
"}",
"}"
] |
Free all the child sFields.
@param bIncludeToolScreens If true, also free the toolScreens.
|
[
"Free",
"all",
"the",
"child",
"sFields",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L541-L552
|
152,115
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.getRecord
|
public Record getRecord(String strFileName)
{
if (m_screenParent != null)
return m_screenParent.getRecord(strFileName); // Look thru the parent window now
else
return null;
}
|
java
|
public Record getRecord(String strFileName)
{
if (m_screenParent != null)
return m_screenParent.getRecord(strFileName); // Look thru the parent window now
else
return null;
}
|
[
"public",
"Record",
"getRecord",
"(",
"String",
"strFileName",
")",
"{",
"if",
"(",
"m_screenParent",
"!=",
"null",
")",
"return",
"m_screenParent",
".",
"getRecord",
"(",
"strFileName",
")",
";",
"// Look thru the parent window now",
"else",
"return",
"null",
";",
"}"
] |
Lookup this record in this screen.
@param The file name of the record to find.
@param The record (or null if not found).
|
[
"Lookup",
"this",
"record",
"in",
"this",
"screen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L612-L618
|
152,116
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.onAdd
|
public boolean onAdd()
{
Record record = this.getMainRecord();
if (record == null)
return false;
try {
if (record.isModified(false))
{
if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
record.set();
else if (record.getEditMode() == Constants.EDIT_ADD)
record.add();
}
record.addNew();
this.clearStatusText();
} catch(DBException ex) {
this.displayError(ex);
return false;
}
return true;
}
|
java
|
public boolean onAdd()
{
Record record = this.getMainRecord();
if (record == null)
return false;
try {
if (record.isModified(false))
{
if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
record.set();
else if (record.getEditMode() == Constants.EDIT_ADD)
record.add();
}
record.addNew();
this.clearStatusText();
} catch(DBException ex) {
this.displayError(ex);
return false;
}
return true;
}
|
[
"public",
"boolean",
"onAdd",
"(",
")",
"{",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"return",
"false",
";",
"try",
"{",
"if",
"(",
"record",
".",
"isModified",
"(",
"false",
")",
")",
"{",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_IN_PROGRESS",
")",
"record",
".",
"set",
"(",
")",
";",
"else",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_ADD",
")",
"record",
".",
"add",
"(",
")",
";",
"}",
"record",
".",
"addNew",
"(",
")",
";",
"this",
".",
"clearStatusText",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"this",
".",
"displayError",
"(",
"ex",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Process the "Add" toolbar command.
@return true If command was handled
|
[
"Process",
"the",
"Add",
"toolbar",
"command",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L719-L740
|
152,117
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.onHelp
|
public boolean onHelp(int iOptions)
{
String strPrevAction = this.getScreenURL();
if ((strPrevAction == null) || (strPrevAction.length() == 0))
return false; // Can't handle help if I'm not the target screen.
// Note: The following is a hack to make the demo screen stop displaying after the first help is pressed
if (this.getProperty("displayInitialHelp") != null)
if ((this.getProperty("helplanguage") != null) && (this.getProperty("helplanguage").length() > 0))
if (this.getTask() != null)
if (this.getTask().getApplication() != null)
this.getTask().getApplication().setProperty("helplanguage", this.getTask().getApplication().getLanguage(true));
strPrevAction = Utility.fixDisplayURL(strPrevAction, true, true, true, this);
BaseAppletReference applet = null;
if (this.getAppletScreen() != null)
if (this.getAppletScreen().getScreenFieldView() != null)
applet = (BaseAppletReference)this.getAppletScreen().getScreenFieldView().getControl();
if (applet != null)
iOptions = applet.getHelpPageOptions(iOptions);
if ((MenuConstants.HELP_WEB_OPTION & iOptions) == MenuConstants.HELP_WEB_OPTION)
return this.getScreenFieldView().showDocument(strPrevAction, iOptions & 1); // Not standalone
else
return this.getAppletScreen().showHelpScreen(strPrevAction, iOptions);
}
|
java
|
public boolean onHelp(int iOptions)
{
String strPrevAction = this.getScreenURL();
if ((strPrevAction == null) || (strPrevAction.length() == 0))
return false; // Can't handle help if I'm not the target screen.
// Note: The following is a hack to make the demo screen stop displaying after the first help is pressed
if (this.getProperty("displayInitialHelp") != null)
if ((this.getProperty("helplanguage") != null) && (this.getProperty("helplanguage").length() > 0))
if (this.getTask() != null)
if (this.getTask().getApplication() != null)
this.getTask().getApplication().setProperty("helplanguage", this.getTask().getApplication().getLanguage(true));
strPrevAction = Utility.fixDisplayURL(strPrevAction, true, true, true, this);
BaseAppletReference applet = null;
if (this.getAppletScreen() != null)
if (this.getAppletScreen().getScreenFieldView() != null)
applet = (BaseAppletReference)this.getAppletScreen().getScreenFieldView().getControl();
if (applet != null)
iOptions = applet.getHelpPageOptions(iOptions);
if ((MenuConstants.HELP_WEB_OPTION & iOptions) == MenuConstants.HELP_WEB_OPTION)
return this.getScreenFieldView().showDocument(strPrevAction, iOptions & 1); // Not standalone
else
return this.getAppletScreen().showHelpScreen(strPrevAction, iOptions);
}
|
[
"public",
"boolean",
"onHelp",
"(",
"int",
"iOptions",
")",
"{",
"String",
"strPrevAction",
"=",
"this",
".",
"getScreenURL",
"(",
")",
";",
"if",
"(",
"(",
"strPrevAction",
"==",
"null",
")",
"||",
"(",
"strPrevAction",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"return",
"false",
";",
"// Can't handle help if I'm not the target screen.",
"// Note: The following is a hack to make the demo screen stop displaying after the first help is pressed",
"if",
"(",
"this",
".",
"getProperty",
"(",
"\"displayInitialHelp\"",
")",
"!=",
"null",
")",
"if",
"(",
"(",
"this",
".",
"getProperty",
"(",
"\"helplanguage\"",
")",
"!=",
"null",
")",
"&&",
"(",
"this",
".",
"getProperty",
"(",
"\"helplanguage\"",
")",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"if",
"(",
"this",
".",
"getTask",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"this",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
"!=",
"null",
")",
"this",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
".",
"setProperty",
"(",
"\"helplanguage\"",
",",
"this",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
".",
"getLanguage",
"(",
"true",
")",
")",
";",
"strPrevAction",
"=",
"Utility",
".",
"fixDisplayURL",
"(",
"strPrevAction",
",",
"true",
",",
"true",
",",
"true",
",",
"this",
")",
";",
"BaseAppletReference",
"applet",
"=",
"null",
";",
"if",
"(",
"this",
".",
"getAppletScreen",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"this",
".",
"getAppletScreen",
"(",
")",
".",
"getScreenFieldView",
"(",
")",
"!=",
"null",
")",
"applet",
"=",
"(",
"BaseAppletReference",
")",
"this",
".",
"getAppletScreen",
"(",
")",
".",
"getScreenFieldView",
"(",
")",
".",
"getControl",
"(",
")",
";",
"if",
"(",
"applet",
"!=",
"null",
")",
"iOptions",
"=",
"applet",
".",
"getHelpPageOptions",
"(",
"iOptions",
")",
";",
"if",
"(",
"(",
"MenuConstants",
".",
"HELP_WEB_OPTION",
"&",
"iOptions",
")",
"==",
"MenuConstants",
".",
"HELP_WEB_OPTION",
")",
"return",
"this",
".",
"getScreenFieldView",
"(",
")",
".",
"showDocument",
"(",
"strPrevAction",
",",
"iOptions",
"&",
"1",
")",
";",
"// Not standalone",
"else",
"return",
"this",
".",
"getAppletScreen",
"(",
")",
".",
"showHelpScreen",
"(",
"strPrevAction",
",",
"iOptions",
")",
";",
"}"
] |
Process the "Help" toolbar command.
@param bUseSameWindow Use the same window?
@retrun true if successful.
|
[
"Process",
"the",
"Help",
"toolbar",
"command",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L775-L798
|
152,118
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.onMove
|
public boolean onMove(int nIDMoveCommand)
{
Record record = this.getMainRecord();
if (record == null)
return false;
try
{
if (record.isModified(false))
{
if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
record.set();
else if (record.getEditMode() == Constants.EDIT_ADD)
record.add();
}
if ((nIDMoveCommand == Constants.NEXT_RECORD) && (!record.hasNext()))
this.onAdd(); // Next record, enter "Add" mode
else if ((nIDMoveCommand == Constants.PREVIOUS_RECORD) && (!record.hasPrevious()))
this.onMove(Constants.FIRST_RECORD); // Can't move before the first record
else
record.move(nIDMoveCommand);
record.isModified(false);
this.clearStatusText();
} catch(DBException ex) {
this.displayError(ex);
return false;
}
return true; // Command processed
}
|
java
|
public boolean onMove(int nIDMoveCommand)
{
Record record = this.getMainRecord();
if (record == null)
return false;
try
{
if (record.isModified(false))
{
if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
record.set();
else if (record.getEditMode() == Constants.EDIT_ADD)
record.add();
}
if ((nIDMoveCommand == Constants.NEXT_RECORD) && (!record.hasNext()))
this.onAdd(); // Next record, enter "Add" mode
else if ((nIDMoveCommand == Constants.PREVIOUS_RECORD) && (!record.hasPrevious()))
this.onMove(Constants.FIRST_RECORD); // Can't move before the first record
else
record.move(nIDMoveCommand);
record.isModified(false);
this.clearStatusText();
} catch(DBException ex) {
this.displayError(ex);
return false;
}
return true; // Command processed
}
|
[
"public",
"boolean",
"onMove",
"(",
"int",
"nIDMoveCommand",
")",
"{",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"return",
"false",
";",
"try",
"{",
"if",
"(",
"record",
".",
"isModified",
"(",
"false",
")",
")",
"{",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_IN_PROGRESS",
")",
"record",
".",
"set",
"(",
")",
";",
"else",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_ADD",
")",
"record",
".",
"add",
"(",
")",
";",
"}",
"if",
"(",
"(",
"nIDMoveCommand",
"==",
"Constants",
".",
"NEXT_RECORD",
")",
"&&",
"(",
"!",
"record",
".",
"hasNext",
"(",
")",
")",
")",
"this",
".",
"onAdd",
"(",
")",
";",
"// Next record, enter \"Add\" mode",
"else",
"if",
"(",
"(",
"nIDMoveCommand",
"==",
"Constants",
".",
"PREVIOUS_RECORD",
")",
"&&",
"(",
"!",
"record",
".",
"hasPrevious",
"(",
")",
")",
")",
"this",
".",
"onMove",
"(",
"Constants",
".",
"FIRST_RECORD",
")",
";",
"// Can't move before the first record",
"else",
"record",
".",
"move",
"(",
"nIDMoveCommand",
")",
";",
"record",
".",
"isModified",
"(",
"false",
")",
";",
"this",
".",
"clearStatusText",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"this",
".",
"displayError",
"(",
"ex",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"// Command processed",
"}"
] |
Process the "Move" Commands.
@param nIDMoveCommand The move command (first/last/next/prev).
@return true if successful.
|
[
"Process",
"the",
"Move",
"Commands",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L878-L905
|
152,119
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.onRefresh
|
public boolean onRefresh()
{
Record record = this.getMainRecord();
if (record == null)
return false;
try
{
if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
{ // If they're adding, can't delete nothing!
if (record.isRefreshedRecord())
return this.onDelete();
Object bookmark = record.getHandle(DBConstants.BOOKMARK_HANDLE);
record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE);
}
if (record.getEditMode() == Constants.EDIT_ADD)
record.addNew();
this.clearStatusText();
} catch (DBException ex) {
this.displayError(ex);
return false;
}
return true;
}
|
java
|
public boolean onRefresh()
{
Record record = this.getMainRecord();
if (record == null)
return false;
try
{
if (record.getEditMode() == Constants.EDIT_IN_PROGRESS)
{ // If they're adding, can't delete nothing!
if (record.isRefreshedRecord())
return this.onDelete();
Object bookmark = record.getHandle(DBConstants.BOOKMARK_HANDLE);
record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE);
}
if (record.getEditMode() == Constants.EDIT_ADD)
record.addNew();
this.clearStatusText();
} catch (DBException ex) {
this.displayError(ex);
return false;
}
return true;
}
|
[
"public",
"boolean",
"onRefresh",
"(",
")",
"{",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"record",
"==",
"null",
")",
"return",
"false",
";",
"try",
"{",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_IN_PROGRESS",
")",
"{",
"// If they're adding, can't delete nothing!",
"if",
"(",
"record",
".",
"isRefreshedRecord",
"(",
")",
")",
"return",
"this",
".",
"onDelete",
"(",
")",
";",
"Object",
"bookmark",
"=",
"record",
".",
"getHandle",
"(",
"DBConstants",
".",
"BOOKMARK_HANDLE",
")",
";",
"record",
".",
"setHandle",
"(",
"bookmark",
",",
"DBConstants",
".",
"BOOKMARK_HANDLE",
")",
";",
"}",
"if",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"Constants",
".",
"EDIT_ADD",
")",
"record",
".",
"addNew",
"(",
")",
";",
"this",
".",
"clearStatusText",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"this",
".",
"displayError",
"(",
"ex",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Process the Refresh Command.
@return true if successful.
|
[
"Process",
"the",
"Refresh",
"Command",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L910-L933
|
152,120
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.addURLParam
|
public String addURLParam(String strOldURL, String strParam, String strData)
{
return Utility.addURLParam(strOldURL, strParam, strData);
}
|
java
|
public String addURLParam(String strOldURL, String strParam, String strData)
{
return Utility.addURLParam(strOldURL, strParam, strData);
}
|
[
"public",
"String",
"addURLParam",
"(",
"String",
"strOldURL",
",",
"String",
"strParam",
",",
"String",
"strData",
")",
"{",
"return",
"Utility",
".",
"addURLParam",
"(",
"strOldURL",
",",
"strParam",
",",
"strData",
")",
";",
"}"
] |
Get the command string that will restore this screen.
Override in Screen, GridScreen, MenuScreen.
@param strOldURL The URL to add this param to.
@param strParam The new param.
@param strData The new data for this param.
@return The new URL.
@see Utility.addURLParam.
|
[
"Get",
"the",
"command",
"string",
"that",
"will",
"restore",
"this",
"screen",
".",
"Override",
"in",
"Screen",
"GridScreen",
"MenuScreen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L960-L963
|
152,121
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.onBack
|
public boolean onBack()
{
BasePanel parent = this.getParentScreen();
if (parent == null)
return false;
parent.popHistory(1, false); // Pop command for this screen
String strLastCommand = parent.popHistory(1, false);
if (strLastCommand != null) // I don't back up into the browser history if the user hit the java back button.
{ // If that wasn't the first screen, redo pop and update the browser this time
parent.pushHistory(strLastCommand, false);
strLastCommand = parent.popHistory(1, true);
}
if ((strLastCommand == null) || (strLastCommand.length() == 0))
{
if (parent.getParentScreen() != null)
if (!(parent.getParentScreen() instanceof FrameScreen))
return parent.onBack();
// ++Add++ No more to pop, display home screen (if push-down gets messed up)
parent.pushHistory(this.getScreenURL(), false); // This is the first screen in the stack
}
else
this.handleCommand(strLastCommand, this, ScreenConstants.USE_SAME_WINDOW | ScreenConstants.DONT_PUSH_TO_BROWSER); // Process the last command
return true; // Handled
}
|
java
|
public boolean onBack()
{
BasePanel parent = this.getParentScreen();
if (parent == null)
return false;
parent.popHistory(1, false); // Pop command for this screen
String strLastCommand = parent.popHistory(1, false);
if (strLastCommand != null) // I don't back up into the browser history if the user hit the java back button.
{ // If that wasn't the first screen, redo pop and update the browser this time
parent.pushHistory(strLastCommand, false);
strLastCommand = parent.popHistory(1, true);
}
if ((strLastCommand == null) || (strLastCommand.length() == 0))
{
if (parent.getParentScreen() != null)
if (!(parent.getParentScreen() instanceof FrameScreen))
return parent.onBack();
// ++Add++ No more to pop, display home screen (if push-down gets messed up)
parent.pushHistory(this.getScreenURL(), false); // This is the first screen in the stack
}
else
this.handleCommand(strLastCommand, this, ScreenConstants.USE_SAME_WINDOW | ScreenConstants.DONT_PUSH_TO_BROWSER); // Process the last command
return true; // Handled
}
|
[
"public",
"boolean",
"onBack",
"(",
")",
"{",
"BasePanel",
"parent",
"=",
"this",
".",
"getParentScreen",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"return",
"false",
";",
"parent",
".",
"popHistory",
"(",
"1",
",",
"false",
")",
";",
"// Pop command for this screen",
"String",
"strLastCommand",
"=",
"parent",
".",
"popHistory",
"(",
"1",
",",
"false",
")",
";",
"if",
"(",
"strLastCommand",
"!=",
"null",
")",
"// I don't back up into the browser history if the user hit the java back button.",
"{",
"// If that wasn't the first screen, redo pop and update the browser this time",
"parent",
".",
"pushHistory",
"(",
"strLastCommand",
",",
"false",
")",
";",
"strLastCommand",
"=",
"parent",
".",
"popHistory",
"(",
"1",
",",
"true",
")",
";",
"}",
"if",
"(",
"(",
"strLastCommand",
"==",
"null",
")",
"||",
"(",
"strLastCommand",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"if",
"(",
"parent",
".",
"getParentScreen",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"!",
"(",
"parent",
".",
"getParentScreen",
"(",
")",
"instanceof",
"FrameScreen",
")",
")",
"return",
"parent",
".",
"onBack",
"(",
")",
";",
"// ++Add++ No more to pop, display home screen (if push-down gets messed up)",
"parent",
".",
"pushHistory",
"(",
"this",
".",
"getScreenURL",
"(",
")",
",",
"false",
")",
";",
"// This is the first screen in the stack",
"}",
"else",
"this",
".",
"handleCommand",
"(",
"strLastCommand",
",",
"this",
",",
"ScreenConstants",
".",
"USE_SAME_WINDOW",
"|",
"ScreenConstants",
".",
"DONT_PUSH_TO_BROWSER",
")",
";",
"// Process the last command",
"return",
"true",
";",
"// Handled",
"}"
] |
Process the "Back" toolbar command.
@return true if successful.
|
[
"Process",
"the",
"Back",
"toolbar",
"command",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L968-L991
|
152,122
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.onHome
|
public boolean onHome()
{
if (!(this instanceof BaseScreen))
return false; // This can only be called from the main screen
BasePanel screenParent = this.getParentScreen();
int count = 0;
while (screenParent.popHistory(1, false) != null)
{ // Pop all the history.
count++;
}
count--; // Want to move back to the first one
if (count > 0)
screenParent.popHistory(count, true); // Dump all browser history
String strLastCommand = Utility.addURLParam(null, Params.MENU, Constant.BLANK); //"?menu="; // Blank command = home
this.handleCommand(strLastCommand, this, ScreenConstants.USE_SAME_WINDOW | ScreenConstants.DONT_PUSH_TO_BROWSER); // Process the last command in this window
return true; // Handled
}
|
java
|
public boolean onHome()
{
if (!(this instanceof BaseScreen))
return false; // This can only be called from the main screen
BasePanel screenParent = this.getParentScreen();
int count = 0;
while (screenParent.popHistory(1, false) != null)
{ // Pop all the history.
count++;
}
count--; // Want to move back to the first one
if (count > 0)
screenParent.popHistory(count, true); // Dump all browser history
String strLastCommand = Utility.addURLParam(null, Params.MENU, Constant.BLANK); //"?menu="; // Blank command = home
this.handleCommand(strLastCommand, this, ScreenConstants.USE_SAME_WINDOW | ScreenConstants.DONT_PUSH_TO_BROWSER); // Process the last command in this window
return true; // Handled
}
|
[
"public",
"boolean",
"onHome",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"BaseScreen",
")",
")",
"return",
"false",
";",
"// This can only be called from the main screen",
"BasePanel",
"screenParent",
"=",
"this",
".",
"getParentScreen",
"(",
")",
";",
"int",
"count",
"=",
"0",
";",
"while",
"(",
"screenParent",
".",
"popHistory",
"(",
"1",
",",
"false",
")",
"!=",
"null",
")",
"{",
"// Pop all the history.",
"count",
"++",
";",
"}",
"count",
"--",
";",
"// Want to move back to the first one",
"if",
"(",
"count",
">",
"0",
")",
"screenParent",
".",
"popHistory",
"(",
"count",
",",
"true",
")",
";",
"// Dump all browser history",
"String",
"strLastCommand",
"=",
"Utility",
".",
"addURLParam",
"(",
"null",
",",
"Params",
".",
"MENU",
",",
"Constant",
".",
"BLANK",
")",
";",
"//\"?menu=\"; // Blank command = home",
"this",
".",
"handleCommand",
"(",
"strLastCommand",
",",
"this",
",",
"ScreenConstants",
".",
"USE_SAME_WINDOW",
"|",
"ScreenConstants",
".",
"DONT_PUSH_TO_BROWSER",
")",
";",
"// Process the last command in this window",
"return",
"true",
";",
"// Handled",
"}"
] |
Process the "Home" command.
@return true if successful.
|
[
"Process",
"the",
"Home",
"command",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L1019-L1036
|
152,123
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.removeSField
|
public boolean removeSField(ScreenField sField)
{ // This call is used when a SField is deleted
boolean bFlag = false;
if (m_SFieldList.contains(sField))
{ // This should only be called for Imaged GridScreens (Child windows would be deleted by now if Component)
bFlag = m_SFieldList.removeElement(sField);
if (sField.getScreenFieldView() != null)
if (sField.getScreenFieldView().getControl() != null) // If it isn't being delete x now, do it
sField.free();
}
return bFlag;
}
|
java
|
public boolean removeSField(ScreenField sField)
{ // This call is used when a SField is deleted
boolean bFlag = false;
if (m_SFieldList.contains(sField))
{ // This should only be called for Imaged GridScreens (Child windows would be deleted by now if Component)
bFlag = m_SFieldList.removeElement(sField);
if (sField.getScreenFieldView() != null)
if (sField.getScreenFieldView().getControl() != null) // If it isn't being delete x now, do it
sField.free();
}
return bFlag;
}
|
[
"public",
"boolean",
"removeSField",
"(",
"ScreenField",
"sField",
")",
"{",
"// This call is used when a SField is deleted",
"boolean",
"bFlag",
"=",
"false",
";",
"if",
"(",
"m_SFieldList",
".",
"contains",
"(",
"sField",
")",
")",
"{",
"// This should only be called for Imaged GridScreens (Child windows would be deleted by now if Component)",
"bFlag",
"=",
"m_SFieldList",
".",
"removeElement",
"(",
"sField",
")",
";",
"if",
"(",
"sField",
".",
"getScreenFieldView",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"sField",
".",
"getScreenFieldView",
"(",
")",
".",
"getControl",
"(",
")",
"!=",
"null",
")",
"// If it isn't being delete x now, do it",
"sField",
".",
"free",
"(",
")",
";",
"}",
"return",
"bFlag",
";",
"}"
] |
Remove this screen field from this screen.
@param sField The screen field to add.
@return true if successful (if found).
|
[
"Remove",
"this",
"screen",
"field",
"from",
"this",
"screen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L1156-L1167
|
152,124
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.getSField
|
public ScreenField getSField(int index)
{ // If this screen cant accept a select BaseTable, find the one that can
if ((index-DBConstants.MAIN_FIELD >= m_SFieldList.size()) || (index < Constants.MAIN_FIELD))
return null;
try {
return (ScreenField)m_SFieldList.elementAt(index-Constants.MAIN_FIELD);
} catch (ArrayIndexOutOfBoundsException e) {
}
return null; // Not found
}
|
java
|
public ScreenField getSField(int index)
{ // If this screen cant accept a select BaseTable, find the one that can
if ((index-DBConstants.MAIN_FIELD >= m_SFieldList.size()) || (index < Constants.MAIN_FIELD))
return null;
try {
return (ScreenField)m_SFieldList.elementAt(index-Constants.MAIN_FIELD);
} catch (ArrayIndexOutOfBoundsException e) {
}
return null; // Not found
}
|
[
"public",
"ScreenField",
"getSField",
"(",
"int",
"index",
")",
"{",
"// If this screen cant accept a select BaseTable, find the one that can",
"if",
"(",
"(",
"index",
"-",
"DBConstants",
".",
"MAIN_FIELD",
">=",
"m_SFieldList",
".",
"size",
"(",
")",
")",
"||",
"(",
"index",
"<",
"Constants",
".",
"MAIN_FIELD",
")",
")",
"return",
"null",
";",
"try",
"{",
"return",
"(",
"ScreenField",
")",
"m_SFieldList",
".",
"elementAt",
"(",
"index",
"-",
"Constants",
".",
"MAIN_FIELD",
")",
";",
"}",
"catch",
"(",
"ArrayIndexOutOfBoundsException",
"e",
")",
"{",
"}",
"return",
"null",
";",
"// Not found",
"}"
] |
Get the SField at this index.
@param index location of the screen field.
@return The screen field at this location.
|
[
"Get",
"the",
"SField",
"at",
"this",
"index",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L1181-L1190
|
152,125
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.selectField
|
public void selectField(ScreenField sfCurrent, int iSelectField)
{
ScreenField sField = this.getComponentAfter(sfCurrent, iSelectField);
if (sField != null)
sField.requestFocus();
}
|
java
|
public void selectField(ScreenField sfCurrent, int iSelectField)
{
ScreenField sField = this.getComponentAfter(sfCurrent, iSelectField);
if (sField != null)
sField.requestFocus();
}
|
[
"public",
"void",
"selectField",
"(",
"ScreenField",
"sfCurrent",
",",
"int",
"iSelectField",
")",
"{",
"ScreenField",
"sField",
"=",
"this",
".",
"getComponentAfter",
"(",
"sfCurrent",
",",
"iSelectField",
")",
";",
"if",
"(",
"sField",
"!=",
"null",
")",
"sField",
".",
"requestFocus",
"(",
")",
";",
"}"
] |
Move the focus to the next logical field.
@param sfCurrent The currently selected screen field.
@param iSelectField The screen field to select (next/prev/first/last).
|
[
"Move",
"the",
"focus",
"to",
"the",
"next",
"logical",
"field",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L1219-L1224
|
152,126
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.getComponentAfter
|
public ScreenField getComponentAfter(ScreenField sfCurrent, int iSelectField)
{
ScreenField m_ChildFocused = (ScreenField)sfCurrent;
if (m_ChildFocused == null)
iSelectField = DBConstants.SELECT_FIRST_FIELD;
ScreenField sField = null;
ScreenField sPrevScreenField = null;
ScreenField sNextScreenField = null;
ScreenField sTargetScreenField = null;
ScreenField sLastFocusTarget = null;
ScreenField sFirstFocusTarget = null;
// Now survey the control to see which one is next
for (int iSField = 0; iSField < this.getSFieldCount(); iSField++)
{ // This should only be called for Imaged GridScreens (Child windows would be deleted by now if Component)
sField = this.getSField(iSField);
if (sField.isEnabled()) if (sField.isFocusTarget())
{
if (sFirstFocusTarget == null)
sFirstFocusTarget = sField;
sLastFocusTarget = sField;
if (sTargetScreenField != null) if (sNextScreenField == null)
sNextScreenField = sField;
if (sField == m_ChildFocused)
sTargetScreenField = sField;
if (sTargetScreenField == null)
sPrevScreenField = sField;
if (sPrevScreenField != null) if (sTargetScreenField != null) if (sNextScreenField != null)
break; // All targets found
}
if (sField == m_ChildFocused)
sTargetScreenField = sField; // In case focus on a control that doesn't accept focus
}
if (sPrevScreenField == null)
sPrevScreenField = sLastFocusTarget; // Last field
if (sNextScreenField == null)
sNextScreenField = sFirstFocusTarget; // First field
if (iSelectField == DBConstants.SELECT_PREV_FIELD)
sNextScreenField = sPrevScreenField; // Tab backwards
if (iSelectField == DBConstants.SELECT_FIRST_FIELD)
sNextScreenField = sFirstFocusTarget; // First field
sField = sNextScreenField;
return sField;
}
|
java
|
public ScreenField getComponentAfter(ScreenField sfCurrent, int iSelectField)
{
ScreenField m_ChildFocused = (ScreenField)sfCurrent;
if (m_ChildFocused == null)
iSelectField = DBConstants.SELECT_FIRST_FIELD;
ScreenField sField = null;
ScreenField sPrevScreenField = null;
ScreenField sNextScreenField = null;
ScreenField sTargetScreenField = null;
ScreenField sLastFocusTarget = null;
ScreenField sFirstFocusTarget = null;
// Now survey the control to see which one is next
for (int iSField = 0; iSField < this.getSFieldCount(); iSField++)
{ // This should only be called for Imaged GridScreens (Child windows would be deleted by now if Component)
sField = this.getSField(iSField);
if (sField.isEnabled()) if (sField.isFocusTarget())
{
if (sFirstFocusTarget == null)
sFirstFocusTarget = sField;
sLastFocusTarget = sField;
if (sTargetScreenField != null) if (sNextScreenField == null)
sNextScreenField = sField;
if (sField == m_ChildFocused)
sTargetScreenField = sField;
if (sTargetScreenField == null)
sPrevScreenField = sField;
if (sPrevScreenField != null) if (sTargetScreenField != null) if (sNextScreenField != null)
break; // All targets found
}
if (sField == m_ChildFocused)
sTargetScreenField = sField; // In case focus on a control that doesn't accept focus
}
if (sPrevScreenField == null)
sPrevScreenField = sLastFocusTarget; // Last field
if (sNextScreenField == null)
sNextScreenField = sFirstFocusTarget; // First field
if (iSelectField == DBConstants.SELECT_PREV_FIELD)
sNextScreenField = sPrevScreenField; // Tab backwards
if (iSelectField == DBConstants.SELECT_FIRST_FIELD)
sNextScreenField = sFirstFocusTarget; // First field
sField = sNextScreenField;
return sField;
}
|
[
"public",
"ScreenField",
"getComponentAfter",
"(",
"ScreenField",
"sfCurrent",
",",
"int",
"iSelectField",
")",
"{",
"ScreenField",
"m_ChildFocused",
"=",
"(",
"ScreenField",
")",
"sfCurrent",
";",
"if",
"(",
"m_ChildFocused",
"==",
"null",
")",
"iSelectField",
"=",
"DBConstants",
".",
"SELECT_FIRST_FIELD",
";",
"ScreenField",
"sField",
"=",
"null",
";",
"ScreenField",
"sPrevScreenField",
"=",
"null",
";",
"ScreenField",
"sNextScreenField",
"=",
"null",
";",
"ScreenField",
"sTargetScreenField",
"=",
"null",
";",
"ScreenField",
"sLastFocusTarget",
"=",
"null",
";",
"ScreenField",
"sFirstFocusTarget",
"=",
"null",
";",
"// Now survey the control to see which one is next",
"for",
"(",
"int",
"iSField",
"=",
"0",
";",
"iSField",
"<",
"this",
".",
"getSFieldCount",
"(",
")",
";",
"iSField",
"++",
")",
"{",
"// This should only be called for Imaged GridScreens (Child windows would be deleted by now if Component)",
"sField",
"=",
"this",
".",
"getSField",
"(",
"iSField",
")",
";",
"if",
"(",
"sField",
".",
"isEnabled",
"(",
")",
")",
"if",
"(",
"sField",
".",
"isFocusTarget",
"(",
")",
")",
"{",
"if",
"(",
"sFirstFocusTarget",
"==",
"null",
")",
"sFirstFocusTarget",
"=",
"sField",
";",
"sLastFocusTarget",
"=",
"sField",
";",
"if",
"(",
"sTargetScreenField",
"!=",
"null",
")",
"if",
"(",
"sNextScreenField",
"==",
"null",
")",
"sNextScreenField",
"=",
"sField",
";",
"if",
"(",
"sField",
"==",
"m_ChildFocused",
")",
"sTargetScreenField",
"=",
"sField",
";",
"if",
"(",
"sTargetScreenField",
"==",
"null",
")",
"sPrevScreenField",
"=",
"sField",
";",
"if",
"(",
"sPrevScreenField",
"!=",
"null",
")",
"if",
"(",
"sTargetScreenField",
"!=",
"null",
")",
"if",
"(",
"sNextScreenField",
"!=",
"null",
")",
"break",
";",
"// All targets found",
"}",
"if",
"(",
"sField",
"==",
"m_ChildFocused",
")",
"sTargetScreenField",
"=",
"sField",
";",
"// In case focus on a control that doesn't accept focus",
"}",
"if",
"(",
"sPrevScreenField",
"==",
"null",
")",
"sPrevScreenField",
"=",
"sLastFocusTarget",
";",
"// Last field",
"if",
"(",
"sNextScreenField",
"==",
"null",
")",
"sNextScreenField",
"=",
"sFirstFocusTarget",
";",
"// First field",
"if",
"(",
"iSelectField",
"==",
"DBConstants",
".",
"SELECT_PREV_FIELD",
")",
"sNextScreenField",
"=",
"sPrevScreenField",
";",
"// Tab backwards",
"if",
"(",
"iSelectField",
"==",
"DBConstants",
".",
"SELECT_FIRST_FIELD",
")",
"sNextScreenField",
"=",
"sFirstFocusTarget",
";",
"// First field",
"sField",
"=",
"sNextScreenField",
";",
"return",
"sField",
";",
"}"
] |
Returns the Component that should receive the focus after aComponent.
@param sfCurrent Currently focused control.
@param iSelectField Type of field to select next (first, next, prev, last).
@return Control to select next.
|
[
"Returns",
"the",
"Component",
"that",
"should",
"receive",
"the",
"focus",
"after",
"aComponent",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L1231-L1273
|
152,127
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
|
BasePanel.setDefaultButton
|
public void setDefaultButton(SBaseButton button)
{
this.getScreenFieldView().setDefaultButton(button == null ? null : button.getScreenFieldView());
}
|
java
|
public void setDefaultButton(SBaseButton button)
{
this.getScreenFieldView().setDefaultButton(button == null ? null : button.getScreenFieldView());
}
|
[
"public",
"void",
"setDefaultButton",
"(",
"SBaseButton",
"button",
")",
"{",
"this",
".",
"getScreenFieldView",
"(",
")",
".",
"setDefaultButton",
"(",
"button",
"==",
"null",
"?",
"null",
":",
"button",
".",
"getScreenFieldView",
"(",
")",
")",
";",
"}"
] |
Set the default button for this basepanel.
@param The button to default to on return.
|
[
"Set",
"the",
"default",
"button",
"for",
"this",
"basepanel",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L1318-L1321
|
152,128
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/RingIterator.java
|
RingIterator.stream
|
public static final <K,V> Stream<Entry<K,V>> stream(K key, NavigableMap<K,V> map, boolean parallel)
{
return StreamSupport.stream(spliterator(key, map), parallel);
}
|
java
|
public static final <K,V> Stream<Entry<K,V>> stream(K key, NavigableMap<K,V> map, boolean parallel)
{
return StreamSupport.stream(spliterator(key, map), parallel);
}
|
[
"public",
"static",
"final",
"<",
"K",
",",
"V",
">",
"Stream",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"stream",
"(",
"K",
"key",
",",
"NavigableMap",
"<",
"K",
",",
"V",
">",
"map",
",",
"boolean",
"parallel",
")",
"{",
"return",
"StreamSupport",
".",
"stream",
"(",
"spliterator",
"(",
"key",
",",
"map",
")",
",",
"parallel",
")",
";",
"}"
] |
Returns a stream that iterates all NavigableMap entries ascending starting from key and
ending entry before key.
@param <K>
@param <V>
@param key
@param map
@param parallel
@return
|
[
"Returns",
"a",
"stream",
"that",
"iterates",
"all",
"NavigableMap",
"entries",
"ascending",
"starting",
"from",
"key",
"and",
"ending",
"entry",
"before",
"key",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/RingIterator.java#L56-L59
|
152,129
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/RingIterator.java
|
RingIterator.spliterator
|
public static final <K,V> Spliterator<Entry<K,V>> spliterator(K key, NavigableMap<K,V> map)
{
return Spliterators.spliterator(new RingIterator(key, map), map.size(), 0);
}
|
java
|
public static final <K,V> Spliterator<Entry<K,V>> spliterator(K key, NavigableMap<K,V> map)
{
return Spliterators.spliterator(new RingIterator(key, map), map.size(), 0);
}
|
[
"public",
"static",
"final",
"<",
"K",
",",
"V",
">",
"Spliterator",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"spliterator",
"(",
"K",
"key",
",",
"NavigableMap",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"return",
"Spliterators",
".",
"spliterator",
"(",
"new",
"RingIterator",
"(",
"key",
",",
"map",
")",
",",
"map",
".",
"size",
"(",
")",
",",
"0",
")",
";",
"}"
] |
Returns a spliterator that iterates all NavigableMap entries ascending starting from key and
ending entry before key.
@param <K>
@param <V>
@param key
@param map
@return
|
[
"Returns",
"a",
"spliterator",
"that",
"iterates",
"all",
"NavigableMap",
"entries",
"ascending",
"starting",
"from",
"key",
"and",
"ending",
"entry",
"before",
"key",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/RingIterator.java#L69-L72
|
152,130
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/CharSequences.java
|
CharSequences.compare
|
public static int compare(CharSequence s1, CharSequence s2)
{
return compare(s1, s2, Funcs::same);
}
|
java
|
public static int compare(CharSequence s1, CharSequence s2)
{
return compare(s1, s2, Funcs::same);
}
|
[
"public",
"static",
"int",
"compare",
"(",
"CharSequence",
"s1",
",",
"CharSequence",
"s2",
")",
"{",
"return",
"compare",
"(",
"s1",
",",
"s2",
",",
"Funcs",
"::",
"same",
")",
";",
"}"
] |
Compares two CharSequences
@param s1
@param s2
@return
|
[
"Compares",
"two",
"CharSequences"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L48-L51
|
152,131
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/CharSequences.java
|
CharSequences.compare
|
public static int compare(CharSequence s1, CharSequence s2, IntUnaryOperator op)
{
return Streams.compare(s1.codePoints().map(op), s2.codePoints().map(op));
}
|
java
|
public static int compare(CharSequence s1, CharSequence s2, IntUnaryOperator op)
{
return Streams.compare(s1.codePoints().map(op), s2.codePoints().map(op));
}
|
[
"public",
"static",
"int",
"compare",
"(",
"CharSequence",
"s1",
",",
"CharSequence",
"s2",
",",
"IntUnaryOperator",
"op",
")",
"{",
"return",
"Streams",
".",
"compare",
"(",
"s1",
".",
"codePoints",
"(",
")",
".",
"map",
"(",
"op",
")",
",",
"s2",
".",
"codePoints",
"(",
")",
".",
"map",
"(",
"op",
")",
")",
";",
"}"
] |
Compares two CharSequences with codepoint mapping
@param s1
@param s2
@param op Codepoint mapping before comparison.
@return
|
[
"Compares",
"two",
"CharSequences",
"with",
"codepoint",
"mapping"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L59-L62
|
152,132
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/CharSequences.java
|
CharSequences.startsWith
|
public static boolean startsWith(CharSequence seq, CharSequence pattern)
{
return startsWith(seq, pattern, Funcs::same);
}
|
java
|
public static boolean startsWith(CharSequence seq, CharSequence pattern)
{
return startsWith(seq, pattern, Funcs::same);
}
|
[
"public",
"static",
"boolean",
"startsWith",
"(",
"CharSequence",
"seq",
",",
"CharSequence",
"pattern",
")",
"{",
"return",
"startsWith",
"(",
"seq",
",",
"pattern",
",",
"Funcs",
"::",
"same",
")",
";",
"}"
] |
Return true if seq start match pattern exactly.
@param seq
@param pattern
@return
|
[
"Return",
"true",
"if",
"seq",
"start",
"match",
"pattern",
"exactly",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L69-L72
|
152,133
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/CharSequences.java
|
CharSequences.startsWith
|
public static boolean startsWith(CharSequence seq, CharSequence pattern, IntUnaryOperator op)
{
if (pattern.length() > seq.length())
{
return false;
}
int length = pattern.length();
for (int ii=0;ii<length;ii++)
{
if (op.applyAsInt(seq.charAt(ii)) != op.applyAsInt(pattern.charAt(ii)))
{
return false;
}
}
return true;
}
|
java
|
public static boolean startsWith(CharSequence seq, CharSequence pattern, IntUnaryOperator op)
{
if (pattern.length() > seq.length())
{
return false;
}
int length = pattern.length();
for (int ii=0;ii<length;ii++)
{
if (op.applyAsInt(seq.charAt(ii)) != op.applyAsInt(pattern.charAt(ii)))
{
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"startsWith",
"(",
"CharSequence",
"seq",
",",
"CharSequence",
"pattern",
",",
"IntUnaryOperator",
"op",
")",
"{",
"if",
"(",
"pattern",
".",
"length",
"(",
")",
">",
"seq",
".",
"length",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"int",
"length",
"=",
"pattern",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"length",
";",
"ii",
"++",
")",
"{",
"if",
"(",
"op",
".",
"applyAsInt",
"(",
"seq",
".",
"charAt",
"(",
"ii",
")",
")",
"!=",
"op",
".",
"applyAsInt",
"(",
"pattern",
".",
"charAt",
"(",
"ii",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Return true if seq start match pattern after both characters have been converted
with op.
@param seq
@param pattern
@param op
@return
|
[
"Return",
"true",
"if",
"seq",
"start",
"match",
"pattern",
"after",
"both",
"characters",
"have",
"been",
"converted",
"with",
"op",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L81-L96
|
152,134
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/CharSequences.java
|
CharSequences.endsWith
|
public static boolean endsWith(CharSequence seq, CharSequence pattern)
{
return endsWith(seq, pattern, Funcs::same);
}
|
java
|
public static boolean endsWith(CharSequence seq, CharSequence pattern)
{
return endsWith(seq, pattern, Funcs::same);
}
|
[
"public",
"static",
"boolean",
"endsWith",
"(",
"CharSequence",
"seq",
",",
"CharSequence",
"pattern",
")",
"{",
"return",
"endsWith",
"(",
"seq",
",",
"pattern",
",",
"Funcs",
"::",
"same",
")",
";",
"}"
] |
Return true if seq end match pattern exactly.
@param seq
@param pattern
@return
|
[
"Return",
"true",
"if",
"seq",
"end",
"match",
"pattern",
"exactly",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L103-L106
|
152,135
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/CharSequences.java
|
CharSequences.endsWith
|
public static boolean endsWith(CharSequence seq, CharSequence pattern, IntUnaryOperator op)
{
if (pattern.length() > seq.length())
{
return false;
}
int ls = seq.length();
int lp = pattern.length();
for (int ii=1;ii<=lp;ii++)
{
if (op.applyAsInt(seq.charAt(ls-ii)) != op.applyAsInt(pattern.charAt(lp-ii)))
{
return false;
}
}
return true;
}
|
java
|
public static boolean endsWith(CharSequence seq, CharSequence pattern, IntUnaryOperator op)
{
if (pattern.length() > seq.length())
{
return false;
}
int ls = seq.length();
int lp = pattern.length();
for (int ii=1;ii<=lp;ii++)
{
if (op.applyAsInt(seq.charAt(ls-ii)) != op.applyAsInt(pattern.charAt(lp-ii)))
{
return false;
}
}
return true;
}
|
[
"public",
"static",
"boolean",
"endsWith",
"(",
"CharSequence",
"seq",
",",
"CharSequence",
"pattern",
",",
"IntUnaryOperator",
"op",
")",
"{",
"if",
"(",
"pattern",
".",
"length",
"(",
")",
">",
"seq",
".",
"length",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"int",
"ls",
"=",
"seq",
".",
"length",
"(",
")",
";",
"int",
"lp",
"=",
"pattern",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"1",
";",
"ii",
"<=",
"lp",
";",
"ii",
"++",
")",
"{",
"if",
"(",
"op",
".",
"applyAsInt",
"(",
"seq",
".",
"charAt",
"(",
"ls",
"-",
"ii",
")",
")",
"!=",
"op",
".",
"applyAsInt",
"(",
"pattern",
".",
"charAt",
"(",
"lp",
"-",
"ii",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Return true if seq end match pattern after both characters have been converted
@param seq
@param pattern
@param op
@return
|
[
"Return",
"true",
"if",
"seq",
"end",
"match",
"pattern",
"after",
"both",
"characters",
"have",
"been",
"converted"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L114-L130
|
152,136
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/CharSequences.java
|
CharSequences.indexOf
|
public static int indexOf(CharSequence seq, CharSequence pattern, int fromIndex)
{
return indexOf(seq, pattern, (int a, int b)->{return a==b;}, fromIndex);
}
|
java
|
public static int indexOf(CharSequence seq, CharSequence pattern, int fromIndex)
{
return indexOf(seq, pattern, (int a, int b)->{return a==b;}, fromIndex);
}
|
[
"public",
"static",
"int",
"indexOf",
"(",
"CharSequence",
"seq",
",",
"CharSequence",
"pattern",
",",
"int",
"fromIndex",
")",
"{",
"return",
"indexOf",
"(",
"seq",
",",
"pattern",
",",
"(",
"int",
"a",
",",
"int",
"b",
")",
"->",
"{",
"return",
"a",
"==",
"b",
";",
"}",
",",
"fromIndex",
")",
";",
"}"
] |
Returns index of pattern, starting at fromIndex, or -1 if pattern not found
@param seq
@param pattern
@param fromIndex
@return
@see java.lang.String#indexOf(java.lang.String, int)
|
[
"Returns",
"index",
"of",
"pattern",
"starting",
"at",
"fromIndex",
"or",
"-",
"1",
"if",
"pattern",
"not",
"found"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L221-L224
|
152,137
|
js-lib-com/commons
|
src/main/java/js/converter/DatesConverter.java
|
DatesConverter.asString
|
@Override
public String asString(Object object) {
// at this point object is a Date
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
calendar.setTime((Date) object);
StringBuilder builder = new StringBuilder();
int year = calendar.get(Calendar.YEAR);
if (calendar.get(Calendar.ERA) == 0) {
// https://en.wikipedia.org/wiki/ISO_8601
// by convention 1 BC is labeled +0000, 2 BC is labeled −0001, ...
if (year > 1) {
builder.append('-');
}
--year;
}
builder.append(String.format("%04d", year));
builder.append('-');
builder.append(String.format("%02d", calendar.get(Calendar.MONTH) + 1));
builder.append('-');
builder.append(String.format("%02d", calendar.get(Calendar.DATE)));
builder.append('T');
builder.append(String.format("%02d", calendar.get(Calendar.HOUR_OF_DAY)));
builder.append(':');
builder.append(String.format("%02d", calendar.get(Calendar.MINUTE)));
builder.append(':');
builder.append(String.format("%02d", calendar.get(Calendar.SECOND)));
builder.append('Z');
return builder.toString();
}
|
java
|
@Override
public String asString(Object object) {
// at this point object is a Date
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
calendar.setTime((Date) object);
StringBuilder builder = new StringBuilder();
int year = calendar.get(Calendar.YEAR);
if (calendar.get(Calendar.ERA) == 0) {
// https://en.wikipedia.org/wiki/ISO_8601
// by convention 1 BC is labeled +0000, 2 BC is labeled −0001, ...
if (year > 1) {
builder.append('-');
}
--year;
}
builder.append(String.format("%04d", year));
builder.append('-');
builder.append(String.format("%02d", calendar.get(Calendar.MONTH) + 1));
builder.append('-');
builder.append(String.format("%02d", calendar.get(Calendar.DATE)));
builder.append('T');
builder.append(String.format("%02d", calendar.get(Calendar.HOUR_OF_DAY)));
builder.append(':');
builder.append(String.format("%02d", calendar.get(Calendar.MINUTE)));
builder.append(':');
builder.append(String.format("%02d", calendar.get(Calendar.SECOND)));
builder.append('Z');
return builder.toString();
}
|
[
"@",
"Override",
"public",
"String",
"asString",
"(",
"Object",
"object",
")",
"{",
"// at this point object is a Date\r",
"Calendar",
"calendar",
"=",
"Calendar",
".",
"getInstance",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"GMT\"",
")",
")",
";",
"calendar",
".",
"setTime",
"(",
"(",
"Date",
")",
"object",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"year",
"=",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"YEAR",
")",
";",
"if",
"(",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"ERA",
")",
"==",
"0",
")",
"{",
"// https://en.wikipedia.org/wiki/ISO_8601\r",
"// by convention 1 BC is labeled +0000, 2 BC is labeled −0001, ...\r",
"if",
"(",
"year",
">",
"1",
")",
"{",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"--",
"year",
";",
"}",
"builder",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"%04d\"",
",",
"year",
")",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"builder",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"%02d\"",
",",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"MONTH",
")",
"+",
"1",
")",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"builder",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"%02d\"",
",",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"DATE",
")",
")",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"builder",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"%02d\"",
",",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",
")",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"builder",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"%02d\"",
",",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"MINUTE",
")",
")",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"builder",
".",
"append",
"(",
"String",
".",
"format",
"(",
"\"%02d\"",
",",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"SECOND",
")",
")",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] |
Return ISO8601 string representation for given date instance.
|
[
"Return",
"ISO8601",
"string",
"representation",
"for",
"given",
"date",
"instance",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/DatesConverter.java#L95-L129
|
152,138
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/ConvertUtility.java
|
ConvertUtility.convertPrimitive
|
public static Object convertPrimitive(Object object)
{
if (object == null)
{
return object;
}
Class<?> clazz = object.getClass();
if (clazz.isPrimitive())
{
if (boolean.class.equals(clazz))
{
Boolean b = (Boolean) object;
return b;
}
if (byte.class.equals(clazz))
{
Byte b = (Byte) object;
return b;
}
if (char.class.equals(clazz))
{
Character c = (Character) object;
return c;
}
if (short.class.equals(clazz))
{
Short s = (Short) object;
return s;
}
if (int.class.equals(clazz))
{
Integer i = (Integer) object;
return i;
}
if (long.class.equals(clazz))
{
Long l = (Long) object;
return l;
}
if (float.class.equals(clazz))
{
Float f = (Float) object;
return f;
}
if (double.class.equals(clazz))
{
Double d = (Double) object;
return d;
}
throw new IllegalArgumentException("Unknown primitive type'" + clazz);
}
return object;
}
|
java
|
public static Object convertPrimitive(Object object)
{
if (object == null)
{
return object;
}
Class<?> clazz = object.getClass();
if (clazz.isPrimitive())
{
if (boolean.class.equals(clazz))
{
Boolean b = (Boolean) object;
return b;
}
if (byte.class.equals(clazz))
{
Byte b = (Byte) object;
return b;
}
if (char.class.equals(clazz))
{
Character c = (Character) object;
return c;
}
if (short.class.equals(clazz))
{
Short s = (Short) object;
return s;
}
if (int.class.equals(clazz))
{
Integer i = (Integer) object;
return i;
}
if (long.class.equals(clazz))
{
Long l = (Long) object;
return l;
}
if (float.class.equals(clazz))
{
Float f = (Float) object;
return f;
}
if (double.class.equals(clazz))
{
Double d = (Double) object;
return d;
}
throw new IllegalArgumentException("Unknown primitive type'" + clazz);
}
return object;
}
|
[
"public",
"static",
"Object",
"convertPrimitive",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"object",
";",
"}",
"Class",
"<",
"?",
">",
"clazz",
"=",
"object",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"clazz",
".",
"isPrimitive",
"(",
")",
")",
"{",
"if",
"(",
"boolean",
".",
"class",
".",
"equals",
"(",
"clazz",
")",
")",
"{",
"Boolean",
"b",
"=",
"(",
"Boolean",
")",
"object",
";",
"return",
"b",
";",
"}",
"if",
"(",
"byte",
".",
"class",
".",
"equals",
"(",
"clazz",
")",
")",
"{",
"Byte",
"b",
"=",
"(",
"Byte",
")",
"object",
";",
"return",
"b",
";",
"}",
"if",
"(",
"char",
".",
"class",
".",
"equals",
"(",
"clazz",
")",
")",
"{",
"Character",
"c",
"=",
"(",
"Character",
")",
"object",
";",
"return",
"c",
";",
"}",
"if",
"(",
"short",
".",
"class",
".",
"equals",
"(",
"clazz",
")",
")",
"{",
"Short",
"s",
"=",
"(",
"Short",
")",
"object",
";",
"return",
"s",
";",
"}",
"if",
"(",
"int",
".",
"class",
".",
"equals",
"(",
"clazz",
")",
")",
"{",
"Integer",
"i",
"=",
"(",
"Integer",
")",
"object",
";",
"return",
"i",
";",
"}",
"if",
"(",
"long",
".",
"class",
".",
"equals",
"(",
"clazz",
")",
")",
"{",
"Long",
"l",
"=",
"(",
"Long",
")",
"object",
";",
"return",
"l",
";",
"}",
"if",
"(",
"float",
".",
"class",
".",
"equals",
"(",
"clazz",
")",
")",
"{",
"Float",
"f",
"=",
"(",
"Float",
")",
"object",
";",
"return",
"f",
";",
"}",
"if",
"(",
"double",
".",
"class",
".",
"equals",
"(",
"clazz",
")",
")",
"{",
"Double",
"d",
"=",
"(",
"Double",
")",
"object",
";",
"return",
"d",
";",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unknown primitive type'\"",
"+",
"clazz",
")",
";",
"}",
"return",
"object",
";",
"}"
] |
Convert a primitive object to its Class object
@param object
@return
|
[
"Convert",
"a",
"primitive",
"object",
"to",
"its",
"Class",
"object"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/ConvertUtility.java#L49-L101
|
152,139
|
jbundle/jbundle
|
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/serial/SDatabase.java
|
SDatabase.flushPTable
|
public void flushPTable(PTable pTable)
{
if (pTable.getLookupKey() instanceof String)
{
try {
String strFilePath = (String)pTable.getLookupKey();
String strFilename = this.getFilename(strFilePath, true);
FileOutputStream ostream = new FileOutputStream(strFilename);
ObjectOutputStream p = new ObjectOutputStream(ostream);
p.writeObject(pTable); // Write the tree to the stream.
p.flush();
p.close();
ostream.close(); // close the file.
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
|
java
|
public void flushPTable(PTable pTable)
{
if (pTable.getLookupKey() instanceof String)
{
try {
String strFilePath = (String)pTable.getLookupKey();
String strFilename = this.getFilename(strFilePath, true);
FileOutputStream ostream = new FileOutputStream(strFilename);
ObjectOutputStream p = new ObjectOutputStream(ostream);
p.writeObject(pTable); // Write the tree to the stream.
p.flush();
p.close();
ostream.close(); // close the file.
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
|
[
"public",
"void",
"flushPTable",
"(",
"PTable",
"pTable",
")",
"{",
"if",
"(",
"pTable",
".",
"getLookupKey",
"(",
")",
"instanceof",
"String",
")",
"{",
"try",
"{",
"String",
"strFilePath",
"=",
"(",
"String",
")",
"pTable",
".",
"getLookupKey",
"(",
")",
";",
"String",
"strFilename",
"=",
"this",
".",
"getFilename",
"(",
"strFilePath",
",",
"true",
")",
";",
"FileOutputStream",
"ostream",
"=",
"new",
"FileOutputStream",
"(",
"strFilename",
")",
";",
"ObjectOutputStream",
"p",
"=",
"new",
"ObjectOutputStream",
"(",
"ostream",
")",
";",
"p",
".",
"writeObject",
"(",
"pTable",
")",
";",
"// Write the tree to the stream.",
"p",
".",
"flush",
"(",
")",
";",
"p",
".",
"close",
"(",
")",
";",
"ostream",
".",
"close",
"(",
")",
";",
"// close the file.",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}"
] |
Write the serial table to the file.
@param pTable the raw data table.
|
[
"Write",
"the",
"serial",
"table",
"to",
"the",
"file",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/serial/SDatabase.java#L122-L140
|
152,140
|
jbundle/jbundle
|
main/db/src/main/java/org/jbundle/main/user/db/UserInfo.java
|
UserInfo.addPropertyListeners
|
public void addPropertyListeners()
{
BaseField fldProperties = this.getField(PropertiesRecord.PROPERTIES);
if (fldProperties.getListener(CopyConvertersHandler.class) != null)
return;
this.addPropertiesFieldBehavior(this.getField(UserInfo.FRAMES), DBParams.FRAMES);
this.addPropertiesFieldBehavior(this.getField(UserInfo.JAVA), DBParams.JAVA);
this.addPropertiesFieldBehavior(this.getField(UserInfo.HOME), DBParams.HOME);
this.addPropertiesFieldBehavior(this.getField(UserInfo.MENU), DBParams.MENU);
this.addPropertiesFieldBehavior(this.getField(UserInfo.BANNERS), DBParams.BANNERS);
this.addPropertiesFieldBehavior(this.getField(UserInfo.TRAILERS), DBParams.TRAILERS);
this.addPropertiesFieldBehavior(this.getField(UserInfo.MENUBARS), DBParams.MENUBARS);
this.addPropertiesFieldBehavior(this.getField(UserInfo.LOGOS), DBParams.LOGOS);
this.addPropertiesFieldBehavior(this.getField(UserInfo.NAV_MENUS), DBParams.NAVMENUS);
this.addPropertiesFieldBehavior(this.getField(UserInfo.MENU_DESC), DBParams.MENUDESC);
this.addPropertiesFieldBehavior(this.getField(UserInfo.HELP_PAGE), MenuConstants.USER_HELP_DISPLAY);
this.addPropertiesFieldBehavior(this.getField(UserInfo.LANGUAGE), DBParams.LANGUAGE);
Record recContactType = ((ReferenceField)this.getField(UserInfo.CONTACT_TYPE_ID)).getReferenceRecord();
this.getField(UserInfo.CONTACT_TYPE_ID).addListener(new ReadSecondaryHandler(recContactType));
BaseField fldContactTypeCode = recContactType.getField(ContactType.CODE);
CopyConvertersHandler listener = new CopyConvertersHandler(new PropertiesConverter(fldProperties, DBParams.CONTACT_TYPE), fldContactTypeCode);
this.getField(UserInfo.CONTACT_TYPE_ID).addListener(listener);
listener.setRespondsToMode(DBConstants.INIT_MOVE, false);
listener.setRespondsToMode(DBConstants.READ_MOVE, false);
this.addPropertiesFieldBehavior(this.getField(UserInfo.CONTACT_TYPE_ID), DBParams.CONTACT_TYPE + DBParams.ID);
this.addPropertiesFieldBehavior(this.getField(UserInfo.CONTACT_ID), DBParams.CONTACT_ID);
}
|
java
|
public void addPropertyListeners()
{
BaseField fldProperties = this.getField(PropertiesRecord.PROPERTIES);
if (fldProperties.getListener(CopyConvertersHandler.class) != null)
return;
this.addPropertiesFieldBehavior(this.getField(UserInfo.FRAMES), DBParams.FRAMES);
this.addPropertiesFieldBehavior(this.getField(UserInfo.JAVA), DBParams.JAVA);
this.addPropertiesFieldBehavior(this.getField(UserInfo.HOME), DBParams.HOME);
this.addPropertiesFieldBehavior(this.getField(UserInfo.MENU), DBParams.MENU);
this.addPropertiesFieldBehavior(this.getField(UserInfo.BANNERS), DBParams.BANNERS);
this.addPropertiesFieldBehavior(this.getField(UserInfo.TRAILERS), DBParams.TRAILERS);
this.addPropertiesFieldBehavior(this.getField(UserInfo.MENUBARS), DBParams.MENUBARS);
this.addPropertiesFieldBehavior(this.getField(UserInfo.LOGOS), DBParams.LOGOS);
this.addPropertiesFieldBehavior(this.getField(UserInfo.NAV_MENUS), DBParams.NAVMENUS);
this.addPropertiesFieldBehavior(this.getField(UserInfo.MENU_DESC), DBParams.MENUDESC);
this.addPropertiesFieldBehavior(this.getField(UserInfo.HELP_PAGE), MenuConstants.USER_HELP_DISPLAY);
this.addPropertiesFieldBehavior(this.getField(UserInfo.LANGUAGE), DBParams.LANGUAGE);
Record recContactType = ((ReferenceField)this.getField(UserInfo.CONTACT_TYPE_ID)).getReferenceRecord();
this.getField(UserInfo.CONTACT_TYPE_ID).addListener(new ReadSecondaryHandler(recContactType));
BaseField fldContactTypeCode = recContactType.getField(ContactType.CODE);
CopyConvertersHandler listener = new CopyConvertersHandler(new PropertiesConverter(fldProperties, DBParams.CONTACT_TYPE), fldContactTypeCode);
this.getField(UserInfo.CONTACT_TYPE_ID).addListener(listener);
listener.setRespondsToMode(DBConstants.INIT_MOVE, false);
listener.setRespondsToMode(DBConstants.READ_MOVE, false);
this.addPropertiesFieldBehavior(this.getField(UserInfo.CONTACT_TYPE_ID), DBParams.CONTACT_TYPE + DBParams.ID);
this.addPropertiesFieldBehavior(this.getField(UserInfo.CONTACT_ID), DBParams.CONTACT_ID);
}
|
[
"public",
"void",
"addPropertyListeners",
"(",
")",
"{",
"BaseField",
"fldProperties",
"=",
"this",
".",
"getField",
"(",
"PropertiesRecord",
".",
"PROPERTIES",
")",
";",
"if",
"(",
"fldProperties",
".",
"getListener",
"(",
"CopyConvertersHandler",
".",
"class",
")",
"!=",
"null",
")",
"return",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"FRAMES",
")",
",",
"DBParams",
".",
"FRAMES",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"JAVA",
")",
",",
"DBParams",
".",
"JAVA",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"HOME",
")",
",",
"DBParams",
".",
"HOME",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"MENU",
")",
",",
"DBParams",
".",
"MENU",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"BANNERS",
")",
",",
"DBParams",
".",
"BANNERS",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"TRAILERS",
")",
",",
"DBParams",
".",
"TRAILERS",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"MENUBARS",
")",
",",
"DBParams",
".",
"MENUBARS",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"LOGOS",
")",
",",
"DBParams",
".",
"LOGOS",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"NAV_MENUS",
")",
",",
"DBParams",
".",
"NAVMENUS",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"MENU_DESC",
")",
",",
"DBParams",
".",
"MENUDESC",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"HELP_PAGE",
")",
",",
"MenuConstants",
".",
"USER_HELP_DISPLAY",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"LANGUAGE",
")",
",",
"DBParams",
".",
"LANGUAGE",
")",
";",
"Record",
"recContactType",
"=",
"(",
"(",
"ReferenceField",
")",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"CONTACT_TYPE_ID",
")",
")",
".",
"getReferenceRecord",
"(",
")",
";",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"CONTACT_TYPE_ID",
")",
".",
"addListener",
"(",
"new",
"ReadSecondaryHandler",
"(",
"recContactType",
")",
")",
";",
"BaseField",
"fldContactTypeCode",
"=",
"recContactType",
".",
"getField",
"(",
"ContactType",
".",
"CODE",
")",
";",
"CopyConvertersHandler",
"listener",
"=",
"new",
"CopyConvertersHandler",
"(",
"new",
"PropertiesConverter",
"(",
"fldProperties",
",",
"DBParams",
".",
"CONTACT_TYPE",
")",
",",
"fldContactTypeCode",
")",
";",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"CONTACT_TYPE_ID",
")",
".",
"addListener",
"(",
"listener",
")",
";",
"listener",
".",
"setRespondsToMode",
"(",
"DBConstants",
".",
"INIT_MOVE",
",",
"false",
")",
";",
"listener",
".",
"setRespondsToMode",
"(",
"DBConstants",
".",
"READ_MOVE",
",",
"false",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"CONTACT_TYPE_ID",
")",
",",
"DBParams",
".",
"CONTACT_TYPE",
"+",
"DBParams",
".",
"ID",
")",
";",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"CONTACT_ID",
")",
",",
"DBParams",
".",
"CONTACT_ID",
")",
";",
"}"
] |
Add The listeners to sync the property field with the virtual fields.
|
[
"Add",
"The",
"listeners",
"to",
"sync",
"the",
"property",
"field",
"with",
"the",
"virtual",
"fields",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/user/db/UserInfo.java#L309-L338
|
152,141
|
jbundle/jbundle
|
main/db/src/main/java/org/jbundle/main/user/db/UserInfo.java
|
UserInfo.getUserInfo
|
public boolean getUserInfo(String strUser, boolean bForceRead)
{
boolean bFound = false;
if ((strUser == null) || (strUser.length() ==0))
return false; // Not found.
int iUserID = -1;
try { // First see if strUser is the UserID in string format
if (Utility.isNumeric(strUser))
if ((strUser != null) && (strUser.length() > 0))
iUserID = Integer.parseInt(strUser);
if (iUserID == 0)
iUserID = -1;
} catch (NumberFormatException ex) {
iUserID = -1;
}
if ((iUserID == -1) && (strUser.length() > 0))
{ // Read using the User name
if (!bForceRead)
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
if (this.getField(UserInfo.USER_NAME).toString().equalsIgnoreCase(strUser))
return true; // Already current
this.getField(UserInfo.USER_NAME).setString(strUser);
this.setKeyArea(UserInfo.USER_NAME_KEY);
try {
bFound = this.seek(null);
} catch (DBException ex) {
ex.printStackTrace();
bFound = false;
}
this.setKeyArea(UserInfo.ID_KEY);
}
if (iUserID != -1)
{ // Valid UserID, read it!
if (!bForceRead)
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
if (this.getField(UserInfo.ID).getValue() == iUserID)
return true; // Already current
this.getField(UserInfo.ID).setValue(iUserID);
try {
this.setKeyArea(UserInfo.ID_KEY);
bFound = this.seek(null);
} catch (DBException ex) {
ex.printStackTrace();
bFound = false;
}
}
return bFound;
}
|
java
|
public boolean getUserInfo(String strUser, boolean bForceRead)
{
boolean bFound = false;
if ((strUser == null) || (strUser.length() ==0))
return false; // Not found.
int iUserID = -1;
try { // First see if strUser is the UserID in string format
if (Utility.isNumeric(strUser))
if ((strUser != null) && (strUser.length() > 0))
iUserID = Integer.parseInt(strUser);
if (iUserID == 0)
iUserID = -1;
} catch (NumberFormatException ex) {
iUserID = -1;
}
if ((iUserID == -1) && (strUser.length() > 0))
{ // Read using the User name
if (!bForceRead)
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
if (this.getField(UserInfo.USER_NAME).toString().equalsIgnoreCase(strUser))
return true; // Already current
this.getField(UserInfo.USER_NAME).setString(strUser);
this.setKeyArea(UserInfo.USER_NAME_KEY);
try {
bFound = this.seek(null);
} catch (DBException ex) {
ex.printStackTrace();
bFound = false;
}
this.setKeyArea(UserInfo.ID_KEY);
}
if (iUserID != -1)
{ // Valid UserID, read it!
if (!bForceRead)
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
if (this.getField(UserInfo.ID).getValue() == iUserID)
return true; // Already current
this.getField(UserInfo.ID).setValue(iUserID);
try {
this.setKeyArea(UserInfo.ID_KEY);
bFound = this.seek(null);
} catch (DBException ex) {
ex.printStackTrace();
bFound = false;
}
}
return bFound;
}
|
[
"public",
"boolean",
"getUserInfo",
"(",
"String",
"strUser",
",",
"boolean",
"bForceRead",
")",
"{",
"boolean",
"bFound",
"=",
"false",
";",
"if",
"(",
"(",
"strUser",
"==",
"null",
")",
"||",
"(",
"strUser",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"return",
"false",
";",
"// Not found.",
"int",
"iUserID",
"=",
"-",
"1",
";",
"try",
"{",
"// First see if strUser is the UserID in string format",
"if",
"(",
"Utility",
".",
"isNumeric",
"(",
"strUser",
")",
")",
"if",
"(",
"(",
"strUser",
"!=",
"null",
")",
"&&",
"(",
"strUser",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"iUserID",
"=",
"Integer",
".",
"parseInt",
"(",
"strUser",
")",
";",
"if",
"(",
"iUserID",
"==",
"0",
")",
"iUserID",
"=",
"-",
"1",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"iUserID",
"=",
"-",
"1",
";",
"}",
"if",
"(",
"(",
"iUserID",
"==",
"-",
"1",
")",
"&&",
"(",
"strUser",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"{",
"// Read using the User name",
"if",
"(",
"!",
"bForceRead",
")",
"if",
"(",
"(",
"this",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_CURRENT",
")",
"||",
"(",
"this",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_IN_PROGRESS",
")",
")",
"if",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"USER_NAME",
")",
".",
"toString",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"strUser",
")",
")",
"return",
"true",
";",
"// Already current",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"USER_NAME",
")",
".",
"setString",
"(",
"strUser",
")",
";",
"this",
".",
"setKeyArea",
"(",
"UserInfo",
".",
"USER_NAME_KEY",
")",
";",
"try",
"{",
"bFound",
"=",
"this",
".",
"seek",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"bFound",
"=",
"false",
";",
"}",
"this",
".",
"setKeyArea",
"(",
"UserInfo",
".",
"ID_KEY",
")",
";",
"}",
"if",
"(",
"iUserID",
"!=",
"-",
"1",
")",
"{",
"// Valid UserID, read it!",
"if",
"(",
"!",
"bForceRead",
")",
"if",
"(",
"(",
"this",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_CURRENT",
")",
"||",
"(",
"this",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_IN_PROGRESS",
")",
")",
"if",
"(",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"ID",
")",
".",
"getValue",
"(",
")",
"==",
"iUserID",
")",
"return",
"true",
";",
"// Already current",
"this",
".",
"getField",
"(",
"UserInfo",
".",
"ID",
")",
".",
"setValue",
"(",
"iUserID",
")",
";",
"try",
"{",
"this",
".",
"setKeyArea",
"(",
"UserInfo",
".",
"ID_KEY",
")",
";",
"bFound",
"=",
"this",
".",
"seek",
"(",
"null",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"bFound",
"=",
"false",
";",
"}",
"}",
"return",
"bFound",
";",
"}"
] |
GetUserInfo Method.
|
[
"GetUserInfo",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/user/db/UserInfo.java#L342-L389
|
152,142
|
jbundle/jbundle
|
main/db/src/main/java/org/jbundle/main/user/db/UserInfo.java
|
UserInfo.validUserProperty
|
public boolean validUserProperty(String strProperty)
{
if (DBParams.FRAMES.equalsIgnoreCase(strProperty))
return true;
if (DBParams.MENUBARS.equalsIgnoreCase(strProperty))
return true;
if (DBParams.NAVMENUS.equalsIgnoreCase(strProperty))
return true;
if (DBParams.JAVA.equalsIgnoreCase(strProperty))
return true;
if (DBParams.BANNERS.equalsIgnoreCase(strProperty))
return true;
if (DBParams.LOGOS.equalsIgnoreCase(strProperty))
return true;
if (DBParams.TRAILERS.equalsIgnoreCase(strProperty))
return true;
if (DBParams.LANGUAGE.equalsIgnoreCase(strProperty))
return true;
return false;
}
|
java
|
public boolean validUserProperty(String strProperty)
{
if (DBParams.FRAMES.equalsIgnoreCase(strProperty))
return true;
if (DBParams.MENUBARS.equalsIgnoreCase(strProperty))
return true;
if (DBParams.NAVMENUS.equalsIgnoreCase(strProperty))
return true;
if (DBParams.JAVA.equalsIgnoreCase(strProperty))
return true;
if (DBParams.BANNERS.equalsIgnoreCase(strProperty))
return true;
if (DBParams.LOGOS.equalsIgnoreCase(strProperty))
return true;
if (DBParams.TRAILERS.equalsIgnoreCase(strProperty))
return true;
if (DBParams.LANGUAGE.equalsIgnoreCase(strProperty))
return true;
return false;
}
|
[
"public",
"boolean",
"validUserProperty",
"(",
"String",
"strProperty",
")",
"{",
"if",
"(",
"DBParams",
".",
"FRAMES",
".",
"equalsIgnoreCase",
"(",
"strProperty",
")",
")",
"return",
"true",
";",
"if",
"(",
"DBParams",
".",
"MENUBARS",
".",
"equalsIgnoreCase",
"(",
"strProperty",
")",
")",
"return",
"true",
";",
"if",
"(",
"DBParams",
".",
"NAVMENUS",
".",
"equalsIgnoreCase",
"(",
"strProperty",
")",
")",
"return",
"true",
";",
"if",
"(",
"DBParams",
".",
"JAVA",
".",
"equalsIgnoreCase",
"(",
"strProperty",
")",
")",
"return",
"true",
";",
"if",
"(",
"DBParams",
".",
"BANNERS",
".",
"equalsIgnoreCase",
"(",
"strProperty",
")",
")",
"return",
"true",
";",
"if",
"(",
"DBParams",
".",
"LOGOS",
".",
"equalsIgnoreCase",
"(",
"strProperty",
")",
")",
"return",
"true",
";",
"if",
"(",
"DBParams",
".",
"TRAILERS",
".",
"equalsIgnoreCase",
"(",
"strProperty",
")",
")",
"return",
"true",
";",
"if",
"(",
"DBParams",
".",
"LANGUAGE",
".",
"equalsIgnoreCase",
"(",
"strProperty",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] |
Is this a valid user property?.
|
[
"Is",
"this",
"a",
"valid",
"user",
"property?",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/user/db/UserInfo.java#L393-L412
|
152,143
|
jeremiehuchet/acrachilisync
|
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/model/EditableAcraReport.java
|
EditableAcraReport.commitStacktraceMD5
|
public void commitStacktraceMD5() throws IOException, ServiceException {
listEntry.getCustomElements().setValueLocal(AcraReportHeader.STACK_TRACE_MD5.tagName(),
getStacktraceMD5());
listEntry.update();
}
|
java
|
public void commitStacktraceMD5() throws IOException, ServiceException {
listEntry.getCustomElements().setValueLocal(AcraReportHeader.STACK_TRACE_MD5.tagName(),
getStacktraceMD5());
listEntry.update();
}
|
[
"public",
"void",
"commitStacktraceMD5",
"(",
")",
"throws",
"IOException",
",",
"ServiceException",
"{",
"listEntry",
".",
"getCustomElements",
"(",
")",
".",
"setValueLocal",
"(",
"AcraReportHeader",
".",
"STACK_TRACE_MD5",
".",
"tagName",
"(",
")",
",",
"getStacktraceMD5",
"(",
")",
")",
";",
"listEntry",
".",
"update",
"(",
")",
";",
"}"
] |
Updates the stacktrace MD5 hash on the remote Google spreadsheet.
@throws ServiceException
@throws IOException
|
[
"Updates",
"the",
"stacktrace",
"MD5",
"hash",
"on",
"the",
"remote",
"Google",
"spreadsheet",
"."
] |
4eadb0218623e77e0d92b5a08515eea2db51e988
|
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/model/EditableAcraReport.java#L56-L61
|
152,144
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.getFilesInDirectoryTree
|
public static ArrayList<File> getFilesInDirectoryTree(File file, String includeMask) {
return getContentsInDirectoryTree(file, includeMask, true, false);
}
|
java
|
public static ArrayList<File> getFilesInDirectoryTree(File file, String includeMask) {
return getContentsInDirectoryTree(file, includeMask, true, false);
}
|
[
"public",
"static",
"ArrayList",
"<",
"File",
">",
"getFilesInDirectoryTree",
"(",
"File",
"file",
",",
"String",
"includeMask",
")",
"{",
"return",
"getContentsInDirectoryTree",
"(",
"file",
",",
"includeMask",
",",
"true",
",",
"false",
")",
";",
"}"
] |
Retrieves all files from a directory and its subdirectories
matching the given mask.
@param file directory
@param includeMask mask to match
@return a list containing the found files
|
[
"Retrieves",
"all",
"files",
"from",
"a",
"directory",
"and",
"its",
"subdirectories",
"matching",
"the",
"given",
"mask",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L113-L115
|
152,145
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.getContentsInDirectoryTree
|
private static ArrayList<File> getContentsInDirectoryTree(File directory, String includeMask, boolean returnFiles, boolean returnDirs) {
return getContentsInDirectoryTree(directory, new FileFilterRuleSet(directory.getPath()).setIncludeFilesWithNameMask(includeMask), returnFiles, returnDirs);
}
|
java
|
private static ArrayList<File> getContentsInDirectoryTree(File directory, String includeMask, boolean returnFiles, boolean returnDirs) {
return getContentsInDirectoryTree(directory, new FileFilterRuleSet(directory.getPath()).setIncludeFilesWithNameMask(includeMask), returnFiles, returnDirs);
}
|
[
"private",
"static",
"ArrayList",
"<",
"File",
">",
"getContentsInDirectoryTree",
"(",
"File",
"directory",
",",
"String",
"includeMask",
",",
"boolean",
"returnFiles",
",",
"boolean",
"returnDirs",
")",
"{",
"return",
"getContentsInDirectoryTree",
"(",
"directory",
",",
"new",
"FileFilterRuleSet",
"(",
"directory",
".",
"getPath",
"(",
")",
")",
".",
"setIncludeFilesWithNameMask",
"(",
"includeMask",
")",
",",
"returnFiles",
",",
"returnDirs",
")",
";",
"}"
] |
Retrieves contents from a directory and its subdirectories matching a given mask.
@param directory directory
@param includeMask file name to match
@param returnFiles return files
@param returnDirs return directories
@return a list containing the found contents
|
[
"Retrieves",
"contents",
"from",
"a",
"directory",
"and",
"its",
"subdirectories",
"matching",
"a",
"given",
"mask",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L127-L129
|
152,146
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.getContentsInDirectoryTree
|
private static ArrayList<File> getContentsInDirectoryTree(File directory, FileFilterRuleSet ruleSet, boolean returnFiles, boolean returnDirs) {
ArrayList<File> result = new ArrayList<File>();
if (directory != null && directory.exists() && directory.isDirectory()) {
File[] files = directory.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
if (returnDirs && ruleSet.fileMatchesRules(files[i])) {
result.add(files[i]);
}
result.addAll(getContentsInDirectoryTree(files[i], ruleSet, returnFiles, returnDirs));
}
else if (returnFiles && ruleSet.fileMatchesRules(files[i])) {
result.add(files[i]);
}
}
}
}
return result;
}
|
java
|
private static ArrayList<File> getContentsInDirectoryTree(File directory, FileFilterRuleSet ruleSet, boolean returnFiles, boolean returnDirs) {
ArrayList<File> result = new ArrayList<File>();
if (directory != null && directory.exists() && directory.isDirectory()) {
File[] files = directory.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
if (returnDirs && ruleSet.fileMatchesRules(files[i])) {
result.add(files[i]);
}
result.addAll(getContentsInDirectoryTree(files[i], ruleSet, returnFiles, returnDirs));
}
else if (returnFiles && ruleSet.fileMatchesRules(files[i])) {
result.add(files[i]);
}
}
}
}
return result;
}
|
[
"private",
"static",
"ArrayList",
"<",
"File",
">",
"getContentsInDirectoryTree",
"(",
"File",
"directory",
",",
"FileFilterRuleSet",
"ruleSet",
",",
"boolean",
"returnFiles",
",",
"boolean",
"returnDirs",
")",
"{",
"ArrayList",
"<",
"File",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
")",
";",
"if",
"(",
"directory",
"!=",
"null",
"&&",
"directory",
".",
"exists",
"(",
")",
"&&",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"directory",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"files",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"files",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"files",
"[",
"i",
"]",
".",
"isDirectory",
"(",
")",
")",
"{",
"if",
"(",
"returnDirs",
"&&",
"ruleSet",
".",
"fileMatchesRules",
"(",
"files",
"[",
"i",
"]",
")",
")",
"{",
"result",
".",
"add",
"(",
"files",
"[",
"i",
"]",
")",
";",
"}",
"result",
".",
"addAll",
"(",
"getContentsInDirectoryTree",
"(",
"files",
"[",
"i",
"]",
",",
"ruleSet",
",",
"returnFiles",
",",
"returnDirs",
")",
")",
";",
"}",
"else",
"if",
"(",
"returnFiles",
"&&",
"ruleSet",
".",
"fileMatchesRules",
"(",
"files",
"[",
"i",
"]",
")",
")",
"{",
"result",
".",
"add",
"(",
"files",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] |
Retrieves contents from a directory and its subdirectories matching a given rule set.
@param directory directory
@param ruleSet file name to match
@param returnFiles return files
@param returnDirs return directories
@return a list containing the found contents
|
[
"Retrieves",
"contents",
"from",
"a",
"directory",
"and",
"its",
"subdirectories",
"matching",
"a",
"given",
"rule",
"set",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L141-L161
|
152,147
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.getDirectoriesInDirectoryTree
|
public static ArrayList<File> getDirectoriesInDirectoryTree(String path) {
File file = new File(path);
return getContentsInDirectoryTree(file, "*", false, true);
}
|
java
|
public static ArrayList<File> getDirectoriesInDirectoryTree(String path) {
File file = new File(path);
return getContentsInDirectoryTree(file, "*", false, true);
}
|
[
"public",
"static",
"ArrayList",
"<",
"File",
">",
"getDirectoriesInDirectoryTree",
"(",
"String",
"path",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"return",
"getContentsInDirectoryTree",
"(",
"file",
",",
"\"*\"",
",",
"false",
",",
"true",
")",
";",
"}"
] |
Retrieves all directories from a directory and its subdirectories.
@param path path to directory
@return A list containing the found directories
|
[
"Retrieves",
"all",
"directories",
"from",
"a",
"directory",
"and",
"its",
"subdirectories",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L170-L173
|
152,148
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.getClassFileFromDirectoryInClassPath
|
public static File getClassFileFromDirectoryInClassPath(String className) {
String fileName = StringSupport.replaceAll(className, ".", "/");
fileName += ".class";
return getFileFromDirectoryInClassPath(fileName, System.getProperty("java.class.path"));
}
|
java
|
public static File getClassFileFromDirectoryInClassPath(String className) {
String fileName = StringSupport.replaceAll(className, ".", "/");
fileName += ".class";
return getFileFromDirectoryInClassPath(fileName, System.getProperty("java.class.path"));
}
|
[
"public",
"static",
"File",
"getClassFileFromDirectoryInClassPath",
"(",
"String",
"className",
")",
"{",
"String",
"fileName",
"=",
"StringSupport",
".",
"replaceAll",
"(",
"className",
",",
"\".\"",
",",
"\"/\"",
")",
";",
"fileName",
"+=",
"\".class\"",
";",
"return",
"getFileFromDirectoryInClassPath",
"(",
"fileName",
",",
"System",
".",
"getProperty",
"(",
"\"java.class.path\"",
")",
")",
";",
"}"
] |
Tries to retrieve a class as File from all directories mentioned in system property java.class.path
@param className class name as retrieved in myObject.getClass().getName()
@return a File if the class file was found or null otherwise
|
[
"Tries",
"to",
"retrieve",
"a",
"class",
"as",
"File",
"from",
"all",
"directories",
"mentioned",
"in",
"system",
"property",
"java",
".",
"class",
".",
"path"
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L207-L211
|
152,149
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.getFileFromDirectoryInClassPath
|
public static File getFileFromDirectoryInClassPath(String fileName, String classPath) {
Collection<String> paths = StringSupport.split(classPath, ";:", false);
for(String singlePath : paths) {
File dir = new File(singlePath);
if (dir.isDirectory()) {
File file = new File(singlePath + '/' + fileName);
if (file.exists()) {
return file;
}
}
}
return null;
}
|
java
|
public static File getFileFromDirectoryInClassPath(String fileName, String classPath) {
Collection<String> paths = StringSupport.split(classPath, ";:", false);
for(String singlePath : paths) {
File dir = new File(singlePath);
if (dir.isDirectory()) {
File file = new File(singlePath + '/' + fileName);
if (file.exists()) {
return file;
}
}
}
return null;
}
|
[
"public",
"static",
"File",
"getFileFromDirectoryInClassPath",
"(",
"String",
"fileName",
",",
"String",
"classPath",
")",
"{",
"Collection",
"<",
"String",
">",
"paths",
"=",
"StringSupport",
".",
"split",
"(",
"classPath",
",",
"\";:\"",
",",
"false",
")",
";",
"for",
"(",
"String",
"singlePath",
":",
"paths",
")",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"singlePath",
")",
";",
"if",
"(",
"dir",
".",
"isDirectory",
"(",
")",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"singlePath",
"+",
"'",
"'",
"+",
"fileName",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"return",
"file",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] |
Locates a file in the classpath.
@param fileName
@param classPath
@return the found file or null if the file can not be located
|
[
"Locates",
"a",
"file",
"in",
"the",
"classpath",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L221-L235
|
152,150
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.getClassZipEntryFromZipInClassPath
|
public static ZipEntry getClassZipEntryFromZipInClassPath(String className) throws IOException {
String fileName = StringSupport.replaceAll(className, ".", "/");
fileName += ".class";
Collection<String> jars = StringSupport.split(System.getProperty("java.class.path"), ";:", false);
for(String jarFileName : jars) {
if (jarFileName.endsWith(".jar") || jarFileName.endsWith(".zip")) {
ZipEntry entry = getZipEntryFromZip(fileName, jarFileName);
if (entry != null) {
return entry;
}
}
}
return null;
}
|
java
|
public static ZipEntry getClassZipEntryFromZipInClassPath(String className) throws IOException {
String fileName = StringSupport.replaceAll(className, ".", "/");
fileName += ".class";
Collection<String> jars = StringSupport.split(System.getProperty("java.class.path"), ";:", false);
for(String jarFileName : jars) {
if (jarFileName.endsWith(".jar") || jarFileName.endsWith(".zip")) {
ZipEntry entry = getZipEntryFromZip(fileName, jarFileName);
if (entry != null) {
return entry;
}
}
}
return null;
}
|
[
"public",
"static",
"ZipEntry",
"getClassZipEntryFromZipInClassPath",
"(",
"String",
"className",
")",
"throws",
"IOException",
"{",
"String",
"fileName",
"=",
"StringSupport",
".",
"replaceAll",
"(",
"className",
",",
"\".\"",
",",
"\"/\"",
")",
";",
"fileName",
"+=",
"\".class\"",
";",
"Collection",
"<",
"String",
">",
"jars",
"=",
"StringSupport",
".",
"split",
"(",
"System",
".",
"getProperty",
"(",
"\"java.class.path\"",
")",
",",
"\";:\"",
",",
"false",
")",
";",
"for",
"(",
"String",
"jarFileName",
":",
"jars",
")",
"{",
"if",
"(",
"jarFileName",
".",
"endsWith",
"(",
"\".jar\"",
")",
"||",
"jarFileName",
".",
"endsWith",
"(",
"\".zip\"",
")",
")",
"{",
"ZipEntry",
"entry",
"=",
"getZipEntryFromZip",
"(",
"fileName",
",",
"jarFileName",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"return",
"entry",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] |
Tries to retrieve a class as ZipEntry from all jars mentioned in system property java.class.path
@param className class name as retrieved in myObject.getClass().getName()
@return a ZipEntry if the class file was found or null otherwise
|
[
"Tries",
"to",
"retrieve",
"a",
"class",
"as",
"ZipEntry",
"from",
"all",
"jars",
"mentioned",
"in",
"system",
"property",
"java",
".",
"class",
".",
"path"
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L279-L293
|
152,151
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.createFile
|
public static File createFile(String filename) throws IOException {
File file = new File(filename);
if (!file.exists()) {
if(file.getParent() != null) {
File path = new File(file.getParent());
path.mkdirs();
}
file.createNewFile();
}
return file;
}
|
java
|
public static File createFile(String filename) throws IOException {
File file = new File(filename);
if (!file.exists()) {
if(file.getParent() != null) {
File path = new File(file.getParent());
path.mkdirs();
}
file.createNewFile();
}
return file;
}
|
[
"public",
"static",
"File",
"createFile",
"(",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"filename",
")",
";",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"file",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",
"File",
"path",
"=",
"new",
"File",
"(",
"file",
".",
"getParent",
"(",
")",
")",
";",
"path",
".",
"mkdirs",
"(",
")",
";",
"}",
"file",
".",
"createNewFile",
"(",
")",
";",
"}",
"return",
"file",
";",
"}"
] |
Creates a file.
The file, and the directory structure is created physically,
if it does not exist already.
@param filename
@return
|
[
"Creates",
"a",
"file",
".",
"The",
"file",
"and",
"the",
"directory",
"structure",
"is",
"created",
"physically",
"if",
"it",
"does",
"not",
"exist",
"already",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L512-L522
|
152,152
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.deleteContentsInDirectoryTree
|
public static void deleteContentsInDirectoryTree(File root, String includeMask) {
Collection<File> files = getContentsInDirectoryTree(root, includeMask, true, true);
for(File file : files) {
if (file.exists()) {//file may meanwhile have been deleted
if (file.isDirectory()) {
//empty directory
emptyDirectory(file.getAbsolutePath());
}
file.delete();
}
}
}
|
java
|
public static void deleteContentsInDirectoryTree(File root, String includeMask) {
Collection<File> files = getContentsInDirectoryTree(root, includeMask, true, true);
for(File file : files) {
if (file.exists()) {//file may meanwhile have been deleted
if (file.isDirectory()) {
//empty directory
emptyDirectory(file.getAbsolutePath());
}
file.delete();
}
}
}
|
[
"public",
"static",
"void",
"deleteContentsInDirectoryTree",
"(",
"File",
"root",
",",
"String",
"includeMask",
")",
"{",
"Collection",
"<",
"File",
">",
"files",
"=",
"getContentsInDirectoryTree",
"(",
"root",
",",
"includeMask",
",",
"true",
",",
"true",
")",
";",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"//file may meanwhile have been deleted",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"//empty directory",
"emptyDirectory",
"(",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"file",
".",
"delete",
"(",
")",
";",
"}",
"}",
"}"
] |
Deletes from a directory all files and subdirectories targeted by a given mask.
The method will recurse into subdirectories.
@param root
@param includeMask
|
[
"Deletes",
"from",
"a",
"directory",
"all",
"files",
"and",
"subdirectories",
"targeted",
"by",
"a",
"given",
"mask",
".",
"The",
"method",
"will",
"recurse",
"into",
"subdirectories",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L649-L660
|
152,153
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
|
FileSupport.convertToUnixStylePath
|
public static String convertToUnixStylePath(String path) {
String retval = StringSupport.replaceAll(path, "\\", "/");
retval = StringSupport.replaceAll(retval, new String[]{"///", "//"}, new String[]{"/", "/"});
return retval;
}
|
java
|
public static String convertToUnixStylePath(String path) {
String retval = StringSupport.replaceAll(path, "\\", "/");
retval = StringSupport.replaceAll(retval, new String[]{"///", "//"}, new String[]{"/", "/"});
return retval;
}
|
[
"public",
"static",
"String",
"convertToUnixStylePath",
"(",
"String",
"path",
")",
"{",
"String",
"retval",
"=",
"StringSupport",
".",
"replaceAll",
"(",
"path",
",",
"\"\\\\\"",
",",
"\"/\"",
")",
";",
"retval",
"=",
"StringSupport",
".",
"replaceAll",
"(",
"retval",
",",
"new",
"String",
"[",
"]",
"{",
"\"///\"",
",",
"\"//\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"/\"",
",",
"\"/\"",
"}",
")",
";",
"return",
"retval",
";",
"}"
] |
Converts backslashes into forward slashes.
@param path
@return
|
[
"Converts",
"backslashes",
"into",
"forward",
"slashes",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L745-L749
|
152,154
|
drewwills/cernunnos
|
cernunnos-core/src/main/java/org/danann/cernunnos/xml/ReadDocumentPhrase.java
|
ReadDocumentPhrase.loadDocument
|
protected Element loadDocument(String ctx_str, String loc_str, EntityResolver resolver) {
try {
final URL ctx = new URL(ctx_str);
final URL doc = new URL(ctx, loc_str);
// Use an EntityResolver if provided...
final SAXReader rdr = new SAXReader();
if (resolver != null) {
rdr.setEntityResolver(resolver);
}
// Read by passing a URL -- don't manage the URLConnection yourself...
final Element rslt = rdr.read(doc).getRootElement();
rslt.normalize();
return rslt;
} catch (Throwable t) {
String msg = "Unable to read the specified document:"
+ "\n\tCONTEXT=" + ctx_str
+ "\n\tLOCATION=" + loc_str;
throw new RuntimeException(msg, t);
}
}
|
java
|
protected Element loadDocument(String ctx_str, String loc_str, EntityResolver resolver) {
try {
final URL ctx = new URL(ctx_str);
final URL doc = new URL(ctx, loc_str);
// Use an EntityResolver if provided...
final SAXReader rdr = new SAXReader();
if (resolver != null) {
rdr.setEntityResolver(resolver);
}
// Read by passing a URL -- don't manage the URLConnection yourself...
final Element rslt = rdr.read(doc).getRootElement();
rslt.normalize();
return rslt;
} catch (Throwable t) {
String msg = "Unable to read the specified document:"
+ "\n\tCONTEXT=" + ctx_str
+ "\n\tLOCATION=" + loc_str;
throw new RuntimeException(msg, t);
}
}
|
[
"protected",
"Element",
"loadDocument",
"(",
"String",
"ctx_str",
",",
"String",
"loc_str",
",",
"EntityResolver",
"resolver",
")",
"{",
"try",
"{",
"final",
"URL",
"ctx",
"=",
"new",
"URL",
"(",
"ctx_str",
")",
";",
"final",
"URL",
"doc",
"=",
"new",
"URL",
"(",
"ctx",
",",
"loc_str",
")",
";",
"// Use an EntityResolver if provided...",
"final",
"SAXReader",
"rdr",
"=",
"new",
"SAXReader",
"(",
")",
";",
"if",
"(",
"resolver",
"!=",
"null",
")",
"{",
"rdr",
".",
"setEntityResolver",
"(",
"resolver",
")",
";",
"}",
"// Read by passing a URL -- don't manage the URLConnection yourself...",
"final",
"Element",
"rslt",
"=",
"rdr",
".",
"read",
"(",
"doc",
")",
".",
"getRootElement",
"(",
")",
";",
"rslt",
".",
"normalize",
"(",
")",
";",
"return",
"rslt",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"String",
"msg",
"=",
"\"Unable to read the specified document:\"",
"+",
"\"\\n\\tCONTEXT=\"",
"+",
"ctx_str",
"+",
"\"\\n\\tLOCATION=\"",
"+",
"loc_str",
";",
"throw",
"new",
"RuntimeException",
"(",
"msg",
",",
"t",
")",
";",
"}",
"}"
] |
Loads a DOM4J document from the specified contact and location and returns the root Element
|
[
"Loads",
"a",
"DOM4J",
"document",
"from",
"the",
"specified",
"contact",
"and",
"location",
"and",
"returns",
"the",
"root",
"Element"
] |
dc6848e0253775e22b6c869fd06506d4ddb6d728
|
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/xml/ReadDocumentPhrase.java#L98-L120
|
152,155
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/message/record/RecordMessageHeader.java
|
RecordMessageHeader.getBookmark
|
public Object getBookmark(int iHandleType)
{
Map<String,Object> properties = this.getProperties();
Object bookmark = properties.get(BOOKMARK);
if (iHandleType == DBConstants.BOOKMARK_HANDLE)
return bookmark;
if (iHandleType == DBConstants.FULL_OBJECT_HANDLE)
{
String strDatabaseName = (String)properties.get(DB_NAME);
String strTableName = (String)properties.get(TABLE_NAME);
// Must match the FULL_OBJECT_HANDLE format!
String strSource = m_strSourceType + BaseTable.HANDLE_SEPARATOR + strDatabaseName + BaseTable.HANDLE_SEPARATOR + strTableName;
strSource += BaseTable.HANDLE_SEPARATOR + bookmark.toString();
return strSource;
}
return null;
}
|
java
|
public Object getBookmark(int iHandleType)
{
Map<String,Object> properties = this.getProperties();
Object bookmark = properties.get(BOOKMARK);
if (iHandleType == DBConstants.BOOKMARK_HANDLE)
return bookmark;
if (iHandleType == DBConstants.FULL_OBJECT_HANDLE)
{
String strDatabaseName = (String)properties.get(DB_NAME);
String strTableName = (String)properties.get(TABLE_NAME);
// Must match the FULL_OBJECT_HANDLE format!
String strSource = m_strSourceType + BaseTable.HANDLE_SEPARATOR + strDatabaseName + BaseTable.HANDLE_SEPARATOR + strTableName;
strSource += BaseTable.HANDLE_SEPARATOR + bookmark.toString();
return strSource;
}
return null;
}
|
[
"public",
"Object",
"getBookmark",
"(",
"int",
"iHandleType",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"this",
".",
"getProperties",
"(",
")",
";",
"Object",
"bookmark",
"=",
"properties",
".",
"get",
"(",
"BOOKMARK",
")",
";",
"if",
"(",
"iHandleType",
"==",
"DBConstants",
".",
"BOOKMARK_HANDLE",
")",
"return",
"bookmark",
";",
"if",
"(",
"iHandleType",
"==",
"DBConstants",
".",
"FULL_OBJECT_HANDLE",
")",
"{",
"String",
"strDatabaseName",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"DB_NAME",
")",
";",
"String",
"strTableName",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"TABLE_NAME",
")",
";",
"// Must match the FULL_OBJECT_HANDLE format!",
"String",
"strSource",
"=",
"m_strSourceType",
"+",
"BaseTable",
".",
"HANDLE_SEPARATOR",
"+",
"strDatabaseName",
"+",
"BaseTable",
".",
"HANDLE_SEPARATOR",
"+",
"strTableName",
";",
"strSource",
"+=",
"BaseTable",
".",
"HANDLE_SEPARATOR",
"+",
"bookmark",
".",
"toString",
"(",
")",
";",
"return",
"strSource",
";",
"}",
"return",
"null",
";",
"}"
] |
Get the bookmark.
|
[
"Get",
"the",
"bookmark",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/RecordMessageHeader.java#L138-L154
|
152,156
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/message/record/RecordMessageHeader.java
|
RecordMessageHeader.isRecordMatch
|
public boolean isRecordMatch(Record record)
{
Map<String,Object> properties = this.getProperties();
String strTableName = (String)properties.get(TABLE_NAME);
// Object dsBookmark = this.getBookmark(DBConstants.BOOKMARK_HANDLE);
if (record != null)
if (record.getTableNames(false).equals(strTableName))
return true; // Match
return false; // No match
}
|
java
|
public boolean isRecordMatch(Record record)
{
Map<String,Object> properties = this.getProperties();
String strTableName = (String)properties.get(TABLE_NAME);
// Object dsBookmark = this.getBookmark(DBConstants.BOOKMARK_HANDLE);
if (record != null)
if (record.getTableNames(false).equals(strTableName))
return true; // Match
return false; // No match
}
|
[
"public",
"boolean",
"isRecordMatch",
"(",
"Record",
"record",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"this",
".",
"getProperties",
"(",
")",
";",
"String",
"strTableName",
"=",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"TABLE_NAME",
")",
";",
"// Object dsBookmark = this.getBookmark(DBConstants.BOOKMARK_HANDLE);",
"if",
"(",
"record",
"!=",
"null",
")",
"if",
"(",
"record",
".",
"getTableNames",
"(",
"false",
")",
".",
"equals",
"(",
"strTableName",
")",
")",
"return",
"true",
";",
"// Match",
"return",
"false",
";",
"// No match",
"}"
] |
Should this record get this message?
|
[
"Should",
"this",
"record",
"get",
"this",
"message?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/RecordMessageHeader.java#L165-L174
|
152,157
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/message/record/RecordMessageHeader.java
|
RecordMessageHeader.isMatchHint
|
public boolean isMatchHint(String strKeyArea, Object objKeyData)
{
if (m_mapHints != null)
if (objKeyData.equals(m_mapHints.get(strKeyArea)))
return true; // Match;
return false; // No match
}
|
java
|
public boolean isMatchHint(String strKeyArea, Object objKeyData)
{
if (m_mapHints != null)
if (objKeyData.equals(m_mapHints.get(strKeyArea)))
return true; // Match;
return false; // No match
}
|
[
"public",
"boolean",
"isMatchHint",
"(",
"String",
"strKeyArea",
",",
"Object",
"objKeyData",
")",
"{",
"if",
"(",
"m_mapHints",
"!=",
"null",
")",
"if",
"(",
"objKeyData",
".",
"equals",
"(",
"m_mapHints",
".",
"get",
"(",
"strKeyArea",
")",
")",
")",
"return",
"true",
";",
"// Match;",
"return",
"false",
";",
"// No match",
"}"
] |
Does this key area hint match my hint?
@param strKeyArea The key area to match.
@param objKeyData The data to match.
@return true if match.
|
[
"Does",
"this",
"key",
"area",
"hint",
"match",
"my",
"hint?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/RecordMessageHeader.java#L181-L187
|
152,158
|
dmerkushov/os-helper
|
src/main/java/ru/dmerkushov/oshelper/OSHelper.java
|
OSHelper.runCommand
|
public static Process runCommand (List<String> toRun) throws OSHelperException {
Process proc;
ProcessBuilder procBuilder = new ProcessBuilder ();
procBuilder.command (toRun);
try {
proc = procBuilder.start ();
} catch (IOException ex) {
throw new OSHelperException ("Received an IOException when running command:\n" + toRun + "\n" + ex.getMessage (), ex);
}
return proc;
}
|
java
|
public static Process runCommand (List<String> toRun) throws OSHelperException {
Process proc;
ProcessBuilder procBuilder = new ProcessBuilder ();
procBuilder.command (toRun);
try {
proc = procBuilder.start ();
} catch (IOException ex) {
throw new OSHelperException ("Received an IOException when running command:\n" + toRun + "\n" + ex.getMessage (), ex);
}
return proc;
}
|
[
"public",
"static",
"Process",
"runCommand",
"(",
"List",
"<",
"String",
">",
"toRun",
")",
"throws",
"OSHelperException",
"{",
"Process",
"proc",
";",
"ProcessBuilder",
"procBuilder",
"=",
"new",
"ProcessBuilder",
"(",
")",
";",
"procBuilder",
".",
"command",
"(",
"toRun",
")",
";",
"try",
"{",
"proc",
"=",
"procBuilder",
".",
"start",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"Received an IOException when running command:\\n\"",
"+",
"toRun",
"+",
"\"\\n\"",
"+",
"ex",
".",
"getMessage",
"(",
")",
",",
"ex",
")",
";",
"}",
"return",
"proc",
";",
"}"
] |
Runs a new OS process
@param toRun OS console command to run
@return the process object
@throws OSHelperException
|
[
"Runs",
"a",
"new",
"OS",
"process"
] |
a7c2b72d289d9bc23ae106d1c5e11769cf3463d6
|
https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L59-L71
|
152,159
|
dmerkushov/os-helper
|
src/main/java/ru/dmerkushov/oshelper/OSHelper.java
|
OSHelper.procWait
|
public static int procWait (Process process) throws OSHelperException {
try {
return process.waitFor ();
} catch (InterruptedException ex) {
throw new OSHelperException ("Received an InterruptedException when waiting for an external process to terminate.", ex);
}
}
|
java
|
public static int procWait (Process process) throws OSHelperException {
try {
return process.waitFor ();
} catch (InterruptedException ex) {
throw new OSHelperException ("Received an InterruptedException when waiting for an external process to terminate.", ex);
}
}
|
[
"public",
"static",
"int",
"procWait",
"(",
"Process",
"process",
")",
"throws",
"OSHelperException",
"{",
"try",
"{",
"return",
"process",
".",
"waitFor",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"Received an InterruptedException when waiting for an external process to terminate.\"",
",",
"ex",
")",
";",
"}",
"}"
] |
Waits for a specified process to terminate
@param process
@throws OSHelperException
@deprecated Use ProcessReturn procWaitWithProcessReturn () instead
|
[
"Waits",
"for",
"a",
"specified",
"process",
"to",
"terminate"
] |
a7c2b72d289d9bc23ae106d1c5e11769cf3463d6
|
https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L159-L165
|
152,160
|
dmerkushov/os-helper
|
src/main/java/ru/dmerkushov/oshelper/OSHelper.java
|
OSHelper.readFile
|
public static byte[] readFile (String fileName) throws OSHelperException {
File file = new File (fileName);
if (!file.exists ()) {
throw new OSHelperException ("File " + fileName + " does not exist");
}
if (!file.canRead ()) {
throw new OSHelperException ("File " + fileName + " is not readable");
}
if (!file.isFile ()) {
throw new OSHelperException ("File " + fileName + " is not a normal file");
}
RandomAccessFile raFile = null;
try {
raFile = new RandomAccessFile (fileName, "r");
} catch (FileNotFoundException ex) {
throw new OSHelperException ("File " + fileName + " not found");
}
long fileLengthLong;
try {
fileLengthLong = raFile.length ();
} catch (IOException ex) {
throw new OSHelperException (ex);
}
if (fileLengthLong > Integer.MAX_VALUE) {
throw new OSHelperException ("File length exceeds " + Integer.MAX_VALUE + " bytes: " + fileLengthLong);
}
int fileLengthInt = (int) fileLengthLong;
byte[] bytes = new byte[fileLengthInt];
try {
raFile.read (bytes);
} catch (IOException ex) {
throw new OSHelperException (ex);
} finally {
try {
raFile.close ();
} catch (IOException ex) {
throw new OSHelperException (ex);
}
}
return bytes;
}
|
java
|
public static byte[] readFile (String fileName) throws OSHelperException {
File file = new File (fileName);
if (!file.exists ()) {
throw new OSHelperException ("File " + fileName + " does not exist");
}
if (!file.canRead ()) {
throw new OSHelperException ("File " + fileName + " is not readable");
}
if (!file.isFile ()) {
throw new OSHelperException ("File " + fileName + " is not a normal file");
}
RandomAccessFile raFile = null;
try {
raFile = new RandomAccessFile (fileName, "r");
} catch (FileNotFoundException ex) {
throw new OSHelperException ("File " + fileName + " not found");
}
long fileLengthLong;
try {
fileLengthLong = raFile.length ();
} catch (IOException ex) {
throw new OSHelperException (ex);
}
if (fileLengthLong > Integer.MAX_VALUE) {
throw new OSHelperException ("File length exceeds " + Integer.MAX_VALUE + " bytes: " + fileLengthLong);
}
int fileLengthInt = (int) fileLengthLong;
byte[] bytes = new byte[fileLengthInt];
try {
raFile.read (bytes);
} catch (IOException ex) {
throw new OSHelperException (ex);
} finally {
try {
raFile.close ();
} catch (IOException ex) {
throw new OSHelperException (ex);
}
}
return bytes;
}
|
[
"public",
"static",
"byte",
"[",
"]",
"readFile",
"(",
"String",
"fileName",
")",
"throws",
"OSHelperException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"File \"",
"+",
"fileName",
"+",
"\" does not exist\"",
")",
";",
"}",
"if",
"(",
"!",
"file",
".",
"canRead",
"(",
")",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"File \"",
"+",
"fileName",
"+",
"\" is not readable\"",
")",
";",
"}",
"if",
"(",
"!",
"file",
".",
"isFile",
"(",
")",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"File \"",
"+",
"fileName",
"+",
"\" is not a normal file\"",
")",
";",
"}",
"RandomAccessFile",
"raFile",
"=",
"null",
";",
"try",
"{",
"raFile",
"=",
"new",
"RandomAccessFile",
"(",
"fileName",
",",
"\"r\"",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"File \"",
"+",
"fileName",
"+",
"\" not found\"",
")",
";",
"}",
"long",
"fileLengthLong",
";",
"try",
"{",
"fileLengthLong",
"=",
"raFile",
".",
"length",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"ex",
")",
";",
"}",
"if",
"(",
"fileLengthLong",
">",
"Integer",
".",
"MAX_VALUE",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"File length exceeds \"",
"+",
"Integer",
".",
"MAX_VALUE",
"+",
"\" bytes: \"",
"+",
"fileLengthLong",
")",
";",
"}",
"int",
"fileLengthInt",
"=",
"(",
"int",
")",
"fileLengthLong",
";",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"fileLengthInt",
"]",
";",
"try",
"{",
"raFile",
".",
"read",
"(",
"bytes",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"ex",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"raFile",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"ex",
")",
";",
"}",
"}",
"return",
"bytes",
";",
"}"
] |
Read a file to a byte array
@param fileName
@return
@throws OSHelperException
|
[
"Read",
"a",
"file",
"to",
"a",
"byte",
"array"
] |
a7c2b72d289d9bc23ae106d1c5e11769cf3463d6
|
https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L221-L266
|
152,161
|
dmerkushov/os-helper
|
src/main/java/ru/dmerkushov/oshelper/OSHelper.java
|
OSHelper.writeFile
|
public static void writeFile (byte[] bytes, String targetFileName) throws OSHelperException {
FileOutputStream fos;
try {
fos = new FileOutputStream (targetFileName);
} catch (FileNotFoundException ex) {
throw new OSHelperException ("Received a FileNotFoundException when trying to open target file " + targetFileName + ".", ex);
}
try {
fos.write (bytes);
} catch (IOException ex) {
throw new OSHelperException ("Received an IOException when trying to write to target file " + targetFileName + ".", ex);
} finally {
try {
fos.close ();
} catch (IOException ex) {
throw new OSHelperException ("Received an IOException when trying to close FileOutputStream for target file " + targetFileName + ".", ex);
}
}
}
|
java
|
public static void writeFile (byte[] bytes, String targetFileName) throws OSHelperException {
FileOutputStream fos;
try {
fos = new FileOutputStream (targetFileName);
} catch (FileNotFoundException ex) {
throw new OSHelperException ("Received a FileNotFoundException when trying to open target file " + targetFileName + ".", ex);
}
try {
fos.write (bytes);
} catch (IOException ex) {
throw new OSHelperException ("Received an IOException when trying to write to target file " + targetFileName + ".", ex);
} finally {
try {
fos.close ();
} catch (IOException ex) {
throw new OSHelperException ("Received an IOException when trying to close FileOutputStream for target file " + targetFileName + ".", ex);
}
}
}
|
[
"public",
"static",
"void",
"writeFile",
"(",
"byte",
"[",
"]",
"bytes",
",",
"String",
"targetFileName",
")",
"throws",
"OSHelperException",
"{",
"FileOutputStream",
"fos",
";",
"try",
"{",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"targetFileName",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"Received a FileNotFoundException when trying to open target file \"",
"+",
"targetFileName",
"+",
"\".\"",
",",
"ex",
")",
";",
"}",
"try",
"{",
"fos",
".",
"write",
"(",
"bytes",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"Received an IOException when trying to write to target file \"",
"+",
"targetFileName",
"+",
"\".\"",
",",
"ex",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"fos",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"\"Received an IOException when trying to close FileOutputStream for target file \"",
"+",
"targetFileName",
"+",
"\".\"",
",",
"ex",
")",
";",
"}",
"}",
"}"
] |
Write a file
@param bytes
@param targetFileName
@throws OSHelperException
|
[
"Write",
"a",
"file"
] |
a7c2b72d289d9bc23ae106d1c5e11769cf3463d6
|
https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L275-L293
|
152,162
|
dmerkushov/os-helper
|
src/main/java/ru/dmerkushov/oshelper/OSHelper.java
|
OSHelper.sendEmail_Unix
|
public static ProcessReturn sendEmail_Unix (String target, String topic, String text) throws OSHelperException {
topic = topic.replaceAll ("\"", "\\\"");
String emailCommandAsString = "mail -s \"" + topic + "\" -S sendcharsets=utf-8 " + target;
List<String> emailCommandAsList = OSHelper.constructCommandAsList_Unix_sh (emailCommandAsString);
Process process = OSHelper.runCommand (emailCommandAsList);
OutputStream processStdin = process.getOutputStream ();
try {
processStdin.write (text.getBytes ());
} catch (IOException ex) {
throw new OSHelperException (ex);
}
try {
processStdin.close ();
} catch (IOException ex) {
throw new OSHelperException (ex);
}
ProcessReturn processReturn = OSHelper.procWaitWithProcessReturn (process, 10000);
return processReturn;
}
|
java
|
public static ProcessReturn sendEmail_Unix (String target, String topic, String text) throws OSHelperException {
topic = topic.replaceAll ("\"", "\\\"");
String emailCommandAsString = "mail -s \"" + topic + "\" -S sendcharsets=utf-8 " + target;
List<String> emailCommandAsList = OSHelper.constructCommandAsList_Unix_sh (emailCommandAsString);
Process process = OSHelper.runCommand (emailCommandAsList);
OutputStream processStdin = process.getOutputStream ();
try {
processStdin.write (text.getBytes ());
} catch (IOException ex) {
throw new OSHelperException (ex);
}
try {
processStdin.close ();
} catch (IOException ex) {
throw new OSHelperException (ex);
}
ProcessReturn processReturn = OSHelper.procWaitWithProcessReturn (process, 10000);
return processReturn;
}
|
[
"public",
"static",
"ProcessReturn",
"sendEmail_Unix",
"(",
"String",
"target",
",",
"String",
"topic",
",",
"String",
"text",
")",
"throws",
"OSHelperException",
"{",
"topic",
"=",
"topic",
".",
"replaceAll",
"(",
"\"\\\"\"",
",",
"\"\\\\\\\"\"",
")",
";",
"String",
"emailCommandAsString",
"=",
"\"mail -s \\\"\"",
"+",
"topic",
"+",
"\"\\\" -S sendcharsets=utf-8 \"",
"+",
"target",
";",
"List",
"<",
"String",
">",
"emailCommandAsList",
"=",
"OSHelper",
".",
"constructCommandAsList_Unix_sh",
"(",
"emailCommandAsString",
")",
";",
"Process",
"process",
"=",
"OSHelper",
".",
"runCommand",
"(",
"emailCommandAsList",
")",
";",
"OutputStream",
"processStdin",
"=",
"process",
".",
"getOutputStream",
"(",
")",
";",
"try",
"{",
"processStdin",
".",
"write",
"(",
"text",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"ex",
")",
";",
"}",
"try",
"{",
"processStdin",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"OSHelperException",
"(",
"ex",
")",
";",
"}",
"ProcessReturn",
"processReturn",
"=",
"OSHelper",
".",
"procWaitWithProcessReturn",
"(",
"process",
",",
"10000",
")",
";",
"return",
"processReturn",
";",
"}"
] |
Send a simple email
@param target
@param topic
@param text
@return The ProcessReturn structure of the mailing process. Normal are
empty <code>stdout</code> and <code>stderr</code>, 0 * for <code>exitCode</code>
and <code>osh_PROCESS_EXITED_BY_ITSELF</code> for <code>exitStatus</code>
@see ProcessReturn
|
[
"Send",
"a",
"simple",
"email"
] |
a7c2b72d289d9bc23ae106d1c5e11769cf3463d6
|
https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L362-L380
|
152,163
|
dmerkushov/os-helper
|
src/main/java/ru/dmerkushov/oshelper/OSHelper.java
|
OSHelper.constructCommandAsList_Unix_sh
|
public static List<String> constructCommandAsList_Unix_sh (String command) {
List<String> commandAsList = new ArrayList<String> ();
commandAsList.add ("sh");
commandAsList.add ("-c");
commandAsList.add (command);
return commandAsList;
}
|
java
|
public static List<String> constructCommandAsList_Unix_sh (String command) {
List<String> commandAsList = new ArrayList<String> ();
commandAsList.add ("sh");
commandAsList.add ("-c");
commandAsList.add (command);
return commandAsList;
}
|
[
"public",
"static",
"List",
"<",
"String",
">",
"constructCommandAsList_Unix_sh",
"(",
"String",
"command",
")",
"{",
"List",
"<",
"String",
">",
"commandAsList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"commandAsList",
".",
"add",
"(",
"\"sh\"",
")",
";",
"commandAsList",
".",
"add",
"(",
"\"-c\"",
")",
";",
"commandAsList",
".",
"add",
"(",
"command",
")",
";",
"return",
"commandAsList",
";",
"}"
] |
Helper method to construct a UNIX-like-OS-compatible command that is
using the SH shell syntax.
@param command
@return
|
[
"Helper",
"method",
"to",
"construct",
"a",
"UNIX",
"-",
"like",
"-",
"OS",
"-",
"compatible",
"command",
"that",
"is",
"using",
"the",
"SH",
"shell",
"syntax",
"."
] |
a7c2b72d289d9bc23ae106d1c5e11769cf3463d6
|
https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L389-L397
|
152,164
|
dmerkushov/os-helper
|
src/main/java/ru/dmerkushov/oshelper/OSHelper.java
|
OSHelper.constructCommandAsList_Windows_cmd
|
public static List<String> constructCommandAsList_Windows_cmd (String command) {
List<String> commandAsList = new ArrayList<String> ();
commandAsList.add ("cmd");
commandAsList.add ("/c");
commandAsList.add (command);
return commandAsList;
}
|
java
|
public static List<String> constructCommandAsList_Windows_cmd (String command) {
List<String> commandAsList = new ArrayList<String> ();
commandAsList.add ("cmd");
commandAsList.add ("/c");
commandAsList.add (command);
return commandAsList;
}
|
[
"public",
"static",
"List",
"<",
"String",
">",
"constructCommandAsList_Windows_cmd",
"(",
"String",
"command",
")",
"{",
"List",
"<",
"String",
">",
"commandAsList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"commandAsList",
".",
"add",
"(",
"\"cmd\"",
")",
";",
"commandAsList",
".",
"add",
"(",
"\"/c\"",
")",
";",
"commandAsList",
".",
"add",
"(",
"command",
")",
";",
"return",
"commandAsList",
";",
"}"
] |
Helper method to construct a Windows-compatible command that is using the
CMD shell syntax.
@param command
@return
|
[
"Helper",
"method",
"to",
"construct",
"a",
"Windows",
"-",
"compatible",
"command",
"that",
"is",
"using",
"the",
"CMD",
"shell",
"syntax",
"."
] |
a7c2b72d289d9bc23ae106d1c5e11769cf3463d6
|
https://github.com/dmerkushov/os-helper/blob/a7c2b72d289d9bc23ae106d1c5e11769cf3463d6/src/main/java/ru/dmerkushov/oshelper/OSHelper.java#L406-L414
|
152,165
|
PuyallupFoursquare/ccb-api-client-java
|
src/main/java/com/p4square/ccbapi/serializer/FormBuilder.java
|
FormBuilder.appendField
|
public void appendField(final String key, final String value) {
if (builder.length() > 0) {
builder.append("&");
}
try {
builder.append(key).append("=").append(URLEncoder.encode(value, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new AssertionError("UTF-8 encoding should always be available.");
}
}
|
java
|
public void appendField(final String key, final String value) {
if (builder.length() > 0) {
builder.append("&");
}
try {
builder.append(key).append("=").append(URLEncoder.encode(value, "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new AssertionError("UTF-8 encoding should always be available.");
}
}
|
[
"public",
"void",
"appendField",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"builder",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"builder",
".",
"append",
"(",
"\"&\"",
")",
";",
"}",
"try",
"{",
"builder",
".",
"append",
"(",
"key",
")",
".",
"append",
"(",
"\"=\"",
")",
".",
"append",
"(",
"URLEncoder",
".",
"encode",
"(",
"value",
",",
"\"UTF-8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"UTF-8 encoding should always be available.\"",
")",
";",
"}",
"}"
] |
Append a field to the form.
@param key The form key, which must be URLEncoded before calling this method.
@param value The value associated with the key. The value will be URLEncoded by this method.
|
[
"Append",
"a",
"field",
"to",
"the",
"form",
"."
] |
54a7a3184dc565fe513aa520e1344b2303ea6834
|
https://github.com/PuyallupFoursquare/ccb-api-client-java/blob/54a7a3184dc565fe513aa520e1344b2303ea6834/src/main/java/com/p4square/ccbapi/serializer/FormBuilder.java#L61-L71
|
152,166
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java
|
FYShuffle.shuffle
|
public static <E> void shuffle(E[] array) {
int swapPlace = -1;
for(int i = 0; i < array.length; i++) {
swapPlace = (int) (Math.random() * (array.length - 1 ));
TrivialSwap.swap(array, i, swapPlace);
}
}
|
java
|
public static <E> void shuffle(E[] array) {
int swapPlace = -1;
for(int i = 0; i < array.length; i++) {
swapPlace = (int) (Math.random() * (array.length - 1 ));
TrivialSwap.swap(array, i, swapPlace);
}
}
|
[
"public",
"static",
"<",
"E",
">",
"void",
"shuffle",
"(",
"E",
"[",
"]",
"array",
")",
"{",
"int",
"swapPlace",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"swapPlace",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"array",
".",
"length",
"-",
"1",
")",
")",
";",
"TrivialSwap",
".",
"swap",
"(",
"array",
",",
"i",
",",
"swapPlace",
")",
";",
"}",
"}"
] |
Randomly shuffle the elements in an array
@param <E> the type of elements in this arrays.
@param array an array of objects to shuffle.
|
[
"Randomly",
"shuffle",
"the",
"elements",
"in",
"an",
"array"
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java#L34-L41
|
152,167
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java
|
FYShuffle.shuffle
|
public static <E> void shuffle(List<E> list) {
int swapPlace = -1;
for(int i = 0; i < list.size(); i++) {
swapPlace = (int) (Math.random() * (list.size() - 1));
TrivialSwap.swap(list, i, swapPlace);
}
}
|
java
|
public static <E> void shuffle(List<E> list) {
int swapPlace = -1;
for(int i = 0; i < list.size(); i++) {
swapPlace = (int) (Math.random() * (list.size() - 1));
TrivialSwap.swap(list, i, swapPlace);
}
}
|
[
"public",
"static",
"<",
"E",
">",
"void",
"shuffle",
"(",
"List",
"<",
"E",
">",
"list",
")",
"{",
"int",
"swapPlace",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"swapPlace",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"list",
".",
"size",
"(",
")",
"-",
"1",
")",
")",
";",
"TrivialSwap",
".",
"swap",
"(",
"list",
",",
"i",
",",
"swapPlace",
")",
";",
"}",
"}"
] |
Randomly shuffle the elements in a list
@param <E> the type of elements in this list.
@param list a list of objects to shuffle.
|
[
"Randomly",
"shuffle",
"the",
"elements",
"in",
"a",
"list"
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java#L50-L57
|
152,168
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java
|
FYShuffle.shuffle
|
public static void shuffle(int[] intArray) {
int swapPlace = -1;
for(int i = 0; i < intArray.length; i++) {
swapPlace = (int) (Math.random() * (intArray.length - 1 ));
XORSwap.swap(intArray, i, swapPlace);
}
}
|
java
|
public static void shuffle(int[] intArray) {
int swapPlace = -1;
for(int i = 0; i < intArray.length; i++) {
swapPlace = (int) (Math.random() * (intArray.length - 1 ));
XORSwap.swap(intArray, i, swapPlace);
}
}
|
[
"public",
"static",
"void",
"shuffle",
"(",
"int",
"[",
"]",
"intArray",
")",
"{",
"int",
"swapPlace",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"intArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"swapPlace",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"intArray",
".",
"length",
"-",
"1",
")",
")",
";",
"XORSwap",
".",
"swap",
"(",
"intArray",
",",
"i",
",",
"swapPlace",
")",
";",
"}",
"}"
] |
Randomly shuffle an int array
@param intArray array of integers to shuffle.
|
[
"Randomly",
"shuffle",
"an",
"int",
"array"
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java#L64-L71
|
152,169
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java
|
FYShuffle.shuffle
|
public static void shuffle(float[] floatArray) {
int swapPlace = -1;
for(int i = 0; i < floatArray.length; i++) {
swapPlace = (int) (Math.random() * (floatArray.length - 1 ));
TrivialSwap.swap(floatArray, i, swapPlace);
}
}
|
java
|
public static void shuffle(float[] floatArray) {
int swapPlace = -1;
for(int i = 0; i < floatArray.length; i++) {
swapPlace = (int) (Math.random() * (floatArray.length - 1 ));
TrivialSwap.swap(floatArray, i, swapPlace);
}
}
|
[
"public",
"static",
"void",
"shuffle",
"(",
"float",
"[",
"]",
"floatArray",
")",
"{",
"int",
"swapPlace",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"floatArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"swapPlace",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"floatArray",
".",
"length",
"-",
"1",
")",
")",
";",
"TrivialSwap",
".",
"swap",
"(",
"floatArray",
",",
"i",
",",
"swapPlace",
")",
";",
"}",
"}"
] |
Randomly shuffle an float array
@param floatArray array of floats to shuffle.
|
[
"Randomly",
"shuffle",
"an",
"float",
"array"
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java#L78-L85
|
152,170
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java
|
FYShuffle.shuffle
|
public static void shuffle(byte[] byteArray) {
int swapPlace = -1;
for(int i = 0; i < byteArray.length; i++) {
swapPlace = (int) (Math.random() * (byteArray.length - 1 ));
XORSwap.swap(byteArray, i, swapPlace);
}
}
|
java
|
public static void shuffle(byte[] byteArray) {
int swapPlace = -1;
for(int i = 0; i < byteArray.length; i++) {
swapPlace = (int) (Math.random() * (byteArray.length - 1 ));
XORSwap.swap(byteArray, i, swapPlace);
}
}
|
[
"public",
"static",
"void",
"shuffle",
"(",
"byte",
"[",
"]",
"byteArray",
")",
"{",
"int",
"swapPlace",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"byteArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"swapPlace",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"byteArray",
".",
"length",
"-",
"1",
")",
")",
";",
"XORSwap",
".",
"swap",
"(",
"byteArray",
",",
"i",
",",
"swapPlace",
")",
";",
"}",
"}"
] |
Randomly shuffle an byte array
@param byteArray array of bytes to shuffle.
|
[
"Randomly",
"shuffle",
"an",
"byte",
"array"
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java#L92-L99
|
152,171
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java
|
FYShuffle.shuffle
|
public static void shuffle(short[] shortArray) {
int swapPlace = -1;
for(int i = 0; i < shortArray.length; i++) {
swapPlace = (int) (Math.random() * (shortArray.length - 1 ));
XORSwap.swap(shortArray, i, swapPlace);
}
}
|
java
|
public static void shuffle(short[] shortArray) {
int swapPlace = -1;
for(int i = 0; i < shortArray.length; i++) {
swapPlace = (int) (Math.random() * (shortArray.length - 1 ));
XORSwap.swap(shortArray, i, swapPlace);
}
}
|
[
"public",
"static",
"void",
"shuffle",
"(",
"short",
"[",
"]",
"shortArray",
")",
"{",
"int",
"swapPlace",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"shortArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"swapPlace",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"shortArray",
".",
"length",
"-",
"1",
")",
")",
";",
"XORSwap",
".",
"swap",
"(",
"shortArray",
",",
"i",
",",
"swapPlace",
")",
";",
"}",
"}"
] |
Randomly shuffle an short array
@param shortArray array of short to shuffle.
|
[
"Randomly",
"shuffle",
"an",
"short",
"array"
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java#L106-L113
|
152,172
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java
|
FYShuffle.shuffle
|
public static void shuffle(long[] longArray) {
int swapPlace = -1;
for(int i = 0; i < longArray.length; i++) {
swapPlace = (int) (Math.random() * (longArray.length - 1 ));
XORSwap.swap(longArray, i, swapPlace);
}
}
|
java
|
public static void shuffle(long[] longArray) {
int swapPlace = -1;
for(int i = 0; i < longArray.length; i++) {
swapPlace = (int) (Math.random() * (longArray.length - 1 ));
XORSwap.swap(longArray, i, swapPlace);
}
}
|
[
"public",
"static",
"void",
"shuffle",
"(",
"long",
"[",
"]",
"longArray",
")",
"{",
"int",
"swapPlace",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"longArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"swapPlace",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"longArray",
".",
"length",
"-",
"1",
")",
")",
";",
"XORSwap",
".",
"swap",
"(",
"longArray",
",",
"i",
",",
"swapPlace",
")",
";",
"}",
"}"
] |
Randomly shuffle an long array
@param longArray array of long to shuffle.
|
[
"Randomly",
"shuffle",
"an",
"long",
"array"
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java#L120-L127
|
152,173
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java
|
FYShuffle.shuffle
|
public static void shuffle(double[] doubleArray) {
int swapPlace = -1;
for(int i = 0; i < doubleArray.length; i++) {
swapPlace = (int) (Math.random() * (doubleArray.length - 1 ));
TrivialSwap.swap(doubleArray, i, swapPlace);
}
}
|
java
|
public static void shuffle(double[] doubleArray) {
int swapPlace = -1;
for(int i = 0; i < doubleArray.length; i++) {
swapPlace = (int) (Math.random() * (doubleArray.length - 1 ));
TrivialSwap.swap(doubleArray, i, swapPlace);
}
}
|
[
"public",
"static",
"void",
"shuffle",
"(",
"double",
"[",
"]",
"doubleArray",
")",
"{",
"int",
"swapPlace",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"doubleArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"swapPlace",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"doubleArray",
".",
"length",
"-",
"1",
")",
")",
";",
"TrivialSwap",
".",
"swap",
"(",
"doubleArray",
",",
"i",
",",
"swapPlace",
")",
";",
"}",
"}"
] |
Randomly shuffle a double array
@param doubleArray array of double to shuffle.
|
[
"Randomly",
"shuffle",
"a",
"double",
"array"
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java#L134-L141
|
152,174
|
mijecu25/dsa
|
src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java
|
FYShuffle.shuffle
|
public static void shuffle(char[] charArray) {
int swapPlace = -1;
for(int i = 0; i < charArray.length; i++) {
swapPlace = (int) (Math.random() * (charArray.length - 1 ));
XORSwap.swap(charArray, i, swapPlace);
}
}
|
java
|
public static void shuffle(char[] charArray) {
int swapPlace = -1;
for(int i = 0; i < charArray.length; i++) {
swapPlace = (int) (Math.random() * (charArray.length - 1 ));
XORSwap.swap(charArray, i, swapPlace);
}
}
|
[
"public",
"static",
"void",
"shuffle",
"(",
"char",
"[",
"]",
"charArray",
")",
"{",
"int",
"swapPlace",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"charArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"swapPlace",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"charArray",
".",
"length",
"-",
"1",
")",
")",
";",
"XORSwap",
".",
"swap",
"(",
"charArray",
",",
"i",
",",
"swapPlace",
")",
";",
"}",
"}"
] |
Randomly shuffle a char array
@param charArray array of char to shuffle.
|
[
"Randomly",
"shuffle",
"a",
"char",
"array"
] |
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
|
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/shuffle/linear/FYShuffle.java#L148-L155
|
152,175
|
js-lib-com/transaction.hibernate
|
src/main/java/js/transaction/hibernate/HibernateAdapter.java
|
HibernateAdapter.destroy
|
public void destroy()
{
log.debug("Close Hibernate session factory and releases caches and database connections.");
// access session factory through getter to have validity check
SessionFactory sessionFactory = getSessionFactory();
if(sessionFactory != null) {
sessionFactory.close();
}
}
|
java
|
public void destroy()
{
log.debug("Close Hibernate session factory and releases caches and database connections.");
// access session factory through getter to have validity check
SessionFactory sessionFactory = getSessionFactory();
if(sessionFactory != null) {
sessionFactory.close();
}
}
|
[
"public",
"void",
"destroy",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"Close Hibernate session factory and releases caches and database connections.\"",
")",
";",
"// access session factory through getter to have validity check\r",
"SessionFactory",
"sessionFactory",
"=",
"getSessionFactory",
"(",
")",
";",
"if",
"(",
"sessionFactory",
"!=",
"null",
")",
"{",
"sessionFactory",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
Destroy Hibernate session factory and releases database resources.
|
[
"Destroy",
"Hibernate",
"session",
"factory",
"and",
"releases",
"database",
"resources",
"."
] |
3aaafa6fa573f27733e6edaef3a4b2cf97cf67d6
|
https://github.com/js-lib-com/transaction.hibernate/blob/3aaafa6fa573f27733e6edaef3a4b2cf97cf67d6/src/main/java/js/transaction/hibernate/HibernateAdapter.java#L230-L238
|
152,176
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/code/PropertyDispatcher.java
|
PropertyDispatcher.addObserver
|
public void addObserver(PropertySetter observer, String... properties)
{
try
{
semaphore.acquire();
}
catch (InterruptedException ex)
{
throw new IllegalArgumentException(ex);
}
try
{
addObserver(observer);
for (String p : properties)
{
observers.addObserver(p, observer);
}
}
finally
{
semaphore.release();
}
}
|
java
|
public void addObserver(PropertySetter observer, String... properties)
{
try
{
semaphore.acquire();
}
catch (InterruptedException ex)
{
throw new IllegalArgumentException(ex);
}
try
{
addObserver(observer);
for (String p : properties)
{
observers.addObserver(p, observer);
}
}
finally
{
semaphore.release();
}
}
|
[
"public",
"void",
"addObserver",
"(",
"PropertySetter",
"observer",
",",
"String",
"...",
"properties",
")",
"{",
"try",
"{",
"semaphore",
".",
"acquire",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"ex",
")",
";",
"}",
"try",
"{",
"addObserver",
"(",
"observer",
")",
";",
"for",
"(",
"String",
"p",
":",
"properties",
")",
"{",
"observers",
".",
"addObserver",
"(",
"p",
",",
"observer",
")",
";",
"}",
"}",
"finally",
"{",
"semaphore",
".",
"release",
"(",
")",
";",
"}",
"}"
] |
Adds a PropertySetter observer for properties.
@param observer
@param properties
|
[
"Adds",
"a",
"PropertySetter",
"observer",
"for",
"properties",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/code/PropertyDispatcher.java#L104-L126
|
152,177
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/FieldReSelectHandler.java
|
FieldReSelectHandler.fieldChanged
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
if (m_gridScreen != null)
m_gridScreen.reSelectRecords();
if (m_sPopupBox != null)
m_sPopupBox.reSelectRecords();
return DBConstants.NORMAL_RETURN;
}
|
java
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
if (m_gridScreen != null)
m_gridScreen.reSelectRecords();
if (m_sPopupBox != null)
m_sPopupBox.reSelectRecords();
return DBConstants.NORMAL_RETURN;
}
|
[
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"m_gridScreen",
"!=",
"null",
")",
"m_gridScreen",
".",
"reSelectRecords",
"(",
")",
";",
"if",
"(",
"m_sPopupBox",
"!=",
"null",
")",
"m_sPopupBox",
".",
"reSelectRecords",
"(",
")",
";",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"}"
] |
The Field has Changed.
Reselect the grid screen.
@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).
Reselect the records.
|
[
"The",
"Field",
"has",
"Changed",
".",
"Reselect",
"the",
"grid",
"screen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/FieldReSelectHandler.java#L103-L110
|
152,178
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/CubicBezierCurve.java
|
CubicBezierCurve.eval
|
public Point eval(double t, AbstractPoint p)
{
if (t < 0 || t > 1)
{
throw new IllegalArgumentException("t="+t+" not in [0,1]");
}
p.set(0, 0);
double c0 = Math.pow(1-t, 3);
double c1 = 3*Math.pow(1-t, 2)*t;
double c2 = 3*(1-t)*t*t;
double c3 = t*t*t;
p.add(c0*P[start].getX(), c0*P[start].getY());
p.add(c1*P[start+1].getX(), c1*P[start+1].getY());
p.add(c2*P[start+2].getX(), c2*P[start+2].getY());
p.add(c3*P[start+3].getX(), c3*P[start+3].getY());
return p;
}
|
java
|
public Point eval(double t, AbstractPoint p)
{
if (t < 0 || t > 1)
{
throw new IllegalArgumentException("t="+t+" not in [0,1]");
}
p.set(0, 0);
double c0 = Math.pow(1-t, 3);
double c1 = 3*Math.pow(1-t, 2)*t;
double c2 = 3*(1-t)*t*t;
double c3 = t*t*t;
p.add(c0*P[start].getX(), c0*P[start].getY());
p.add(c1*P[start+1].getX(), c1*P[start+1].getY());
p.add(c2*P[start+2].getX(), c2*P[start+2].getY());
p.add(c3*P[start+3].getX(), c3*P[start+3].getY());
return p;
}
|
[
"public",
"Point",
"eval",
"(",
"double",
"t",
",",
"AbstractPoint",
"p",
")",
"{",
"if",
"(",
"t",
"<",
"0",
"||",
"t",
">",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"t=\"",
"+",
"t",
"+",
"\" not in [0,1]\"",
")",
";",
"}",
"p",
".",
"set",
"(",
"0",
",",
"0",
")",
";",
"double",
"c0",
"=",
"Math",
".",
"pow",
"(",
"1",
"-",
"t",
",",
"3",
")",
";",
"double",
"c1",
"=",
"3",
"*",
"Math",
".",
"pow",
"(",
"1",
"-",
"t",
",",
"2",
")",
"*",
"t",
";",
"double",
"c2",
"=",
"3",
"*",
"(",
"1",
"-",
"t",
")",
"*",
"t",
"*",
"t",
";",
"double",
"c3",
"=",
"t",
"*",
"t",
"*",
"t",
";",
"p",
".",
"add",
"(",
"c0",
"*",
"P",
"[",
"start",
"]",
".",
"getX",
"(",
")",
",",
"c0",
"*",
"P",
"[",
"start",
"]",
".",
"getY",
"(",
")",
")",
";",
"p",
".",
"add",
"(",
"c1",
"*",
"P",
"[",
"start",
"+",
"1",
"]",
".",
"getX",
"(",
")",
",",
"c1",
"*",
"P",
"[",
"start",
"+",
"1",
"]",
".",
"getY",
"(",
")",
")",
";",
"p",
".",
"add",
"(",
"c2",
"*",
"P",
"[",
"start",
"+",
"2",
"]",
".",
"getX",
"(",
")",
",",
"c2",
"*",
"P",
"[",
"start",
"+",
"2",
"]",
".",
"getY",
"(",
")",
")",
";",
"p",
".",
"add",
"(",
"c3",
"*",
"P",
"[",
"start",
"+",
"3",
"]",
".",
"getX",
"(",
")",
",",
"c3",
"*",
"P",
"[",
"start",
"+",
"3",
"]",
".",
"getY",
"(",
")",
")",
";",
"return",
"p",
";",
"}"
] |
Evaluates point in Bezier Curve. Returned Point is the same as given in
parameter p.
@param t
@param p
@return
|
[
"Evaluates",
"point",
"in",
"Bezier",
"Curve",
".",
"Returned",
"Point",
"is",
"the",
"same",
"as",
"given",
"in",
"parameter",
"p",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CubicBezierCurve.java#L82-L98
|
152,179
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/CubicBezierCurve.java
|
CubicBezierCurve.curveStart
|
public void curveStart()
{
double d0 = AbstractPoint.angle(P[start], P[start+3]); // P0 -> P3
double d1 = AbstractPoint.angle(P[start+3], P[start]); // P3 -> P0
double d2 = AbstractPoint.angle(P[start+3], P[start+2]); // P3 -> P2
double a1 = d1 - d2;
double a2 = d0 + a1;
double di = AbstractPoint.distance(P[start+3], P[start+2]);
P[start+1] = AbstractPoint.move(P[start], a2, di);
}
|
java
|
public void curveStart()
{
double d0 = AbstractPoint.angle(P[start], P[start+3]); // P0 -> P3
double d1 = AbstractPoint.angle(P[start+3], P[start]); // P3 -> P0
double d2 = AbstractPoint.angle(P[start+3], P[start+2]); // P3 -> P2
double a1 = d1 - d2;
double a2 = d0 + a1;
double di = AbstractPoint.distance(P[start+3], P[start+2]);
P[start+1] = AbstractPoint.move(P[start], a2, di);
}
|
[
"public",
"void",
"curveStart",
"(",
")",
"{",
"double",
"d0",
"=",
"AbstractPoint",
".",
"angle",
"(",
"P",
"[",
"start",
"]",
",",
"P",
"[",
"start",
"+",
"3",
"]",
")",
";",
"// P0 -> P3\r",
"double",
"d1",
"=",
"AbstractPoint",
".",
"angle",
"(",
"P",
"[",
"start",
"+",
"3",
"]",
",",
"P",
"[",
"start",
"]",
")",
";",
"// P3 -> P0\r",
"double",
"d2",
"=",
"AbstractPoint",
".",
"angle",
"(",
"P",
"[",
"start",
"+",
"3",
"]",
",",
"P",
"[",
"start",
"+",
"2",
"]",
")",
";",
"// P3 -> P2\r",
"double",
"a1",
"=",
"d1",
"-",
"d2",
";",
"double",
"a2",
"=",
"d0",
"+",
"a1",
";",
"double",
"di",
"=",
"AbstractPoint",
".",
"distance",
"(",
"P",
"[",
"start",
"+",
"3",
"]",
",",
"P",
"[",
"start",
"+",
"2",
"]",
")",
";",
"P",
"[",
"start",
"+",
"1",
"]",
"=",
"AbstractPoint",
".",
"move",
"(",
"P",
"[",
"start",
"]",
",",
"a2",
",",
"di",
")",
";",
"}"
] |
Experimental! makes the start curve like the end
|
[
"Experimental!",
"makes",
"the",
"start",
"curve",
"like",
"the",
"end"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CubicBezierCurve.java#L115-L124
|
152,180
|
meridor/stecker
|
stecker-plugin-loader/src/main/java/org/meridor/stecker/PluginLoader.java
|
PluginLoader.withPluginDirectory
|
public static PluginLoader withPluginDirectory(Path pluginsDirectory) throws PluginException {
if (pluginsDirectory == null) {
throw new PluginException("Plugins directory can't be null");
}
return new PluginLoader(pluginsDirectory);
}
|
java
|
public static PluginLoader withPluginDirectory(Path pluginsDirectory) throws PluginException {
if (pluginsDirectory == null) {
throw new PluginException("Plugins directory can't be null");
}
return new PluginLoader(pluginsDirectory);
}
|
[
"public",
"static",
"PluginLoader",
"withPluginDirectory",
"(",
"Path",
"pluginsDirectory",
")",
"throws",
"PluginException",
"{",
"if",
"(",
"pluginsDirectory",
"==",
"null",
")",
"{",
"throw",
"new",
"PluginException",
"(",
"\"Plugins directory can't be null\"",
")",
";",
"}",
"return",
"new",
"PluginLoader",
"(",
"pluginsDirectory",
")",
";",
"}"
] |
Define the directory to search for plugins
@param pluginsDirectory directory containing plugins
@return this
@throws org.meridor.stecker.PluginException when plugins directory is null
|
[
"Define",
"the",
"directory",
"to",
"search",
"for",
"plugins"
] |
4c41a24513339d71d7f581691ae627870816e80e
|
https://github.com/meridor/stecker/blob/4c41a24513339d71d7f581691ae627870816e80e/stecker-plugin-loader/src/main/java/org/meridor/stecker/PluginLoader.java#L58-L63
|
152,181
|
meridor/stecker
|
stecker-plugin-loader/src/main/java/org/meridor/stecker/PluginLoader.java
|
PluginLoader.withExtensionPoints
|
public PluginLoader withExtensionPoints(Class... extensionPoints) {
this.extensionPoints.addAll(
Stream.of(extensionPoints)
.distinct()
.collect(Collectors.<Class>toList())
);
return this;
}
|
java
|
public PluginLoader withExtensionPoints(Class... extensionPoints) {
this.extensionPoints.addAll(
Stream.of(extensionPoints)
.distinct()
.collect(Collectors.<Class>toList())
);
return this;
}
|
[
"public",
"PluginLoader",
"withExtensionPoints",
"(",
"Class",
"...",
"extensionPoints",
")",
"{",
"this",
".",
"extensionPoints",
".",
"addAll",
"(",
"Stream",
".",
"of",
"(",
"extensionPoints",
")",
".",
"distinct",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"<",
"Class",
">",
"toList",
"(",
")",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Define extension points to be considered by this loader
@param extensionPoints a list of extension point classes
@return this
|
[
"Define",
"extension",
"points",
"to",
"be",
"considered",
"by",
"this",
"loader"
] |
4c41a24513339d71d7f581691ae627870816e80e
|
https://github.com/meridor/stecker/blob/4c41a24513339d71d7f581691ae627870816e80e/stecker-plugin-loader/src/main/java/org/meridor/stecker/PluginLoader.java#L104-L111
|
152,182
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.vitals/src/main/java/org/carewebframework/vista/plugin/vitals/EntryController.java
|
EntryController.pending
|
@Override
public String pending(boolean silent) {
if (modified && !warned) {
if (silent || !PromptDialog.confirm(TX_PROMPT)) {
return "Vital entry in progress.";
}
}
return null;
}
|
java
|
@Override
public String pending(boolean silent) {
if (modified && !warned) {
if (silent || !PromptDialog.confirm(TX_PROMPT)) {
return "Vital entry in progress.";
}
}
return null;
}
|
[
"@",
"Override",
"public",
"String",
"pending",
"(",
"boolean",
"silent",
")",
"{",
"if",
"(",
"modified",
"&&",
"!",
"warned",
")",
"{",
"if",
"(",
"silent",
"||",
"!",
"PromptDialog",
".",
"confirm",
"(",
"TX_PROMPT",
")",
")",
"{",
"return",
"\"Vital entry in progress.\"",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Called when a patient context change has been requested.
@param silent = If true, user interaction is not permitted.
|
[
"Called",
"when",
"a",
"patient",
"context",
"change",
"has",
"been",
"requested",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.vitals/src/main/java/org/carewebframework/vista/plugin/vitals/EntryController.java#L501-L510
|
152,183
|
jbundle/jbundle
|
app/program/project/src/main/java/org/jbundle/app/program/project/report/NameIndentConverter.java
|
NameIndentConverter.getString
|
public String getString()
{
String string = super.getString();
int iIndent = (int)m_convIndent.getValue();
string = gstrSpaces.substring(0, iIndent * m_iIndentAmount) + string;
return string;
}
|
java
|
public String getString()
{
String string = super.getString();
int iIndent = (int)m_convIndent.getValue();
string = gstrSpaces.substring(0, iIndent * m_iIndentAmount) + string;
return string;
}
|
[
"public",
"String",
"getString",
"(",
")",
"{",
"String",
"string",
"=",
"super",
".",
"getString",
"(",
")",
";",
"int",
"iIndent",
"=",
"(",
"int",
")",
"m_convIndent",
".",
"getValue",
"(",
")",
";",
"string",
"=",
"gstrSpaces",
".",
"substring",
"(",
"0",
",",
"iIndent",
"*",
"m_iIndentAmount",
")",
"+",
"string",
";",
"return",
"string",
";",
"}"
] |
GetString Method.
|
[
"GetString",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/project/src/main/java/org/jbundle/app/program/project/report/NameIndentConverter.java#L61-L67
|
152,184
|
mbenson/therian
|
core/src/main/java/therian/util/Positions.java
|
Positions.writeValue
|
public static <T> Consumer<T> writeValue(final Position.Writable<? super T> pos) {
return pos::setValue;
}
|
java
|
public static <T> Consumer<T> writeValue(final Position.Writable<? super T> pos) {
return pos::setValue;
}
|
[
"public",
"static",
"<",
"T",
">",
"Consumer",
"<",
"T",
">",
"writeValue",
"(",
"final",
"Position",
".",
"Writable",
"<",
"?",
"super",
"T",
">",
"pos",
")",
"{",
"return",
"pos",
"::",
"setValue",
";",
"}"
] |
Get a UnaryProcedure callback for writing a position value.
@param pos
@return UnaryProcedure
@see TherianContext#forwardTo(therian.Operation, Callback)
|
[
"Get",
"a",
"UnaryProcedure",
"callback",
"for",
"writing",
"a",
"position",
"value",
"."
] |
0653505f73e2a6f5b0abc394ea6d83af03408254
|
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/util/Positions.java#L356-L358
|
152,185
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.empty
|
public static void empty(String parameter, String name) {
if (parameter == null || !parameter.isEmpty()) {
throw new IllegalArgumentException(name + " is null or not empty.");
}
}
|
java
|
public static void empty(String parameter, String name) {
if (parameter == null || !parameter.isEmpty()) {
throw new IllegalArgumentException(name + " is null or not empty.");
}
}
|
[
"public",
"static",
"void",
"empty",
"(",
"String",
"parameter",
",",
"String",
"name",
")",
"{",
"if",
"(",
"parameter",
"==",
"null",
"||",
"!",
"parameter",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"name",
"+",
"\" is null or not empty.\"",
")",
";",
"}",
"}"
] |
Test if string parameter is strictly empty, that is, not null but empty.
@param parameter invocation string parameter,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is null or not empty.
|
[
"Test",
"if",
"string",
"parameter",
"is",
"strictly",
"empty",
"that",
"is",
"not",
"null",
"but",
"empty",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L55-L59
|
152,186
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.notEmpty
|
public static void notEmpty(String parameter, String name) throws IllegalArgumentException {
if (parameter != null && parameter.isEmpty()) {
throw new IllegalArgumentException(name + " is empty.");
}
}
|
java
|
public static void notEmpty(String parameter, String name) throws IllegalArgumentException {
if (parameter != null && parameter.isEmpty()) {
throw new IllegalArgumentException(name + " is empty.");
}
}
|
[
"public",
"static",
"void",
"notEmpty",
"(",
"String",
"parameter",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"!=",
"null",
"&&",
"parameter",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"name",
"+",
"\" is empty.\"",
")",
";",
"}",
"}"
] |
Test if string parameter is strict not empty. If parameter to test is null this test method does not rise exception.
@param parameter invocation string parameter,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is empty.
|
[
"Test",
"if",
"string",
"parameter",
"is",
"strict",
"not",
"empty",
".",
"If",
"parameter",
"to",
"test",
"is",
"null",
"this",
"test",
"method",
"does",
"not",
"rise",
"exception",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L81-L85
|
152,187
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.notNullOrEmpty
|
public static void notNullOrEmpty(String parameter, String name) throws IllegalArgumentException {
if (parameter == null || parameter.isEmpty()) {
throw new IllegalArgumentException(name + " is null or empty.");
}
}
|
java
|
public static void notNullOrEmpty(String parameter, String name) throws IllegalArgumentException {
if (parameter == null || parameter.isEmpty()) {
throw new IllegalArgumentException(name + " is null or empty.");
}
}
|
[
"public",
"static",
"void",
"notNullOrEmpty",
"(",
"String",
"parameter",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"==",
"null",
"||",
"parameter",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"name",
"+",
"\" is null or empty.\"",
")",
";",
"}",
"}"
] |
Test if string parameter is not null or empty.
@param parameter invocation string parameter,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is null or empty.
|
[
"Test",
"if",
"string",
"parameter",
"is",
"not",
"null",
"or",
"empty",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L94-L98
|
152,188
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.notNullOrEmpty
|
public static void notNullOrEmpty(File parameter, String name) throws IllegalArgumentException {
if (parameter == null || parameter.getPath().isEmpty()) {
throw new IllegalArgumentException(name + " path is null or empty.");
}
}
|
java
|
public static void notNullOrEmpty(File parameter, String name) throws IllegalArgumentException {
if (parameter == null || parameter.getPath().isEmpty()) {
throw new IllegalArgumentException(name + " path is null or empty.");
}
}
|
[
"public",
"static",
"void",
"notNullOrEmpty",
"(",
"File",
"parameter",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"==",
"null",
"||",
"parameter",
".",
"getPath",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"name",
"+",
"\" path is null or empty.\"",
")",
";",
"}",
"}"
] |
Test if file parameter is not null and has not empty path.
@param parameter invocation file parameter,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is null or its path is empty.
|
[
"Test",
"if",
"file",
"parameter",
"is",
"not",
"null",
"and",
"has",
"not",
"empty",
"path",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L107-L111
|
152,189
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.notNullOrEmpty
|
public static void notNullOrEmpty(Object[] parameter, String name) throws IllegalArgumentException {
if (parameter == null || parameter.length == 0) {
throw new IllegalArgumentException(name + " parameter is empty.");
}
}
|
java
|
public static void notNullOrEmpty(Object[] parameter, String name) throws IllegalArgumentException {
if (parameter == null || parameter.length == 0) {
throw new IllegalArgumentException(name + " parameter is empty.");
}
}
|
[
"public",
"static",
"void",
"notNullOrEmpty",
"(",
"Object",
"[",
"]",
"parameter",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"==",
"null",
"||",
"parameter",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"name",
"+",
"\" parameter is empty.\"",
")",
";",
"}",
"}"
] |
Test if array parameter is not null or empty.
@param parameter invocation array parameter,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> array is null or empty.
|
[
"Test",
"if",
"array",
"parameter",
"is",
"not",
"null",
"or",
"empty",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L120-L124
|
152,190
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.size
|
public static void size(Collection<?> parameter, int size, String name) throws IllegalArgumentException {
if (parameter.size() != size) {
throw new IllegalArgumentException(String.format("%s size is not %d.", name, size));
}
}
|
java
|
public static void size(Collection<?> parameter, int size, String name) throws IllegalArgumentException {
if (parameter.size() != size) {
throw new IllegalArgumentException(String.format("%s size is not %d.", name, size));
}
}
|
[
"public",
"static",
"void",
"size",
"(",
"Collection",
"<",
"?",
">",
"parameter",
",",
"int",
"size",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
".",
"size",
"(",
")",
"!=",
"size",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s size is not %d.\"",
",",
"name",
",",
"size",
")",
")",
";",
"}",
"}"
] |
Test if given collection size has a specified value.
@param parameter invocation collection parameters,
@param size requested size,
@param name the name of invocation parameter.
@throws IllegalArgumentException if collection has not requested size.
|
[
"Test",
"if",
"given",
"collection",
"size",
"has",
"a",
"specified",
"value",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L134-L138
|
152,191
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.size
|
public static void size(Map<?, ?> parameter, int size, String name) throws IllegalArgumentException {
if (parameter.size() != size) {
throw new IllegalArgumentException(String.format("%s size is not %d.", name, size));
}
}
|
java
|
public static void size(Map<?, ?> parameter, int size, String name) throws IllegalArgumentException {
if (parameter.size() != size) {
throw new IllegalArgumentException(String.format("%s size is not %d.", name, size));
}
}
|
[
"public",
"static",
"void",
"size",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"parameter",
",",
"int",
"size",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
".",
"size",
"(",
")",
"!=",
"size",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s size is not %d.\"",
",",
"name",
",",
"size",
")",
")",
";",
"}",
"}"
] |
Test if given map size has a specified value.
@param parameter invocation map parameters,
@param size requested size,
@param name the name of invocation parameter.
@throws IllegalArgumentException if map has not requested size.
|
[
"Test",
"if",
"given",
"map",
"size",
"has",
"a",
"specified",
"value",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L148-L152
|
152,192
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.isFile
|
public static void isFile(File parameter, String name) throws IllegalArgumentException {
if (parameter == null || !parameter.exists() || parameter.isDirectory()) {
throw new IllegalArgumentException(String.format("%s |%s| is missing or is a directory.", name, parameter.getAbsolutePath()));
}
}
|
java
|
public static void isFile(File parameter, String name) throws IllegalArgumentException {
if (parameter == null || !parameter.exists() || parameter.isDirectory()) {
throw new IllegalArgumentException(String.format("%s |%s| is missing or is a directory.", name, parameter.getAbsolutePath()));
}
}
|
[
"public",
"static",
"void",
"isFile",
"(",
"File",
"parameter",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"==",
"null",
"||",
"!",
"parameter",
".",
"exists",
"(",
")",
"||",
"parameter",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s |%s| is missing or is a directory.\"",
",",
"name",
",",
"parameter",
".",
"getAbsolutePath",
"(",
")",
")",
")",
";",
"}",
"}"
] |
Check if file parameter is an existing ordinary file, not a directory. This validator throws illegal argument if given
file does not exist or is not an ordinary file.
@param parameter invocation file parameter,
@param name parameter name.
@throws IllegalArgumentException if <code>parameter</code> file is null or does not exist or is a directory.
|
[
"Check",
"if",
"file",
"parameter",
"is",
"an",
"existing",
"ordinary",
"file",
"not",
"a",
"directory",
".",
"This",
"validator",
"throws",
"illegal",
"argument",
"if",
"given",
"file",
"does",
"not",
"exist",
"or",
"is",
"not",
"an",
"ordinary",
"file",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L176-L180
|
152,193
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.range
|
public static void range(double parameter, double lowEndpoint, double highEndpoint, String name) throws IllegalArgumentException {
if (lowEndpoint > parameter || parameter > highEndpoint) {
throw new IllegalArgumentException(String.format("%s parameter is not in range [%d, %d].", name, lowEndpoint, highEndpoint));
}
}
|
java
|
public static void range(double parameter, double lowEndpoint, double highEndpoint, String name) throws IllegalArgumentException {
if (lowEndpoint > parameter || parameter > highEndpoint) {
throw new IllegalArgumentException(String.format("%s parameter is not in range [%d, %d].", name, lowEndpoint, highEndpoint));
}
}
|
[
"public",
"static",
"void",
"range",
"(",
"double",
"parameter",
",",
"double",
"lowEndpoint",
",",
"double",
"highEndpoint",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"lowEndpoint",
">",
"parameter",
"||",
"parameter",
">",
"highEndpoint",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s parameter is not in range [%d, %d].\"",
",",
"name",
",",
"lowEndpoint",
",",
"highEndpoint",
")",
")",
";",
"}",
"}"
] |
Test if numeric parameter is in a given range. Parameter is considered in range if is greater or equal with lower
endpoint and smaller or equal higher endpoint.
@param parameter invocation numeric parameter,
@param lowEndpoint range lower endpoint,
@param highEndpoint range higher endpoint,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is not in range.
|
[
"Test",
"if",
"numeric",
"parameter",
"is",
"in",
"a",
"given",
"range",
".",
"Parameter",
"is",
"considered",
"in",
"range",
"if",
"is",
"greater",
"or",
"equal",
"with",
"lower",
"endpoint",
"and",
"smaller",
"or",
"equal",
"higher",
"endpoint",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L223-L227
|
152,194
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.EQ
|
public static void EQ(long parameter, long expected, String name) throws IllegalArgumentException {
if (parameter != expected) {
throw new IllegalArgumentException(String.format("%s is not %d.", name, expected));
}
}
|
java
|
public static void EQ(long parameter, long expected, String name) throws IllegalArgumentException {
if (parameter != expected) {
throw new IllegalArgumentException(String.format("%s is not %d.", name, expected));
}
}
|
[
"public",
"static",
"void",
"EQ",
"(",
"long",
"parameter",
",",
"long",
"expected",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"!=",
"expected",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s is not %d.\"",
",",
"name",
",",
"expected",
")",
")",
";",
"}",
"}"
] |
Test if numeric parameter has expected value.
@param parameter invocation numeric parameter,
@param expected expected value,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> has not expected value.
|
[
"Test",
"if",
"numeric",
"parameter",
"has",
"expected",
"value",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L289-L293
|
152,195
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.GT
|
public static void GT(long parameter, long value, String name) throws IllegalArgumentException {
if (parameter <= value) {
throw new IllegalArgumentException(String.format("%s is not greater than %d.", name, value));
}
}
|
java
|
public static void GT(long parameter, long value, String name) throws IllegalArgumentException {
if (parameter <= value) {
throw new IllegalArgumentException(String.format("%s is not greater than %d.", name, value));
}
}
|
[
"public",
"static",
"void",
"GT",
"(",
"long",
"parameter",
",",
"long",
"value",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"<=",
"value",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s is not greater than %d.\"",
",",
"name",
",",
"value",
")",
")",
";",
"}",
"}"
] |
Test if numeric parameter is strictly greater than given threshold value.
@param parameter invocation numeric parameter,
@param value threshold value,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is not greater than threshold value.
|
[
"Test",
"if",
"numeric",
"parameter",
"is",
"strictly",
"greater",
"than",
"given",
"threshold",
"value",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L345-L349
|
152,196
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.GT
|
public static void GT(char parameter, char expected, String name) throws IllegalArgumentException {
if (parameter <= expected) {
throw new IllegalArgumentException(String.format("%s is not greater than %c.", name, expected));
}
}
|
java
|
public static void GT(char parameter, char expected, String name) throws IllegalArgumentException {
if (parameter <= expected) {
throw new IllegalArgumentException(String.format("%s is not greater than %c.", name, expected));
}
}
|
[
"public",
"static",
"void",
"GT",
"(",
"char",
"parameter",
",",
"char",
"expected",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"<=",
"expected",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s is not greater than %c.\"",
",",
"name",
",",
"expected",
")",
")",
";",
"}",
"}"
] |
Test if character parameter is strictly greater than given character value.
@param parameter invocation character parameter,
@param expected expected character value,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is not greater than threshold character.
|
[
"Test",
"if",
"character",
"parameter",
"is",
"strictly",
"greater",
"than",
"given",
"character",
"value",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L373-L377
|
152,197
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.GTE
|
public static void GTE(long parameter, long value, String name) throws IllegalArgumentException {
if (parameter < value) {
throw new IllegalArgumentException(String.format("%s is not greater than or equal %d.", name, value));
}
}
|
java
|
public static void GTE(long parameter, long value, String name) throws IllegalArgumentException {
if (parameter < value) {
throw new IllegalArgumentException(String.format("%s is not greater than or equal %d.", name, value));
}
}
|
[
"public",
"static",
"void",
"GTE",
"(",
"long",
"parameter",
",",
"long",
"value",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"<",
"value",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s is not greater than or equal %d.\"",
",",
"name",
",",
"value",
")",
")",
";",
"}",
"}"
] |
Test if numeric parameter is greater than or equal to given threshold value.
@param parameter invocation numeric parameter,
@param value threshold value,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is not greater than or equal to threshold value.
|
[
"Test",
"if",
"numeric",
"parameter",
"is",
"greater",
"than",
"or",
"equal",
"to",
"given",
"threshold",
"value",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L387-L391
|
152,198
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.LT
|
public static void LT(char parameter, char value, String name) throws IllegalArgumentException {
if (parameter >= value) {
throw new IllegalArgumentException(String.format("%s is not less than %c.", name, value));
}
}
|
java
|
public static void LT(char parameter, char value, String name) throws IllegalArgumentException {
if (parameter >= value) {
throw new IllegalArgumentException(String.format("%s is not less than %c.", name, value));
}
}
|
[
"public",
"static",
"void",
"LT",
"(",
"char",
"parameter",
",",
"char",
"value",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
">=",
"value",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s is not less than %c.\"",
",",
"name",
",",
"value",
")",
")",
";",
"}",
"}"
] |
Test if character parameter is strictly less than given character value.
@param parameter invocation character parameter,
@param value threshold value,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is not less than character value.
|
[
"Test",
"if",
"character",
"parameter",
"is",
"strictly",
"less",
"than",
"given",
"character",
"value",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L457-L461
|
152,199
|
js-lib-com/commons
|
src/main/java/js/util/Params.java
|
Params.LTE
|
public static void LTE(long parameter, long value, String name) throws IllegalArgumentException {
if (parameter > value) {
throw new IllegalArgumentException(String.format("%s is not less than or equal %d.", name, value));
}
}
|
java
|
public static void LTE(long parameter, long value, String name) throws IllegalArgumentException {
if (parameter > value) {
throw new IllegalArgumentException(String.format("%s is not less than or equal %d.", name, value));
}
}
|
[
"public",
"static",
"void",
"LTE",
"(",
"long",
"parameter",
",",
"long",
"value",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
">",
"value",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s is not less than or equal %d.\"",
",",
"name",
",",
"value",
")",
")",
";",
"}",
"}"
] |
Test if numeric parameter is less than or equal to given threshold value.
@param parameter invocation numeric parameter,
@param value threshold value,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is not less than or equal to threshold value.
|
[
"Test",
"if",
"numeric",
"parameter",
"is",
"less",
"than",
"or",
"equal",
"to",
"given",
"threshold",
"value",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L471-L475
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.