id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
152,800
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java
|
EntityUtilities.findTranslationLocaleFromString
|
public static LocaleWrapper findTranslationLocaleFromString(final LocaleProvider localeProvider, final String localeString) {
if (localeString == null) return null;
final CollectionWrapper<LocaleWrapper> locales = localeProvider.getLocales();
for (final LocaleWrapper locale : locales.getItems()) {
if (localeString.equals(locale.getValue())) {
return locale;
}
}
return null;
}
|
java
|
public static LocaleWrapper findTranslationLocaleFromString(final LocaleProvider localeProvider, final String localeString) {
if (localeString == null) return null;
final CollectionWrapper<LocaleWrapper> locales = localeProvider.getLocales();
for (final LocaleWrapper locale : locales.getItems()) {
if (localeString.equals(locale.getValue())) {
return locale;
}
}
return null;
}
|
[
"public",
"static",
"LocaleWrapper",
"findTranslationLocaleFromString",
"(",
"final",
"LocaleProvider",
"localeProvider",
",",
"final",
"String",
"localeString",
")",
"{",
"if",
"(",
"localeString",
"==",
"null",
")",
"return",
"null",
";",
"final",
"CollectionWrapper",
"<",
"LocaleWrapper",
">",
"locales",
"=",
"localeProvider",
".",
"getLocales",
"(",
")",
";",
"for",
"(",
"final",
"LocaleWrapper",
"locale",
":",
"locales",
".",
"getItems",
"(",
")",
")",
"{",
"if",
"(",
"localeString",
".",
"equals",
"(",
"locale",
".",
"getValue",
"(",
")",
")",
")",
"{",
"return",
"locale",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Finds the matching locale entity from a translation locale string.
@param localeProvider
@param localeString
@return
|
[
"Finds",
"the",
"matching",
"locale",
"entity",
"from",
"a",
"translation",
"locale",
"string",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L471-L482
|
152,801
|
tvesalainen/hoski-lib
|
src/main/java/fi/hoski/datastore/repository/DataObject.java
|
DataObject.firstMandatoryNullProperty
|
public String firstMandatoryNullProperty()
{
for (String property : model.propertyList)
{
if (
model.mandatorySet.contains(property) &&
model.defaultMap.get(property) == null &&
data.get(property) == null
)
{
return property;
}
}
return firstMandatoryNullProperty(model.propertyList);
}
|
java
|
public String firstMandatoryNullProperty()
{
for (String property : model.propertyList)
{
if (
model.mandatorySet.contains(property) &&
model.defaultMap.get(property) == null &&
data.get(property) == null
)
{
return property;
}
}
return firstMandatoryNullProperty(model.propertyList);
}
|
[
"public",
"String",
"firstMandatoryNullProperty",
"(",
")",
"{",
"for",
"(",
"String",
"property",
":",
"model",
".",
"propertyList",
")",
"{",
"if",
"(",
"model",
".",
"mandatorySet",
".",
"contains",
"(",
"property",
")",
"&&",
"model",
".",
"defaultMap",
".",
"get",
"(",
"property",
")",
"==",
"null",
"&&",
"data",
".",
"get",
"(",
"property",
")",
"==",
"null",
")",
"{",
"return",
"property",
";",
"}",
"}",
"return",
"firstMandatoryNullProperty",
"(",
"model",
".",
"propertyList",
")",
";",
"}"
] |
Returns The first, in property order, property which is mandatory and is
not set. If all mandatory properties have values, returns null.
@return
|
[
"Returns",
"The",
"first",
"in",
"property",
"order",
"property",
"which",
"is",
"mandatory",
"and",
"is",
"not",
"set",
".",
"If",
"all",
"mandatory",
"properties",
"have",
"values",
"returns",
"null",
"."
] |
9b5bab44113e0adb74bf1ee436013e8a7c608d00
|
https://github.com/tvesalainen/hoski-lib/blob/9b5bab44113e0adb74bf1ee436013e8a7c608d00/src/main/java/fi/hoski/datastore/repository/DataObject.java#L309-L323
|
152,802
|
tvesalainen/hoski-lib
|
src/main/java/fi/hoski/datastore/repository/DataObject.java
|
DataObject.populate
|
public void populate(Map<String, String[]> map)
{
for (Entry<String, String[]> entry : map.entrySet())
{
String property = entry.getKey();
if (model.typeMap.containsKey(property))
{
String[] values = entry.getValue();
if (values.length > 1)
{
throw new UnsupportedOperationException(property + " has multivalue " + values);
}
if (values.length == 1)
{
set(property, values[0]);
}
}
}
}
|
java
|
public void populate(Map<String, String[]> map)
{
for (Entry<String, String[]> entry : map.entrySet())
{
String property = entry.getKey();
if (model.typeMap.containsKey(property))
{
String[] values = entry.getValue();
if (values.length > 1)
{
throw new UnsupportedOperationException(property + " has multivalue " + values);
}
if (values.length == 1)
{
set(property, values[0]);
}
}
}
}
|
[
"public",
"void",
"populate",
"(",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"map",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
"[",
"]",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"property",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"model",
".",
"typeMap",
".",
"containsKey",
"(",
"property",
")",
")",
"{",
"String",
"[",
"]",
"values",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"values",
".",
"length",
">",
"1",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"property",
"+",
"\" has multivalue \"",
"+",
"values",
")",
";",
"}",
"if",
"(",
"values",
".",
"length",
"==",
"1",
")",
"{",
"set",
"(",
"property",
",",
"values",
"[",
"0",
"]",
")",
";",
"}",
"}",
"}",
"}"
] |
Convenience method to support ServletRequest.
@param map
|
[
"Convenience",
"method",
"to",
"support",
"ServletRequest",
"."
] |
9b5bab44113e0adb74bf1ee436013e8a7c608d00
|
https://github.com/tvesalainen/hoski-lib/blob/9b5bab44113e0adb74bf1ee436013e8a7c608d00/src/main/java/fi/hoski/datastore/repository/DataObject.java#L416-L434
|
152,803
|
tvesalainen/hoski-lib
|
src/main/java/fi/hoski/datastore/repository/DataObject.java
|
DataObject.writeCSV
|
public static void writeCSV(DataObjectModel model, Collection<? extends DataObject> collection, OutputStream os) throws IOException
{
BufferedOutputStream bos = new BufferedOutputStream(os);
OutputStreamWriter osw = new OutputStreamWriter(bos, "ISO-8859-1");
CSVWriter writer = new CSVWriter(osw, ',', '"', "\r\n");
String[] line = model.getProperties();
writer.writeNext(line);
for (DataObject dob : collection)
{
int index = 0;
for (String property : model.getPropertyList())
{
Object value = dob.get(property);
if (value != null)
{
line[index++] = value.toString();
}
else
{
line[index++] = "";
}
}
writer.writeNext(line);
}
writer.flush();
}
|
java
|
public static void writeCSV(DataObjectModel model, Collection<? extends DataObject> collection, OutputStream os) throws IOException
{
BufferedOutputStream bos = new BufferedOutputStream(os);
OutputStreamWriter osw = new OutputStreamWriter(bos, "ISO-8859-1");
CSVWriter writer = new CSVWriter(osw, ',', '"', "\r\n");
String[] line = model.getProperties();
writer.writeNext(line);
for (DataObject dob : collection)
{
int index = 0;
for (String property : model.getPropertyList())
{
Object value = dob.get(property);
if (value != null)
{
line[index++] = value.toString();
}
else
{
line[index++] = "";
}
}
writer.writeNext(line);
}
writer.flush();
}
|
[
"public",
"static",
"void",
"writeCSV",
"(",
"DataObjectModel",
"model",
",",
"Collection",
"<",
"?",
"extends",
"DataObject",
">",
"collection",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"BufferedOutputStream",
"bos",
"=",
"new",
"BufferedOutputStream",
"(",
"os",
")",
";",
"OutputStreamWriter",
"osw",
"=",
"new",
"OutputStreamWriter",
"(",
"bos",
",",
"\"ISO-8859-1\"",
")",
";",
"CSVWriter",
"writer",
"=",
"new",
"CSVWriter",
"(",
"osw",
",",
"'",
"'",
",",
"'",
"'",
",",
"\"\\r\\n\"",
")",
";",
"String",
"[",
"]",
"line",
"=",
"model",
".",
"getProperties",
"(",
")",
";",
"writer",
".",
"writeNext",
"(",
"line",
")",
";",
"for",
"(",
"DataObject",
"dob",
":",
"collection",
")",
"{",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"String",
"property",
":",
"model",
".",
"getPropertyList",
"(",
")",
")",
"{",
"Object",
"value",
"=",
"dob",
".",
"get",
"(",
"property",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"line",
"[",
"index",
"++",
"]",
"=",
"value",
".",
"toString",
"(",
")",
";",
"}",
"else",
"{",
"line",
"[",
"index",
"++",
"]",
"=",
"\"\"",
";",
"}",
"}",
"writer",
".",
"writeNext",
"(",
"line",
")",
";",
"}",
"writer",
".",
"flush",
"(",
")",
";",
"}"
] |
Writes collection of DataObjects in csv format. OutputStream is not closed
after operation.
@param os
@param collection
@throws IOException
|
[
"Writes",
"collection",
"of",
"DataObjects",
"in",
"csv",
"format",
".",
"OutputStream",
"is",
"not",
"closed",
"after",
"operation",
"."
] |
9b5bab44113e0adb74bf1ee436013e8a7c608d00
|
https://github.com/tvesalainen/hoski-lib/blob/9b5bab44113e0adb74bf1ee436013e8a7c608d00/src/main/java/fi/hoski/datastore/repository/DataObject.java#L483-L508
|
152,804
|
pressgang-ccms/PressGangCCMSQuery
|
src/main/java/org/jboss/pressgang/ccms/filter/utils/FilterUtilities.java
|
FilterUtilities.getUrlVariables
|
public static HashMap<String, String> getUrlVariables(final Filter filter) {
final HashMap<String, String> vars = new HashMap<String, String>();
for (final FilterTag filterTag : filter.getFilterTags()) {
final Tag tag = filterTag.getTag();
final Integer tagState = filterTag.getTagState();
if (tagState == CommonFilterConstants.MATCH_TAG_STATE) {
vars.put(CommonFilterConstants.MATCH_TAG + tag.getTagId(), CommonFilterConstants.MATCH_TAG_STATE + "");
} else if (tagState == CommonFilterConstants.NOT_MATCH_TAG_STATE) {
vars.put(CommonFilterConstants.MATCH_TAG + tag.getTagId(), CommonFilterConstants.NOT_MATCH_TAG_STATE + "");
} else if (tagState == CommonFilterConstants.GROUP_TAG_STATE) {
vars.put(CommonFilterConstants.GROUP_TAG + tag.getTagId(), CommonFilterConstants.GROUP_TAG_STATE + "");
}
}
for (final FilterCategory filterCategory : filter.getFilterCategories()) {
final Category category = filterCategory.getCategory();
final Project project = filterCategory.getProject();
if (filterCategory.getCategoryState() == CommonFilterConstants.CATEGORY_INTERNAL_AND_STATE) {
vars.put(
CommonFilterConstants.CATEORY_INTERNAL_LOGIC + category.getCategoryId() + (project == null ? "" : "-" + project
.getProjectId()),
CommonFilterConstants.AND_LOGIC);
}
// don't add a url var for the "or" internal logic, as this is the
// default
else if (filterCategory.getCategoryState() == CommonFilterConstants.CATEGORY_EXTERNAL_OR_STATE) {
vars.put(
CommonFilterConstants.CATEORY_EXTERNAL_LOGIC + category.getCategoryId() + (project == null ? "" : "-" + project
.getProjectId()),
CommonFilterConstants.OR_LOGIC);
}
// don't add a url var for the "and" external logic, as this is the
// default
}
int count = 1;
for (final FilterLocale filterLocale : filter.getFilterLocales()) {
final Integer localeState = filterLocale.getLocaleState();
if (localeState == CommonFilterConstants.MATCH_TAG_STATE) {
vars.put(CommonFilterConstants.MATCH_LOCALE + count, filterLocale.getLocaleName() + CommonFilterConstants.MATCH_TAG_STATE);
} else if (localeState == CommonFilterConstants.NOT_MATCH_TAG_STATE) {
vars.put(CommonFilterConstants.MATCH_LOCALE + count,
filterLocale.getLocaleName() + CommonFilterConstants.NOT_MATCH_TAG_STATE);
}
count++;
}
boolean foundFilterField = false;
boolean foundFilterFieldLogic = false;
for (final FilterField filterField : filter.getFilterFields()) {
try {
vars.put(filterField.getField(), URLEncoder.encode(filterField.getValue(), "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
if (!filterField.getField().equals(CommonFilterConstants.LOGIC_FILTER_VAR)) foundFilterField = true;
else foundFilterFieldLogic = true;
}
/*
* if we have found some filter fields, but did not find the filter
* logic, use the default value
*/
if (foundFilterField && !foundFilterFieldLogic)
vars.put(CommonFilterConstants.LOGIC_FILTER_VAR, FilterConstants.LOGIC_FILTER_VAR_DEFAULT_VALUE);
return vars;
}
|
java
|
public static HashMap<String, String> getUrlVariables(final Filter filter) {
final HashMap<String, String> vars = new HashMap<String, String>();
for (final FilterTag filterTag : filter.getFilterTags()) {
final Tag tag = filterTag.getTag();
final Integer tagState = filterTag.getTagState();
if (tagState == CommonFilterConstants.MATCH_TAG_STATE) {
vars.put(CommonFilterConstants.MATCH_TAG + tag.getTagId(), CommonFilterConstants.MATCH_TAG_STATE + "");
} else if (tagState == CommonFilterConstants.NOT_MATCH_TAG_STATE) {
vars.put(CommonFilterConstants.MATCH_TAG + tag.getTagId(), CommonFilterConstants.NOT_MATCH_TAG_STATE + "");
} else if (tagState == CommonFilterConstants.GROUP_TAG_STATE) {
vars.put(CommonFilterConstants.GROUP_TAG + tag.getTagId(), CommonFilterConstants.GROUP_TAG_STATE + "");
}
}
for (final FilterCategory filterCategory : filter.getFilterCategories()) {
final Category category = filterCategory.getCategory();
final Project project = filterCategory.getProject();
if (filterCategory.getCategoryState() == CommonFilterConstants.CATEGORY_INTERNAL_AND_STATE) {
vars.put(
CommonFilterConstants.CATEORY_INTERNAL_LOGIC + category.getCategoryId() + (project == null ? "" : "-" + project
.getProjectId()),
CommonFilterConstants.AND_LOGIC);
}
// don't add a url var for the "or" internal logic, as this is the
// default
else if (filterCategory.getCategoryState() == CommonFilterConstants.CATEGORY_EXTERNAL_OR_STATE) {
vars.put(
CommonFilterConstants.CATEORY_EXTERNAL_LOGIC + category.getCategoryId() + (project == null ? "" : "-" + project
.getProjectId()),
CommonFilterConstants.OR_LOGIC);
}
// don't add a url var for the "and" external logic, as this is the
// default
}
int count = 1;
for (final FilterLocale filterLocale : filter.getFilterLocales()) {
final Integer localeState = filterLocale.getLocaleState();
if (localeState == CommonFilterConstants.MATCH_TAG_STATE) {
vars.put(CommonFilterConstants.MATCH_LOCALE + count, filterLocale.getLocaleName() + CommonFilterConstants.MATCH_TAG_STATE);
} else if (localeState == CommonFilterConstants.NOT_MATCH_TAG_STATE) {
vars.put(CommonFilterConstants.MATCH_LOCALE + count,
filterLocale.getLocaleName() + CommonFilterConstants.NOT_MATCH_TAG_STATE);
}
count++;
}
boolean foundFilterField = false;
boolean foundFilterFieldLogic = false;
for (final FilterField filterField : filter.getFilterFields()) {
try {
vars.put(filterField.getField(), URLEncoder.encode(filterField.getValue(), "UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
if (!filterField.getField().equals(CommonFilterConstants.LOGIC_FILTER_VAR)) foundFilterField = true;
else foundFilterFieldLogic = true;
}
/*
* if we have found some filter fields, but did not find the filter
* logic, use the default value
*/
if (foundFilterField && !foundFilterFieldLogic)
vars.put(CommonFilterConstants.LOGIC_FILTER_VAR, FilterConstants.LOGIC_FILTER_VAR_DEFAULT_VALUE);
return vars;
}
|
[
"public",
"static",
"HashMap",
"<",
"String",
",",
"String",
">",
"getUrlVariables",
"(",
"final",
"Filter",
"filter",
")",
"{",
"final",
"HashMap",
"<",
"String",
",",
"String",
">",
"vars",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"for",
"(",
"final",
"FilterTag",
"filterTag",
":",
"filter",
".",
"getFilterTags",
"(",
")",
")",
"{",
"final",
"Tag",
"tag",
"=",
"filterTag",
".",
"getTag",
"(",
")",
";",
"final",
"Integer",
"tagState",
"=",
"filterTag",
".",
"getTagState",
"(",
")",
";",
"if",
"(",
"tagState",
"==",
"CommonFilterConstants",
".",
"MATCH_TAG_STATE",
")",
"{",
"vars",
".",
"put",
"(",
"CommonFilterConstants",
".",
"MATCH_TAG",
"+",
"tag",
".",
"getTagId",
"(",
")",
",",
"CommonFilterConstants",
".",
"MATCH_TAG_STATE",
"+",
"\"\"",
")",
";",
"}",
"else",
"if",
"(",
"tagState",
"==",
"CommonFilterConstants",
".",
"NOT_MATCH_TAG_STATE",
")",
"{",
"vars",
".",
"put",
"(",
"CommonFilterConstants",
".",
"MATCH_TAG",
"+",
"tag",
".",
"getTagId",
"(",
")",
",",
"CommonFilterConstants",
".",
"NOT_MATCH_TAG_STATE",
"+",
"\"\"",
")",
";",
"}",
"else",
"if",
"(",
"tagState",
"==",
"CommonFilterConstants",
".",
"GROUP_TAG_STATE",
")",
"{",
"vars",
".",
"put",
"(",
"CommonFilterConstants",
".",
"GROUP_TAG",
"+",
"tag",
".",
"getTagId",
"(",
")",
",",
"CommonFilterConstants",
".",
"GROUP_TAG_STATE",
"+",
"\"\"",
")",
";",
"}",
"}",
"for",
"(",
"final",
"FilterCategory",
"filterCategory",
":",
"filter",
".",
"getFilterCategories",
"(",
")",
")",
"{",
"final",
"Category",
"category",
"=",
"filterCategory",
".",
"getCategory",
"(",
")",
";",
"final",
"Project",
"project",
"=",
"filterCategory",
".",
"getProject",
"(",
")",
";",
"if",
"(",
"filterCategory",
".",
"getCategoryState",
"(",
")",
"==",
"CommonFilterConstants",
".",
"CATEGORY_INTERNAL_AND_STATE",
")",
"{",
"vars",
".",
"put",
"(",
"CommonFilterConstants",
".",
"CATEORY_INTERNAL_LOGIC",
"+",
"category",
".",
"getCategoryId",
"(",
")",
"+",
"(",
"project",
"==",
"null",
"?",
"\"\"",
":",
"\"-\"",
"+",
"project",
".",
"getProjectId",
"(",
")",
")",
",",
"CommonFilterConstants",
".",
"AND_LOGIC",
")",
";",
"}",
"// don't add a url var for the \"or\" internal logic, as this is the",
"// default",
"else",
"if",
"(",
"filterCategory",
".",
"getCategoryState",
"(",
")",
"==",
"CommonFilterConstants",
".",
"CATEGORY_EXTERNAL_OR_STATE",
")",
"{",
"vars",
".",
"put",
"(",
"CommonFilterConstants",
".",
"CATEORY_EXTERNAL_LOGIC",
"+",
"category",
".",
"getCategoryId",
"(",
")",
"+",
"(",
"project",
"==",
"null",
"?",
"\"\"",
":",
"\"-\"",
"+",
"project",
".",
"getProjectId",
"(",
")",
")",
",",
"CommonFilterConstants",
".",
"OR_LOGIC",
")",
";",
"}",
"// don't add a url var for the \"and\" external logic, as this is the",
"// default",
"}",
"int",
"count",
"=",
"1",
";",
"for",
"(",
"final",
"FilterLocale",
"filterLocale",
":",
"filter",
".",
"getFilterLocales",
"(",
")",
")",
"{",
"final",
"Integer",
"localeState",
"=",
"filterLocale",
".",
"getLocaleState",
"(",
")",
";",
"if",
"(",
"localeState",
"==",
"CommonFilterConstants",
".",
"MATCH_TAG_STATE",
")",
"{",
"vars",
".",
"put",
"(",
"CommonFilterConstants",
".",
"MATCH_LOCALE",
"+",
"count",
",",
"filterLocale",
".",
"getLocaleName",
"(",
")",
"+",
"CommonFilterConstants",
".",
"MATCH_TAG_STATE",
")",
";",
"}",
"else",
"if",
"(",
"localeState",
"==",
"CommonFilterConstants",
".",
"NOT_MATCH_TAG_STATE",
")",
"{",
"vars",
".",
"put",
"(",
"CommonFilterConstants",
".",
"MATCH_LOCALE",
"+",
"count",
",",
"filterLocale",
".",
"getLocaleName",
"(",
")",
"+",
"CommonFilterConstants",
".",
"NOT_MATCH_TAG_STATE",
")",
";",
"}",
"count",
"++",
";",
"}",
"boolean",
"foundFilterField",
"=",
"false",
";",
"boolean",
"foundFilterFieldLogic",
"=",
"false",
";",
"for",
"(",
"final",
"FilterField",
"filterField",
":",
"filter",
".",
"getFilterFields",
"(",
")",
")",
"{",
"try",
"{",
"vars",
".",
"put",
"(",
"filterField",
".",
"getField",
"(",
")",
",",
"URLEncoder",
".",
"encode",
"(",
"filterField",
".",
"getValue",
"(",
")",
",",
"\"UTF-8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"!",
"filterField",
".",
"getField",
"(",
")",
".",
"equals",
"(",
"CommonFilterConstants",
".",
"LOGIC_FILTER_VAR",
")",
")",
"foundFilterField",
"=",
"true",
";",
"else",
"foundFilterFieldLogic",
"=",
"true",
";",
"}",
"/*\n * if we have found some filter fields, but did not find the filter\n * logic, use the default value\n */",
"if",
"(",
"foundFilterField",
"&&",
"!",
"foundFilterFieldLogic",
")",
"vars",
".",
"put",
"(",
"CommonFilterConstants",
".",
"LOGIC_FILTER_VAR",
",",
"FilterConstants",
".",
"LOGIC_FILTER_VAR_DEFAULT_VALUE",
")",
";",
"return",
"vars",
";",
"}"
] |
Translate the contents of this filter, its tags and categories into
variables that can be appended to a url
@return
|
[
"Translate",
"the",
"contents",
"of",
"this",
"filter",
"its",
"tags",
"and",
"categories",
"into",
"variables",
"that",
"can",
"be",
"appended",
"to",
"a",
"url"
] |
2bb23430adab956737d0301cd2ea933f986dd85b
|
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/utils/FilterUtilities.java#L55-L129
|
152,805
|
NessComputing/components-ness-event
|
core/src/main/java/com/nesscomputing/event/NessEvent.java
|
NessEvent.createEvent
|
@JsonCreator
static NessEvent createEvent(@Nullable @JsonProperty("user") final UUID user,
@Nullable @JsonProperty("timestamp") final DateTime timestamp,
@Nonnull @JsonProperty("id") final UUID id,
@Nonnull @JsonProperty("type") final NessEventType type,
@Nullable @JsonProperty("payload") final Map<String, ? extends Object> payload)
{
return new NessEvent(user, timestamp, type, payload, id);
}
|
java
|
@JsonCreator
static NessEvent createEvent(@Nullable @JsonProperty("user") final UUID user,
@Nullable @JsonProperty("timestamp") final DateTime timestamp,
@Nonnull @JsonProperty("id") final UUID id,
@Nonnull @JsonProperty("type") final NessEventType type,
@Nullable @JsonProperty("payload") final Map<String, ? extends Object> payload)
{
return new NessEvent(user, timestamp, type, payload, id);
}
|
[
"@",
"JsonCreator",
"static",
"NessEvent",
"createEvent",
"(",
"@",
"Nullable",
"@",
"JsonProperty",
"(",
"\"user\"",
")",
"final",
"UUID",
"user",
",",
"@",
"Nullable",
"@",
"JsonProperty",
"(",
"\"timestamp\"",
")",
"final",
"DateTime",
"timestamp",
",",
"@",
"Nonnull",
"@",
"JsonProperty",
"(",
"\"id\"",
")",
"final",
"UUID",
"id",
",",
"@",
"Nonnull",
"@",
"JsonProperty",
"(",
"\"type\"",
")",
"final",
"NessEventType",
"type",
",",
"@",
"Nullable",
"@",
"JsonProperty",
"(",
"\"payload\"",
")",
"final",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"payload",
")",
"{",
"return",
"new",
"NessEvent",
"(",
"user",
",",
"timestamp",
",",
"type",
",",
"payload",
",",
"id",
")",
";",
"}"
] |
Create a new event from over-the-wire json.
@param user User that the event happened for. Can be null for a system level event.
@param timestamp The time when this event entered the system
@param type The Event type.
@param payload Arbitrary data describing the event.
@param id UUID as event id.
|
[
"Create",
"a",
"new",
"event",
"from",
"over",
"-",
"the",
"-",
"wire",
"json",
"."
] |
6d41f9e7c810c3ffa6bb79e19bb8cfb1d1c12c33
|
https://github.com/NessComputing/components-ness-event/blob/6d41f9e7c810c3ffa6bb79e19bb8cfb1d1c12c33/core/src/main/java/com/nesscomputing/event/NessEvent.java#L63-L71
|
152,806
|
NessComputing/components-ness-event
|
core/src/main/java/com/nesscomputing/event/NessEvent.java
|
NessEvent.createEvent
|
public static NessEvent createEvent(@Nullable final UUID user,
@Nullable final DateTime timestamp,
@Nonnull final NessEventType type,
@Nullable final Map<String, ? extends Object> payload)
{
return new NessEvent(user, timestamp, type, payload, UUID.randomUUID());
}
|
java
|
public static NessEvent createEvent(@Nullable final UUID user,
@Nullable final DateTime timestamp,
@Nonnull final NessEventType type,
@Nullable final Map<String, ? extends Object> payload)
{
return new NessEvent(user, timestamp, type, payload, UUID.randomUUID());
}
|
[
"public",
"static",
"NessEvent",
"createEvent",
"(",
"@",
"Nullable",
"final",
"UUID",
"user",
",",
"@",
"Nullable",
"final",
"DateTime",
"timestamp",
",",
"@",
"Nonnull",
"final",
"NessEventType",
"type",
",",
"@",
"Nullable",
"final",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"payload",
")",
"{",
"return",
"new",
"NessEvent",
"(",
"user",
",",
"timestamp",
",",
"type",
",",
"payload",
",",
"UUID",
".",
"randomUUID",
"(",
")",
")",
";",
"}"
] |
Create a new event.
@param user User that the event happened for. Can be null for a system level event.
@param timestamp The time when this event entered the system
@param type The Event type.
@param payload Arbitrary data describing the event.
|
[
"Create",
"a",
"new",
"event",
"."
] |
6d41f9e7c810c3ffa6bb79e19bb8cfb1d1c12c33
|
https://github.com/NessComputing/components-ness-event/blob/6d41f9e7c810c3ffa6bb79e19bb8cfb1d1c12c33/core/src/main/java/com/nesscomputing/event/NessEvent.java#L81-L87
|
152,807
|
NessComputing/components-ness-event
|
core/src/main/java/com/nesscomputing/event/NessEvent.java
|
NessEvent.createEvent
|
public static NessEvent createEvent(@Nullable final UUID user,
@Nonnull final NessEventType type)
{
return new NessEvent(user, new DateTime(DateTimeZone.UTC), type, Collections.<String, Object>emptyMap(), UUID.randomUUID());
}
|
java
|
public static NessEvent createEvent(@Nullable final UUID user,
@Nonnull final NessEventType type)
{
return new NessEvent(user, new DateTime(DateTimeZone.UTC), type, Collections.<String, Object>emptyMap(), UUID.randomUUID());
}
|
[
"public",
"static",
"NessEvent",
"createEvent",
"(",
"@",
"Nullable",
"final",
"UUID",
"user",
",",
"@",
"Nonnull",
"final",
"NessEventType",
"type",
")",
"{",
"return",
"new",
"NessEvent",
"(",
"user",
",",
"new",
"DateTime",
"(",
"DateTimeZone",
".",
"UTC",
")",
",",
"type",
",",
"Collections",
".",
"<",
"String",
",",
"Object",
">",
"emptyMap",
"(",
")",
",",
"UUID",
".",
"randomUUID",
"(",
")",
")",
";",
"}"
] |
Convenience constructor that assumes no payload.
|
[
"Convenience",
"constructor",
"that",
"assumes",
"no",
"payload",
"."
] |
6d41f9e7c810c3ffa6bb79e19bb8cfb1d1c12c33
|
https://github.com/NessComputing/components-ness-event/blob/6d41f9e7c810c3ffa6bb79e19bb8cfb1d1c12c33/core/src/main/java/com/nesscomputing/event/NessEvent.java#L103-L107
|
152,808
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/event/HistoryHandler.java
|
HistoryHandler.getHistorySourceDate
|
public BaseField getHistorySourceDate()
{
if (m_fldSourceHistoryDate == null)
{
if (m_iSourceDateSeq != null)
m_fldSourceHistoryDate = this.getOwner().getField(m_iSourceDateSeq);
else if (this.getHistoryRecord() instanceof VirtualRecord)
m_fldSourceHistoryDate = this.getOwner().getField(VirtualRecord.LAST_CHANGED);
}
return m_fldSourceHistoryDate;
}
|
java
|
public BaseField getHistorySourceDate()
{
if (m_fldSourceHistoryDate == null)
{
if (m_iSourceDateSeq != null)
m_fldSourceHistoryDate = this.getOwner().getField(m_iSourceDateSeq);
else if (this.getHistoryRecord() instanceof VirtualRecord)
m_fldSourceHistoryDate = this.getOwner().getField(VirtualRecord.LAST_CHANGED);
}
return m_fldSourceHistoryDate;
}
|
[
"public",
"BaseField",
"getHistorySourceDate",
"(",
")",
"{",
"if",
"(",
"m_fldSourceHistoryDate",
"==",
"null",
")",
"{",
"if",
"(",
"m_iSourceDateSeq",
"!=",
"null",
")",
"m_fldSourceHistoryDate",
"=",
"this",
".",
"getOwner",
"(",
")",
".",
"getField",
"(",
"m_iSourceDateSeq",
")",
";",
"else",
"if",
"(",
"this",
".",
"getHistoryRecord",
"(",
")",
"instanceof",
"VirtualRecord",
")",
"m_fldSourceHistoryDate",
"=",
"this",
".",
"getOwner",
"(",
")",
".",
"getField",
"(",
"VirtualRecord",
".",
"LAST_CHANGED",
")",
";",
"}",
"return",
"m_fldSourceHistoryDate",
";",
"}"
] |
Get the date source from this record
|
[
"Get",
"the",
"date",
"source",
"from",
"this",
"record"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/HistoryHandler.java#L170-L180
|
152,809
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/event/HistoryHandler.java
|
HistoryHandler.bumpTime
|
public Date bumpTime(DateTimeField fieldTarget)
{
Date dateBefore = fieldTarget.getDateTime();
Calendar calTarget = fieldTarget.getCalendar();
calTarget.add(Calendar.SECOND, 1);
fieldTarget.setCalendar(calTarget, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE);
return dateBefore;
}
|
java
|
public Date bumpTime(DateTimeField fieldTarget)
{
Date dateBefore = fieldTarget.getDateTime();
Calendar calTarget = fieldTarget.getCalendar();
calTarget.add(Calendar.SECOND, 1);
fieldTarget.setCalendar(calTarget, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE);
return dateBefore;
}
|
[
"public",
"Date",
"bumpTime",
"(",
"DateTimeField",
"fieldTarget",
")",
"{",
"Date",
"dateBefore",
"=",
"fieldTarget",
".",
"getDateTime",
"(",
")",
";",
"Calendar",
"calTarget",
"=",
"fieldTarget",
".",
"getCalendar",
"(",
")",
";",
"calTarget",
".",
"add",
"(",
"Calendar",
".",
"SECOND",
",",
"1",
")",
";",
"fieldTarget",
".",
"setCalendar",
"(",
"calTarget",
",",
"DBConstants",
".",
"DISPLAY",
",",
"DBConstants",
".",
"SCREEN_MOVE",
")",
";",
"return",
"dateBefore",
";",
"}"
] |
Bump time field by a second.
@param fieldTarget
@return
|
[
"Bump",
"time",
"field",
"by",
"a",
"second",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/HistoryHandler.java#L252-L259
|
152,810
|
schwa-lab/libschwa-java
|
src/main/java/org/schwa/dr/AnnSchema.java
|
AnnSchema.getField
|
public FieldSchema getField(String name) {
for (FieldSchema field : fieldSchemas)
if (field.getName().equals(name))
return field;
return null;
}
|
java
|
public FieldSchema getField(String name) {
for (FieldSchema field : fieldSchemas)
if (field.getName().equals(name))
return field;
return null;
}
|
[
"public",
"FieldSchema",
"getField",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"FieldSchema",
"field",
":",
"fieldSchemas",
")",
"if",
"(",
"field",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"return",
"field",
";",
"return",
"null",
";",
"}"
] |
Returns the schema for the field on this annotation class whose name matches the provided
name. This method returns null if no field matches.
|
[
"Returns",
"the",
"schema",
"for",
"the",
"field",
"on",
"this",
"annotation",
"class",
"whose",
"name",
"matches",
"the",
"provided",
"name",
".",
"This",
"method",
"returns",
"null",
"if",
"no",
"field",
"matches",
"."
] |
83a2330e212bbc0fcd62be12453424736d997f41
|
https://github.com/schwa-lab/libschwa-java/blob/83a2330e212bbc0fcd62be12453424736d997f41/src/main/java/org/schwa/dr/AnnSchema.java#L50-L55
|
152,811
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/util/FileUtils.java
|
FileUtils.copyFile
|
public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new
FileInputStream(in).getChannel();
FileChannel outChannel = new
FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
}
catch (IOException e) {
throw e;
}
finally {
if (inChannel != null) {
inChannel.close();
}
if (outChannel != null) {
outChannel.close();
}
}
}
|
java
|
public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new
FileInputStream(in).getChannel();
FileChannel outChannel = new
FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
}
catch (IOException e) {
throw e;
}
finally {
if (inChannel != null) {
inChannel.close();
}
if (outChannel != null) {
outChannel.close();
}
}
}
|
[
"public",
"static",
"void",
"copyFile",
"(",
"File",
"in",
",",
"File",
"out",
")",
"throws",
"IOException",
"{",
"FileChannel",
"inChannel",
"=",
"new",
"FileInputStream",
"(",
"in",
")",
".",
"getChannel",
"(",
")",
";",
"FileChannel",
"outChannel",
"=",
"new",
"FileOutputStream",
"(",
"out",
")",
".",
"getChannel",
"(",
")",
";",
"try",
"{",
"inChannel",
".",
"transferTo",
"(",
"0",
",",
"inChannel",
".",
"size",
"(",
")",
",",
"outChannel",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"finally",
"{",
"if",
"(",
"inChannel",
"!=",
"null",
")",
"{",
"inChannel",
".",
"close",
"(",
")",
";",
"}",
"if",
"(",
"outChannel",
"!=",
"null",
")",
"{",
"outChannel",
".",
"close",
"(",
")",
";",
"}",
"}",
"}"
] |
Copy file a file from one location to another.
@param in Source file
@param out Target file
@throws IOException if any error occurred.
|
[
"Copy",
"file",
"a",
"file",
"from",
"one",
"location",
"to",
"another",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/util/FileUtils.java#L30-L49
|
152,812
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/LevenbergMarquardt.java
|
LevenbergMarquardt.adjustParam
|
private boolean adjustParam(DenseMatrix64F X, DenseMatrix64F Y,
double prevCost) {
// lambda adjusts how big of a step it takes
double lambda = initialLambda;
// the difference between the current and previous cost
double difference = 1000;
for( int iter = 0; iter < iter1 && difference > maxDifference ; iter++ ) {
// compute some variables based on the gradient
computeDandH(param,X,Y);
// try various step sizes and see if any of them improve the
// results over what has already been done
boolean foundBetter = false;
for( int i = 0; i < iter2; i++ ) {
computeA(A,H,lambda);
if( !solve(A,d,negDelta) ) {
return false;
}
// compute the candidate parameters
subtract(param, negDelta, tempParam);
double cost = cost(tempParam,X,Y);
if( cost < prevCost ) {
// the candidate parameters produced better results so use it
foundBetter = true;
param.set(tempParam);
difference = prevCost - cost;
prevCost = cost;
lambda /= 10.0;
} else {
lambda *= 10.0;
}
}
// it reached a point where it can't improve so exit
if( !foundBetter )
break;
}
finalCost = prevCost;
return true;
}
|
java
|
private boolean adjustParam(DenseMatrix64F X, DenseMatrix64F Y,
double prevCost) {
// lambda adjusts how big of a step it takes
double lambda = initialLambda;
// the difference between the current and previous cost
double difference = 1000;
for( int iter = 0; iter < iter1 && difference > maxDifference ; iter++ ) {
// compute some variables based on the gradient
computeDandH(param,X,Y);
// try various step sizes and see if any of them improve the
// results over what has already been done
boolean foundBetter = false;
for( int i = 0; i < iter2; i++ ) {
computeA(A,H,lambda);
if( !solve(A,d,negDelta) ) {
return false;
}
// compute the candidate parameters
subtract(param, negDelta, tempParam);
double cost = cost(tempParam,X,Y);
if( cost < prevCost ) {
// the candidate parameters produced better results so use it
foundBetter = true;
param.set(tempParam);
difference = prevCost - cost;
prevCost = cost;
lambda /= 10.0;
} else {
lambda *= 10.0;
}
}
// it reached a point where it can't improve so exit
if( !foundBetter )
break;
}
finalCost = prevCost;
return true;
}
|
[
"private",
"boolean",
"adjustParam",
"(",
"DenseMatrix64F",
"X",
",",
"DenseMatrix64F",
"Y",
",",
"double",
"prevCost",
")",
"{",
"// lambda adjusts how big of a step it takes\r",
"double",
"lambda",
"=",
"initialLambda",
";",
"// the difference between the current and previous cost\r",
"double",
"difference",
"=",
"1000",
";",
"for",
"(",
"int",
"iter",
"=",
"0",
";",
"iter",
"<",
"iter1",
"&&",
"difference",
">",
"maxDifference",
";",
"iter",
"++",
")",
"{",
"// compute some variables based on the gradient\r",
"computeDandH",
"(",
"param",
",",
"X",
",",
"Y",
")",
";",
"// try various step sizes and see if any of them improve the\r",
"// results over what has already been done\r",
"boolean",
"foundBetter",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"iter2",
";",
"i",
"++",
")",
"{",
"computeA",
"(",
"A",
",",
"H",
",",
"lambda",
")",
";",
"if",
"(",
"!",
"solve",
"(",
"A",
",",
"d",
",",
"negDelta",
")",
")",
"{",
"return",
"false",
";",
"}",
"// compute the candidate parameters\r",
"subtract",
"(",
"param",
",",
"negDelta",
",",
"tempParam",
")",
";",
"double",
"cost",
"=",
"cost",
"(",
"tempParam",
",",
"X",
",",
"Y",
")",
";",
"if",
"(",
"cost",
"<",
"prevCost",
")",
"{",
"// the candidate parameters produced better results so use it\r",
"foundBetter",
"=",
"true",
";",
"param",
".",
"set",
"(",
"tempParam",
")",
";",
"difference",
"=",
"prevCost",
"-",
"cost",
";",
"prevCost",
"=",
"cost",
";",
"lambda",
"/=",
"10.0",
";",
"}",
"else",
"{",
"lambda",
"*=",
"10.0",
";",
"}",
"}",
"// it reached a point where it can't improve so exit\r",
"if",
"(",
"!",
"foundBetter",
")",
"break",
";",
"}",
"finalCost",
"=",
"prevCost",
";",
"return",
"true",
";",
"}"
] |
Iterate until the difference between the costs is insignificant
or it iterates too many times
|
[
"Iterate",
"until",
"the",
"difference",
"between",
"the",
"costs",
"is",
"insignificant",
"or",
"it",
"iterates",
"too",
"many",
"times"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/LevenbergMarquardt.java#L158-L200
|
152,813
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/LevenbergMarquardt.java
|
LevenbergMarquardt.computeDandH
|
private void computeDandH( DenseMatrix64F param , DenseMatrix64F x , DenseMatrix64F y )
{
func.compute(param,x, tempDH);
subtractEquals(tempDH, y);
if (jacobianFactory != null)
{
jacobianFactory.computeJacobian(param, x, jacobian);
}
else
{
computeNumericalJacobian(param,x,jacobian);
}
int numParam = param.getNumElements();
int length = y.getNumElements();
// d = average{ (f(x_i;p) - y_i) * jacobian(:,i) }
for( int i = 0; i < numParam; i++ ) {
double total = 0;
for( int j = 0; j < length; j++ ) {
total += tempDH.get(j,0)*jacobian.get(i,j);
}
d.set(i,0,total/length);
}
// compute the approximation of the hessian
multTransB(jacobian,jacobian,H);
scale(1.0/length,H);
}
|
java
|
private void computeDandH( DenseMatrix64F param , DenseMatrix64F x , DenseMatrix64F y )
{
func.compute(param,x, tempDH);
subtractEquals(tempDH, y);
if (jacobianFactory != null)
{
jacobianFactory.computeJacobian(param, x, jacobian);
}
else
{
computeNumericalJacobian(param,x,jacobian);
}
int numParam = param.getNumElements();
int length = y.getNumElements();
// d = average{ (f(x_i;p) - y_i) * jacobian(:,i) }
for( int i = 0; i < numParam; i++ ) {
double total = 0;
for( int j = 0; j < length; j++ ) {
total += tempDH.get(j,0)*jacobian.get(i,j);
}
d.set(i,0,total/length);
}
// compute the approximation of the hessian
multTransB(jacobian,jacobian,H);
scale(1.0/length,H);
}
|
[
"private",
"void",
"computeDandH",
"(",
"DenseMatrix64F",
"param",
",",
"DenseMatrix64F",
"x",
",",
"DenseMatrix64F",
"y",
")",
"{",
"func",
".",
"compute",
"(",
"param",
",",
"x",
",",
"tempDH",
")",
";",
"subtractEquals",
"(",
"tempDH",
",",
"y",
")",
";",
"if",
"(",
"jacobianFactory",
"!=",
"null",
")",
"{",
"jacobianFactory",
".",
"computeJacobian",
"(",
"param",
",",
"x",
",",
"jacobian",
")",
";",
"}",
"else",
"{",
"computeNumericalJacobian",
"(",
"param",
",",
"x",
",",
"jacobian",
")",
";",
"}",
"int",
"numParam",
"=",
"param",
".",
"getNumElements",
"(",
")",
";",
"int",
"length",
"=",
"y",
".",
"getNumElements",
"(",
")",
";",
"// d = average{ (f(x_i;p) - y_i) * jacobian(:,i) }\r",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numParam",
";",
"i",
"++",
")",
"{",
"double",
"total",
"=",
"0",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"length",
";",
"j",
"++",
")",
"{",
"total",
"+=",
"tempDH",
".",
"get",
"(",
"j",
",",
"0",
")",
"*",
"jacobian",
".",
"get",
"(",
"i",
",",
"j",
")",
";",
"}",
"d",
".",
"set",
"(",
"i",
",",
"0",
",",
"total",
"/",
"length",
")",
";",
"}",
"// compute the approximation of the hessian\r",
"multTransB",
"(",
"jacobian",
",",
"jacobian",
",",
"H",
")",
";",
"scale",
"(",
"1.0",
"/",
"length",
",",
"H",
")",
";",
"}"
] |
Computes the d and H parameters. Where d is the average error gradient and
H is an approximation of the hessian.
|
[
"Computes",
"the",
"d",
"and",
"H",
"parameters",
".",
"Where",
"d",
"is",
"the",
"average",
"error",
"gradient",
"and",
"H",
"is",
"an",
"approximation",
"of",
"the",
"hessian",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/LevenbergMarquardt.java#L242-L271
|
152,814
|
jbundle/jbundle
|
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseSessionProxy.java
|
BaseSessionProxy.checkForSession
|
public BaseSessionProxy checkForSession(String strClassAndID)
{
int iColon = strClassAndID.indexOf(CLASS_SEPARATOR);
String strSessionClass = null;
if (iColon != -1)
strSessionClass = strClassAndID.substring(0, iColon);
String strID = strClassAndID.substring(iColon + 1);
if (REMOTE_SESSION.equals(strSessionClass))
return new SessionProxy(this, strID);
if (REMOTE_TABLE.equals(strSessionClass))
return new TableProxy(this, strID);
if (REMOTE_BASE_SESSION.equals(strSessionClass))
return new BaseSessionProxy(this, strID);
return null; // Not a session
}
|
java
|
public BaseSessionProxy checkForSession(String strClassAndID)
{
int iColon = strClassAndID.indexOf(CLASS_SEPARATOR);
String strSessionClass = null;
if (iColon != -1)
strSessionClass = strClassAndID.substring(0, iColon);
String strID = strClassAndID.substring(iColon + 1);
if (REMOTE_SESSION.equals(strSessionClass))
return new SessionProxy(this, strID);
if (REMOTE_TABLE.equals(strSessionClass))
return new TableProxy(this, strID);
if (REMOTE_BASE_SESSION.equals(strSessionClass))
return new BaseSessionProxy(this, strID);
return null; // Not a session
}
|
[
"public",
"BaseSessionProxy",
"checkForSession",
"(",
"String",
"strClassAndID",
")",
"{",
"int",
"iColon",
"=",
"strClassAndID",
".",
"indexOf",
"(",
"CLASS_SEPARATOR",
")",
";",
"String",
"strSessionClass",
"=",
"null",
";",
"if",
"(",
"iColon",
"!=",
"-",
"1",
")",
"strSessionClass",
"=",
"strClassAndID",
".",
"substring",
"(",
"0",
",",
"iColon",
")",
";",
"String",
"strID",
"=",
"strClassAndID",
".",
"substring",
"(",
"iColon",
"+",
"1",
")",
";",
"if",
"(",
"REMOTE_SESSION",
".",
"equals",
"(",
"strSessionClass",
")",
")",
"return",
"new",
"SessionProxy",
"(",
"this",
",",
"strID",
")",
";",
"if",
"(",
"REMOTE_TABLE",
".",
"equals",
"(",
"strSessionClass",
")",
")",
"return",
"new",
"TableProxy",
"(",
"this",
",",
"strID",
")",
";",
"if",
"(",
"REMOTE_BASE_SESSION",
".",
"equals",
"(",
"strSessionClass",
")",
")",
"return",
"new",
"BaseSessionProxy",
"(",
"this",
",",
"strID",
")",
";",
"return",
"null",
";",
"// Not a session",
"}"
] |
Check for session.
@param strClassAndID
@return
|
[
"Check",
"for",
"session",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseSessionProxy.java#L102-L116
|
152,815
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/configuration/BasicSebConfiguration.java
|
BasicSebConfiguration.getDefaultBaseUrlRegex
|
protected String getDefaultBaseUrlRegex() {
String baseUrl = getBaseUrl();
return baseUrl == null ? null : Pattern.quote(baseUrl);
}
|
java
|
protected String getDefaultBaseUrlRegex() {
String baseUrl = getBaseUrl();
return baseUrl == null ? null : Pattern.quote(baseUrl);
}
|
[
"protected",
"String",
"getDefaultBaseUrlRegex",
"(",
")",
"{",
"String",
"baseUrl",
"=",
"getBaseUrl",
"(",
")",
";",
"return",
"baseUrl",
"==",
"null",
"?",
"null",
":",
"Pattern",
".",
"quote",
"(",
"baseUrl",
")",
";",
"}"
] |
Default base URL regex for pages. Override this for different value.
@return The base URL regex
|
[
"Default",
"base",
"URL",
"regex",
"for",
"pages",
".",
"Override",
"this",
"for",
"different",
"value",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/configuration/BasicSebConfiguration.java#L134-L137
|
152,816
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/configuration/BasicSebConfiguration.java
|
BasicSebConfiguration.getDefaultReportDir
|
protected File getDefaultReportDir() {
File reportsRootDir = getReportsRootDir();
if (reportsRootDir == null) {
throw new SebException("Reports root directory is null");
}
if (!reportsRootDir.exists()) {
try {
Files.createDirectories(reportsRootDir.toPath());
} catch (IOException e) {
throw new SebException(
"Reports root directory does not exists and can not be created " + reportsRootDir);
}
} else if (!reportsRootDir.isDirectory()) {
throw new SebException("Reports root directory is not directory " + reportsRootDir);
} else if (!reportsRootDir.canWrite()) {
throw new SebException("Reports root directory is not writable " + reportsRootDir);
}
File reportDir = new SebUtils()
.getUniqueFilePath(reportsRootDir, LocalDateTime.now().format(Seb.FILE_DATE_FORMATTER), null).toFile();
try {
Files.createDirectories(reportDir.toPath());
} catch (IOException e) {
throw new SebException("Report directory can not be created " + reportDir);
}
return reportDir;
}
|
java
|
protected File getDefaultReportDir() {
File reportsRootDir = getReportsRootDir();
if (reportsRootDir == null) {
throw new SebException("Reports root directory is null");
}
if (!reportsRootDir.exists()) {
try {
Files.createDirectories(reportsRootDir.toPath());
} catch (IOException e) {
throw new SebException(
"Reports root directory does not exists and can not be created " + reportsRootDir);
}
} else if (!reportsRootDir.isDirectory()) {
throw new SebException("Reports root directory is not directory " + reportsRootDir);
} else if (!reportsRootDir.canWrite()) {
throw new SebException("Reports root directory is not writable " + reportsRootDir);
}
File reportDir = new SebUtils()
.getUniqueFilePath(reportsRootDir, LocalDateTime.now().format(Seb.FILE_DATE_FORMATTER), null).toFile();
try {
Files.createDirectories(reportDir.toPath());
} catch (IOException e) {
throw new SebException("Report directory can not be created " + reportDir);
}
return reportDir;
}
|
[
"protected",
"File",
"getDefaultReportDir",
"(",
")",
"{",
"File",
"reportsRootDir",
"=",
"getReportsRootDir",
"(",
")",
";",
"if",
"(",
"reportsRootDir",
"==",
"null",
")",
"{",
"throw",
"new",
"SebException",
"(",
"\"Reports root directory is null\"",
")",
";",
"}",
"if",
"(",
"!",
"reportsRootDir",
".",
"exists",
"(",
")",
")",
"{",
"try",
"{",
"Files",
".",
"createDirectories",
"(",
"reportsRootDir",
".",
"toPath",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"SebException",
"(",
"\"Reports root directory does not exists and can not be created \"",
"+",
"reportsRootDir",
")",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"reportsRootDir",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"SebException",
"(",
"\"Reports root directory is not directory \"",
"+",
"reportsRootDir",
")",
";",
"}",
"else",
"if",
"(",
"!",
"reportsRootDir",
".",
"canWrite",
"(",
")",
")",
"{",
"throw",
"new",
"SebException",
"(",
"\"Reports root directory is not writable \"",
"+",
"reportsRootDir",
")",
";",
"}",
"File",
"reportDir",
"=",
"new",
"SebUtils",
"(",
")",
".",
"getUniqueFilePath",
"(",
"reportsRootDir",
",",
"LocalDateTime",
".",
"now",
"(",
")",
".",
"format",
"(",
"Seb",
".",
"FILE_DATE_FORMATTER",
")",
",",
"null",
")",
".",
"toFile",
"(",
")",
";",
"try",
"{",
"Files",
".",
"createDirectories",
"(",
"reportDir",
".",
"toPath",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"SebException",
"(",
"\"Report directory can not be created \"",
"+",
"reportDir",
")",
";",
"}",
"return",
"reportDir",
";",
"}"
] |
Returns directory for storing Seb report files. As default, unique
directory is created inside reports root directory. Override this for
different value.
@return The report directory.
|
[
"Returns",
"directory",
"for",
"storing",
"Seb",
"report",
"files",
".",
"As",
"default",
"unique",
"directory",
"is",
"created",
"inside",
"reports",
"root",
"directory",
".",
"Override",
"this",
"for",
"different",
"value",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/configuration/BasicSebConfiguration.java#L248-L273
|
152,817
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/configuration/BasicSebConfiguration.java
|
BasicSebConfiguration.getDefaultListeners
|
protected List<SebListener> getDefaultListeners() {
return new ArrayList<>(Arrays.asList(new ConfigListener(), new LoggingListener(), new SebLogListener(),
new WebDriverLogListener(), new PageSourceListener(), new ScreenshotListener()));
}
|
java
|
protected List<SebListener> getDefaultListeners() {
return new ArrayList<>(Arrays.asList(new ConfigListener(), new LoggingListener(), new SebLogListener(),
new WebDriverLogListener(), new PageSourceListener(), new ScreenshotListener()));
}
|
[
"protected",
"List",
"<",
"SebListener",
">",
"getDefaultListeners",
"(",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"Arrays",
".",
"asList",
"(",
"new",
"ConfigListener",
"(",
")",
",",
"new",
"LoggingListener",
"(",
")",
",",
"new",
"SebLogListener",
"(",
")",
",",
"new",
"WebDriverLogListener",
"(",
")",
",",
"new",
"PageSourceListener",
"(",
")",
",",
"new",
"ScreenshotListener",
"(",
")",
")",
")",
";",
"}"
] |
Returns default list of Seb event listeners. Override this for different
value.
@return The Seb event listeners.
|
[
"Returns",
"default",
"list",
"of",
"Seb",
"event",
"listeners",
".",
"Override",
"this",
"for",
"different",
"value",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/configuration/BasicSebConfiguration.java#L281-L284
|
152,818
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/configuration/BasicSebConfiguration.java
|
BasicSebConfiguration.getDefaultLogLevel
|
protected Level getDefaultLogLevel() {
String levelStr = getProperty(LOG_LEVEL);
Level level = null;
if (levelStr != null) {
level = Level.parse(levelStr);
}
if (level == null)
level = Level.INFO;
return level;
}
|
java
|
protected Level getDefaultLogLevel() {
String levelStr = getProperty(LOG_LEVEL);
Level level = null;
if (levelStr != null) {
level = Level.parse(levelStr);
}
if (level == null)
level = Level.INFO;
return level;
}
|
[
"protected",
"Level",
"getDefaultLogLevel",
"(",
")",
"{",
"String",
"levelStr",
"=",
"getProperty",
"(",
"LOG_LEVEL",
")",
";",
"Level",
"level",
"=",
"null",
";",
"if",
"(",
"levelStr",
"!=",
"null",
")",
"{",
"level",
"=",
"Level",
".",
"parse",
"(",
"levelStr",
")",
";",
"}",
"if",
"(",
"level",
"==",
"null",
")",
"level",
"=",
"Level",
".",
"INFO",
";",
"return",
"level",
";",
"}"
] |
Basic log level. Override this for different value.
@return The log level.
|
[
"Basic",
"log",
"level",
".",
"Override",
"this",
"for",
"different",
"value",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/configuration/BasicSebConfiguration.java#L299-L308
|
152,819
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/AppletScreen.java
|
AppletScreen.getTitle
|
public String getTitle() // Standard file maint for this record (returns new record)
{
for (int i = 0; i < this.getSFieldCount(); i++)
{
if (this.getSField(i) instanceof BaseScreen)
return ((BaseScreen)this.getSField(i)).getTitle();
}
return super.getTitle();
}
|
java
|
public String getTitle() // Standard file maint for this record (returns new record)
{
for (int i = 0; i < this.getSFieldCount(); i++)
{
if (this.getSField(i) instanceof BaseScreen)
return ((BaseScreen)this.getSField(i)).getTitle();
}
return super.getTitle();
}
|
[
"public",
"String",
"getTitle",
"(",
")",
"// Standard file maint for this record (returns new record)",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"getSFieldCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"this",
".",
"getSField",
"(",
"i",
")",
"instanceof",
"BaseScreen",
")",
"return",
"(",
"(",
"BaseScreen",
")",
"this",
".",
"getSField",
"(",
"i",
")",
")",
".",
"getTitle",
"(",
")",
";",
"}",
"return",
"super",
".",
"getTitle",
"(",
")",
";",
"}"
] |
Title for this screen.
@return the screen title.
|
[
"Title",
"for",
"this",
"screen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/AppletScreen.java#L216-L224
|
152,820
|
dfoerderreuther/console-builder
|
console-builder/src/main/java/de/eleon/console/builder/ConsoleReaderWrapper.java
|
ConsoleReaderWrapper.print
|
public void print(CharSequence charSequence) {
try {
consoleReader.println(charSequence);
consoleReader.flush();
} catch (IOException e) {
throw new IllegalStateException("Can't write to console", e);
}
}
|
java
|
public void print(CharSequence charSequence) {
try {
consoleReader.println(charSequence);
consoleReader.flush();
} catch (IOException e) {
throw new IllegalStateException("Can't write to console", e);
}
}
|
[
"public",
"void",
"print",
"(",
"CharSequence",
"charSequence",
")",
"{",
"try",
"{",
"consoleReader",
".",
"println",
"(",
"charSequence",
")",
";",
"consoleReader",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Can't write to console\"",
",",
"e",
")",
";",
"}",
"}"
] |
Print charSequence to console
@param charSequence to print
|
[
"Print",
"charSequence",
"to",
"console"
] |
814bee4a1a812a3a39a9b239e5eccb525b944e65
|
https://github.com/dfoerderreuther/console-builder/blob/814bee4a1a812a3a39a9b239e5eccb525b944e65/console-builder/src/main/java/de/eleon/console/builder/ConsoleReaderWrapper.java#L99-L106
|
152,821
|
dfoerderreuther/console-builder
|
console-builder/src/main/java/de/eleon/console/builder/ConsoleReaderWrapper.java
|
ConsoleReaderWrapper.setCompleters
|
public void setCompleters(List<Completer> completers) {
for (Completer completer : consoleReader.getCompleters()) {
consoleReader.removeCompleter(completer);
}
if (Iterables.size(completers) > 1) {
Completer completer = new AggregateCompleter(completers);
consoleReader.addCompleter(completer);
}
for (Completer completer : completers) {
consoleReader.addCompleter(completer);
}
}
|
java
|
public void setCompleters(List<Completer> completers) {
for (Completer completer : consoleReader.getCompleters()) {
consoleReader.removeCompleter(completer);
}
if (Iterables.size(completers) > 1) {
Completer completer = new AggregateCompleter(completers);
consoleReader.addCompleter(completer);
}
for (Completer completer : completers) {
consoleReader.addCompleter(completer);
}
}
|
[
"public",
"void",
"setCompleters",
"(",
"List",
"<",
"Completer",
">",
"completers",
")",
"{",
"for",
"(",
"Completer",
"completer",
":",
"consoleReader",
".",
"getCompleters",
"(",
")",
")",
"{",
"consoleReader",
".",
"removeCompleter",
"(",
"completer",
")",
";",
"}",
"if",
"(",
"Iterables",
".",
"size",
"(",
"completers",
")",
">",
"1",
")",
"{",
"Completer",
"completer",
"=",
"new",
"AggregateCompleter",
"(",
"completers",
")",
";",
"consoleReader",
".",
"addCompleter",
"(",
"completer",
")",
";",
"}",
"for",
"(",
"Completer",
"completer",
":",
"completers",
")",
"{",
"consoleReader",
".",
"addCompleter",
"(",
"completer",
")",
";",
"}",
"}"
] |
Remove all completers and add the new ones. If completers contains more then one element create an AggregateCompleter with the completers and add it.
@param completers to add
|
[
"Remove",
"all",
"completers",
"and",
"add",
"the",
"new",
"ones",
".",
"If",
"completers",
"contains",
"more",
"then",
"one",
"element",
"create",
"an",
"AggregateCompleter",
"with",
"the",
"completers",
"and",
"add",
"it",
"."
] |
814bee4a1a812a3a39a9b239e5eccb525b944e65
|
https://github.com/dfoerderreuther/console-builder/blob/814bee4a1a812a3a39a9b239e5eccb525b944e65/console-builder/src/main/java/de/eleon/console/builder/ConsoleReaderWrapper.java#L127-L138
|
152,822
|
dfoerderreuther/console-builder
|
console-builder/src/main/java/de/eleon/console/builder/ConsoleReaderWrapper.java
|
ConsoleReaderWrapper.getInput
|
public String getInput() {
try {
String ret = consoleReader.readLine();
if (ret != null) {
ret = ret.trim();
}
if (ret != null && !ret.isEmpty() && consoleReader.isHistoryEnabled() && history != null) {
history.add(ret);
history.flush();
}
return ret;
} catch (IOException e) {
throw new IllegalStateException("Can't read from console", e);
}
}
|
java
|
public String getInput() {
try {
String ret = consoleReader.readLine();
if (ret != null) {
ret = ret.trim();
}
if (ret != null && !ret.isEmpty() && consoleReader.isHistoryEnabled() && history != null) {
history.add(ret);
history.flush();
}
return ret;
} catch (IOException e) {
throw new IllegalStateException("Can't read from console", e);
}
}
|
[
"public",
"String",
"getInput",
"(",
")",
"{",
"try",
"{",
"String",
"ret",
"=",
"consoleReader",
".",
"readLine",
"(",
")",
";",
"if",
"(",
"ret",
"!=",
"null",
")",
"{",
"ret",
"=",
"ret",
".",
"trim",
"(",
")",
";",
"}",
"if",
"(",
"ret",
"!=",
"null",
"&&",
"!",
"ret",
".",
"isEmpty",
"(",
")",
"&&",
"consoleReader",
".",
"isHistoryEnabled",
"(",
")",
"&&",
"history",
"!=",
"null",
")",
"{",
"history",
".",
"add",
"(",
"ret",
")",
";",
"history",
".",
"flush",
"(",
")",
";",
"}",
"return",
"ret",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Can't read from console\"",
",",
"e",
")",
";",
"}",
"}"
] |
Get User input
@return the user input
|
[
"Get",
"User",
"input"
] |
814bee4a1a812a3a39a9b239e5eccb525b944e65
|
https://github.com/dfoerderreuther/console-builder/blob/814bee4a1a812a3a39a9b239e5eccb525b944e65/console-builder/src/main/java/de/eleon/console/builder/ConsoleReaderWrapper.java#L145-L159
|
152,823
|
js-lib-com/commons
|
src/main/java/js/format/Duration.java
|
Duration.format
|
private String format(double duration, Units units)
{
StringBuilder builder = new StringBuilder();
builder.append(numberFormat.format(duration));
builder.append(' ');
builder.append(units.display());
return builder.toString();
}
|
java
|
private String format(double duration, Units units)
{
StringBuilder builder = new StringBuilder();
builder.append(numberFormat.format(duration));
builder.append(' ');
builder.append(units.display());
return builder.toString();
}
|
[
"private",
"String",
"format",
"(",
"double",
"duration",
",",
"Units",
"units",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"numberFormat",
".",
"format",
"(",
"duration",
")",
")",
";",
"builder",
".",
"append",
"(",
"'",
"'",
")",
";",
"builder",
".",
"append",
"(",
"units",
".",
"display",
"(",
")",
")",
";",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] |
Build time duration representation for given numeric value and units.
@param duration duration numeric part value,
@param units bit rate units.
@return formated bit rate.
|
[
"Build",
"time",
"duration",
"representation",
"for",
"given",
"numeric",
"value",
"and",
"units",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/format/Duration.java#L120-L127
|
152,824
|
jbundle/jbundle
|
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java
|
XBasePanel.getMetaRedirect
|
public String getMetaRedirect()
{
if (this.getProperty(XMLTags.META_REDIRECT) != null)
return this.getProperty(XMLTags.META_REDIRECT);
return DBConstants.BLANK; // Override this
}
|
java
|
public String getMetaRedirect()
{
if (this.getProperty(XMLTags.META_REDIRECT) != null)
return this.getProperty(XMLTags.META_REDIRECT);
return DBConstants.BLANK; // Override this
}
|
[
"public",
"String",
"getMetaRedirect",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getProperty",
"(",
"XMLTags",
".",
"META_REDIRECT",
")",
"!=",
"null",
")",
"return",
"this",
".",
"getProperty",
"(",
"XMLTags",
".",
"META_REDIRECT",
")",
";",
"return",
"DBConstants",
".",
"BLANK",
";",
"// Override this",
"}"
] |
Get the name of the meta tag.
@return The name of the meta tag(s).
|
[
"Get",
"the",
"name",
"of",
"the",
"meta",
"tag",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java#L160-L165
|
152,825
|
jbundle/jbundle
|
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java
|
XBasePanel.getThisURL
|
public String getThisURL()
{
String strURL = DBConstants.BLANK;
strURL = Utility.addURLParam(strURL, DBParams.RECORD, this.getProperty(DBParams.RECORD), false);
strURL = Utility.addURLParam(strURL, DBParams.SCREEN, this.getProperty(DBParams.SCREEN), false);
strURL = Utility.addURLParam(strURL, DBParams.CLASS, this.getProperty(DBParams.CLASS), false);
strURL = Utility.addURLParam(strURL, DBParams.COMMAND, this.getProperty(DBParams.COMMAND), false);
strURL = Utility.addURLParam(strURL, DBParams.MENU, this.getProperty(DBParams.MENU), false);
return strURL;
}
|
java
|
public String getThisURL()
{
String strURL = DBConstants.BLANK;
strURL = Utility.addURLParam(strURL, DBParams.RECORD, this.getProperty(DBParams.RECORD), false);
strURL = Utility.addURLParam(strURL, DBParams.SCREEN, this.getProperty(DBParams.SCREEN), false);
strURL = Utility.addURLParam(strURL, DBParams.CLASS, this.getProperty(DBParams.CLASS), false);
strURL = Utility.addURLParam(strURL, DBParams.COMMAND, this.getProperty(DBParams.COMMAND), false);
strURL = Utility.addURLParam(strURL, DBParams.MENU, this.getProperty(DBParams.MENU), false);
return strURL;
}
|
[
"public",
"String",
"getThisURL",
"(",
")",
"{",
"String",
"strURL",
"=",
"DBConstants",
".",
"BLANK",
";",
"strURL",
"=",
"Utility",
".",
"addURLParam",
"(",
"strURL",
",",
"DBParams",
".",
"RECORD",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"RECORD",
")",
",",
"false",
")",
";",
"strURL",
"=",
"Utility",
".",
"addURLParam",
"(",
"strURL",
",",
"DBParams",
".",
"SCREEN",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"SCREEN",
")",
",",
"false",
")",
";",
"strURL",
"=",
"Utility",
".",
"addURLParam",
"(",
"strURL",
",",
"DBParams",
".",
"CLASS",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"CLASS",
")",
",",
"false",
")",
";",
"strURL",
"=",
"Utility",
".",
"addURLParam",
"(",
"strURL",
",",
"DBParams",
".",
"COMMAND",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"COMMAND",
")",
",",
"false",
")",
";",
"strURL",
"=",
"Utility",
".",
"addURLParam",
"(",
"strURL",
",",
"DBParams",
".",
"MENU",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"MENU",
")",
",",
"false",
")",
";",
"return",
"strURL",
";",
"}"
] |
Get the URL to display this page.
@return The URL string.
|
[
"Get",
"the",
"URL",
"to",
"display",
"this",
"page",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java#L513-L522
|
152,826
|
eostermueller/headlessInTraceClient
|
src/main/java/org/headlessintrace/client/connection/ConnectionDetail.java
|
ConnectionDetail.executeStartupCommands
|
void executeStartupCommands() {
if (m_startupCommands !=null) {
StringBuilder sb = new StringBuilder();
for (IAgentCommand cmd : m_startupCommands) {
sb.append(cmd.getMessage());
}
getControlThread().sendMessage(sb.toString());
}
}
|
java
|
void executeStartupCommands() {
if (m_startupCommands !=null) {
StringBuilder sb = new StringBuilder();
for (IAgentCommand cmd : m_startupCommands) {
sb.append(cmd.getMessage());
}
getControlThread().sendMessage(sb.toString());
}
}
|
[
"void",
"executeStartupCommands",
"(",
")",
"{",
"if",
"(",
"m_startupCommands",
"!=",
"null",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"IAgentCommand",
"cmd",
":",
"m_startupCommands",
")",
"{",
"sb",
".",
"append",
"(",
"cmd",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"getControlThread",
"(",
")",
".",
"sendMessage",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] |
Immediately after the connection is first established, execute all the commands in this.m_startupCommands.
This method concatenates the commands of all those given in the array and attempts to execute them
in a single round-trip call.
|
[
"Immediately",
"after",
"the",
"connection",
"is",
"first",
"established",
"execute",
"all",
"the",
"commands",
"in",
"this",
".",
"m_startupCommands",
".",
"This",
"method",
"concatenates",
"the",
"commands",
"of",
"all",
"those",
"given",
"in",
"the",
"array",
"and",
"attempts",
"to",
"execute",
"them",
"in",
"a",
"single",
"round",
"-",
"trip",
"call",
"."
] |
50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604
|
https://github.com/eostermueller/headlessInTraceClient/blob/50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604/src/main/java/org/headlessintrace/client/connection/ConnectionDetail.java#L82-L91
|
152,827
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java
|
MessageControl.getNamespaceFromVersion
|
public String getNamespaceFromVersion(String version)
{
MessageVersion recMessageVersion = this.getMessageVersion(version);
String namespace = this.getField(MessageControl.BASE_NAMESPACE).toString();
if (namespace == null)
namespace = DBConstants.BLANK;
if ((recMessageVersion != null) && (!recMessageVersion.getField(MessageVersion.NAMESPACE).isNull()))
namespace += recMessageVersion.getField(MessageVersion.NAMESPACE).toString();
return namespace;
}
|
java
|
public String getNamespaceFromVersion(String version)
{
MessageVersion recMessageVersion = this.getMessageVersion(version);
String namespace = this.getField(MessageControl.BASE_NAMESPACE).toString();
if (namespace == null)
namespace = DBConstants.BLANK;
if ((recMessageVersion != null) && (!recMessageVersion.getField(MessageVersion.NAMESPACE).isNull()))
namespace += recMessageVersion.getField(MessageVersion.NAMESPACE).toString();
return namespace;
}
|
[
"public",
"String",
"getNamespaceFromVersion",
"(",
"String",
"version",
")",
"{",
"MessageVersion",
"recMessageVersion",
"=",
"this",
".",
"getMessageVersion",
"(",
"version",
")",
";",
"String",
"namespace",
"=",
"this",
".",
"getField",
"(",
"MessageControl",
".",
"BASE_NAMESPACE",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"namespace",
"==",
"null",
")",
"namespace",
"=",
"DBConstants",
".",
"BLANK",
";",
"if",
"(",
"(",
"recMessageVersion",
"!=",
"null",
")",
"&&",
"(",
"!",
"recMessageVersion",
".",
"getField",
"(",
"MessageVersion",
".",
"NAMESPACE",
")",
".",
"isNull",
"(",
")",
")",
")",
"namespace",
"+=",
"recMessageVersion",
".",
"getField",
"(",
"MessageVersion",
".",
"NAMESPACE",
")",
".",
"toString",
"(",
")",
";",
"return",
"namespace",
";",
"}"
] |
GetNamespaceFromVersion Method.
|
[
"GetNamespaceFromVersion",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java#L148-L157
|
152,828
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java
|
MessageControl.getMessageVersion
|
public MessageVersion getMessageVersion(String version)
{
MessageVersion recMessageVersion = this.getMessageVersion();
recMessageVersion.setKeyArea(MessageVersion.CODE_KEY);
version = MessageControl.fixVersion(version);
recMessageVersion.getField(MessageVersion.CODE).setString(version);
try {
if (version != null)
if (recMessageVersion.seek(DBConstants.EQUALS))
{
return recMessageVersion;
}
} catch (DBException e) {
e.printStackTrace();
}
return (MessageVersion)((ReferenceField)this.getField(MessageControl.DEFAULT_VERSION_ID)).getReference();
}
|
java
|
public MessageVersion getMessageVersion(String version)
{
MessageVersion recMessageVersion = this.getMessageVersion();
recMessageVersion.setKeyArea(MessageVersion.CODE_KEY);
version = MessageControl.fixVersion(version);
recMessageVersion.getField(MessageVersion.CODE).setString(version);
try {
if (version != null)
if (recMessageVersion.seek(DBConstants.EQUALS))
{
return recMessageVersion;
}
} catch (DBException e) {
e.printStackTrace();
}
return (MessageVersion)((ReferenceField)this.getField(MessageControl.DEFAULT_VERSION_ID)).getReference();
}
|
[
"public",
"MessageVersion",
"getMessageVersion",
"(",
"String",
"version",
")",
"{",
"MessageVersion",
"recMessageVersion",
"=",
"this",
".",
"getMessageVersion",
"(",
")",
";",
"recMessageVersion",
".",
"setKeyArea",
"(",
"MessageVersion",
".",
"CODE_KEY",
")",
";",
"version",
"=",
"MessageControl",
".",
"fixVersion",
"(",
"version",
")",
";",
"recMessageVersion",
".",
"getField",
"(",
"MessageVersion",
".",
"CODE",
")",
".",
"setString",
"(",
"version",
")",
";",
"try",
"{",
"if",
"(",
"version",
"!=",
"null",
")",
"if",
"(",
"recMessageVersion",
".",
"seek",
"(",
"DBConstants",
".",
"EQUALS",
")",
")",
"{",
"return",
"recMessageVersion",
";",
"}",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"(",
"MessageVersion",
")",
"(",
"(",
"ReferenceField",
")",
"this",
".",
"getField",
"(",
"MessageControl",
".",
"DEFAULT_VERSION_ID",
")",
")",
".",
"getReference",
"(",
")",
";",
"}"
] |
GetMessageVersion Method.
|
[
"GetMessageVersion",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java#L201-L217
|
152,829
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java
|
MessageControl.getNumericVersionFromVersion
|
public String getNumericVersionFromVersion(String version)
{
MessageVersion recMessageVersion = this.getMessageVersion(version);
String numericVersion = DBConstants.BLANK;
if ((recMessageVersion != null) && (!recMessageVersion.getField(MessageVersion.NAMESPACE).isNull()))
numericVersion = recMessageVersion.getField(MessageVersion.NUMERIC_VERSION).toString();
if ((numericVersion == null) || (numericVersion.length() == 0))
numericVersion = "1.000";
return numericVersion;
}
|
java
|
public String getNumericVersionFromVersion(String version)
{
MessageVersion recMessageVersion = this.getMessageVersion(version);
String numericVersion = DBConstants.BLANK;
if ((recMessageVersion != null) && (!recMessageVersion.getField(MessageVersion.NAMESPACE).isNull()))
numericVersion = recMessageVersion.getField(MessageVersion.NUMERIC_VERSION).toString();
if ((numericVersion == null) || (numericVersion.length() == 0))
numericVersion = "1.000";
return numericVersion;
}
|
[
"public",
"String",
"getNumericVersionFromVersion",
"(",
"String",
"version",
")",
"{",
"MessageVersion",
"recMessageVersion",
"=",
"this",
".",
"getMessageVersion",
"(",
"version",
")",
";",
"String",
"numericVersion",
"=",
"DBConstants",
".",
"BLANK",
";",
"if",
"(",
"(",
"recMessageVersion",
"!=",
"null",
")",
"&&",
"(",
"!",
"recMessageVersion",
".",
"getField",
"(",
"MessageVersion",
".",
"NAMESPACE",
")",
".",
"isNull",
"(",
")",
")",
")",
"numericVersion",
"=",
"recMessageVersion",
".",
"getField",
"(",
"MessageVersion",
".",
"NUMERIC_VERSION",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"(",
"numericVersion",
"==",
"null",
")",
"||",
"(",
"numericVersion",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"numericVersion",
"=",
"\"1.000\"",
";",
"return",
"numericVersion",
";",
"}"
] |
GetNumericVersionFromVersion Method.
|
[
"GetNumericVersionFromVersion",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java#L221-L230
|
152,830
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java
|
MessageControl.getIdFromVersion
|
public String getIdFromVersion(String version)
{
MessageVersion recMessageVersion = this.getMessageVersion(version);
String idVersion = DBConstants.BLANK;
if ((idVersion != null) && (!recMessageVersion.getField(MessageVersion.NAMESPACE).isNull()))
idVersion = recMessageVersion.getField(MessageVersion.VERSION_ID).toString();
if ((idVersion == null) || (idVersion.length() == 0))
idVersion = "OTA" + version;
return idVersion;
}
|
java
|
public String getIdFromVersion(String version)
{
MessageVersion recMessageVersion = this.getMessageVersion(version);
String idVersion = DBConstants.BLANK;
if ((idVersion != null) && (!recMessageVersion.getField(MessageVersion.NAMESPACE).isNull()))
idVersion = recMessageVersion.getField(MessageVersion.VERSION_ID).toString();
if ((idVersion == null) || (idVersion.length() == 0))
idVersion = "OTA" + version;
return idVersion;
}
|
[
"public",
"String",
"getIdFromVersion",
"(",
"String",
"version",
")",
"{",
"MessageVersion",
"recMessageVersion",
"=",
"this",
".",
"getMessageVersion",
"(",
"version",
")",
";",
"String",
"idVersion",
"=",
"DBConstants",
".",
"BLANK",
";",
"if",
"(",
"(",
"idVersion",
"!=",
"null",
")",
"&&",
"(",
"!",
"recMessageVersion",
".",
"getField",
"(",
"MessageVersion",
".",
"NAMESPACE",
")",
".",
"isNull",
"(",
")",
")",
")",
"idVersion",
"=",
"recMessageVersion",
".",
"getField",
"(",
"MessageVersion",
".",
"VERSION_ID",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"(",
"idVersion",
"==",
"null",
")",
"||",
"(",
"idVersion",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"idVersion",
"=",
"\"OTA\"",
"+",
"version",
";",
"return",
"idVersion",
";",
"}"
] |
GetIdFromVersion Method.
|
[
"GetIdFromVersion",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java#L234-L243
|
152,831
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java
|
MessageControl.fixVersion
|
public static String fixVersion(String version)
{
if (version != null)
if (version.length() > 0)
{
version = version.toUpperCase();
if (Character.isLetter(version.charAt(0)))
version = version.substring(1, version.length()) + version.substring(0, 1); // Move letter to start
}
return version;
}
|
java
|
public static String fixVersion(String version)
{
if (version != null)
if (version.length() > 0)
{
version = version.toUpperCase();
if (Character.isLetter(version.charAt(0)))
version = version.substring(1, version.length()) + version.substring(0, 1); // Move letter to start
}
return version;
}
|
[
"public",
"static",
"String",
"fixVersion",
"(",
"String",
"version",
")",
"{",
"if",
"(",
"version",
"!=",
"null",
")",
"if",
"(",
"version",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"version",
"=",
"version",
".",
"toUpperCase",
"(",
")",
";",
"if",
"(",
"Character",
".",
"isLetter",
"(",
"version",
".",
"charAt",
"(",
"0",
")",
")",
")",
"version",
"=",
"version",
".",
"substring",
"(",
"1",
",",
"version",
".",
"length",
"(",
")",
")",
"+",
"version",
".",
"substring",
"(",
"0",
",",
"1",
")",
";",
"// Move letter to start",
"}",
"return",
"version",
";",
"}"
] |
FixVersion Method.
|
[
"FixVersion",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java#L247-L257
|
152,832
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java
|
MessageControl.getVersionFromSchemaLocation
|
public String getVersionFromSchemaLocation(String schemaLocation)
{
MessageVersion recMessageVersion = this.getMessageVersion();
recMessageVersion.close();
try {
while (recMessageVersion.hasNext())
{
recMessageVersion.next();
String messageSchemaLocation = this.getSchemaLocation(recMessageVersion, DBConstants.BLANK);
if (schemaLocation.startsWith(messageSchemaLocation))
return recMessageVersion.getField(MessageVersion.CODE).toString();
}
} catch (DBException e) {
e.printStackTrace();
}
return null;
}
|
java
|
public String getVersionFromSchemaLocation(String schemaLocation)
{
MessageVersion recMessageVersion = this.getMessageVersion();
recMessageVersion.close();
try {
while (recMessageVersion.hasNext())
{
recMessageVersion.next();
String messageSchemaLocation = this.getSchemaLocation(recMessageVersion, DBConstants.BLANK);
if (schemaLocation.startsWith(messageSchemaLocation))
return recMessageVersion.getField(MessageVersion.CODE).toString();
}
} catch (DBException e) {
e.printStackTrace();
}
return null;
}
|
[
"public",
"String",
"getVersionFromSchemaLocation",
"(",
"String",
"schemaLocation",
")",
"{",
"MessageVersion",
"recMessageVersion",
"=",
"this",
".",
"getMessageVersion",
"(",
")",
";",
"recMessageVersion",
".",
"close",
"(",
")",
";",
"try",
"{",
"while",
"(",
"recMessageVersion",
".",
"hasNext",
"(",
")",
")",
"{",
"recMessageVersion",
".",
"next",
"(",
")",
";",
"String",
"messageSchemaLocation",
"=",
"this",
".",
"getSchemaLocation",
"(",
"recMessageVersion",
",",
"DBConstants",
".",
"BLANK",
")",
";",
"if",
"(",
"schemaLocation",
".",
"startsWith",
"(",
"messageSchemaLocation",
")",
")",
"return",
"recMessageVersion",
".",
"getField",
"(",
"MessageVersion",
".",
"CODE",
")",
".",
"toString",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
GetVersionFromSchemaLocation Method.
|
[
"GetVersionFromSchemaLocation",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageControl.java#L261-L277
|
152,833
|
jbundle/jbundle
|
thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedInfo.java
|
CachedInfo.getEndDate
|
public Date getEndDate()
{
if ((m_startTime != null) && (m_endTime != null))
{
if (m_endTime.before(m_startTime))
return m_startTime;
}
return m_endTime;
}
|
java
|
public Date getEndDate()
{
if ((m_startTime != null) && (m_endTime != null))
{
if (m_endTime.before(m_startTime))
return m_startTime;
}
return m_endTime;
}
|
[
"public",
"Date",
"getEndDate",
"(",
")",
"{",
"if",
"(",
"(",
"m_startTime",
"!=",
"null",
")",
"&&",
"(",
"m_endTime",
"!=",
"null",
")",
")",
"{",
"if",
"(",
"m_endTime",
".",
"before",
"(",
"m_startTime",
")",
")",
"return",
"m_startTime",
";",
"}",
"return",
"m_endTime",
";",
"}"
] |
Get the ending time of this service.
|
[
"Get",
"the",
"ending",
"time",
"of",
"this",
"service",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/other/src/main/java/org/jbundle/thin/base/screen/cal/opt/CachedInfo.java#L107-L115
|
152,834
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/convert/MergeConverter.java
|
MergeConverter.setString
|
public int setString(String strString, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
if (this.getNextConverter() != null)
return this.getNextConverter().setString(strString, bDisplayOption, iMoveMode);
else
return super.setString(strString, bDisplayOption, iMoveMode);
}
|
java
|
public int setString(String strString, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
if (this.getNextConverter() != null)
return this.getNextConverter().setString(strString, bDisplayOption, iMoveMode);
else
return super.setString(strString, bDisplayOption, iMoveMode);
}
|
[
"public",
"int",
"setString",
"(",
"String",
"strString",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"// init this field override for other value",
"{",
"if",
"(",
"this",
".",
"getNextConverter",
"(",
")",
"!=",
"null",
")",
"return",
"this",
".",
"getNextConverter",
"(",
")",
".",
"setString",
"(",
"strString",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"else",
"return",
"super",
".",
"setString",
"(",
"strString",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] |
Convert and move string to this field.
Set the current string of the current next converter..
@param strString the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN).
|
[
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
".",
"Set",
"the",
"current",
"string",
"of",
"the",
"current",
"next",
"converter",
".."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/MergeConverter.java#L153-L159
|
152,835
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/convert/MergeConverter.java
|
MergeConverter.setupDefaultView
|
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert convert, int iDisplayFieldDesc, Map<String, Object> properties)
{
ScreenComponent sField = null;
Converter converter = this.getNextConverter();
if (converter != null)
sField = converter.setupDefaultView(itsLocation, targetScreen, convert, iDisplayFieldDesc, properties);
else
sField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
if (sField != null)
{ // Get rid of any and all links to/from field/converter
converter.removeComponent(sField); // Have the field add me to its list for display
sField.setConverter(this);
}
return sField;
}
|
java
|
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert convert, int iDisplayFieldDesc, Map<String, Object> properties)
{
ScreenComponent sField = null;
Converter converter = this.getNextConverter();
if (converter != null)
sField = converter.setupDefaultView(itsLocation, targetScreen, convert, iDisplayFieldDesc, properties);
else
sField = super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
if (sField != null)
{ // Get rid of any and all links to/from field/converter
converter.removeComponent(sField); // Have the field add me to its list for display
sField.setConverter(this);
}
return sField;
}
|
[
"public",
"ScreenComponent",
"setupDefaultView",
"(",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"targetScreen",
",",
"Convert",
"convert",
",",
"int",
"iDisplayFieldDesc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"ScreenComponent",
"sField",
"=",
"null",
";",
"Converter",
"converter",
"=",
"this",
".",
"getNextConverter",
"(",
")",
";",
"if",
"(",
"converter",
"!=",
"null",
")",
"sField",
"=",
"converter",
".",
"setupDefaultView",
"(",
"itsLocation",
",",
"targetScreen",
",",
"convert",
",",
"iDisplayFieldDesc",
",",
"properties",
")",
";",
"else",
"sField",
"=",
"super",
".",
"setupDefaultView",
"(",
"itsLocation",
",",
"targetScreen",
",",
"converter",
",",
"iDisplayFieldDesc",
",",
"properties",
")",
";",
"if",
"(",
"sField",
"!=",
"null",
")",
"{",
"// Get rid of any and all links to/from field/converter",
"converter",
".",
"removeComponent",
"(",
"sField",
")",
";",
"// Have the field add me to its list for display",
"sField",
".",
"setConverter",
"(",
"this",
")",
";",
"}",
"return",
"sField",
";",
"}"
] |
Set up the default control for this field.
Adds the default screen control for the current converter, and makes me it's converter.
@param itsLocation Location of this component on screen (ie., GridBagConstraint).
@param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
@param iDisplayFieldDesc Display the label? (optional).
@return Return the component or ScreenField that is created for this field.
|
[
"Set",
"up",
"the",
"default",
"control",
"for",
"this",
"field",
".",
"Adds",
"the",
"default",
"screen",
"control",
"for",
"the",
"current",
"converter",
"and",
"makes",
"me",
"it",
"s",
"converter",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/MergeConverter.java#L179-L193
|
152,836
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/convert/MergeConverter.java
|
MergeConverter.getNextConverter
|
public Converter getNextConverter()
{
BaseTable currentTable = m_MergeRecord.getTable().getCurrentTable();
if (currentTable == null)
return null;
if (m_FieldSeq != -1)
{
if (m_strLinkedRecord == null)
return currentTable.getRecord().getField(m_FieldSeq); // Get the current field
else
return currentTable.getRecord().getField(m_strLinkedRecord, m_FieldSeq); // Get the current field
}
else
{
for (int index = 0; index < m_vArray.size(); index++)
{
InfoList infoList = (InfoList)m_vArray.elementAt(index);
Record pQueryTable = currentTable.getRecord().getRecord(infoList.m_strFileName);
if (pQueryTable != null)
{
String strLinkFileName = infoList.m_strLinkFileName;
int iFieldSeq = infoList.m_iFieldSeq;
Converter field = infoList.m_converter;
if (field != null)
return field;
if (strLinkFileName != null)
return currentTable.getRecord().getField(strLinkFileName, iFieldSeq);
return pQueryTable.getField(iFieldSeq);
}
}
}
return null;
}
|
java
|
public Converter getNextConverter()
{
BaseTable currentTable = m_MergeRecord.getTable().getCurrentTable();
if (currentTable == null)
return null;
if (m_FieldSeq != -1)
{
if (m_strLinkedRecord == null)
return currentTable.getRecord().getField(m_FieldSeq); // Get the current field
else
return currentTable.getRecord().getField(m_strLinkedRecord, m_FieldSeq); // Get the current field
}
else
{
for (int index = 0; index < m_vArray.size(); index++)
{
InfoList infoList = (InfoList)m_vArray.elementAt(index);
Record pQueryTable = currentTable.getRecord().getRecord(infoList.m_strFileName);
if (pQueryTable != null)
{
String strLinkFileName = infoList.m_strLinkFileName;
int iFieldSeq = infoList.m_iFieldSeq;
Converter field = infoList.m_converter;
if (field != null)
return field;
if (strLinkFileName != null)
return currentTable.getRecord().getField(strLinkFileName, iFieldSeq);
return pQueryTable.getField(iFieldSeq);
}
}
}
return null;
}
|
[
"public",
"Converter",
"getNextConverter",
"(",
")",
"{",
"BaseTable",
"currentTable",
"=",
"m_MergeRecord",
".",
"getTable",
"(",
")",
".",
"getCurrentTable",
"(",
")",
";",
"if",
"(",
"currentTable",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"m_FieldSeq",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"m_strLinkedRecord",
"==",
"null",
")",
"return",
"currentTable",
".",
"getRecord",
"(",
")",
".",
"getField",
"(",
"m_FieldSeq",
")",
";",
"// Get the current field",
"else",
"return",
"currentTable",
".",
"getRecord",
"(",
")",
".",
"getField",
"(",
"m_strLinkedRecord",
",",
"m_FieldSeq",
")",
";",
"// Get the current field",
"}",
"else",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"m_vArray",
".",
"size",
"(",
")",
";",
"index",
"++",
")",
"{",
"InfoList",
"infoList",
"=",
"(",
"InfoList",
")",
"m_vArray",
".",
"elementAt",
"(",
"index",
")",
";",
"Record",
"pQueryTable",
"=",
"currentTable",
".",
"getRecord",
"(",
")",
".",
"getRecord",
"(",
"infoList",
".",
"m_strFileName",
")",
";",
"if",
"(",
"pQueryTable",
"!=",
"null",
")",
"{",
"String",
"strLinkFileName",
"=",
"infoList",
".",
"m_strLinkFileName",
";",
"int",
"iFieldSeq",
"=",
"infoList",
".",
"m_iFieldSeq",
";",
"Converter",
"field",
"=",
"infoList",
".",
"m_converter",
";",
"if",
"(",
"field",
"!=",
"null",
")",
"return",
"field",
";",
"if",
"(",
"strLinkFileName",
"!=",
"null",
")",
"return",
"currentTable",
".",
"getRecord",
"(",
")",
".",
"getField",
"(",
"strLinkFileName",
",",
"iFieldSeq",
")",
";",
"return",
"pQueryTable",
".",
"getField",
"(",
"iFieldSeq",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] |
Get the Current converter.
@return The current converter depending on the current table in the merge table.
|
[
"Get",
"the",
"Current",
"converter",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/MergeConverter.java#L198-L230
|
152,837
|
huangp/entityunit
|
src/main/java/com/github/huangp/entityunit/util/ClassUtil.java
|
ClassUtil.getInstanceFields
|
public static List<Field> getInstanceFields(Class type) {
List<Field> fields = Lists.newArrayList(type.getDeclaredFields());
return ImmutableList.copyOf(Iterables.filter(fields, InstanceFieldPredicate.PREDICATE));
}
|
java
|
public static List<Field> getInstanceFields(Class type) {
List<Field> fields = Lists.newArrayList(type.getDeclaredFields());
return ImmutableList.copyOf(Iterables.filter(fields, InstanceFieldPredicate.PREDICATE));
}
|
[
"public",
"static",
"List",
"<",
"Field",
">",
"getInstanceFields",
"(",
"Class",
"type",
")",
"{",
"List",
"<",
"Field",
">",
"fields",
"=",
"Lists",
".",
"newArrayList",
"(",
"type",
".",
"getDeclaredFields",
"(",
")",
")",
";",
"return",
"ImmutableList",
".",
"copyOf",
"(",
"Iterables",
".",
"filter",
"(",
"fields",
",",
"InstanceFieldPredicate",
".",
"PREDICATE",
")",
")",
";",
"}"
] |
Return all non-static and non-transient fields.
@param type
class to work with
@return list of fields
|
[
"Return",
"all",
"non",
"-",
"static",
"and",
"non",
"-",
"transient",
"fields",
"."
] |
1a09b530149d707dbff7ff46f5428d9db709a4b4
|
https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/util/ClassUtil.java#L54-L57
|
152,838
|
krotscheck/data-file-reader
|
data-file-reader-base/src/main/java/net/krotscheck/dfr/EncoderCache.java
|
EncoderCache.getEncoder
|
public static IDataEncoder getEncoder(final String mimeType)
throws ClassNotFoundException, IllegalAccessException,
InstantiationException {
populateCache();
if (!cache.containsKey(mimeType)) {
throw new ClassNotFoundException(
String.format("IDataEncoder for"
+ " mimeType [%s] not found.", mimeType));
}
Class<? extends IDataEncoder> encoderClass = cache.get(mimeType);
return encoderClass.newInstance();
}
|
java
|
public static IDataEncoder getEncoder(final String mimeType)
throws ClassNotFoundException, IllegalAccessException,
InstantiationException {
populateCache();
if (!cache.containsKey(mimeType)) {
throw new ClassNotFoundException(
String.format("IDataEncoder for"
+ " mimeType [%s] not found.", mimeType));
}
Class<? extends IDataEncoder> encoderClass = cache.get(mimeType);
return encoderClass.newInstance();
}
|
[
"public",
"static",
"IDataEncoder",
"getEncoder",
"(",
"final",
"String",
"mimeType",
")",
"throws",
"ClassNotFoundException",
",",
"IllegalAccessException",
",",
"InstantiationException",
"{",
"populateCache",
"(",
")",
";",
"if",
"(",
"!",
"cache",
".",
"containsKey",
"(",
"mimeType",
")",
")",
"{",
"throw",
"new",
"ClassNotFoundException",
"(",
"String",
".",
"format",
"(",
"\"IDataEncoder for\"",
"+",
"\" mimeType [%s] not found.\"",
",",
"mimeType",
")",
")",
";",
"}",
"Class",
"<",
"?",
"extends",
"IDataEncoder",
">",
"encoderClass",
"=",
"cache",
".",
"get",
"(",
"mimeType",
")",
";",
"return",
"encoderClass",
".",
"newInstance",
"(",
")",
";",
"}"
] |
Retrieve a encoder for a specified mime type.
@param mimeType The mimetype to scan for.
@return An instance of the encoder.
@throws ClassNotFoundException Thrown when no encoder for a mimetype is
found.
@throws IllegalAccessException Thrown when the encoder's constructor is
not accessible. Never thrown, as the
service loader would throw it first.
@throws InstantiationException Thrown when the encoder's constructor is
not accessible. Never thrown, as the
service loader would throw it first.
|
[
"Retrieve",
"a",
"encoder",
"for",
"a",
"specified",
"mime",
"type",
"."
] |
b9a85bd07dc9f9b8291ffbfb6945443d96371811
|
https://github.com/krotscheck/data-file-reader/blob/b9a85bd07dc9f9b8291ffbfb6945443d96371811/data-file-reader-base/src/main/java/net/krotscheck/dfr/EncoderCache.java#L113-L128
|
152,839
|
js-lib-com/commons
|
src/main/java/js/converter/CharactersConverter.java
|
CharactersConverter.asObject
|
@Override
public <T> T asObject(String string, Class<T> valueType) throws BugError {
// at this point value type is guaranteed to be char or Character
if (string.length() > 1) {
throw new ConverterException("Trying to convert a larger string into a single character.");
}
return (T) (Character) string.charAt(0);
}
|
java
|
@Override
public <T> T asObject(String string, Class<T> valueType) throws BugError {
// at this point value type is guaranteed to be char or Character
if (string.length() > 1) {
throw new ConverterException("Trying to convert a larger string into a single character.");
}
return (T) (Character) string.charAt(0);
}
|
[
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"asObject",
"(",
"String",
"string",
",",
"Class",
"<",
"T",
">",
"valueType",
")",
"throws",
"BugError",
"{",
"// at this point value type is guaranteed to be char or Character\r",
"if",
"(",
"string",
".",
"length",
"(",
")",
">",
"1",
")",
"{",
"throw",
"new",
"ConverterException",
"(",
"\"Trying to convert a larger string into a single character.\"",
")",
";",
"}",
"return",
"(",
"T",
")",
"(",
"Character",
")",
"string",
".",
"charAt",
"(",
"0",
")",
";",
"}"
] |
Return the first character from given string.
@throws ConverterException if given string has more than one single character.
|
[
"Return",
"the",
"first",
"character",
"from",
"given",
"string",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/CharactersConverter.java#L22-L29
|
152,840
|
jbundle/jbundle
|
app/program/manual/backup/src/main/java/org/jbundle/app/program/manual/backup/RestoreBackupProcess.java
|
RestoreBackupProcess.getFileList
|
public String[] getFileList()
{
String[] files = null;
String strFilename = this.getProperty("filename");
if (strFilename != null)
{
files = new String[1];
files[0] = strFilename;
}
String strDirname = this.getProperty("folder");
if (strDirname != null)
{
FileList list = new FileList(strDirname);
files = list.getFileNames();
if (!strDirname.endsWith("/"))
strDirname += "/";
for (int i = 0; i < files.length; i++)
{
files[i] = strDirname + files[i]; // Full pathname
}
}
return files;
}
|
java
|
public String[] getFileList()
{
String[] files = null;
String strFilename = this.getProperty("filename");
if (strFilename != null)
{
files = new String[1];
files[0] = strFilename;
}
String strDirname = this.getProperty("folder");
if (strDirname != null)
{
FileList list = new FileList(strDirname);
files = list.getFileNames();
if (!strDirname.endsWith("/"))
strDirname += "/";
for (int i = 0; i < files.length; i++)
{
files[i] = strDirname + files[i]; // Full pathname
}
}
return files;
}
|
[
"public",
"String",
"[",
"]",
"getFileList",
"(",
")",
"{",
"String",
"[",
"]",
"files",
"=",
"null",
";",
"String",
"strFilename",
"=",
"this",
".",
"getProperty",
"(",
"\"filename\"",
")",
";",
"if",
"(",
"strFilename",
"!=",
"null",
")",
"{",
"files",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"files",
"[",
"0",
"]",
"=",
"strFilename",
";",
"}",
"String",
"strDirname",
"=",
"this",
".",
"getProperty",
"(",
"\"folder\"",
")",
";",
"if",
"(",
"strDirname",
"!=",
"null",
")",
"{",
"FileList",
"list",
"=",
"new",
"FileList",
"(",
"strDirname",
")",
";",
"files",
"=",
"list",
".",
"getFileNames",
"(",
")",
";",
"if",
"(",
"!",
"strDirname",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"strDirname",
"+=",
"\"/\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"files",
".",
"length",
";",
"i",
"++",
")",
"{",
"files",
"[",
"i",
"]",
"=",
"strDirname",
"+",
"files",
"[",
"i",
"]",
";",
"// Full pathname",
"}",
"}",
"return",
"files",
";",
"}"
] |
Get the list of files to read thru and import.
@return
|
[
"Get",
"the",
"list",
"of",
"files",
"to",
"read",
"thru",
"and",
"import",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/backup/src/main/java/org/jbundle/app/program/manual/backup/RestoreBackupProcess.java#L177-L199
|
152,841
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/navi/Scalar.java
|
Scalar.add
|
void add(Scalar o)
{
if (!type.equals(o.type))
{
throw new UnsupportedOperationException("Action with wrong kind of class");
}
value += o.value;
}
|
java
|
void add(Scalar o)
{
if (!type.equals(o.type))
{
throw new UnsupportedOperationException("Action with wrong kind of class");
}
value += o.value;
}
|
[
"void",
"add",
"(",
"Scalar",
"o",
")",
"{",
"if",
"(",
"!",
"type",
".",
"equals",
"(",
"o",
".",
"type",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Action with wrong kind of class\"",
")",
";",
"}",
"value",
"+=",
"o",
".",
"value",
";",
"}"
] |
Add o value to this
@param o
|
[
"Add",
"o",
"value",
"to",
"this"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Scalar.java#L136-L143
|
152,842
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/navi/Scalar.java
|
Scalar.subtract
|
void subtract(Scalar o)
{
if (!type.equals(o.type))
{
throw new UnsupportedOperationException("Action with wrong kind of class");
}
value -= o.value;
}
|
java
|
void subtract(Scalar o)
{
if (!type.equals(o.type))
{
throw new UnsupportedOperationException("Action with wrong kind of class");
}
value -= o.value;
}
|
[
"void",
"subtract",
"(",
"Scalar",
"o",
")",
"{",
"if",
"(",
"!",
"type",
".",
"equals",
"(",
"o",
".",
"type",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Action with wrong kind of class\"",
")",
";",
"}",
"value",
"-=",
"o",
".",
"value",
";",
"}"
] |
Subtract o value from this
@param o
|
[
"Subtract",
"o",
"value",
"from",
"this"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Scalar.java#L156-L163
|
152,843
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/JackrabbitContentRepository.java
|
JackrabbitContentRepository.destroyRepository
|
@Override
protected void destroyRepository() {
final RepositoryImpl repository = (RepositoryImpl) getRepository();
repository.shutdown();
LOG.info("Destroyed repository at {}", repository.getConfig().getHomeDir());
}
|
java
|
@Override
protected void destroyRepository() {
final RepositoryImpl repository = (RepositoryImpl) getRepository();
repository.shutdown();
LOG.info("Destroyed repository at {}", repository.getConfig().getHomeDir());
}
|
[
"@",
"Override",
"protected",
"void",
"destroyRepository",
"(",
")",
"{",
"final",
"RepositoryImpl",
"repository",
"=",
"(",
"RepositoryImpl",
")",
"getRepository",
"(",
")",
";",
"repository",
".",
"shutdown",
"(",
")",
";",
"LOG",
".",
"info",
"(",
"\"Destroyed repository at {}\"",
",",
"repository",
".",
"getConfig",
"(",
")",
".",
"getHomeDir",
"(",
")",
")",
";",
"}"
] |
Closes the admin session, and in case of local transient respository for unit test, shuts down the repository and
cleans all temporary files.
|
[
"Closes",
"the",
"admin",
"session",
"and",
"in",
"case",
"of",
"local",
"transient",
"respository",
"for",
"unit",
"test",
"shuts",
"down",
"the",
"repository",
"and",
"cleans",
"all",
"temporary",
"files",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/JackrabbitContentRepository.java#L68-L74
|
152,844
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/JackrabbitContentRepository.java
|
JackrabbitContentRepository.createRepository
|
@Override
protected RepositoryImpl createRepository() throws IOException {
try {
final RepositoryConfig config = createRepositoryConfiguration();
return RepositoryImpl.create(config);
} catch (final ConfigurationException e) {
LOG.error("Configuration invalid", e);
throw new AssertionError(e.getMessage(), e);
} catch (RepositoryException e) {
LOG.error("Could not create repository", e);
throw new AssertionError(e.getMessage(), e);
}
}
|
java
|
@Override
protected RepositoryImpl createRepository() throws IOException {
try {
final RepositoryConfig config = createRepositoryConfiguration();
return RepositoryImpl.create(config);
} catch (final ConfigurationException e) {
LOG.error("Configuration invalid", e);
throw new AssertionError(e.getMessage(), e);
} catch (RepositoryException e) {
LOG.error("Could not create repository", e);
throw new AssertionError(e.getMessage(), e);
}
}
|
[
"@",
"Override",
"protected",
"RepositoryImpl",
"createRepository",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"final",
"RepositoryConfig",
"config",
"=",
"createRepositoryConfiguration",
"(",
")",
";",
"return",
"RepositoryImpl",
".",
"create",
"(",
"config",
")",
";",
"}",
"catch",
"(",
"final",
"ConfigurationException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Configuration invalid\"",
",",
"e",
")",
";",
"throw",
"new",
"AssertionError",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"RepositoryException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Could not create repository\"",
",",
"e",
")",
";",
"throw",
"new",
"AssertionError",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] |
Creates a transient repository with files in the local temp directory.
@return the created repository
@throws IOException
if the repository configuration can not be read
|
[
"Creates",
"a",
"transient",
"repository",
"with",
"files",
"in",
"the",
"local",
"temp",
"directory",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/JackrabbitContentRepository.java#L84-L97
|
152,845
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/text/CamelCase.java
|
CamelCase.delimitedLower
|
public static final String delimitedLower(String text, String delim)
{
return stream(text).map((String s)->{return s.toLowerCase();}).collect(Collectors.joining(delim));
}
|
java
|
public static final String delimitedLower(String text, String delim)
{
return stream(text).map((String s)->{return s.toLowerCase();}).collect(Collectors.joining(delim));
}
|
[
"public",
"static",
"final",
"String",
"delimitedLower",
"(",
"String",
"text",
",",
"String",
"delim",
")",
"{",
"return",
"stream",
"(",
"text",
")",
".",
"map",
"(",
"(",
"String",
"s",
")",
"->",
"{",
"return",
"s",
".",
"toLowerCase",
"(",
")",
";",
"}",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
"delim",
")",
")",
";",
"}"
] |
Return camel-case if delim = '-'
@param text
@param delim
@return
|
[
"Return",
"camel",
"-",
"case",
"if",
"delim",
"=",
"-"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/text/CamelCase.java#L69-L72
|
152,846
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/text/CamelCase.java
|
CamelCase.delimited
|
public static final String delimited(String text, String delim)
{
return stream(text).collect(Collectors.joining(delim));
}
|
java
|
public static final String delimited(String text, String delim)
{
return stream(text).collect(Collectors.joining(delim));
}
|
[
"public",
"static",
"final",
"String",
"delimited",
"(",
"String",
"text",
",",
"String",
"delim",
")",
"{",
"return",
"stream",
"(",
"text",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
"delim",
")",
")",
";",
"}"
] |
Returns Camel-Case if delim = '-'
@param text
@param delim
@return
|
[
"Returns",
"Camel",
"-",
"Case",
"if",
"delim",
"=",
"-"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/text/CamelCase.java#L79-L82
|
152,847
|
jeremiehuchet/acrachilisync
|
acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/CreationDateIssueComparator.java
|
CreationDateIssueComparator.compare
|
@Override
public int compare(final Issue i1, final Issue i2) {
if (null == i1 && null == i2) {
return 0;
} else if (null == i1) {
return 1;
} else if (null == i2) {
return -1;
} else {
return i1.getCreatedOn().compareTo(i2.getCreatedOn());
}
}
|
java
|
@Override
public int compare(final Issue i1, final Issue i2) {
if (null == i1 && null == i2) {
return 0;
} else if (null == i1) {
return 1;
} else if (null == i2) {
return -1;
} else {
return i1.getCreatedOn().compareTo(i2.getCreatedOn());
}
}
|
[
"@",
"Override",
"public",
"int",
"compare",
"(",
"final",
"Issue",
"i1",
",",
"final",
"Issue",
"i2",
")",
"{",
"if",
"(",
"null",
"==",
"i1",
"&&",
"null",
"==",
"i2",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"null",
"==",
"i1",
")",
"{",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"null",
"==",
"i2",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"{",
"return",
"i1",
".",
"getCreatedOn",
"(",
")",
".",
"compareTo",
"(",
"i2",
".",
"getCreatedOn",
"(",
")",
")",
";",
"}",
"}"
] |
Compare creation date of given issues.
@see java.util.Date#compareTo(java.util.Date)
@see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
[
"Compare",
"creation",
"date",
"of",
"given",
"issues",
"."
] |
4eadb0218623e77e0d92b5a08515eea2db51e988
|
https://github.com/jeremiehuchet/acrachilisync/blob/4eadb0218623e77e0d92b5a08515eea2db51e988/acrachilisync-core/src/main/java/fr/dudie/acrachilisync/utils/CreationDateIssueComparator.java#L35-L47
|
152,848
|
watchrabbit/rabbit-executor
|
src/main/java/com/watchrabbit/executor/command/ExecutorCommand.java
|
ExecutorCommand.withExcludedExceptions
|
public ExecutorCommand<V> withExcludedExceptions(List<Class<? extends Exception>> excludedExceptions) {
config.setExcludedExceptions(excludedExceptions);
return this;
}
|
java
|
public ExecutorCommand<V> withExcludedExceptions(List<Class<? extends Exception>> excludedExceptions) {
config.setExcludedExceptions(excludedExceptions);
return this;
}
|
[
"public",
"ExecutorCommand",
"<",
"V",
">",
"withExcludedExceptions",
"(",
"List",
"<",
"Class",
"<",
"?",
"extends",
"Exception",
">",
">",
"excludedExceptions",
")",
"{",
"config",
".",
"setExcludedExceptions",
"(",
"excludedExceptions",
")",
";",
"return",
"this",
";",
"}"
] |
If wrapped method throws one of passed exceptions breaker will pass it
without opening connection.
@param excludedExceptions exceptions that should not open breaker
@return {@code ExecutorCommand<V>} executor with configured
excludedExceptions
|
[
"If",
"wrapped",
"method",
"throws",
"one",
"of",
"passed",
"exceptions",
"breaker",
"will",
"pass",
"it",
"without",
"opening",
"connection",
"."
] |
fe6674b78e6ab464babcecb6e1f100edec3c9966
|
https://github.com/watchrabbit/rabbit-executor/blob/fe6674b78e6ab464babcecb6e1f100edec3c9966/src/main/java/com/watchrabbit/executor/command/ExecutorCommand.java#L92-L95
|
152,849
|
watchrabbit/rabbit-executor
|
src/main/java/com/watchrabbit/executor/command/ExecutorCommand.java
|
ExecutorCommand.invoke
|
public <V> V invoke(Callable<V> callable) throws Exception {
return service.executeSynchronously(callable, config);
}
|
java
|
public <V> V invoke(Callable<V> callable) throws Exception {
return service.executeSynchronously(callable, config);
}
|
[
"public",
"<",
"V",
">",
"V",
"invoke",
"(",
"Callable",
"<",
"V",
">",
"callable",
")",
"throws",
"Exception",
"{",
"return",
"service",
".",
"executeSynchronously",
"(",
"callable",
",",
"config",
")",
";",
"}"
] |
Invokes callable synchronously with respecting circuit logic and cache
logic if configured.
@param <V> type of value returned by this method
@param callable method fired by executor
@return {@code V} returns value returned by callable
@throws Exception if callable throws some exception
|
[
"Invokes",
"callable",
"synchronously",
"with",
"respecting",
"circuit",
"logic",
"and",
"cache",
"logic",
"if",
"configured",
"."
] |
fe6674b78e6ab464babcecb6e1f100edec3c9966
|
https://github.com/watchrabbit/rabbit-executor/blob/fe6674b78e6ab464babcecb6e1f100edec3c9966/src/main/java/com/watchrabbit/executor/command/ExecutorCommand.java#L121-L123
|
152,850
|
watchrabbit/rabbit-executor
|
src/main/java/com/watchrabbit/executor/command/ExecutorCommand.java
|
ExecutorCommand.queue
|
public Future<V> queue(Callable<V> callable) {
return service.executeAsynchronously(callable, config);
}
|
java
|
public Future<V> queue(Callable<V> callable) {
return service.executeAsynchronously(callable, config);
}
|
[
"public",
"Future",
"<",
"V",
">",
"queue",
"(",
"Callable",
"<",
"V",
">",
"callable",
")",
"{",
"return",
"service",
".",
"executeAsynchronously",
"(",
"callable",
",",
"config",
")",
";",
"}"
] |
Invokes runnable asynchronously with respecting circuit logic and cache
logic if configured.
@param callable method fired by executor
@return {@code Future<V>} with value or exception returned by callable
|
[
"Invokes",
"runnable",
"asynchronously",
"with",
"respecting",
"circuit",
"logic",
"and",
"cache",
"logic",
"if",
"configured",
"."
] |
fe6674b78e6ab464babcecb6e1f100edec3c9966
|
https://github.com/watchrabbit/rabbit-executor/blob/fe6674b78e6ab464babcecb6e1f100edec3c9966/src/main/java/com/watchrabbit/executor/command/ExecutorCommand.java#L146-L148
|
152,851
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/db/TaskSession.java
|
TaskSession.getEnvironment
|
public Environment getEnvironment()
{
Environment env = ((BaseApplication)this.getApplication()).getEnvironment();
if (env == null)
env = Environment.getEnvironment(null); // Never
return env;
}
|
java
|
public Environment getEnvironment()
{
Environment env = ((BaseApplication)this.getApplication()).getEnvironment();
if (env == null)
env = Environment.getEnvironment(null); // Never
return env;
}
|
[
"public",
"Environment",
"getEnvironment",
"(",
")",
"{",
"Environment",
"env",
"=",
"(",
"(",
"BaseApplication",
")",
"this",
".",
"getApplication",
"(",
")",
")",
".",
"getEnvironment",
"(",
")",
";",
"if",
"(",
"env",
"==",
"null",
")",
"env",
"=",
"Environment",
".",
"getEnvironment",
"(",
"null",
")",
";",
"// Never",
"return",
"env",
";",
"}"
] |
Get this task's environment.
@return The environment.
|
[
"Get",
"this",
"task",
"s",
"environment",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TaskSession.java#L138-L144
|
152,852
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/db/TaskSession.java
|
TaskSession.createRemoteSendQueue
|
public RemoteSendQueue createRemoteSendQueue(String strQueueName, String strQueueType) throws RemoteException
{
MessageManager messageManager = this.getEnvironment().getMessageManager(this.getApplication(), true);
BaseMessageSender sender = (BaseMessageSender)messageManager.getMessageQueue(strQueueName, strQueueType).getMessageSender();
SendQueueSession remoteQueue = new SendQueueSession(this, sender);
return remoteQueue;
}
|
java
|
public RemoteSendQueue createRemoteSendQueue(String strQueueName, String strQueueType) throws RemoteException
{
MessageManager messageManager = this.getEnvironment().getMessageManager(this.getApplication(), true);
BaseMessageSender sender = (BaseMessageSender)messageManager.getMessageQueue(strQueueName, strQueueType).getMessageSender();
SendQueueSession remoteQueue = new SendQueueSession(this, sender);
return remoteQueue;
}
|
[
"public",
"RemoteSendQueue",
"createRemoteSendQueue",
"(",
"String",
"strQueueName",
",",
"String",
"strQueueType",
")",
"throws",
"RemoteException",
"{",
"MessageManager",
"messageManager",
"=",
"this",
".",
"getEnvironment",
"(",
")",
".",
"getMessageManager",
"(",
"this",
".",
"getApplication",
"(",
")",
",",
"true",
")",
";",
"BaseMessageSender",
"sender",
"=",
"(",
"BaseMessageSender",
")",
"messageManager",
".",
"getMessageQueue",
"(",
"strQueueName",
",",
"strQueueType",
")",
".",
"getMessageSender",
"(",
")",
";",
"SendQueueSession",
"remoteQueue",
"=",
"new",
"SendQueueSession",
"(",
"this",
",",
"sender",
")",
";",
"return",
"remoteQueue",
";",
"}"
] |
Create the remote send queue.
@param strQueueName The queue name to service.
@param strQueueType The queue type.
@return The RemoteSendQueue.
|
[
"Create",
"the",
"remote",
"send",
"queue",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TaskSession.java#L274-L280
|
152,853
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/db/TaskSession.java
|
TaskSession.createRemoteReceiveQueue
|
public RemoteReceiveQueue createRemoteReceiveQueue(String strQueueName, String strQueueType) throws RemoteException
{
MessageManager messageManager = this.getEnvironment().getMessageManager(this.getApplication(), true);
BaseMessageReceiver receiver = (BaseMessageReceiver)messageManager.getMessageQueue(strQueueName, strQueueType).getMessageReceiver();
ReceiveQueueSession remoteQueue = new ReceiveQueueSession(this, receiver);
return remoteQueue;
}
|
java
|
public RemoteReceiveQueue createRemoteReceiveQueue(String strQueueName, String strQueueType) throws RemoteException
{
MessageManager messageManager = this.getEnvironment().getMessageManager(this.getApplication(), true);
BaseMessageReceiver receiver = (BaseMessageReceiver)messageManager.getMessageQueue(strQueueName, strQueueType).getMessageReceiver();
ReceiveQueueSession remoteQueue = new ReceiveQueueSession(this, receiver);
return remoteQueue;
}
|
[
"public",
"RemoteReceiveQueue",
"createRemoteReceiveQueue",
"(",
"String",
"strQueueName",
",",
"String",
"strQueueType",
")",
"throws",
"RemoteException",
"{",
"MessageManager",
"messageManager",
"=",
"this",
".",
"getEnvironment",
"(",
")",
".",
"getMessageManager",
"(",
"this",
".",
"getApplication",
"(",
")",
",",
"true",
")",
";",
"BaseMessageReceiver",
"receiver",
"=",
"(",
"BaseMessageReceiver",
")",
"messageManager",
".",
"getMessageQueue",
"(",
"strQueueName",
",",
"strQueueType",
")",
".",
"getMessageReceiver",
"(",
")",
";",
"ReceiveQueueSession",
"remoteQueue",
"=",
"new",
"ReceiveQueueSession",
"(",
"this",
",",
"receiver",
")",
";",
"return",
"remoteQueue",
";",
"}"
] |
Create the remote receive queue.
@param strQueueName The queue name to service.
@param strQueueType The queue type.
@return The RemoteSendQueue.
|
[
"Create",
"the",
"remote",
"receive",
"queue",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TaskSession.java#L287-L293
|
152,854
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/process/MessageTimeoutProcess.java
|
MessageTimeoutProcess.processMessageTimeout
|
public void processMessageTimeout(String strTrxID)
{
MessageLog recMessageLog = (MessageLog)this.getMainRecord();
BaseMessage message = (BaseMessage)recMessageLog.createMessage(strTrxID);
String strMessageError = "Message timeout";
BaseMessage messageReply = (BaseMessage)BaseMessageProcessor.processErrorMessage(this, message, strMessageError);
if (messageReply != null) // No reply if null.
{
BaseMessageTransport transport = this.getMessageTransport(message);
transport.setupReplyMessage(messageReply, message, MessageInfoType.REPLY, MessageType.MESSAGE_IN);
transport.processIncomingMessage(messageReply, message);
}
}
|
java
|
public void processMessageTimeout(String strTrxID)
{
MessageLog recMessageLog = (MessageLog)this.getMainRecord();
BaseMessage message = (BaseMessage)recMessageLog.createMessage(strTrxID);
String strMessageError = "Message timeout";
BaseMessage messageReply = (BaseMessage)BaseMessageProcessor.processErrorMessage(this, message, strMessageError);
if (messageReply != null) // No reply if null.
{
BaseMessageTransport transport = this.getMessageTransport(message);
transport.setupReplyMessage(messageReply, message, MessageInfoType.REPLY, MessageType.MESSAGE_IN);
transport.processIncomingMessage(messageReply, message);
}
}
|
[
"public",
"void",
"processMessageTimeout",
"(",
"String",
"strTrxID",
")",
"{",
"MessageLog",
"recMessageLog",
"=",
"(",
"MessageLog",
")",
"this",
".",
"getMainRecord",
"(",
")",
";",
"BaseMessage",
"message",
"=",
"(",
"BaseMessage",
")",
"recMessageLog",
".",
"createMessage",
"(",
"strTrxID",
")",
";",
"String",
"strMessageError",
"=",
"\"Message timeout\"",
";",
"BaseMessage",
"messageReply",
"=",
"(",
"BaseMessage",
")",
"BaseMessageProcessor",
".",
"processErrorMessage",
"(",
"this",
",",
"message",
",",
"strMessageError",
")",
";",
"if",
"(",
"messageReply",
"!=",
"null",
")",
"// No reply if null.",
"{",
"BaseMessageTransport",
"transport",
"=",
"this",
".",
"getMessageTransport",
"(",
"message",
")",
";",
"transport",
".",
"setupReplyMessage",
"(",
"messageReply",
",",
"message",
",",
"MessageInfoType",
".",
"REPLY",
",",
"MessageType",
".",
"MESSAGE_IN",
")",
";",
"transport",
".",
"processIncomingMessage",
"(",
"messageReply",
",",
"message",
")",
";",
"}",
"}"
] |
ProcessMessageTimeout Method.
|
[
"ProcessMessageTimeout",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/process/MessageTimeoutProcess.java#L132-L144
|
152,855
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/convert/PropertiesConverter.java
|
PropertiesConverter.setString
|
public int setString(String fieldPtr, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
if (this.getField() instanceof PropertiesField) // Always
return ((PropertiesField)this.getField()).setProperty(m_strProperty, fieldPtr, bDisplayOption, iMoveMode);
return DBConstants.NORMAL_RETURN;
}
|
java
|
public int setString(String fieldPtr, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
if (this.getField() instanceof PropertiesField) // Always
return ((PropertiesField)this.getField()).setProperty(m_strProperty, fieldPtr, bDisplayOption, iMoveMode);
return DBConstants.NORMAL_RETURN;
}
|
[
"public",
"int",
"setString",
"(",
"String",
"fieldPtr",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"// init this field override for other value",
"{",
"if",
"(",
"this",
".",
"getField",
"(",
")",
"instanceof",
"PropertiesField",
")",
"// Always",
"return",
"(",
"(",
"PropertiesField",
")",
"this",
".",
"getField",
"(",
")",
")",
".",
"setProperty",
"(",
"m_strProperty",
",",
"fieldPtr",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"}"
] |
Convert and move string to this field.
Set this property in the property field.
@param strString the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN).
|
[
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
".",
"Set",
"this",
"property",
"in",
"the",
"property",
"field",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/PropertiesConverter.java#L85-L90
|
152,856
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/JsonDomainFactory.java
|
JsonDomainFactory.fetchObject
|
@SuppressWarnings("unchecked")
@Override
public <T extends Object> T fetchObject(Class<T> clazz, String id) {
if (StringUtils.isEmpty(id)) {
return null;
}
String json = VistAUtil.getBrokerSession().callRPC("RGSER FETCH", PREFIX + getAlias(clazz), id);
return (T) JSONUtil.deserialize(json);
}
|
java
|
@SuppressWarnings("unchecked")
@Override
public <T extends Object> T fetchObject(Class<T> clazz, String id) {
if (StringUtils.isEmpty(id)) {
return null;
}
String json = VistAUtil.getBrokerSession().callRPC("RGSER FETCH", PREFIX + getAlias(clazz), id);
return (T) JSONUtil.deserialize(json);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"<",
"T",
"extends",
"Object",
">",
"T",
"fetchObject",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"id",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"id",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"json",
"=",
"VistAUtil",
".",
"getBrokerSession",
"(",
")",
".",
"callRPC",
"(",
"\"RGSER FETCH\"",
",",
"PREFIX",
"+",
"getAlias",
"(",
"clazz",
")",
",",
"id",
")",
";",
"return",
"(",
"T",
")",
"JSONUtil",
".",
"deserialize",
"(",
"json",
")",
";",
"}"
] |
Fetch an instance of the domain class from the data store.
|
[
"Fetch",
"an",
"instance",
"of",
"the",
"domain",
"class",
"from",
"the",
"data",
"store",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/JsonDomainFactory.java#L72-L81
|
152,857
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/JsonDomainFactory.java
|
JsonDomainFactory.fetchObjects
|
@SuppressWarnings("unchecked")
@Override
public <T extends Object> List<T> fetchObjects(Class<T> clazz, String[] ids) {
if (ids == null || ids.length == 0) {
return Collections.emptyList();
}
String json = VistAUtil.getBrokerSession().callRPC("RGSER FETCH", PREFIX + getAlias(clazz), ids);
return (List<T>) JSONUtil.deserialize(json);
}
|
java
|
@SuppressWarnings("unchecked")
@Override
public <T extends Object> List<T> fetchObjects(Class<T> clazz, String[] ids) {
if (ids == null || ids.length == 0) {
return Collections.emptyList();
}
String json = VistAUtil.getBrokerSession().callRPC("RGSER FETCH", PREFIX + getAlias(clazz), ids);
return (List<T>) JSONUtil.deserialize(json);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"<",
"T",
"extends",
"Object",
">",
"List",
"<",
"T",
">",
"fetchObjects",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"[",
"]",
"ids",
")",
"{",
"if",
"(",
"ids",
"==",
"null",
"||",
"ids",
".",
"length",
"==",
"0",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"String",
"json",
"=",
"VistAUtil",
".",
"getBrokerSession",
"(",
")",
".",
"callRPC",
"(",
"\"RGSER FETCH\"",
",",
"PREFIX",
"+",
"getAlias",
"(",
"clazz",
")",
",",
"ids",
")",
";",
"return",
"(",
"List",
"<",
"T",
">",
")",
"JSONUtil",
".",
"deserialize",
"(",
"json",
")",
";",
"}"
] |
Fetch multiple instances of the domain class from the data store.
|
[
"Fetch",
"multiple",
"instances",
"of",
"the",
"domain",
"class",
"from",
"the",
"data",
"store",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/JsonDomainFactory.java#L86-L95
|
152,858
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/JsonDomainFactory.java
|
JsonDomainFactory.getAlias
|
@Override
public String getAlias(Class<?> clazz) {
// Locate the alias of the requested class.
String alias = JSONUtil.getAlias(clazz);
// If not found, ensure that the class has been loaded to allow for its
// static initializers to execute, then try again.
if (alias == null) {
try {
Class.forName(clazz.getName());
} catch (ClassNotFoundException e) {
throw MiscUtil.toUnchecked(e);
}
alias = JSONUtil.getAlias(clazz);
}
return alias;
}
|
java
|
@Override
public String getAlias(Class<?> clazz) {
// Locate the alias of the requested class.
String alias = JSONUtil.getAlias(clazz);
// If not found, ensure that the class has been loaded to allow for its
// static initializers to execute, then try again.
if (alias == null) {
try {
Class.forName(clazz.getName());
} catch (ClassNotFoundException e) {
throw MiscUtil.toUnchecked(e);
}
alias = JSONUtil.getAlias(clazz);
}
return alias;
}
|
[
"@",
"Override",
"public",
"String",
"getAlias",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"// Locate the alias of the requested class.",
"String",
"alias",
"=",
"JSONUtil",
".",
"getAlias",
"(",
"clazz",
")",
";",
"// If not found, ensure that the class has been loaded to allow for its",
"// static initializers to execute, then try again.",
"if",
"(",
"alias",
"==",
"null",
")",
"{",
"try",
"{",
"Class",
".",
"forName",
"(",
"clazz",
".",
"getName",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"MiscUtil",
".",
"toUnchecked",
"(",
"e",
")",
";",
"}",
"alias",
"=",
"JSONUtil",
".",
"getAlias",
"(",
"clazz",
")",
";",
"}",
"return",
"alias",
";",
"}"
] |
Returns the alias for the domain class. A domain class will typically register its alias in a
static initializer block. If the initial attempt to retrieve an alias fails, this method
forces the class loader to load the class to ensure that any static initializers are
executed, and then tries again.
@param clazz Domain class whose alias is sought.
@return The alias for the domain class.
|
[
"Returns",
"the",
"alias",
"for",
"the",
"domain",
"class",
".",
"A",
"domain",
"class",
"will",
"typically",
"register",
"its",
"alias",
"in",
"a",
"static",
"initializer",
"block",
".",
"If",
"the",
"initial",
"attempt",
"to",
"retrieve",
"an",
"alias",
"fails",
"this",
"method",
"forces",
"the",
"class",
"loader",
"to",
"load",
"the",
"class",
"to",
"ensure",
"that",
"any",
"static",
"initializers",
"are",
"executed",
"and",
"then",
"tries",
"again",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.core/src/main/java/org/carewebframework/vista/api/JsonDomainFactory.java#L106-L123
|
152,859
|
jbundle/jbundle
|
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteFieldClass.java
|
WriteFieldClass.writeFieldInit
|
public void writeFieldInit()
{
String strClassName;
Record recClassInfo = this.getMainRecord();
strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();
if (this.readThisMethod(strClassName))
this.writeThisMethod(CodeType.THICK);
else
this.writeThisMethod(CodeType.THICK);
}
|
java
|
public void writeFieldInit()
{
String strClassName;
Record recClassInfo = this.getMainRecord();
strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();
if (this.readThisMethod(strClassName))
this.writeThisMethod(CodeType.THICK);
else
this.writeThisMethod(CodeType.THICK);
}
|
[
"public",
"void",
"writeFieldInit",
"(",
")",
"{",
"String",
"strClassName",
";",
"Record",
"recClassInfo",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"strClassName",
"=",
"recClassInfo",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"getString",
"(",
")",
";",
"if",
"(",
"this",
".",
"readThisMethod",
"(",
"strClassName",
")",
")",
"this",
".",
"writeThisMethod",
"(",
"CodeType",
".",
"THICK",
")",
";",
"else",
"this",
".",
"writeThisMethod",
"(",
"CodeType",
".",
"THICK",
")",
";",
"}"
] |
Write the field initialize code
|
[
"Write",
"the",
"field",
"initialize",
"code"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteFieldClass.java#L125-L134
|
152,860
|
jbundle/jbundle
|
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteFieldClass.java
|
WriteFieldClass.writeInitField
|
public void writeInitField()
{
Record recLogicFile = this.getRecord(LogicFile.LOGIC_FILE_FILE);
try {
String strClassName;
Record recClassInfo = this.getMainRecord();
FieldData recFieldData = (FieldData)this.getRecord(FieldData.FIELD_DATA_FILE);
strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();
if (this.readThisMethod("initField"))
this.writeThisMethod(CodeType.THICK);
else
{
String strInitField = this.getInitField(recFieldData, false, false);
if (strInitField.length() != 0)
{
recLogicFile.getField(LogicFile.METHOD_NAME).setString("initField");
recLogicFile.setKeyArea(LogicFile.METHOD_CLASS_NAME_KEY);
if (!recLogicFile.seek("="))
{
this.writeMethodInterface(null, "initField", "int", "boolean displayOption", "", "Initialize the field.", null);
String setOp = ".setString";
if ((strInitField.equalsIgnoreCase("todaysDate()")) || (strInitField.equalsIgnoreCase("currentTime()")) || (strInitField.equalsIgnoreCase("getUserID()")))
setOp = ".setValue";
if (strInitField.length() > 0)
if ((strInitField.charAt(0) == 'k') ||
(Character.isDigit(strInitField.charAt(0))) ||
(strInitField.indexOf(".k") != -1))
setOp = ".setValue";
if ((strInitField.equals("true")) || (strInitField.equals("false")))
setOp = ".setState";
if ((strClassName.equalsIgnoreCase("IntegerField")) //**Change this to look through the base classes for NumberField
|| (strClassName.equalsIgnoreCase("ShortField"))
|| (strClassName.equalsIgnoreCase("FloatField"))
|| (strClassName.equalsIgnoreCase("RealField"))
|| (strClassName.equalsIgnoreCase("CurrencysField"))
|| (strClassName.equalsIgnoreCase("DoubleField")))
setOp = ".setValue";
if (strInitField.equals("all"))
{
strInitField = "\"all\""; // HACK
setOp = ".setString";
}
if ((strInitField.indexOf('_') != -1) && (strInitField.indexOf('.') == -1))
{
strInitField = "\"\"/**" + strInitField + "*/"; // HACK
setOp = ".setString";
}
if (strInitField != strClassName)
m_StreamOut.writeit("\treturn this" + setOp + "(" + strInitField + ", displayOption, DBConstants.INIT_MOVE);\n");
m_StreamOut.writeit("}\n");
}
}
}
} catch (DBException ex) {
ex.printStackTrace();
} finally {
recLogicFile.setKeyArea(LogicFile.SEQUENCE_KEY); // set this back
}
}
|
java
|
public void writeInitField()
{
Record recLogicFile = this.getRecord(LogicFile.LOGIC_FILE_FILE);
try {
String strClassName;
Record recClassInfo = this.getMainRecord();
FieldData recFieldData = (FieldData)this.getRecord(FieldData.FIELD_DATA_FILE);
strClassName = recClassInfo.getField(ClassInfo.CLASS_NAME).getString();
if (this.readThisMethod("initField"))
this.writeThisMethod(CodeType.THICK);
else
{
String strInitField = this.getInitField(recFieldData, false, false);
if (strInitField.length() != 0)
{
recLogicFile.getField(LogicFile.METHOD_NAME).setString("initField");
recLogicFile.setKeyArea(LogicFile.METHOD_CLASS_NAME_KEY);
if (!recLogicFile.seek("="))
{
this.writeMethodInterface(null, "initField", "int", "boolean displayOption", "", "Initialize the field.", null);
String setOp = ".setString";
if ((strInitField.equalsIgnoreCase("todaysDate()")) || (strInitField.equalsIgnoreCase("currentTime()")) || (strInitField.equalsIgnoreCase("getUserID()")))
setOp = ".setValue";
if (strInitField.length() > 0)
if ((strInitField.charAt(0) == 'k') ||
(Character.isDigit(strInitField.charAt(0))) ||
(strInitField.indexOf(".k") != -1))
setOp = ".setValue";
if ((strInitField.equals("true")) || (strInitField.equals("false")))
setOp = ".setState";
if ((strClassName.equalsIgnoreCase("IntegerField")) //**Change this to look through the base classes for NumberField
|| (strClassName.equalsIgnoreCase("ShortField"))
|| (strClassName.equalsIgnoreCase("FloatField"))
|| (strClassName.equalsIgnoreCase("RealField"))
|| (strClassName.equalsIgnoreCase("CurrencysField"))
|| (strClassName.equalsIgnoreCase("DoubleField")))
setOp = ".setValue";
if (strInitField.equals("all"))
{
strInitField = "\"all\""; // HACK
setOp = ".setString";
}
if ((strInitField.indexOf('_') != -1) && (strInitField.indexOf('.') == -1))
{
strInitField = "\"\"/**" + strInitField + "*/"; // HACK
setOp = ".setString";
}
if (strInitField != strClassName)
m_StreamOut.writeit("\treturn this" + setOp + "(" + strInitField + ", displayOption, DBConstants.INIT_MOVE);\n");
m_StreamOut.writeit("}\n");
}
}
}
} catch (DBException ex) {
ex.printStackTrace();
} finally {
recLogicFile.setKeyArea(LogicFile.SEQUENCE_KEY); // set this back
}
}
|
[
"public",
"void",
"writeInitField",
"(",
")",
"{",
"Record",
"recLogicFile",
"=",
"this",
".",
"getRecord",
"(",
"LogicFile",
".",
"LOGIC_FILE_FILE",
")",
";",
"try",
"{",
"String",
"strClassName",
";",
"Record",
"recClassInfo",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"FieldData",
"recFieldData",
"=",
"(",
"FieldData",
")",
"this",
".",
"getRecord",
"(",
"FieldData",
".",
"FIELD_DATA_FILE",
")",
";",
"strClassName",
"=",
"recClassInfo",
".",
"getField",
"(",
"ClassInfo",
".",
"CLASS_NAME",
")",
".",
"getString",
"(",
")",
";",
"if",
"(",
"this",
".",
"readThisMethod",
"(",
"\"initField\"",
")",
")",
"this",
".",
"writeThisMethod",
"(",
"CodeType",
".",
"THICK",
")",
";",
"else",
"{",
"String",
"strInitField",
"=",
"this",
".",
"getInitField",
"(",
"recFieldData",
",",
"false",
",",
"false",
")",
";",
"if",
"(",
"strInitField",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"recLogicFile",
".",
"getField",
"(",
"LogicFile",
".",
"METHOD_NAME",
")",
".",
"setString",
"(",
"\"initField\"",
")",
";",
"recLogicFile",
".",
"setKeyArea",
"(",
"LogicFile",
".",
"METHOD_CLASS_NAME_KEY",
")",
";",
"if",
"(",
"!",
"recLogicFile",
".",
"seek",
"(",
"\"=\"",
")",
")",
"{",
"this",
".",
"writeMethodInterface",
"(",
"null",
",",
"\"initField\"",
",",
"\"int\"",
",",
"\"boolean displayOption\"",
",",
"\"\"",
",",
"\"Initialize the field.\"",
",",
"null",
")",
";",
"String",
"setOp",
"=",
"\".setString\"",
";",
"if",
"(",
"(",
"strInitField",
".",
"equalsIgnoreCase",
"(",
"\"todaysDate()\"",
")",
")",
"||",
"(",
"strInitField",
".",
"equalsIgnoreCase",
"(",
"\"currentTime()\"",
")",
")",
"||",
"(",
"strInitField",
".",
"equalsIgnoreCase",
"(",
"\"getUserID()\"",
")",
")",
")",
"setOp",
"=",
"\".setValue\"",
";",
"if",
"(",
"strInitField",
".",
"length",
"(",
")",
">",
"0",
")",
"if",
"(",
"(",
"strInitField",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"||",
"(",
"Character",
".",
"isDigit",
"(",
"strInitField",
".",
"charAt",
"(",
"0",
")",
")",
")",
"||",
"(",
"strInitField",
".",
"indexOf",
"(",
"\".k\"",
")",
"!=",
"-",
"1",
")",
")",
"setOp",
"=",
"\".setValue\"",
";",
"if",
"(",
"(",
"strInitField",
".",
"equals",
"(",
"\"true\"",
")",
")",
"||",
"(",
"strInitField",
".",
"equals",
"(",
"\"false\"",
")",
")",
")",
"setOp",
"=",
"\".setState\"",
";",
"if",
"(",
"(",
"strClassName",
".",
"equalsIgnoreCase",
"(",
"\"IntegerField\"",
")",
")",
"//**Change this to look through the base classes for NumberField",
"||",
"(",
"strClassName",
".",
"equalsIgnoreCase",
"(",
"\"ShortField\"",
")",
")",
"||",
"(",
"strClassName",
".",
"equalsIgnoreCase",
"(",
"\"FloatField\"",
")",
")",
"||",
"(",
"strClassName",
".",
"equalsIgnoreCase",
"(",
"\"RealField\"",
")",
")",
"||",
"(",
"strClassName",
".",
"equalsIgnoreCase",
"(",
"\"CurrencysField\"",
")",
")",
"||",
"(",
"strClassName",
".",
"equalsIgnoreCase",
"(",
"\"DoubleField\"",
")",
")",
")",
"setOp",
"=",
"\".setValue\"",
";",
"if",
"(",
"strInitField",
".",
"equals",
"(",
"\"all\"",
")",
")",
"{",
"strInitField",
"=",
"\"\\\"all\\\"\"",
";",
"// HACK",
"setOp",
"=",
"\".setString\"",
";",
"}",
"if",
"(",
"(",
"strInitField",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"&&",
"(",
"strInitField",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
")",
")",
"{",
"strInitField",
"=",
"\"\\\"\\\"/**\"",
"+",
"strInitField",
"+",
"\"*/\"",
";",
"// HACK",
"setOp",
"=",
"\".setString\"",
";",
"}",
"if",
"(",
"strInitField",
"!=",
"strClassName",
")",
"m_StreamOut",
".",
"writeit",
"(",
"\"\\treturn this\"",
"+",
"setOp",
"+",
"\"(\"",
"+",
"strInitField",
"+",
"\", displayOption, DBConstants.INIT_MOVE);\\n\"",
")",
";",
"m_StreamOut",
".",
"writeit",
"(",
"\"}\\n\"",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"recLogicFile",
".",
"setKeyArea",
"(",
"LogicFile",
".",
"SEQUENCE_KEY",
")",
";",
"// set this back",
"}",
"}"
] |
Write the field init code
|
[
"Write",
"the",
"field",
"init",
"code"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteFieldClass.java#L138-L196
|
152,861
|
OwlPlatform/java-owl-common
|
src/main/java/com/owlplatform/common/SampleMessage.java
|
SampleMessage.setDeviceId
|
public void setDeviceId(byte[] deviceId) {
if (deviceId == null) {
throw new RuntimeException("Device ID cannot be null.");
}
if (deviceId.length != DEVICE_ID_SIZE) {
throw new RuntimeException(String.format(
"Device ID must be %d bytes long.", Integer.valueOf(DEVICE_ID_SIZE)));
}
this.deviceId = deviceId;
}
|
java
|
public void setDeviceId(byte[] deviceId) {
if (deviceId == null) {
throw new RuntimeException("Device ID cannot be null.");
}
if (deviceId.length != DEVICE_ID_SIZE) {
throw new RuntimeException(String.format(
"Device ID must be %d bytes long.", Integer.valueOf(DEVICE_ID_SIZE)));
}
this.deviceId = deviceId;
}
|
[
"public",
"void",
"setDeviceId",
"(",
"byte",
"[",
"]",
"deviceId",
")",
"{",
"if",
"(",
"deviceId",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Device ID cannot be null.\"",
")",
";",
"}",
"if",
"(",
"deviceId",
".",
"length",
"!=",
"DEVICE_ID_SIZE",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"\"Device ID must be %d bytes long.\"",
",",
"Integer",
".",
"valueOf",
"(",
"DEVICE_ID_SIZE",
")",
")",
")",
";",
"}",
"this",
".",
"deviceId",
"=",
"deviceId",
";",
"}"
] |
Sets the device identifier for the transmitter referenced in this sample.
@param deviceId
the device identifier for the transmitter referenced in this
sample.
|
[
"Sets",
"the",
"device",
"identifier",
"for",
"the",
"transmitter",
"referenced",
"in",
"this",
"sample",
"."
] |
fe95d401914f4747253cef18ecf42179268367a2
|
https://github.com/OwlPlatform/java-owl-common/blob/fe95d401914f4747253cef18ecf42179268367a2/src/main/java/com/owlplatform/common/SampleMessage.java#L204-L213
|
152,862
|
OwlPlatform/java-owl-common
|
src/main/java/com/owlplatform/common/SampleMessage.java
|
SampleMessage.setReceiverId
|
public void setReceiverId(byte[] receiverId) {
if (receiverId == null) {
throw new RuntimeException("Receiver ID cannot be null.");
}
if (receiverId.length != DEVICE_ID_SIZE) {
throw new RuntimeException(
String.format("Receiver ID must be %d bytes long.",
Integer.valueOf(DEVICE_ID_SIZE)));
}
this.receiverId = receiverId;
}
|
java
|
public void setReceiverId(byte[] receiverId) {
if (receiverId == null) {
throw new RuntimeException("Receiver ID cannot be null.");
}
if (receiverId.length != DEVICE_ID_SIZE) {
throw new RuntimeException(
String.format("Receiver ID must be %d bytes long.",
Integer.valueOf(DEVICE_ID_SIZE)));
}
this.receiverId = receiverId;
}
|
[
"public",
"void",
"setReceiverId",
"(",
"byte",
"[",
"]",
"receiverId",
")",
"{",
"if",
"(",
"receiverId",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Receiver ID cannot be null.\"",
")",
";",
"}",
"if",
"(",
"receiverId",
".",
"length",
"!=",
"DEVICE_ID_SIZE",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"String",
".",
"format",
"(",
"\"Receiver ID must be %d bytes long.\"",
",",
"Integer",
".",
"valueOf",
"(",
"DEVICE_ID_SIZE",
")",
")",
")",
";",
"}",
"this",
".",
"receiverId",
"=",
"receiverId",
";",
"}"
] |
Sets the device identifier for the receiver referenced in this sample.
@param receiverId
the device identifier for the receiver referenced in this sample.
|
[
"Sets",
"the",
"device",
"identifier",
"for",
"the",
"receiver",
"referenced",
"in",
"this",
"sample",
"."
] |
fe95d401914f4747253cef18ecf42179268367a2
|
https://github.com/OwlPlatform/java-owl-common/blob/fe95d401914f4747253cef18ecf42179268367a2/src/main/java/com/owlplatform/common/SampleMessage.java#L230-L240
|
152,863
|
openCage/eightyfs
|
src/main/java/de/pfabulist/lindwurm/eighty/path/ProviderPath.java
|
ProviderPath.toRealPath
|
public static EightyPath toRealPath( Path path ) {
if( !( path instanceof EightyPath ) ) {
throw new IllegalArgumentException( path + " should be EightyPath" );
}
EightyPath eightyPath = (EightyPath) path;
if ( eightyPath.knownReal() ) {
return eightyPath;
}
return new RealPath( eightyPath ).to();
}
|
java
|
public static EightyPath toRealPath( Path path ) {
if( !( path instanceof EightyPath ) ) {
throw new IllegalArgumentException( path + " should be EightyPath" );
}
EightyPath eightyPath = (EightyPath) path;
if ( eightyPath.knownReal() ) {
return eightyPath;
}
return new RealPath( eightyPath ).to();
}
|
[
"public",
"static",
"EightyPath",
"toRealPath",
"(",
"Path",
"path",
")",
"{",
"if",
"(",
"!",
"(",
"path",
"instanceof",
"EightyPath",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"path",
"+",
"\" should be EightyPath\"",
")",
";",
"}",
"EightyPath",
"eightyPath",
"=",
"(",
"EightyPath",
")",
"path",
";",
"if",
"(",
"eightyPath",
".",
"knownReal",
"(",
")",
")",
"{",
"return",
"eightyPath",
";",
"}",
"return",
"new",
"RealPath",
"(",
"eightyPath",
")",
".",
"to",
"(",
")",
";",
"}"
] |
toRealPath follow links
@param path
@return
|
[
"toRealPath",
"follow",
"links"
] |
708ec4d336ee5e3dbd4196099f64091eaf6b3387
|
https://github.com/openCage/eightyfs/blob/708ec4d336ee5e3dbd4196099f64091eaf6b3387/src/main/java/de/pfabulist/lindwurm/eighty/path/ProviderPath.java#L65-L77
|
152,864
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/ChangeFocusOnChangeHandler.java
|
ChangeFocusOnChangeHandler.init
|
public void init(BaseField field, ScreenComponent screenField, BaseField fldTarget)
{
super.init(field);
m_screenField = screenField;
m_fldTarget = fldTarget;
m_bScreenMove = true; // Only respond to user change
m_bInitMove = false;
m_bReadMove = false;
if (screenField == null)
this.lookupSField();
}
|
java
|
public void init(BaseField field, ScreenComponent screenField, BaseField fldTarget)
{
super.init(field);
m_screenField = screenField;
m_fldTarget = fldTarget;
m_bScreenMove = true; // Only respond to user change
m_bInitMove = false;
m_bReadMove = false;
if (screenField == null)
this.lookupSField();
}
|
[
"public",
"void",
"init",
"(",
"BaseField",
"field",
",",
"ScreenComponent",
"screenField",
",",
"BaseField",
"fldTarget",
")",
"{",
"super",
".",
"init",
"(",
"field",
")",
";",
"m_screenField",
"=",
"screenField",
";",
"m_fldTarget",
"=",
"fldTarget",
";",
"m_bScreenMove",
"=",
"true",
";",
"// Only respond to user change",
"m_bInitMove",
"=",
"false",
";",
"m_bReadMove",
"=",
"false",
";",
"if",
"(",
"screenField",
"==",
"null",
")",
"this",
".",
"lookupSField",
"(",
")",
";",
"}"
] |
Constructor.
This listener only responds to screen moves by default.
@param field The field to change the focus to on change to this field.
@param screenField The screen field to change the focus to on change to this field.
|
[
"Constructor",
".",
"This",
"listener",
"only",
"responds",
"to",
"screen",
"moves",
"by",
"default",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ChangeFocusOnChangeHandler.java#L68-L79
|
152,865
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/ChangeFocusOnChangeHandler.java
|
ChangeFocusOnChangeHandler.fieldChanged
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
if (m_screenField == null)
this.lookupSField();
if (m_bChangeIfNull != null)
{
if ((m_bChangeIfNull.booleanValue()) && (!this.getOwner().isNull()))
return DBConstants.NORMAL_RETURN;
if ((!m_bChangeIfNull.booleanValue()) && (this.getOwner().isNull()))
return DBConstants.NORMAL_RETURN;
}
if (m_screenField != null)
m_screenField.requestFocus();
return DBConstants.NORMAL_RETURN;
}
|
java
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
if (m_screenField == null)
this.lookupSField();
if (m_bChangeIfNull != null)
{
if ((m_bChangeIfNull.booleanValue()) && (!this.getOwner().isNull()))
return DBConstants.NORMAL_RETURN;
if ((!m_bChangeIfNull.booleanValue()) && (this.getOwner().isNull()))
return DBConstants.NORMAL_RETURN;
}
if (m_screenField != null)
m_screenField.requestFocus();
return DBConstants.NORMAL_RETURN;
}
|
[
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"m_screenField",
"==",
"null",
")",
"this",
".",
"lookupSField",
"(",
")",
";",
"if",
"(",
"m_bChangeIfNull",
"!=",
"null",
")",
"{",
"if",
"(",
"(",
"m_bChangeIfNull",
".",
"booleanValue",
"(",
")",
")",
"&&",
"(",
"!",
"this",
".",
"getOwner",
"(",
")",
".",
"isNull",
"(",
")",
")",
")",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"if",
"(",
"(",
"!",
"m_bChangeIfNull",
".",
"booleanValue",
"(",
")",
")",
"&&",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"isNull",
"(",
")",
")",
")",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"}",
"if",
"(",
"m_screenField",
"!=",
"null",
")",
"m_screenField",
".",
"requestFocus",
"(",
")",
";",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"}"
] |
The Field has Changed.
Change to focus to the target field.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
|
[
"The",
"Field",
"has",
"Changed",
".",
"Change",
"to",
"focus",
"to",
"the",
"target",
"field",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ChangeFocusOnChangeHandler.java#L102-L116
|
152,866
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/logging/ErrorLogger.java
|
ErrorLogger.getLogMessages
|
public Vector<LogMessage> getLogMessages() {
final Vector<LogMessage> output = new Vector<LogMessage>();
for (final LogMessage msg : messages) {
if (msg.getType() == LogMessage.Type.DEBUG) {
if (msg.getDebugLevel() <= debugLevel) {
output.add(msg);
}
} else {
output.add(msg);
}
}
return output;
}
|
java
|
public Vector<LogMessage> getLogMessages() {
final Vector<LogMessage> output = new Vector<LogMessage>();
for (final LogMessage msg : messages) {
if (msg.getType() == LogMessage.Type.DEBUG) {
if (msg.getDebugLevel() <= debugLevel) {
output.add(msg);
}
} else {
output.add(msg);
}
}
return output;
}
|
[
"public",
"Vector",
"<",
"LogMessage",
">",
"getLogMessages",
"(",
")",
"{",
"final",
"Vector",
"<",
"LogMessage",
">",
"output",
"=",
"new",
"Vector",
"<",
"LogMessage",
">",
"(",
")",
";",
"for",
"(",
"final",
"LogMessage",
"msg",
":",
"messages",
")",
"{",
"if",
"(",
"msg",
".",
"getType",
"(",
")",
"==",
"LogMessage",
".",
"Type",
".",
"DEBUG",
")",
"{",
"if",
"(",
"msg",
".",
"getDebugLevel",
"(",
")",
"<=",
"debugLevel",
")",
"{",
"output",
".",
"add",
"(",
"msg",
")",
";",
"}",
"}",
"else",
"{",
"output",
".",
"add",
"(",
"msg",
")",
";",
"}",
"}",
"return",
"output",
";",
"}"
] |
Gets the log messages and ignores message that are higher then the debug level
@return A vector based array containing the LogMessage's
|
[
"Gets",
"the",
"log",
"messages",
"and",
"ignores",
"message",
"that",
"are",
"higher",
"then",
"the",
"debug",
"level"
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/logging/ErrorLogger.java#L178-L190
|
152,867
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/net/NetFile.java
|
NetFile.refresh
|
public void refresh() throws IOException
{
if (Files.exists(file))
{
fine("%s exist", file);
writeLock.lock();
try
{
finer("start update(%s)", file);
update(file);
finer("end update(%s)", file);
}
finally
{
writeLock.unlock();
}
FileTime lmt = Files.getLastModifiedTime(file);
if (thread == null && lmt.toMillis()+expires < System.currentTimeMillis())
{
thread = new Thread(this, url.toString());
thread.setDaemon(true);
thread.start();
fine("started thread for %s", url);
}
}
else
{
fine("%s doesn't exist", file);
run();
}
}
|
java
|
public void refresh() throws IOException
{
if (Files.exists(file))
{
fine("%s exist", file);
writeLock.lock();
try
{
finer("start update(%s)", file);
update(file);
finer("end update(%s)", file);
}
finally
{
writeLock.unlock();
}
FileTime lmt = Files.getLastModifiedTime(file);
if (thread == null && lmt.toMillis()+expires < System.currentTimeMillis())
{
thread = new Thread(this, url.toString());
thread.setDaemon(true);
thread.start();
fine("started thread for %s", url);
}
}
else
{
fine("%s doesn't exist", file);
run();
}
}
|
[
"public",
"void",
"refresh",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Files",
".",
"exists",
"(",
"file",
")",
")",
"{",
"fine",
"(",
"\"%s exist\"",
",",
"file",
")",
";",
"writeLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"finer",
"(",
"\"start update(%s)\"",
",",
"file",
")",
";",
"update",
"(",
"file",
")",
";",
"finer",
"(",
"\"end update(%s)\"",
",",
"file",
")",
";",
"}",
"finally",
"{",
"writeLock",
".",
"unlock",
"(",
")",
";",
"}",
"FileTime",
"lmt",
"=",
"Files",
".",
"getLastModifiedTime",
"(",
"file",
")",
";",
"if",
"(",
"thread",
"==",
"null",
"&&",
"lmt",
".",
"toMillis",
"(",
")",
"+",
"expires",
"<",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
"{",
"thread",
"=",
"new",
"Thread",
"(",
"this",
",",
"url",
".",
"toString",
"(",
")",
")",
";",
"thread",
".",
"setDaemon",
"(",
"true",
")",
";",
"thread",
".",
"start",
"(",
")",
";",
"fine",
"(",
"\"started thread for %s\"",
",",
"url",
")",
";",
"}",
"}",
"else",
"{",
"fine",
"(",
"\"%s doesn't exist\"",
",",
"file",
")",
";",
"run",
"(",
")",
";",
"}",
"}"
] |
Call to refresh the file. During the call consumer is called at least once.
@throws IOException
|
[
"Call",
"to",
"refresh",
"the",
"file",
".",
"During",
"the",
"call",
"consumer",
"is",
"called",
"at",
"least",
"once",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/net/NetFile.java#L82-L112
|
152,868
|
tacitknowledge/discovery
|
src/main/java/com/tacitknowledge/util/discovery/ArchiveResourceListSource.java
|
ArchiveResourceListSource.getResources
|
private List getResources(ZipFile file, String root)
{
List resourceNames = new ArrayList();
Enumeration e = file.entries();
while (e.hasMoreElements())
{
ZipEntry entry = (ZipEntry) e.nextElement();
String name = entry.getName();
if (name.startsWith(root)
&& !(name.indexOf('/') > root.length())
&& !entry.isDirectory())
{
// Calling File.getPath() cleans up the path so that it's using
// the proper path separators for the host OS
name = new File(name).getPath();
resourceNames.add(name);
}
}
return resourceNames;
}
|
java
|
private List getResources(ZipFile file, String root)
{
List resourceNames = new ArrayList();
Enumeration e = file.entries();
while (e.hasMoreElements())
{
ZipEntry entry = (ZipEntry) e.nextElement();
String name = entry.getName();
if (name.startsWith(root)
&& !(name.indexOf('/') > root.length())
&& !entry.isDirectory())
{
// Calling File.getPath() cleans up the path so that it's using
// the proper path separators for the host OS
name = new File(name).getPath();
resourceNames.add(name);
}
}
return resourceNames;
}
|
[
"private",
"List",
"getResources",
"(",
"ZipFile",
"file",
",",
"String",
"root",
")",
"{",
"List",
"resourceNames",
"=",
"new",
"ArrayList",
"(",
")",
";",
"Enumeration",
"e",
"=",
"file",
".",
"entries",
"(",
")",
";",
"while",
"(",
"e",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"ZipEntry",
"entry",
"=",
"(",
"ZipEntry",
")",
"e",
".",
"nextElement",
"(",
")",
";",
"String",
"name",
"=",
"entry",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
".",
"startsWith",
"(",
"root",
")",
"&&",
"!",
"(",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"root",
".",
"length",
"(",
")",
")",
"&&",
"!",
"entry",
".",
"isDirectory",
"(",
")",
")",
"{",
"// Calling File.getPath() cleans up the path so that it's using",
"// the proper path separators for the host OS",
"name",
"=",
"new",
"File",
"(",
"name",
")",
".",
"getPath",
"(",
")",
";",
"resourceNames",
".",
"add",
"(",
"name",
")",
";",
"}",
"}",
"return",
"resourceNames",
";",
"}"
] |
Returns a list of file resources contained in the specified directory
within a given Zip'd archive file.
@param file the zip file containing the resources to return
@param root the directory within the zip file containing the resources
@return a list of file resources contained in the specified directory
within a given Zip'd archive file
|
[
"Returns",
"a",
"list",
"of",
"file",
"resources",
"contained",
"in",
"the",
"specified",
"directory",
"within",
"a",
"given",
"Zip",
"d",
"archive",
"file",
"."
] |
700f5492c9cb5c0146d684acb38b71fd4ef4e97a
|
https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ArchiveResourceListSource.java#L95-L114
|
152,869
|
jbundle/jbundle
|
model/base/src/main/java/org/jbundle/model/DBException.java
|
DBException.getMessage
|
public String getMessage() {
String message = super.getMessage();
if (m_iErrorCode != -1)
message = message + " Error code: " + m_iErrorCode;
return message;
}
|
java
|
public String getMessage() {
String message = super.getMessage();
if (m_iErrorCode != -1)
message = message + " Error code: " + m_iErrorCode;
return message;
}
|
[
"public",
"String",
"getMessage",
"(",
")",
"{",
"String",
"message",
"=",
"super",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"m_iErrorCode",
"!=",
"-",
"1",
")",
"message",
"=",
"message",
"+",
"\" Error code: \"",
"+",
"m_iErrorCode",
";",
"return",
"message",
";",
"}"
] |
Returns the detail message string of this throwable.
@return the detail message string of this <tt>Throwable</tt> instance
(which may be <tt>null</tt>).
|
[
"Returns",
"the",
"detail",
"message",
"string",
"of",
"this",
"throwable",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/DBException.java#L72-L77
|
152,870
|
jinahya/hex-codec
|
src/main/java/com/github/jinahya/codec/HexEncoder.java
|
HexEncoder.encodeSingle
|
public static void encodeSingle(final int input, final byte[] output,
final int outoff) {
if (output == null) {
throw new NullPointerException("output");
}
if (outoff < 0) {
throw new IllegalArgumentException("outoff(" + outoff + ") < 0");
}
if (outoff >= output.length - 1) {
throw new IllegalArgumentException(
"outoff(" + outoff + ") >= output.length(" + output.length
+ ") - 1");
}
output[outoff] = (byte) encodeHalf((input >> 4) & 0x0F);
output[outoff + 1] = (byte) encodeHalf(input & 0x0F);
}
|
java
|
public static void encodeSingle(final int input, final byte[] output,
final int outoff) {
if (output == null) {
throw new NullPointerException("output");
}
if (outoff < 0) {
throw new IllegalArgumentException("outoff(" + outoff + ") < 0");
}
if (outoff >= output.length - 1) {
throw new IllegalArgumentException(
"outoff(" + outoff + ") >= output.length(" + output.length
+ ") - 1");
}
output[outoff] = (byte) encodeHalf((input >> 4) & 0x0F);
output[outoff + 1] = (byte) encodeHalf(input & 0x0F);
}
|
[
"public",
"static",
"void",
"encodeSingle",
"(",
"final",
"int",
"input",
",",
"final",
"byte",
"[",
"]",
"output",
",",
"final",
"int",
"outoff",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"output\"",
")",
";",
"}",
"if",
"(",
"outoff",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"outoff(\"",
"+",
"outoff",
"+",
"\") < 0\"",
")",
";",
"}",
"if",
"(",
"outoff",
">=",
"output",
".",
"length",
"-",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"outoff(\"",
"+",
"outoff",
"+",
"\") >= output.length(\"",
"+",
"output",
".",
"length",
"+",
"\") - 1\"",
")",
";",
"}",
"output",
"[",
"outoff",
"]",
"=",
"(",
"byte",
")",
"encodeHalf",
"(",
"(",
"input",
">>",
"4",
")",
"&",
"0x0F",
")",
";",
"output",
"[",
"outoff",
"+",
"1",
"]",
"=",
"(",
"byte",
")",
"encodeHalf",
"(",
"input",
"&",
"0x0F",
")",
";",
"}"
] |
Encodes a single octet into two hex chars.
@param input the octet to encode.
@param output the array to which each encoded hex chars are written.
@param outoff the offset in the output array.
|
[
"Encodes",
"a",
"single",
"octet",
"into",
"two",
"hex",
"chars",
"."
] |
159aa54010821655496177e76a3ef35a49fbd433
|
https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexEncoder.java#L73-L92
|
152,871
|
jinahya/hex-codec
|
src/main/java/com/github/jinahya/codec/HexEncoder.java
|
HexEncoder.encodeSingle
|
public static void encodeSingle(final byte[] input, final int inoff,
final byte[] output, final int outoff) {
if (input == null) {
throw new NullPointerException("input");
}
if (inoff < 0) {
throw new IllegalArgumentException("inoff(" + inoff + ") < 0");
}
if (inoff >= input.length) {
throw new IllegalArgumentException(
"inoff(" + inoff + ") >= input.length(" + input.length + ")");
}
encodeSingle(input[inoff], output, outoff);
}
|
java
|
public static void encodeSingle(final byte[] input, final int inoff,
final byte[] output, final int outoff) {
if (input == null) {
throw new NullPointerException("input");
}
if (inoff < 0) {
throw new IllegalArgumentException("inoff(" + inoff + ") < 0");
}
if (inoff >= input.length) {
throw new IllegalArgumentException(
"inoff(" + inoff + ") >= input.length(" + input.length + ")");
}
encodeSingle(input[inoff], output, outoff);
}
|
[
"public",
"static",
"void",
"encodeSingle",
"(",
"final",
"byte",
"[",
"]",
"input",
",",
"final",
"int",
"inoff",
",",
"final",
"byte",
"[",
"]",
"output",
",",
"final",
"int",
"outoff",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"input\"",
")",
";",
"}",
"if",
"(",
"inoff",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"inoff(\"",
"+",
"inoff",
"+",
"\") < 0\"",
")",
";",
"}",
"if",
"(",
"inoff",
">=",
"input",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"inoff(\"",
"+",
"inoff",
"+",
"\") >= input.length(\"",
"+",
"input",
".",
"length",
"+",
"\")\"",
")",
";",
"}",
"encodeSingle",
"(",
"input",
"[",
"inoff",
"]",
",",
"output",
",",
"outoff",
")",
";",
"}"
] |
Encodes a single octet into two nibbles.
@param input the input byte array
@param inoff the offset in the input array
@param output the array to which each encoded nibbles are written.
@param outoff the offset in the output array.
|
[
"Encodes",
"a",
"single",
"octet",
"into",
"two",
"nibbles",
"."
] |
159aa54010821655496177e76a3ef35a49fbd433
|
https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexEncoder.java#L103-L120
|
152,872
|
jinahya/hex-codec
|
src/main/java/com/github/jinahya/codec/HexEncoder.java
|
HexEncoder.encodeMultiple
|
public static byte[] encodeMultiple(final byte[] input) {
if (input == null) {
throw new NullPointerException("input");
}
final byte[] output = new byte[input.length << 1]; // * 2
encodeMultiple(input, 0, output, 0, input.length);
return output;
}
|
java
|
public static byte[] encodeMultiple(final byte[] input) {
if (input == null) {
throw new NullPointerException("input");
}
final byte[] output = new byte[input.length << 1]; // * 2
encodeMultiple(input, 0, output, 0, input.length);
return output;
}
|
[
"public",
"static",
"byte",
"[",
"]",
"encodeMultiple",
"(",
"final",
"byte",
"[",
"]",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"input\"",
")",
";",
"}",
"final",
"byte",
"[",
"]",
"output",
"=",
"new",
"byte",
"[",
"input",
".",
"length",
"<<",
"1",
"]",
";",
"// * 2",
"encodeMultiple",
"(",
"input",
",",
"0",
",",
"output",
",",
"0",
",",
"input",
".",
"length",
")",
";",
"return",
"output",
";",
"}"
] |
Encodes given sequence of octets into a sequence of nibbles.
@param input the octets to encode
@return the encoded nibbles.
|
[
"Encodes",
"given",
"sequence",
"of",
"octets",
"into",
"a",
"sequence",
"of",
"nibbles",
"."
] |
159aa54010821655496177e76a3ef35a49fbd433
|
https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexEncoder.java#L146-L157
|
152,873
|
jbundle/jbundle
|
base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java
|
TrxMessageHeader.addTaskProperties
|
public void addTaskProperties(Task task)
{
if (task == null)
return;
this.put(TrxMessageHeader.USER_ID, task.getProperty(DBParams.USER_ID));
//? BaseDatabase.addDBProperties(m_mapMessageHeader, task, null); // Note: m_mapMessageHeader is guaranteed not null by previous call.
}
|
java
|
public void addTaskProperties(Task task)
{
if (task == null)
return;
this.put(TrxMessageHeader.USER_ID, task.getProperty(DBParams.USER_ID));
//? BaseDatabase.addDBProperties(m_mapMessageHeader, task, null); // Note: m_mapMessageHeader is guaranteed not null by previous call.
}
|
[
"public",
"void",
"addTaskProperties",
"(",
"Task",
"task",
")",
"{",
"if",
"(",
"task",
"==",
"null",
")",
"return",
";",
"this",
".",
"put",
"(",
"TrxMessageHeader",
".",
"USER_ID",
",",
"task",
".",
"getProperty",
"(",
"DBParams",
".",
"USER_ID",
")",
")",
";",
"//? BaseDatabase.addDBProperties(m_mapMessageHeader, task, null);\t// Note: m_mapMessageHeader is guaranteed not null by previous call.",
"}"
] |
Add the task properties that I will need to start up a process somewhere else with this same environment.
@param task
|
[
"Add",
"the",
"task",
"properties",
"that",
"I",
"will",
"need",
"to",
"start",
"up",
"a",
"process",
"somewhere",
"else",
"with",
"this",
"same",
"environment",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java#L435-L441
|
152,874
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java
|
JDescTextField.getText
|
public String getText()
{
String strText = super.getText();
if (strText != null)
if (strText.equals(m_strDescription))
strText = Constants.BLANK;
return strText;
}
|
java
|
public String getText()
{
String strText = super.getText();
if (strText != null)
if (strText.equals(m_strDescription))
strText = Constants.BLANK;
return strText;
}
|
[
"public",
"String",
"getText",
"(",
")",
"{",
"String",
"strText",
"=",
"super",
".",
"getText",
"(",
")",
";",
"if",
"(",
"strText",
"!=",
"null",
")",
"if",
"(",
"strText",
".",
"equals",
"(",
"m_strDescription",
")",
")",
"strText",
"=",
"Constants",
".",
"BLANK",
";",
"return",
"strText",
";",
"}"
] |
Get text from JTextField.
This method factors out the description.
@return The text for this component.
|
[
"Get",
"text",
"from",
"JTextField",
".",
"This",
"method",
"factors",
"out",
"the",
"description",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java#L112-L119
|
152,875
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java
|
JDescTextField.setText
|
public void setText(String strText)
{
if ((strText == null) || (strText.length() == 0))
{
if (!m_bInFocus)
{
strText = m_strDescription;
this.changeFont(true);
}
}
else
this.changeFont(false);
super.setText(strText);
}
|
java
|
public void setText(String strText)
{
if ((strText == null) || (strText.length() == 0))
{
if (!m_bInFocus)
{
strText = m_strDescription;
this.changeFont(true);
}
}
else
this.changeFont(false);
super.setText(strText);
}
|
[
"public",
"void",
"setText",
"(",
"String",
"strText",
")",
"{",
"if",
"(",
"(",
"strText",
"==",
"null",
")",
"||",
"(",
"strText",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"if",
"(",
"!",
"m_bInFocus",
")",
"{",
"strText",
"=",
"m_strDescription",
";",
"this",
".",
"changeFont",
"(",
"true",
")",
";",
"}",
"}",
"else",
"this",
".",
"changeFont",
"(",
"false",
")",
";",
"super",
".",
"setText",
"(",
"strText",
")",
";",
"}"
] |
Set this text component to this text string.
This method factors out the description.
@param text The text for this component.
|
[
"Set",
"this",
"text",
"component",
"to",
"this",
"text",
"string",
".",
"This",
"method",
"factors",
"out",
"the",
"description",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java#L125-L138
|
152,876
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java
|
JDescTextField.myFocusLost
|
public void myFocusLost()
{
m_bInFocus = false;
String strText = super.getText();
if ((strText == null) || (strText.length() == 0))
{ // Don't notify of change
if (m_actionListener != null)
this.removeActionListener(m_actionListener);
this.changeFont(true);
super.setText(m_strDescription);
if (m_actionListener != null)
this.addActionListener(m_actionListener);
}
}
|
java
|
public void myFocusLost()
{
m_bInFocus = false;
String strText = super.getText();
if ((strText == null) || (strText.length() == 0))
{ // Don't notify of change
if (m_actionListener != null)
this.removeActionListener(m_actionListener);
this.changeFont(true);
super.setText(m_strDescription);
if (m_actionListener != null)
this.addActionListener(m_actionListener);
}
}
|
[
"public",
"void",
"myFocusLost",
"(",
")",
"{",
"m_bInFocus",
"=",
"false",
";",
"String",
"strText",
"=",
"super",
".",
"getText",
"(",
")",
";",
"if",
"(",
"(",
"strText",
"==",
"null",
")",
"||",
"(",
"strText",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"// Don't notify of change",
"if",
"(",
"m_actionListener",
"!=",
"null",
")",
"this",
".",
"removeActionListener",
"(",
"m_actionListener",
")",
";",
"this",
".",
"changeFont",
"(",
"true",
")",
";",
"super",
".",
"setText",
"(",
"m_strDescription",
")",
";",
"if",
"(",
"m_actionListener",
"!=",
"null",
")",
"this",
".",
"addActionListener",
"(",
"m_actionListener",
")",
";",
"}",
"}"
] |
Gained the focus.
Need to set the description back if this component is empty.
|
[
"Gained",
"the",
"focus",
".",
"Need",
"to",
"set",
"the",
"description",
"back",
"if",
"this",
"component",
"is",
"empty",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java#L161-L174
|
152,877
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java
|
JDescTextField.changeFont
|
public void changeFont(boolean bDescription)
{
if (m_fontNormal == null)
{
m_fontNormal = this.getFont();
m_fontDesc = m_fontNormal.deriveFont(Font.ITALIC);
m_colorNormal = this.getForeground();
m_colorDesc = Color.gray;
}
if (bDescription)
{
this.setFont(m_fontDesc);
this.setForeground(m_colorDesc);
}
else
{
this.setFont(m_fontNormal);
this.setForeground(m_colorNormal);
}
}
|
java
|
public void changeFont(boolean bDescription)
{
if (m_fontNormal == null)
{
m_fontNormal = this.getFont();
m_fontDesc = m_fontNormal.deriveFont(Font.ITALIC);
m_colorNormal = this.getForeground();
m_colorDesc = Color.gray;
}
if (bDescription)
{
this.setFont(m_fontDesc);
this.setForeground(m_colorDesc);
}
else
{
this.setFont(m_fontNormal);
this.setForeground(m_colorNormal);
}
}
|
[
"public",
"void",
"changeFont",
"(",
"boolean",
"bDescription",
")",
"{",
"if",
"(",
"m_fontNormal",
"==",
"null",
")",
"{",
"m_fontNormal",
"=",
"this",
".",
"getFont",
"(",
")",
";",
"m_fontDesc",
"=",
"m_fontNormal",
".",
"deriveFont",
"(",
"Font",
".",
"ITALIC",
")",
";",
"m_colorNormal",
"=",
"this",
".",
"getForeground",
"(",
")",
";",
"m_colorDesc",
"=",
"Color",
".",
"gray",
";",
"}",
"if",
"(",
"bDescription",
")",
"{",
"this",
".",
"setFont",
"(",
"m_fontDesc",
")",
";",
"this",
".",
"setForeground",
"(",
"m_colorDesc",
")",
";",
"}",
"else",
"{",
"this",
".",
"setFont",
"(",
"m_fontNormal",
")",
";",
"this",
".",
"setForeground",
"(",
"m_colorNormal",
")",
";",
"}",
"}"
] |
Change the font depending of whether you are displaying the description or text.
@param bDescription If true, set the description text.
|
[
"Change",
"the",
"font",
"depending",
"of",
"whether",
"you",
"are",
"displaying",
"the",
"description",
"or",
"text",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java#L179-L198
|
152,878
|
entrusc/xdata
|
src/main/java/com/moebiusgames/xdata/XData.java
|
XData.validate
|
public static boolean validate(InputStream in) throws IOException {
final Map<String, AbstractDataMarshaller<?>> marshallerMap = generateMarshallerMap(false, Collections.EMPTY_LIST);
marshallerMap.putAll(generateMarshallerMap(false, DEFAULT_MARSHALLERS));
final GZIPInputStream gzipInputStream = new GZIPInputStream(in);
try {
MessageDigestInputStream messageDigestInputStream = new MessageDigestInputStream(gzipInputStream, CHECKSUM_ALGORITHM);
CountingDataInputStream dIn = new CountingDataInputStream(messageDigestInputStream);
checkHeader(dIn);
deSerialize(dIn, marshallerMap, true, DUMMY_PROGRESS_LISTENER);
byte[] checksumCalcualted = messageDigestInputStream.getDigest();
final int checksumAvailable = dIn.read();
byte[] checksumValue = new byte[CHECKSUM_ALGORITHM_LENGTH];
if (checksumAvailable == -1) {
return false; //no stored checksum
}
int readBytes = dIn.read(checksumValue);
if (readBytes == CHECKSUM_ALGORITHM_LENGTH) {
return Arrays.equals(checksumValue, checksumCalcualted);
} else {
return false; //checksum length too short or too long
}
} catch (NoSuchAlgorithmException ex) {
throw new IOException("Checksum algorithm not available", ex);
} finally {
gzipInputStream.close();
}
}
|
java
|
public static boolean validate(InputStream in) throws IOException {
final Map<String, AbstractDataMarshaller<?>> marshallerMap = generateMarshallerMap(false, Collections.EMPTY_LIST);
marshallerMap.putAll(generateMarshallerMap(false, DEFAULT_MARSHALLERS));
final GZIPInputStream gzipInputStream = new GZIPInputStream(in);
try {
MessageDigestInputStream messageDigestInputStream = new MessageDigestInputStream(gzipInputStream, CHECKSUM_ALGORITHM);
CountingDataInputStream dIn = new CountingDataInputStream(messageDigestInputStream);
checkHeader(dIn);
deSerialize(dIn, marshallerMap, true, DUMMY_PROGRESS_LISTENER);
byte[] checksumCalcualted = messageDigestInputStream.getDigest();
final int checksumAvailable = dIn.read();
byte[] checksumValue = new byte[CHECKSUM_ALGORITHM_LENGTH];
if (checksumAvailable == -1) {
return false; //no stored checksum
}
int readBytes = dIn.read(checksumValue);
if (readBytes == CHECKSUM_ALGORITHM_LENGTH) {
return Arrays.equals(checksumValue, checksumCalcualted);
} else {
return false; //checksum length too short or too long
}
} catch (NoSuchAlgorithmException ex) {
throw new IOException("Checksum algorithm not available", ex);
} finally {
gzipInputStream.close();
}
}
|
[
"public",
"static",
"boolean",
"validate",
"(",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"final",
"Map",
"<",
"String",
",",
"AbstractDataMarshaller",
"<",
"?",
">",
">",
"marshallerMap",
"=",
"generateMarshallerMap",
"(",
"false",
",",
"Collections",
".",
"EMPTY_LIST",
")",
";",
"marshallerMap",
".",
"putAll",
"(",
"generateMarshallerMap",
"(",
"false",
",",
"DEFAULT_MARSHALLERS",
")",
")",
";",
"final",
"GZIPInputStream",
"gzipInputStream",
"=",
"new",
"GZIPInputStream",
"(",
"in",
")",
";",
"try",
"{",
"MessageDigestInputStream",
"messageDigestInputStream",
"=",
"new",
"MessageDigestInputStream",
"(",
"gzipInputStream",
",",
"CHECKSUM_ALGORITHM",
")",
";",
"CountingDataInputStream",
"dIn",
"=",
"new",
"CountingDataInputStream",
"(",
"messageDigestInputStream",
")",
";",
"checkHeader",
"(",
"dIn",
")",
";",
"deSerialize",
"(",
"dIn",
",",
"marshallerMap",
",",
"true",
",",
"DUMMY_PROGRESS_LISTENER",
")",
";",
"byte",
"[",
"]",
"checksumCalcualted",
"=",
"messageDigestInputStream",
".",
"getDigest",
"(",
")",
";",
"final",
"int",
"checksumAvailable",
"=",
"dIn",
".",
"read",
"(",
")",
";",
"byte",
"[",
"]",
"checksumValue",
"=",
"new",
"byte",
"[",
"CHECKSUM_ALGORITHM_LENGTH",
"]",
";",
"if",
"(",
"checksumAvailable",
"==",
"-",
"1",
")",
"{",
"return",
"false",
";",
"//no stored checksum",
"}",
"int",
"readBytes",
"=",
"dIn",
".",
"read",
"(",
"checksumValue",
")",
";",
"if",
"(",
"readBytes",
"==",
"CHECKSUM_ALGORITHM_LENGTH",
")",
"{",
"return",
"Arrays",
".",
"equals",
"(",
"checksumValue",
",",
"checksumCalcualted",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"//checksum length too short or too long",
"}",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"ex",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Checksum algorithm not available\"",
",",
"ex",
")",
";",
"}",
"finally",
"{",
"gzipInputStream",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
explicitly validates the given xdata stream against the embedded checksum,
if there is no checksum or the checksum does not correspond to the data,
then false is returned. Otherwise true is returned.
@param in
@return
|
[
"explicitly",
"validates",
"the",
"given",
"xdata",
"stream",
"against",
"the",
"embedded",
"checksum",
"if",
"there",
"is",
"no",
"checksum",
"or",
"the",
"checksum",
"does",
"not",
"correspond",
"to",
"the",
"data",
"then",
"false",
"is",
"returned",
".",
"Otherwise",
"true",
"is",
"returned",
"."
] |
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
|
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/XData.java#L647-L678
|
152,879
|
entrusc/xdata
|
src/main/java/com/moebiusgames/xdata/XData.java
|
XData.marshalObject
|
private static DataNode marshalObject(Map<String, AbstractDataMarshaller<?>> marshallerMap, Object object) {
//can't be null here because it is not resolved: meaning, it is an instance of an unknown class
final Class<?> clazz = object.getClass();
final AbstractDataMarshaller<Object> serializer = (AbstractDataMarshaller<Object>) marshallerMap.get(clazz.getCanonicalName());
if (serializer != null) {
final DataNode node = serializer.marshal(object);
node.setObject(META_CLASS_NAME, serializer.getDataClassName());
return node;
}
return null; //no marshaller - let others decide what to do with that info
}
|
java
|
private static DataNode marshalObject(Map<String, AbstractDataMarshaller<?>> marshallerMap, Object object) {
//can't be null here because it is not resolved: meaning, it is an instance of an unknown class
final Class<?> clazz = object.getClass();
final AbstractDataMarshaller<Object> serializer = (AbstractDataMarshaller<Object>) marshallerMap.get(clazz.getCanonicalName());
if (serializer != null) {
final DataNode node = serializer.marshal(object);
node.setObject(META_CLASS_NAME, serializer.getDataClassName());
return node;
}
return null; //no marshaller - let others decide what to do with that info
}
|
[
"private",
"static",
"DataNode",
"marshalObject",
"(",
"Map",
"<",
"String",
",",
"AbstractDataMarshaller",
"<",
"?",
">",
">",
"marshallerMap",
",",
"Object",
"object",
")",
"{",
"//can't be null here because it is not resolved: meaning, it is an instance of an unknown class",
"final",
"Class",
"<",
"?",
">",
"clazz",
"=",
"object",
".",
"getClass",
"(",
")",
";",
"final",
"AbstractDataMarshaller",
"<",
"Object",
">",
"serializer",
"=",
"(",
"AbstractDataMarshaller",
"<",
"Object",
">",
")",
"marshallerMap",
".",
"get",
"(",
"clazz",
".",
"getCanonicalName",
"(",
")",
")",
";",
"if",
"(",
"serializer",
"!=",
"null",
")",
"{",
"final",
"DataNode",
"node",
"=",
"serializer",
".",
"marshal",
"(",
"object",
")",
";",
"node",
".",
"setObject",
"(",
"META_CLASS_NAME",
",",
"serializer",
".",
"getDataClassName",
"(",
")",
")",
";",
"return",
"node",
";",
"}",
"return",
"null",
";",
"//no marshaller - let others decide what to do with that info",
"}"
] |
wraps an deSerializedObject using the data marshaller for that given deSerializedObject
@param marshallerMap
@param object
@return
|
[
"wraps",
"an",
"deSerializedObject",
"using",
"the",
"data",
"marshaller",
"for",
"that",
"given",
"deSerializedObject"
] |
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
|
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/XData.java#L1192-L1203
|
152,880
|
entrusc/xdata
|
src/main/java/com/moebiusgames/xdata/XData.java
|
XData.serializeElement
|
private static boolean serializeElement(Object element, Deque<SerializationFrame> stack, DataOutputStream dOut,
Map<String, AbstractDataMarshaller<?>> marshallerMap,
Map<SerializedObject, SerializedObject> serializedObjects,
SerializedObject testSerializedObject,
boolean ignoreMissingMarshallers) throws IOException {
if (element instanceof List) {
stack.push(new ListSerializationFrame(element, (List<?>) element));
return true;
} else
if (element == null || isPrimitiveOrString(element)) {
serializePrimitive(dOut, element);
} else {
//unmarshalled deSerializedObject or data node
testSerializedObject.object = element;
if (serializedObjects.containsKey(testSerializedObject)) {
final SerializedObject serializedObject = serializedObjects.get(testSerializedObject);
serializeReference(serializedObject, dOut);
} else {
DataNodeSerializationFrame dataNodeFrame;
if (element instanceof DataNode) {
dataNodeFrame = new DataNodeSerializationFrame(element, (DataNode) element);
} else {
final DataNode marshalledObject = marshalObject(marshallerMap, element);
if (marshalledObject != null) {
dataNodeFrame = new DataNodeSerializationFrame(element, marshalledObject);
} else {
//we have no marshaller for the given object - now either raise an exception
//or set the value to null ...
if (!ignoreMissingMarshallers) {
throw new IllegalStateException("No serializer defined for class " + element.getClass().getCanonicalName());
} else {
//ignore and just store null value
serializePrimitive(dOut, null);
return false;
}
}
}
stack.push(dataNodeFrame);
return true;
}
}
return false;
}
|
java
|
private static boolean serializeElement(Object element, Deque<SerializationFrame> stack, DataOutputStream dOut,
Map<String, AbstractDataMarshaller<?>> marshallerMap,
Map<SerializedObject, SerializedObject> serializedObjects,
SerializedObject testSerializedObject,
boolean ignoreMissingMarshallers) throws IOException {
if (element instanceof List) {
stack.push(new ListSerializationFrame(element, (List<?>) element));
return true;
} else
if (element == null || isPrimitiveOrString(element)) {
serializePrimitive(dOut, element);
} else {
//unmarshalled deSerializedObject or data node
testSerializedObject.object = element;
if (serializedObjects.containsKey(testSerializedObject)) {
final SerializedObject serializedObject = serializedObjects.get(testSerializedObject);
serializeReference(serializedObject, dOut);
} else {
DataNodeSerializationFrame dataNodeFrame;
if (element instanceof DataNode) {
dataNodeFrame = new DataNodeSerializationFrame(element, (DataNode) element);
} else {
final DataNode marshalledObject = marshalObject(marshallerMap, element);
if (marshalledObject != null) {
dataNodeFrame = new DataNodeSerializationFrame(element, marshalledObject);
} else {
//we have no marshaller for the given object - now either raise an exception
//or set the value to null ...
if (!ignoreMissingMarshallers) {
throw new IllegalStateException("No serializer defined for class " + element.getClass().getCanonicalName());
} else {
//ignore and just store null value
serializePrimitive(dOut, null);
return false;
}
}
}
stack.push(dataNodeFrame);
return true;
}
}
return false;
}
|
[
"private",
"static",
"boolean",
"serializeElement",
"(",
"Object",
"element",
",",
"Deque",
"<",
"SerializationFrame",
">",
"stack",
",",
"DataOutputStream",
"dOut",
",",
"Map",
"<",
"String",
",",
"AbstractDataMarshaller",
"<",
"?",
">",
">",
"marshallerMap",
",",
"Map",
"<",
"SerializedObject",
",",
"SerializedObject",
">",
"serializedObjects",
",",
"SerializedObject",
"testSerializedObject",
",",
"boolean",
"ignoreMissingMarshallers",
")",
"throws",
"IOException",
"{",
"if",
"(",
"element",
"instanceof",
"List",
")",
"{",
"stack",
".",
"push",
"(",
"new",
"ListSerializationFrame",
"(",
"element",
",",
"(",
"List",
"<",
"?",
">",
")",
"element",
")",
")",
";",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"element",
"==",
"null",
"||",
"isPrimitiveOrString",
"(",
"element",
")",
")",
"{",
"serializePrimitive",
"(",
"dOut",
",",
"element",
")",
";",
"}",
"else",
"{",
"//unmarshalled deSerializedObject or data node",
"testSerializedObject",
".",
"object",
"=",
"element",
";",
"if",
"(",
"serializedObjects",
".",
"containsKey",
"(",
"testSerializedObject",
")",
")",
"{",
"final",
"SerializedObject",
"serializedObject",
"=",
"serializedObjects",
".",
"get",
"(",
"testSerializedObject",
")",
";",
"serializeReference",
"(",
"serializedObject",
",",
"dOut",
")",
";",
"}",
"else",
"{",
"DataNodeSerializationFrame",
"dataNodeFrame",
";",
"if",
"(",
"element",
"instanceof",
"DataNode",
")",
"{",
"dataNodeFrame",
"=",
"new",
"DataNodeSerializationFrame",
"(",
"element",
",",
"(",
"DataNode",
")",
"element",
")",
";",
"}",
"else",
"{",
"final",
"DataNode",
"marshalledObject",
"=",
"marshalObject",
"(",
"marshallerMap",
",",
"element",
")",
";",
"if",
"(",
"marshalledObject",
"!=",
"null",
")",
"{",
"dataNodeFrame",
"=",
"new",
"DataNodeSerializationFrame",
"(",
"element",
",",
"marshalledObject",
")",
";",
"}",
"else",
"{",
"//we have no marshaller for the given object - now either raise an exception",
"//or set the value to null ...",
"if",
"(",
"!",
"ignoreMissingMarshallers",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No serializer defined for class \"",
"+",
"element",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
")",
";",
"}",
"else",
"{",
"//ignore and just store null value",
"serializePrimitive",
"(",
"dOut",
",",
"null",
")",
";",
"return",
"false",
";",
"}",
"}",
"}",
"stack",
".",
"push",
"(",
"dataNodeFrame",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
processes one element and either serializes it directly to the stream, or pushes
a corresponding frame to the stack.
@param element
@param stack
@param dOut
@param marshallerMap
@param serializedObjects
@param testSerializedObject
@return true if a new element has been pushed to the stack, false otherwise
@throws IOException
|
[
"processes",
"one",
"element",
"and",
"either",
"serializes",
"it",
"directly",
"to",
"the",
"stream",
"or",
"pushes",
"a",
"corresponding",
"frame",
"to",
"the",
"stack",
"."
] |
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
|
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/XData.java#L1218-L1260
|
152,881
|
entrusc/xdata
|
src/main/java/com/moebiusgames/xdata/XData.java
|
XData.serialize
|
private static void serialize(Map<String, AbstractDataMarshaller<?>> marshallerMap,
DataOutputStream dOut, DataNode primaryNode, boolean ignoreMissingMarshallers,
ProgressListener progressListener) throws IOException {
//a map containing all serialized objects. This is used
//to make sure that we store each deSerializedObject only once.
final Map<SerializedObject, SerializedObject> serializedObjects = new HashMap<>();
final Deque<SerializationFrame> stack = new LinkedList<>();
final DataNodeSerializationFrame primaryDataNodeFrame = new DataNodeSerializationFrame(null, primaryNode);
progressListener.onTotalSteps(primaryDataNodeFrame.entries.size());
stack.add(primaryDataNodeFrame);
final SerializedObject testSerializedObject = new SerializedObject();
while (!stack.isEmpty()) {
final SerializationFrame frame = stack.peek();
//writes the header for that frame (if needed)
frame.writeHeader(dOut);
if (frame.hasNext()) {
while (frame.hasNext()) {
if (frame.next(stack, dOut, marshallerMap,
serializedObjects, testSerializedObject,
ignoreMissingMarshallers)) {
if (frame == primaryDataNodeFrame) {
progressListener.onStep();
}
break;
}
if (frame == primaryDataNodeFrame) {
progressListener.onStep();
}
}
} else {
stack.pop();
//remember serialized deSerializedObject's addresses
if (frame instanceof DataNodeSerializationFrame) {
DataNodeSerializationFrame dataNodeFrame = (DataNodeSerializationFrame) frame;
SerializedObject newSerializedObject = new SerializedObject();
newSerializedObject.object = frame.object;
newSerializedObject.positionInStream = dataNodeFrame.positionInStream;
serializedObjects.put(newSerializedObject, newSerializedObject);
}
}
}
}
|
java
|
private static void serialize(Map<String, AbstractDataMarshaller<?>> marshallerMap,
DataOutputStream dOut, DataNode primaryNode, boolean ignoreMissingMarshallers,
ProgressListener progressListener) throws IOException {
//a map containing all serialized objects. This is used
//to make sure that we store each deSerializedObject only once.
final Map<SerializedObject, SerializedObject> serializedObjects = new HashMap<>();
final Deque<SerializationFrame> stack = new LinkedList<>();
final DataNodeSerializationFrame primaryDataNodeFrame = new DataNodeSerializationFrame(null, primaryNode);
progressListener.onTotalSteps(primaryDataNodeFrame.entries.size());
stack.add(primaryDataNodeFrame);
final SerializedObject testSerializedObject = new SerializedObject();
while (!stack.isEmpty()) {
final SerializationFrame frame = stack.peek();
//writes the header for that frame (if needed)
frame.writeHeader(dOut);
if (frame.hasNext()) {
while (frame.hasNext()) {
if (frame.next(stack, dOut, marshallerMap,
serializedObjects, testSerializedObject,
ignoreMissingMarshallers)) {
if (frame == primaryDataNodeFrame) {
progressListener.onStep();
}
break;
}
if (frame == primaryDataNodeFrame) {
progressListener.onStep();
}
}
} else {
stack.pop();
//remember serialized deSerializedObject's addresses
if (frame instanceof DataNodeSerializationFrame) {
DataNodeSerializationFrame dataNodeFrame = (DataNodeSerializationFrame) frame;
SerializedObject newSerializedObject = new SerializedObject();
newSerializedObject.object = frame.object;
newSerializedObject.positionInStream = dataNodeFrame.positionInStream;
serializedObjects.put(newSerializedObject, newSerializedObject);
}
}
}
}
|
[
"private",
"static",
"void",
"serialize",
"(",
"Map",
"<",
"String",
",",
"AbstractDataMarshaller",
"<",
"?",
">",
">",
"marshallerMap",
",",
"DataOutputStream",
"dOut",
",",
"DataNode",
"primaryNode",
",",
"boolean",
"ignoreMissingMarshallers",
",",
"ProgressListener",
"progressListener",
")",
"throws",
"IOException",
"{",
"//a map containing all serialized objects. This is used",
"//to make sure that we store each deSerializedObject only once.",
"final",
"Map",
"<",
"SerializedObject",
",",
"SerializedObject",
">",
"serializedObjects",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"final",
"Deque",
"<",
"SerializationFrame",
">",
"stack",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"final",
"DataNodeSerializationFrame",
"primaryDataNodeFrame",
"=",
"new",
"DataNodeSerializationFrame",
"(",
"null",
",",
"primaryNode",
")",
";",
"progressListener",
".",
"onTotalSteps",
"(",
"primaryDataNodeFrame",
".",
"entries",
".",
"size",
"(",
")",
")",
";",
"stack",
".",
"add",
"(",
"primaryDataNodeFrame",
")",
";",
"final",
"SerializedObject",
"testSerializedObject",
"=",
"new",
"SerializedObject",
"(",
")",
";",
"while",
"(",
"!",
"stack",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"SerializationFrame",
"frame",
"=",
"stack",
".",
"peek",
"(",
")",
";",
"//writes the header for that frame (if needed)",
"frame",
".",
"writeHeader",
"(",
"dOut",
")",
";",
"if",
"(",
"frame",
".",
"hasNext",
"(",
")",
")",
"{",
"while",
"(",
"frame",
".",
"hasNext",
"(",
")",
")",
"{",
"if",
"(",
"frame",
".",
"next",
"(",
"stack",
",",
"dOut",
",",
"marshallerMap",
",",
"serializedObjects",
",",
"testSerializedObject",
",",
"ignoreMissingMarshallers",
")",
")",
"{",
"if",
"(",
"frame",
"==",
"primaryDataNodeFrame",
")",
"{",
"progressListener",
".",
"onStep",
"(",
")",
";",
"}",
"break",
";",
"}",
"if",
"(",
"frame",
"==",
"primaryDataNodeFrame",
")",
"{",
"progressListener",
".",
"onStep",
"(",
")",
";",
"}",
"}",
"}",
"else",
"{",
"stack",
".",
"pop",
"(",
")",
";",
"//remember serialized deSerializedObject's addresses",
"if",
"(",
"frame",
"instanceof",
"DataNodeSerializationFrame",
")",
"{",
"DataNodeSerializationFrame",
"dataNodeFrame",
"=",
"(",
"DataNodeSerializationFrame",
")",
"frame",
";",
"SerializedObject",
"newSerializedObject",
"=",
"new",
"SerializedObject",
"(",
")",
";",
"newSerializedObject",
".",
"object",
"=",
"frame",
".",
"object",
";",
"newSerializedObject",
".",
"positionInStream",
"=",
"dataNodeFrame",
".",
"positionInStream",
";",
"serializedObjects",
".",
"put",
"(",
"newSerializedObject",
",",
"newSerializedObject",
")",
";",
"}",
"}",
"}",
"}"
] |
actually serializes the data
@param marshallerMap
@param dOut
@param primaryNode
@param progressListener
@throws IOException
|
[
"actually",
"serializes",
"the",
"data"
] |
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
|
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/XData.java#L1271-L1321
|
152,882
|
entrusc/xdata
|
src/main/java/com/moebiusgames/xdata/XData.java
|
XData.serializePrimitive
|
private static void serializePrimitive(DataOutputStream dOut, Object primitive) throws IOException {
if (primitive == null) {
dOut.writeByte(VAL_NULL);
} else {
dOut.writeByte(VAL_ELEMENT);
final Class<?> resolvedObjectClass = primitive.getClass();
Serializer<Object> serializer = (Serializer<Object>) PRIMITIVE_SERIALIZERS_BY_CLASS.get(resolvedObjectClass);
if (serializer == null) {
throw new IllegalStateException("Can't serialize resolved class " + resolvedObjectClass.getCanonicalName());
}
dOut.writeByte(serializer.getSerializerId());
serializer.serialize(primitive, dOut);
}
}
|
java
|
private static void serializePrimitive(DataOutputStream dOut, Object primitive) throws IOException {
if (primitive == null) {
dOut.writeByte(VAL_NULL);
} else {
dOut.writeByte(VAL_ELEMENT);
final Class<?> resolvedObjectClass = primitive.getClass();
Serializer<Object> serializer = (Serializer<Object>) PRIMITIVE_SERIALIZERS_BY_CLASS.get(resolvedObjectClass);
if (serializer == null) {
throw new IllegalStateException("Can't serialize resolved class " + resolvedObjectClass.getCanonicalName());
}
dOut.writeByte(serializer.getSerializerId());
serializer.serialize(primitive, dOut);
}
}
|
[
"private",
"static",
"void",
"serializePrimitive",
"(",
"DataOutputStream",
"dOut",
",",
"Object",
"primitive",
")",
"throws",
"IOException",
"{",
"if",
"(",
"primitive",
"==",
"null",
")",
"{",
"dOut",
".",
"writeByte",
"(",
"VAL_NULL",
")",
";",
"}",
"else",
"{",
"dOut",
".",
"writeByte",
"(",
"VAL_ELEMENT",
")",
";",
"final",
"Class",
"<",
"?",
">",
"resolvedObjectClass",
"=",
"primitive",
".",
"getClass",
"(",
")",
";",
"Serializer",
"<",
"Object",
">",
"serializer",
"=",
"(",
"Serializer",
"<",
"Object",
">",
")",
"PRIMITIVE_SERIALIZERS_BY_CLASS",
".",
"get",
"(",
"resolvedObjectClass",
")",
";",
"if",
"(",
"serializer",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Can't serialize resolved class \"",
"+",
"resolvedObjectClass",
".",
"getCanonicalName",
"(",
")",
")",
";",
"}",
"dOut",
".",
"writeByte",
"(",
"serializer",
".",
"getSerializerId",
"(",
")",
")",
";",
"serializer",
".",
"serialize",
"(",
"primitive",
",",
"dOut",
")",
";",
"}",
"}"
] |
serializes a primitive or null
@param serializerMap
@param dOut
@param primitive
@throws IOException
|
[
"serializes",
"a",
"primitive",
"or",
"null"
] |
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
|
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/XData.java#L1336-L1349
|
152,883
|
fuinorg/utils4swing
|
src/main/java/org/fuin/utils4swing/threadsafe/ThreadSafeJOptionPane.java
|
ThreadSafeJOptionPane.showMessageDialog
|
public static void showMessageDialog(final Component parentComponent, final Object message) {
execute(new VoidOptionPane() {
public void show() {
JOptionPane.showMessageDialog(parentComponent, message);
}
});
}
|
java
|
public static void showMessageDialog(final Component parentComponent, final Object message) {
execute(new VoidOptionPane() {
public void show() {
JOptionPane.showMessageDialog(parentComponent, message);
}
});
}
|
[
"public",
"static",
"void",
"showMessageDialog",
"(",
"final",
"Component",
"parentComponent",
",",
"final",
"Object",
"message",
")",
"{",
"execute",
"(",
"new",
"VoidOptionPane",
"(",
")",
"{",
"public",
"void",
"show",
"(",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"parentComponent",
",",
"message",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Brings up an information-message dialog titled "Message".
@param parentComponent
determines the <code>Frame</code> in which the dialog is
displayed; if <code>null</code>, or if the
<code>parentComponent</code> has no <code>Frame</code>, a
default <code>Frame</code> is used
@param message
the <code>Object</code> to display
|
[
"Brings",
"up",
"an",
"information",
"-",
"message",
"dialog",
"titled",
"Message",
"."
] |
560fb69eac182e3473de9679c3c15433e524ef6b
|
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/threadsafe/ThreadSafeJOptionPane.java#L827-L835
|
152,884
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/builder/JNDIContentRepositoryBuilder.java
|
JNDIContentRepositoryBuilder.withContextProperty
|
public JNDIContentRepositoryBuilder withContextProperty(final String name, final Object value) {
contextProperties.put(name, value);
return this;
}
|
java
|
public JNDIContentRepositoryBuilder withContextProperty(final String name, final Object value) {
contextProperties.put(name, value);
return this;
}
|
[
"public",
"JNDIContentRepositoryBuilder",
"withContextProperty",
"(",
"final",
"String",
"name",
",",
"final",
"Object",
"value",
")",
"{",
"contextProperties",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] |
Adds a new context property to the environment for the JNDI lookup context
@param name
the name of the environment variable
@param value
the value to assign to the variable
@return this test rule
|
[
"Adds",
"a",
"new",
"context",
"property",
"to",
"the",
"environment",
"for",
"the",
"JNDI",
"lookup",
"context"
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/builder/JNDIContentRepositoryBuilder.java#L131-L135
|
152,885
|
inkstand-io/scribble
|
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/builder/JNDIContentRepositoryBuilder.java
|
JNDIContentRepositoryBuilder.withSecurityPrincipal
|
public JNDIContentRepositoryBuilder withSecurityPrincipal(final String principalName, final String credentials) {
contextProperties.put(Context.SECURITY_PRINCIPAL, principalName);
contextProperties.put(Context.SECURITY_CREDENTIALS, credentials);
return this;
}
|
java
|
public JNDIContentRepositoryBuilder withSecurityPrincipal(final String principalName, final String credentials) {
contextProperties.put(Context.SECURITY_PRINCIPAL, principalName);
contextProperties.put(Context.SECURITY_CREDENTIALS, credentials);
return this;
}
|
[
"public",
"JNDIContentRepositoryBuilder",
"withSecurityPrincipal",
"(",
"final",
"String",
"principalName",
",",
"final",
"String",
"credentials",
")",
"{",
"contextProperties",
".",
"put",
"(",
"Context",
".",
"SECURITY_PRINCIPAL",
",",
"principalName",
")",
";",
"contextProperties",
".",
"put",
"(",
"Context",
".",
"SECURITY_CREDENTIALS",
",",
"credentials",
")",
";",
"return",
"this",
";",
"}"
] |
Sets the context properties for SECURITY_PRINCIPAL and SECURITY_CREDENTIAL to perform the lookup. This method is
a convenience for setting the properties SECURITY_PRINCIPAL and SECURITY_CREDENTIAL on the environment.
@param principalName
the principal name to use to perform the lookup
@param credentials
the credentials used to authenticate the principal
@return this test rule
|
[
"Sets",
"the",
"context",
"properties",
"for",
"SECURITY_PRINCIPAL",
"and",
"SECURITY_CREDENTIAL",
"to",
"perform",
"the",
"lookup",
".",
"This",
"method",
"is",
"a",
"convenience",
"for",
"setting",
"the",
"properties",
"SECURITY_PRINCIPAL",
"and",
"SECURITY_CREDENTIAL",
"on",
"the",
"environment",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/builder/JNDIContentRepositoryBuilder.java#L190-L195
|
152,886
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/db/DatabaseSession.java
|
DatabaseSession.freeRemoteSession
|
public void freeRemoteSession() throws RemoteException
{
try {
if (m_database.getTableCount() == 0)
m_database.free(); // Free if this is my private database, or there are no tables left
} catch (Exception ex) {
ex.printStackTrace();
}
super.freeRemoteSession();
}
|
java
|
public void freeRemoteSession() throws RemoteException
{
try {
if (m_database.getTableCount() == 0)
m_database.free(); // Free if this is my private database, or there are no tables left
} catch (Exception ex) {
ex.printStackTrace();
}
super.freeRemoteSession();
}
|
[
"public",
"void",
"freeRemoteSession",
"(",
")",
"throws",
"RemoteException",
"{",
"try",
"{",
"if",
"(",
"m_database",
".",
"getTableCount",
"(",
")",
"==",
"0",
")",
"m_database",
".",
"free",
"(",
")",
";",
"// Free if this is my private database, or there are no tables left",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"super",
".",
"freeRemoteSession",
"(",
")",
";",
"}"
] |
Free the objects.
This method is called from the remote client, and frees this session.
|
[
"Free",
"the",
"objects",
".",
"This",
"method",
"is",
"called",
"from",
"the",
"remote",
"client",
"and",
"frees",
"this",
"session",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/DatabaseSession.java#L103-L112
|
152,887
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/io/FileFilterRuleSet.java
|
FileFilterRuleSet.fileMatchesRules
|
public boolean fileMatchesRules(File file) {
try {
if(file.exists()) {
if(includeFilesContainingText.length == 0 && excludeFilesContainingText.length == 0) {
return fileMatchesRules(
getComparableFileName(file));
} else {
return fileMatchesRules(
getComparableFileName(file),
FileSupport.getTextFileFromFS(file));
}
}
} catch (IOException ioe) {
//at the moment file does not match rules
}
return false;
}
|
java
|
public boolean fileMatchesRules(File file) {
try {
if(file.exists()) {
if(includeFilesContainingText.length == 0 && excludeFilesContainingText.length == 0) {
return fileMatchesRules(
getComparableFileName(file));
} else {
return fileMatchesRules(
getComparableFileName(file),
FileSupport.getTextFileFromFS(file));
}
}
} catch (IOException ioe) {
//at the moment file does not match rules
}
return false;
}
|
[
"public",
"boolean",
"fileMatchesRules",
"(",
"File",
"file",
")",
"{",
"try",
"{",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"includeFilesContainingText",
".",
"length",
"==",
"0",
"&&",
"excludeFilesContainingText",
".",
"length",
"==",
"0",
")",
"{",
"return",
"fileMatchesRules",
"(",
"getComparableFileName",
"(",
"file",
")",
")",
";",
"}",
"else",
"{",
"return",
"fileMatchesRules",
"(",
"getComparableFileName",
"(",
"file",
")",
",",
"FileSupport",
".",
"getTextFileFromFS",
"(",
"file",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"//at the moment file does not match rules",
"}",
"return",
"false",
";",
"}"
] |
Checks if file matches rules.
@param file
@return true if a file exists, matches include and exclude rules and is successfully parsed in case of inspection of contents
@throws IOException
|
[
"Checks",
"if",
"file",
"matches",
"rules",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileFilterRuleSet.java#L98-L115
|
152,888
|
tvesalainen/util
|
vfs/src/main/java/org/vesalainen/vfs/VirtualFileSystems.java
|
VirtualFileSystems.newFileSystem
|
public static final FileSystem newFileSystem(Path path, Map<String,?> env) throws IOException
{
return getDefault().provider().newFileSystem(path, env);
}
|
java
|
public static final FileSystem newFileSystem(Path path, Map<String,?> env) throws IOException
{
return getDefault().provider().newFileSystem(path, env);
}
|
[
"public",
"static",
"final",
"FileSystem",
"newFileSystem",
"(",
"Path",
"path",
",",
"Map",
"<",
"String",
",",
"?",
">",
"env",
")",
"throws",
"IOException",
"{",
"return",
"getDefault",
"(",
")",
".",
"provider",
"(",
")",
".",
"newFileSystem",
"(",
"path",
",",
"env",
")",
";",
"}"
] |
Constructs a new FileSystem to access the contents of a file as a file system.
@param path
@param env
@return
@throws IOException
|
[
"Constructs",
"a",
"new",
"FileSystem",
"to",
"access",
"the",
"contents",
"of",
"a",
"file",
"as",
"a",
"file",
"system",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/VirtualFileSystems.java#L47-L50
|
152,889
|
hdecarne/java-default
|
src/main/java/de/carne/util/cmdline/CmdLineProcessor.java
|
CmdLineProcessor.process
|
public void process() throws CmdLineException {
ProcessingContext context = new ProcessingContext();
for (String arg : this.args) {
if (arg != null && !context.processPendingOptionAction(arg)
&& !context.processOptionAction(arg, this.optionActions)
&& !context.processSwitchAction(arg, this.switchActions)) {
// No action found so far. Invoke the corresponding default action.
Consumer<String> defaultAction = (isActionArg(arg) ? this.unknownAction : this.unnamedAction);
if (defaultAction != null) {
try {
defaultAction.accept(arg);
} catch (RuntimeException e) {
throw new CmdLineException(this, arg, e);
}
} else {
throw new CmdLineException(this, arg);
}
}
}
context.verifyNoPendingOptionAction();
}
|
java
|
public void process() throws CmdLineException {
ProcessingContext context = new ProcessingContext();
for (String arg : this.args) {
if (arg != null && !context.processPendingOptionAction(arg)
&& !context.processOptionAction(arg, this.optionActions)
&& !context.processSwitchAction(arg, this.switchActions)) {
// No action found so far. Invoke the corresponding default action.
Consumer<String> defaultAction = (isActionArg(arg) ? this.unknownAction : this.unnamedAction);
if (defaultAction != null) {
try {
defaultAction.accept(arg);
} catch (RuntimeException e) {
throw new CmdLineException(this, arg, e);
}
} else {
throw new CmdLineException(this, arg);
}
}
}
context.verifyNoPendingOptionAction();
}
|
[
"public",
"void",
"process",
"(",
")",
"throws",
"CmdLineException",
"{",
"ProcessingContext",
"context",
"=",
"new",
"ProcessingContext",
"(",
")",
";",
"for",
"(",
"String",
"arg",
":",
"this",
".",
"args",
")",
"{",
"if",
"(",
"arg",
"!=",
"null",
"&&",
"!",
"context",
".",
"processPendingOptionAction",
"(",
"arg",
")",
"&&",
"!",
"context",
".",
"processOptionAction",
"(",
"arg",
",",
"this",
".",
"optionActions",
")",
"&&",
"!",
"context",
".",
"processSwitchAction",
"(",
"arg",
",",
"this",
".",
"switchActions",
")",
")",
"{",
"// No action found so far. Invoke the corresponding default action.",
"Consumer",
"<",
"String",
">",
"defaultAction",
"=",
"(",
"isActionArg",
"(",
"arg",
")",
"?",
"this",
".",
"unknownAction",
":",
"this",
".",
"unnamedAction",
")",
";",
"if",
"(",
"defaultAction",
"!=",
"null",
")",
"{",
"try",
"{",
"defaultAction",
".",
"accept",
"(",
"arg",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"throw",
"new",
"CmdLineException",
"(",
"this",
",",
"arg",
",",
"e",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"CmdLineException",
"(",
"this",
",",
"arg",
")",
";",
"}",
"}",
"}",
"context",
".",
"verifyNoPendingOptionAction",
"(",
")",
";",
"}"
] |
Processes the command line and invoke the correspond actions.
@throws CmdLineException if the command line contains an error.
@see #onSwitch(Consumer)
@see #onOption(BiConsumer)
@see #onUnnamedOption(Consumer)
@see #onUnknownArg(Consumer)
|
[
"Processes",
"the",
"command",
"line",
"and",
"invoke",
"the",
"correspond",
"actions",
"."
] |
ca16f6fdb0436e90e9e2df3106055e320bb3c9e3
|
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/cmdline/CmdLineProcessor.java#L104-L126
|
152,890
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/CubicSplineCurve.java
|
CubicSplineCurve.get141Matrix
|
public static final DenseMatrix64F get141Matrix(int order)
{
if (order < 2)
{
throw new IllegalArgumentException("order has to be at least 2 for 1 4 1 matrix");
}
double[] data = new double[order*order];
for (int row=0;row<order;row++)
{
for (int col=0;col<order;col++)
{
int index = row*order+col;
if (row == col)
{
data[index] = 4;
}
else
{
if (Math.abs(row-col) == 1)
{
data[index] = 1;
}
else
{
data[index] = 0;
}
}
}
}
return new DenseMatrix64F(order, order, true, data);
}
|
java
|
public static final DenseMatrix64F get141Matrix(int order)
{
if (order < 2)
{
throw new IllegalArgumentException("order has to be at least 2 for 1 4 1 matrix");
}
double[] data = new double[order*order];
for (int row=0;row<order;row++)
{
for (int col=0;col<order;col++)
{
int index = row*order+col;
if (row == col)
{
data[index] = 4;
}
else
{
if (Math.abs(row-col) == 1)
{
data[index] = 1;
}
else
{
data[index] = 0;
}
}
}
}
return new DenseMatrix64F(order, order, true, data);
}
|
[
"public",
"static",
"final",
"DenseMatrix64F",
"get141Matrix",
"(",
"int",
"order",
")",
"{",
"if",
"(",
"order",
"<",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"order has to be at least 2 for 1 4 1 matrix\"",
")",
";",
"}",
"double",
"[",
"]",
"data",
"=",
"new",
"double",
"[",
"order",
"*",
"order",
"]",
";",
"for",
"(",
"int",
"row",
"=",
"0",
";",
"row",
"<",
"order",
";",
"row",
"++",
")",
"{",
"for",
"(",
"int",
"col",
"=",
"0",
";",
"col",
"<",
"order",
";",
"col",
"++",
")",
"{",
"int",
"index",
"=",
"row",
"*",
"order",
"+",
"col",
";",
"if",
"(",
"row",
"==",
"col",
")",
"{",
"data",
"[",
"index",
"]",
"=",
"4",
";",
"}",
"else",
"{",
"if",
"(",
"Math",
".",
"abs",
"(",
"row",
"-",
"col",
")",
"==",
"1",
")",
"{",
"data",
"[",
"index",
"]",
"=",
"1",
";",
"}",
"else",
"{",
"data",
"[",
"index",
"]",
"=",
"0",
";",
"}",
"}",
"}",
"}",
"return",
"new",
"DenseMatrix64F",
"(",
"order",
",",
"order",
",",
"true",
",",
"data",
")",
";",
"}"
] |
Creates a 1 4 1 matrix eg.
|4 1 0|
|1 4 1|
|0 1 4|
@param order Matrix dimension > 1
@return 1 4 1 matrix
|
[
"Creates",
"a",
"1",
"4",
"1",
"matrix",
"eg",
".",
"|4",
"1",
"0|",
"|1",
"4",
"1|",
"|0",
"1",
"4|"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CubicSplineCurve.java#L172-L202
|
152,891
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/CubicSplineCurve.java
|
CubicSplineCurve.get
|
public double get(double x, double epsilon)
{
Point nearest = getNearest(x, epsilon);
return nearest.getY();
}
|
java
|
public double get(double x, double epsilon)
{
Point nearest = getNearest(x, epsilon);
return nearest.getY();
}
|
[
"public",
"double",
"get",
"(",
"double",
"x",
",",
"double",
"epsilon",
")",
"{",
"Point",
"nearest",
"=",
"getNearest",
"(",
"x",
",",
"epsilon",
")",
";",
"return",
"nearest",
".",
"getY",
"(",
")",
";",
"}"
] |
Returns y for x. This is convenient method. Use getNearest to get exact
evaluated point.
@param x
@param epsilon Evaluated points x cannot differ more
@return
@see org.vesalainen.math.CubicSplineCurve#getNearest(double, double)
|
[
"Returns",
"y",
"for",
"x",
".",
"This",
"is",
"convenient",
"method",
".",
"Use",
"getNearest",
"to",
"get",
"exact",
"evaluated",
"point",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CubicSplineCurve.java#L315-L319
|
152,892
|
js-lib-com/commons
|
src/main/java/js/util/Classes.java
|
Classes.loadService
|
public static <S> S loadService(Class<S> serviceInterface, ClassLoader classLoader)
{
Iterator<S> services = ServiceLoader.load(serviceInterface, classLoader).iterator();
if(services.hasNext()) {
return services.next();
}
// although not official, Android does not support ServiceLoader
// there is no way to insert service descriptor files into apk META-INF
// as an workaround uses a hard coded 'services' package to store service descriptors
try {
String serviceDescriptor = getResourceAsString("/services/" + serviceInterface.getName());
return newInstance(serviceDescriptor);
}
catch(Throwable e) {
// log.dump("Service not found", e);
}
return null;
}
|
java
|
public static <S> S loadService(Class<S> serviceInterface, ClassLoader classLoader)
{
Iterator<S> services = ServiceLoader.load(serviceInterface, classLoader).iterator();
if(services.hasNext()) {
return services.next();
}
// although not official, Android does not support ServiceLoader
// there is no way to insert service descriptor files into apk META-INF
// as an workaround uses a hard coded 'services' package to store service descriptors
try {
String serviceDescriptor = getResourceAsString("/services/" + serviceInterface.getName());
return newInstance(serviceDescriptor);
}
catch(Throwable e) {
// log.dump("Service not found", e);
}
return null;
}
|
[
"public",
"static",
"<",
"S",
">",
"S",
"loadService",
"(",
"Class",
"<",
"S",
">",
"serviceInterface",
",",
"ClassLoader",
"classLoader",
")",
"{",
"Iterator",
"<",
"S",
">",
"services",
"=",
"ServiceLoader",
".",
"load",
"(",
"serviceInterface",
",",
"classLoader",
")",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"services",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"services",
".",
"next",
"(",
")",
";",
"}",
"// although not official, Android does not support ServiceLoader\r",
"// there is no way to insert service descriptor files into apk META-INF\r",
"// as an workaround uses a hard coded 'services' package to store service descriptors\r",
"try",
"{",
"String",
"serviceDescriptor",
"=",
"getResourceAsString",
"(",
"\"/services/\"",
"+",
"serviceInterface",
".",
"getName",
"(",
")",
")",
";",
"return",
"newInstance",
"(",
"serviceDescriptor",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"// log.dump(\"Service not found\", e);\r",
"}",
"return",
"null",
";",
"}"
] |
Load service of requested interface using given class loader. Throws exception if service implementation not found
on run-time.
@param serviceInterface service interface,
@param classLoader class loader.
@param <S> service type.
@return service instance.
@throws NoProviderException if service provider not found on run-time.
|
[
"Load",
"service",
"of",
"requested",
"interface",
"using",
"given",
"class",
"loader",
".",
"Throws",
"exception",
"if",
"service",
"implementation",
"not",
"found",
"on",
"run",
"-",
"time",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L219-L238
|
152,893
|
js-lib-com/commons
|
src/main/java/js/util/Classes.java
|
Classes.loadOptionalService
|
public static <S> S loadOptionalService(Class<S> serviceInterface)
{
S service = null;
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if(classLoader != null) {
service = loadService(serviceInterface, classLoader);
}
if(service == null) {
service = loadService(serviceInterface, Classes.class.getClassLoader());
}
return service;
}
|
java
|
public static <S> S loadOptionalService(Class<S> serviceInterface)
{
S service = null;
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
if(classLoader != null) {
service = loadService(serviceInterface, classLoader);
}
if(service == null) {
service = loadService(serviceInterface, Classes.class.getClassLoader());
}
return service;
}
|
[
"public",
"static",
"<",
"S",
">",
"S",
"loadOptionalService",
"(",
"Class",
"<",
"S",
">",
"serviceInterface",
")",
"{",
"S",
"service",
"=",
"null",
";",
"ClassLoader",
"classLoader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"if",
"(",
"classLoader",
"!=",
"null",
")",
"{",
"service",
"=",
"loadService",
"(",
"serviceInterface",
",",
"classLoader",
")",
";",
"}",
"if",
"(",
"service",
"==",
"null",
")",
"{",
"service",
"=",
"loadService",
"(",
"serviceInterface",
",",
"Classes",
".",
"class",
".",
"getClassLoader",
"(",
")",
")",
";",
"}",
"return",
"service",
";",
"}"
] |
Load service of requested interface returning null if service provider not found. Caller should test returned value
and take appropriate actions.
@param serviceInterface service interface.
@param <S> service type.
@return service instance or null.
|
[
"Load",
"service",
"of",
"requested",
"interface",
"returning",
"null",
"if",
"service",
"provider",
"not",
"found",
".",
"Caller",
"should",
"test",
"returned",
"value",
"and",
"take",
"appropriate",
"actions",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L248-L259
|
152,894
|
js-lib-com/commons
|
src/main/java/js/util/Classes.java
|
Classes.getParameterTypes
|
public static Class<?>[] getParameterTypes(Object... arguments)
{
Class<?>[] types = new Class<?>[arguments.length];
for(int i = 0; i < arguments.length; i++) {
Object argument = arguments[i];
if(argument == null) {
types[i] = Object.class;
continue;
}
if(!(argument instanceof VarArgs)) {
types[i] = argument.getClass();
if(types[i].isAnonymousClass()) {
Class<?>[] interfaces = types[i].getInterfaces();
Class<?> superclass = interfaces.length > 0 ? interfaces[0] : null;
if(superclass == null) {
superclass = types[i].getSuperclass();
}
types[i] = superclass;
}
continue;
}
// here we have VarArgs that must be the last in arguments list
if(i != arguments.length - 1) {
throw new BugError("Variable arguments must be the last in arguments list.");
}
@SuppressWarnings("unchecked")
VarArgs<Object> varArgs = (VarArgs<Object>)argument;
int index = arguments.length - 1;
types[index] = varArgs.getType();
arguments[index] = varArgs.getArguments();
}
return types;
}
|
java
|
public static Class<?>[] getParameterTypes(Object... arguments)
{
Class<?>[] types = new Class<?>[arguments.length];
for(int i = 0; i < arguments.length; i++) {
Object argument = arguments[i];
if(argument == null) {
types[i] = Object.class;
continue;
}
if(!(argument instanceof VarArgs)) {
types[i] = argument.getClass();
if(types[i].isAnonymousClass()) {
Class<?>[] interfaces = types[i].getInterfaces();
Class<?> superclass = interfaces.length > 0 ? interfaces[0] : null;
if(superclass == null) {
superclass = types[i].getSuperclass();
}
types[i] = superclass;
}
continue;
}
// here we have VarArgs that must be the last in arguments list
if(i != arguments.length - 1) {
throw new BugError("Variable arguments must be the last in arguments list.");
}
@SuppressWarnings("unchecked")
VarArgs<Object> varArgs = (VarArgs<Object>)argument;
int index = arguments.length - 1;
types[index] = varArgs.getType();
arguments[index] = varArgs.getArguments();
}
return types;
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"getParameterTypes",
"(",
"Object",
"...",
"arguments",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
"=",
"new",
"Class",
"<",
"?",
">",
"[",
"arguments",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arguments",
".",
"length",
";",
"i",
"++",
")",
"{",
"Object",
"argument",
"=",
"arguments",
"[",
"i",
"]",
";",
"if",
"(",
"argument",
"==",
"null",
")",
"{",
"types",
"[",
"i",
"]",
"=",
"Object",
".",
"class",
";",
"continue",
";",
"}",
"if",
"(",
"!",
"(",
"argument",
"instanceof",
"VarArgs",
")",
")",
"{",
"types",
"[",
"i",
"]",
"=",
"argument",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"types",
"[",
"i",
"]",
".",
"isAnonymousClass",
"(",
")",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
"=",
"types",
"[",
"i",
"]",
".",
"getInterfaces",
"(",
")",
";",
"Class",
"<",
"?",
">",
"superclass",
"=",
"interfaces",
".",
"length",
">",
"0",
"?",
"interfaces",
"[",
"0",
"]",
":",
"null",
";",
"if",
"(",
"superclass",
"==",
"null",
")",
"{",
"superclass",
"=",
"types",
"[",
"i",
"]",
".",
"getSuperclass",
"(",
")",
";",
"}",
"types",
"[",
"i",
"]",
"=",
"superclass",
";",
"}",
"continue",
";",
"}",
"// here we have VarArgs that must be the last in arguments list\r",
"if",
"(",
"i",
"!=",
"arguments",
".",
"length",
"-",
"1",
")",
"{",
"throw",
"new",
"BugError",
"(",
"\"Variable arguments must be the last in arguments list.\"",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"VarArgs",
"<",
"Object",
">",
"varArgs",
"=",
"(",
"VarArgs",
"<",
"Object",
">",
")",
"argument",
";",
"int",
"index",
"=",
"arguments",
".",
"length",
"-",
"1",
";",
"types",
"[",
"index",
"]",
"=",
"varArgs",
".",
"getType",
"(",
")",
";",
"arguments",
"[",
"index",
"]",
"=",
"varArgs",
".",
"getArguments",
"(",
")",
";",
"}",
"return",
"types",
";",
"}"
] |
Get method formal parameter types inferred from actual invocation arguments. This utility is a helper for method
discovery when have access to the actual invocation argument, but not the formal parameter types list declared by
method signature.
@param arguments variable number of method arguments.
@return parameter types.
|
[
"Get",
"method",
"formal",
"parameter",
"types",
"inferred",
"from",
"actual",
"invocation",
"arguments",
".",
"This",
"utility",
"is",
"a",
"helper",
"for",
"method",
"discovery",
"when",
"have",
"access",
"to",
"the",
"actual",
"invocation",
"argument",
"but",
"not",
"the",
"formal",
"parameter",
"types",
"list",
"declared",
"by",
"method",
"signature",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L294-L327
|
152,895
|
js-lib-com/commons
|
src/main/java/js/util/Classes.java
|
Classes.invoke
|
private static Object invoke(Object object, Method method, Object... arguments) throws Exception
{
Throwable cause = null;
try {
method.setAccessible(true);
return method.invoke(object instanceof Class<?> ? null : object, arguments);
}
catch(IllegalAccessException e) {
throw new BugError(e);
}
catch(InvocationTargetException e) {
cause = e.getCause();
if(cause instanceof Exception) {
throw (Exception)cause;
}
if(cause instanceof AssertionError) {
throw (AssertionError)cause;
}
}
throw new BugError("Method |%s| invocation fails: %s", method, cause);
}
|
java
|
private static Object invoke(Object object, Method method, Object... arguments) throws Exception
{
Throwable cause = null;
try {
method.setAccessible(true);
return method.invoke(object instanceof Class<?> ? null : object, arguments);
}
catch(IllegalAccessException e) {
throw new BugError(e);
}
catch(InvocationTargetException e) {
cause = e.getCause();
if(cause instanceof Exception) {
throw (Exception)cause;
}
if(cause instanceof AssertionError) {
throw (AssertionError)cause;
}
}
throw new BugError("Method |%s| invocation fails: %s", method, cause);
}
|
[
"private",
"static",
"Object",
"invoke",
"(",
"Object",
"object",
",",
"Method",
"method",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"Throwable",
"cause",
"=",
"null",
";",
"try",
"{",
"method",
".",
"setAccessible",
"(",
"true",
")",
";",
"return",
"method",
".",
"invoke",
"(",
"object",
"instanceof",
"Class",
"<",
"?",
">",
"?",
"null",
":",
"object",
",",
"arguments",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"BugError",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"e",
")",
"{",
"cause",
"=",
"e",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"cause",
"instanceof",
"Exception",
")",
"{",
"throw",
"(",
"Exception",
")",
"cause",
";",
"}",
"if",
"(",
"cause",
"instanceof",
"AssertionError",
")",
"{",
"throw",
"(",
"AssertionError",
")",
"cause",
";",
"}",
"}",
"throw",
"new",
"BugError",
"(",
"\"Method |%s| invocation fails: %s\"",
",",
"method",
",",
"cause",
")",
";",
"}"
] |
Do the actual reflexive method invocation.
@param object object instance,
@param method reflexive method,
@param arguments variable number of arguments.
@return value returned by method execution.
@throws Exception if invocation fail for whatever reason including method internals.
|
[
"Do",
"the",
"actual",
"reflexive",
"method",
"invocation",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L478-L498
|
152,896
|
js-lib-com/commons
|
src/main/java/js/util/Classes.java
|
Classes.getCallerMethod
|
public static String getCallerMethod()
{
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
if(stackTrace.length == 0) {
return "unknown";
}
final StackTraceElement e = stackTrace[0];
return Strings.concat(e.getClassName(), '#', e.getMethodName(), ':', e.getLineNumber());
}
|
java
|
public static String getCallerMethod()
{
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
if(stackTrace.length == 0) {
return "unknown";
}
final StackTraceElement e = stackTrace[0];
return Strings.concat(e.getClassName(), '#', e.getMethodName(), ':', e.getLineNumber());
}
|
[
"public",
"static",
"String",
"getCallerMethod",
"(",
")",
"{",
"StackTraceElement",
"[",
"]",
"stackTrace",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getStackTrace",
"(",
")",
";",
"if",
"(",
"stackTrace",
".",
"length",
"==",
"0",
")",
"{",
"return",
"\"unknown\"",
";",
"}",
"final",
"StackTraceElement",
"e",
"=",
"stackTrace",
"[",
"0",
"]",
";",
"return",
"Strings",
".",
"concat",
"(",
"e",
".",
"getClassName",
"(",
")",
",",
"'",
"'",
",",
"e",
".",
"getMethodName",
"(",
")",
",",
"'",
"'",
",",
"e",
".",
"getLineNumber",
"(",
")",
")",
";",
"}"
] |
Get source line for the caller method.
@return caller method.
|
[
"Get",
"source",
"line",
"for",
"the",
"caller",
"method",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L587-L595
|
152,897
|
js-lib-com/commons
|
src/main/java/js/util/Classes.java
|
Classes.getOptionalField
|
public static Field getOptionalField(Class<?> clazz, String fieldName)
{
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
}
catch(NoSuchFieldException expectable) {}
catch(SecurityException e) {
throw new BugError(e);
}
return null;
}
|
java
|
public static Field getOptionalField(Class<?> clazz, String fieldName)
{
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
return field;
}
catch(NoSuchFieldException expectable) {}
catch(SecurityException e) {
throw new BugError(e);
}
return null;
}
|
[
"public",
"static",
"Field",
"getOptionalField",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
")",
"{",
"try",
"{",
"Field",
"field",
"=",
"clazz",
".",
"getDeclaredField",
"(",
"fieldName",
")",
";",
"field",
".",
"setAccessible",
"(",
"true",
")",
";",
"return",
"field",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"expectable",
")",
"{",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"throw",
"new",
"BugError",
"(",
"e",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Get class field or null if not found. Try to get named class field and returns null if not found; this method does
not throw any exception.
@param clazz Java class to return field from,
@param fieldName field name.
@return class reflective field or null.
|
[
"Get",
"class",
"field",
"or",
"null",
"if",
"not",
"found",
".",
"Try",
"to",
"get",
"named",
"class",
"field",
"and",
"returns",
"null",
"if",
"not",
"found",
";",
"this",
"method",
"does",
"not",
"throw",
"any",
"exception",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L630-L642
|
152,898
|
js-lib-com/commons
|
src/main/java/js/util/Classes.java
|
Classes.getOptionalFieldValue
|
@SafeVarargs
public static <T> T getOptionalFieldValue(Object object, String fieldName, Class<T>... fieldType)
{
Class<?> clazz = null;
if(object instanceof Class<?>) {
clazz = (Class<?>)object;
object = null;
}
else {
clazz = object.getClass();
}
return getFieldValue(object, clazz, fieldName, fieldType.length == 1 ? fieldType[0] : null, true);
}
|
java
|
@SafeVarargs
public static <T> T getOptionalFieldValue(Object object, String fieldName, Class<T>... fieldType)
{
Class<?> clazz = null;
if(object instanceof Class<?>) {
clazz = (Class<?>)object;
object = null;
}
else {
clazz = object.getClass();
}
return getFieldValue(object, clazz, fieldName, fieldType.length == 1 ? fieldType[0] : null, true);
}
|
[
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"T",
"getOptionalFieldValue",
"(",
"Object",
"object",
",",
"String",
"fieldName",
",",
"Class",
"<",
"T",
">",
"...",
"fieldType",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"null",
";",
"if",
"(",
"object",
"instanceof",
"Class",
"<",
"?",
">",
")",
"{",
"clazz",
"=",
"(",
"Class",
"<",
"?",
">",
")",
"object",
";",
"object",
"=",
"null",
";",
"}",
"else",
"{",
"clazz",
"=",
"object",
".",
"getClass",
"(",
")",
";",
"}",
"return",
"getFieldValue",
"(",
"object",
",",
"clazz",
",",
"fieldName",
",",
"fieldType",
".",
"length",
"==",
"1",
"?",
"fieldType",
"[",
"0",
"]",
":",
"null",
",",
"true",
")",
";",
"}"
] |
Get optional field value from instance or class. Retrieve named field value from given instance or class; if field
is missing return null. Note that this method does not throw exceptions. Also, if optional desired field type is
present and named field is of different type returns null.
@param object instance or class to retrieve field value from,
@param fieldName field name,
@param fieldType optional desired field type.
@param <T> field value type.
@return instance or class field value or null if field not found.
|
[
"Get",
"optional",
"field",
"value",
"from",
"instance",
"or",
"class",
".",
"Retrieve",
"named",
"field",
"value",
"from",
"given",
"instance",
"or",
"class",
";",
"if",
"field",
"is",
"missing",
"return",
"null",
".",
"Note",
"that",
"this",
"method",
"does",
"not",
"throw",
"exceptions",
".",
"Also",
"if",
"optional",
"desired",
"field",
"type",
"is",
"present",
"and",
"named",
"field",
"is",
"of",
"different",
"type",
"returns",
"null",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L743-L755
|
152,899
|
js-lib-com/commons
|
src/main/java/js/util/Classes.java
|
Classes.getFieldValue
|
public static <T> T getFieldValue(Object object, Class<?> clazz, String fieldName)
{
return getFieldValue(object, clazz, fieldName, null, false);
}
|
java
|
public static <T> T getFieldValue(Object object, Class<?> clazz, String fieldName)
{
return getFieldValue(object, clazz, fieldName, null, false);
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"getFieldValue",
"(",
"Object",
"object",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
")",
"{",
"return",
"getFieldValue",
"(",
"object",
",",
"clazz",
",",
"fieldName",
",",
"null",
",",
"false",
")",
";",
"}"
] |
Get instance field value declared into superclass. Retrieve inherited field value from given instance throwing
exception if field is not declared into superclass.
@param object instance to retrieve field value from,
@param clazz instance superclass,
@param fieldName field name.
@param <T> field value type.
@return instance field value.
@throws NoSuchBeingException if field is missing.
|
[
"Get",
"instance",
"field",
"value",
"declared",
"into",
"superclass",
".",
"Retrieve",
"inherited",
"field",
"value",
"from",
"given",
"instance",
"throwing",
"exception",
"if",
"field",
"is",
"not",
"declared",
"into",
"superclass",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L768-L771
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.