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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
151,500 | jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java | HBasePanel.printHtmlHeader | public void printHtmlHeader(PrintWriter out, String strTitle, String strHTMLStart, String strHTMLEnd)
{
if ((strHTMLStart == null) || (strHTMLStart.length() == 0))
strHTMLStart = "<html>\n" +
"<head>\n" +
"<link rel=\"stylesheet\" type=\"text/css\" href=\"org/jbundle/res/docs/styles/css/style.css\" title=\"basicstyle\">";
out.println(strHTMLStart);
String strStyleParam = this.getProperty("style"); // Menu page
if (strStyleParam != null) if (strStyleParam.length() > 0)
{ // Include style
out.println("<style type=\"text/css\">");
out.println("<!--");
out.println("@import url(\"org/jbundle/res/docs/styles/css/" + strStyleParam + ".css\");");
out.println("-->");
out.println("</style>");
}
String strParamTitle = this.getProperty("title"); // Menu page
if (strParamTitle != null) if (strParamTitle.length() > 0)
strTitle = strParamTitle;
if (strTitle.length() == 0)
strTitle = " ";
if ((strHTMLEnd == null) || (strHTMLEnd.length() == 0))
strHTMLEnd = "<title>" + HtmlConstants.TITLE_TAG + "</title>\n" +
"</head>\n" +
"<body>\n" +
"<h1>" + HtmlConstants.TITLE_TAG + "</h1>";
strHTMLEnd = Utility.replace(strHTMLEnd, HtmlConstants.TITLE_TAG, strTitle);
String strKeywords = this.getHtmlKeywords();
if ((strKeywords != null) && (strKeywords.length() > 0))
strKeywords += ", ";
strHTMLEnd = Utility.replace(strHTMLEnd, "<keywords/>", strKeywords);
String strMenudesc = this.getHtmlMenudesc();
strHTMLEnd = Utility.replace(strHTMLEnd, HtmlConstants.MENU_DESC_TAG, strMenudesc);
out.println(strHTMLEnd);
} | java | public void printHtmlHeader(PrintWriter out, String strTitle, String strHTMLStart, String strHTMLEnd)
{
if ((strHTMLStart == null) || (strHTMLStart.length() == 0))
strHTMLStart = "<html>\n" +
"<head>\n" +
"<link rel=\"stylesheet\" type=\"text/css\" href=\"org/jbundle/res/docs/styles/css/style.css\" title=\"basicstyle\">";
out.println(strHTMLStart);
String strStyleParam = this.getProperty("style"); // Menu page
if (strStyleParam != null) if (strStyleParam.length() > 0)
{ // Include style
out.println("<style type=\"text/css\">");
out.println("<!--");
out.println("@import url(\"org/jbundle/res/docs/styles/css/" + strStyleParam + ".css\");");
out.println("-->");
out.println("</style>");
}
String strParamTitle = this.getProperty("title"); // Menu page
if (strParamTitle != null) if (strParamTitle.length() > 0)
strTitle = strParamTitle;
if (strTitle.length() == 0)
strTitle = " ";
if ((strHTMLEnd == null) || (strHTMLEnd.length() == 0))
strHTMLEnd = "<title>" + HtmlConstants.TITLE_TAG + "</title>\n" +
"</head>\n" +
"<body>\n" +
"<h1>" + HtmlConstants.TITLE_TAG + "</h1>";
strHTMLEnd = Utility.replace(strHTMLEnd, HtmlConstants.TITLE_TAG, strTitle);
String strKeywords = this.getHtmlKeywords();
if ((strKeywords != null) && (strKeywords.length() > 0))
strKeywords += ", ";
strHTMLEnd = Utility.replace(strHTMLEnd, "<keywords/>", strKeywords);
String strMenudesc = this.getHtmlMenudesc();
strHTMLEnd = Utility.replace(strHTMLEnd, HtmlConstants.MENU_DESC_TAG, strMenudesc);
out.println(strHTMLEnd);
} | [
"public",
"void",
"printHtmlHeader",
"(",
"PrintWriter",
"out",
",",
"String",
"strTitle",
",",
"String",
"strHTMLStart",
",",
"String",
"strHTMLEnd",
")",
"{",
"if",
"(",
"(",
"strHTMLStart",
"==",
"null",
")",
"||",
"(",
"strHTMLStart",
".",
"length",
"(",... | Default Form Header.
@param out The html out stream.
@param strTitle The screen title.
@param strHTMLStart The start HTML.
@param strHTMLEnd The ending HTML. | [
"Default",
"Form",
"Header",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L466-L500 |
151,501 | jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java | HBasePanel.writeHtmlString | public void writeHtmlString(String strHTML, PrintWriter out)
{
int iIndex;
if (strHTML == null)
return;
while ((iIndex = strHTML.indexOf(HtmlConstants.TITLE_TAG)) != -1)
{ // ** FIX THIS to look for a <xxx/> and look up the token **
strHTML = strHTML.substring(0, iIndex) + ((BasePanel)this.getScreenField()).getTitle() + strHTML.substring(iIndex + HtmlConstants.TITLE_TAG.length());
}
out.println(strHTML);
} | java | public void writeHtmlString(String strHTML, PrintWriter out)
{
int iIndex;
if (strHTML == null)
return;
while ((iIndex = strHTML.indexOf(HtmlConstants.TITLE_TAG)) != -1)
{ // ** FIX THIS to look for a <xxx/> and look up the token **
strHTML = strHTML.substring(0, iIndex) + ((BasePanel)this.getScreenField()).getTitle() + strHTML.substring(iIndex + HtmlConstants.TITLE_TAG.length());
}
out.println(strHTML);
} | [
"public",
"void",
"writeHtmlString",
"(",
"String",
"strHTML",
",",
"PrintWriter",
"out",
")",
"{",
"int",
"iIndex",
";",
"if",
"(",
"strHTML",
"==",
"null",
")",
"return",
";",
"while",
"(",
"(",
"iIndex",
"=",
"strHTML",
".",
"indexOf",
"(",
"HtmlConst... | Parse the HTML for variables and print it.
@param strHTML the html string to output.
@param out The html out stream. | [
"Parse",
"the",
"HTML",
"for",
"variables",
"and",
"print",
"it",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L610-L620 |
151,502 | tvesalainen/util | util/src/main/java/org/vesalainen/io/CompressedOutput.java | CompressedOutput.write | public float write() throws IOException
{
bitArray.setAll(false);
for (int ii=0;ii<bytes;ii++)
{
bitArray.set(ii, bb1.get(ii) != bb2.get(ii));
}
if (!bitArray.any())
{
return 0;
}
if (!bitArray.and(selfImportantArray))
{
return 0;
}
if (writeCount == 0)
{
DataOutputStream dos = new DataOutputStream(out);
dos.writeUTF(source);
dos.writeShort(properties.size());
List<Property> props = new ArrayList<>(properties.values());
props.sort(null);
for (Property prop : props)
{
dos.writeUTF(prop.getName());
dos.writeUTF(prop.getType());
}
dos.writeLong(uuid.getMostSignificantBits());
dos.writeLong(uuid.getLeastSignificantBits());
}
out.write(bits);
int cnt = 0;
for (int ii=0;ii<bytes;ii++)
{
if (bitArray.isSet(ii))
{
byte b = bb2.get(ii);
out.write(b);
bb1.put(ii, b);
cnt++;
writeBytes++;
}
}
writeCount++;
return (float)cnt/(float)bytes;
} | java | public float write() throws IOException
{
bitArray.setAll(false);
for (int ii=0;ii<bytes;ii++)
{
bitArray.set(ii, bb1.get(ii) != bb2.get(ii));
}
if (!bitArray.any())
{
return 0;
}
if (!bitArray.and(selfImportantArray))
{
return 0;
}
if (writeCount == 0)
{
DataOutputStream dos = new DataOutputStream(out);
dos.writeUTF(source);
dos.writeShort(properties.size());
List<Property> props = new ArrayList<>(properties.values());
props.sort(null);
for (Property prop : props)
{
dos.writeUTF(prop.getName());
dos.writeUTF(prop.getType());
}
dos.writeLong(uuid.getMostSignificantBits());
dos.writeLong(uuid.getLeastSignificantBits());
}
out.write(bits);
int cnt = 0;
for (int ii=0;ii<bytes;ii++)
{
if (bitArray.isSet(ii))
{
byte b = bb2.get(ii);
out.write(b);
bb1.put(ii, b);
cnt++;
writeBytes++;
}
}
writeCount++;
return (float)cnt/(float)bytes;
} | [
"public",
"float",
"write",
"(",
")",
"throws",
"IOException",
"{",
"bitArray",
".",
"setAll",
"(",
"false",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"bytes",
";",
"ii",
"++",
")",
"{",
"bitArray",
".",
"set",
"(",
"ii",
",",
... | Writes objects fields to stream
@return Compression rate
@throws IOException | [
"Writes",
"objects",
"fields",
"to",
"stream"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/io/CompressedOutput.java#L53-L99 |
151,503 | the-fascinator/plugin-roles-internal | src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java | InternalRoles.getRoles | @Override
public String[] getRoles(String username) {
if (user_list.containsKey(username)) {
return user_list.get(username).toArray(new String[0]);
} else {
if (defaultRoles == null) {
return new String[0];
} else {
return defaultRoles;
}
}
} | java | @Override
public String[] getRoles(String username) {
if (user_list.containsKey(username)) {
return user_list.get(username).toArray(new String[0]);
} else {
if (defaultRoles == null) {
return new String[0];
} else {
return defaultRoles;
}
}
} | [
"@",
"Override",
"public",
"String",
"[",
"]",
"getRoles",
"(",
"String",
"username",
")",
"{",
"if",
"(",
"user_list",
".",
"containsKey",
"(",
"username",
")",
")",
"{",
"return",
"user_list",
".",
"get",
"(",
"username",
")",
".",
"toArray",
"(",
"n... | Find and return all roles this user has.
@param username
The username of the user.
@return An array of role names (String). | [
"Find",
"and",
"return",
"all",
"roles",
"this",
"user",
"has",
"."
] | 5f75f802a92ef907acf030692d462aec4b4d3aae | https://github.com/the-fascinator/plugin-roles-internal/blob/5f75f802a92ef907acf030692d462aec4b4d3aae/src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java#L239-L250 |
151,504 | the-fascinator/plugin-roles-internal | src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java | InternalRoles.getUsersInRole | @Override
public String[] getUsersInRole(String role) {
if (role_list.containsKey(role)) {
return role_list.get(role).toArray(new String[0]);
} else {
return new String[0];
}
} | java | @Override
public String[] getUsersInRole(String role) {
if (role_list.containsKey(role)) {
return role_list.get(role).toArray(new String[0]);
} else {
return new String[0];
}
} | [
"@",
"Override",
"public",
"String",
"[",
"]",
"getUsersInRole",
"(",
"String",
"role",
")",
"{",
"if",
"(",
"role_list",
".",
"containsKey",
"(",
"role",
")",
")",
"{",
"return",
"role_list",
".",
"get",
"(",
"role",
")",
".",
"toArray",
"(",
"new",
... | Returns a list of users who have a particular role.
@param role
The role to search for.
@return An array of usernames (String) that have that role. | [
"Returns",
"a",
"list",
"of",
"users",
"who",
"have",
"a",
"particular",
"role",
"."
] | 5f75f802a92ef907acf030692d462aec4b4d3aae | https://github.com/the-fascinator/plugin-roles-internal/blob/5f75f802a92ef907acf030692d462aec4b4d3aae/src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java#L259-L266 |
151,505 | the-fascinator/plugin-roles-internal | src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java | InternalRoles.setRole | @Override
public void setRole(String username, String newrole) throws RolesException {
List<String> users_with_role = new ArrayList<String>();
if (user_list.containsKey(username)) {
List<String> roles_of_user = user_list.get(username);
if (!roles_of_user.contains(newrole)) {
// Update our user list
roles_of_user.add(newrole);
user_list.put(username, roles_of_user);
// Update our roles list
if (role_list.containsKey(newrole))
users_with_role = role_list.get(newrole);
users_with_role.add(username);
role_list.put(newrole, users_with_role);
// Don't forget to update our file_store
String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
file_store.setProperty(username, roles);
// And commit the file_store to disk
try {
saveRoles();
} catch (IOException e) {
throw new RolesException(e);
}
} else {
throw new RolesException("User '" + username + "' already has role '" + newrole + "'!");
}
} else {
// Add the user
List<String> empty = new ArrayList<String>();
user_list.put(username, empty);
// Try again
this.setRole(username, newrole);
}
} | java | @Override
public void setRole(String username, String newrole) throws RolesException {
List<String> users_with_role = new ArrayList<String>();
if (user_list.containsKey(username)) {
List<String> roles_of_user = user_list.get(username);
if (!roles_of_user.contains(newrole)) {
// Update our user list
roles_of_user.add(newrole);
user_list.put(username, roles_of_user);
// Update our roles list
if (role_list.containsKey(newrole))
users_with_role = role_list.get(newrole);
users_with_role.add(username);
role_list.put(newrole, users_with_role);
// Don't forget to update our file_store
String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
file_store.setProperty(username, roles);
// And commit the file_store to disk
try {
saveRoles();
} catch (IOException e) {
throw new RolesException(e);
}
} else {
throw new RolesException("User '" + username + "' already has role '" + newrole + "'!");
}
} else {
// Add the user
List<String> empty = new ArrayList<String>();
user_list.put(username, empty);
// Try again
this.setRole(username, newrole);
}
} | [
"@",
"Override",
"public",
"void",
"setRole",
"(",
"String",
"username",
",",
"String",
"newrole",
")",
"throws",
"RolesException",
"{",
"List",
"<",
"String",
">",
"users_with_role",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
... | Assign a role to a user.
@param username
The username of the user.
@param newrole
The new role to assign the user.
@throws RolesException
if there was an error during assignment. | [
"Assign",
"a",
"role",
"to",
"a",
"user",
"."
] | 5f75f802a92ef907acf030692d462aec4b4d3aae | https://github.com/the-fascinator/plugin-roles-internal/blob/5f75f802a92ef907acf030692d462aec4b4d3aae/src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java#L289-L325 |
151,506 | the-fascinator/plugin-roles-internal | src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java | InternalRoles.removeRole | @Override
public void removeRole(String username, String oldrole) throws RolesException {
List<String> users_with_role = new ArrayList<String>();
if (user_list.containsKey(username)) {
List<String> roles_of_user = user_list.get(username);
if (roles_of_user.contains(oldrole)) {
// Update our user list
roles_of_user.remove(oldrole);
user_list.put(username, roles_of_user);
// Update our roles list
if (role_list.containsKey(oldrole))
users_with_role = role_list.get(oldrole);
users_with_role.remove(username);
if (users_with_role.size() < 1) {
role_list.remove(oldrole);
} else {
role_list.put(oldrole, users_with_role);
}
// Don't forget to update our file_store
String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
file_store.setProperty(username, roles);
// And commit the file_store to disk
try {
saveRoles();
} catch (IOException e) {
throw new RolesException(e);
}
} else {
throw new RolesException("User '" + username + "' does not have the role '" + oldrole + "'!");
}
} else {
throw new RolesException("User '" + username + "' does not exist!");
}
} | java | @Override
public void removeRole(String username, String oldrole) throws RolesException {
List<String> users_with_role = new ArrayList<String>();
if (user_list.containsKey(username)) {
List<String> roles_of_user = user_list.get(username);
if (roles_of_user.contains(oldrole)) {
// Update our user list
roles_of_user.remove(oldrole);
user_list.put(username, roles_of_user);
// Update our roles list
if (role_list.containsKey(oldrole))
users_with_role = role_list.get(oldrole);
users_with_role.remove(username);
if (users_with_role.size() < 1) {
role_list.remove(oldrole);
} else {
role_list.put(oldrole, users_with_role);
}
// Don't forget to update our file_store
String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
file_store.setProperty(username, roles);
// And commit the file_store to disk
try {
saveRoles();
} catch (IOException e) {
throw new RolesException(e);
}
} else {
throw new RolesException("User '" + username + "' does not have the role '" + oldrole + "'!");
}
} else {
throw new RolesException("User '" + username + "' does not exist!");
}
} | [
"@",
"Override",
"public",
"void",
"removeRole",
"(",
"String",
"username",
",",
"String",
"oldrole",
")",
"throws",
"RolesException",
"{",
"List",
"<",
"String",
">",
"users_with_role",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"("... | Remove a role from a user.
@param username
The username of the user.
@param oldrole
The role to remove from the user.
@throws RolesException
if there was an error during removal. | [
"Remove",
"a",
"role",
"from",
"a",
"user",
"."
] | 5f75f802a92ef907acf030692d462aec4b4d3aae | https://github.com/the-fascinator/plugin-roles-internal/blob/5f75f802a92ef907acf030692d462aec4b4d3aae/src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java#L337-L373 |
151,507 | the-fascinator/plugin-roles-internal | src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java | InternalRoles.deleteRole | @Override
public void deleteRole(String rolename) throws RolesException {
if (role_list.containsKey(rolename)) {
List<String> users_with_role = role_list.get(rolename);
for (String user : users_with_role) {
// Remove the role from this user
List<String> roles_of_user = user_list.get(user);
roles_of_user.remove(rolename);
user_list.put(user, roles_of_user);
// Update our file_store
String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
file_store.setProperty(user, roles);
}
// Remove the role entry
role_list.remove(rolename);
// And commit the file_store to disk
try {
saveRoles();
} catch (IOException e) {
throw new RolesException(e);
}
} else {
throw new RolesException("Cannot find role '" + rolename + "'!");
}
} | java | @Override
public void deleteRole(String rolename) throws RolesException {
if (role_list.containsKey(rolename)) {
List<String> users_with_role = role_list.get(rolename);
for (String user : users_with_role) {
// Remove the role from this user
List<String> roles_of_user = user_list.get(user);
roles_of_user.remove(rolename);
user_list.put(user, roles_of_user);
// Update our file_store
String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
file_store.setProperty(user, roles);
}
// Remove the role entry
role_list.remove(rolename);
// And commit the file_store to disk
try {
saveRoles();
} catch (IOException e) {
throw new RolesException(e);
}
} else {
throw new RolesException("Cannot find role '" + rolename + "'!");
}
} | [
"@",
"Override",
"public",
"void",
"deleteRole",
"(",
"String",
"rolename",
")",
"throws",
"RolesException",
"{",
"if",
"(",
"role_list",
".",
"containsKey",
"(",
"rolename",
")",
")",
"{",
"List",
"<",
"String",
">",
"users_with_role",
"=",
"role_list",
"."... | Delete a role.
@param rolename
The name of the role to delete.
@throws RolesException
if there was an error during deletion. | [
"Delete",
"a",
"role",
"."
] | 5f75f802a92ef907acf030692d462aec4b4d3aae | https://github.com/the-fascinator/plugin-roles-internal/blob/5f75f802a92ef907acf030692d462aec4b4d3aae/src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java#L397-L423 |
151,508 | the-fascinator/plugin-roles-internal | src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java | InternalRoles.renameRole | @Override
public void renameRole(String oldrole, String newrole) throws RolesException {
if (role_list.containsKey(oldrole)) {
List<String> users_with_role = role_list.get(oldrole);
for (String user : users_with_role) {
// Remove the role from this user
List<String> roles_of_user = user_list.get(user);
roles_of_user.remove(oldrole);
roles_of_user.add(newrole);
user_list.put(user, roles_of_user);
// Update our file_store
String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
file_store.setProperty(user, roles);
}
// Replace the role entry
role_list.remove(oldrole);
role_list.put(newrole, users_with_role);
// And commit the file_store to disk
try {
saveRoles();
} catch (IOException e) {
throw new RolesException(e);
}
} else {
throw new RolesException("Cannot find role '" + oldrole + "'!");
}
} | java | @Override
public void renameRole(String oldrole, String newrole) throws RolesException {
if (role_list.containsKey(oldrole)) {
List<String> users_with_role = role_list.get(oldrole);
for (String user : users_with_role) {
// Remove the role from this user
List<String> roles_of_user = user_list.get(user);
roles_of_user.remove(oldrole);
roles_of_user.add(newrole);
user_list.put(user, roles_of_user);
// Update our file_store
String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
file_store.setProperty(user, roles);
}
// Replace the role entry
role_list.remove(oldrole);
role_list.put(newrole, users_with_role);
// And commit the file_store to disk
try {
saveRoles();
} catch (IOException e) {
throw new RolesException(e);
}
} else {
throw new RolesException("Cannot find role '" + oldrole + "'!");
}
} | [
"@",
"Override",
"public",
"void",
"renameRole",
"(",
"String",
"oldrole",
",",
"String",
"newrole",
")",
"throws",
"RolesException",
"{",
"if",
"(",
"role_list",
".",
"containsKey",
"(",
"oldrole",
")",
")",
"{",
"List",
"<",
"String",
">",
"users_with_role... | Rename a role.
@param oldrole
The name role currently has.
@param newrole
The name role is changing to.
@throws RolesException
if there was an error during rename. | [
"Rename",
"a",
"role",
"."
] | 5f75f802a92ef907acf030692d462aec4b4d3aae | https://github.com/the-fascinator/plugin-roles-internal/blob/5f75f802a92ef907acf030692d462aec4b4d3aae/src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java#L435-L463 |
151,509 | the-fascinator/plugin-roles-internal | src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java | InternalRoles.searchRoles | @Override
public String[] searchRoles(String search) throws RolesException {
// Complete list of users
String[] roles = role_list.keySet().toArray(new String[role_list.size()]);
List<String> found = new ArrayList<String>();
// Look through the list for anyone who matches
for (int i = 0; i < roles.length; i++) {
if (roles[i].toLowerCase().contains(search.toLowerCase())) {
found.add(roles[i]);
}
}
// Return the list
return found.toArray(new String[found.size()]);
} | java | @Override
public String[] searchRoles(String search) throws RolesException {
// Complete list of users
String[] roles = role_list.keySet().toArray(new String[role_list.size()]);
List<String> found = new ArrayList<String>();
// Look through the list for anyone who matches
for (int i = 0; i < roles.length; i++) {
if (roles[i].toLowerCase().contains(search.toLowerCase())) {
found.add(roles[i]);
}
}
// Return the list
return found.toArray(new String[found.size()]);
} | [
"@",
"Override",
"public",
"String",
"[",
"]",
"searchRoles",
"(",
"String",
"search",
")",
"throws",
"RolesException",
"{",
"// Complete list of users",
"String",
"[",
"]",
"roles",
"=",
"role_list",
".",
"keySet",
"(",
")",
".",
"toArray",
"(",
"new",
"Str... | Returns a list of roles matching the search.
@param search
The search string to execute.
@return An array of role names that match the search.
@throws RolesException
if there was an error searching. | [
"Returns",
"a",
"list",
"of",
"roles",
"matching",
"the",
"search",
"."
] | 5f75f802a92ef907acf030692d462aec4b4d3aae | https://github.com/the-fascinator/plugin-roles-internal/blob/5f75f802a92ef907acf030692d462aec4b4d3aae/src/main/java/com/googlecode/fascinator/roles/internal/InternalRoles.java#L474-L489 |
151,510 | jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/MessageReceivingPopClientProcess.java | MessageReceivingPopClientProcess.run | public void run()
{
Folder folder = this.getInboxFolder();
if (folder != null)
this.processMail(folder);
try {
folder.close(true);
} catch (MessagingException e) {
e.printStackTrace();
}
} | java | public void run()
{
Folder folder = this.getInboxFolder();
if (folder != null)
this.processMail(folder);
try {
folder.close(true);
} catch (MessagingException e) {
e.printStackTrace();
}
} | [
"public",
"void",
"run",
"(",
")",
"{",
"Folder",
"folder",
"=",
"this",
".",
"getInboxFolder",
"(",
")",
";",
"if",
"(",
"folder",
"!=",
"null",
")",
"this",
".",
"processMail",
"(",
"folder",
")",
";",
"try",
"{",
"folder",
".",
"close",
"(",
"tr... | Run the code in this process. | [
"Run",
"the",
"code",
"in",
"this",
"process",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/MessageReceivingPopClientProcess.java#L96-L108 |
151,511 | jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/MessageReceivingPopClientProcess.java | MessageReceivingPopClientProcess.getInboxFolder | public Folder getInboxFolder()
{
String strMessageType = MessageTransportModel.EMAIL;
String strClassName = null;
Record recMessageTransport = this.getRecord(MessageTransportModel.MESSAGE_TRANSPORT_FILE);
if (recMessageTransport == null)
recMessageTransport = Record.makeRecordFromClassName(MessageTransportModel.THICK_CLASS, this);
recMessageTransport.setKeyArea(MessageTransportModel.CODE_KEY);
recMessageTransport.getField(MessageTransportModel.CODE).setString(strMessageType);
Map<String,Object> properties = null;
try {
if (recMessageTransport.seek(null))
{
PropertiesField fldProperty = (PropertiesField)recMessageTransport.getField(MessageTransportModel.PROPERTIES);
strClassName = fldProperty.getProperty(MessageTransportModel.TRANSPORT_CLASS_NAME_PARAM);
properties = fldProperty.loadProperties();
this.setProperties(properties);
}
} catch (DBException ex) {
ex.printStackTrace();
}
if (strClassName == null)
strClassName = EmailMessageTransport.class.getName();
String strHost = this.getProperty(POP3_HOST);
int iPort = 110;
if (this.getProperty(POP3_PORT) != null)
iPort = Integer.parseInt(this.getProperty(POP3_PORT));
String strUsername = this.getProperty(POP3_USERNAME);
String strPassword = this.getProperty(POP3_PASSWORD);
strPassword = PasswordPropertiesField.decrypt(strPassword);
String strInbox = this.getProperty(POP3_INBOX);
if (strInbox == null)
strInbox = DEFAULT_INBOX;
String strInterval = this.getProperty(POP3_INTERVAL);
if (strInterval == null)
strInterval = DEFAULT_INTERVAL;
try
{
Properties props = Utility.mapToProperties(properties);//System.getProperties();
if ((props.getProperty(POP3_SSL) != null)
&& (props.getProperty(POP3_SSL).equalsIgnoreCase(DBConstants.TRUE)))
{
props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
props.setProperty("mail.pop3.socketFactory.fallback", "false");
if (this.getProperty(POP3_PORT) != null)
if (this.getProperty("mail.pop3.socketFactory.port") == null)
props.setProperty("mail.pop3.socketFactory.port", this.getProperty(POP3_PORT));
}
// Get a Session object
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
// Get a Store object
URLName url = new URLName(STORE_TYPE, strHost, iPort, "", strUsername, strPassword);
// Store store = session.getStore("imap");
Store store = session.getStore(url);
// Connect
store.connect();
// Open a Folder
Folder folder = store.getFolder(strInbox);
if (folder == null || !folder.exists())
{
Utility.getLogger().warning("Invalid folder");
System.exit(1);
}
folder.open(Folder.READ_WRITE);
// Check mail once in "freq" MILLIseconds
//? int freq = Integer.parseInt(strInterval);
return folder;
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
} | java | public Folder getInboxFolder()
{
String strMessageType = MessageTransportModel.EMAIL;
String strClassName = null;
Record recMessageTransport = this.getRecord(MessageTransportModel.MESSAGE_TRANSPORT_FILE);
if (recMessageTransport == null)
recMessageTransport = Record.makeRecordFromClassName(MessageTransportModel.THICK_CLASS, this);
recMessageTransport.setKeyArea(MessageTransportModel.CODE_KEY);
recMessageTransport.getField(MessageTransportModel.CODE).setString(strMessageType);
Map<String,Object> properties = null;
try {
if (recMessageTransport.seek(null))
{
PropertiesField fldProperty = (PropertiesField)recMessageTransport.getField(MessageTransportModel.PROPERTIES);
strClassName = fldProperty.getProperty(MessageTransportModel.TRANSPORT_CLASS_NAME_PARAM);
properties = fldProperty.loadProperties();
this.setProperties(properties);
}
} catch (DBException ex) {
ex.printStackTrace();
}
if (strClassName == null)
strClassName = EmailMessageTransport.class.getName();
String strHost = this.getProperty(POP3_HOST);
int iPort = 110;
if (this.getProperty(POP3_PORT) != null)
iPort = Integer.parseInt(this.getProperty(POP3_PORT));
String strUsername = this.getProperty(POP3_USERNAME);
String strPassword = this.getProperty(POP3_PASSWORD);
strPassword = PasswordPropertiesField.decrypt(strPassword);
String strInbox = this.getProperty(POP3_INBOX);
if (strInbox == null)
strInbox = DEFAULT_INBOX;
String strInterval = this.getProperty(POP3_INTERVAL);
if (strInterval == null)
strInterval = DEFAULT_INTERVAL;
try
{
Properties props = Utility.mapToProperties(properties);//System.getProperties();
if ((props.getProperty(POP3_SSL) != null)
&& (props.getProperty(POP3_SSL).equalsIgnoreCase(DBConstants.TRUE)))
{
props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
props.setProperty("mail.pop3.socketFactory.fallback", "false");
if (this.getProperty(POP3_PORT) != null)
if (this.getProperty("mail.pop3.socketFactory.port") == null)
props.setProperty("mail.pop3.socketFactory.port", this.getProperty(POP3_PORT));
}
// Get a Session object
Session session = Session.getDefaultInstance(props, null);
session.setDebug(true);
// Get a Store object
URLName url = new URLName(STORE_TYPE, strHost, iPort, "", strUsername, strPassword);
// Store store = session.getStore("imap");
Store store = session.getStore(url);
// Connect
store.connect();
// Open a Folder
Folder folder = store.getFolder(strInbox);
if (folder == null || !folder.exists())
{
Utility.getLogger().warning("Invalid folder");
System.exit(1);
}
folder.open(Folder.READ_WRITE);
// Check mail once in "freq" MILLIseconds
//? int freq = Integer.parseInt(strInterval);
return folder;
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
} | [
"public",
"Folder",
"getInboxFolder",
"(",
")",
"{",
"String",
"strMessageType",
"=",
"MessageTransportModel",
".",
"EMAIL",
";",
"String",
"strClassName",
"=",
"null",
";",
"Record",
"recMessageTransport",
"=",
"this",
".",
"getRecord",
"(",
"MessageTransportModel"... | Open the poop3 inbox.
@return The INBOX folder. | [
"Open",
"the",
"poop3",
"inbox",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/MessageReceivingPopClientProcess.java#L113-L195 |
151,512 | jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/MessageReceivingPopClientProcess.java | MessageReceivingPopClientProcess.processMail | public void processMail(Folder folder)
{
try {
int iCount = folder.getMessageCount();
if (iCount == 0)
return;
String pattern = REPLY_STRING;
Message[] messages = null;
if (this.getProperty(PATTERN) == null)
{
messages = folder.getMessages();
}
else
{
pattern = this.getProperty(PATTERN);
SubjectTerm st = new SubjectTerm(pattern);
// Get some message references
messages = folder.search(st);
}
for (int iMsgnum = 0; iMsgnum < messages.length; iMsgnum++)
{
Message message = messages[iMsgnum];
String strSubject = message.getSubject();
if (strSubject != null)
if ((pattern == null) || (strSubject.indexOf(pattern) != -1))
this.processThisMessage(message);
message.setFlag(Flags.Flag.SEEN, true); // Archives the message (so I don't process it again)
}
} catch (Exception ex) {
ex.printStackTrace();
}
} | java | public void processMail(Folder folder)
{
try {
int iCount = folder.getMessageCount();
if (iCount == 0)
return;
String pattern = REPLY_STRING;
Message[] messages = null;
if (this.getProperty(PATTERN) == null)
{
messages = folder.getMessages();
}
else
{
pattern = this.getProperty(PATTERN);
SubjectTerm st = new SubjectTerm(pattern);
// Get some message references
messages = folder.search(st);
}
for (int iMsgnum = 0; iMsgnum < messages.length; iMsgnum++)
{
Message message = messages[iMsgnum];
String strSubject = message.getSubject();
if (strSubject != null)
if ((pattern == null) || (strSubject.indexOf(pattern) != -1))
this.processThisMessage(message);
message.setFlag(Flags.Flag.SEEN, true); // Archives the message (so I don't process it again)
}
} catch (Exception ex) {
ex.printStackTrace();
}
} | [
"public",
"void",
"processMail",
"(",
"Folder",
"folder",
")",
"{",
"try",
"{",
"int",
"iCount",
"=",
"folder",
".",
"getMessageCount",
"(",
")",
";",
"if",
"(",
"iCount",
"==",
"0",
")",
"return",
";",
"String",
"pattern",
"=",
"REPLY_STRING",
";",
"M... | Go through all the mail and process the messages.
@param folder The inbox folder. | [
"Go",
"through",
"all",
"the",
"mail",
"and",
"process",
"the",
"messages",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/MessageReceivingPopClientProcess.java#L200-L233 |
151,513 | jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/MessageReceivingPopClientProcess.java | MessageReceivingPopClientProcess.getContentString | public String getContentString(Message message)
{
try {
String strContentType = message.getContentType();
Object content = message.getContent();
if (content instanceof MimeMultipart)
{
for (int index = 0; ; index++)
{
BodyPart bodyPart = ((javax.mail.internet.MimeMultipart)content).getBodyPart(index);
Object contents = bodyPart.getContent();
if (contents != null)
return contents.toString();
}
}
return message.getContent().toString(); // pend(don) FIX THIS!
} catch (IOException ex) {
ex.printStackTrace();
} catch (MessagingException ex) {
ex.printStackTrace();
}
return null;
} | java | public String getContentString(Message message)
{
try {
String strContentType = message.getContentType();
Object content = message.getContent();
if (content instanceof MimeMultipart)
{
for (int index = 0; ; index++)
{
BodyPart bodyPart = ((javax.mail.internet.MimeMultipart)content).getBodyPart(index);
Object contents = bodyPart.getContent();
if (contents != null)
return contents.toString();
}
}
return message.getContent().toString(); // pend(don) FIX THIS!
} catch (IOException ex) {
ex.printStackTrace();
} catch (MessagingException ex) {
ex.printStackTrace();
}
return null;
} | [
"public",
"String",
"getContentString",
"(",
"Message",
"message",
")",
"{",
"try",
"{",
"String",
"strContentType",
"=",
"message",
".",
"getContentType",
"(",
")",
";",
"Object",
"content",
"=",
"message",
".",
"getContent",
"(",
")",
";",
"if",
"(",
"co... | Get the message content as a string.
@param message The message.
@return The message content. | [
"Get",
"the",
"message",
"content",
"as",
"a",
"string",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/MessageReceivingPopClientProcess.java#L320-L342 |
151,514 | FrodeRanders/java-vopn | src/main/java/org/gautelis/vopn/lang/DynamicInvoker.java | DynamicInvoker.createObject | public Object createObject(String className, Class clazz) throws ClassNotFoundException {
Object object;
try {
object = clazz.newInstance();
} catch (InstantiationException ie) {
String info = "Could not create " + description + " object: " + className
+ ". Could not access object constructor: ";
info += ie.getMessage();
throw new ClassNotFoundException(info, ie);
} catch (IllegalAccessException iae) {
String info = "Could not create " + description + " object: " + className
+ ". Could not instantiate object. Does the object classname refer to an abstract class, "
+ "an interface or the like?: ";
info += iae.getMessage();
throw new ClassNotFoundException(info, iae);
} catch (ClassCastException cce) {
String info = "Could not create " + description + " object: " + className
+ ". The specified object classname does not refer to the proper type: ";
info += cce.getMessage();
throw new ClassNotFoundException(info, cce);
}
return object;
} | java | public Object createObject(String className, Class clazz) throws ClassNotFoundException {
Object object;
try {
object = clazz.newInstance();
} catch (InstantiationException ie) {
String info = "Could not create " + description + " object: " + className
+ ". Could not access object constructor: ";
info += ie.getMessage();
throw new ClassNotFoundException(info, ie);
} catch (IllegalAccessException iae) {
String info = "Could not create " + description + " object: " + className
+ ". Could not instantiate object. Does the object classname refer to an abstract class, "
+ "an interface or the like?: ";
info += iae.getMessage();
throw new ClassNotFoundException(info, iae);
} catch (ClassCastException cce) {
String info = "Could not create " + description + " object: " + className
+ ". The specified object classname does not refer to the proper type: ";
info += cce.getMessage();
throw new ClassNotFoundException(info, cce);
}
return object;
} | [
"public",
"Object",
"createObject",
"(",
"String",
"className",
",",
"Class",
"clazz",
")",
"throws",
"ClassNotFoundException",
"{",
"Object",
"object",
";",
"try",
"{",
"object",
"=",
"clazz",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Instantia... | Dynamically creates an object | [
"Dynamically",
"creates",
"an",
"object"
] | 4c7b2f90201327af4eaa3cd46b3fee68f864e5cc | https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/lang/DynamicInvoker.java#L143-L169 |
151,515 | tvesalainen/util | util/src/main/java/org/vesalainen/math/sliding/AbstractSlidingAngleAverage.java | AbstractSlidingAngleAverage.fast | @Override
public double fast()
{
readLock.lock();
try
{
int count = count();
return toDegrees(sinSum / count, cosSum / count);
}
finally
{
readLock.unlock();
}
} | java | @Override
public double fast()
{
readLock.lock();
try
{
int count = count();
return toDegrees(sinSum / count, cosSum / count);
}
finally
{
readLock.unlock();
}
} | [
"@",
"Override",
"public",
"double",
"fast",
"(",
")",
"{",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"int",
"count",
"=",
"count",
"(",
")",
";",
"return",
"toDegrees",
"(",
"sinSum",
"/",
"count",
",",
"cosSum",
"/",
"count",
")",
";",
... | Returns fast average. Fast calculation adds and subtracts values from
sum field. This might cause difference in time to actual calculating
sample by sample.
@return | [
"Returns",
"fast",
"average",
".",
"Fast",
"calculation",
"adds",
"and",
"subtracts",
"values",
"from",
"sum",
"field",
".",
"This",
"might",
"cause",
"difference",
"in",
"time",
"to",
"actual",
"calculating",
"sample",
"by",
"sample",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/sliding/AbstractSlidingAngleAverage.java#L85-L98 |
151,516 | tvesalainen/util | util/src/main/java/org/vesalainen/math/sliding/AbstractSlidingAngleAverage.java | AbstractSlidingAngleAverage.average | @Override
public double average()
{
readLock.lock();
try
{
int count = count();
double s = 0;
double c = 0;
PrimitiveIterator.OfInt it = modIterator();
while (it.hasNext())
{
int m = it.nextInt();
s += sin[m];
c += cos[m];
};
return toDegrees(s / count, c / count);
}
finally
{
readLock.unlock();
}
} | java | @Override
public double average()
{
readLock.lock();
try
{
int count = count();
double s = 0;
double c = 0;
PrimitiveIterator.OfInt it = modIterator();
while (it.hasNext())
{
int m = it.nextInt();
s += sin[m];
c += cos[m];
};
return toDegrees(s / count, c / count);
}
finally
{
readLock.unlock();
}
} | [
"@",
"Override",
"public",
"double",
"average",
"(",
")",
"{",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"int",
"count",
"=",
"count",
"(",
")",
";",
"double",
"s",
"=",
"0",
";",
"double",
"c",
"=",
"0",
";",
"PrimitiveIterator",
".",
... | Returns sample by sample calculated average.
@return | [
"Returns",
"sample",
"by",
"sample",
"calculated",
"average",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/sliding/AbstractSlidingAngleAverage.java#L103-L125 |
151,517 | timothyb89/EventBus | src/main/java/org/timothyb89/eventbus/EventQueueDefinition.java | EventQueueDefinition.remove | public void remove(EventQueueEntry entry) {
List<EventQueueEntry> container = queue.get(entry.getPriority());
if (container == null) {
return;
}
container.remove(entry);
// TODO: can we remove an empty container safely?
} | java | public void remove(EventQueueEntry entry) {
List<EventQueueEntry> container = queue.get(entry.getPriority());
if (container == null) {
return;
}
container.remove(entry);
// TODO: can we remove an empty container safely?
} | [
"public",
"void",
"remove",
"(",
"EventQueueEntry",
"entry",
")",
"{",
"List",
"<",
"EventQueueEntry",
">",
"container",
"=",
"queue",
".",
"get",
"(",
"entry",
".",
"getPriority",
"(",
")",
")",
";",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"re... | Removes the given queue entry from the notification list.
@param entry the entry to remove | [
"Removes",
"the",
"given",
"queue",
"entry",
"from",
"the",
"notification",
"list",
"."
] | 9285406c16eda84e20da6c72fe2500c24c7848db | https://github.com/timothyb89/EventBus/blob/9285406c16eda84e20da6c72fe2500c24c7848db/src/main/java/org/timothyb89/eventbus/EventQueueDefinition.java#L61-L70 |
151,518 | timothyb89/EventBus | src/main/java/org/timothyb89/eventbus/EventQueueDefinition.java | EventQueueDefinition.removeAll | public void removeAll(Object object) {
for (Entry<Integer, List<EventQueueEntry>> e : queue.entrySet()) {
List<EventQueueEntry> entries = e.getValue();
List<EventQueueEntry> toRemove = new LinkedList<>();
synchronized (entries) {
for (EventQueueEntry entry : entries) {
if (entry.getObject() == object) {
toRemove.add(entry);
}
}
entries.removeAll(toRemove);
// TODO: can we safely remove `entries` if it's empty here?
}
}
log.debug(
"Removed {} from notification queue for {}",
object, eventType);
} | java | public void removeAll(Object object) {
for (Entry<Integer, List<EventQueueEntry>> e : queue.entrySet()) {
List<EventQueueEntry> entries = e.getValue();
List<EventQueueEntry> toRemove = new LinkedList<>();
synchronized (entries) {
for (EventQueueEntry entry : entries) {
if (entry.getObject() == object) {
toRemove.add(entry);
}
}
entries.removeAll(toRemove);
// TODO: can we safely remove `entries` if it's empty here?
}
}
log.debug(
"Removed {} from notification queue for {}",
object, eventType);
} | [
"public",
"void",
"removeAll",
"(",
"Object",
"object",
")",
"{",
"for",
"(",
"Entry",
"<",
"Integer",
",",
"List",
"<",
"EventQueueEntry",
">",
">",
"e",
":",
"queue",
".",
"entrySet",
"(",
")",
")",
"{",
"List",
"<",
"EventQueueEntry",
">",
"entries"... | Removes all handler methods in the given object from notifications by
this queue.
@param object the object to deregister | [
"Removes",
"all",
"handler",
"methods",
"in",
"the",
"given",
"object",
"from",
"notifications",
"by",
"this",
"queue",
"."
] | 9285406c16eda84e20da6c72fe2500c24c7848db | https://github.com/timothyb89/EventBus/blob/9285406c16eda84e20da6c72fe2500c24c7848db/src/main/java/org/timothyb89/eventbus/EventQueueDefinition.java#L77-L98 |
151,519 | tvesalainen/util | util/src/main/java/org/vesalainen/nio/ByteBufferOutputStream.java | ByteBufferOutputStream.getRemaining | public final int getRemaining()
{
int rem = 0;
for (int ii=0;ii<length;ii++)
{
rem += srcs[offset+ii].remaining();
}
return rem;
} | java | public final int getRemaining()
{
int rem = 0;
for (int ii=0;ii<length;ii++)
{
rem += srcs[offset+ii].remaining();
}
return rem;
} | [
"public",
"final",
"int",
"getRemaining",
"(",
")",
"{",
"int",
"rem",
"=",
"0",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"length",
";",
"ii",
"++",
")",
"{",
"rem",
"+=",
"srcs",
"[",
"offset",
"+",
"ii",
"]",
".",
"remaining",
... | Returns the number of bytes that can be written.
@return | [
"Returns",
"the",
"number",
"of",
"bytes",
"that",
"can",
"be",
"written",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/ByteBufferOutputStream.java#L56-L64 |
151,520 | jbundle/jbundle | thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JThreeStateCheckBox.java | JThreeStateCheckBox.updateImage | public void updateImage()
{
if (m_iCurrentState == ON)
this.setIcon(m_iconOn);
else if (m_iCurrentState == OFF)
this.setIcon(m_iconOff);
else
this.setIcon(m_iconNull);
} | java | public void updateImage()
{
if (m_iCurrentState == ON)
this.setIcon(m_iconOn);
else if (m_iCurrentState == OFF)
this.setIcon(m_iconOff);
else
this.setIcon(m_iconNull);
} | [
"public",
"void",
"updateImage",
"(",
")",
"{",
"if",
"(",
"m_iCurrentState",
"==",
"ON",
")",
"this",
".",
"setIcon",
"(",
"m_iconOn",
")",
";",
"else",
"if",
"(",
"m_iCurrentState",
"==",
"OFF",
")",
"this",
".",
"setIcon",
"(",
"m_iconOff",
")",
";"... | Update the image to the current state. | [
"Update",
"the",
"image",
"to",
"the",
"current",
"state",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JThreeStateCheckBox.java#L128-L136 |
151,521 | jbundle/jbundle | thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JThreeStateCheckBox.java | JThreeStateCheckBox.toggleState | public void toggleState()
{
if (m_iCurrentState == ON)
m_iCurrentState = NULL;
else if (m_iCurrentState == OFF)
m_iCurrentState = ON;
else
m_iCurrentState = OFF;
this.updateImage();
} | java | public void toggleState()
{
if (m_iCurrentState == ON)
m_iCurrentState = NULL;
else if (m_iCurrentState == OFF)
m_iCurrentState = ON;
else
m_iCurrentState = OFF;
this.updateImage();
} | [
"public",
"void",
"toggleState",
"(",
")",
"{",
"if",
"(",
"m_iCurrentState",
"==",
"ON",
")",
"m_iCurrentState",
"=",
"NULL",
";",
"else",
"if",
"(",
"m_iCurrentState",
"==",
"OFF",
")",
"m_iCurrentState",
"=",
"ON",
";",
"else",
"m_iCurrentState",
"=",
"... | Toggle the button state. | [
"Toggle",
"the",
"button",
"state",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JThreeStateCheckBox.java#L149-L158 |
151,522 | inkstand-io/scribble | scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java | Directory.createDirectoryService | private DirectoryService createDirectoryService() {
final DirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();
try {
factory.init("scribble");
return factory.getDirectoryService();
} catch (Exception e) { //NOSONAR
throw new AssertionError("Unable to create directory service", e);
}
} | java | private DirectoryService createDirectoryService() {
final DirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();
try {
factory.init("scribble");
return factory.getDirectoryService();
} catch (Exception e) { //NOSONAR
throw new AssertionError("Unable to create directory service", e);
}
} | [
"private",
"DirectoryService",
"createDirectoryService",
"(",
")",
"{",
"final",
"DirectoryServiceFactory",
"factory",
"=",
"new",
"DefaultDirectoryServiceFactory",
"(",
")",
";",
"try",
"{",
"factory",
".",
"init",
"(",
"\"scribble\"",
")",
";",
"return",
"factory"... | Creates a new DirectoryService instance for the test rule. Initialization of the service is done in the
apply Statement phase by invoking the setupService method. | [
"Creates",
"a",
"new",
"DirectoryService",
"instance",
"for",
"the",
"test",
"rule",
".",
"Initialization",
"of",
"the",
"service",
"is",
"done",
"in",
"the",
"apply",
"Statement",
"phase",
"by",
"invoking",
"the",
"setupService",
"method",
"."
] | 66e67553bad4b1ff817e1715fd1d3dd833406744 | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L158-L168 |
151,523 | inkstand-io/scribble | scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java | Directory.setupService | protected void setupService() throws Exception { // NOSONAR
final DirectoryService service = this.getDirectoryService();
service.getChangeLog().setEnabled(false);
this.workDir = getOuterRule().newFolder("dsworkdir");
service.setInstanceLayout(new InstanceLayout(this.workDir));
final CacheService cacheService = new CacheService();
cacheService.initialize(service.getInstanceLayout());
service.setCacheService(cacheService);
service.setAccessControlEnabled(this.acEnabled);
service.setAllowAnonymousAccess(this.anonymousAllowed);
this.createPartitions();
this.importInitialLdif();
} | java | protected void setupService() throws Exception { // NOSONAR
final DirectoryService service = this.getDirectoryService();
service.getChangeLog().setEnabled(false);
this.workDir = getOuterRule().newFolder("dsworkdir");
service.setInstanceLayout(new InstanceLayout(this.workDir));
final CacheService cacheService = new CacheService();
cacheService.initialize(service.getInstanceLayout());
service.setCacheService(cacheService);
service.setAccessControlEnabled(this.acEnabled);
service.setAllowAnonymousAccess(this.anonymousAllowed);
this.createPartitions();
this.importInitialLdif();
} | [
"protected",
"void",
"setupService",
"(",
")",
"throws",
"Exception",
"{",
"// NOSONAR",
"final",
"DirectoryService",
"service",
"=",
"this",
".",
"getDirectoryService",
"(",
")",
";",
"service",
".",
"getChangeLog",
"(",
")",
".",
"setEnabled",
"(",
"false",
... | Applies the configuration to the service such as AccessControl and AnonymousAccess. Both are enabled as
configured. Further, the method initializes the cache service. The method does not start the service.
@throws Exception
if starting the directory service failed for any reason | [
"Applies",
"the",
"configuration",
"to",
"the",
"service",
"such",
"as",
"AccessControl",
"and",
"AnonymousAccess",
".",
"Both",
"are",
"enabled",
"as",
"configured",
".",
"Further",
"the",
"method",
"initializes",
"the",
"cache",
"service",
".",
"The",
"method"... | 66e67553bad4b1ff817e1715fd1d3dd833406744 | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L177-L194 |
151,524 | inkstand-io/scribble | scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java | Directory.importInitialLdif | private void importInitialLdif() throws IOException {
if (this.initialLdif != null) {
try (InputStream ldifStream = this.initialLdif.openStream()) {
this.importLdif(ldifStream);
}
}
} | java | private void importInitialLdif() throws IOException {
if (this.initialLdif != null) {
try (InputStream ldifStream = this.initialLdif.openStream()) {
this.importLdif(ldifStream);
}
}
} | [
"private",
"void",
"importInitialLdif",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"initialLdif",
"!=",
"null",
")",
"{",
"try",
"(",
"InputStream",
"ldifStream",
"=",
"this",
".",
"initialLdif",
".",
"openStream",
"(",
")",
")",
"{",
... | Initializes the directory with content from the initial ldif file. Note that a partition has to be created for
the root of the ldif file.
@throws IOException
if the resource pointing to the ldif file to be imported can not be accessed | [
"Initializes",
"the",
"directory",
"with",
"content",
"from",
"the",
"initial",
"ldif",
"file",
".",
"Note",
"that",
"a",
"partition",
"has",
"to",
"be",
"created",
"for",
"the",
"root",
"of",
"the",
"ldif",
"file",
"."
] | 66e67553bad4b1ff817e1715fd1d3dd833406744 | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L214-L221 |
151,525 | inkstand-io/scribble | scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java | Directory.createPartitions | private void createPartitions() {
for (Map.Entry<String, String> partitionEntry : this.partitions.entrySet()) {
try {
this.addPartitionInternal(partitionEntry.getKey(), partitionEntry.getValue());
} catch (Exception e) { //NOSONAR
throw new AssertionError("Could not create partitions " + this.partitions, e);
}
}
} | java | private void createPartitions() {
for (Map.Entry<String, String> partitionEntry : this.partitions.entrySet()) {
try {
this.addPartitionInternal(partitionEntry.getKey(), partitionEntry.getValue());
} catch (Exception e) { //NOSONAR
throw new AssertionError("Could not create partitions " + this.partitions, e);
}
}
} | [
"private",
"void",
"createPartitions",
"(",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"partitionEntry",
":",
"this",
".",
"partitions",
".",
"entrySet",
"(",
")",
")",
"{",
"try",
"{",
"this",
".",
"addPartitionInterna... | Creates all paritions that are added on rule setup. | [
"Creates",
"all",
"paritions",
"that",
"are",
"added",
"on",
"rule",
"setup",
"."
] | 66e67553bad4b1ff817e1715fd1d3dd833406744 | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L227-L236 |
151,526 | inkstand-io/scribble | scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java | Directory.importLdif | public void importLdif(InputStream ldifData) throws IOException {
final File ldifFile = getOuterRule().newFile("scribble_import.ldif");
try (final Writer writer = new OutputStreamWriter(new FileOutputStream(ldifFile), Charsets.UTF_8)) {
IOUtils.copy(ldifData, writer);
}
final String pathToLdifFile = ldifFile.getAbsolutePath();
final CoreSession session = this.getDirectoryService().getAdminSession();
final LdifFileLoader loader = new LdifFileLoader(session, pathToLdifFile);
loader.execute();
} | java | public void importLdif(InputStream ldifData) throws IOException {
final File ldifFile = getOuterRule().newFile("scribble_import.ldif");
try (final Writer writer = new OutputStreamWriter(new FileOutputStream(ldifFile), Charsets.UTF_8)) {
IOUtils.copy(ldifData, writer);
}
final String pathToLdifFile = ldifFile.getAbsolutePath();
final CoreSession session = this.getDirectoryService().getAdminSession();
final LdifFileLoader loader = new LdifFileLoader(session, pathToLdifFile);
loader.execute();
} | [
"public",
"void",
"importLdif",
"(",
"InputStream",
"ldifData",
")",
"throws",
"IOException",
"{",
"final",
"File",
"ldifFile",
"=",
"getOuterRule",
"(",
")",
".",
"newFile",
"(",
"\"scribble_import.ldif\"",
")",
";",
"try",
"(",
"final",
"Writer",
"writer",
"... | Imports directory content that is defined in LDIF format and provided as input stream. The method writes the
stream content into a temporary file.
@param ldifData
the ldif data to import as a stream
@throws IOException
if the temporary file can not be created | [
"Imports",
"directory",
"content",
"that",
"is",
"defined",
"in",
"LDIF",
"format",
"and",
"provided",
"as",
"input",
"stream",
".",
"The",
"method",
"writes",
"the",
"stream",
"content",
"into",
"a",
"temporary",
"file",
"."
] | 66e67553bad4b1ff817e1715fd1d3dd833406744 | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L324-L336 |
151,527 | inkstand-io/scribble | scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java | Directory.addPartition | @RuleSetup
public void addPartition(String partitionId, String suffix) {
this.partitions.put(partitionId, suffix);
} | java | @RuleSetup
public void addPartition(String partitionId, String suffix) {
this.partitions.put(partitionId, suffix);
} | [
"@",
"RuleSetup",
"public",
"void",
"addPartition",
"(",
"String",
"partitionId",
",",
"String",
"suffix",
")",
"{",
"this",
".",
"partitions",
".",
"put",
"(",
"partitionId",
",",
"suffix",
")",
";",
"}"
] | Adds a partition to the rule. The actual parititon is created when the rule is applied.
@param partitionId
the id of the partition
@param suffix
the suffix of the partition | [
"Adds",
"a",
"partition",
"to",
"the",
"rule",
".",
"The",
"actual",
"parititon",
"is",
"created",
"when",
"the",
"rule",
"is",
"applied",
"."
] | 66e67553bad4b1ff817e1715fd1d3dd833406744 | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L371-L375 |
151,528 | jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/MoveOnEventHandler.java | MoveOnEventHandler.moveTheData | public void moveTheData(boolean bDisplayOption, int iMoveType)
{
if (m_convCheckMark != null) if (m_bDisableOnMove)
m_fldDest.setEnabled(!m_convCheckMark.getState());
if ((m_convCheckMark == null)
|| (m_convCheckMark.getState()))
{
if ((this.getSourceField() != null)
&& ((!this.getSourceField().isNull()) || (!m_bDontMoveNullSource)))
m_fldDest.moveFieldToThis(this.getSourceField(), bDisplayOption, iMoveType); // Move dependent field to here
else if (m_strSource != null)
m_fldDest.setString(m_strSource, bDisplayOption, iMoveType); // Move dependent field to here
else if (m_fldDest instanceof ReferenceField)
((ReferenceField)m_fldDest).setReference(this.getOwner(), bDisplayOption, iMoveType);
}
else
{
if (bDisplayOption)
m_fldDest.displayField(); // Redisplay based on this check mark
}
} | java | public void moveTheData(boolean bDisplayOption, int iMoveType)
{
if (m_convCheckMark != null) if (m_bDisableOnMove)
m_fldDest.setEnabled(!m_convCheckMark.getState());
if ((m_convCheckMark == null)
|| (m_convCheckMark.getState()))
{
if ((this.getSourceField() != null)
&& ((!this.getSourceField().isNull()) || (!m_bDontMoveNullSource)))
m_fldDest.moveFieldToThis(this.getSourceField(), bDisplayOption, iMoveType); // Move dependent field to here
else if (m_strSource != null)
m_fldDest.setString(m_strSource, bDisplayOption, iMoveType); // Move dependent field to here
else if (m_fldDest instanceof ReferenceField)
((ReferenceField)m_fldDest).setReference(this.getOwner(), bDisplayOption, iMoveType);
}
else
{
if (bDisplayOption)
m_fldDest.displayField(); // Redisplay based on this check mark
}
} | [
"public",
"void",
"moveTheData",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveType",
")",
"{",
"if",
"(",
"m_convCheckMark",
"!=",
"null",
")",
"if",
"(",
"m_bDisableOnMove",
")",
"m_fldDest",
".",
"setEnabled",
"(",
"!",
"m_convCheckMark",
".",
"getSta... | Actually move the data.
@param bDisplayOption If true, display any changes. | [
"Actually",
"move",
"the",
"data",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/MoveOnEventHandler.java#L200-L220 |
151,529 | jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/BaseXmlTrxMessageIn.java | BaseXmlTrxMessageIn.convertToMessage | public Object convertToMessage()
{
try {
Object reply = this.getRawData();
org.w3c.dom.Node nodeBody = this.getMessageBody(reply, false);
if (this.getConvertToMessage() == null)
return null;
Object msg = this.getConvertToMessage().unmarshalRootElement(nodeBody, this);
return msg;
} catch(Throwable ex) {
this.setMessageException(ex);
}
return null; // Error
} | java | public Object convertToMessage()
{
try {
Object reply = this.getRawData();
org.w3c.dom.Node nodeBody = this.getMessageBody(reply, false);
if (this.getConvertToMessage() == null)
return null;
Object msg = this.getConvertToMessage().unmarshalRootElement(nodeBody, this);
return msg;
} catch(Throwable ex) {
this.setMessageException(ex);
}
return null; // Error
} | [
"public",
"Object",
"convertToMessage",
"(",
")",
"{",
"try",
"{",
"Object",
"reply",
"=",
"this",
".",
"getRawData",
"(",
")",
";",
"org",
".",
"w3c",
".",
"dom",
".",
"Node",
"nodeBody",
"=",
"this",
".",
"getMessageBody",
"(",
"reply",
",",
"false",... | Convert this DOM Tree to the JAXB message tree.
Don't override this method, override the unmarshalRootElement method.
@param nodeBody The source message.
@return The JAXB object root. | [
"Convert",
"this",
"DOM",
"Tree",
"to",
"the",
"JAXB",
"message",
"tree",
".",
"Don",
"t",
"override",
"this",
"method",
"override",
"the",
"unmarshalRootElement",
"method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/BaseXmlTrxMessageIn.java#L106-L122 |
151,530 | jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/BaseXmlTrxMessageIn.java | BaseXmlTrxMessageIn.setMessageException | public void setMessageException(Throwable ex)
{
String strErrorMessage = ex.getMessage();
BaseMessage message = this.getMessage();
if ((message != null) && (message.getMessageHeader() instanceof TrxMessageHeader))
((TrxMessageHeader)message.getMessageHeader()).put(TrxMessageHeader.MESSAGE_ERROR, strErrorMessage);
else
ex.printStackTrace();
} | java | public void setMessageException(Throwable ex)
{
String strErrorMessage = ex.getMessage();
BaseMessage message = this.getMessage();
if ((message != null) && (message.getMessageHeader() instanceof TrxMessageHeader))
((TrxMessageHeader)message.getMessageHeader()).put(TrxMessageHeader.MESSAGE_ERROR, strErrorMessage);
else
ex.printStackTrace();
} | [
"public",
"void",
"setMessageException",
"(",
"Throwable",
"ex",
")",
"{",
"String",
"strErrorMessage",
"=",
"ex",
".",
"getMessage",
"(",
")",
";",
"BaseMessage",
"message",
"=",
"this",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"(",
"message",
"!=",
... | If an exception occurred, set it in the message
@param ex | [
"If",
"an",
"exception",
"occurred",
"set",
"it",
"in",
"the",
"message"
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/BaseXmlTrxMessageIn.java#L147-L155 |
151,531 | jbundle/jbundle | thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JMultiFieldPanel.java | JMultiFieldPanel.addComponent | public void addComponent(JComponent component, boolean bLinkComponentToConverter)
{
this.add(Box.createHorizontalStrut(3));
if (this.getComponentCount() < brgComponentsLinkedToConverter.length)
brgComponentsLinkedToConverter[this.getComponentCount()] = bLinkComponentToConverter;
this.add(component);
} | java | public void addComponent(JComponent component, boolean bLinkComponentToConverter)
{
this.add(Box.createHorizontalStrut(3));
if (this.getComponentCount() < brgComponentsLinkedToConverter.length)
brgComponentsLinkedToConverter[this.getComponentCount()] = bLinkComponentToConverter;
this.add(component);
} | [
"public",
"void",
"addComponent",
"(",
"JComponent",
"component",
",",
"boolean",
"bLinkComponentToConverter",
")",
"{",
"this",
".",
"add",
"(",
"Box",
".",
"createHorizontalStrut",
"(",
"3",
")",
")",
";",
"if",
"(",
"this",
".",
"getComponentCount",
"(",
... | Add this component to this panel. | [
"Add",
"this",
"component",
"to",
"this",
"panel",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JMultiFieldPanel.java#L104-L112 |
151,532 | jbundle/jbundle | thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JMultiFieldPanel.java | JMultiFieldPanel.setControlValue | public void setControlValue(Object objValue, Component component)
{
Convert converter = null;
if (component instanceof ScreenComponent)
converter = ((ScreenComponent)component).getConverter();
if (converter == null)
converter = m_converter;
if (component instanceof FieldComponent)
((FieldComponent)component).setControlValue(converter.getData());
else if (component instanceof JTextComponent)
((JTextComponent)component).setText(converter.toString());
} | java | public void setControlValue(Object objValue, Component component)
{
Convert converter = null;
if (component instanceof ScreenComponent)
converter = ((ScreenComponent)component).getConverter();
if (converter == null)
converter = m_converter;
if (component instanceof FieldComponent)
((FieldComponent)component).setControlValue(converter.getData());
else if (component instanceof JTextComponent)
((JTextComponent)component).setText(converter.toString());
} | [
"public",
"void",
"setControlValue",
"(",
"Object",
"objValue",
",",
"Component",
"component",
")",
"{",
"Convert",
"converter",
"=",
"null",
";",
"if",
"(",
"component",
"instanceof",
"ScreenComponent",
")",
"converter",
"=",
"(",
"(",
"ScreenComponent",
")",
... | Set this control to this value.
@param objValue The value to set the component to.
@param component The component to set to this value. | [
"Set",
"this",
"control",
"to",
"this",
"value",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JMultiFieldPanel.java#L161-L173 |
151,533 | jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/BaseMessageTransport.java | BaseMessageTransport.getTransportProperties | public Map<String,Object> getTransportProperties()
{
Map<String,Object> propMessageTransport = null;
Record recMessageTransport = Record.makeRecordFromClassName(MessageTransportModel.THICK_CLASS, this);
recMessageTransport.setKeyArea(MessageTransportModel.CODE_KEY);
String strMessageType = this.getMessageTransportType();
recMessageTransport.getField(MessageTransportModel.CODE).setString(strMessageType);
try {
if (recMessageTransport.seek(null))
{
PropertiesField fldProperty = (PropertiesField)recMessageTransport.getField(MessageTransportModel.PROPERTIES);
propMessageTransport = fldProperty.loadProperties();
}
} catch (DBException ex) {
ex.printStackTrace();
} finally {
recMessageTransport.free();
recMessageTransport = null;
}
return propMessageTransport;
} | java | public Map<String,Object> getTransportProperties()
{
Map<String,Object> propMessageTransport = null;
Record recMessageTransport = Record.makeRecordFromClassName(MessageTransportModel.THICK_CLASS, this);
recMessageTransport.setKeyArea(MessageTransportModel.CODE_KEY);
String strMessageType = this.getMessageTransportType();
recMessageTransport.getField(MessageTransportModel.CODE).setString(strMessageType);
try {
if (recMessageTransport.seek(null))
{
PropertiesField fldProperty = (PropertiesField)recMessageTransport.getField(MessageTransportModel.PROPERTIES);
propMessageTransport = fldProperty.loadProperties();
}
} catch (DBException ex) {
ex.printStackTrace();
} finally {
recMessageTransport.free();
recMessageTransport = null;
}
return propMessageTransport;
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"getTransportProperties",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"propMessageTransport",
"=",
"null",
";",
"Record",
"recMessageTransport",
"=",
"Record",
".",
"makeRecordFromClassName",
"(",
... | Get the properties that go with this transport type. | [
"Get",
"the",
"properties",
"that",
"go",
"with",
"this",
"transport",
"type",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/BaseMessageTransport.java#L112-L132 |
151,534 | jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/BaseMessageTransport.java | BaseMessageTransport.setupReplyMessage | public void setupReplyMessage(BaseMessage messageReply, BaseMessage messageOut, String strMessageInfoType, String strMessageProcessType)
{
if (messageReply != null) // No reply if null.
{
TrxMessageHeader trxMessageHeaderIncomming = null;
if (messageOut != null)
trxMessageHeaderIncomming = (TrxMessageHeader)messageOut.getMessageHeader();
if (trxMessageHeaderIncomming != null)
{
TrxMessageHeader replyHeader = (TrxMessageHeader)messageReply.getMessageHeader();
if (replyHeader == null)
messageReply.setMessageHeader(replyHeader = new TrxMessageHeader(null, null));
replyHeader.putAll(trxMessageHeaderIncomming.createReplyHeader());
if (strMessageInfoType != null)
((TrxMessageHeader)messageReply.getMessageHeader()).put(TrxMessageHeader.MESSAGE_INFO_TYPE, strMessageInfoType); // Make sure this is seen as a reply
if (strMessageProcessType != null)
((TrxMessageHeader)messageReply.getMessageHeader()).put(TrxMessageHeader.MESSAGE_PROCESS_TYPE, strMessageProcessType); // Make sure this is seen as a reply
if (((TrxMessageHeader)messageReply.getMessageHeader()).getMessageInfoMap() != null)
((TrxMessageHeader)messageReply.getMessageHeader()).getMessageInfoMap().remove(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS); // The reply never uses the message in's processor
Record recMessageProcessInfo = this.getRecord(MessageProcessInfoModel.MESSAGE_PROCESS_INFO_FILE);
if (recMessageProcessInfo == null)
recMessageProcessInfo = Record.makeRecordFromClassName(MessageProcessInfoModel.THICK_CLASS, this);
this.addMessageTransportType(messageReply); // This will insure I get the transport properties
((MessageProcessInfoModel)recMessageProcessInfo).setupMessageHeaderFromCode(messageReply, null, null);
}
if (strMessageInfoType != null)
((TrxMessageHeader)messageReply.getMessageHeader()).put(TrxMessageHeader.MESSAGE_INFO_TYPE, strMessageInfoType); // Make sure this is seen as a reply
if (strMessageProcessType != null)
((TrxMessageHeader)messageReply.getMessageHeader()).put(TrxMessageHeader.MESSAGE_PROCESS_TYPE, strMessageProcessType); // Make sure this is seen as a reply
}
} | java | public void setupReplyMessage(BaseMessage messageReply, BaseMessage messageOut, String strMessageInfoType, String strMessageProcessType)
{
if (messageReply != null) // No reply if null.
{
TrxMessageHeader trxMessageHeaderIncomming = null;
if (messageOut != null)
trxMessageHeaderIncomming = (TrxMessageHeader)messageOut.getMessageHeader();
if (trxMessageHeaderIncomming != null)
{
TrxMessageHeader replyHeader = (TrxMessageHeader)messageReply.getMessageHeader();
if (replyHeader == null)
messageReply.setMessageHeader(replyHeader = new TrxMessageHeader(null, null));
replyHeader.putAll(trxMessageHeaderIncomming.createReplyHeader());
if (strMessageInfoType != null)
((TrxMessageHeader)messageReply.getMessageHeader()).put(TrxMessageHeader.MESSAGE_INFO_TYPE, strMessageInfoType); // Make sure this is seen as a reply
if (strMessageProcessType != null)
((TrxMessageHeader)messageReply.getMessageHeader()).put(TrxMessageHeader.MESSAGE_PROCESS_TYPE, strMessageProcessType); // Make sure this is seen as a reply
if (((TrxMessageHeader)messageReply.getMessageHeader()).getMessageInfoMap() != null)
((TrxMessageHeader)messageReply.getMessageHeader()).getMessageInfoMap().remove(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS); // The reply never uses the message in's processor
Record recMessageProcessInfo = this.getRecord(MessageProcessInfoModel.MESSAGE_PROCESS_INFO_FILE);
if (recMessageProcessInfo == null)
recMessageProcessInfo = Record.makeRecordFromClassName(MessageProcessInfoModel.THICK_CLASS, this);
this.addMessageTransportType(messageReply); // This will insure I get the transport properties
((MessageProcessInfoModel)recMessageProcessInfo).setupMessageHeaderFromCode(messageReply, null, null);
}
if (strMessageInfoType != null)
((TrxMessageHeader)messageReply.getMessageHeader()).put(TrxMessageHeader.MESSAGE_INFO_TYPE, strMessageInfoType); // Make sure this is seen as a reply
if (strMessageProcessType != null)
((TrxMessageHeader)messageReply.getMessageHeader()).put(TrxMessageHeader.MESSAGE_PROCESS_TYPE, strMessageProcessType); // Make sure this is seen as a reply
}
} | [
"public",
"void",
"setupReplyMessage",
"(",
"BaseMessage",
"messageReply",
",",
"BaseMessage",
"messageOut",
",",
"String",
"strMessageInfoType",
",",
"String",
"strMessageProcessType",
")",
"{",
"if",
"(",
"messageReply",
"!=",
"null",
")",
"// No reply if null.",
"{... | Set up a message header for this reply using the message header for the original message.
@param messageReply The (internal or external) reply message (typically without a header).
@param trxMessageHeaderIncomming The header of the message that I'm replying to.
@param The type of message to tag this reply as (Reply in, Reply out, or null = unknown). | [
"Set",
"up",
"a",
"message",
"header",
"for",
"this",
"reply",
"using",
"the",
"message",
"header",
"for",
"the",
"original",
"message",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/BaseMessageTransport.java#L380-L410 |
151,535 | jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/BaseMessageTransport.java | BaseMessageTransport.getProperty | public String getProperty(TrxMessageHeader trxMessageHeader, String strParamName)
{
String strProperty = (String)trxMessageHeader.get(strParamName);
if (strProperty == null)
strProperty = this.getProperty(strParamName);
return strProperty;
} | java | public String getProperty(TrxMessageHeader trxMessageHeader, String strParamName)
{
String strProperty = (String)trxMessageHeader.get(strParamName);
if (strProperty == null)
strProperty = this.getProperty(strParamName);
return strProperty;
} | [
"public",
"String",
"getProperty",
"(",
"TrxMessageHeader",
"trxMessageHeader",
",",
"String",
"strParamName",
")",
"{",
"String",
"strProperty",
"=",
"(",
"String",
")",
"trxMessageHeader",
".",
"get",
"(",
"strParamName",
")",
";",
"if",
"(",
"strProperty",
"=... | Get this transport specific param.
Get this param. The transport properties specify param names by adding the word
param after it. For example, to specify a different param for the messageClass
for a SOAP transport, the SOAP property messageClassParam=SOAPMessageClass should
be set in the SOAP transport properties and the SOAPMessageClass should be set in
the messageProperties so it knows which message class to use for SOAP messages.
@param trxMessageHeader The message header to find a param in.
@param strParam The param name.
@return The parameter. | [
"Get",
"this",
"transport",
"specific",
"param",
".",
"Get",
"this",
"param",
".",
"The",
"transport",
"properties",
"specify",
"param",
"names",
"by",
"adding",
"the",
"word",
"param",
"after",
"it",
".",
"For",
"example",
"to",
"specify",
"a",
"different",... | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/BaseMessageTransport.java#L436-L442 |
151,536 | jbundle/jbundle | main/db/src/main/java/org/jbundle/main/db/base/ContactField.java | ContactField.getContactTypeField | public ContactTypeField getContactTypeField()
{
BaseField field = this.getRecord().getField("ContactTypeID");
if (field instanceof ContactTypeField)
return (ContactTypeField)field;
return null; // Never
} | java | public ContactTypeField getContactTypeField()
{
BaseField field = this.getRecord().getField("ContactTypeID");
if (field instanceof ContactTypeField)
return (ContactTypeField)field;
return null; // Never
} | [
"public",
"ContactTypeField",
"getContactTypeField",
"(",
")",
"{",
"BaseField",
"field",
"=",
"this",
".",
"getRecord",
"(",
")",
".",
"getField",
"(",
"\"ContactTypeID\"",
")",
";",
"if",
"(",
"field",
"instanceof",
"ContactTypeField",
")",
"return",
"(",
"C... | Get the contact type field in the same record as this contact field.
@return The contact type field. | [
"Get",
"the",
"contact",
"type",
"field",
"in",
"the",
"same",
"record",
"as",
"this",
"contact",
"field",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/base/ContactField.java#L188-L194 |
151,537 | williamwebb/alogger | BillingHelper/src/main/java/com/jug6ernaut/billing/Security.java | Security.generatePublicKey | public static PublicKey generatePublicKey(String encodedPublicKey) {
try {
byte[] decodedKey = Base64.decode(encodedPublicKey);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
return keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeySpecException e) {
Log.e(TAG, "Invalid key specification.");
throw new IllegalArgumentException(e);
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
throw new IllegalArgumentException(e);
}
} | java | public static PublicKey generatePublicKey(String encodedPublicKey) {
try {
byte[] decodedKey = Base64.decode(encodedPublicKey);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
return keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeySpecException e) {
Log.e(TAG, "Invalid key specification.");
throw new IllegalArgumentException(e);
} catch (Base64DecoderException e) {
Log.e(TAG, "Base64 decoding failed.");
throw new IllegalArgumentException(e);
}
} | [
"public",
"static",
"PublicKey",
"generatePublicKey",
"(",
"String",
"encodedPublicKey",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"decodedKey",
"=",
"Base64",
".",
"decode",
"(",
"encodedPublicKey",
")",
";",
"KeyFactory",
"keyFactory",
"=",
"KeyFactory",
".",
... | Generates a PublicKey instance from a string containing the
Base64-encoded public key.
@param encodedPublicKey Base64-encoded public key
@throws IllegalArgumentException if encodedPublicKey is invalid | [
"Generates",
"a",
"PublicKey",
"instance",
"from",
"a",
"string",
"containing",
"the",
"Base64",
"-",
"encoded",
"public",
"key",
"."
] | 61fca49e0b8d9c3a76c40da8883ac354b240351e | https://github.com/williamwebb/alogger/blob/61fca49e0b8d9c3a76c40da8883ac354b240351e/BillingHelper/src/main/java/com/jug6ernaut/billing/Security.java#L67-L81 |
151,538 | inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ConfigurableContentRepository.java | ConfigurableContentRepository.logNodeTypes | private void logNodeTypes(final NodeType... nodeTypes) {
if(LOG.isDebugEnabled()){
StringBuilder buf = new StringBuilder(32);
buf.append("[\n");
for(NodeType nt : nodeTypes){
buf.append(nt.getName()).append(" > ");
for(NodeType st : nt.getSupertypes()){
buf.append(st.getName()).append(", ");
}
buf.append('\n');
for(PropertyDefinition pd : nt.getPropertyDefinitions()){
buf.append("\t").append(pd.getName()).append(" (")
.append(PropertyType.nameFromValue(pd.getRequiredType()))
.append(")\n");
}
}
buf.append(']');
LOG.debug("Registered NodeTypes: {}",buf.toString());
}
} | java | private void logNodeTypes(final NodeType... nodeTypes) {
if(LOG.isDebugEnabled()){
StringBuilder buf = new StringBuilder(32);
buf.append("[\n");
for(NodeType nt : nodeTypes){
buf.append(nt.getName()).append(" > ");
for(NodeType st : nt.getSupertypes()){
buf.append(st.getName()).append(", ");
}
buf.append('\n');
for(PropertyDefinition pd : nt.getPropertyDefinitions()){
buf.append("\t").append(pd.getName()).append(" (")
.append(PropertyType.nameFromValue(pd.getRequiredType()))
.append(")\n");
}
}
buf.append(']');
LOG.debug("Registered NodeTypes: {}",buf.toString());
}
} | [
"private",
"void",
"logNodeTypes",
"(",
"final",
"NodeType",
"...",
"nodeTypes",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"32",
")",
";",
"buf",
".",
"append",
"(",
... | Helper method to logs a list of node types and their properties in a human readable way.
@param nodeTypes
the node types to be logged. | [
"Helper",
"method",
"to",
"logs",
"a",
"list",
"of",
"node",
"types",
"and",
"their",
"properties",
"in",
"a",
"human",
"readable",
"way",
"."
] | 66e67553bad4b1ff817e1715fd1d3dd833406744 | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/ConfigurableContentRepository.java#L164-L184 |
151,539 | rometools/rome-certiorem | src/main/java/com/rometools/certiorem/hub/notify/standard/AbstractNotifier.java | AbstractNotifier.notifySubscribers | @Override
public void notifySubscribers(final List<? extends Subscriber> subscribers, final SyndFeed value, final SubscriptionSummaryCallback callback) {
String mimeType = null;
if (value.getFeedType().startsWith("rss")) {
mimeType = "application/rss+xml";
} else {
mimeType = "application/atom+xml";
}
final SyndFeedOutput output = new SyndFeedOutput();
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
output.output(value, new OutputStreamWriter(baos));
baos.close();
} catch (final IOException ex) {
LOG.error("Unable to output the feed", ex);
throw new RuntimeException("Unable to output the feed.", ex);
} catch (final FeedException ex) {
LOG.error("Unable to output the feed", ex);
throw new RuntimeException("Unable to output the feed.", ex);
}
final byte[] payload = baos.toByteArray();
for (final Subscriber s : subscribers) {
final Notification not = new Notification();
not.callback = callback;
not.lastRun = 0;
not.mimeType = mimeType;
not.payload = payload;
not.retryCount = 0;
not.subscriber = s;
enqueueNotification(not);
}
} | java | @Override
public void notifySubscribers(final List<? extends Subscriber> subscribers, final SyndFeed value, final SubscriptionSummaryCallback callback) {
String mimeType = null;
if (value.getFeedType().startsWith("rss")) {
mimeType = "application/rss+xml";
} else {
mimeType = "application/atom+xml";
}
final SyndFeedOutput output = new SyndFeedOutput();
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
output.output(value, new OutputStreamWriter(baos));
baos.close();
} catch (final IOException ex) {
LOG.error("Unable to output the feed", ex);
throw new RuntimeException("Unable to output the feed.", ex);
} catch (final FeedException ex) {
LOG.error("Unable to output the feed", ex);
throw new RuntimeException("Unable to output the feed.", ex);
}
final byte[] payload = baos.toByteArray();
for (final Subscriber s : subscribers) {
final Notification not = new Notification();
not.callback = callback;
not.lastRun = 0;
not.mimeType = mimeType;
not.payload = payload;
not.retryCount = 0;
not.subscriber = s;
enqueueNotification(not);
}
} | [
"@",
"Override",
"public",
"void",
"notifySubscribers",
"(",
"final",
"List",
"<",
"?",
"extends",
"Subscriber",
">",
"subscribers",
",",
"final",
"SyndFeed",
"value",
",",
"final",
"SubscriptionSummaryCallback",
"callback",
")",
"{",
"String",
"mimeType",
"=",
... | This method will serialize the synd feed and build Notifications for the implementation class
to handle.
@see enqueueNotification
@param subscribers List of subscribers to notify
@param value The SyndFeed object to send
@param callback A callback that will be invoked each time a subscriber is notified. | [
"This",
"method",
"will",
"serialize",
"the",
"synd",
"feed",
"and",
"build",
"Notifications",
"for",
"the",
"implementation",
"class",
"to",
"handle",
"."
] | e5a003193dd2abd748e77961c0f216a7f5690712 | https://github.com/rometools/rome-certiorem/blob/e5a003193dd2abd748e77961c0f216a7f5690712/src/main/java/com/rometools/certiorem/hub/notify/standard/AbstractNotifier.java#L59-L96 |
151,540 | jbundle/jbundle | app/program/db/src/main/java/org/jbundle/app/program/db/util/ResourcesUtilities.java | ResourcesUtilities.fixPropertyValue | public static String fixPropertyValue(String string, boolean bResourceListBundle)
{
if (string == null)
string = Constants.BLANK;
StringBuffer strBuff = new StringBuffer();
StringReader stringReader = new StringReader(string);
LineNumberReader lineReader = new LineNumberReader(stringReader);
boolean bFirstTime = true;
String strLine;
try {
while ((strLine = lineReader.readLine()) != null)
{
if (!bFirstTime)
{
if (bResourceListBundle)
strBuff.append(" + \"\\n\" +" + "\n\t\t");
else
strBuff.append("\\n\\\n");
}
if (bResourceListBundle)
strBuff.append('\"');
if (!bFirstTime)
if (!bResourceListBundle)
if (strLine.startsWith(" "))
strBuff.append("\\"); // Escape out the first space for properties files
strBuff.append(ResourcesUtilities.encodeLine(strLine, bResourceListBundle));
if (bResourceListBundle)
strBuff.append("\"");
bFirstTime = false;
}
} catch (IOException ex) {
ex.printStackTrace(); // Never
}
return strBuff.toString();
} | java | public static String fixPropertyValue(String string, boolean bResourceListBundle)
{
if (string == null)
string = Constants.BLANK;
StringBuffer strBuff = new StringBuffer();
StringReader stringReader = new StringReader(string);
LineNumberReader lineReader = new LineNumberReader(stringReader);
boolean bFirstTime = true;
String strLine;
try {
while ((strLine = lineReader.readLine()) != null)
{
if (!bFirstTime)
{
if (bResourceListBundle)
strBuff.append(" + \"\\n\" +" + "\n\t\t");
else
strBuff.append("\\n\\\n");
}
if (bResourceListBundle)
strBuff.append('\"');
if (!bFirstTime)
if (!bResourceListBundle)
if (strLine.startsWith(" "))
strBuff.append("\\"); // Escape out the first space for properties files
strBuff.append(ResourcesUtilities.encodeLine(strLine, bResourceListBundle));
if (bResourceListBundle)
strBuff.append("\"");
bFirstTime = false;
}
} catch (IOException ex) {
ex.printStackTrace(); // Never
}
return strBuff.toString();
} | [
"public",
"static",
"String",
"fixPropertyValue",
"(",
"String",
"string",
",",
"boolean",
"bResourceListBundle",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"string",
"=",
"Constants",
".",
"BLANK",
";",
"StringBuffer",
"strBuff",
"=",
"new",
"StringBuf... | Clean up this long string and convert it to a java quoted string. | [
"Clean",
"up",
"this",
"long",
"string",
"and",
"convert",
"it",
"to",
"a",
"java",
"quoted",
"string",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/util/ResourcesUtilities.java#L49-L83 |
151,541 | jbundle/jbundle | app/program/db/src/main/java/org/jbundle/app/program/db/util/ResourcesUtilities.java | ResourcesUtilities.encodeLine | public static String encodeLine(String string, boolean bResourceListBundle)
{
if (string == null)
return string;
for (int i = 0; i < string.length(); i++)
{
if (((string.charAt(i) == '\"') || (string.charAt(i) == '\\'))
|| ((!bResourceListBundle) && (string.charAt(i) == ':')))
{ // must preceed these special characters with a "\"
string = string.substring(0, i) + "\\" + string.substring(i);
i++;
}
else if (string.charAt(i) > 127)
{
String strHex = "0123456789ABCDEF";
String strOut = "\\u";
strOut += strHex.charAt((string.charAt(i) & 0xF000) >> 12);
strOut += strHex.charAt((string.charAt(i) & 0xF00) >> 8);
strOut += strHex.charAt((string.charAt(i) & 0xF0) >> 4);
strOut += strHex.charAt(string.charAt(i) & 0xF);
string = string.substring(0, i) + strOut + string.substring(i + 1);
i = i + strOut.length() - 1;
}
}
return string;
} | java | public static String encodeLine(String string, boolean bResourceListBundle)
{
if (string == null)
return string;
for (int i = 0; i < string.length(); i++)
{
if (((string.charAt(i) == '\"') || (string.charAt(i) == '\\'))
|| ((!bResourceListBundle) && (string.charAt(i) == ':')))
{ // must preceed these special characters with a "\"
string = string.substring(0, i) + "\\" + string.substring(i);
i++;
}
else if (string.charAt(i) > 127)
{
String strHex = "0123456789ABCDEF";
String strOut = "\\u";
strOut += strHex.charAt((string.charAt(i) & 0xF000) >> 12);
strOut += strHex.charAt((string.charAt(i) & 0xF00) >> 8);
strOut += strHex.charAt((string.charAt(i) & 0xF0) >> 4);
strOut += strHex.charAt(string.charAt(i) & 0xF);
string = string.substring(0, i) + strOut + string.substring(i + 1);
i = i + strOut.length() - 1;
}
}
return string;
} | [
"public",
"static",
"String",
"encodeLine",
"(",
"String",
"string",
",",
"boolean",
"bResourceListBundle",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"return",
"string",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"string",
".",
"leng... | Encode the utf-16 characters in this line to escaped java strings. | [
"Encode",
"the",
"utf",
"-",
"16",
"characters",
"in",
"this",
"line",
"to",
"escaped",
"java",
"strings",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/util/ResourcesUtilities.java#L87-L112 |
151,542 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.doFor | public static final <T> void doFor(Object bean, String property, Consumer<T> consumer)
{
T t = (T) getValue(bean, property);
consumer.accept(t);
} | java | public static final <T> void doFor(Object bean, String property, Consumer<T> consumer)
{
T t = (T) getValue(bean, property);
consumer.accept(t);
} | [
"public",
"static",
"final",
"<",
"T",
">",
"void",
"doFor",
"(",
"Object",
"bean",
",",
"String",
"property",
",",
"Consumer",
"<",
"T",
">",
"consumer",
")",
"{",
"T",
"t",
"=",
"(",
"T",
")",
"getValue",
"(",
"bean",
",",
"property",
")",
";",
... | Executes consumer for property.
@param <T>
@param bean
@param property
@param consumer | [
"Executes",
"consumer",
"for",
"property",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L92-L96 |
151,543 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.getValue | public static final Object getValue(Object bean, String property)
{
return doFor(bean, property, null, BeanHelper::getValue, BeanHelper::getValue, BeanHelper::getFieldValue, BeanHelper::getMethodValue);
} | java | public static final Object getValue(Object bean, String property)
{
return doFor(bean, property, null, BeanHelper::getValue, BeanHelper::getValue, BeanHelper::getFieldValue, BeanHelper::getMethodValue);
} | [
"public",
"static",
"final",
"Object",
"getValue",
"(",
"Object",
"bean",
",",
"String",
"property",
")",
"{",
"return",
"doFor",
"(",
"bean",
",",
"property",
",",
"null",
",",
"BeanHelper",
"::",
"getValue",
",",
"BeanHelper",
"::",
"getValue",
",",
"Bea... | Return propertys value.
@param bean
@param property
@return | [
"Return",
"propertys",
"value",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L103-L106 |
151,544 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.getParameterTypes | public static final Class[] getParameterTypes(Object bean, String property)
{
Type type = (Type) doFor(
bean,
property,
null,
(Object a, int i)->{Object o = Array.get(a, i);return o!=null?o.getClass().getComponentType():null;},
(List l, int i)->{return l.get(i).getClass().getGenericSuperclass();},
(Object o, Class c, String p)->{return getField(c, p).getGenericType();},
(Object o, Method m)->{return m.getGenericReturnType();});
if (type instanceof ParameterizedType)
{
ParameterizedType pt = (ParameterizedType) type;
Type[] ata = pt.getActualTypeArguments();
if (ata.length > 0)
{
Class[] ca = new Class[ata.length];
for (int ii=0;ii<ca.length;ii++)
{
ca[ii] = (Class) ata[ii];
}
return ca;
}
}
if (type instanceof Class)
{
Class cls = (Class) type;
if (cls.isArray())
{
cls = cls.getComponentType();
}
return new Class[] {cls};
}
return null;
} | java | public static final Class[] getParameterTypes(Object bean, String property)
{
Type type = (Type) doFor(
bean,
property,
null,
(Object a, int i)->{Object o = Array.get(a, i);return o!=null?o.getClass().getComponentType():null;},
(List l, int i)->{return l.get(i).getClass().getGenericSuperclass();},
(Object o, Class c, String p)->{return getField(c, p).getGenericType();},
(Object o, Method m)->{return m.getGenericReturnType();});
if (type instanceof ParameterizedType)
{
ParameterizedType pt = (ParameterizedType) type;
Type[] ata = pt.getActualTypeArguments();
if (ata.length > 0)
{
Class[] ca = new Class[ata.length];
for (int ii=0;ii<ca.length;ii++)
{
ca[ii] = (Class) ata[ii];
}
return ca;
}
}
if (type instanceof Class)
{
Class cls = (Class) type;
if (cls.isArray())
{
cls = cls.getComponentType();
}
return new Class[] {cls};
}
return null;
} | [
"public",
"static",
"final",
"Class",
"[",
"]",
"getParameterTypes",
"(",
"Object",
"bean",
",",
"String",
"property",
")",
"{",
"Type",
"type",
"=",
"(",
"Type",
")",
"doFor",
"(",
"bean",
",",
"property",
",",
"null",
",",
"(",
"Object",
"a",
",",
... | Returns actual parameter types for property
@param bean
@param property
@return | [
"Returns",
"actual",
"parameter",
"types",
"for",
"property"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L227-L261 |
151,545 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.getField | public static Field getField(Class cls, String fieldname) throws NoSuchFieldException
{
while (true)
{
try
{
return cls.getDeclaredField(fieldname);
}
catch (NoSuchFieldException ex)
{
cls = cls.getSuperclass();
if (Object.class.equals(cls))
{
throw ex;
}
}
catch (SecurityException ex)
{
throw new IllegalArgumentException(ex);
}
}
} | java | public static Field getField(Class cls, String fieldname) throws NoSuchFieldException
{
while (true)
{
try
{
return cls.getDeclaredField(fieldname);
}
catch (NoSuchFieldException ex)
{
cls = cls.getSuperclass();
if (Object.class.equals(cls))
{
throw ex;
}
}
catch (SecurityException ex)
{
throw new IllegalArgumentException(ex);
}
}
} | [
"public",
"static",
"Field",
"getField",
"(",
"Class",
"cls",
",",
"String",
"fieldname",
")",
"throws",
"NoSuchFieldException",
"{",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"return",
"cls",
".",
"getDeclaredField",
"(",
"fieldname",
")",
";",
"}",
"ca... | Returns Declared field either from given class or it's super class
@param cls
@param fieldname
@return
@throws NoSuchFieldException | [
"Returns",
"Declared",
"field",
"either",
"from",
"given",
"class",
"or",
"it",
"s",
"super",
"class"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L269-L290 |
151,546 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.getType | public static final Class getType(Object bean, String property)
{
return (Class) doFor(bean, property, null, BeanHelper::getObjectType, BeanHelper::getObjectType, BeanHelper::getFieldType, BeanHelper::getMethodType);
} | java | public static final Class getType(Object bean, String property)
{
return (Class) doFor(bean, property, null, BeanHelper::getObjectType, BeanHelper::getObjectType, BeanHelper::getFieldType, BeanHelper::getMethodType);
} | [
"public",
"static",
"final",
"Class",
"getType",
"(",
"Object",
"bean",
",",
"String",
"property",
")",
"{",
"return",
"(",
"Class",
")",
"doFor",
"(",
"bean",
",",
"property",
",",
"null",
",",
"BeanHelper",
"::",
"getObjectType",
",",
"BeanHelper",
"::",... | Return property type.
@param bean
@param property
@return | [
"Return",
"property",
"type",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L321-L324 |
151,547 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.getAnnotation | public static final <T extends Annotation> T getAnnotation(Object bean, String property, Class<T> annotationClass)
{
return (T) doFor(
bean,
property,
null,
(Object a, int i)->{Object o=Array.get(a, i);return o!=null?o.getClass().getAnnotation(annotationClass):null;},
(List l, int i)->{return l.get(i).getClass().getAnnotation(annotationClass);},
(Object b, Class c, String p)->{return getField(c, p).getAnnotation(annotationClass);},
(Object b, Method m)->{return m.getAnnotation(annotationClass);});
} | java | public static final <T extends Annotation> T getAnnotation(Object bean, String property, Class<T> annotationClass)
{
return (T) doFor(
bean,
property,
null,
(Object a, int i)->{Object o=Array.get(a, i);return o!=null?o.getClass().getAnnotation(annotationClass):null;},
(List l, int i)->{return l.get(i).getClass().getAnnotation(annotationClass);},
(Object b, Class c, String p)->{return getField(c, p).getAnnotation(annotationClass);},
(Object b, Method m)->{return m.getAnnotation(annotationClass);});
} | [
"public",
"static",
"final",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getAnnotation",
"(",
"Object",
"bean",
",",
"String",
"property",
",",
"Class",
"<",
"T",
">",
"annotationClass",
")",
"{",
"return",
"(",
"T",
")",
"doFor",
"(",
"bean",
",",
"... | Returns property annotation.
@param <T>
@param bean
@param property
@param annotationClass
@return | [
"Returns",
"property",
"annotation",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L337-L347 |
151,548 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.hasProperty | public static final boolean hasProperty(Object bean, String property)
{
try
{
return (boolean) doFor(
bean,
property,
null,
(Object a, int i)->{return true;},
(List l, int i)->{return true;},
(Object b, Class c, String p)->{getField(c, p);return true;},
(Object b, Method m)->{return true;});
}
catch (BeanHelperException ex)
{
return false;
}
} | java | public static final boolean hasProperty(Object bean, String property)
{
try
{
return (boolean) doFor(
bean,
property,
null,
(Object a, int i)->{return true;},
(List l, int i)->{return true;},
(Object b, Class c, String p)->{getField(c, p);return true;},
(Object b, Method m)->{return true;});
}
catch (BeanHelperException ex)
{
return false;
}
} | [
"public",
"static",
"final",
"boolean",
"hasProperty",
"(",
"Object",
"bean",
",",
"String",
"property",
")",
"{",
"try",
"{",
"return",
"(",
"boolean",
")",
"doFor",
"(",
"bean",
",",
"property",
",",
"null",
",",
"(",
"Object",
"a",
",",
"int",
"i",
... | Return true if property exists.
@param bean
@param property
@return | [
"Return",
"true",
"if",
"property",
"exists",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L355-L372 |
151,549 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.defaultFactory | public static final <T> T defaultFactory(Class<T> cls, String hint)
{
try
{
return cls.newInstance();
}
catch (InstantiationException | IllegalAccessException ex)
{
throw new IllegalArgumentException(ex);
}
} | java | public static final <T> T defaultFactory(Class<T> cls, String hint)
{
try
{
return cls.newInstance();
}
catch (InstantiationException | IllegalAccessException ex)
{
throw new IllegalArgumentException(ex);
}
} | [
"public",
"static",
"final",
"<",
"T",
">",
"T",
"defaultFactory",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"String",
"hint",
")",
"{",
"try",
"{",
"return",
"cls",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"|",
... | Default object factory that calls newInstance method. Checked exceptions
are wrapped in IllegalArgumentException.
@param <T>
@param cls Target class
@param hint Hint for factory
@return | [
"Default",
"object",
"factory",
"that",
"calls",
"newInstance",
"method",
".",
"Checked",
"exceptions",
"are",
"wrapped",
"in",
"IllegalArgumentException",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L416-L426 |
151,550 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.applyList | public static final <T> T applyList(Object base, String fieldname)
{
return applyList(base, fieldname, BeanHelper::defaultFactory);
} | java | public static final <T> T applyList(Object base, String fieldname)
{
return applyList(base, fieldname, BeanHelper::defaultFactory);
} | [
"public",
"static",
"final",
"<",
"T",
">",
"T",
"applyList",
"(",
"Object",
"base",
",",
"String",
"fieldname",
")",
"{",
"return",
"applyList",
"(",
"base",
",",
"fieldname",
",",
"BeanHelper",
"::",
"defaultFactory",
")",
";",
"}"
] | Applies bean action by using default factory.
<p>Bean actions are:
<p>List item property remove by adding '#' to the end of pattern.
<p>E.g. list.3- same as list.remove(3)
<p>List item property assign by adding '=' to the end of pattern
<p>E.g. list.3=hint same as list.set(3, factory.get(cls, hint))
<p>List item creation to the end of the list.
<p>E.g. list+ same as add(factory.get(cls, null))
<p>E.g. list+hint same as add(factory.get(cls, hint))
@param <T>
@param base
@param fieldname
@return true if pattern was applied | [
"Applies",
"bean",
"action",
"by",
"using",
"default",
"factory",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L443-L446 |
151,551 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.applyPrefix | public static final String applyPrefix(String property)
{
int addIdx = property.lastIndexOf(Add);
if (addIdx != -1)
{
return property.substring(0, addIdx);
}
else
{
int assignIdx = property.lastIndexOf(Assign);
if (assignIdx != -1)
{
return property.substring(0, assignIdx);
}
else
{
if (property.endsWith(Remove))
{
return property.substring(0, property.length()-1);
}
else
{
return property;
}
}
}
} | java | public static final String applyPrefix(String property)
{
int addIdx = property.lastIndexOf(Add);
if (addIdx != -1)
{
return property.substring(0, addIdx);
}
else
{
int assignIdx = property.lastIndexOf(Assign);
if (assignIdx != -1)
{
return property.substring(0, assignIdx);
}
else
{
if (property.endsWith(Remove))
{
return property.substring(0, property.length()-1);
}
else
{
return property;
}
}
}
} | [
"public",
"static",
"final",
"String",
"applyPrefix",
"(",
"String",
"property",
")",
"{",
"int",
"addIdx",
"=",
"property",
".",
"lastIndexOf",
"(",
"Add",
")",
";",
"if",
"(",
"addIdx",
"!=",
"-",
"1",
")",
"{",
"return",
"property",
".",
"substring",
... | Return prefix of apply pattern or pattern if not apply-pattern.
@param property
@return | [
"Return",
"prefix",
"of",
"apply",
"pattern",
"or",
"pattern",
"if",
"not",
"apply",
"-",
"pattern",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L495-L521 |
151,552 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.removeList | public static final Object removeList(Object bean, String property)
{
return doFor(
bean,
property,
null,
(Object a, int i)->{throw new UnsupportedOperationException("not supported");},
(List l, int i)->{return l.remove(i);},
(Object b, Class c, String p)->{throw new UnsupportedOperationException("not supported");},
(Object b, Method m)->{throw new UnsupportedOperationException("not supported");}
);
} | java | public static final Object removeList(Object bean, String property)
{
return doFor(
bean,
property,
null,
(Object a, int i)->{throw new UnsupportedOperationException("not supported");},
(List l, int i)->{return l.remove(i);},
(Object b, Class c, String p)->{throw new UnsupportedOperationException("not supported");},
(Object b, Method m)->{throw new UnsupportedOperationException("not supported");}
);
} | [
"public",
"static",
"final",
"Object",
"removeList",
"(",
"Object",
"bean",
",",
"String",
"property",
")",
"{",
"return",
"doFor",
"(",
"bean",
",",
"property",
",",
"null",
",",
"(",
"Object",
"a",
",",
"int",
"i",
")",
"->",
"{",
"throw",
"new",
"... | Removes pattern item from list
@param bean
@param property | [
"Removes",
"pattern",
"item",
"from",
"list"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L563-L574 |
151,553 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.addList | public static final <T> void addList(Object bean, String property, T value)
{
addList(bean, property, null, (Class<T> c, String h)->{return value;});
} | java | public static final <T> void addList(Object bean, String property, T value)
{
addList(bean, property, null, (Class<T> c, String h)->{return value;});
} | [
"public",
"static",
"final",
"<",
"T",
">",
"void",
"addList",
"(",
"Object",
"bean",
",",
"String",
"property",
",",
"T",
"value",
")",
"{",
"addList",
"(",
"bean",
",",
"property",
",",
"null",
",",
"(",
"Class",
"<",
"T",
">",
"c",
",",
"String"... | Adds pattern item to end of list
@param <T>
@param bean
@param property
@param value | [
"Adds",
"pattern",
"item",
"to",
"end",
"of",
"list"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L582-L585 |
151,554 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.addList | public static final <T> T addList(Object bean, String property, String hint, BiFunction<Class<T>,String,T> factory)
{
Object fieldValue = getValue(bean, property);
if (fieldValue instanceof List)
{
List list = (List) fieldValue;
Class[] pt = getParameterTypes(bean, property);
T value = (T)factory.apply(pt[0], hint);
if (value != null && !pt[0].isAssignableFrom(value.getClass()))
{
throw new IllegalArgumentException(pt[0]+" not assignable from "+value);
}
list.add(value);
return value;
}
else
{
throw new IllegalArgumentException(fieldValue+" not List");
}
} | java | public static final <T> T addList(Object bean, String property, String hint, BiFunction<Class<T>,String,T> factory)
{
Object fieldValue = getValue(bean, property);
if (fieldValue instanceof List)
{
List list = (List) fieldValue;
Class[] pt = getParameterTypes(bean, property);
T value = (T)factory.apply(pt[0], hint);
if (value != null && !pt[0].isAssignableFrom(value.getClass()))
{
throw new IllegalArgumentException(pt[0]+" not assignable from "+value);
}
list.add(value);
return value;
}
else
{
throw new IllegalArgumentException(fieldValue+" not List");
}
} | [
"public",
"static",
"final",
"<",
"T",
">",
"T",
"addList",
"(",
"Object",
"bean",
",",
"String",
"property",
",",
"String",
"hint",
",",
"BiFunction",
"<",
"Class",
"<",
"T",
">",
",",
"String",
",",
"T",
">",
"factory",
")",
"{",
"Object",
"fieldVa... | Adds pattern item to end of list using given factory and hint
@param <T>
@param bean
@param property
@param hint
@param factory | [
"Adds",
"pattern",
"item",
"to",
"end",
"of",
"list",
"using",
"given",
"factory",
"and",
"hint"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L594-L613 |
151,555 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.getter | public static final String getter(Field field, String fieldName)
{
Class<?> type = field.getType();
if (type.isPrimitive() && "boolean".equals(type.getName()))
{
return isser(fieldName);
}
else
{
return getter(fieldName);
}
} | java | public static final String getter(Field field, String fieldName)
{
Class<?> type = field.getType();
if (type.isPrimitive() && "boolean".equals(type.getName()))
{
return isser(fieldName);
}
else
{
return getter(fieldName);
}
} | [
"public",
"static",
"final",
"String",
"getter",
"(",
"Field",
"field",
",",
"String",
"fieldName",
")",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"field",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
".",
"isPrimitive",
"(",
")",
"&&",
"\"boole... | property -> getProperty
@param field
@param fieldName
@return | [
"property",
"-",
">",
"getProperty"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L707-L718 |
151,556 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.prefix | public static final String prefix(String pattern)
{
int idx = CharSequences.lastIndexOf(pattern, BeanHelper::separator);
if (idx != -1)
{
return pattern.substring(0, idx);
}
else
{
return "";
}
} | java | public static final String prefix(String pattern)
{
int idx = CharSequences.lastIndexOf(pattern, BeanHelper::separator);
if (idx != -1)
{
return pattern.substring(0, idx);
}
else
{
return "";
}
} | [
"public",
"static",
"final",
"String",
"prefix",
"(",
"String",
"pattern",
")",
"{",
"int",
"idx",
"=",
"CharSequences",
".",
"lastIndexOf",
"(",
"pattern",
",",
"BeanHelper",
"::",
"separator",
")",
";",
"if",
"(",
"idx",
"!=",
"-",
"1",
")",
"{",
"re... | Return string before last reparator
@param pattern
@return | [
"Return",
"string",
"before",
"last",
"reparator"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L905-L916 |
151,557 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.isListItem | public static final boolean isListItem(String pattern)
{
int idx = pattern.lastIndexOf(Lim);
if (idx != -1)
{
try
{
Integer.parseInt(pattern.substring(idx+1));
return true;
}
catch (NumberFormatException ex)
{
return false;
}
}
else
{
return false;
}
} | java | public static final boolean isListItem(String pattern)
{
int idx = pattern.lastIndexOf(Lim);
if (idx != -1)
{
try
{
Integer.parseInt(pattern.substring(idx+1));
return true;
}
catch (NumberFormatException ex)
{
return false;
}
}
else
{
return false;
}
} | [
"public",
"static",
"final",
"boolean",
"isListItem",
"(",
"String",
"pattern",
")",
"{",
"int",
"idx",
"=",
"pattern",
".",
"lastIndexOf",
"(",
"Lim",
")",
";",
"if",
"(",
"idx",
"!=",
"-",
"1",
")",
"{",
"try",
"{",
"Integer",
".",
"parseInt",
"(",... | Return true if string after last separator is numeric
@param pattern
@return | [
"Return",
"true",
"if",
"string",
"after",
"last",
"separator",
"is",
"numeric"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L922-L941 |
151,558 | tvesalainen/util | util/src/main/java/org/vesalainen/bean/BeanHelper.java | BeanHelper.getProperties | public static final Set<String> getProperties(Object bean)
{
return stream(bean).collect(Collectors.toSet());
} | java | public static final Set<String> getProperties(Object bean)
{
return stream(bean).collect(Collectors.toSet());
} | [
"public",
"static",
"final",
"Set",
"<",
"String",
">",
"getProperties",
"(",
"Object",
"bean",
")",
"{",
"return",
"stream",
"(",
"bean",
")",
".",
"collect",
"(",
"Collectors",
".",
"toSet",
"(",
")",
")",
";",
"}"
] | Return set of objects patterns
@param bean
@return | [
"Return",
"set",
"of",
"objects",
"patterns"
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L964-L967 |
151,559 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.free | public void free()
{
super.free();
if (m_record != null)
m_record.removeField(this);
m_record = null;
m_strFieldName = null;
m_strFieldDesc = null;
if (m_vScreenField != null)
{ // Remove all the screen fields
m_vScreenField.removeAllElements();
m_vScreenField = null;
}
} | java | public void free()
{
super.free();
if (m_record != null)
m_record.removeField(this);
m_record = null;
m_strFieldName = null;
m_strFieldDesc = null;
if (m_vScreenField != null)
{ // Remove all the screen fields
m_vScreenField.removeAllElements();
m_vScreenField = null;
}
} | [
"public",
"void",
"free",
"(",
")",
"{",
"super",
".",
"free",
"(",
")",
";",
"if",
"(",
"m_record",
"!=",
"null",
")",
"m_record",
".",
"removeField",
"(",
"this",
")",
";",
"m_record",
"=",
"null",
";",
"m_strFieldName",
"=",
"null",
";",
"m_strFie... | Free this field's resources.
Removes this fieldlist from the parent record. | [
"Free",
"this",
"field",
"s",
"resources",
".",
"Removes",
"this",
"fieldlist",
"from",
"the",
"parent",
"record",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L138-L151 |
151,560 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.addComponent | public void addComponent(Object sField)
{
if (m_vScreenField == null)
m_vScreenField = new Vector<Object>();
m_vScreenField.addElement(sField); // Notify this screen field if I change
} | java | public void addComponent(Object sField)
{
if (m_vScreenField == null)
m_vScreenField = new Vector<Object>();
m_vScreenField.addElement(sField); // Notify this screen field if I change
} | [
"public",
"void",
"addComponent",
"(",
"Object",
"sField",
")",
"{",
"if",
"(",
"m_vScreenField",
"==",
"null",
")",
"m_vScreenField",
"=",
"new",
"Vector",
"<",
"Object",
">",
"(",
")",
";",
"m_vScreenField",
".",
"addElement",
"(",
"sField",
")",
";",
... | This screen component is displaying this field.
@param Object sField The screen component.. either a awt.Component or a ScreenField. | [
"This",
"screen",
"component",
"is",
"displaying",
"this",
"field",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L156-L161 |
151,561 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.getComponent | public Object getComponent(int iPosition)
{
if (m_vScreenField == null)
return null;
if (iPosition < m_vScreenField.size())
{
try {
return m_vScreenField.elementAt(iPosition);
}
catch (ArrayIndexOutOfBoundsException e) {
return null;
}
}
return null;
} | java | public Object getComponent(int iPosition)
{
if (m_vScreenField == null)
return null;
if (iPosition < m_vScreenField.size())
{
try {
return m_vScreenField.elementAt(iPosition);
}
catch (ArrayIndexOutOfBoundsException e) {
return null;
}
}
return null;
} | [
"public",
"Object",
"getComponent",
"(",
"int",
"iPosition",
")",
"{",
"if",
"(",
"m_vScreenField",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"iPosition",
"<",
"m_vScreenField",
".",
"size",
"(",
")",
")",
"{",
"try",
"{",
"return",
"m_vScreen... | Get the component at this position.
@return The component at this position or null. | [
"Get",
"the",
"component",
"at",
"this",
"position",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L175-L189 |
151,562 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.displayField | public void displayField() // init this field override for other value
{
if (m_vScreenField == null)
return;
for (int i = 0; i < m_vScreenField.size(); i++)
{
Object component = m_vScreenField.elementAt(i);
Convert converter = null;
if (component instanceof ScreenComponent)
converter = ((ScreenComponent)component).getConverter();
if (converter == null)
converter = this;
if ((this.getFieldName().equals(this.getNameByReflection(component)))
|| (converter.getField() == this))
{
if (component instanceof FieldComponent)
((FieldComponent)component).setControlValue(converter.getData());
else if (component.getClass().getName().contains("ext")) // JTextComponent/JTextArea - TODO FIX This lame code!
this.setTextByReflection(component, converter.getString());
// else if (component instanceof JTextComponent)
// ((JTextComponent)component).setText(converter.getString());
}
}
} | java | public void displayField() // init this field override for other value
{
if (m_vScreenField == null)
return;
for (int i = 0; i < m_vScreenField.size(); i++)
{
Object component = m_vScreenField.elementAt(i);
Convert converter = null;
if (component instanceof ScreenComponent)
converter = ((ScreenComponent)component).getConverter();
if (converter == null)
converter = this;
if ((this.getFieldName().equals(this.getNameByReflection(component)))
|| (converter.getField() == this))
{
if (component instanceof FieldComponent)
((FieldComponent)component).setControlValue(converter.getData());
else if (component.getClass().getName().contains("ext")) // JTextComponent/JTextArea - TODO FIX This lame code!
this.setTextByReflection(component, converter.getString());
// else if (component instanceof JTextComponent)
// ((JTextComponent)component).setText(converter.getString());
}
}
} | [
"public",
"void",
"displayField",
"(",
")",
"// init this field override for other value",
"{",
"if",
"(",
"m_vScreenField",
"==",
"null",
")",
"return",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_vScreenField",
".",
"size",
"(",
")",
";",
"i... | Display this field.
Go through the sFieldList and setText for JTextComponents and setControlValue for
FieldComponents.
@see org.jbundle.model.screen.FieldComponent | [
"Display",
"this",
"field",
".",
"Go",
"through",
"the",
"sFieldList",
"and",
"setText",
"for",
"JTextComponents",
"and",
"setControlValue",
"for",
"FieldComponents",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L287-L310 |
151,563 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.getFieldDesc | public String getFieldDesc()
{
String strFieldDesc = null;
if (m_strFieldDesc != null) // Field desc null? (using default)
strFieldDesc = m_strFieldDesc;
else
{ // Get the description from the resource file
if (this.getRecord() != null)
strFieldDesc = this.getRecord().getString(this.getFieldName());
}
return strFieldDesc;
} | java | public String getFieldDesc()
{
String strFieldDesc = null;
if (m_strFieldDesc != null) // Field desc null? (using default)
strFieldDesc = m_strFieldDesc;
else
{ // Get the description from the resource file
if (this.getRecord() != null)
strFieldDesc = this.getRecord().getString(this.getFieldName());
}
return strFieldDesc;
} | [
"public",
"String",
"getFieldDesc",
"(",
")",
"{",
"String",
"strFieldDesc",
"=",
"null",
";",
"if",
"(",
"m_strFieldDesc",
"!=",
"null",
")",
"// Field desc null? (using default)",
"strFieldDesc",
"=",
"m_strFieldDesc",
";",
"else",
"{",
"// Get the description from ... | Get the short field description.
@return The field desc. If null, return the resource from the record's resouce file.
If not available, return the field name. | [
"Get",
"the",
"short",
"field",
"description",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L361-L372 |
151,564 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.getFieldTip | public String getFieldTip()
{
String strTipKey = this.getFieldName() + Constants.TIP;
String strFieldTip = strTipKey;
if (this.getRecord() != null)
strFieldTip = this.getRecord().getString(strTipKey);
if (strFieldTip == strTipKey)
return this.getFieldDesc();
return strFieldTip;
} | java | public String getFieldTip()
{
String strTipKey = this.getFieldName() + Constants.TIP;
String strFieldTip = strTipKey;
if (this.getRecord() != null)
strFieldTip = this.getRecord().getString(strTipKey);
if (strFieldTip == strTipKey)
return this.getFieldDesc();
return strFieldTip;
} | [
"public",
"String",
"getFieldTip",
"(",
")",
"{",
"String",
"strTipKey",
"=",
"this",
".",
"getFieldName",
"(",
")",
"+",
"Constants",
".",
"TIP",
";",
"String",
"strFieldTip",
"=",
"strTipKey",
";",
"if",
"(",
"this",
".",
"getRecord",
"(",
")",
"!=",
... | Get the long field description tip.
Look in the resource for the long description, if not found, return the field desc.
@return The field tip. | [
"Get",
"the",
"long",
"field",
"description",
"tip",
".",
"Look",
"in",
"the",
"resource",
"for",
"the",
"long",
"description",
"if",
"not",
"found",
"return",
"the",
"field",
"desc",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L386-L395 |
151,565 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.getMaxLength | public int getMaxLength()
{
if (m_iMaxLength == Constants.DEFAULT_FIELD_LENGTH)
{
m_iMaxLength = 20;
if (m_classData == Short.class)
m_iMaxLength = 4;
else if (m_classData == Integer.class)
m_iMaxLength = 8;
else if (m_classData == Float.class)
m_iMaxLength = 8;
else if (m_classData == Double.class)
m_iMaxLength = 15;
else if (m_classData == java.util.Date.class)
m_iMaxLength = 15;
else if (m_classData == String.class)
m_iMaxLength = 30;
else if (m_classData == Boolean.class)
m_iMaxLength = 10;
}
return m_iMaxLength;
} | java | public int getMaxLength()
{
if (m_iMaxLength == Constants.DEFAULT_FIELD_LENGTH)
{
m_iMaxLength = 20;
if (m_classData == Short.class)
m_iMaxLength = 4;
else if (m_classData == Integer.class)
m_iMaxLength = 8;
else if (m_classData == Float.class)
m_iMaxLength = 8;
else if (m_classData == Double.class)
m_iMaxLength = 15;
else if (m_classData == java.util.Date.class)
m_iMaxLength = 15;
else if (m_classData == String.class)
m_iMaxLength = 30;
else if (m_classData == Boolean.class)
m_iMaxLength = 10;
}
return m_iMaxLength;
} | [
"public",
"int",
"getMaxLength",
"(",
")",
"{",
"if",
"(",
"m_iMaxLength",
"==",
"Constants",
".",
"DEFAULT_FIELD_LENGTH",
")",
"{",
"m_iMaxLength",
"=",
"20",
";",
"if",
"(",
"m_classData",
"==",
"Short",
".",
"class",
")",
"m_iMaxLength",
"=",
"4",
";",
... | Maximum string length.
@return The max field length. | [
"Maximum",
"string",
"length",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L428-L449 |
151,566 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.initField | public int initField(boolean bDisplayOption) // Init this field override for other value
{
if ((this.getDefault() == null) || (this.getDefault() instanceof String))
return this.setString((String)this.getDefault(), bDisplayOption, Constants.INIT_MOVE); // zero out the field
return this.setData(this.getDefault(), bDisplayOption, Constants.INIT_MOVE);
} | java | public int initField(boolean bDisplayOption) // Init this field override for other value
{
if ((this.getDefault() == null) || (this.getDefault() instanceof String))
return this.setString((String)this.getDefault(), bDisplayOption, Constants.INIT_MOVE); // zero out the field
return this.setData(this.getDefault(), bDisplayOption, Constants.INIT_MOVE);
} | [
"public",
"int",
"initField",
"(",
"boolean",
"bDisplayOption",
")",
"// Init this field override for other value",
"{",
"if",
"(",
"(",
"this",
".",
"getDefault",
"(",
")",
"==",
"null",
")",
"||",
"(",
"this",
".",
"getDefault",
"(",
")",
"instanceof",
"Stri... | Set this field back to the original value.
@param bDisplayOption If true, display the data.
@return The error code. | [
"Set",
"this",
"field",
"back",
"to",
"the",
"original",
"value",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L455-L460 |
151,567 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.getValue | public double getValue()
{
Object objData = this.getData();
if (objData != null)
{
Class<?> classData = this.getDataClass();
if (classData != Object.class)
if (classData == objData.getClass())
{
if (classData == Short.class)
return ((Short)objData).shortValue();
else if (classData == Integer.class)
return ((Integer)objData).intValue();
else if (classData == Float.class)
return ((Float)objData).floatValue();
else if (classData == Double.class)
return ((Double)objData).doubleValue();
else if (classData == java.util.Date.class)
return ((Date)objData).getTime();
else if (classData == Boolean.class)
return (((Boolean)objData).booleanValue() ? 1 : 0);
else if (classData != String.class)
{
try {
return this.stringToDouble((String)objData).doubleValue();
} catch (Exception ex) { // Ignore the exception
}
}
}
}
return super.getValue(); // Return a 0
} | java | public double getValue()
{
Object objData = this.getData();
if (objData != null)
{
Class<?> classData = this.getDataClass();
if (classData != Object.class)
if (classData == objData.getClass())
{
if (classData == Short.class)
return ((Short)objData).shortValue();
else if (classData == Integer.class)
return ((Integer)objData).intValue();
else if (classData == Float.class)
return ((Float)objData).floatValue();
else if (classData == Double.class)
return ((Double)objData).doubleValue();
else if (classData == java.util.Date.class)
return ((Date)objData).getTime();
else if (classData == Boolean.class)
return (((Boolean)objData).booleanValue() ? 1 : 0);
else if (classData != String.class)
{
try {
return this.stringToDouble((String)objData).doubleValue();
} catch (Exception ex) { // Ignore the exception
}
}
}
}
return super.getValue(); // Return a 0
} | [
"public",
"double",
"getValue",
"(",
")",
"{",
"Object",
"objData",
"=",
"this",
".",
"getData",
"(",
")",
";",
"if",
"(",
"objData",
"!=",
"null",
")",
"{",
"Class",
"<",
"?",
">",
"classData",
"=",
"this",
".",
"getDataClass",
"(",
")",
";",
"if"... | For numeric fields, get the current value.
Usually overidden.
@return the field's value. | [
"For",
"numeric",
"fields",
"get",
"the",
"current",
"value",
".",
"Usually",
"overidden",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L600-L631 |
151,568 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.setState | public int setState(boolean bState, boolean bDisplayOption, int iMoveMode)
{
Boolean objData = new Boolean(bState);
if (this.getDataClass() == Boolean.class)
return this.setData(objData, bDisplayOption, iMoveMode);
else if (Number.class.isAssignableFrom(this.getDataClass()))
return this.setValue(objData.booleanValue() ? 1 : 0, bDisplayOption, iMoveMode);
else if (this.getDataClass() == String.class)
return this.setString(objData.booleanValue() ? Constants.TRUE : Constants.FALSE, bDisplayOption, iMoveMode);
return super.setState(bState, bDisplayOption, iMoveMode);
} | java | public int setState(boolean bState, boolean bDisplayOption, int iMoveMode)
{
Boolean objData = new Boolean(bState);
if (this.getDataClass() == Boolean.class)
return this.setData(objData, bDisplayOption, iMoveMode);
else if (Number.class.isAssignableFrom(this.getDataClass()))
return this.setValue(objData.booleanValue() ? 1 : 0, bDisplayOption, iMoveMode);
else if (this.getDataClass() == String.class)
return this.setString(objData.booleanValue() ? Constants.TRUE : Constants.FALSE, bDisplayOption, iMoveMode);
return super.setState(bState, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"setState",
"(",
"boolean",
"bState",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"Boolean",
"objData",
"=",
"new",
"Boolean",
"(",
"bState",
")",
";",
"if",
"(",
"this",
".",
"getDataClass",
"(",
")",
"==",
"Boo... | Set the data in this field to true or false. | [
"Set",
"the",
"data",
"in",
"this",
"field",
"to",
"true",
"or",
"false",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L635-L645 |
151,569 | jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.getState | public boolean getState() // init this field override for other value
{
if (this.getDataClass() == Boolean.class)
{
Boolean objData = (Boolean)this.getData();
if (objData != null)
return objData.booleanValue();
}
return false;
} | java | public boolean getState() // init this field override for other value
{
if (this.getDataClass() == Boolean.class)
{
Boolean objData = (Boolean)this.getData();
if (objData != null)
return objData.booleanValue();
}
return false;
} | [
"public",
"boolean",
"getState",
"(",
")",
"// init this field override for other value",
"{",
"if",
"(",
"this",
".",
"getDataClass",
"(",
")",
"==",
"Boolean",
".",
"class",
")",
"{",
"Boolean",
"objData",
"=",
"(",
"Boolean",
")",
"this",
".",
"getData",
... | Get the state of this boolean field.
@return true if true, false if not boolean or null. | [
"Get",
"the",
"state",
"of",
"this",
"boolean",
"field",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L650-L659 |
151,570 | JM-Lab/utils-java9 | src/main/java/kr/jm/utils/RestfulResourceUpdater.java | RestfulResourceUpdater.updateResourceWithLog | public Optional<T> updateResourceWithLog() {
Optional<T> resourceAsOpt = updateResource();
log.debug("Updated Resource - {}",
updateResource().isPresent() ? "YES" : "NO");
return resourceAsOpt;
} | java | public Optional<T> updateResourceWithLog() {
Optional<T> resourceAsOpt = updateResource();
log.debug("Updated Resource - {}",
updateResource().isPresent() ? "YES" : "NO");
return resourceAsOpt;
} | [
"public",
"Optional",
"<",
"T",
">",
"updateResourceWithLog",
"(",
")",
"{",
"Optional",
"<",
"T",
">",
"resourceAsOpt",
"=",
"updateResource",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"Updated Resource - {}\"",
",",
"updateResource",
"(",
")",
".",
"isPre... | Update resource with log optional.
@return the optional | [
"Update",
"resource",
"with",
"log",
"optional",
"."
] | ee80235b2760396a616cf7563cbdc98d4affe8e1 | https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/RestfulResourceUpdater.java#L87-L92 |
151,571 | JM-Lab/utils-java9 | src/main/java/kr/jm/utils/RestfulResourceUpdater.java | RestfulResourceUpdater.updateResource | public Optional<T> updateResource() {
return JMOptional.getOptional(JMRestfulResource
.getStringWithRestOrClasspathOrFilePath(restfulResourceUrl))
.filter(getEquals(cachedJsonString).negate())
.filter(peek(this::setJsonStringCache))
.map(jsonString -> JMJson.withJsonString(jsonString,
typeReference))
.filter(peek(resource -> this.cachedResource = resource));
} | java | public Optional<T> updateResource() {
return JMOptional.getOptional(JMRestfulResource
.getStringWithRestOrClasspathOrFilePath(restfulResourceUrl))
.filter(getEquals(cachedJsonString).negate())
.filter(peek(this::setJsonStringCache))
.map(jsonString -> JMJson.withJsonString(jsonString,
typeReference))
.filter(peek(resource -> this.cachedResource = resource));
} | [
"public",
"Optional",
"<",
"T",
">",
"updateResource",
"(",
")",
"{",
"return",
"JMOptional",
".",
"getOptional",
"(",
"JMRestfulResource",
".",
"getStringWithRestOrClasspathOrFilePath",
"(",
"restfulResourceUrl",
")",
")",
".",
"filter",
"(",
"getEquals",
"(",
"c... | Update resource optional.
@return the optional | [
"Update",
"resource",
"optional",
"."
] | ee80235b2760396a616cf7563cbdc98d4affe8e1 | https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/RestfulResourceUpdater.java#L99-L107 |
151,572 | incodehq-legacy/incode-module-communications | module/src/main/java/org/incode/module/communications/dom/mixins/Document_sendByEmail.java | Document_sendByEmail.stripFileExtensionIfAny | private static String stripFileExtensionIfAny(final String name) {
final int suffix = name.lastIndexOf(".html");
return suffix == -1 ? name : name.substring(0, suffix);
} | java | private static String stripFileExtensionIfAny(final String name) {
final int suffix = name.lastIndexOf(".html");
return suffix == -1 ? name : name.substring(0, suffix);
} | [
"private",
"static",
"String",
"stripFileExtensionIfAny",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"int",
"suffix",
"=",
"name",
".",
"lastIndexOf",
"(",
"\".html\"",
")",
";",
"return",
"suffix",
"==",
"-",
"1",
"?",
"name",
":",
"name",
".",
... | bit of a hack... | [
"bit",
"of",
"a",
"hack",
"..."
] | 0dca6825886e85cb778f7c4f6ede126f636fdd54 | https://github.com/incodehq-legacy/incode-module-communications/blob/0dca6825886e85cb778f7c4f6ede126f636fdd54/module/src/main/java/org/incode/module/communications/dom/mixins/Document_sendByEmail.java#L246-L249 |
151,573 | jbundle/jbundle | main/msg/src/main/java/org/jbundle/main/msg/db/MessageDetail.java | MessageDetail.addPropertyListeners | public void addPropertyListeners()
{
this.addPropertiesFieldBehavior(this.getField(MessageDetail.DESTINATION_SITE), TrxMessageHeader.DESTINATION_PARAM);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.DESTINATION_PATH), TrxMessageHeader.DESTINATION_MESSAGE_PARAM);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.RETURN_SITE), TrxMessageHeader.SOURCE_PARAM);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.RETURN_PATH), TrxMessageHeader.SOURCE_MESSAGE_PARAM);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.XSLT_DOCUMENT), TrxMessageHeader.XSLT_DOCUMENT);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.INITIAL_MANUAL_TRANSPORT_STATUS_ID), MessageTransport.INITIAL_MESSAGE_DATA_STATUS);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.DEFAULT_MESSAGE_VERSION_ID), TrxMessageHeader.MESSAGE_VERSION_ID);
} | java | public void addPropertyListeners()
{
this.addPropertiesFieldBehavior(this.getField(MessageDetail.DESTINATION_SITE), TrxMessageHeader.DESTINATION_PARAM);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.DESTINATION_PATH), TrxMessageHeader.DESTINATION_MESSAGE_PARAM);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.RETURN_SITE), TrxMessageHeader.SOURCE_PARAM);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.RETURN_PATH), TrxMessageHeader.SOURCE_MESSAGE_PARAM);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.XSLT_DOCUMENT), TrxMessageHeader.XSLT_DOCUMENT);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.INITIAL_MANUAL_TRANSPORT_STATUS_ID), MessageTransport.INITIAL_MESSAGE_DATA_STATUS);
this.addPropertiesFieldBehavior(this.getField(MessageDetail.DEFAULT_MESSAGE_VERSION_ID), TrxMessageHeader.MESSAGE_VERSION_ID);
} | [
"public",
"void",
"addPropertyListeners",
"(",
")",
"{",
"this",
".",
"addPropertiesFieldBehavior",
"(",
"this",
".",
"getField",
"(",
"MessageDetail",
".",
"DESTINATION_SITE",
")",
",",
"TrxMessageHeader",
".",
"DESTINATION_PARAM",
")",
";",
"this",
".",
"addProp... | AddPropertyListeners Method. | [
"AddPropertyListeners",
"Method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageDetail.java#L201-L210 |
151,574 | jbundle/jbundle | main/msg/src/main/java/org/jbundle/main/msg/db/MessageDetail.java | MessageDetail.addMessageProperties | public TrxMessageHeader addMessageProperties(TrxMessageHeader trxMessageHeader, MessageDetailTarget recMessageDetailTarget, MessageProcessInfo recMessageProcessInfo, MessageTransport recMessageTransport)
{
try {
if (trxMessageHeader == null)
trxMessageHeader = new TrxMessageHeader(null, null);
ContactType recContactType = (ContactType)((ReferenceField)this.getField(MessageDetail.CONTACT_TYPE_ID)).getReferenceRecord(null);
recContactType = (ContactType)recContactType.getContactType((Record)recMessageDetailTarget);
if (recContactType == null)
return trxMessageHeader; // Just being careful
this.setKeyArea(MessageDetail.CONTACT_TYPE_ID_KEY);
this.getField(MessageDetail.CONTACT_TYPE_ID).moveFieldToThis((BaseField)recContactType.getCounterField());
this.getField(MessageDetail.PERSON_ID).moveFieldToThis((BaseField)((Record)recMessageDetailTarget).getCounterField());
this.getField(MessageDetail.MESSAGE_PROCESS_INFO_ID).moveFieldToThis((BaseField)recMessageProcessInfo.getCounterField());
this.getField(MessageDetail.MESSAGE_TRANSPORT_ID).moveFieldToThis((BaseField)recMessageTransport.getCounterField());
if (this.seek(null))
{
Map<String,Object> propHeader = ((PropertiesField)this.getField(MessageDetail.PROPERTIES)).loadProperties();
if (propHeader == null)
propHeader = new HashMap<String,Object>(); // Never return null.
Map<String,Object> map = trxMessageHeader.getMessageHeaderMap();
if (map != null)
map.putAll(propHeader);
else
map = propHeader;
trxMessageHeader.setMessageHeaderMap(map);
if ((recMessageTransport != null)
&& ((recMessageTransport.getEditMode() == DBConstants.EDIT_CURRENT) || (recMessageTransport.getEditMode() == DBConstants.EDIT_IN_PROGRESS)))
{
trxMessageHeader = recMessageTransport.addMessageProperties(trxMessageHeader);
}
}
} catch (DBException ex) {
ex.printStackTrace();
}
// No need to free the two files as they are linked to the fields in this record
return trxMessageHeader;
} | java | public TrxMessageHeader addMessageProperties(TrxMessageHeader trxMessageHeader, MessageDetailTarget recMessageDetailTarget, MessageProcessInfo recMessageProcessInfo, MessageTransport recMessageTransport)
{
try {
if (trxMessageHeader == null)
trxMessageHeader = new TrxMessageHeader(null, null);
ContactType recContactType = (ContactType)((ReferenceField)this.getField(MessageDetail.CONTACT_TYPE_ID)).getReferenceRecord(null);
recContactType = (ContactType)recContactType.getContactType((Record)recMessageDetailTarget);
if (recContactType == null)
return trxMessageHeader; // Just being careful
this.setKeyArea(MessageDetail.CONTACT_TYPE_ID_KEY);
this.getField(MessageDetail.CONTACT_TYPE_ID).moveFieldToThis((BaseField)recContactType.getCounterField());
this.getField(MessageDetail.PERSON_ID).moveFieldToThis((BaseField)((Record)recMessageDetailTarget).getCounterField());
this.getField(MessageDetail.MESSAGE_PROCESS_INFO_ID).moveFieldToThis((BaseField)recMessageProcessInfo.getCounterField());
this.getField(MessageDetail.MESSAGE_TRANSPORT_ID).moveFieldToThis((BaseField)recMessageTransport.getCounterField());
if (this.seek(null))
{
Map<String,Object> propHeader = ((PropertiesField)this.getField(MessageDetail.PROPERTIES)).loadProperties();
if (propHeader == null)
propHeader = new HashMap<String,Object>(); // Never return null.
Map<String,Object> map = trxMessageHeader.getMessageHeaderMap();
if (map != null)
map.putAll(propHeader);
else
map = propHeader;
trxMessageHeader.setMessageHeaderMap(map);
if ((recMessageTransport != null)
&& ((recMessageTransport.getEditMode() == DBConstants.EDIT_CURRENT) || (recMessageTransport.getEditMode() == DBConstants.EDIT_IN_PROGRESS)))
{
trxMessageHeader = recMessageTransport.addMessageProperties(trxMessageHeader);
}
}
} catch (DBException ex) {
ex.printStackTrace();
}
// No need to free the two files as they are linked to the fields in this record
return trxMessageHeader;
} | [
"public",
"TrxMessageHeader",
"addMessageProperties",
"(",
"TrxMessageHeader",
"trxMessageHeader",
",",
"MessageDetailTarget",
"recMessageDetailTarget",
",",
"MessageProcessInfo",
"recMessageProcessInfo",
",",
"MessageTransport",
"recMessageTransport",
")",
"{",
"try",
"{",
"if... | Get the message properties for this vendor.
@param strMessageName The message name.
@return A map with the message properties. | [
"Get",
"the",
"message",
"properties",
"for",
"this",
"vendor",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageDetail.java#L216-L254 |
151,575 | NessComputing/components-ness-quartz | src/main/java/com/nesscomputing/quartz/QuartzJob.java | QuartzJob.startTime | @SuppressWarnings("unchecked")
public final SelfType startTime(final DateTime when, final TimeSpan jitter)
{
// Find the current week day in the same time zone as the "when" time passed in.
final DateTime now = new DateTime().withZone(when.getZone());
final int startWeekDay = when.getDayOfWeek();
final int currentWeekDay = now.getDayOfWeek();
// ( x + n ) % n is x for x > 0 and n - x for x < 0.
final int daysTilStart = (startWeekDay - currentWeekDay + DAYS_PER_WEEK) % DAYS_PER_WEEK;
Preconditions.checkState(daysTilStart >= 0 && daysTilStart < DAYS_PER_WEEK, "daysTilStart must be 0..%s, but is %s", DAYS_PER_WEEK, daysTilStart);
// same trick as above, add a full week in millis and do the modulo.
final long millisecondsTilStart = (when.getMillisOfDay() - now.getMillisOfDay() + daysTilStart * MILLIS_PER_DAY + MILLIS_PER_WEEK) % MILLIS_PER_WEEK;
Preconditions.checkState(millisecondsTilStart >= 0 && millisecondsTilStart < MILLIS_PER_WEEK, "millisecondsTilStart must be 0..%s, but is %s", MILLIS_PER_WEEK, millisecondsTilStart);
this.delay = Duration.millis((long)(ThreadLocalRandom.current().nextDouble() * jitter.getMillis()) + millisecondsTilStart);
return (SelfType) this;
} | java | @SuppressWarnings("unchecked")
public final SelfType startTime(final DateTime when, final TimeSpan jitter)
{
// Find the current week day in the same time zone as the "when" time passed in.
final DateTime now = new DateTime().withZone(when.getZone());
final int startWeekDay = when.getDayOfWeek();
final int currentWeekDay = now.getDayOfWeek();
// ( x + n ) % n is x for x > 0 and n - x for x < 0.
final int daysTilStart = (startWeekDay - currentWeekDay + DAYS_PER_WEEK) % DAYS_PER_WEEK;
Preconditions.checkState(daysTilStart >= 0 && daysTilStart < DAYS_PER_WEEK, "daysTilStart must be 0..%s, but is %s", DAYS_PER_WEEK, daysTilStart);
// same trick as above, add a full week in millis and do the modulo.
final long millisecondsTilStart = (when.getMillisOfDay() - now.getMillisOfDay() + daysTilStart * MILLIS_PER_DAY + MILLIS_PER_WEEK) % MILLIS_PER_WEEK;
Preconditions.checkState(millisecondsTilStart >= 0 && millisecondsTilStart < MILLIS_PER_WEEK, "millisecondsTilStart must be 0..%s, but is %s", MILLIS_PER_WEEK, millisecondsTilStart);
this.delay = Duration.millis((long)(ThreadLocalRandom.current().nextDouble() * jitter.getMillis()) + millisecondsTilStart);
return (SelfType) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"SelfType",
"startTime",
"(",
"final",
"DateTime",
"when",
",",
"final",
"TimeSpan",
"jitter",
")",
"{",
"// Find the current week day in the same time zone as the \"when\" time passed in.",
"final",
"Da... | Set the time-of-day when the first run of the job will take place. | [
"Set",
"the",
"time",
"-",
"of",
"-",
"day",
"when",
"the",
"first",
"run",
"of",
"the",
"job",
"will",
"take",
"place",
"."
] | fd41c440e21b31a5292a0606c8687eacfc5120ae | https://github.com/NessComputing/components-ness-quartz/blob/fd41c440e21b31a5292a0606c8687eacfc5120ae/src/main/java/com/nesscomputing/quartz/QuartzJob.java#L87-L106 |
151,576 | wigforss/Ka-Web | servlet/src/main/java/org/kasource/web/servlet/filter/NoCacheFilter.java | NoCacheFilter.doFilter | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException {
if(response instanceof HttpServletResponse) {
HttpServletResponse httpResponse = (HttpServletResponse) response;
String queryString = ((HttpServletRequest) request).getQueryString();
if(queryString == null) {
queryString = "";
}
if(regExpFilters == null || regExpFilters.isEmpty()) {
setHeaders(httpResponse);
} else {
if(Pattern.matches(regExpFilters, queryString)) {
setHeaders(httpResponse);
}
}
}
chain.doFilter(request, response);
} | java | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException {
if(response instanceof HttpServletResponse) {
HttpServletResponse httpResponse = (HttpServletResponse) response;
String queryString = ((HttpServletRequest) request).getQueryString();
if(queryString == null) {
queryString = "";
}
if(regExpFilters == null || regExpFilters.isEmpty()) {
setHeaders(httpResponse);
} else {
if(Pattern.matches(regExpFilters, queryString)) {
setHeaders(httpResponse);
}
}
}
chain.doFilter(request, response);
} | [
"@",
"Override",
"public",
"void",
"doFilter",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"if",
"(",
"response",
"instanceof",
"HttpServletResponse",
... | Add no-cache headers if Query String matches reqExoFilters | [
"Add",
"no",
"-",
"cache",
"headers",
"if",
"Query",
"String",
"matches",
"reqExoFilters"
] | bb6d8eacbefdeb7c8c6bb6135e55939d968fa433 | https://github.com/wigforss/Ka-Web/blob/bb6d8eacbefdeb7c8c6bb6135e55939d968fa433/servlet/src/main/java/org/kasource/web/servlet/filter/NoCacheFilter.java#L40-L61 |
151,577 | wigforss/Ka-Web | servlet/src/main/java/org/kasource/web/servlet/filter/NoCacheFilter.java | NoCacheFilter.setHeader | private void setHeader(HttpServletResponse response, String name, String value) {
if(response.containsHeader(value)) {
response.setHeader(name, value);
} else {
response.addHeader(name, value);
}
} | java | private void setHeader(HttpServletResponse response, String name, String value) {
if(response.containsHeader(value)) {
response.setHeader(name, value);
} else {
response.addHeader(name, value);
}
} | [
"private",
"void",
"setHeader",
"(",
"HttpServletResponse",
"response",
",",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"response",
".",
"containsHeader",
"(",
"value",
")",
")",
"{",
"response",
".",
"setHeader",
"(",
"name",
",",
"val... | Set Cache header.
@param response The HttpResponse to set header on
@param name Name of the header to set
@param value Value of the header to set. | [
"Set",
"Cache",
"header",
"."
] | bb6d8eacbefdeb7c8c6bb6135e55939d968fa433 | https://github.com/wigforss/Ka-Web/blob/bb6d8eacbefdeb7c8c6bb6135e55939d968fa433/servlet/src/main/java/org/kasource/web/servlet/filter/NoCacheFilter.java#L81-L87 |
151,578 | pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java | DocBookXMLPreProcessor.createLinkWrapperElement | protected Element createLinkWrapperElement(final Document document, final Node node, final String cssClass) {
// Create the bug/editor link root element
final Element linkElement = document.createElement("para");
if (cssClass != null) {
linkElement.setAttribute("role", cssClass);
}
node.appendChild(linkElement);
return linkElement;
} | java | protected Element createLinkWrapperElement(final Document document, final Node node, final String cssClass) {
// Create the bug/editor link root element
final Element linkElement = document.createElement("para");
if (cssClass != null) {
linkElement.setAttribute("role", cssClass);
}
node.appendChild(linkElement);
return linkElement;
} | [
"protected",
"Element",
"createLinkWrapperElement",
"(",
"final",
"Document",
"document",
",",
"final",
"Node",
"node",
",",
"final",
"String",
"cssClass",
")",
"{",
"// Create the bug/editor link root element",
"final",
"Element",
"linkElement",
"=",
"document",
".",
... | Creates the wrapper element for bug or editor links and adds it to the document.
@param document The document to add the wrapper/link to.
@param node The specific node the wrapper/link should be added to.
@param cssClass The css class name to use for the wrapper. @return The wrapper element that links can be added to. | [
"Creates",
"the",
"wrapper",
"element",
"for",
"bug",
"or",
"editor",
"links",
"and",
"adds",
"it",
"to",
"the",
"document",
"."
] | 5436d36ba1b3c5baa246b270e5fc350e6778bce8 | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L227-L237 |
151,579 | pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java | DocBookXMLPreProcessor.createExternalLinkElement | protected Element createExternalLinkElement(final DocBookVersion docBookVersion, final Document document, String title,
final String url) {
final Element linkEle;
if (docBookVersion == DocBookVersion.DOCBOOK_50) {
linkEle = document.createElement("link");
linkEle.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", url);
} else {
linkEle = document.createElement("ulink");
linkEle.setAttribute("url", url);
}
linkEle.setTextContent(title);
return linkEle;
} | java | protected Element createExternalLinkElement(final DocBookVersion docBookVersion, final Document document, String title,
final String url) {
final Element linkEle;
if (docBookVersion == DocBookVersion.DOCBOOK_50) {
linkEle = document.createElement("link");
linkEle.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", url);
} else {
linkEle = document.createElement("ulink");
linkEle.setAttribute("url", url);
}
linkEle.setTextContent(title);
return linkEle;
} | [
"protected",
"Element",
"createExternalLinkElement",
"(",
"final",
"DocBookVersion",
"docBookVersion",
",",
"final",
"Document",
"document",
",",
"String",
"title",
",",
"final",
"String",
"url",
")",
"{",
"final",
"Element",
"linkEle",
";",
"if",
"(",
"docBookVer... | Creates an element that represents an external link.
@param docBookVersion The DocBook Version the link should be created for.
@param document The document to create the link for.
@param title
@param url The links url. @return | [
"Creates",
"an",
"element",
"that",
"represents",
"an",
"external",
"link",
"."
] | 5436d36ba1b3c5baa246b270e5fc350e6778bce8 | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L247-L259 |
151,580 | pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java | DocBookXMLPreProcessor.createExternalLinkElement | protected String createExternalLinkElement(final DocBookVersion docBookVersion, final String title, final String url) {
final StringBuilder linkEle = new StringBuilder();
if (docBookVersion == DocBookVersion.DOCBOOK_50) {
linkEle.append("<link xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"").append(url).append("\">");
linkEle.append(title);
linkEle.append("</link>");
} else {
linkEle.append("<ulink url=\"").append(url).append("\">");
linkEle.append(title);
linkEle.append("</ulink>");
}
return linkEle.toString();
} | java | protected String createExternalLinkElement(final DocBookVersion docBookVersion, final String title, final String url) {
final StringBuilder linkEle = new StringBuilder();
if (docBookVersion == DocBookVersion.DOCBOOK_50) {
linkEle.append("<link xmlns:xlink=\"http://www.w3.org/1999/xlink\" xlink:href=\"").append(url).append("\">");
linkEle.append(title);
linkEle.append("</link>");
} else {
linkEle.append("<ulink url=\"").append(url).append("\">");
linkEle.append(title);
linkEle.append("</ulink>");
}
return linkEle.toString();
} | [
"protected",
"String",
"createExternalLinkElement",
"(",
"final",
"DocBookVersion",
"docBookVersion",
",",
"final",
"String",
"title",
",",
"final",
"String",
"url",
")",
"{",
"final",
"StringBuilder",
"linkEle",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
... | Creates a string that represents an external link.
@param docBookVersion The DocBook Version the link should be created for.
@param title
@param url The links url. @return | [
"Creates",
"a",
"string",
"that",
"represents",
"an",
"external",
"link",
"."
] | 5436d36ba1b3c5baa246b270e5fc350e6778bce8 | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L268-L280 |
151,581 | pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java | DocBookXMLPreProcessor.processTopicAdditionalInfo | public void processTopicAdditionalInfo(final BuildData buildData, final SpecTopic specTopic,
final Document document) throws BuildProcessingException {
// First check if we should even bother processing any additional info based on build data
if (!shouldAddAdditionalInfo(buildData, specTopic)) return;
final List<Node> invalidNodes = XMLUtilities.getChildNodes(document.getDocumentElement(), "section");
// Only add injections if the topic doesn't contain any invalid nodes. The reason for this is that adding any links to topics
// that contain <section> will cause the XML to become invalid. Unfortunately there isn't any way around this.
if (invalidNodes == null || invalidNodes.size() == 0) {
final Element rootEle = getRootAdditionalInfoElement(document, document.getDocumentElement());
if (buildData.getBuildOptions().getInsertEditorLinks() && specTopic.getTopicType() != TopicType.AUTHOR_GROUP) {
processTopicEditorLinks(buildData, specTopic, document, rootEle);
}
// Only include a bugzilla link for normal topics
if (buildData.getBuildOptions().getInsertBugLinks() && specTopic.getTopicType() == TopicType.NORMAL) {
processTopicBugLink(buildData, specTopic, document, rootEle);
}
}
} | java | public void processTopicAdditionalInfo(final BuildData buildData, final SpecTopic specTopic,
final Document document) throws BuildProcessingException {
// First check if we should even bother processing any additional info based on build data
if (!shouldAddAdditionalInfo(buildData, specTopic)) return;
final List<Node> invalidNodes = XMLUtilities.getChildNodes(document.getDocumentElement(), "section");
// Only add injections if the topic doesn't contain any invalid nodes. The reason for this is that adding any links to topics
// that contain <section> will cause the XML to become invalid. Unfortunately there isn't any way around this.
if (invalidNodes == null || invalidNodes.size() == 0) {
final Element rootEle = getRootAdditionalInfoElement(document, document.getDocumentElement());
if (buildData.getBuildOptions().getInsertEditorLinks() && specTopic.getTopicType() != TopicType.AUTHOR_GROUP) {
processTopicEditorLinks(buildData, specTopic, document, rootEle);
}
// Only include a bugzilla link for normal topics
if (buildData.getBuildOptions().getInsertBugLinks() && specTopic.getTopicType() == TopicType.NORMAL) {
processTopicBugLink(buildData, specTopic, document, rootEle);
}
}
} | [
"public",
"void",
"processTopicAdditionalInfo",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"SpecTopic",
"specTopic",
",",
"final",
"Document",
"document",
")",
"throws",
"BuildProcessingException",
"{",
"// First check if we should even bother processing any addition... | Adds some debug information and links to the end of the topic | [
"Adds",
"some",
"debug",
"information",
"and",
"links",
"to",
"the",
"end",
"of",
"the",
"topic"
] | 5436d36ba1b3c5baa246b270e5fc350e6778bce8 | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L383-L404 |
151,582 | pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java | DocBookXMLPreProcessor.shouldAddAdditionalInfo | protected static boolean shouldAddAdditionalInfo(final BuildData buildData, final SpecTopic specTopic) {
return (buildData.getBuildOptions().getInsertEditorLinks() && specTopic.getTopicType() != TopicType.AUTHOR_GROUP) || (buildData
.getBuildOptions().getInsertBugLinks() && specTopic.getTopicType() == TopicType.NORMAL);
} | java | protected static boolean shouldAddAdditionalInfo(final BuildData buildData, final SpecTopic specTopic) {
return (buildData.getBuildOptions().getInsertEditorLinks() && specTopic.getTopicType() != TopicType.AUTHOR_GROUP) || (buildData
.getBuildOptions().getInsertBugLinks() && specTopic.getTopicType() == TopicType.NORMAL);
} | [
"protected",
"static",
"boolean",
"shouldAddAdditionalInfo",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"SpecTopic",
"specTopic",
")",
"{",
"return",
"(",
"buildData",
".",
"getBuildOptions",
"(",
")",
".",
"getInsertEditorLinks",
"(",
")",
"&&",
"specT... | Checks to see if additional info should be added based on the build options and the spec topic type.
@param buildData
@param specTopic
@return | [
"Checks",
"to",
"see",
"if",
"additional",
"info",
"should",
"be",
"added",
"based",
"on",
"the",
"build",
"options",
"and",
"the",
"spec",
"topic",
"type",
"."
] | 5436d36ba1b3c5baa246b270e5fc350e6778bce8 | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L413-L416 |
151,583 | pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java | DocBookXMLPreProcessor.processIdList | private static List<InjectionData> processIdList(final String list) {
/* find the individual topic ids */
final String[] ids = list.split(",");
List<InjectionData> retValue = new ArrayList<InjectionData>(ids.length);
/* clean the topic ids */
for (final String id : ids) {
final String topicId = id.replaceAll(OPTIONAL_MARKER, "").trim();
final boolean optional = id.contains(OPTIONAL_MARKER);
try {
final InjectionData topicData = new InjectionData(topicId, optional);
retValue.add(topicData);
} catch (final NumberFormatException ex) {
/*
* these lists are discovered by a regular expression so we shouldn't have any trouble here with Integer.parse
*/
LOG.debug("Unable to convert Injection Point ID into a Number", ex);
retValue.add(new InjectionData("-1", false));
}
}
return retValue;
} | java | private static List<InjectionData> processIdList(final String list) {
/* find the individual topic ids */
final String[] ids = list.split(",");
List<InjectionData> retValue = new ArrayList<InjectionData>(ids.length);
/* clean the topic ids */
for (final String id : ids) {
final String topicId = id.replaceAll(OPTIONAL_MARKER, "").trim();
final boolean optional = id.contains(OPTIONAL_MARKER);
try {
final InjectionData topicData = new InjectionData(topicId, optional);
retValue.add(topicData);
} catch (final NumberFormatException ex) {
/*
* these lists are discovered by a regular expression so we shouldn't have any trouble here with Integer.parse
*/
LOG.debug("Unable to convert Injection Point ID into a Number", ex);
retValue.add(new InjectionData("-1", false));
}
}
return retValue;
} | [
"private",
"static",
"List",
"<",
"InjectionData",
">",
"processIdList",
"(",
"final",
"String",
"list",
")",
"{",
"/* find the individual topic ids */",
"final",
"String",
"[",
"]",
"ids",
"=",
"list",
".",
"split",
"(",
"\",\"",
")",
";",
"List",
"<",
"Inj... | Takes a comma separated list of ints, and returns an array of Integers. This is used when processing custom injection
points. | [
"Takes",
"a",
"comma",
"separated",
"list",
"of",
"ints",
"and",
"returns",
"an",
"array",
"of",
"Integers",
".",
"This",
"is",
"used",
"when",
"processing",
"custom",
"injection",
"points",
"."
] | 5436d36ba1b3c5baa246b270e5fc350e6778bce8 | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L468-L492 |
151,584 | arxanchain/java-common | src/main/java/com/arxanfintech/common/util/RLP.java | RLP.encodeLength | public static byte[] encodeLength(int length, int offset) {
if (length < SIZE_THRESHOLD) {
byte firstByte = (byte) (length + offset);
return new byte[] { firstByte };
} else if (length < MAX_ITEM_LENGTH) {
byte[] binaryLength;
if (length > 0xFF)
binaryLength = intToBytesNoLeadZeroes(length);
else
binaryLength = new byte[] { (byte) length };
byte firstByte = (byte) (binaryLength.length + offset + SIZE_THRESHOLD - 1);
return concatenate(new byte[] { firstByte }, binaryLength);
} else {
throw new RuntimeException("Input too long");
}
} | java | public static byte[] encodeLength(int length, int offset) {
if (length < SIZE_THRESHOLD) {
byte firstByte = (byte) (length + offset);
return new byte[] { firstByte };
} else if (length < MAX_ITEM_LENGTH) {
byte[] binaryLength;
if (length > 0xFF)
binaryLength = intToBytesNoLeadZeroes(length);
else
binaryLength = new byte[] { (byte) length };
byte firstByte = (byte) (binaryLength.length + offset + SIZE_THRESHOLD - 1);
return concatenate(new byte[] { firstByte }, binaryLength);
} else {
throw new RuntimeException("Input too long");
}
} | [
"public",
"static",
"byte",
"[",
"]",
"encodeLength",
"(",
"int",
"length",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"length",
"<",
"SIZE_THRESHOLD",
")",
"{",
"byte",
"firstByte",
"=",
"(",
"byte",
")",
"(",
"length",
"+",
"offset",
")",
";",
"ret... | Integer limitation goes up to 2^31-1 so length can never be bigger than
MAX_ITEM_LENGTH
@param length
length
@param offset
offset
@return byte[] | [
"Integer",
"limitation",
"goes",
"up",
"to",
"2^31",
"-",
"1",
"so",
"length",
"can",
"never",
"be",
"bigger",
"than",
"MAX_ITEM_LENGTH"
] | 3ddfedfd948f5bab3fee0b74b85cdce4702ed84e | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/RLP.java#L437-L452 |
151,585 | tvesalainen/util | util/src/main/java/d3/env/TSAGeoMag.java | TSAGeoMag.getIntensity | public double getIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return ti;
} | java | public double getIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return ti;
} | [
"public",
"double",
"getIntensity",
"(",
"double",
"dlat",
",",
"double",
"dlong",
",",
"double",
"year",
",",
"double",
"altitude",
")",
"{",
"calcGeoMag",
"(",
"dlat",
",",
"dlong",
",",
"year",
",",
"altitude",
")",
";",
"return",
"ti",
";",
"}"
] | Returns the magnetic field intensity from the
Department of Defense geomagnetic model and data
in nano Tesla.
@param dlat Latitude in decimal degrees.
@param dlong Longitude in decimal degrees.
@param year Date of the calculation in decimal years.
@param altitude Altitude of the calculation in kilometers.
@return Magnetic field strength in nano Tesla. | [
"Returns",
"the",
"magnetic",
"field",
"intensity",
"from",
"the",
"Department",
"of",
"Defense",
"geomagnetic",
"model",
"and",
"data",
"in",
"nano",
"Tesla",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L968-L972 |
151,586 | tvesalainen/util | util/src/main/java/d3/env/TSAGeoMag.java | TSAGeoMag.getHorizontalIntensity | public double getHorizontalIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return bh;
} | java | public double getHorizontalIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return bh;
} | [
"public",
"double",
"getHorizontalIntensity",
"(",
"double",
"dlat",
",",
"double",
"dlong",
",",
"double",
"year",
",",
"double",
"altitude",
")",
"{",
"calcGeoMag",
"(",
"dlat",
",",
"dlong",
",",
"year",
",",
"altitude",
")",
";",
"return",
"bh",
";",
... | Returns the horizontal magnetic field intensity from the
Department of Defense geomagnetic model and data
in nano Tesla.
@param dlat Latitude in decimal degrees.
@param dlong Longitude in decimal degrees.
@param year Date of the calculation in decimal years.
@param altitude Altitude of the calculation in kilometers.
@return The horizontal magnetic field strength in nano Tesla. | [
"Returns",
"the",
"horizontal",
"magnetic",
"field",
"intensity",
"from",
"the",
"Department",
"of",
"Defense",
"geomagnetic",
"model",
"and",
"data",
"in",
"nano",
"Tesla",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1003-L1007 |
151,587 | tvesalainen/util | util/src/main/java/d3/env/TSAGeoMag.java | TSAGeoMag.getVerticalIntensity | public double getVerticalIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return bz;
} | java | public double getVerticalIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return bz;
} | [
"public",
"double",
"getVerticalIntensity",
"(",
"double",
"dlat",
",",
"double",
"dlong",
",",
"double",
"year",
",",
"double",
"altitude",
")",
"{",
"calcGeoMag",
"(",
"dlat",
",",
"dlong",
",",
"year",
",",
"altitude",
")",
";",
"return",
"bz",
";",
"... | Returns the vertical magnetic field intensity from the
Department of Defense geomagnetic model and data
in nano Tesla.
@param dlat Latitude in decimal degrees.
@param dlong Longitude in decimal degrees.
@param year Date of the calculation in decimal years.
@param altitude Altitude of the calculation in kilometers.
@return The vertical magnetic field strength in nano Tesla. | [
"Returns",
"the",
"vertical",
"magnetic",
"field",
"intensity",
"from",
"the",
"Department",
"of",
"Defense",
"geomagnetic",
"model",
"and",
"data",
"in",
"nano",
"Tesla",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1038-L1042 |
151,588 | tvesalainen/util | util/src/main/java/d3/env/TSAGeoMag.java | TSAGeoMag.getNorthIntensity | public double getNorthIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return by;
} | java | public double getNorthIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return by;
} | [
"public",
"double",
"getNorthIntensity",
"(",
"double",
"dlat",
",",
"double",
"dlong",
",",
"double",
"year",
",",
"double",
"altitude",
")",
"{",
"calcGeoMag",
"(",
"dlat",
",",
"dlong",
",",
"year",
",",
"altitude",
")",
";",
"return",
"by",
";",
"}"
... | Returns the northerly magnetic field intensity from the
Department of Defense geomagnetic model and data
in nano Tesla.
@param dlat Latitude in decimal degrees.
@param dlong Longitude in decimal degrees.
@param year Date of the calculation in decimal years.
@param altitude Altitude of the calculation in kilometers.
@return The northerly component of the magnetic field strength in nano Tesla. | [
"Returns",
"the",
"northerly",
"magnetic",
"field",
"intensity",
"from",
"the",
"Department",
"of",
"Defense",
"geomagnetic",
"model",
"and",
"data",
"in",
"nano",
"Tesla",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1073-L1077 |
151,589 | tvesalainen/util | util/src/main/java/d3/env/TSAGeoMag.java | TSAGeoMag.getEastIntensity | public double getEastIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return bx;
} | java | public double getEastIntensity( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return bx;
} | [
"public",
"double",
"getEastIntensity",
"(",
"double",
"dlat",
",",
"double",
"dlong",
",",
"double",
"year",
",",
"double",
"altitude",
")",
"{",
"calcGeoMag",
"(",
"dlat",
",",
"dlong",
",",
"year",
",",
"altitude",
")",
";",
"return",
"bx",
";",
"}"
] | Returns the easterly magnetic field intensity from the
Department of Defense geomagnetic model and data
in nano Tesla.
@param dlat Latitude in decimal degrees.
@param dlong Longitude in decimal degrees.
@param year Date of the calculation in decimal years.
@param altitude Altitude of the calculation in kilometers.
@return The easterly component of the magnetic field strength in nano Tesla. | [
"Returns",
"the",
"easterly",
"magnetic",
"field",
"intensity",
"from",
"the",
"Department",
"of",
"Defense",
"geomagnetic",
"model",
"and",
"data",
"in",
"nano",
"Tesla",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1108-L1112 |
151,590 | tvesalainen/util | util/src/main/java/d3/env/TSAGeoMag.java | TSAGeoMag.getDipAngle | public double getDipAngle( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return dip;
} | java | public double getDipAngle( double dlat, double dlong, double year, double altitude )
{
calcGeoMag( dlat, dlong, year, altitude );
return dip;
} | [
"public",
"double",
"getDipAngle",
"(",
"double",
"dlat",
",",
"double",
"dlong",
",",
"double",
"year",
",",
"double",
"altitude",
")",
"{",
"calcGeoMag",
"(",
"dlat",
",",
"dlong",
",",
"year",
",",
"altitude",
")",
";",
"return",
"dip",
";",
"}"
] | Returns the magnetic field dip angle from the
Department of Defense geomagnetic model and data,
in degrees.
@param dlat Latitude in decimal degrees.
@param dlong Longitude in decimal degrees.
@param year Date of the calculation in decimal years.
@param altitude Altitude of the calculation in kilometers.
@return The magnetic field dip angle, in degrees. | [
"Returns",
"the",
"magnetic",
"field",
"dip",
"angle",
"from",
"the",
"Department",
"of",
"Defense",
"geomagnetic",
"model",
"and",
"data",
"in",
"degrees",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1143-L1147 |
151,591 | tvesalainen/util | util/src/main/java/d3/env/TSAGeoMag.java | TSAGeoMag.setCoeff | private void setCoeff()
{
c[0][0] = 0.0;
cd[0][0] = 0.0;
epoch = Double.parseDouble(input[0].trim().split("[\\s]+")[0]);
defaultDate = epoch + 2.5;
String [] tokens;
//loop to get data from internal values
for(int i=1; i<input.length; i++)
{
tokens = input[i].trim().split("[\\s]+");
int n = Integer.parseInt(tokens[0]);
int m = Integer.parseInt(tokens[1]);
double gnm = Double.parseDouble(tokens[2]);
double hnm = Double.parseDouble(tokens[3]);
double dgnm = Double.parseDouble(tokens[4]);
double dhnm = Double.parseDouble(tokens[5]);
if (m <= n)
{
c[m][n] = gnm;
cd[m][n] = dgnm;
if (m != 0)
{
c[n][m-1] = hnm;
cd[n][m-1] = dhnm;
}
}
}
} | java | private void setCoeff()
{
c[0][0] = 0.0;
cd[0][0] = 0.0;
epoch = Double.parseDouble(input[0].trim().split("[\\s]+")[0]);
defaultDate = epoch + 2.5;
String [] tokens;
//loop to get data from internal values
for(int i=1; i<input.length; i++)
{
tokens = input[i].trim().split("[\\s]+");
int n = Integer.parseInt(tokens[0]);
int m = Integer.parseInt(tokens[1]);
double gnm = Double.parseDouble(tokens[2]);
double hnm = Double.parseDouble(tokens[3]);
double dgnm = Double.parseDouble(tokens[4]);
double dhnm = Double.parseDouble(tokens[5]);
if (m <= n)
{
c[m][n] = gnm;
cd[m][n] = dgnm;
if (m != 0)
{
c[n][m-1] = hnm;
cd[n][m-1] = dhnm;
}
}
}
} | [
"private",
"void",
"setCoeff",
"(",
")",
"{",
"c",
"[",
"0",
"]",
"[",
"0",
"]",
"=",
"0.0",
";",
"cd",
"[",
"0",
"]",
"[",
"0",
"]",
"=",
"0.0",
";",
"epoch",
"=",
"Double",
".",
"parseDouble",
"(",
"input",
"[",
"0",
"]",
".",
"trim",
"("... | This method sets the input data to the internal fit coefficents.
If there is an exception reading the input file WMM.COF, these values
are used.
NOTE: This method is not tested by the JUnit test, unless the WMM.COF file
is missing. | [
"This",
"method",
"sets",
"the",
"input",
"data",
"to",
"the",
"internal",
"fit",
"coefficents",
".",
"If",
"there",
"is",
"an",
"exception",
"reading",
"the",
"input",
"file",
"WMM",
".",
"COF",
"these",
"values",
"are",
"used",
"."
] | bba7a44689f638ffabc8be40a75bdc9a33676433 | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1156-L1190 |
151,592 | OwlPlatform/java-owl-worldmodel | src/main/java/com/owlplatform/worldmodel/client/Response.java | Response.setState | void setState(final WorldState state) {
if (this.ready) {
throw new IllegalStateException(
"Cannot reassign the world state of a response.");
}
this.state = state;
this.ready = true;
// Notify any blocking/waiting threads
synchronized (this) {
this.notifyAll();
}
} | java | void setState(final WorldState state) {
if (this.ready) {
throw new IllegalStateException(
"Cannot reassign the world state of a response.");
}
this.state = state;
this.ready = true;
// Notify any blocking/waiting threads
synchronized (this) {
this.notifyAll();
}
} | [
"void",
"setState",
"(",
"final",
"WorldState",
"state",
")",
"{",
"if",
"(",
"this",
".",
"ready",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot reassign the world state of a response.\"",
")",
";",
"}",
"this",
".",
"state",
"=",
"state",
... | Sets the state of this Response message. This method should only be
called once.
@param state | [
"Sets",
"the",
"state",
"of",
"this",
"Response",
"message",
".",
"This",
"method",
"should",
"only",
"be",
"called",
"once",
"."
] | a850e8b930c6e9787c7cad30c0de887858ca563d | https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/client/Response.java#L94-L105 |
151,593 | js-lib-com/commons | src/main/java/js/converter/TimeZoneConverter.java | TimeZoneConverter.asObject | @Override
public <T> T asObject(String string, Class<T> valueType) {
// at this point value type is guaranteed to be a kind of TimeZone
return (T) TimeZone.getTimeZone(string);
} | java | @Override
public <T> T asObject(String string, Class<T> valueType) {
// at this point value type is guaranteed to be a kind of TimeZone
return (T) TimeZone.getTimeZone(string);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"asObject",
"(",
"String",
"string",
",",
"Class",
"<",
"T",
">",
"valueType",
")",
"{",
"// at this point value type is guaranteed to be a kind of TimeZone\r",
"return",
"(",
"T",
")",
"TimeZone",
".",
"getTimeZone",... | Create time zone instance from time zone ID. If time zone ID is not recognized return UTC. | [
"Create",
"time",
"zone",
"instance",
"from",
"time",
"zone",
"ID",
".",
"If",
"time",
"zone",
"ID",
"is",
"not",
"recognized",
"return",
"UTC",
"."
] | f8c64482142b163487745da74feb106f0765c16b | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/TimeZoneConverter.java#L18-L22 |
151,594 | JM-Lab/utils-java9 | src/main/java/kr/jm/utils/flow/processor/JMProcessorBuilder.java | JMProcessorBuilder.build | public static <I, O> JMProcessor<I, O> build(
Function<I, O> transformerFunction) {
return new JMProcessor<>(transformerFunction);
} | java | public static <I, O> JMProcessor<I, O> build(
Function<I, O> transformerFunction) {
return new JMProcessor<>(transformerFunction);
} | [
"public",
"static",
"<",
"I",
",",
"O",
">",
"JMProcessor",
"<",
"I",
",",
"O",
">",
"build",
"(",
"Function",
"<",
"I",
",",
"O",
">",
"transformerFunction",
")",
"{",
"return",
"new",
"JMProcessor",
"<>",
"(",
"transformerFunction",
")",
";",
"}"
] | Build jm processor.
@param <I> the type parameter
@param <O> the type parameter
@param transformerFunction the transformer function
@return the jm processor | [
"Build",
"jm",
"processor",
"."
] | ee80235b2760396a616cf7563cbdc98d4affe8e1 | https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/flow/processor/JMProcessorBuilder.java#L22-L25 |
151,595 | JM-Lab/utils-java9 | src/main/java/kr/jm/utils/flow/processor/JMProcessorBuilder.java | JMProcessorBuilder.combine | public static <T, M, R> Processor<T, R> combine(
Processor<T, M> processor1, Processor<M, R> processor2) {
processor1.subscribe(processor2);
return new Processor<>() {
@Override
public void subscribe(Flow.Subscriber<? super R> subscriber) {
processor2.subscribe(subscriber);
}
@Override
public void onSubscribe(Flow.Subscription subscription) {
processor1.onSubscribe(subscription);
}
@Override
public void onNext(T item) {processor1.onNext(item);}
@Override
public void onError(Throwable throwable) {
processor1.onError(throwable);
}
@Override
public void onComplete() {processor1.onComplete();}
};
} | java | public static <T, M, R> Processor<T, R> combine(
Processor<T, M> processor1, Processor<M, R> processor2) {
processor1.subscribe(processor2);
return new Processor<>() {
@Override
public void subscribe(Flow.Subscriber<? super R> subscriber) {
processor2.subscribe(subscriber);
}
@Override
public void onSubscribe(Flow.Subscription subscription) {
processor1.onSubscribe(subscription);
}
@Override
public void onNext(T item) {processor1.onNext(item);}
@Override
public void onError(Throwable throwable) {
processor1.onError(throwable);
}
@Override
public void onComplete() {processor1.onComplete();}
};
} | [
"public",
"static",
"<",
"T",
",",
"M",
",",
"R",
">",
"Processor",
"<",
"T",
",",
"R",
">",
"combine",
"(",
"Processor",
"<",
"T",
",",
"M",
">",
"processor1",
",",
"Processor",
"<",
"M",
",",
"R",
">",
"processor2",
")",
"{",
"processor1",
".",... | Combine processor.
@param <T> the type parameter
@param <M> the type parameter
@param <R> the type parameter
@param processor1 the processor 1
@param processor2 the processor 2
@return the processor | [
"Combine",
"processor",
"."
] | ee80235b2760396a616cf7563cbdc98d4affe8e1 | https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/flow/processor/JMProcessorBuilder.java#L37-L62 |
151,596 | jbundle/jbundle | main/msg/src/main/java/org/jbundle/main/msg/screen/MessageLogGridScreen.java | MessageLogGridScreen.isContactDisplay | public boolean isContactDisplay()
{
String strUserContactType = this.getProperty(DBParams.CONTACT_TYPE);
String strUserContactID = this.getProperty(DBParams.CONTACT_ID);
String strContactType = ((ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.CONTACT_TYPE_ID)).getReference().getField(ContactType.CODE).toString();
String strContactID = this.getScreenRecord().getField(MessageLogScreenRecord.CONTACT_ID).toString();
if ((strUserContactID != null) && (strUserContactID.equals(strContactID)))
if ((strUserContactType != null) && (strUserContactType.equals(strContactType)))
return true;
return false;
} | java | public boolean isContactDisplay()
{
String strUserContactType = this.getProperty(DBParams.CONTACT_TYPE);
String strUserContactID = this.getProperty(DBParams.CONTACT_ID);
String strContactType = ((ReferenceField)this.getScreenRecord().getField(MessageLogScreenRecord.CONTACT_TYPE_ID)).getReference().getField(ContactType.CODE).toString();
String strContactID = this.getScreenRecord().getField(MessageLogScreenRecord.CONTACT_ID).toString();
if ((strUserContactID != null) && (strUserContactID.equals(strContactID)))
if ((strUserContactType != null) && (strUserContactType.equals(strContactType)))
return true;
return false;
} | [
"public",
"boolean",
"isContactDisplay",
"(",
")",
"{",
"String",
"strUserContactType",
"=",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"CONTACT_TYPE",
")",
";",
"String",
"strUserContactID",
"=",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"CONTACT... | IsContactDisplay Method. | [
"IsContactDisplay",
"Method",
"."
] | 4037fcfa85f60c7d0096c453c1a3cd573c2b0abc | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/screen/MessageLogGridScreen.java#L137-L149 |
151,597 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/ParseDateExtensions.java | ParseDateExtensions.parseDate | public static Date parseDate(final String date, final List<String> patterns)
{
for (final String pattern : patterns)
{
final SimpleDateFormat formatter = new SimpleDateFormat(pattern);
try
{
return formatter.parse(date);
}
catch (final ParseException e)
{
// Do nothing...
}
}
return null;
} | java | public static Date parseDate(final String date, final List<String> patterns)
{
for (final String pattern : patterns)
{
final SimpleDateFormat formatter = new SimpleDateFormat(pattern);
try
{
return formatter.parse(date);
}
catch (final ParseException e)
{
// Do nothing...
}
}
return null;
} | [
"public",
"static",
"Date",
"parseDate",
"(",
"final",
"String",
"date",
",",
"final",
"List",
"<",
"String",
">",
"patterns",
")",
"{",
"for",
"(",
"final",
"String",
"pattern",
":",
"patterns",
")",
"{",
"final",
"SimpleDateFormat",
"formatter",
"=",
"ne... | Tries to convert the given String to a Date.
@param date
The date to convert as String.
@param patterns
The date patterns to convert the String to a date-object.
@return Gives a Date if the convertion was successfull otherwise null. | [
"Tries",
"to",
"convert",
"the",
"given",
"String",
"to",
"a",
"Date",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/ParseDateExtensions.java#L56-L71 |
151,598 | lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/ParseDateExtensions.java | ParseDateExtensions.parseToDate | public static Date parseToDate(final String datum, final String[] formats, final Locale locale)
{
for (final String format : formats)
{
final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
try
{
return sdf.parse(datum);
}
catch (final ParseException e)
{
// Do nothing...
}
}
return null;
} | java | public static Date parseToDate(final String datum, final String[] formats, final Locale locale)
{
for (final String format : formats)
{
final SimpleDateFormat sdf = new SimpleDateFormat(format, locale);
try
{
return sdf.parse(datum);
}
catch (final ParseException e)
{
// Do nothing...
}
}
return null;
} | [
"public",
"static",
"Date",
"parseToDate",
"(",
"final",
"String",
"datum",
",",
"final",
"String",
"[",
"]",
"formats",
",",
"final",
"Locale",
"locale",
")",
"{",
"for",
"(",
"final",
"String",
"format",
":",
"formats",
")",
"{",
"final",
"SimpleDateForm... | Returns a date-object if the array with the formats are valid otherwise null.
@param datum
The date as string which to parse to a date-object.
@param formats
The string-array with the date-patterns.
@param locale
THe Locale for the SimpleDateFormat.
@return A date-object if the array with the formats are valid otherwise null. | [
"Returns",
"a",
"date",
"-",
"object",
"if",
"the",
"array",
"with",
"the",
"formats",
"are",
"valid",
"otherwise",
"null",
"."
] | fbf201e679d9f9b92e7b5771f3eea1413cc2e113 | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/ParseDateExtensions.java#L103-L118 |
151,599 | jpelzer/pelzer-spring | src/main/java/com/pelzer/util/spring/SpringUtil.java | SpringUtil.readBeanName | private String readBeanName(Class beanClass) throws NoSuchFieldException, IllegalAccessException{
final Field field = beanClass.getField("BEAN_NAME");
return String.valueOf(field.get(null));
} | java | private String readBeanName(Class beanClass) throws NoSuchFieldException, IllegalAccessException{
final Field field = beanClass.getField("BEAN_NAME");
return String.valueOf(field.get(null));
} | [
"private",
"String",
"readBeanName",
"(",
"Class",
"beanClass",
")",
"throws",
"NoSuchFieldException",
",",
"IllegalAccessException",
"{",
"final",
"Field",
"field",
"=",
"beanClass",
".",
"getField",
"(",
"\"BEAN_NAME\"",
")",
";",
"return",
"String",
".",
"value... | Find what's stored in 'BEAN_NAME' and return it, or toss an exception. | [
"Find",
"what",
"s",
"stored",
"in",
"BEAN_NAME",
"and",
"return",
"it",
"or",
"toss",
"an",
"exception",
"."
] | b5bd9877df244d9092df01c12d81e7b35d438c57 | https://github.com/jpelzer/pelzer-spring/blob/b5bd9877df244d9092df01c12d81e7b35d438c57/src/main/java/com/pelzer/util/spring/SpringUtil.java#L107-L110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.