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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
149,200
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java
|
MultiLanguageTextProcessor.getFirstMultiLanguageText
|
public static String getFirstMultiLanguageText(final MultiLanguageTextOrBuilder multiLanguageText) throws NotAvailableException {
for (MultiLanguageText.MapFieldEntry entry : multiLanguageText.getEntryList()) {
return entry.getValue();
}
throw new NotAvailableException("MultiLanguageText");
}
|
java
|
public static String getFirstMultiLanguageText(final MultiLanguageTextOrBuilder multiLanguageText) throws NotAvailableException {
for (MultiLanguageText.MapFieldEntry entry : multiLanguageText.getEntryList()) {
return entry.getValue();
}
throw new NotAvailableException("MultiLanguageText");
}
|
[
"public",
"static",
"String",
"getFirstMultiLanguageText",
"(",
"final",
"MultiLanguageTextOrBuilder",
"multiLanguageText",
")",
"throws",
"NotAvailableException",
"{",
"for",
"(",
"MultiLanguageText",
".",
"MapFieldEntry",
"entry",
":",
"multiLanguageText",
".",
"getEntryList",
"(",
")",
")",
"{",
"return",
"entry",
".",
"getValue",
"(",
")",
";",
"}",
"throw",
"new",
"NotAvailableException",
"(",
"\"MultiLanguageText\"",
")",
";",
"}"
] |
Get the first multiLanguageText found in the multiLanguageText type. This is independent of the language of the multiLanguageText.
@param multiLanguageText the multiLanguageText type which is searched for the first multiLanguageText
@return the first multiLanguageText found
@throws NotAvailableException if now multiLanguageText is contained in the multiLanguageText type.
|
[
"Get",
"the",
"first",
"multiLanguageText",
"found",
"in",
"the",
"multiLanguageText",
"type",
".",
"This",
"is",
"independent",
"of",
"the",
"language",
"of",
"the",
"multiLanguageText",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java#L165-L170
|
149,201
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java
|
MultiLanguageTextProcessor.getMultiLanguageTextByLanguage
|
public static String getMultiLanguageTextByLanguage(final String languageCode, final MultiLanguageTextOrBuilder multiLanguageText) throws NotAvailableException {
for (MultiLanguageText.MapFieldEntry entry : multiLanguageText.getEntryList()) {
if (entry.getKey().equalsIgnoreCase(languageCode)) {
return entry.getValue();
}
}
throw new NotAvailableException("MultiLanguageTextList of Language[" + languageCode + "] in multiLanguageTextType[" + multiLanguageText + "]");
}
|
java
|
public static String getMultiLanguageTextByLanguage(final String languageCode, final MultiLanguageTextOrBuilder multiLanguageText) throws NotAvailableException {
for (MultiLanguageText.MapFieldEntry entry : multiLanguageText.getEntryList()) {
if (entry.getKey().equalsIgnoreCase(languageCode)) {
return entry.getValue();
}
}
throw new NotAvailableException("MultiLanguageTextList of Language[" + languageCode + "] in multiLanguageTextType[" + multiLanguageText + "]");
}
|
[
"public",
"static",
"String",
"getMultiLanguageTextByLanguage",
"(",
"final",
"String",
"languageCode",
",",
"final",
"MultiLanguageTextOrBuilder",
"multiLanguageText",
")",
"throws",
"NotAvailableException",
"{",
"for",
"(",
"MultiLanguageText",
".",
"MapFieldEntry",
"entry",
":",
"multiLanguageText",
".",
"getEntryList",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getKey",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"languageCode",
")",
")",
"{",
"return",
"entry",
".",
"getValue",
"(",
")",
";",
"}",
"}",
"throw",
"new",
"NotAvailableException",
"(",
"\"MultiLanguageTextList of Language[\"",
"+",
"languageCode",
"+",
"\"] in multiLanguageTextType[\"",
"+",
"multiLanguageText",
"+",
"\"]\"",
")",
";",
"}"
] |
Get the multiLanguageText for a languageCode in a multiLanguageText type. This is done by checking if the key matches the languageCode. If it matches the value list is
returned. Thus the returned list can be empty depending on the multiLanguageText.
@param languageCode the languageCode which is checked
@param multiLanguageText the multiLanguageText type that is searched for a multiLanguageText list
@return the multiLanguageText for the languageCode in the language type
@throws NotAvailableException if no entry for the languageCode exist in the multiLanguageText type
|
[
"Get",
"the",
"multiLanguageText",
"for",
"a",
"languageCode",
"in",
"a",
"multiLanguageText",
"type",
".",
"This",
"is",
"done",
"by",
"checking",
"if",
"the",
"key",
"matches",
"the",
"languageCode",
".",
"If",
"it",
"matches",
"the",
"value",
"list",
"is",
"returned",
".",
"Thus",
"the",
"returned",
"list",
"can",
"be",
"empty",
"depending",
"on",
"the",
"multiLanguageText",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java#L259-L266
|
149,202
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java
|
MultiLanguageTextProcessor.format
|
public static MultiLanguageText.Builder format(final MultiLanguageText.Builder multiLanguageText) {
for (final MapFieldEntry.Builder entryBuilder : multiLanguageText.getEntryBuilderList()) {
final String value = entryBuilder.getValue();
entryBuilder.clearValue();
entryBuilder.setValue(format(value));
}
return multiLanguageText;
}
|
java
|
public static MultiLanguageText.Builder format(final MultiLanguageText.Builder multiLanguageText) {
for (final MapFieldEntry.Builder entryBuilder : multiLanguageText.getEntryBuilderList()) {
final String value = entryBuilder.getValue();
entryBuilder.clearValue();
entryBuilder.setValue(format(value));
}
return multiLanguageText;
}
|
[
"public",
"static",
"MultiLanguageText",
".",
"Builder",
"format",
"(",
"final",
"MultiLanguageText",
".",
"Builder",
"multiLanguageText",
")",
"{",
"for",
"(",
"final",
"MapFieldEntry",
".",
"Builder",
"entryBuilder",
":",
"multiLanguageText",
".",
"getEntryBuilderList",
"(",
")",
")",
"{",
"final",
"String",
"value",
"=",
"entryBuilder",
".",
"getValue",
"(",
")",
";",
"entryBuilder",
".",
"clearValue",
"(",
")",
";",
"entryBuilder",
".",
"setValue",
"(",
"format",
"(",
"value",
")",
")",
";",
"}",
"return",
"multiLanguageText",
";",
"}"
] |
Format the given multiLanguageText by removing duplicated white spaces, underscores and camel cases in all entries.
@param multiLanguageText the multiLanguageText to format.
@return the formatted multiLanguageText.
|
[
"Format",
"the",
"given",
"multiLanguageText",
"by",
"removing",
"duplicated",
"white",
"spaces",
"underscores",
"and",
"camel",
"cases",
"in",
"all",
"entries",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java#L275-L282
|
149,203
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java
|
MultiLanguageTextProcessor.format
|
public static String format(String multiLanguageText) {
if (multiLanguageText.isEmpty()) {
return multiLanguageText;
}
if (Character.isDigit(multiLanguageText.charAt(multiLanguageText.length() - 1))) {
for (int i = multiLanguageText.length(); i > 0; i--) {
if (!Character.isDigit(multiLanguageText.charAt(i - 1))) {
if (!Character.isLowerCase(multiLanguageText.charAt(i - 1))) {
break;
}
multiLanguageText = multiLanguageText.substring(0, i) + " " + multiLanguageText.substring(i);
break;
}
}
}
return StringProcessor.formatHumanReadable(multiLanguageText);
}
|
java
|
public static String format(String multiLanguageText) {
if (multiLanguageText.isEmpty()) {
return multiLanguageText;
}
if (Character.isDigit(multiLanguageText.charAt(multiLanguageText.length() - 1))) {
for (int i = multiLanguageText.length(); i > 0; i--) {
if (!Character.isDigit(multiLanguageText.charAt(i - 1))) {
if (!Character.isLowerCase(multiLanguageText.charAt(i - 1))) {
break;
}
multiLanguageText = multiLanguageText.substring(0, i) + " " + multiLanguageText.substring(i);
break;
}
}
}
return StringProcessor.formatHumanReadable(multiLanguageText);
}
|
[
"public",
"static",
"String",
"format",
"(",
"String",
"multiLanguageText",
")",
"{",
"if",
"(",
"multiLanguageText",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"multiLanguageText",
";",
"}",
"if",
"(",
"Character",
".",
"isDigit",
"(",
"multiLanguageText",
".",
"charAt",
"(",
"multiLanguageText",
".",
"length",
"(",
")",
"-",
"1",
")",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"multiLanguageText",
".",
"length",
"(",
")",
";",
"i",
">",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"!",
"Character",
".",
"isDigit",
"(",
"multiLanguageText",
".",
"charAt",
"(",
"i",
"-",
"1",
")",
")",
")",
"{",
"if",
"(",
"!",
"Character",
".",
"isLowerCase",
"(",
"multiLanguageText",
".",
"charAt",
"(",
"i",
"-",
"1",
")",
")",
")",
"{",
"break",
";",
"}",
"multiLanguageText",
"=",
"multiLanguageText",
".",
"substring",
"(",
"0",
",",
"i",
")",
"+",
"\" \"",
"+",
"multiLanguageText",
".",
"substring",
"(",
"i",
")",
";",
"break",
";",
"}",
"}",
"}",
"return",
"StringProcessor",
".",
"formatHumanReadable",
"(",
"multiLanguageText",
")",
";",
"}"
] |
Format the given multiLanguageText by removing duplicated white spaces, underscores and camel cases.
@param multiLanguageText the multiLanguageText to format.
@return the formatted multiLanguageText.
|
[
"Format",
"the",
"given",
"multiLanguageText",
"by",
"removing",
"duplicated",
"white",
"spaces",
"underscores",
"and",
"camel",
"cases",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java#L291-L307
|
149,204
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/ContextDefinition.java
|
ContextDefinition.setSubContexts
|
public void setSubContexts(String[] subContextOf) {
if (subContextOf == null) {
this.subContexts = StringUtils.EMPTY_STRING_ARRAY;
} else {
ProtempaUtil.checkArrayForNullElement(subContextOf,
"subContextOf");
ProtempaUtil.checkArrayForDuplicates(subContextOf, "subContextOf");
this.subContexts = subContextOf.clone();
}
}
|
java
|
public void setSubContexts(String[] subContextOf) {
if (subContextOf == null) {
this.subContexts = StringUtils.EMPTY_STRING_ARRAY;
} else {
ProtempaUtil.checkArrayForNullElement(subContextOf,
"subContextOf");
ProtempaUtil.checkArrayForDuplicates(subContextOf, "subContextOf");
this.subContexts = subContextOf.clone();
}
}
|
[
"public",
"void",
"setSubContexts",
"(",
"String",
"[",
"]",
"subContextOf",
")",
"{",
"if",
"(",
"subContextOf",
"==",
"null",
")",
"{",
"this",
".",
"subContexts",
"=",
"StringUtils",
".",
"EMPTY_STRING_ARRAY",
";",
"}",
"else",
"{",
"ProtempaUtil",
".",
"checkArrayForNullElement",
"(",
"subContextOf",
",",
"\"subContextOf\"",
")",
";",
"ProtempaUtil",
".",
"checkArrayForDuplicates",
"(",
"subContextOf",
",",
"\"subContextOf\"",
")",
";",
"this",
".",
"subContexts",
"=",
"subContextOf",
".",
"clone",
"(",
")",
";",
"}",
"}"
] |
Sets the ids of other context definitions that, together with this one,
have a specific meaning when their intervals intersect.
@param subContextOf an array of context proposition ids.
|
[
"Sets",
"the",
"ids",
"of",
"other",
"context",
"definitions",
"that",
"together",
"with",
"this",
"one",
"have",
"a",
"specific",
"meaning",
"when",
"their",
"intervals",
"intersect",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/ContextDefinition.java#L146-L155
|
149,205
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/dest/deid/CipherEncryption.java
|
CipherEncryption.decrypt
|
String decrypt(String str) throws DecryptException {
if (str == null) {
return null;
}
try {
initCiphers();
byte[] ciphertext = Base64.decodeBase64(str);
byte[] cleartext = this.decryptCipher.doFinal(ciphertext);
return new String(cleartext);
} catch (NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException ex) {
throw new DecryptException(ex);
} catch (InvalidKeyException ex) {
throw new AssertionError(ex);
}
}
|
java
|
String decrypt(String str) throws DecryptException {
if (str == null) {
return null;
}
try {
initCiphers();
byte[] ciphertext = Base64.decodeBase64(str);
byte[] cleartext = this.decryptCipher.doFinal(ciphertext);
return new String(cleartext);
} catch (NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException ex) {
throw new DecryptException(ex);
} catch (InvalidKeyException ex) {
throw new AssertionError(ex);
}
}
|
[
"String",
"decrypt",
"(",
"String",
"str",
")",
"throws",
"DecryptException",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"initCiphers",
"(",
")",
";",
"byte",
"[",
"]",
"ciphertext",
"=",
"Base64",
".",
"decodeBase64",
"(",
"str",
")",
";",
"byte",
"[",
"]",
"cleartext",
"=",
"this",
".",
"decryptCipher",
".",
"doFinal",
"(",
"ciphertext",
")",
";",
"return",
"new",
"String",
"(",
"cleartext",
")",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"|",
"NoSuchPaddingException",
"|",
"IllegalBlockSizeException",
"|",
"BadPaddingException",
"ex",
")",
"{",
"throw",
"new",
"DecryptException",
"(",
"ex",
")",
";",
"}",
"catch",
"(",
"InvalidKeyException",
"ex",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"ex",
")",
";",
"}",
"}"
] |
Decrypts the provided hex string. This method converts a hex string to a
byte array and passes the array to a decryption cipher. If an exception
is thrown, this instance may no longer be usable.
@param str the hex string to encrypt.
@return the encrypted version of the string, or <code>null</code> if the
provided string is <code>null</code>.
@throws BadPaddingException if the provided string lacks padding.
@throws IllegalBlockSizeException if the provided string otherwise cannot
be decrypted.
|
[
"Decrypts",
"the",
"provided",
"hex",
"string",
".",
"This",
"method",
"converts",
"a",
"hex",
"string",
"to",
"a",
"byte",
"array",
"and",
"passes",
"the",
"array",
"to",
"a",
"decryption",
"cipher",
".",
"If",
"an",
"exception",
"is",
"thrown",
"this",
"instance",
"may",
"no",
"longer",
"be",
"usable",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/dest/deid/CipherEncryption.java#L116-L131
|
149,206
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/proposition/interval/IntervalFactory.java
|
IntervalFactory.getInstance
|
public Interval getInstance(Long start, Granularity startGran,
Long finish, Granularity finishGran) {
List<Object> key = Arrays.asList(new Object[]{start, startGran,
finish, finishGran});
Interval result;
synchronized (cache) {
result = cache.get(key);
if (result == null) {
if (start == null || finish == null) {
result = new DefaultInterval(start, startGran, finish, finishGran);
} else {
result = new SimpleInterval(start, startGran, finish, finishGran);
}
cache.put(key, result);
}
}
return result;
}
|
java
|
public Interval getInstance(Long start, Granularity startGran,
Long finish, Granularity finishGran) {
List<Object> key = Arrays.asList(new Object[]{start, startGran,
finish, finishGran});
Interval result;
synchronized (cache) {
result = cache.get(key);
if (result == null) {
if (start == null || finish == null) {
result = new DefaultInterval(start, startGran, finish, finishGran);
} else {
result = new SimpleInterval(start, startGran, finish, finishGran);
}
cache.put(key, result);
}
}
return result;
}
|
[
"public",
"Interval",
"getInstance",
"(",
"Long",
"start",
",",
"Granularity",
"startGran",
",",
"Long",
"finish",
",",
"Granularity",
"finishGran",
")",
"{",
"List",
"<",
"Object",
">",
"key",
"=",
"Arrays",
".",
"asList",
"(",
"new",
"Object",
"[",
"]",
"{",
"start",
",",
"startGran",
",",
"finish",
",",
"finishGran",
"}",
")",
";",
"Interval",
"result",
";",
"synchronized",
"(",
"cache",
")",
"{",
"result",
"=",
"cache",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"if",
"(",
"start",
"==",
"null",
"||",
"finish",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"DefaultInterval",
"(",
"start",
",",
"startGran",
",",
"finish",
",",
"finishGran",
")",
";",
"}",
"else",
"{",
"result",
"=",
"new",
"SimpleInterval",
"(",
"start",
",",
"startGran",
",",
"finish",
",",
"finishGran",
")",
";",
"}",
"cache",
".",
"put",
"(",
"key",
",",
"result",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Returns at interval specified by the given start and finish and
granularities.
@param start a {@link Long} representing the start of the interval. If
<code>null</code>, the <code>start</code> will be unbounded.
@param startGran the {@link Granularity} of the start of the interval.
The <code>start</code> parameter's interpretation depends on the
{@link Granularity} implementation provided.
@param finish a {@link Long} representing the finish of the interval. If
<code>null</code>, the <code>finish</code> will be unbounded.
@param finishGran the {@link Granularity} of the finish of the interval.
The <code>start</code> parameter's interpretation depends on the
{@link Granularity} implementation provided.
@return an {@link Interval}.
|
[
"Returns",
"at",
"interval",
"specified",
"by",
"the",
"given",
"start",
"and",
"finish",
"and",
"granularities",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/IntervalFactory.java#L110-L127
|
149,207
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/HighLevelAbstractionFinder.java
|
HighLevelAbstractionFinder.find
|
static boolean find(
Map<List<TemporalExtendedPropositionDefinition>, Relation> epdToRelation,
List<List<TemporalExtendedPropositionDefinition>> epdPairs,
Map<TemporalExtendedPropositionDefinition, TemporalProposition> potentialInstance) {
/*
* Loop through the abstraction definition pairs for each defined
* relation. If a relation is not found, then set found to false.
*/
for (List<TemporalExtendedPropositionDefinition> tepd : epdPairs) {
if (!hasRelation(epdToRelation, potentialInstance, tepd)) {
return false;
}
}
return true;
}
|
java
|
static boolean find(
Map<List<TemporalExtendedPropositionDefinition>, Relation> epdToRelation,
List<List<TemporalExtendedPropositionDefinition>> epdPairs,
Map<TemporalExtendedPropositionDefinition, TemporalProposition> potentialInstance) {
/*
* Loop through the abstraction definition pairs for each defined
* relation. If a relation is not found, then set found to false.
*/
for (List<TemporalExtendedPropositionDefinition> tepd : epdPairs) {
if (!hasRelation(epdToRelation, potentialInstance, tepd)) {
return false;
}
}
return true;
}
|
[
"static",
"boolean",
"find",
"(",
"Map",
"<",
"List",
"<",
"TemporalExtendedPropositionDefinition",
">",
",",
"Relation",
">",
"epdToRelation",
",",
"List",
"<",
"List",
"<",
"TemporalExtendedPropositionDefinition",
">",
">",
"epdPairs",
",",
"Map",
"<",
"TemporalExtendedPropositionDefinition",
",",
"TemporalProposition",
">",
"potentialInstance",
")",
"{",
"/*\n * Loop through the abstraction definition pairs for each defined\n * relation. If a relation is not found, then set found to false.\n */",
"for",
"(",
"List",
"<",
"TemporalExtendedPropositionDefinition",
">",
"tepd",
":",
"epdPairs",
")",
"{",
"if",
"(",
"!",
"hasRelation",
"(",
"epdToRelation",
",",
"potentialInstance",
",",
"tepd",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Determines if a list of abstract parameters satisfies a complex
abstraction definition.
@param def
the {@link HighLevelAbstractionDefinition} that we're looking
for.
@param potentialInstance
a {@link List} of {@link TemporalProposition} objects
containing one instance of each component abstraction
definition in <code>def</code>.
@return <code>true</code> if <code>def</code> was found,
<code>false</code> otherwise. It also returns <code>true</code>
if no relations are defined.
|
[
"Determines",
"if",
"a",
"list",
"of",
"abstract",
"parameters",
"satisfies",
"a",
"complex",
"abstraction",
"definition",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/HighLevelAbstractionFinder.java#L54-L70
|
149,208
|
eurekaclinical/eurekaclinical-i2b2-integration-service
|
src/main/java/org/eurekaclinical/i2b2integration/service/entity/UserEntity.java
|
UserEntity.setRoles
|
@Override
public void setRoles(List<RoleEntity> inRoles) {
if (inRoles == null) {
this.roles = new ArrayList<>();
} else {
this.roles = new ArrayList<>(inRoles);
}
this.roles = inRoles;
}
|
java
|
@Override
public void setRoles(List<RoleEntity> inRoles) {
if (inRoles == null) {
this.roles = new ArrayList<>();
} else {
this.roles = new ArrayList<>(inRoles);
}
this.roles = inRoles;
}
|
[
"@",
"Override",
"public",
"void",
"setRoles",
"(",
"List",
"<",
"RoleEntity",
">",
"inRoles",
")",
"{",
"if",
"(",
"inRoles",
"==",
"null",
")",
"{",
"this",
".",
"roles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"else",
"{",
"this",
".",
"roles",
"=",
"new",
"ArrayList",
"<>",
"(",
"inRoles",
")",
";",
"}",
"this",
".",
"roles",
"=",
"inRoles",
";",
"}"
] |
Set the roles assigned to the current user.
@param inRoles A list of roles to be assigned to the user.
|
[
"Set",
"the",
"roles",
"assigned",
"to",
"the",
"current",
"user",
"."
] |
218fb8d6b5734dc076345693739d284c313f2669
|
https://github.com/eurekaclinical/eurekaclinical-i2b2-integration-service/blob/218fb8d6b5734dc076345693739d284c313f2669/src/main/java/org/eurekaclinical/i2b2integration/service/entity/UserEntity.java#L150-L158
|
149,209
|
kevoree/kevoree-library
|
mqttServer/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/ProtocolProcessor.java
|
ProtocolProcessor.publish2Subscribers
|
private void publish2Subscribers(String topic, AbstractMessage.QOSType qos, ByteBuffer origMessage, boolean retain, Integer messageID) {
Log.trace("publish2Subscribers republishing to existing subscribers that matches the topic {}", topic);
if (Log.DEBUG) {
Log.trace("content <{}>", DebugUtils.payload2Str(origMessage));
Log.trace("subscription tree {}", subscriptions.dumpTree());
}
for (final Subscription sub : subscriptions.matches(topic)) {
if(m_clientIDs.get(sub.getClientId()) == null) {
subscriptions.removeSubscription(topic, sub.getClientId());
continue;
}
if (qos.ordinal() > sub.getRequestedQos().ordinal()) {
qos = sub.getRequestedQos();
}
ByteBuffer message = origMessage.duplicate();
if (qos == AbstractMessage.QOSType.MOST_ONE && sub.isActive()) {
//QoS 0
sendPublish(sub.getClientId(), topic, qos, message, false);
} else {
//QoS 1 or 2
//if the target subscription is not clean session and is not connected => store it
if (!sub.isCleanSession() && !sub.isActive()) {
//clone the event with matching clientID
PublishEvent newPublishEvt = new PublishEvent(topic, qos, message, retain, sub.getClientId(), messageID);
m_storageService.storePublishForFuture(newPublishEvt);
} else {
//if QoS 2 then store it in temp memory
if (qos ==AbstractMessage.QOSType.EXACTLY_ONCE) {
String publishKey = String.format("%s%d", sub.getClientId(), messageID);
PublishEvent newPublishEvt = new PublishEvent(topic, qos, message, retain, sub.getClientId(), messageID);
m_storageService.addInFlight(newPublishEvt, publishKey);
}
//publish
if (sub.isActive()) {
sendPublish(sub.getClientId(), topic, qos, message, false);
}
}
}
}
}
|
java
|
private void publish2Subscribers(String topic, AbstractMessage.QOSType qos, ByteBuffer origMessage, boolean retain, Integer messageID) {
Log.trace("publish2Subscribers republishing to existing subscribers that matches the topic {}", topic);
if (Log.DEBUG) {
Log.trace("content <{}>", DebugUtils.payload2Str(origMessage));
Log.trace("subscription tree {}", subscriptions.dumpTree());
}
for (final Subscription sub : subscriptions.matches(topic)) {
if(m_clientIDs.get(sub.getClientId()) == null) {
subscriptions.removeSubscription(topic, sub.getClientId());
continue;
}
if (qos.ordinal() > sub.getRequestedQos().ordinal()) {
qos = sub.getRequestedQos();
}
ByteBuffer message = origMessage.duplicate();
if (qos == AbstractMessage.QOSType.MOST_ONE && sub.isActive()) {
//QoS 0
sendPublish(sub.getClientId(), topic, qos, message, false);
} else {
//QoS 1 or 2
//if the target subscription is not clean session and is not connected => store it
if (!sub.isCleanSession() && !sub.isActive()) {
//clone the event with matching clientID
PublishEvent newPublishEvt = new PublishEvent(topic, qos, message, retain, sub.getClientId(), messageID);
m_storageService.storePublishForFuture(newPublishEvt);
} else {
//if QoS 2 then store it in temp memory
if (qos ==AbstractMessage.QOSType.EXACTLY_ONCE) {
String publishKey = String.format("%s%d", sub.getClientId(), messageID);
PublishEvent newPublishEvt = new PublishEvent(topic, qos, message, retain, sub.getClientId(), messageID);
m_storageService.addInFlight(newPublishEvt, publishKey);
}
//publish
if (sub.isActive()) {
sendPublish(sub.getClientId(), topic, qos, message, false);
}
}
}
}
}
|
[
"private",
"void",
"publish2Subscribers",
"(",
"String",
"topic",
",",
"AbstractMessage",
".",
"QOSType",
"qos",
",",
"ByteBuffer",
"origMessage",
",",
"boolean",
"retain",
",",
"Integer",
"messageID",
")",
"{",
"Log",
".",
"trace",
"(",
"\"publish2Subscribers republishing to existing subscribers that matches the topic {}\"",
",",
"topic",
")",
";",
"if",
"(",
"Log",
".",
"DEBUG",
")",
"{",
"Log",
".",
"trace",
"(",
"\"content <{}>\"",
",",
"DebugUtils",
".",
"payload2Str",
"(",
"origMessage",
")",
")",
";",
"Log",
".",
"trace",
"(",
"\"subscription tree {}\"",
",",
"subscriptions",
".",
"dumpTree",
"(",
")",
")",
";",
"}",
"for",
"(",
"final",
"Subscription",
"sub",
":",
"subscriptions",
".",
"matches",
"(",
"topic",
")",
")",
"{",
"if",
"(",
"m_clientIDs",
".",
"get",
"(",
"sub",
".",
"getClientId",
"(",
")",
")",
"==",
"null",
")",
"{",
"subscriptions",
".",
"removeSubscription",
"(",
"topic",
",",
"sub",
".",
"getClientId",
"(",
")",
")",
";",
"continue",
";",
"}",
"if",
"(",
"qos",
".",
"ordinal",
"(",
")",
">",
"sub",
".",
"getRequestedQos",
"(",
")",
".",
"ordinal",
"(",
")",
")",
"{",
"qos",
"=",
"sub",
".",
"getRequestedQos",
"(",
")",
";",
"}",
"ByteBuffer",
"message",
"=",
"origMessage",
".",
"duplicate",
"(",
")",
";",
"if",
"(",
"qos",
"==",
"AbstractMessage",
".",
"QOSType",
".",
"MOST_ONE",
"&&",
"sub",
".",
"isActive",
"(",
")",
")",
"{",
"//QoS 0",
"sendPublish",
"(",
"sub",
".",
"getClientId",
"(",
")",
",",
"topic",
",",
"qos",
",",
"message",
",",
"false",
")",
";",
"}",
"else",
"{",
"//QoS 1 or 2",
"//if the target subscription is not clean session and is not connected => store it",
"if",
"(",
"!",
"sub",
".",
"isCleanSession",
"(",
")",
"&&",
"!",
"sub",
".",
"isActive",
"(",
")",
")",
"{",
"//clone the event with matching clientID",
"PublishEvent",
"newPublishEvt",
"=",
"new",
"PublishEvent",
"(",
"topic",
",",
"qos",
",",
"message",
",",
"retain",
",",
"sub",
".",
"getClientId",
"(",
")",
",",
"messageID",
")",
";",
"m_storageService",
".",
"storePublishForFuture",
"(",
"newPublishEvt",
")",
";",
"}",
"else",
"{",
"//if QoS 2 then store it in temp memory",
"if",
"(",
"qos",
"==",
"AbstractMessage",
".",
"QOSType",
".",
"EXACTLY_ONCE",
")",
"{",
"String",
"publishKey",
"=",
"String",
".",
"format",
"(",
"\"%s%d\"",
",",
"sub",
".",
"getClientId",
"(",
")",
",",
"messageID",
")",
";",
"PublishEvent",
"newPublishEvt",
"=",
"new",
"PublishEvent",
"(",
"topic",
",",
"qos",
",",
"message",
",",
"retain",
",",
"sub",
".",
"getClientId",
"(",
")",
",",
"messageID",
")",
";",
"m_storageService",
".",
"addInFlight",
"(",
"newPublishEvt",
",",
"publishKey",
")",
";",
"}",
"//publish",
"if",
"(",
"sub",
".",
"isActive",
"(",
")",
")",
"{",
"sendPublish",
"(",
"sub",
".",
"getClientId",
"(",
")",
",",
"topic",
",",
"qos",
",",
"message",
",",
"false",
")",
";",
"}",
"}",
"}",
"}",
"}"
] |
Flood the subscribers with the message to notify. MessageID is optional and should only used for QoS 1 and 2
|
[
"Flood",
"the",
"subscribers",
"with",
"the",
"message",
"to",
"notify",
".",
"MessageID",
"is",
"optional",
"and",
"should",
"only",
"used",
"for",
"QoS",
"1",
"and",
"2"
] |
617460e6c5881902ebc488a31ecdea179024d8f1
|
https://github.com/kevoree/kevoree-library/blob/617460e6c5881902ebc488a31ecdea179024d8f1/mqttServer/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/ProtocolProcessor.java#L294-L335
|
149,210
|
kevoree/kevoree-library
|
mqttServer/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/ProtocolProcessor.java
|
ProtocolProcessor.processPubRel
|
void processPubRel(String clientID, int messageID) {
Log.trace("PUB --PUBREL--> SRV processPubRel invoked for clientID {} ad messageID {}", clientID, messageID);
String publishKey = String.format("%s%d", clientID, messageID);
PublishEvent evt = m_storageService.retrieveQoS2Message(publishKey);
final String topic = evt.getTopic();
final AbstractMessage.QOSType qos = evt.getQos();
publish2Subscribers(topic, qos, evt.getMessage(), evt.isRetain(), evt.getMessageID());
m_storageService.removeQoS2Message(publishKey);
if (evt.isRetain()) {
m_storageService.storeRetained(topic, evt.getMessage(), qos);
}
sendPubComp(clientID, messageID);
}
|
java
|
void processPubRel(String clientID, int messageID) {
Log.trace("PUB --PUBREL--> SRV processPubRel invoked for clientID {} ad messageID {}", clientID, messageID);
String publishKey = String.format("%s%d", clientID, messageID);
PublishEvent evt = m_storageService.retrieveQoS2Message(publishKey);
final String topic = evt.getTopic();
final AbstractMessage.QOSType qos = evt.getQos();
publish2Subscribers(topic, qos, evt.getMessage(), evt.isRetain(), evt.getMessageID());
m_storageService.removeQoS2Message(publishKey);
if (evt.isRetain()) {
m_storageService.storeRetained(topic, evt.getMessage(), qos);
}
sendPubComp(clientID, messageID);
}
|
[
"void",
"processPubRel",
"(",
"String",
"clientID",
",",
"int",
"messageID",
")",
"{",
"Log",
".",
"trace",
"(",
"\"PUB --PUBREL--> SRV processPubRel invoked for clientID {} ad messageID {}\"",
",",
"clientID",
",",
"messageID",
")",
";",
"String",
"publishKey",
"=",
"String",
".",
"format",
"(",
"\"%s%d\"",
",",
"clientID",
",",
"messageID",
")",
";",
"PublishEvent",
"evt",
"=",
"m_storageService",
".",
"retrieveQoS2Message",
"(",
"publishKey",
")",
";",
"final",
"String",
"topic",
"=",
"evt",
".",
"getTopic",
"(",
")",
";",
"final",
"AbstractMessage",
".",
"QOSType",
"qos",
"=",
"evt",
".",
"getQos",
"(",
")",
";",
"publish2Subscribers",
"(",
"topic",
",",
"qos",
",",
"evt",
".",
"getMessage",
"(",
")",
",",
"evt",
".",
"isRetain",
"(",
")",
",",
"evt",
".",
"getMessageID",
"(",
")",
")",
";",
"m_storageService",
".",
"removeQoS2Message",
"(",
"publishKey",
")",
";",
"if",
"(",
"evt",
".",
"isRetain",
"(",
")",
")",
"{",
"m_storageService",
".",
"storeRetained",
"(",
"topic",
",",
"evt",
".",
"getMessage",
"(",
")",
",",
"qos",
")",
";",
"}",
"sendPubComp",
"(",
"clientID",
",",
"messageID",
")",
";",
"}"
] |
Second phase of a publish QoS2 protocol, sent by publisher to the broker. Search the stored message and publish
to all interested subscribers.
|
[
"Second",
"phase",
"of",
"a",
"publish",
"QoS2",
"protocol",
"sent",
"by",
"publisher",
"to",
"the",
"broker",
".",
"Search",
"the",
"stored",
"message",
"and",
"publish",
"to",
"all",
"interested",
"subscribers",
"."
] |
617460e6c5881902ebc488a31ecdea179024d8f1
|
https://github.com/kevoree/kevoree-library/blob/617460e6c5881902ebc488a31ecdea179024d8f1/mqttServer/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/ProtocolProcessor.java#L400-L417
|
149,211
|
kevoree/kevoree-library
|
mqttServer/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/ProtocolProcessor.java
|
ProtocolProcessor.processUnsubscribe
|
void processUnsubscribe(ServerChannel session, String clientID, List<String> topics, int messageID) {
Log.trace("processUnsubscribe invoked, removing subscription on topics {}, for clientID <{}>", topics, clientID);
for (String topic : topics) {
subscriptions.removeSubscription(topic, clientID);
}
//ack the client
UnsubAckMessage ackMessage = new UnsubAckMessage();
ackMessage.setMessageID(messageID);
Log.trace("replying with UnsubAck to MSG ID {}", messageID);
session.write(ackMessage);
}
|
java
|
void processUnsubscribe(ServerChannel session, String clientID, List<String> topics, int messageID) {
Log.trace("processUnsubscribe invoked, removing subscription on topics {}, for clientID <{}>", topics, clientID);
for (String topic : topics) {
subscriptions.removeSubscription(topic, clientID);
}
//ack the client
UnsubAckMessage ackMessage = new UnsubAckMessage();
ackMessage.setMessageID(messageID);
Log.trace("replying with UnsubAck to MSG ID {}", messageID);
session.write(ackMessage);
}
|
[
"void",
"processUnsubscribe",
"(",
"ServerChannel",
"session",
",",
"String",
"clientID",
",",
"List",
"<",
"String",
">",
"topics",
",",
"int",
"messageID",
")",
"{",
"Log",
".",
"trace",
"(",
"\"processUnsubscribe invoked, removing subscription on topics {}, for clientID <{}>\"",
",",
"topics",
",",
"clientID",
")",
";",
"for",
"(",
"String",
"topic",
":",
"topics",
")",
"{",
"subscriptions",
".",
"removeSubscription",
"(",
"topic",
",",
"clientID",
")",
";",
"}",
"//ack the client",
"UnsubAckMessage",
"ackMessage",
"=",
"new",
"UnsubAckMessage",
"(",
")",
";",
"ackMessage",
".",
"setMessageID",
"(",
"messageID",
")",
";",
"Log",
".",
"trace",
"(",
"\"replying with UnsubAck to MSG ID {}\"",
",",
"messageID",
")",
";",
"session",
".",
"write",
"(",
"ackMessage",
")",
";",
"}"
] |
Remove the clientID from topic subscription, if not previously subscribed,
doesn't reply any error
|
[
"Remove",
"the",
"clientID",
"from",
"topic",
"subscription",
"if",
"not",
"previously",
"subscribed",
"doesn",
"t",
"reply",
"any",
"error"
] |
617460e6c5881902ebc488a31ecdea179024d8f1
|
https://github.com/kevoree/kevoree-library/blob/617460e6c5881902ebc488a31ecdea179024d8f1/mqttServer/src/main/java/org/dna/mqtt/moquette/messaging/spi/impl/ProtocolProcessor.java#L485-L497
|
149,212
|
netkicorp/java-wns-resolver
|
src/main/java/com/netki/dns/DNSBootstrapService.java
|
DNSBootstrapService.getSystemDNSServers
|
public List<InetAddress> getSystemDNSServers() {
List<InetAddress> dnsServers = new ArrayList<InetAddress>();
ResolverConfig resolverConfig = new ResolverConfig();
try {
for(String dnsHostIp : resolverConfig.servers()) {
if(dnsHostIp.equals("")) continue;
dnsServers.add(InetAddress.getByName(dnsHostIp));
}
} catch (Exception e) {
e.printStackTrace();
}
return dnsServers;
}
|
java
|
public List<InetAddress> getSystemDNSServers() {
List<InetAddress> dnsServers = new ArrayList<InetAddress>();
ResolverConfig resolverConfig = new ResolverConfig();
try {
for(String dnsHostIp : resolverConfig.servers()) {
if(dnsHostIp.equals("")) continue;
dnsServers.add(InetAddress.getByName(dnsHostIp));
}
} catch (Exception e) {
e.printStackTrace();
}
return dnsServers;
}
|
[
"public",
"List",
"<",
"InetAddress",
">",
"getSystemDNSServers",
"(",
")",
"{",
"List",
"<",
"InetAddress",
">",
"dnsServers",
"=",
"new",
"ArrayList",
"<",
"InetAddress",
">",
"(",
")",
";",
"ResolverConfig",
"resolverConfig",
"=",
"new",
"ResolverConfig",
"(",
")",
";",
"try",
"{",
"for",
"(",
"String",
"dnsHostIp",
":",
"resolverConfig",
".",
"servers",
"(",
")",
")",
"{",
"if",
"(",
"dnsHostIp",
".",
"equals",
"(",
"\"\"",
")",
")",
"continue",
";",
"dnsServers",
".",
"add",
"(",
"InetAddress",
".",
"getByName",
"(",
"dnsHostIp",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"dnsServers",
";",
"}"
] |
Get System DNS Servers
@return A list of InetAddress objects contains the system's configured DNS servers
|
[
"Get",
"System",
"DNS",
"Servers"
] |
a7aad04d96c03feb05536aef189617beb4f011bc
|
https://github.com/netkicorp/java-wns-resolver/blob/a7aad04d96c03feb05536aef189617beb4f011bc/src/main/java/com/netki/dns/DNSBootstrapService.java#L24-L38
|
149,213
|
znerd/xmlenc
|
src/examples/org/znerd/xmlenc/examples/simple/Main.java
|
Main.main
|
public final static void main(String[] args) throws IOException {
Writer writer = new OutputStreamWriter(System.out, "utf-8");
XMLOutputter outputter = new XMLOutputter(writer, "iso-8859-1");
writeXML(outputter);
System.out.println();
System.out.println();
outputter.reset(writer, "utf-8");
writeXML(outputter);
}
|
java
|
public final static void main(String[] args) throws IOException {
Writer writer = new OutputStreamWriter(System.out, "utf-8");
XMLOutputter outputter = new XMLOutputter(writer, "iso-8859-1");
writeXML(outputter);
System.out.println();
System.out.println();
outputter.reset(writer, "utf-8");
writeXML(outputter);
}
|
[
"public",
"final",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"Writer",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"System",
".",
"out",
",",
"\"utf-8\"",
")",
";",
"XMLOutputter",
"outputter",
"=",
"new",
"XMLOutputter",
"(",
"writer",
",",
"\"iso-8859-1\"",
")",
";",
"writeXML",
"(",
"outputter",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"outputter",
".",
"reset",
"(",
"writer",
",",
"\"utf-8\"",
")",
";",
"writeXML",
"(",
"outputter",
")",
";",
"}"
] |
Main function.
@param args
the arguments to this function.
|
[
"Main",
"function",
"."
] |
6ff483777d9467db9990b7c7ae0158f21a243c31
|
https://github.com/znerd/xmlenc/blob/6ff483777d9467db9990b7c7ae0158f21a243c31/src/examples/org/znerd/xmlenc/examples/simple/Main.java#L20-L32
|
149,214
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/backend/AbstractBackend.java
|
AbstractBackend.fireBackendUpdated
|
protected void fireBackendUpdated(E e) {
for (int i = 0, n = this.listenerList.size(); i < n; i++) {
this.listenerList.get(i).backendUpdated(e);
}
}
|
java
|
protected void fireBackendUpdated(E e) {
for (int i = 0, n = this.listenerList.size(); i < n; i++) {
this.listenerList.get(i).backendUpdated(e);
}
}
|
[
"protected",
"void",
"fireBackendUpdated",
"(",
"E",
"e",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"this",
".",
"listenerList",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"this",
".",
"listenerList",
".",
"get",
"(",
"i",
")",
".",
"backendUpdated",
"(",
"e",
")",
";",
"}",
"}"
] |
Notifies all registered listeners when the backend has been updated.
@param e a {@link BackendUpdatedEvent} representing an update.
|
[
"Notifies",
"all",
"registered",
"listeners",
"when",
"the",
"backend",
"has",
"been",
"updated",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/backend/AbstractBackend.java#L100-L104
|
149,215
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/backend/AbstractBackend.java
|
AbstractBackend.fireUnrecoverableError
|
protected void fireUnrecoverableError(UnrecoverableBackendErrorEvent e) {
for (int i = 0, n = this.listenerList.size(); i < n; i++) {
this.listenerList.get(i).unrecoverableErrorOccurred(e);
}
}
|
java
|
protected void fireUnrecoverableError(UnrecoverableBackendErrorEvent e) {
for (int i = 0, n = this.listenerList.size(); i < n; i++) {
this.listenerList.get(i).unrecoverableErrorOccurred(e);
}
}
|
[
"protected",
"void",
"fireUnrecoverableError",
"(",
"UnrecoverableBackendErrorEvent",
"e",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"n",
"=",
"this",
".",
"listenerList",
".",
"size",
"(",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"this",
".",
"listenerList",
".",
"get",
"(",
"i",
")",
".",
"unrecoverableErrorOccurred",
"(",
"e",
")",
";",
"}",
"}"
] |
Notifies all registered listeners when an unrecoverable error has
occurred in a backend.
@param e a {@link UnrecoverableBackendErrorEvent} representing the
cause of the error.
|
[
"Notifies",
"all",
"registered",
"listeners",
"when",
"an",
"unrecoverable",
"error",
"has",
"occurred",
"in",
"a",
"backend",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/backend/AbstractBackend.java#L113-L117
|
149,216
|
ops4j/org.ops4j.pax.wicket
|
service/src/main/java/org/ops4j/pax/wicket/spi/support/BundleClassResolverHelper.java
|
BundleClassResolverHelper.register
|
public final void register() {
synchronized (lock) {
if (serviceRegistration == null) {
BundleClassResolver resolver = new BundleClassResolver();
serviceRegistration = bundleContext.registerService(SERVICE_NAMES, resolver, serviceProperties);
}
}
}
|
java
|
public final void register() {
synchronized (lock) {
if (serviceRegistration == null) {
BundleClassResolver resolver = new BundleClassResolver();
serviceRegistration = bundleContext.registerService(SERVICE_NAMES, resolver, serviceProperties);
}
}
}
|
[
"public",
"final",
"void",
"register",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"serviceRegistration",
"==",
"null",
")",
"{",
"BundleClassResolver",
"resolver",
"=",
"new",
"BundleClassResolver",
"(",
")",
";",
"serviceRegistration",
"=",
"bundleContext",
".",
"registerService",
"(",
"SERVICE_NAMES",
",",
"resolver",
",",
"serviceProperties",
")",
";",
"}",
"}",
"}"
] |
Register class resolver.
|
[
"Register",
"class",
"resolver",
"."
] |
ef7cb4bdf918e9e61ec69789b9c690567616faa9
|
https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/spi/support/BundleClassResolverHelper.java#L123-L130
|
149,217
|
eurekaclinical/protempa
|
protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/LocalConnectionManager.java
|
LocalConnectionManager.initProject
|
@SuppressWarnings("unchecked")
@Override
protected Project initProject() {
Collection errors = new ArrayList();
String projectFilePathOrURI = getProjectIdentifier();
return new Project(projectFilePathOrURI, errors);
}
|
java
|
@SuppressWarnings("unchecked")
@Override
protected Project initProject() {
Collection errors = new ArrayList();
String projectFilePathOrURI = getProjectIdentifier();
return new Project(projectFilePathOrURI, errors);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"protected",
"Project",
"initProject",
"(",
")",
"{",
"Collection",
"errors",
"=",
"new",
"ArrayList",
"(",
")",
";",
"String",
"projectFilePathOrURI",
"=",
"getProjectIdentifier",
"(",
")",
";",
"return",
"new",
"Project",
"(",
"projectFilePathOrURI",
",",
"errors",
")",
";",
"}"
] |
Opens the project specified by the file path or URI given in
the constructor.
@return a Protege {@link Project}.
@see ConnectionManager#initProject()
|
[
"Opens",
"the",
"project",
"specified",
"by",
"the",
"file",
"path",
"or",
"URI",
"given",
"in",
"the",
"constructor",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-ksb-protege/src/main/java/org/protempa/backend/ksb/protege/LocalConnectionManager.java#L56-L62
|
149,218
|
openbase/jul
|
exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java
|
StackTracePrinter.printAllStackTraces
|
public static void printAllStackTraces(final String filter, final Logger logger, final LogLevel logLevel) {
for (Map.Entry<Thread, StackTraceElement[]> entry : Thread.getAllStackTraces().entrySet()) {
if (filter == null || entry.getKey().getName().contains(filter)) {
StackTracePrinter.printStackTrace("Thread[" + entry.getKey().getName() + "] state[" + entry.getKey().getState().name() + "]", entry.getValue(), logger, logLevel);
}
}
}
|
java
|
public static void printAllStackTraces(final String filter, final Logger logger, final LogLevel logLevel) {
for (Map.Entry<Thread, StackTraceElement[]> entry : Thread.getAllStackTraces().entrySet()) {
if (filter == null || entry.getKey().getName().contains(filter)) {
StackTracePrinter.printStackTrace("Thread[" + entry.getKey().getName() + "] state[" + entry.getKey().getState().name() + "]", entry.getValue(), logger, logLevel);
}
}
}
|
[
"public",
"static",
"void",
"printAllStackTraces",
"(",
"final",
"String",
"filter",
",",
"final",
"Logger",
"logger",
",",
"final",
"LogLevel",
"logLevel",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Thread",
",",
"StackTraceElement",
"[",
"]",
">",
"entry",
":",
"Thread",
".",
"getAllStackTraces",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"filter",
"==",
"null",
"||",
"entry",
".",
"getKey",
"(",
")",
".",
"getName",
"(",
")",
".",
"contains",
"(",
"filter",
")",
")",
"{",
"StackTracePrinter",
".",
"printStackTrace",
"(",
"\"Thread[\"",
"+",
"entry",
".",
"getKey",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"] state[\"",
"+",
"entry",
".",
"getKey",
"(",
")",
".",
"getState",
"(",
")",
".",
"name",
"(",
")",
"+",
"\"]\"",
",",
"entry",
".",
"getValue",
"(",
")",
",",
"logger",
",",
"logLevel",
")",
";",
"}",
"}",
"}"
] |
Method prints the stack traces of all running java threads via the given logger.
@param filter only thread where the name of the thread contains this given {@code filter} key are printed. If the filter is null, no filtering will be performed.
@param logger the logger used for printing.
@param logLevel the level to print.
|
[
"Method",
"prints",
"the",
"stack",
"traces",
"of",
"all",
"running",
"java",
"threads",
"via",
"the",
"given",
"logger",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java#L150-L156
|
149,219
|
eurekaclinical/protempa
|
protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/RelationalDbDataSourceBackend.java
|
RelationalDbDataSourceBackend.initialize
|
@Override
public void initialize(BackendInstanceSpec config)
throws BackendInitializationException {
super.initialize(config);
if (this.mappingsFactory == null) {
setMappingsFactory(null);
}
this.relationalDatabaseSpecBuilder
= createRelationalDatabaseSpecBuilder();
}
|
java
|
@Override
public void initialize(BackendInstanceSpec config)
throws BackendInitializationException {
super.initialize(config);
if (this.mappingsFactory == null) {
setMappingsFactory(null);
}
this.relationalDatabaseSpecBuilder
= createRelationalDatabaseSpecBuilder();
}
|
[
"@",
"Override",
"public",
"void",
"initialize",
"(",
"BackendInstanceSpec",
"config",
")",
"throws",
"BackendInitializationException",
"{",
"super",
".",
"initialize",
"(",
"config",
")",
";",
"if",
"(",
"this",
".",
"mappingsFactory",
"==",
"null",
")",
"{",
"setMappingsFactory",
"(",
"null",
")",
";",
"}",
"this",
".",
"relationalDatabaseSpecBuilder",
"=",
"createRelationalDatabaseSpecBuilder",
"(",
")",
";",
"}"
] |
Collects the database connection information specified in this backend's
configuration, and uses it to try and get a SQL generator with which to
generate database queries.
@param config the {@link BackendInstanceSpec} that specifies this
backend's configuration parameters.
@throws DataSourceBackendInitializationException if bad database
connection information was provided or a SQL generator that is compatible
with the database and available drivers is not available.
|
[
"Collects",
"the",
"database",
"connection",
"information",
"specified",
"in",
"this",
"backend",
"s",
"configuration",
"and",
"uses",
"it",
"to",
"try",
"and",
"get",
"a",
"SQL",
"generator",
"with",
"which",
"to",
"generate",
"database",
"queries",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-dsb-relationaldb/src/main/java/org/protempa/backend/dsb/relationaldb/RelationalDbDataSourceBackend.java#L265-L274
|
149,220
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/DataSourceImpl.java
|
DataSourceImpl.getGranularityFactory
|
@Override
public GranularityFactory getGranularityFactory()
throws DataSourceReadException {
initializeIfNeeded();
GranularityFactory result = null;
DataSourceBackend b = null;
for (DataSourceBackend backend : getBackends()) {
result = backend.getGranularityFactory();
b = backend;
break;
}
assert result != null : "no granularity factory returned from "
+ b.getClass() + "!";
return result;
}
|
java
|
@Override
public GranularityFactory getGranularityFactory()
throws DataSourceReadException {
initializeIfNeeded();
GranularityFactory result = null;
DataSourceBackend b = null;
for (DataSourceBackend backend : getBackends()) {
result = backend.getGranularityFactory();
b = backend;
break;
}
assert result != null : "no granularity factory returned from "
+ b.getClass() + "!";
return result;
}
|
[
"@",
"Override",
"public",
"GranularityFactory",
"getGranularityFactory",
"(",
")",
"throws",
"DataSourceReadException",
"{",
"initializeIfNeeded",
"(",
")",
";",
"GranularityFactory",
"result",
"=",
"null",
";",
"DataSourceBackend",
"b",
"=",
"null",
";",
"for",
"(",
"DataSourceBackend",
"backend",
":",
"getBackends",
"(",
")",
")",
"{",
"result",
"=",
"backend",
".",
"getGranularityFactory",
"(",
")",
";",
"b",
"=",
"backend",
";",
"break",
";",
"}",
"assert",
"result",
"!=",
"null",
":",
"\"no granularity factory returned from \"",
"+",
"b",
".",
"getClass",
"(",
")",
"+",
"\"!\"",
";",
"return",
"result",
";",
"}"
] |
Returns an object for accessing the granularity of returned data from the
schema adaptor for this data source.
@return a {@link GranularityFactory}, or <code>null</code> if the data
source could not be initialized or the schema adaptor returned a null
GranularityFactory.
@throws TerminologyAdaptorInitializationException if the terminology
adaptor could not be initialized.
@throws SchemaAdaptorInitializationException if the schema adaptor could
not be initialized.
@see SchemaAdaptor#getGranularityFactory()
|
[
"Returns",
"an",
"object",
"for",
"accessing",
"the",
"granularity",
"of",
"returned",
"data",
"from",
"the",
"schema",
"adaptor",
"for",
"this",
"data",
"source",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/DataSourceImpl.java#L151-L165
|
149,221
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/DataSourceImpl.java
|
DataSourceImpl.getUnitFactory
|
@Override
public UnitFactory getUnitFactory() throws DataSourceReadException {
initializeIfNeeded();
UnitFactory result = null;
DataSourceBackend b = null;
for (DataSourceBackend backend : getBackends()) {
result = backend.getUnitFactory();
b = backend;
break;
}
assert result != null : "no unit factory returned from "
+ b.getClass() + "!";
return result;
}
|
java
|
@Override
public UnitFactory getUnitFactory() throws DataSourceReadException {
initializeIfNeeded();
UnitFactory result = null;
DataSourceBackend b = null;
for (DataSourceBackend backend : getBackends()) {
result = backend.getUnitFactory();
b = backend;
break;
}
assert result != null : "no unit factory returned from "
+ b.getClass() + "!";
return result;
}
|
[
"@",
"Override",
"public",
"UnitFactory",
"getUnitFactory",
"(",
")",
"throws",
"DataSourceReadException",
"{",
"initializeIfNeeded",
"(",
")",
";",
"UnitFactory",
"result",
"=",
"null",
";",
"DataSourceBackend",
"b",
"=",
"null",
";",
"for",
"(",
"DataSourceBackend",
"backend",
":",
"getBackends",
"(",
")",
")",
"{",
"result",
"=",
"backend",
".",
"getUnitFactory",
"(",
")",
";",
"b",
"=",
"backend",
";",
"break",
";",
"}",
"assert",
"result",
"!=",
"null",
":",
"\"no unit factory returned from \"",
"+",
"b",
".",
"getClass",
"(",
")",
"+",
"\"!\"",
";",
"return",
"result",
";",
"}"
] |
Returns the length units of returned data from this data source.
@return a {@link UnitFactory}, or <code>null</code> if the data source
could not be initialized or the schema adaptor returned a null
UnitFactory.
@throws DataSourceReadException if the data source could not be
initialized.
|
[
"Returns",
"the",
"length",
"units",
"of",
"returned",
"data",
"from",
"this",
"data",
"source",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/DataSourceImpl.java#L176-L189
|
149,222
|
eurekaclinical/protempa
|
protempa-framework/src/main/java/org/protempa/ExtendedPropositionDefinition.java
|
ExtendedPropositionDefinition.getMatches
|
boolean getMatches(Proposition proposition, Collection<String> propIds) throws KnowledgeSourceReadException {
if (proposition == null) {
return false;
} else {
String pId = proposition.getId();
if (this.propositionId != null && !propIds.contains(pId)) {
return false;
}
// check that all property constraints are met
for (PropertyConstraint pc : this.propertyConstraints) {
if (!pc.isSatisfiedBy(proposition)) {
return false;
}
}
return true;
}
}
|
java
|
boolean getMatches(Proposition proposition, Collection<String> propIds) throws KnowledgeSourceReadException {
if (proposition == null) {
return false;
} else {
String pId = proposition.getId();
if (this.propositionId != null && !propIds.contains(pId)) {
return false;
}
// check that all property constraints are met
for (PropertyConstraint pc : this.propertyConstraints) {
if (!pc.isSatisfiedBy(proposition)) {
return false;
}
}
return true;
}
}
|
[
"boolean",
"getMatches",
"(",
"Proposition",
"proposition",
",",
"Collection",
"<",
"String",
">",
"propIds",
")",
"throws",
"KnowledgeSourceReadException",
"{",
"if",
"(",
"proposition",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"String",
"pId",
"=",
"proposition",
".",
"getId",
"(",
")",
";",
"if",
"(",
"this",
".",
"propositionId",
"!=",
"null",
"&&",
"!",
"propIds",
".",
"contains",
"(",
"pId",
")",
")",
"{",
"return",
"false",
";",
"}",
"// check that all property constraints are met",
"for",
"(",
"PropertyConstraint",
"pc",
":",
"this",
".",
"propertyConstraints",
")",
"{",
"if",
"(",
"!",
"pc",
".",
"isSatisfiedBy",
"(",
"proposition",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}"
] |
Returns whether a proposition has the same id and value, and consistent
duration as specified by this extended parameter definition.
@param proposition
a <code>Proposition</code>
@return <code>true</code> if <code>proposition</code> has the same id and
value, consistent duration, and property values that match any
property constraints as specified by this extended parameter
definition, or <code>false</code> if not, or if
<code>proposition</code> is <code>null</code>.
|
[
"Returns",
"whether",
"a",
"proposition",
"has",
"the",
"same",
"id",
"and",
"value",
"and",
"consistent",
"duration",
"as",
"specified",
"by",
"this",
"extended",
"parameter",
"definition",
"."
] |
5a620d1a407c7a5426d1cf17d47b97717cf71634
|
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/ExtendedPropositionDefinition.java#L88-L105
|
149,223
|
ebean-orm/querybean-agent-now-merged-into-ebean-agent-
|
src/main/java/io/ebean/typequery/agent/CombinedTransform.java
|
CombinedTransform.transform
|
public Response transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] origBytes) throws IllegalClassFormatException {
byte[] transformed = first.transform(loader, className, classBeingRedefined, protectionDomain, origBytes);
boolean firstEnhanced = (transformed != null);
byte[] nextBytes = (transformed != null) ? transformed : origBytes;
byte[] finalTransformed = second.transform(loader, className, classBeingRedefined, protectionDomain, nextBytes);
if (finalTransformed != null) {
return new Response(finalTransformed, firstEnhanced, true);
} else if (transformed != null) {
return new Response(transformed, firstEnhanced, false);
}
return Response.NOT_TRANSFORMED;
}
|
java
|
public Response transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] origBytes) throws IllegalClassFormatException {
byte[] transformed = first.transform(loader, className, classBeingRedefined, protectionDomain, origBytes);
boolean firstEnhanced = (transformed != null);
byte[] nextBytes = (transformed != null) ? transformed : origBytes;
byte[] finalTransformed = second.transform(loader, className, classBeingRedefined, protectionDomain, nextBytes);
if (finalTransformed != null) {
return new Response(finalTransformed, firstEnhanced, true);
} else if (transformed != null) {
return new Response(transformed, firstEnhanced, false);
}
return Response.NOT_TRANSFORMED;
}
|
[
"public",
"Response",
"transform",
"(",
"ClassLoader",
"loader",
",",
"String",
"className",
",",
"Class",
"<",
"?",
">",
"classBeingRedefined",
",",
"ProtectionDomain",
"protectionDomain",
",",
"byte",
"[",
"]",
"origBytes",
")",
"throws",
"IllegalClassFormatException",
"{",
"byte",
"[",
"]",
"transformed",
"=",
"first",
".",
"transform",
"(",
"loader",
",",
"className",
",",
"classBeingRedefined",
",",
"protectionDomain",
",",
"origBytes",
")",
";",
"boolean",
"firstEnhanced",
"=",
"(",
"transformed",
"!=",
"null",
")",
";",
"byte",
"[",
"]",
"nextBytes",
"=",
"(",
"transformed",
"!=",
"null",
")",
"?",
"transformed",
":",
"origBytes",
";",
"byte",
"[",
"]",
"finalTransformed",
"=",
"second",
".",
"transform",
"(",
"loader",
",",
"className",
",",
"classBeingRedefined",
",",
"protectionDomain",
",",
"nextBytes",
")",
";",
"if",
"(",
"finalTransformed",
"!=",
"null",
")",
"{",
"return",
"new",
"Response",
"(",
"finalTransformed",
",",
"firstEnhanced",
",",
"true",
")",
";",
"}",
"else",
"if",
"(",
"transformed",
"!=",
"null",
")",
"{",
"return",
"new",
"Response",
"(",
"transformed",
",",
"firstEnhanced",
",",
"false",
")",
";",
"}",
"return",
"Response",
".",
"NOT_TRANSFORMED",
";",
"}"
] |
Perform the combined enhancement.
|
[
"Perform",
"the",
"combined",
"enhancement",
"."
] |
a063554fabdbed15ff5e10ad0a0b53b67e039006
|
https://github.com/ebean-orm/querybean-agent-now-merged-into-ebean-agent-/blob/a063554fabdbed15ff5e10ad0a0b53b67e039006/src/main/java/io/ebean/typequery/agent/CombinedTransform.java#L31-L46
|
149,224
|
openbase/jul
|
schedule/src/main/java/org/openbase/jul/schedule/MultiFuture.java
|
MultiFuture.cancel
|
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
boolean success = true;
for (Future<FUTURE_TYPE> future : futureList) {
success &= future.cancel(true);
}
return success;
}
|
java
|
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
boolean success = true;
for (Future<FUTURE_TYPE> future : futureList) {
success &= future.cancel(true);
}
return success;
}
|
[
"@",
"Override",
"public",
"boolean",
"cancel",
"(",
"boolean",
"mayInterruptIfRunning",
")",
"{",
"boolean",
"success",
"=",
"true",
";",
"for",
"(",
"Future",
"<",
"FUTURE_TYPE",
">",
"future",
":",
"futureList",
")",
"{",
"success",
"&=",
"future",
".",
"cancel",
"(",
"true",
")",
";",
"}",
"return",
"success",
";",
"}"
] |
Cancels all internal futures.
@param mayInterruptIfRunning defines if waiting threads should be interrupted.
@return true if all subfutures are successfully canceled.
|
[
"Cancels",
"all",
"internal",
"futures",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/schedule/src/main/java/org/openbase/jul/schedule/MultiFuture.java#L54-L61
|
149,225
|
openbase/jul
|
schedule/src/main/java/org/openbase/jul/schedule/MultiFuture.java
|
MultiFuture.isCancelled
|
@Override
public boolean isCancelled() {
boolean canceled = false;
for (Future<FUTURE_TYPE> future : futureList) {
if (!future.isDone()) {
return false;
}
canceled |= future.isCancelled();
}
return canceled;
}
|
java
|
@Override
public boolean isCancelled() {
boolean canceled = false;
for (Future<FUTURE_TYPE> future : futureList) {
if (!future.isDone()) {
return false;
}
canceled |= future.isCancelled();
}
return canceled;
}
|
[
"@",
"Override",
"public",
"boolean",
"isCancelled",
"(",
")",
"{",
"boolean",
"canceled",
"=",
"false",
";",
"for",
"(",
"Future",
"<",
"FUTURE_TYPE",
">",
"future",
":",
"futureList",
")",
"{",
"if",
"(",
"!",
"future",
".",
"isDone",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"canceled",
"|=",
"future",
".",
"isCancelled",
"(",
")",
";",
"}",
"return",
"canceled",
";",
"}"
] |
Method returns true if at least one subfutures was canceled. In case there are still processing futures
remaining, than false is returned in any case. False is returned as well when all futures are done but none was canceled.
@return see method description.
|
[
"Method",
"returns",
"true",
"if",
"at",
"least",
"one",
"subfutures",
"was",
"canceled",
".",
"In",
"case",
"there",
"are",
"still",
"processing",
"futures",
"remaining",
"than",
"false",
"is",
"returned",
"in",
"any",
"case",
".",
"False",
"is",
"returned",
"as",
"well",
"when",
"all",
"futures",
"are",
"done",
"but",
"none",
"was",
"canceled",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/schedule/src/main/java/org/openbase/jul/schedule/MultiFuture.java#L69-L79
|
149,226
|
openbase/jul
|
schedule/src/main/java/org/openbase/jul/schedule/MultiFuture.java
|
MultiFuture.isDone
|
@Override
public boolean isDone() {
for (Future<FUTURE_TYPE> future : futureList) {
if (!future.isDone()) {
return false;
}
}
return true;
}
|
java
|
@Override
public boolean isDone() {
for (Future<FUTURE_TYPE> future : futureList) {
if (!future.isDone()) {
return false;
}
}
return true;
}
|
[
"@",
"Override",
"public",
"boolean",
"isDone",
"(",
")",
"{",
"for",
"(",
"Future",
"<",
"FUTURE_TYPE",
">",
"future",
":",
"futureList",
")",
"{",
"if",
"(",
"!",
"future",
".",
"isDone",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
Method checks if the subfutures are done.
@return true if all futures are done, otherwise false.
|
[
"Method",
"checks",
"if",
"the",
"subfutures",
"are",
"done",
"."
] |
662e98c3a853085e475be54c3be3deb72193c72d
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/schedule/src/main/java/org/openbase/jul/schedule/MultiFuture.java#L86-L94
|
149,227
|
geomajas/geomajas-project-graphics
|
graphics/src/main/java/org/geomajas/graphics/client/util/CopyUtil.java
|
CopyUtil.deepCopyCoordinates
|
public static Coordinate[] deepCopyCoordinates(Coordinate[] coordinatesOriginal) {
if (coordinatesOriginal != null) {
Coordinate[] copy = new Coordinate[coordinatesOriginal.length];
for (int i = 0; i < coordinatesOriginal.length; i++) {
copy[i] = deepCopyCoordinate(coordinatesOriginal[i]);
}
return copy;
}
return null;
}
|
java
|
public static Coordinate[] deepCopyCoordinates(Coordinate[] coordinatesOriginal) {
if (coordinatesOriginal != null) {
Coordinate[] copy = new Coordinate[coordinatesOriginal.length];
for (int i = 0; i < coordinatesOriginal.length; i++) {
copy[i] = deepCopyCoordinate(coordinatesOriginal[i]);
}
return copy;
}
return null;
}
|
[
"public",
"static",
"Coordinate",
"[",
"]",
"deepCopyCoordinates",
"(",
"Coordinate",
"[",
"]",
"coordinatesOriginal",
")",
"{",
"if",
"(",
"coordinatesOriginal",
"!=",
"null",
")",
"{",
"Coordinate",
"[",
"]",
"copy",
"=",
"new",
"Coordinate",
"[",
"coordinatesOriginal",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"coordinatesOriginal",
".",
"length",
";",
"i",
"++",
")",
"{",
"copy",
"[",
"i",
"]",
"=",
"deepCopyCoordinate",
"(",
"coordinatesOriginal",
"[",
"i",
"]",
")",
";",
"}",
"return",
"copy",
";",
"}",
"return",
"null",
";",
"}"
] |
Copy values of array of coordinates to new array.
@param coordinatesOriginal
@return
|
[
"Copy",
"values",
"of",
"array",
"of",
"coordinates",
"to",
"new",
"array",
"."
] |
1104196640e0ba455b8a619e774352a8e1e319ba
|
https://github.com/geomajas/geomajas-project-graphics/blob/1104196640e0ba455b8a619e774352a8e1e319ba/graphics/src/main/java/org/geomajas/graphics/client/util/CopyUtil.java#L67-L76
|
149,228
|
Viascom/groundwork
|
service-result/src/main/java/ch/viascom/groundwork/serviceresult/exception/ServiceException.java
|
ServiceException.setException
|
public ServiceException setException(Throwable innerException) {
ByteArrayOutputStream messageOutputStream = new ByteArrayOutputStream();
innerException.printStackTrace(new PrintStream(messageOutputStream));
String exceptionMessage = messageOutputStream.toString();
this.fault.setException(exceptionMessage);
return this;
}
|
java
|
public ServiceException setException(Throwable innerException) {
ByteArrayOutputStream messageOutputStream = new ByteArrayOutputStream();
innerException.printStackTrace(new PrintStream(messageOutputStream));
String exceptionMessage = messageOutputStream.toString();
this.fault.setException(exceptionMessage);
return this;
}
|
[
"public",
"ServiceException",
"setException",
"(",
"Throwable",
"innerException",
")",
"{",
"ByteArrayOutputStream",
"messageOutputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"innerException",
".",
"printStackTrace",
"(",
"new",
"PrintStream",
"(",
"messageOutputStream",
")",
")",
";",
"String",
"exceptionMessage",
"=",
"messageOutputStream",
".",
"toString",
"(",
")",
";",
"this",
".",
"fault",
".",
"setException",
"(",
"exceptionMessage",
")",
";",
"return",
"this",
";",
"}"
] |
Sets the exception which caused this service exception.
It's important to set this exception to understand
and reproduce the error!
@param innerException Underlying exception
|
[
"Sets",
"the",
"exception",
"which",
"caused",
"this",
"service",
"exception",
".",
"It",
"s",
"important",
"to",
"set",
"this",
"exception",
"to",
"understand",
"and",
"reproduce",
"the",
"error!"
] |
d3f7d0df65e2e75861fc7db938090683f2cdf919
|
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/service-result/src/main/java/ch/viascom/groundwork/serviceresult/exception/ServiceException.java#L71-L80
|
149,229
|
julienledem/brennus
|
brennus-asm/src/main/java/brennus/asm/specializer/Specializer.java
|
Specializer.specializeInstance
|
private Object specializeInstance(ClassDescriptor specializedClass, Object t) {
try (Logger l = new Logger("specializeInstance(" + specializedClass.getSpecializedClass().getSimpleName() + " , " + t + ")")) {
if (!specializedClass.isSpecialized()) {
l.log("value unchanged");
return t;
}
l.log("Creating new instance");
Object newInstance = specializedClass.getSpecializedClass().newInstance();
l.log("setting field values:");
Class<?> c = t.getClass();
l.log("from class " + c.getSimpleName() + " to class " + specializedClass.getSpecializedClass().getSimpleName());
while (c != null && specializedClass != null) {
for (Field field : c.getDeclaredFields()) {
field.setAccessible(true);
Object value = field.get(t);
FieldDescriptor fieldDescriptor = specializedClass.getFields().get(field.getName());
if (fieldDescriptor != null && fieldDescriptor.getSpecializedClass().isSpecialized()) {
value = specializeInstance(fieldDescriptor.getSpecializedClass(), value);
l.log("- specialized " + newInstance.getClass().getSimpleName() + "." + field.getName() + " = " + value);
} else {
l.log("- copied " + newInstance.getClass().getSimpleName() + "." + field.getName() + " = " + value);
}
Field newField = newInstance.getClass().getField(field.getName());
newField.set(newInstance, value);
}
c = c.getSuperclass();
specializedClass = specializedClass.getParent();
}
return newInstance;
} catch (InstantiationException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
throw new SpecializationException("Could not create instance of the specialized class " + specializedClass.specializedClass.getSimpleName(), e);
}
}
|
java
|
private Object specializeInstance(ClassDescriptor specializedClass, Object t) {
try (Logger l = new Logger("specializeInstance(" + specializedClass.getSpecializedClass().getSimpleName() + " , " + t + ")")) {
if (!specializedClass.isSpecialized()) {
l.log("value unchanged");
return t;
}
l.log("Creating new instance");
Object newInstance = specializedClass.getSpecializedClass().newInstance();
l.log("setting field values:");
Class<?> c = t.getClass();
l.log("from class " + c.getSimpleName() + " to class " + specializedClass.getSpecializedClass().getSimpleName());
while (c != null && specializedClass != null) {
for (Field field : c.getDeclaredFields()) {
field.setAccessible(true);
Object value = field.get(t);
FieldDescriptor fieldDescriptor = specializedClass.getFields().get(field.getName());
if (fieldDescriptor != null && fieldDescriptor.getSpecializedClass().isSpecialized()) {
value = specializeInstance(fieldDescriptor.getSpecializedClass(), value);
l.log("- specialized " + newInstance.getClass().getSimpleName() + "." + field.getName() + " = " + value);
} else {
l.log("- copied " + newInstance.getClass().getSimpleName() + "." + field.getName() + " = " + value);
}
Field newField = newInstance.getClass().getField(field.getName());
newField.set(newInstance, value);
}
c = c.getSuperclass();
specializedClass = specializedClass.getParent();
}
return newInstance;
} catch (InstantiationException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
throw new SpecializationException("Could not create instance of the specialized class " + specializedClass.specializedClass.getSimpleName(), e);
}
}
|
[
"private",
"Object",
"specializeInstance",
"(",
"ClassDescriptor",
"specializedClass",
",",
"Object",
"t",
")",
"{",
"try",
"(",
"Logger",
"l",
"=",
"new",
"Logger",
"(",
"\"specializeInstance(\"",
"+",
"specializedClass",
".",
"getSpecializedClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\" , \"",
"+",
"t",
"+",
"\")\"",
")",
")",
"{",
"if",
"(",
"!",
"specializedClass",
".",
"isSpecialized",
"(",
")",
")",
"{",
"l",
".",
"log",
"(",
"\"value unchanged\"",
")",
";",
"return",
"t",
";",
"}",
"l",
".",
"log",
"(",
"\"Creating new instance\"",
")",
";",
"Object",
"newInstance",
"=",
"specializedClass",
".",
"getSpecializedClass",
"(",
")",
".",
"newInstance",
"(",
")",
";",
"l",
".",
"log",
"(",
"\"setting field values:\"",
")",
";",
"Class",
"<",
"?",
">",
"c",
"=",
"t",
".",
"getClass",
"(",
")",
";",
"l",
".",
"log",
"(",
"\"from class \"",
"+",
"c",
".",
"getSimpleName",
"(",
")",
"+",
"\" to class \"",
"+",
"specializedClass",
".",
"getSpecializedClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"while",
"(",
"c",
"!=",
"null",
"&&",
"specializedClass",
"!=",
"null",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"c",
".",
"getDeclaredFields",
"(",
")",
")",
"{",
"field",
".",
"setAccessible",
"(",
"true",
")",
";",
"Object",
"value",
"=",
"field",
".",
"get",
"(",
"t",
")",
";",
"FieldDescriptor",
"fieldDescriptor",
"=",
"specializedClass",
".",
"getFields",
"(",
")",
".",
"get",
"(",
"field",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"fieldDescriptor",
"!=",
"null",
"&&",
"fieldDescriptor",
".",
"getSpecializedClass",
"(",
")",
".",
"isSpecialized",
"(",
")",
")",
"{",
"value",
"=",
"specializeInstance",
"(",
"fieldDescriptor",
".",
"getSpecializedClass",
"(",
")",
",",
"value",
")",
";",
"l",
".",
"log",
"(",
"\"- specialized \"",
"+",
"newInstance",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\".\"",
"+",
"field",
".",
"getName",
"(",
")",
"+",
"\" = \"",
"+",
"value",
")",
";",
"}",
"else",
"{",
"l",
".",
"log",
"(",
"\"- copied \"",
"+",
"newInstance",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\".\"",
"+",
"field",
".",
"getName",
"(",
")",
"+",
"\" = \"",
"+",
"value",
")",
";",
"}",
"Field",
"newField",
"=",
"newInstance",
".",
"getClass",
"(",
")",
".",
"getField",
"(",
"field",
".",
"getName",
"(",
")",
")",
";",
"newField",
".",
"set",
"(",
"newInstance",
",",
"value",
")",
";",
"}",
"c",
"=",
"c",
".",
"getSuperclass",
"(",
")",
";",
"specializedClass",
"=",
"specializedClass",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"newInstance",
";",
"}",
"catch",
"(",
"InstantiationException",
"|",
"IllegalAccessException",
"|",
"NoSuchFieldException",
"|",
"SecurityException",
"e",
")",
"{",
"throw",
"new",
"SpecializationException",
"(",
"\"Could not create instance of the specialized class \"",
"+",
"specializedClass",
".",
"specializedClass",
".",
"getSimpleName",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] |
creates a specialized copy of the given instance
@param specializedClass target specialized class to create an instance of
@param t the object to copy and specialize
@return the specialized instance. Should be functionally equivalent to t
|
[
"creates",
"a",
"specialized",
"copy",
"of",
"the",
"given",
"instance"
] |
0798fb565d95af19ddc5accd084e58c4e882dbd0
|
https://github.com/julienledem/brennus/blob/0798fb565d95af19ddc5accd084e58c4e882dbd0/brennus-asm/src/main/java/brennus/asm/specializer/Specializer.java#L79-L111
|
149,230
|
cloudbees/bees-maven-components
|
src/main/java/com/cloudbees/sdk/maven/RepositorySystemModule.java
|
RepositorySystemModule.getRemoteRepositories
|
@Provides @Singleton
public List<RemoteRepository> getRemoteRepositories(
SettingsDecrypter decrypter,
ExtensionList<RemoteRepositoryDecorator> decorators) {
List<RemoteRepository> repositories = new ArrayList<RemoteRepository>();
MavenDependencyResolverSettings resolverSettings = new MavenDependencyResolverSettings();
resolverSettings.setUseMavenCentral(true);
List<RemoteRepository> repos = resolverSettings.getRemoteRepositories();
for (RemoteRepository remoteRepository : repos) {
Server server = resolverSettings.getSettings().getServer(remoteRepository.getId());
if (server != null) {
server = decrypter.decrypt(new DefaultSettingsDecryptionRequest(server)).getServer();
remoteRepository.setAuthentication(new Authentication(server.getUsername(), server.getPassword(), server.getPrivateKey(), server.getPassphrase()));
}
repositories.add(decorate(remoteRepository, decorators));
}
RemoteRepository r = new RemoteRepository("cloudbees-public-release", "default", "https://repository-cloudbees.forge.cloudbees.com/public-release/");
repositories.add(decorate(r,decorators));
return repositories;
}
|
java
|
@Provides @Singleton
public List<RemoteRepository> getRemoteRepositories(
SettingsDecrypter decrypter,
ExtensionList<RemoteRepositoryDecorator> decorators) {
List<RemoteRepository> repositories = new ArrayList<RemoteRepository>();
MavenDependencyResolverSettings resolverSettings = new MavenDependencyResolverSettings();
resolverSettings.setUseMavenCentral(true);
List<RemoteRepository> repos = resolverSettings.getRemoteRepositories();
for (RemoteRepository remoteRepository : repos) {
Server server = resolverSettings.getSettings().getServer(remoteRepository.getId());
if (server != null) {
server = decrypter.decrypt(new DefaultSettingsDecryptionRequest(server)).getServer();
remoteRepository.setAuthentication(new Authentication(server.getUsername(), server.getPassword(), server.getPrivateKey(), server.getPassphrase()));
}
repositories.add(decorate(remoteRepository, decorators));
}
RemoteRepository r = new RemoteRepository("cloudbees-public-release", "default", "https://repository-cloudbees.forge.cloudbees.com/public-release/");
repositories.add(decorate(r,decorators));
return repositories;
}
|
[
"@",
"Provides",
"@",
"Singleton",
"public",
"List",
"<",
"RemoteRepository",
">",
"getRemoteRepositories",
"(",
"SettingsDecrypter",
"decrypter",
",",
"ExtensionList",
"<",
"RemoteRepositoryDecorator",
">",
"decorators",
")",
"{",
"List",
"<",
"RemoteRepository",
">",
"repositories",
"=",
"new",
"ArrayList",
"<",
"RemoteRepository",
">",
"(",
")",
";",
"MavenDependencyResolverSettings",
"resolverSettings",
"=",
"new",
"MavenDependencyResolverSettings",
"(",
")",
";",
"resolverSettings",
".",
"setUseMavenCentral",
"(",
"true",
")",
";",
"List",
"<",
"RemoteRepository",
">",
"repos",
"=",
"resolverSettings",
".",
"getRemoteRepositories",
"(",
")",
";",
"for",
"(",
"RemoteRepository",
"remoteRepository",
":",
"repos",
")",
"{",
"Server",
"server",
"=",
"resolverSettings",
".",
"getSettings",
"(",
")",
".",
"getServer",
"(",
"remoteRepository",
".",
"getId",
"(",
")",
")",
";",
"if",
"(",
"server",
"!=",
"null",
")",
"{",
"server",
"=",
"decrypter",
".",
"decrypt",
"(",
"new",
"DefaultSettingsDecryptionRequest",
"(",
"server",
")",
")",
".",
"getServer",
"(",
")",
";",
"remoteRepository",
".",
"setAuthentication",
"(",
"new",
"Authentication",
"(",
"server",
".",
"getUsername",
"(",
")",
",",
"server",
".",
"getPassword",
"(",
")",
",",
"server",
".",
"getPrivateKey",
"(",
")",
",",
"server",
".",
"getPassphrase",
"(",
")",
")",
")",
";",
"}",
"repositories",
".",
"add",
"(",
"decorate",
"(",
"remoteRepository",
",",
"decorators",
")",
")",
";",
"}",
"RemoteRepository",
"r",
"=",
"new",
"RemoteRepository",
"(",
"\"cloudbees-public-release\"",
",",
"\"default\"",
",",
"\"https://repository-cloudbees.forge.cloudbees.com/public-release/\"",
")",
";",
"repositories",
".",
"add",
"(",
"decorate",
"(",
"r",
",",
"decorators",
")",
")",
";",
"return",
"repositories",
";",
"}"
] |
List of remote repositories to resolve artifacts from.
|
[
"List",
"of",
"remote",
"repositories",
"to",
"resolve",
"artifacts",
"from",
"."
] |
b4410c4826c38a83c209286dad847f3bdfad682a
|
https://github.com/cloudbees/bees-maven-components/blob/b4410c4826c38a83c209286dad847f3bdfad682a/src/main/java/com/cloudbees/sdk/maven/RepositorySystemModule.java#L106-L126
|
149,231
|
Viascom/groundwork
|
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java
|
FoxHttpClientBuilder.activteGZipResponseInterceptor
|
public FoxHttpClientBuilder activteGZipResponseInterceptor(int weight) throws FoxHttpException {
foxHttpClient.register(FoxHttpInterceptorType.RESPONSE, new GZipResponseInterceptor(weight));
return this;
}
|
java
|
public FoxHttpClientBuilder activteGZipResponseInterceptor(int weight) throws FoxHttpException {
foxHttpClient.register(FoxHttpInterceptorType.RESPONSE, new GZipResponseInterceptor(weight));
return this;
}
|
[
"public",
"FoxHttpClientBuilder",
"activteGZipResponseInterceptor",
"(",
"int",
"weight",
")",
"throws",
"FoxHttpException",
"{",
"foxHttpClient",
".",
"register",
"(",
"FoxHttpInterceptorType",
".",
"RESPONSE",
",",
"new",
"GZipResponseInterceptor",
"(",
"weight",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Automatic gzip response parser.
@param weight weight of the interceptor
@return FoxHttpClientBuilder (this)
@throws FoxHttpException Throws an exception if the interceptor does not match the type
|
[
"Automatic",
"gzip",
"response",
"parser",
"."
] |
d3f7d0df65e2e75861fc7db938090683f2cdf919
|
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java#L156-L159
|
149,232
|
Viascom/groundwork
|
foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java
|
FoxHttpClientBuilder.addFoxHttpAuthorization
|
public FoxHttpClientBuilder addFoxHttpAuthorization(FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpAuthorization foxHttpAuthorization) {
foxHttpClient.getFoxHttpAuthorizationStrategy().addAuthorization(foxHttpAuthorizationScope, foxHttpAuthorization);
return this;
}
|
java
|
public FoxHttpClientBuilder addFoxHttpAuthorization(FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpAuthorization foxHttpAuthorization) {
foxHttpClient.getFoxHttpAuthorizationStrategy().addAuthorization(foxHttpAuthorizationScope, foxHttpAuthorization);
return this;
}
|
[
"public",
"FoxHttpClientBuilder",
"addFoxHttpAuthorization",
"(",
"FoxHttpAuthorizationScope",
"foxHttpAuthorizationScope",
",",
"FoxHttpAuthorization",
"foxHttpAuthorization",
")",
"{",
"foxHttpClient",
".",
"getFoxHttpAuthorizationStrategy",
"(",
")",
".",
"addAuthorization",
"(",
"foxHttpAuthorizationScope",
",",
"foxHttpAuthorization",
")",
";",
"return",
"this",
";",
"}"
] |
Add a Authorization to the AuthorizationStrategy
@param foxHttpAuthorizationScope Scope of the authorization
@param foxHttpAuthorization Authorization itself
@return FoxHttpClientBuilder (this)
|
[
"Add",
"a",
"Authorization",
"to",
"the",
"AuthorizationStrategy"
] |
d3f7d0df65e2e75861fc7db938090683f2cdf919
|
https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/builder/FoxHttpClientBuilder.java#L213-L216
|
149,233
|
javagl/Common
|
src/main/java/de/javagl/common/beans/VerboseXmlEncoder.java
|
VerboseXmlEncoder.forceWritingEnumValue
|
static void forceWritingEnumValue(
VerboseXmlEncoder encoder, Object object)
{
Field valueToExpressionField = null;
Field refsField = null;
try
{
Class<?> encoderClass = encoder.getClass().getSuperclass();
valueToExpressionField =
encoderClass.getDeclaredField("valueToExpression");
valueToExpressionField.setAccessible(true);
Object valueToExpressionObject =
valueToExpressionField.get(encoder);
Map<?,?> valueToExpression = (Map<?,?>)valueToExpressionObject;
Object valueData = valueToExpression.get(object);
if (valueData != null)
{
Class<?> valueDataClass = valueData.getClass();
refsField = valueDataClass.getDeclaredField("refs");
refsField.setAccessible(true);
refsField.setInt(valueData, 0);
}
}
catch (NoSuchFieldException e)
{
logger.warning(e.toString());
}
catch (SecurityException e)
{
logger.warning(e.toString());
}
catch (IllegalArgumentException e)
{
logger.warning(e.toString());
}
catch (IllegalAccessException e)
{
logger.warning(e.toString());
}
finally
{
if (valueToExpressionField != null)
{
valueToExpressionField.setAccessible(false);
}
if (refsField != null)
{
refsField.setAccessible(false);
}
}
}
|
java
|
static void forceWritingEnumValue(
VerboseXmlEncoder encoder, Object object)
{
Field valueToExpressionField = null;
Field refsField = null;
try
{
Class<?> encoderClass = encoder.getClass().getSuperclass();
valueToExpressionField =
encoderClass.getDeclaredField("valueToExpression");
valueToExpressionField.setAccessible(true);
Object valueToExpressionObject =
valueToExpressionField.get(encoder);
Map<?,?> valueToExpression = (Map<?,?>)valueToExpressionObject;
Object valueData = valueToExpression.get(object);
if (valueData != null)
{
Class<?> valueDataClass = valueData.getClass();
refsField = valueDataClass.getDeclaredField("refs");
refsField.setAccessible(true);
refsField.setInt(valueData, 0);
}
}
catch (NoSuchFieldException e)
{
logger.warning(e.toString());
}
catch (SecurityException e)
{
logger.warning(e.toString());
}
catch (IllegalArgumentException e)
{
logger.warning(e.toString());
}
catch (IllegalAccessException e)
{
logger.warning(e.toString());
}
finally
{
if (valueToExpressionField != null)
{
valueToExpressionField.setAccessible(false);
}
if (refsField != null)
{
refsField.setAccessible(false);
}
}
}
|
[
"static",
"void",
"forceWritingEnumValue",
"(",
"VerboseXmlEncoder",
"encoder",
",",
"Object",
"object",
")",
"{",
"Field",
"valueToExpressionField",
"=",
"null",
";",
"Field",
"refsField",
"=",
"null",
";",
"try",
"{",
"Class",
"<",
"?",
">",
"encoderClass",
"=",
"encoder",
".",
"getClass",
"(",
")",
".",
"getSuperclass",
"(",
")",
";",
"valueToExpressionField",
"=",
"encoderClass",
".",
"getDeclaredField",
"(",
"\"valueToExpression\"",
")",
";",
"valueToExpressionField",
".",
"setAccessible",
"(",
"true",
")",
";",
"Object",
"valueToExpressionObject",
"=",
"valueToExpressionField",
".",
"get",
"(",
"encoder",
")",
";",
"Map",
"<",
"?",
",",
"?",
">",
"valueToExpression",
"=",
"(",
"Map",
"<",
"?",
",",
"?",
">",
")",
"valueToExpressionObject",
";",
"Object",
"valueData",
"=",
"valueToExpression",
".",
"get",
"(",
"object",
")",
";",
"if",
"(",
"valueData",
"!=",
"null",
")",
"{",
"Class",
"<",
"?",
">",
"valueDataClass",
"=",
"valueData",
".",
"getClass",
"(",
")",
";",
"refsField",
"=",
"valueDataClass",
".",
"getDeclaredField",
"(",
"\"refs\"",
")",
";",
"refsField",
".",
"setAccessible",
"(",
"true",
")",
";",
"refsField",
".",
"setInt",
"(",
"valueData",
",",
"0",
")",
";",
"}",
"}",
"catch",
"(",
"NoSuchFieldException",
"e",
")",
"{",
"logger",
".",
"warning",
"(",
"e",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"SecurityException",
"e",
")",
"{",
"logger",
".",
"warning",
"(",
"e",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"logger",
".",
"warning",
"(",
"e",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"logger",
".",
"warning",
"(",
"e",
".",
"toString",
"(",
")",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"valueToExpressionField",
"!=",
"null",
")",
"{",
"valueToExpressionField",
".",
"setAccessible",
"(",
"false",
")",
";",
"}",
"if",
"(",
"refsField",
"!=",
"null",
")",
"{",
"refsField",
".",
"setAccessible",
"(",
"false",
")",
";",
"}",
"}",
"}"
] |
Use a nasty reflection hack to make sure that the given object is
always written explicitly, without using "idref", in the given
VerboseXmlEncoder
@param encoder The encoder
@param object The object
|
[
"Use",
"a",
"nasty",
"reflection",
"hack",
"to",
"make",
"sure",
"that",
"the",
"given",
"object",
"is",
"always",
"written",
"explicitly",
"without",
"using",
"idref",
"in",
"the",
"given",
"VerboseXmlEncoder"
] |
5a4876b48c3a2dc61d21324733cf37512d721c33
|
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/VerboseXmlEncoder.java#L94-L144
|
149,234
|
mike10004/common-helper
|
imnetio-helper/src/main/java/com/github/mike10004/common/image/ImageInfo.java
|
ImageInfo.readSBits
|
private int readSBits(int numBits) throws IOException
{
// Get the number as an unsigned value.
long uBits = readUBits( numBits );
// Is the number negative?
if( ( uBits & (1L << (numBits - 1))) != 0 )
{
// Yes. Extend the sign.
uBits |= -1L << numBits;
}
return (int)uBits;
}
|
java
|
private int readSBits(int numBits) throws IOException
{
// Get the number as an unsigned value.
long uBits = readUBits( numBits );
// Is the number negative?
if( ( uBits & (1L << (numBits - 1))) != 0 )
{
// Yes. Extend the sign.
uBits |= -1L << numBits;
}
return (int)uBits;
}
|
[
"private",
"int",
"readSBits",
"(",
"int",
"numBits",
")",
"throws",
"IOException",
"{",
"// Get the number as an unsigned value.",
"long",
"uBits",
"=",
"readUBits",
"(",
"numBits",
")",
";",
"// Is the number negative?",
"if",
"(",
"(",
"uBits",
"&",
"(",
"1L",
"<<",
"(",
"numBits",
"-",
"1",
")",
")",
")",
"!=",
"0",
")",
"{",
"// Yes. Extend the sign.",
"uBits",
"|=",
"-",
"1L",
"<<",
"numBits",
";",
"}",
"return",
"(",
"int",
")",
"uBits",
";",
"}"
] |
Read a signed integer value from input.
@param numBits number of bits to read
|
[
"Read",
"a",
"signed",
"integer",
"value",
"from",
"input",
"."
] |
744f82d9b0768a9ad9c63a57a37ab2c93bf408f4
|
https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/imnetio-helper/src/main/java/com/github/mike10004/common/image/ImageInfo.java#L1221-L1234
|
149,235
|
julienledem/brennus
|
brennus-builder/src/main/java/brennus/ConstructorCallBuilder.java
|
ConstructorCallBuilder.param
|
ConstructorParamExpressionBuilder param() {
return new ConstructorParamExpressionBuilder(
new ExpressionHandler<ConstructorCallBuilder>() {
public ConstructorCallBuilder handleExpression(Expression e) {
return new ConstructorCallBuilder(
factory,
expressionHandler,
parameters.append(e));
}
});
}
|
java
|
ConstructorParamExpressionBuilder param() {
return new ConstructorParamExpressionBuilder(
new ExpressionHandler<ConstructorCallBuilder>() {
public ConstructorCallBuilder handleExpression(Expression e) {
return new ConstructorCallBuilder(
factory,
expressionHandler,
parameters.append(e));
}
});
}
|
[
"ConstructorParamExpressionBuilder",
"param",
"(",
")",
"{",
"return",
"new",
"ConstructorParamExpressionBuilder",
"(",
"new",
"ExpressionHandler",
"<",
"ConstructorCallBuilder",
">",
"(",
")",
"{",
"public",
"ConstructorCallBuilder",
"handleExpression",
"(",
"Expression",
"e",
")",
"{",
"return",
"new",
"ConstructorCallBuilder",
"(",
"factory",
",",
"expressionHandler",
",",
"parameters",
".",
"append",
"(",
"e",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] |
pass a parameter to the constructor
@return the expressionbuilder to build the parameter value
|
[
"pass",
"a",
"parameter",
"to",
"the",
"constructor"
] |
0798fb565d95af19ddc5accd084e58c4e882dbd0
|
https://github.com/julienledem/brennus/blob/0798fb565d95af19ddc5accd084e58c4e882dbd0/brennus-builder/src/main/java/brennus/ConstructorCallBuilder.java#L39-L49
|
149,236
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/QueueFactory.java
|
QueueFactory.newQueueBuilder
|
public static <B extends ProcessBuilder> QueueBuilder<B> newQueueBuilder(Class<B> process_builder_class)
{
return new QueueBuilder<B>(ROOT_QUEUE, process_builder_class);
}
|
java
|
public static <B extends ProcessBuilder> QueueBuilder<B> newQueueBuilder(Class<B> process_builder_class)
{
return new QueueBuilder<B>(ROOT_QUEUE, process_builder_class);
}
|
[
"public",
"static",
"<",
"B",
"extends",
"ProcessBuilder",
">",
"QueueBuilder",
"<",
"B",
">",
"newQueueBuilder",
"(",
"Class",
"<",
"B",
">",
"process_builder_class",
")",
"{",
"return",
"new",
"QueueBuilder",
"<",
"B",
">",
"(",
"ROOT_QUEUE",
",",
"process_builder_class",
")",
";",
"}"
] |
Retrieve a new QueueBuilder using the ROOT_QUEUE
as a parent.
@return The new QueueBuilder object.
|
[
"Retrieve",
"a",
"new",
"QueueBuilder",
"using",
"the",
"ROOT_QUEUE",
"as",
"a",
"parent",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/QueueFactory.java#L105-L108
|
149,237
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/QueueFactory.java
|
QueueFactory.newQueueBuilder
|
static <B extends ProcessBuilder> QueueBuilder<B> newQueueBuilder(Queue parent_queue, Class<B> process_builder_class)
{
return new QueueBuilder<B>(parent_queue, process_builder_class);
}
|
java
|
static <B extends ProcessBuilder> QueueBuilder<B> newQueueBuilder(Queue parent_queue, Class<B> process_builder_class)
{
return new QueueBuilder<B>(parent_queue, process_builder_class);
}
|
[
"static",
"<",
"B",
"extends",
"ProcessBuilder",
">",
"QueueBuilder",
"<",
"B",
">",
"newQueueBuilder",
"(",
"Queue",
"parent_queue",
",",
"Class",
"<",
"B",
">",
"process_builder_class",
")",
"{",
"return",
"new",
"QueueBuilder",
"<",
"B",
">",
"(",
"parent_queue",
",",
"process_builder_class",
")",
";",
"}"
] |
Retrieve a new QueueBuilder using the specified
queue as a parent.
@param parent_queue - The parent queue.
@return The new QueueBuilder object.
|
[
"Retrieve",
"a",
"new",
"QueueBuilder",
"using",
"the",
"specified",
"queue",
"as",
"a",
"parent",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/QueueFactory.java#L117-L120
|
149,238
|
pryzach/midao
|
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/output/BeanListOutputHandler.java
|
BeanListOutputHandler.handle
|
public List<T> handle(List<QueryParameters> outputList) throws MjdbcException {
return this.outputProcessor.toBeanList(outputList, this.type);
}
|
java
|
public List<T> handle(List<QueryParameters> outputList) throws MjdbcException {
return this.outputProcessor.toBeanList(outputList, this.type);
}
|
[
"public",
"List",
"<",
"T",
">",
"handle",
"(",
"List",
"<",
"QueryParameters",
">",
"outputList",
")",
"throws",
"MjdbcException",
"{",
"return",
"this",
".",
"outputProcessor",
".",
"toBeanList",
"(",
"outputList",
",",
"this",
".",
"type",
")",
";",
"}"
] |
Converts query output into list of beans
@param outputList Query output
@return List of beans converted from query output
@throws org.midao.jdbc.core.exception.MjdbcException
|
[
"Converts",
"query",
"output",
"into",
"list",
"of",
"beans"
] |
ed9048ed2c792a4794a2116a25779dfb84cd9447
|
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/output/BeanListOutputHandler.java#L67-L69
|
149,239
|
greese/dasein-util
|
src/main/java/org/dasein/attributes/types/StringFactory.java
|
StringFactory.getConstraint
|
@SuppressWarnings("unchecked")
public Constraint getConstraint(String ... typeInfo) {
if( typeInfo == null || typeInfo.length < 1 ) {
return getConstraints().iterator().next();
}
else if( typeInfo.length == 1 ) {
Constraint c = getConstraint(new String[0]);
DataType<?> attr = c.getType();
Boolean b;
b = (Boolean)attr.getValue(typeInfo[0]);
if( b == null || !b ) {
return constraints.get(1);
}
else {
return constraints.get(2);
}
}
else {
return super.getConstraint(typeInfo);
}
}
|
java
|
@SuppressWarnings("unchecked")
public Constraint getConstraint(String ... typeInfo) {
if( typeInfo == null || typeInfo.length < 1 ) {
return getConstraints().iterator().next();
}
else if( typeInfo.length == 1 ) {
Constraint c = getConstraint(new String[0]);
DataType<?> attr = c.getType();
Boolean b;
b = (Boolean)attr.getValue(typeInfo[0]);
if( b == null || !b ) {
return constraints.get(1);
}
else {
return constraints.get(2);
}
}
else {
return super.getConstraint(typeInfo);
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Constraint",
"getConstraint",
"(",
"String",
"...",
"typeInfo",
")",
"{",
"if",
"(",
"typeInfo",
"==",
"null",
"||",
"typeInfo",
".",
"length",
"<",
"1",
")",
"{",
"return",
"getConstraints",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"}",
"else",
"if",
"(",
"typeInfo",
".",
"length",
"==",
"1",
")",
"{",
"Constraint",
"c",
"=",
"getConstraint",
"(",
"new",
"String",
"[",
"0",
"]",
")",
";",
"DataType",
"<",
"?",
">",
"attr",
"=",
"c",
".",
"getType",
"(",
")",
";",
"Boolean",
"b",
";",
"b",
"=",
"(",
"Boolean",
")",
"attr",
".",
"getValue",
"(",
"typeInfo",
"[",
"0",
"]",
")",
";",
"if",
"(",
"b",
"==",
"null",
"||",
"!",
"b",
")",
"{",
"return",
"constraints",
".",
"get",
"(",
"1",
")",
";",
"}",
"else",
"{",
"return",
"constraints",
".",
"get",
"(",
"2",
")",
";",
"}",
"}",
"else",
"{",
"return",
"super",
".",
"getConstraint",
"(",
"typeInfo",
")",
";",
"}",
"}"
] |
Overrides the default method to allow conditional checking. Only for non-longtext
strings do we allow for a list of choices.
|
[
"Overrides",
"the",
"default",
"method",
"to",
"allow",
"conditional",
"checking",
".",
"Only",
"for",
"non",
"-",
"longtext",
"strings",
"do",
"we",
"allow",
"for",
"a",
"list",
"of",
"choices",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/attributes/types/StringFactory.java#L47-L68
|
149,240
|
pryzach/midao
|
midao-jdbc-core/src/main/java/org/midao/jdbc/spring/exception/SpringExceptionHandler.java
|
SpringExceptionHandler.translateSQLStatePrefix
|
private MjdbcSQLException translateSQLStatePrefix(String reason, String SQLState, int vendorCode, SQLException cause) {
MjdbcSQLException result = null;
String sqlState = getSqlState(cause);
String sqlStatePrefix = null;
if (sqlState != null && sqlState.length() >= 2) {
sqlStatePrefix = sqlState.substring(0, 2);
if (SpringExceptionHandlerConstants.SQL_STATE_PREFIX_BAD_SQL_GRAMMAR.contains(sqlStatePrefix) == true) {
result = new BadSqlGrammarException(reason, SQLState, vendorCode);
} else if (SpringExceptionHandlerConstants.SQL_STATE_PREFIX_DATA_INTEGRITY_VIOLATION.contains(sqlStatePrefix) == true) {
result = new DataIntegrityViolationException(reason, SQLState, vendorCode);
} else if (SpringExceptionHandlerConstants.SQL_STATE_PREFIX_DATA_ACCESS_RESOURCE_FAILURE.contains(sqlStatePrefix) == true) {
result = new DataAccessResourceFailureException(reason, SQLState, vendorCode);
} else if (SpringExceptionHandlerConstants.SQL_STATE_PREFIX_TRANSIENT_DATA_ACCESS_RESOURCE_EXCEPTION.contains(sqlStatePrefix) == true) {
result = new TransientDataAccessResourceException(reason, SQLState, vendorCode);
} else if (SpringExceptionHandlerConstants.SQL_STATE_PREFIX_CONCURRENCY_FAILURE.contains(sqlStatePrefix) == true) {
result = new ConcurrencyFailureException(reason, SQLState, vendorCode);
}
}
return result;
}
|
java
|
private MjdbcSQLException translateSQLStatePrefix(String reason, String SQLState, int vendorCode, SQLException cause) {
MjdbcSQLException result = null;
String sqlState = getSqlState(cause);
String sqlStatePrefix = null;
if (sqlState != null && sqlState.length() >= 2) {
sqlStatePrefix = sqlState.substring(0, 2);
if (SpringExceptionHandlerConstants.SQL_STATE_PREFIX_BAD_SQL_GRAMMAR.contains(sqlStatePrefix) == true) {
result = new BadSqlGrammarException(reason, SQLState, vendorCode);
} else if (SpringExceptionHandlerConstants.SQL_STATE_PREFIX_DATA_INTEGRITY_VIOLATION.contains(sqlStatePrefix) == true) {
result = new DataIntegrityViolationException(reason, SQLState, vendorCode);
} else if (SpringExceptionHandlerConstants.SQL_STATE_PREFIX_DATA_ACCESS_RESOURCE_FAILURE.contains(sqlStatePrefix) == true) {
result = new DataAccessResourceFailureException(reason, SQLState, vendorCode);
} else if (SpringExceptionHandlerConstants.SQL_STATE_PREFIX_TRANSIENT_DATA_ACCESS_RESOURCE_EXCEPTION.contains(sqlStatePrefix) == true) {
result = new TransientDataAccessResourceException(reason, SQLState, vendorCode);
} else if (SpringExceptionHandlerConstants.SQL_STATE_PREFIX_CONCURRENCY_FAILURE.contains(sqlStatePrefix) == true) {
result = new ConcurrencyFailureException(reason, SQLState, vendorCode);
}
}
return result;
}
|
[
"private",
"MjdbcSQLException",
"translateSQLStatePrefix",
"(",
"String",
"reason",
",",
"String",
"SQLState",
",",
"int",
"vendorCode",
",",
"SQLException",
"cause",
")",
"{",
"MjdbcSQLException",
"result",
"=",
"null",
";",
"String",
"sqlState",
"=",
"getSqlState",
"(",
"cause",
")",
";",
"String",
"sqlStatePrefix",
"=",
"null",
";",
"if",
"(",
"sqlState",
"!=",
"null",
"&&",
"sqlState",
".",
"length",
"(",
")",
">=",
"2",
")",
"{",
"sqlStatePrefix",
"=",
"sqlState",
".",
"substring",
"(",
"0",
",",
"2",
")",
";",
"if",
"(",
"SpringExceptionHandlerConstants",
".",
"SQL_STATE_PREFIX_BAD_SQL_GRAMMAR",
".",
"contains",
"(",
"sqlStatePrefix",
")",
"==",
"true",
")",
"{",
"result",
"=",
"new",
"BadSqlGrammarException",
"(",
"reason",
",",
"SQLState",
",",
"vendorCode",
")",
";",
"}",
"else",
"if",
"(",
"SpringExceptionHandlerConstants",
".",
"SQL_STATE_PREFIX_DATA_INTEGRITY_VIOLATION",
".",
"contains",
"(",
"sqlStatePrefix",
")",
"==",
"true",
")",
"{",
"result",
"=",
"new",
"DataIntegrityViolationException",
"(",
"reason",
",",
"SQLState",
",",
"vendorCode",
")",
";",
"}",
"else",
"if",
"(",
"SpringExceptionHandlerConstants",
".",
"SQL_STATE_PREFIX_DATA_ACCESS_RESOURCE_FAILURE",
".",
"contains",
"(",
"sqlStatePrefix",
")",
"==",
"true",
")",
"{",
"result",
"=",
"new",
"DataAccessResourceFailureException",
"(",
"reason",
",",
"SQLState",
",",
"vendorCode",
")",
";",
"}",
"else",
"if",
"(",
"SpringExceptionHandlerConstants",
".",
"SQL_STATE_PREFIX_TRANSIENT_DATA_ACCESS_RESOURCE_EXCEPTION",
".",
"contains",
"(",
"sqlStatePrefix",
")",
"==",
"true",
")",
"{",
"result",
"=",
"new",
"TransientDataAccessResourceException",
"(",
"reason",
",",
"SQLState",
",",
"vendorCode",
")",
";",
"}",
"else",
"if",
"(",
"SpringExceptionHandlerConstants",
".",
"SQL_STATE_PREFIX_CONCURRENCY_FAILURE",
".",
"contains",
"(",
"sqlStatePrefix",
")",
"==",
"true",
")",
"{",
"result",
"=",
"new",
"ConcurrencyFailureException",
"(",
"reason",
",",
"SQLState",
",",
"vendorCode",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Checks SQL state and tries to convert it into Spring SQL Exception.
This implementation is vendor "free".
@param reason a description of the exception
@param SQLState an XOPEN or SQL:2003 code identifying the exception
@param vendorCode a database vendor-specific exception code
@param cause original SQL Exception
@return SQL Exception converted into Spring SQL Exception. Null otherwise
|
[
"Checks",
"SQL",
"state",
"and",
"tries",
"to",
"convert",
"it",
"into",
"Spring",
"SQL",
"Exception",
".",
"This",
"implementation",
"is",
"vendor",
"free",
"."
] |
ed9048ed2c792a4794a2116a25779dfb84cd9447
|
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/spring/exception/SpringExceptionHandler.java#L158-L180
|
149,241
|
pryzach/midao
|
midao-jdbc-core/src/main/java/org/midao/jdbc/spring/exception/SpringExceptionHandler.java
|
SpringExceptionHandler.getSqlState
|
private String getSqlState(SQLException ex) {
String result = ex.getSQLState();
SQLException nestedEx = null;
if (result == null) {
nestedEx = ex.getNextException();
if (nestedEx != null) {
result = nestedEx.getSQLState();
}
}
return result;
}
|
java
|
private String getSqlState(SQLException ex) {
String result = ex.getSQLState();
SQLException nestedEx = null;
if (result == null) {
nestedEx = ex.getNextException();
if (nestedEx != null) {
result = nestedEx.getSQLState();
}
}
return result;
}
|
[
"private",
"String",
"getSqlState",
"(",
"SQLException",
"ex",
")",
"{",
"String",
"result",
"=",
"ex",
".",
"getSQLState",
"(",
")",
";",
"SQLException",
"nestedEx",
"=",
"null",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"nestedEx",
"=",
"ex",
".",
"getNextException",
"(",
")",
";",
"if",
"(",
"nestedEx",
"!=",
"null",
")",
"{",
"result",
"=",
"nestedEx",
".",
"getSQLState",
"(",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Reads SQLException hierarchy and returns SQL state.
@param ex top SQL exception
@return sql state
|
[
"Reads",
"SQLException",
"hierarchy",
"and",
"returns",
"SQL",
"state",
"."
] |
ed9048ed2c792a4794a2116a25779dfb84cd9447
|
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/spring/exception/SpringExceptionHandler.java#L374-L386
|
149,242
|
pryzach/midao
|
midao-jdbc-core/src/main/java/org/midao/jdbc/spring/exception/SpringExceptionHandler.java
|
SpringExceptionHandler.getErrorCode
|
private String getErrorCode(SQLException ex) {
String result = null;
SQLException nestedEx = null;
if (ex.getErrorCode() != 0) {
result = Integer.toString(ex.getErrorCode());
}
if (result == null) {
nestedEx = ex.getNextException();
if (nestedEx != null) {
result = Integer.toString(nestedEx.getErrorCode());
}
}
return result;
}
|
java
|
private String getErrorCode(SQLException ex) {
String result = null;
SQLException nestedEx = null;
if (ex.getErrorCode() != 0) {
result = Integer.toString(ex.getErrorCode());
}
if (result == null) {
nestedEx = ex.getNextException();
if (nestedEx != null) {
result = Integer.toString(nestedEx.getErrorCode());
}
}
return result;
}
|
[
"private",
"String",
"getErrorCode",
"(",
"SQLException",
"ex",
")",
"{",
"String",
"result",
"=",
"null",
";",
"SQLException",
"nestedEx",
"=",
"null",
";",
"if",
"(",
"ex",
".",
"getErrorCode",
"(",
")",
"!=",
"0",
")",
"{",
"result",
"=",
"Integer",
".",
"toString",
"(",
"ex",
".",
"getErrorCode",
"(",
")",
")",
";",
"}",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"nestedEx",
"=",
"ex",
".",
"getNextException",
"(",
")",
";",
"if",
"(",
"nestedEx",
"!=",
"null",
")",
"{",
"result",
"=",
"Integer",
".",
"toString",
"(",
"nestedEx",
".",
"getErrorCode",
"(",
")",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Reads SQLException hierarchy and returns error code
@param ex top SQL exception
@return error code as String
|
[
"Reads",
"SQLException",
"hierarchy",
"and",
"returns",
"error",
"code"
] |
ed9048ed2c792a4794a2116a25779dfb84cd9447
|
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/spring/exception/SpringExceptionHandler.java#L394-L410
|
149,243
|
lightblueseas/wicket-js-addons
|
wicket-js-addons-core/src/main/java/de/alpharogroup/wicket/js/addon/core/TextTemplateExtensions.java
|
TextTemplateExtensions.setVariableWithSingleQuotationMarks
|
public static void setVariableWithSingleQuotationMarks(final String variablename,
final Object object, final Map<String, Object> variables)
{
if (object != null)
{
variables.put(variablename, "'" + object + "'");
}
else
{
variables.put(variablename, "null");
}
}
|
java
|
public static void setVariableWithSingleQuotationMarks(final String variablename,
final Object object, final Map<String, Object> variables)
{
if (object != null)
{
variables.put(variablename, "'" + object + "'");
}
else
{
variables.put(variablename, "null");
}
}
|
[
"public",
"static",
"void",
"setVariableWithSingleQuotationMarks",
"(",
"final",
"String",
"variablename",
",",
"final",
"Object",
"object",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"variables",
")",
"{",
"if",
"(",
"object",
"!=",
"null",
")",
"{",
"variables",
".",
"put",
"(",
"variablename",
",",
"\"'\"",
"+",
"object",
"+",
"\"'\"",
")",
";",
"}",
"else",
"{",
"variables",
".",
"put",
"(",
"variablename",
",",
"\"null\"",
")",
";",
"}",
"}"
] |
Sets the variable with singe quotation marks.
@param variablename
the variablename
@param object
the object
@param variables
the variables
|
[
"Sets",
"the",
"variable",
"with",
"singe",
"quotation",
"marks",
"."
] |
b1c88c1abafd1e965f2e32ef13d66be0b28d76f6
|
https://github.com/lightblueseas/wicket-js-addons/blob/b1c88c1abafd1e965f2e32ef13d66be0b28d76f6/wicket-js-addons-core/src/main/java/de/alpharogroup/wicket/js/addon/core/TextTemplateExtensions.java#L90-L101
|
149,244
|
uniform-java/uniform
|
src/main/java/net/uniform/api/html/SimpleHTMLTag.java
|
SimpleHTMLTag.addSubTag
|
public SimpleHTMLTag addSubTag(SimpleHTMLTag tag) {
if (tag == this) {
throw new IllegalArgumentException("The tag cannot be its own parent");
}
if (subTags == null) {
subTags = new ArrayList<>();
}
subTags.add(tag);
return this;
}
|
java
|
public SimpleHTMLTag addSubTag(SimpleHTMLTag tag) {
if (tag == this) {
throw new IllegalArgumentException("The tag cannot be its own parent");
}
if (subTags == null) {
subTags = new ArrayList<>();
}
subTags.add(tag);
return this;
}
|
[
"public",
"SimpleHTMLTag",
"addSubTag",
"(",
"SimpleHTMLTag",
"tag",
")",
"{",
"if",
"(",
"tag",
"==",
"this",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The tag cannot be its own parent\"",
")",
";",
"}",
"if",
"(",
"subTags",
"==",
"null",
")",
"{",
"subTags",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"subTags",
".",
"add",
"(",
"tag",
")",
";",
"return",
"this",
";",
"}"
] |
Adds a subtag to this tag.
If the tag has a text content, any subtag will be ignored.
@param tag Subtag to add
@return This tag
|
[
"Adds",
"a",
"subtag",
"to",
"this",
"tag",
".",
"If",
"the",
"tag",
"has",
"a",
"text",
"content",
"any",
"subtag",
"will",
"be",
"ignored",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/api/html/SimpleHTMLTag.java#L171-L183
|
149,245
|
uniform-java/uniform
|
src/main/java/net/uniform/api/html/SimpleHTMLTag.java
|
SimpleHTMLTag.setProperty
|
public SimpleHTMLTag setProperty(String key, String value) {
key = UniformUtils.checkPropertyNameAndLowerCase(key);
if (properties == null) {
properties = new HashMap<>();
}
properties.put(key, value);
return this;
}
|
java
|
public SimpleHTMLTag setProperty(String key, String value) {
key = UniformUtils.checkPropertyNameAndLowerCase(key);
if (properties == null) {
properties = new HashMap<>();
}
properties.put(key, value);
return this;
}
|
[
"public",
"SimpleHTMLTag",
"setProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"key",
"=",
"UniformUtils",
".",
"checkPropertyNameAndLowerCase",
"(",
"key",
")",
";",
"if",
"(",
"properties",
"==",
"null",
")",
"{",
"properties",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"properties",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] |
Sets a property of the tag by key.
@param key Property key
@param value Property value
@return This tag
|
[
"Sets",
"a",
"property",
"of",
"the",
"tag",
"by",
"key",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/api/html/SimpleHTMLTag.java#L192-L202
|
149,246
|
uniform-java/uniform
|
src/main/java/net/uniform/api/html/SimpleHTMLTag.java
|
SimpleHTMLTag.removeProperty
|
public SimpleHTMLTag removeProperty(String key) {
key = UniformUtils.checkPropertyNameAndLowerCase(key);
if (properties != null) {
properties.remove(key);
}
return this;
}
|
java
|
public SimpleHTMLTag removeProperty(String key) {
key = UniformUtils.checkPropertyNameAndLowerCase(key);
if (properties != null) {
properties.remove(key);
}
return this;
}
|
[
"public",
"SimpleHTMLTag",
"removeProperty",
"(",
"String",
"key",
")",
"{",
"key",
"=",
"UniformUtils",
".",
"checkPropertyNameAndLowerCase",
"(",
"key",
")",
";",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"properties",
".",
"remove",
"(",
"key",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Removes a property of the tag by key.
@param key Propery key
@return This tag
|
[
"Removes",
"a",
"property",
"of",
"the",
"tag",
"by",
"key",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/api/html/SimpleHTMLTag.java#L210-L217
|
149,247
|
uniform-java/uniform
|
src/main/java/net/uniform/api/html/SimpleHTMLTag.java
|
SimpleHTMLTag.setProperties
|
public SimpleHTMLTag setProperties(Map<String, String> properties) {
if (properties == null || properties.isEmpty()) {
this.properties = null;
} else {
this.properties = new HashMap<>();
for (Entry<String, String> entry : properties.entrySet()) {
String key = entry.getKey();
key = UniformUtils.checkPropertyNameAndLowerCase(key);
this.properties.put(key, entry.getValue());
}
}
return this;
}
|
java
|
public SimpleHTMLTag setProperties(Map<String, String> properties) {
if (properties == null || properties.isEmpty()) {
this.properties = null;
} else {
this.properties = new HashMap<>();
for (Entry<String, String> entry : properties.entrySet()) {
String key = entry.getKey();
key = UniformUtils.checkPropertyNameAndLowerCase(key);
this.properties.put(key, entry.getValue());
}
}
return this;
}
|
[
"public",
"SimpleHTMLTag",
"setProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
"||",
"properties",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"properties",
"=",
"null",
";",
"}",
"else",
"{",
"this",
".",
"properties",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"properties",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"key",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"key",
"=",
"UniformUtils",
".",
"checkPropertyNameAndLowerCase",
"(",
"key",
")",
";",
"this",
".",
"properties",
".",
"put",
"(",
"key",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Replaces all properties of the tag with a map of properties indexed by key.
@param properties New properties
@return This tag
|
[
"Replaces",
"all",
"properties",
"of",
"the",
"tag",
"with",
"a",
"map",
"of",
"properties",
"indexed",
"by",
"key",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/api/html/SimpleHTMLTag.java#L225-L240
|
149,248
|
uniform-java/uniform
|
src/main/java/net/uniform/api/html/SimpleHTMLTag.java
|
SimpleHTMLTag.getProperty
|
public String getProperty(String key) {
key = UniformUtils.checkPropertyNameAndLowerCase(key);
if (properties == null) {
return null;
}
return properties.get(key);
}
|
java
|
public String getProperty(String key) {
key = UniformUtils.checkPropertyNameAndLowerCase(key);
if (properties == null) {
return null;
}
return properties.get(key);
}
|
[
"public",
"String",
"getProperty",
"(",
"String",
"key",
")",
"{",
"key",
"=",
"UniformUtils",
".",
"checkPropertyNameAndLowerCase",
"(",
"key",
")",
";",
"if",
"(",
"properties",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"properties",
".",
"get",
"(",
"key",
")",
";",
"}"
] |
Returns a property of this tag by key, if present.
@param key Property key
@return Property value or null
|
[
"Returns",
"a",
"property",
"of",
"this",
"tag",
"by",
"key",
"if",
"present",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/api/html/SimpleHTMLTag.java#L248-L255
|
149,249
|
mike10004/common-helper
|
imnetio-helper/src/main/java/com/github/mike10004/common/image/ImageInfos.java
|
ImageInfos.read
|
public static ImageInfo read(InputStream in) throws IOException {
ImageInfo imageInfo = new ImageInfo();
imageInfo.setInput(in);
if (!imageInfo.check()) {
throw new IOException("ImageInfo.check() failed; data stream is "
+ "broken or does not contain data in a supported image format");
}
return imageInfo;
}
|
java
|
public static ImageInfo read(InputStream in) throws IOException {
ImageInfo imageInfo = new ImageInfo();
imageInfo.setInput(in);
if (!imageInfo.check()) {
throw new IOException("ImageInfo.check() failed; data stream is "
+ "broken or does not contain data in a supported image format");
}
return imageInfo;
}
|
[
"public",
"static",
"ImageInfo",
"read",
"(",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"ImageInfo",
"imageInfo",
"=",
"new",
"ImageInfo",
"(",
")",
";",
"imageInfo",
".",
"setInput",
"(",
"in",
")",
";",
"if",
"(",
"!",
"imageInfo",
".",
"check",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"ImageInfo.check() failed; data stream is \"",
"+",
"\"broken or does not contain data in a supported image format\"",
")",
";",
"}",
"return",
"imageInfo",
";",
"}"
] |
Reads image info from a stream.
@param in the input stream containing image data
@return the image info object, with {@link ImageInfo#check() }
already invoked
@throws IOException if {@link ImageInfo#check() } fails or any other
I/O exception is thrown
|
[
"Reads",
"image",
"info",
"from",
"a",
"stream",
"."
] |
744f82d9b0768a9ad9c63a57a37ab2c93bf408f4
|
https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/imnetio-helper/src/main/java/com/github/mike10004/common/image/ImageInfos.java#L73-L81
|
149,250
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.containsKey
|
@SuppressWarnings("unchecked")
public boolean containsKey(Object key) {
synchronized( this ) {
//WeakReference ref;
SoftReference ref;
V item;
if( !cache.containsKey(key) ) {
return false;
}
ref = cache.get(key);
item = (V)ref.get();
if( item == null ) {
return false;
}
if( item instanceof CachedItem ) {
CachedItem ci = (CachedItem)item;
if( !ci.isValidForCache() ) {
remove(key);
return false;
}
}
return true;
}
}
|
java
|
@SuppressWarnings("unchecked")
public boolean containsKey(Object key) {
synchronized( this ) {
//WeakReference ref;
SoftReference ref;
V item;
if( !cache.containsKey(key) ) {
return false;
}
ref = cache.get(key);
item = (V)ref.get();
if( item == null ) {
return false;
}
if( item instanceof CachedItem ) {
CachedItem ci = (CachedItem)item;
if( !ci.isValidForCache() ) {
remove(key);
return false;
}
}
return true;
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"boolean",
"containsKey",
"(",
"Object",
"key",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"//WeakReference ref;",
"SoftReference",
"ref",
";",
"V",
"item",
";",
"if",
"(",
"!",
"cache",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"return",
"false",
";",
"}",
"ref",
"=",
"cache",
".",
"get",
"(",
"key",
")",
";",
"item",
"=",
"(",
"V",
")",
"ref",
".",
"get",
"(",
")",
";",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"item",
"instanceof",
"CachedItem",
")",
"{",
"CachedItem",
"ci",
"=",
"(",
"CachedItem",
")",
"item",
";",
"if",
"(",
"!",
"ci",
".",
"isValidForCache",
"(",
")",
")",
"{",
"remove",
"(",
"key",
")",
";",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}"
] |
This method will verify both that the key exists and the value is currently
value for the cache.
@param key the key to test for existence
@return true if the cache has a value with the specified key
|
[
"This",
"method",
"will",
"verify",
"both",
"that",
"the",
"key",
"exists",
"and",
"the",
"value",
"is",
"currently",
"value",
"for",
"the",
"cache",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L71-L96
|
149,251
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.containsValue
|
public boolean containsValue(Object val) {
synchronized( this ) {
for( V item : values() ) {
if( item instanceof CachedItem ){
CachedItem ci = (CachedItem)item;
if( ci.isValidForCache() && ci.equals(val) ) {
return true;
}
}
else if( item.equals(val) ) {
return true;
}
}
}
return false;
}
|
java
|
public boolean containsValue(Object val) {
synchronized( this ) {
for( V item : values() ) {
if( item instanceof CachedItem ){
CachedItem ci = (CachedItem)item;
if( ci.isValidForCache() && ci.equals(val) ) {
return true;
}
}
else if( item.equals(val) ) {
return true;
}
}
}
return false;
}
|
[
"public",
"boolean",
"containsValue",
"(",
"Object",
"val",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"for",
"(",
"V",
"item",
":",
"values",
"(",
")",
")",
"{",
"if",
"(",
"item",
"instanceof",
"CachedItem",
")",
"{",
"CachedItem",
"ci",
"=",
"(",
"CachedItem",
")",
"item",
";",
"if",
"(",
"ci",
".",
"isValidForCache",
"(",
")",
"&&",
"ci",
".",
"equals",
"(",
"val",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"else",
"if",
"(",
"item",
".",
"equals",
"(",
"val",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Verifies that the specified value is in the cache.
@param val the desired value
@return true if it is in the cache and value
|
[
"Verifies",
"that",
"the",
"specified",
"value",
"is",
"in",
"the",
"cache",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L103-L119
|
149,252
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.entrySet
|
public Set<Entry<K, V>> entrySet() {
TreeSet<Entry<K,V>> set = new TreeSet<Entry<K,V>>();
synchronized( this ) {
for(K key : keySet() ) {
if( containsKey(key) ) {
get(key);
set.add(getEntry(key));
}
}
return set;
}
}
|
java
|
public Set<Entry<K, V>> entrySet() {
TreeSet<Entry<K,V>> set = new TreeSet<Entry<K,V>>();
synchronized( this ) {
for(K key : keySet() ) {
if( containsKey(key) ) {
get(key);
set.add(getEntry(key));
}
}
return set;
}
}
|
[
"public",
"Set",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"entrySet",
"(",
")",
"{",
"TreeSet",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"set",
"=",
"new",
"TreeSet",
"<",
"Entry",
"<",
"K",
",",
"V",
">",
">",
"(",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"for",
"(",
"K",
"key",
":",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"containsKey",
"(",
"key",
")",
")",
"{",
"get",
"(",
"key",
")",
";",
"set",
".",
"add",
"(",
"getEntry",
"(",
"key",
")",
")",
";",
"}",
"}",
"return",
"set",
";",
"}",
"}"
] |
Returns a set of entries in this cache.
@return cache entries
|
[
"Returns",
"a",
"set",
"of",
"entries",
"in",
"this",
"cache",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L125-L137
|
149,253
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.get
|
@SuppressWarnings("unchecked")
public V get(Object key) {
synchronized( this ) {
//WeakReference ref;
SoftReference ref;
V item;
if( !containsKey(key) ) {
return null;
}
ref = cache.get(key);
item = (V)ref.get();
if( item == null ) {
return null;
}
if( item instanceof CachedItem ) {
CachedItem ci = (CachedItem)item;
if( ci.isValidForCache() ) {
return item;
}
remove(key);
return null;
}
return item;
}
}
|
java
|
@SuppressWarnings("unchecked")
public V get(Object key) {
synchronized( this ) {
//WeakReference ref;
SoftReference ref;
V item;
if( !containsKey(key) ) {
return null;
}
ref = cache.get(key);
item = (V)ref.get();
if( item == null ) {
return null;
}
if( item instanceof CachedItem ) {
CachedItem ci = (CachedItem)item;
if( ci.isValidForCache() ) {
return item;
}
remove(key);
return null;
}
return item;
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"V",
"get",
"(",
"Object",
"key",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"//WeakReference ref;",
"SoftReference",
"ref",
";",
"V",
"item",
";",
"if",
"(",
"!",
"containsKey",
"(",
"key",
")",
")",
"{",
"return",
"null",
";",
"}",
"ref",
"=",
"cache",
".",
"get",
"(",
"key",
")",
";",
"item",
"=",
"(",
"V",
")",
"ref",
".",
"get",
"(",
")",
";",
"if",
"(",
"item",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"item",
"instanceof",
"CachedItem",
")",
"{",
"CachedItem",
"ci",
"=",
"(",
"CachedItem",
")",
"item",
";",
"if",
"(",
"ci",
".",
"isValidForCache",
"(",
")",
")",
"{",
"return",
"item",
";",
"}",
"remove",
"(",
"key",
")",
";",
"return",
"null",
";",
"}",
"return",
"item",
";",
"}",
"}"
] |
Retrieves the item associated with the specified key if it is currently
valid for the cache.
@param key the key whose item is being sought
@return the current value for that key, if any
|
[
"Retrieves",
"the",
"item",
"associated",
"with",
"the",
"specified",
"key",
"if",
"it",
"is",
"currently",
"valid",
"for",
"the",
"cache",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L145-L171
|
149,254
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.getEntry
|
private Entry<K, V> getEntry(K key) {
final K k = key;
return new Entry<K, V>() {
public boolean equals(Object ob) {
if( ob instanceof Entry ) {
Entry entry = (Entry)ob;
if( !entry.getKey().equals(getKey()) ) {
return false;
}
if( !entry.getValue().equals(getValue()) ) {
return false;
}
return true;
}
return false;
}
public K getKey() {
return k;
}
public V getValue() {
return ConcurrentCache.this.get(getKey());
}
public V setValue(V val) {
return ConcurrentCache.this.put(getKey(), val);
}
};
}
|
java
|
private Entry<K, V> getEntry(K key) {
final K k = key;
return new Entry<K, V>() {
public boolean equals(Object ob) {
if( ob instanceof Entry ) {
Entry entry = (Entry)ob;
if( !entry.getKey().equals(getKey()) ) {
return false;
}
if( !entry.getValue().equals(getValue()) ) {
return false;
}
return true;
}
return false;
}
public K getKey() {
return k;
}
public V getValue() {
return ConcurrentCache.this.get(getKey());
}
public V setValue(V val) {
return ConcurrentCache.this.put(getKey(), val);
}
};
}
|
[
"private",
"Entry",
"<",
"K",
",",
"V",
">",
"getEntry",
"(",
"K",
"key",
")",
"{",
"final",
"K",
"k",
"=",
"key",
";",
"return",
"new",
"Entry",
"<",
"K",
",",
"V",
">",
"(",
")",
"{",
"public",
"boolean",
"equals",
"(",
"Object",
"ob",
")",
"{",
"if",
"(",
"ob",
"instanceof",
"Entry",
")",
"{",
"Entry",
"entry",
"=",
"(",
"Entry",
")",
"ob",
";",
"if",
"(",
"!",
"entry",
".",
"getKey",
"(",
")",
".",
"equals",
"(",
"getKey",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"entry",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"getValue",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"public",
"K",
"getKey",
"(",
")",
"{",
"return",
"k",
";",
"}",
"public",
"V",
"getValue",
"(",
")",
"{",
"return",
"ConcurrentCache",
".",
"this",
".",
"get",
"(",
"getKey",
"(",
")",
")",
";",
"}",
"public",
"V",
"setValue",
"(",
"V",
"val",
")",
"{",
"return",
"ConcurrentCache",
".",
"this",
".",
"put",
"(",
"getKey",
"(",
")",
",",
"val",
")",
";",
"}",
"}",
";",
"}"
] |
Returns an entry value for the specified
@param key the key of the desired entry
@return an entry for the specified key
|
[
"Returns",
"an",
"entry",
"value",
"for",
"the",
"specified"
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L178-L209
|
149,255
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.getOrLoad
|
public V getOrLoad(K key, CacheLoader<V> loader) {
V item;
// synchronized( this ) {
if( containsKey(key) ) {
return get(key);
}
//}
item = loader.load();
if( item != null ) {
putIfAbsent(key, item);
return get(key);
}
else {
return null;
}
}
|
java
|
public V getOrLoad(K key, CacheLoader<V> loader) {
V item;
// synchronized( this ) {
if( containsKey(key) ) {
return get(key);
}
//}
item = loader.load();
if( item != null ) {
putIfAbsent(key, item);
return get(key);
}
else {
return null;
}
}
|
[
"public",
"V",
"getOrLoad",
"(",
"K",
"key",
",",
"CacheLoader",
"<",
"V",
">",
"loader",
")",
"{",
"V",
"item",
";",
"// synchronized( this ) {",
"if",
"(",
"containsKey",
"(",
"key",
")",
")",
"{",
"return",
"get",
"(",
"key",
")",
";",
"}",
"//}",
"item",
"=",
"loader",
".",
"load",
"(",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"putIfAbsent",
"(",
"key",
",",
"item",
")",
";",
"return",
"get",
"(",
"key",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Retrieves the value for the specified key. If no value is present, this method
will attempt to load a value and place it into the cache. This method appears
atomic in accordance with the contract of a @{link ConcurrentMap}, but any
required loading will actually occur outside of a synchronous block, thus allowing
for other operations on the cache while a load is in process. In the rare
instance that two loads occur simultaneously, the result of the first completed
load will be stored in the cache and the second will be discarded. As a result,
the return value of both calls will be the item loaded from the first load to
complete.
@param key the key being sought
@param loader a loader to load a new value if a value is missing
@return the value matching the specified key or <code>null</code> if no object
exists in the system matching the desired key
|
[
"Retrieves",
"the",
"value",
"for",
"the",
"specified",
"key",
".",
"If",
"no",
"value",
"is",
"present",
"this",
"method",
"will",
"attempt",
"to",
"load",
"a",
"value",
"and",
"place",
"it",
"into",
"the",
"cache",
".",
"This",
"method",
"appears",
"atomic",
"in",
"accordance",
"with",
"the",
"contract",
"of",
"a"
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L226-L242
|
149,256
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.put
|
public V put(K key, V val) {
//synchronized( this ) {
//WeakReference<V> ref = new WeakReference<V>(val);
SoftReference<V> ref = new SoftReference<V>(val);
cache.put(key, ref);
return get(key);
//}
}
|
java
|
public V put(K key, V val) {
//synchronized( this ) {
//WeakReference<V> ref = new WeakReference<V>(val);
SoftReference<V> ref = new SoftReference<V>(val);
cache.put(key, ref);
return get(key);
//}
}
|
[
"public",
"V",
"put",
"(",
"K",
"key",
",",
"V",
"val",
")",
"{",
"//synchronized( this ) {",
"//WeakReference<V> ref = new WeakReference<V>(val);",
"SoftReference",
"<",
"V",
">",
"ref",
"=",
"new",
"SoftReference",
"<",
"V",
">",
"(",
"val",
")",
";",
"cache",
".",
"put",
"(",
"key",
",",
"ref",
")",
";",
"return",
"get",
"(",
"key",
")",
";",
"//}",
"}"
] |
Places the specified value into the cache.
@param key the key for the item being placed into the cache
@param val the item to be cached
@return the resulting value stored in the cache
|
[
"Places",
"the",
"specified",
"value",
"into",
"the",
"cache",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L259-L267
|
149,257
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.putAll
|
public void putAll(Map<? extends K, ? extends V> map) {
//synchronized( this ) {
for(K key : map.keySet() ) {
put(key, map.get(key));
}
//}
}
|
java
|
public void putAll(Map<? extends K, ? extends V> map) {
//synchronized( this ) {
for(K key : map.keySet() ) {
put(key, map.get(key));
}
//}
}
|
[
"public",
"void",
"putAll",
"(",
"Map",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"map",
")",
"{",
"//synchronized( this ) {",
"for",
"(",
"K",
"key",
":",
"map",
".",
"keySet",
"(",
")",
")",
"{",
"put",
"(",
"key",
",",
"map",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"//}",
"}"
] |
Places all elements in the specified map into this cache.
@param map the map to store in this cache.
|
[
"Places",
"all",
"elements",
"in",
"the",
"specified",
"map",
"into",
"this",
"cache",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L282-L288
|
149,258
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.putIfAbsent
|
public V putIfAbsent(K key, V val) {
//synchronized( this ) {
V item;
if( !containsKey(key) ) {
return put(key, val);
}
item = get(key);
if( item instanceof CachedItem ) {
CachedItem ci = (CachedItem)item;
if( !ci.isValidForCache() ) {
put(key, val);
return null;
}
}
return item;
//}
}
|
java
|
public V putIfAbsent(K key, V val) {
//synchronized( this ) {
V item;
if( !containsKey(key) ) {
return put(key, val);
}
item = get(key);
if( item instanceof CachedItem ) {
CachedItem ci = (CachedItem)item;
if( !ci.isValidForCache() ) {
put(key, val);
return null;
}
}
return item;
//}
}
|
[
"public",
"V",
"putIfAbsent",
"(",
"K",
"key",
",",
"V",
"val",
")",
"{",
"//synchronized( this ) {",
"V",
"item",
";",
"if",
"(",
"!",
"containsKey",
"(",
"key",
")",
")",
"{",
"return",
"put",
"(",
"key",
",",
"val",
")",
";",
"}",
"item",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"item",
"instanceof",
"CachedItem",
")",
"{",
"CachedItem",
"ci",
"=",
"(",
"CachedItem",
")",
"item",
";",
"if",
"(",
"!",
"ci",
".",
"isValidForCache",
"(",
")",
")",
"{",
"put",
"(",
"key",
",",
"val",
")",
";",
"return",
"null",
";",
"}",
"}",
"return",
"item",
";",
"//}",
"}"
] |
Conditionally associates the specified value with the specified key if
no value currently exists for the key. The actual value stored with the
key is returned.
@param key the key for which a value is to be stored
@param val the proposed new value
@return the actual value stored with key, whether the old or the new
|
[
"Conditionally",
"associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"if",
"no",
"value",
"currently",
"exists",
"for",
"the",
"key",
".",
"The",
"actual",
"value",
"stored",
"with",
"the",
"key",
"is",
"returned",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L298-L316
|
149,259
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.remove
|
public boolean remove(Object key, Object val) {
String k = key.toString();
// synchronized( this ) {
V item;
if( !containsKey(k) ) {
return false;
}
item = get(k);
if( val == null && item == null ) {
remove(k);
return true;
}
if( val == null || item == null ) {
return false;
}
if( val.equals(item) ) {
remove(k);
return true;
}
// }
return false;
}
|
java
|
public boolean remove(Object key, Object val) {
String k = key.toString();
// synchronized( this ) {
V item;
if( !containsKey(k) ) {
return false;
}
item = get(k);
if( val == null && item == null ) {
remove(k);
return true;
}
if( val == null || item == null ) {
return false;
}
if( val.equals(item) ) {
remove(k);
return true;
}
// }
return false;
}
|
[
"public",
"boolean",
"remove",
"(",
"Object",
"key",
",",
"Object",
"val",
")",
"{",
"String",
"k",
"=",
"key",
".",
"toString",
"(",
")",
";",
"// synchronized( this ) {",
"V",
"item",
";",
"if",
"(",
"!",
"containsKey",
"(",
"k",
")",
")",
"{",
"return",
"false",
";",
"}",
"item",
"=",
"get",
"(",
"k",
")",
";",
"if",
"(",
"val",
"==",
"null",
"&&",
"item",
"==",
"null",
")",
"{",
"remove",
"(",
"k",
")",
";",
"return",
"true",
";",
"}",
"if",
"(",
"val",
"==",
"null",
"||",
"item",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"val",
".",
"equals",
"(",
"item",
")",
")",
"{",
"remove",
"(",
"k",
")",
";",
"return",
"true",
";",
"}",
"// }",
"return",
"false",
";",
"}"
] |
Removes the specified key only if the current value equals the specified value.
If the value does not match the current value, the removal will not occur.
@param key the key to be removed
@param val the value that must be matched by the current value for this key
|
[
"Removes",
"the",
"specified",
"key",
"only",
"if",
"the",
"current",
"value",
"equals",
"the",
"specified",
"value",
".",
"If",
"the",
"value",
"does",
"not",
"match",
"the",
"current",
"value",
"the",
"removal",
"will",
"not",
"occur",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L355-L378
|
149,260
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.replace
|
public V replace(K key, V val) {
// synchronized( this ) {
if( !containsKey(key) ) {
return null;
}
return put(key, val);
//}
}
|
java
|
public V replace(K key, V val) {
// synchronized( this ) {
if( !containsKey(key) ) {
return null;
}
return put(key, val);
//}
}
|
[
"public",
"V",
"replace",
"(",
"K",
"key",
",",
"V",
"val",
")",
"{",
"// synchronized( this ) {",
"if",
"(",
"!",
"containsKey",
"(",
"key",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"put",
"(",
"key",
",",
"val",
")",
";",
"//}",
"}"
] |
Replaces the specified key only if it has some current value.
@param key the key to replace
@param val the new value
@return whatever is stored in the cache for the key when the operation completes
|
[
"Replaces",
"the",
"specified",
"key",
"only",
"if",
"it",
"has",
"some",
"current",
"value",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L386-L393
|
149,261
|
greese/dasein-util
|
src/main/java/org/dasein/util/ConcurrentCache.java
|
ConcurrentCache.replace
|
public boolean replace(K key, V ov, V nv) {
// synchronized( this ) {
if( !remove(key, ov) ) {
return false;
}
put(key, nv);
return true;
//}
}
|
java
|
public boolean replace(K key, V ov, V nv) {
// synchronized( this ) {
if( !remove(key, ov) ) {
return false;
}
put(key, nv);
return true;
//}
}
|
[
"public",
"boolean",
"replace",
"(",
"K",
"key",
",",
"V",
"ov",
",",
"V",
"nv",
")",
"{",
"// synchronized( this ) {",
"if",
"(",
"!",
"remove",
"(",
"key",
",",
"ov",
")",
")",
"{",
"return",
"false",
";",
"}",
"put",
"(",
"key",
",",
"nv",
")",
";",
"return",
"true",
";",
"//}",
"}"
] |
Replaces the current value of the specified key with the proposed new value
only if the current value matches the specified old value.
@param key the key whose value should be replaced
@param ov the old value that should match the current value in the cache
@param nv the new value to put in the cache
@return true if the value was replaced
|
[
"Replaces",
"the",
"current",
"value",
"of",
"the",
"specified",
"key",
"with",
"the",
"proposed",
"new",
"value",
"only",
"if",
"the",
"current",
"value",
"matches",
"the",
"specified",
"old",
"value",
"."
] |
648606dcb4bd382e3287a6c897a32e65d553dc47
|
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L403-L411
|
149,262
|
javagl/Common
|
src/main/java/de/javagl/common/Tuple2.java
|
Tuple2.of
|
public static <S, SS extends S, T, TT extends T> Tuple2<S, T> of(SS s, TT t)
{
return new Tuple2<S, T>(s, t);
}
|
java
|
public static <S, SS extends S, T, TT extends T> Tuple2<S, T> of(SS s, TT t)
{
return new Tuple2<S, T>(s, t);
}
|
[
"public",
"static",
"<",
"S",
",",
"SS",
"extends",
"S",
",",
"T",
",",
"TT",
"extends",
"T",
">",
"Tuple2",
"<",
"S",
",",
"T",
">",
"of",
"(",
"SS",
"s",
",",
"TT",
"t",
")",
"{",
"return",
"new",
"Tuple2",
"<",
"S",
",",
"T",
">",
"(",
"s",
",",
"t",
")",
";",
"}"
] |
Creates a new 2-tuple consisting of the given elements
@param <S> The type of the first element
@param <SS> A subtype of the first element type
@param <T> The type of the second element
@param <TT> A subtype of the second element type
@param s The first element
@param t The second element
@return The new tuple
|
[
"Creates",
"a",
"new",
"2",
"-",
"tuple",
"consisting",
"of",
"the",
"given",
"elements"
] |
5a4876b48c3a2dc61d21324733cf37512d721c33
|
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/Tuple2.java#L50-L53
|
149,263
|
jboss/jboss-jad-api_spec
|
src/main/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java
|
DeploymentFactoryManager.getDeploymentManager
|
public DeploymentManager getDeploymentManager(String uri, String userName, String password) throws DeploymentManagerCreationException
{
Set clone;
synchronized (deploymentFactories)
{
clone = new HashSet(deploymentFactories);
}
for (Iterator i = clone.iterator(); i.hasNext();)
{
DeploymentFactory factory = (DeploymentFactory)i.next();
if (factory.handlesURI(uri))
return factory.getDeploymentManager(uri, userName, password);
}
throw new DeploymentManagerCreationException("No deployment manager for uri=" + uri);
}
|
java
|
public DeploymentManager getDeploymentManager(String uri, String userName, String password) throws DeploymentManagerCreationException
{
Set clone;
synchronized (deploymentFactories)
{
clone = new HashSet(deploymentFactories);
}
for (Iterator i = clone.iterator(); i.hasNext();)
{
DeploymentFactory factory = (DeploymentFactory)i.next();
if (factory.handlesURI(uri))
return factory.getDeploymentManager(uri, userName, password);
}
throw new DeploymentManagerCreationException("No deployment manager for uri=" + uri);
}
|
[
"public",
"DeploymentManager",
"getDeploymentManager",
"(",
"String",
"uri",
",",
"String",
"userName",
",",
"String",
"password",
")",
"throws",
"DeploymentManagerCreationException",
"{",
"Set",
"clone",
";",
"synchronized",
"(",
"deploymentFactories",
")",
"{",
"clone",
"=",
"new",
"HashSet",
"(",
"deploymentFactories",
")",
";",
"}",
"for",
"(",
"Iterator",
"i",
"=",
"clone",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"DeploymentFactory",
"factory",
"=",
"(",
"DeploymentFactory",
")",
"i",
".",
"next",
"(",
")",
";",
"if",
"(",
"factory",
".",
"handlesURI",
"(",
"uri",
")",
")",
"return",
"factory",
".",
"getDeploymentManager",
"(",
"uri",
",",
"userName",
",",
"password",
")",
";",
"}",
"throw",
"new",
"DeploymentManagerCreationException",
"(",
"\"No deployment manager for uri=\"",
"+",
"uri",
")",
";",
"}"
] |
Get a connected deployment manager
@param uri the uri of the deployment manager
@param userName the user name
@param password the password
@return the deployment manager
@throws DeploymentManagerCreationException
|
[
"Get",
"a",
"connected",
"deployment",
"manager"
] |
b5ebffc7082aadf327023d81a799ae6567d20cef
|
https://github.com/jboss/jboss-jad-api_spec/blob/b5ebffc7082aadf327023d81a799ae6567d20cef/src/main/java/javax/enterprise/deploy/shared/factories/DeploymentFactoryManager.java#L86-L100
|
149,264
|
matthewhorridge/binaryowl
|
src/main/java/org/semanticweb/binaryowl/change/OntologyChangeRecordList.java
|
OntologyChangeRecordList.getChangeSignature
|
private Set<OWLEntity> getChangeSignature() {
Set<OWLEntity> result = new HashSet<OWLEntity>();
final OWLOntologyChangeDataVisitor<Set<OWLEntity>, RuntimeException> visitor = new OWLOntologyChangeDataVisitor<Set<OWLEntity>, RuntimeException>() {
@Override
public Set<OWLEntity> visit(AddAxiomData data) throws RuntimeException {
return data.getAxiom().getSignature();
}
@Override
public Set<OWLEntity> visit(RemoveAxiomData data) throws RuntimeException {
return data.getAxiom().getSignature();
}
@Override
public Set<OWLEntity> visit(AddOntologyAnnotationData data) throws RuntimeException {
return data.getAnnotation().getSignature();
}
@Override
public Set<OWLEntity> visit(RemoveOntologyAnnotationData data) throws RuntimeException {
return data.getAnnotation().getSignature();
}
@Override
public Set<OWLEntity> visit(SetOntologyIDData data) throws RuntimeException {
return Collections.emptySet();
}
@Override
public Set<OWLEntity> visit(AddImportData data) throws RuntimeException {
return Collections.emptySet();
}
@Override
public Set<OWLEntity> visit(RemoveImportData data) throws RuntimeException {
return Collections.emptySet();
}
};
for(OWLOntologyChangeRecord record : changeRecords) {
result.addAll(record.getData().accept(visitor));
}
return result;
}
|
java
|
private Set<OWLEntity> getChangeSignature() {
Set<OWLEntity> result = new HashSet<OWLEntity>();
final OWLOntologyChangeDataVisitor<Set<OWLEntity>, RuntimeException> visitor = new OWLOntologyChangeDataVisitor<Set<OWLEntity>, RuntimeException>() {
@Override
public Set<OWLEntity> visit(AddAxiomData data) throws RuntimeException {
return data.getAxiom().getSignature();
}
@Override
public Set<OWLEntity> visit(RemoveAxiomData data) throws RuntimeException {
return data.getAxiom().getSignature();
}
@Override
public Set<OWLEntity> visit(AddOntologyAnnotationData data) throws RuntimeException {
return data.getAnnotation().getSignature();
}
@Override
public Set<OWLEntity> visit(RemoveOntologyAnnotationData data) throws RuntimeException {
return data.getAnnotation().getSignature();
}
@Override
public Set<OWLEntity> visit(SetOntologyIDData data) throws RuntimeException {
return Collections.emptySet();
}
@Override
public Set<OWLEntity> visit(AddImportData data) throws RuntimeException {
return Collections.emptySet();
}
@Override
public Set<OWLEntity> visit(RemoveImportData data) throws RuntimeException {
return Collections.emptySet();
}
};
for(OWLOntologyChangeRecord record : changeRecords) {
result.addAll(record.getData().accept(visitor));
}
return result;
}
|
[
"private",
"Set",
"<",
"OWLEntity",
">",
"getChangeSignature",
"(",
")",
"{",
"Set",
"<",
"OWLEntity",
">",
"result",
"=",
"new",
"HashSet",
"<",
"OWLEntity",
">",
"(",
")",
";",
"final",
"OWLOntologyChangeDataVisitor",
"<",
"Set",
"<",
"OWLEntity",
">",
",",
"RuntimeException",
">",
"visitor",
"=",
"new",
"OWLOntologyChangeDataVisitor",
"<",
"Set",
"<",
"OWLEntity",
">",
",",
"RuntimeException",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Set",
"<",
"OWLEntity",
">",
"visit",
"(",
"AddAxiomData",
"data",
")",
"throws",
"RuntimeException",
"{",
"return",
"data",
".",
"getAxiom",
"(",
")",
".",
"getSignature",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Set",
"<",
"OWLEntity",
">",
"visit",
"(",
"RemoveAxiomData",
"data",
")",
"throws",
"RuntimeException",
"{",
"return",
"data",
".",
"getAxiom",
"(",
")",
".",
"getSignature",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Set",
"<",
"OWLEntity",
">",
"visit",
"(",
"AddOntologyAnnotationData",
"data",
")",
"throws",
"RuntimeException",
"{",
"return",
"data",
".",
"getAnnotation",
"(",
")",
".",
"getSignature",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Set",
"<",
"OWLEntity",
">",
"visit",
"(",
"RemoveOntologyAnnotationData",
"data",
")",
"throws",
"RuntimeException",
"{",
"return",
"data",
".",
"getAnnotation",
"(",
")",
".",
"getSignature",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Set",
"<",
"OWLEntity",
">",
"visit",
"(",
"SetOntologyIDData",
"data",
")",
"throws",
"RuntimeException",
"{",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Set",
"<",
"OWLEntity",
">",
"visit",
"(",
"AddImportData",
"data",
")",
"throws",
"RuntimeException",
"{",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"Set",
"<",
"OWLEntity",
">",
"visit",
"(",
"RemoveImportData",
"data",
")",
"throws",
"RuntimeException",
"{",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"}",
";",
"for",
"(",
"OWLOntologyChangeRecord",
"record",
":",
"changeRecords",
")",
"{",
"result",
".",
"addAll",
"(",
"record",
".",
"getData",
"(",
")",
".",
"accept",
"(",
"visitor",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Gets the signature in the set of change records in this list.
@return The signature.
|
[
"Gets",
"the",
"signature",
"in",
"the",
"set",
"of",
"change",
"records",
"in",
"this",
"list",
"."
] |
7fccfe804120f86b38ca855ddbb569a81a042257
|
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/change/OntologyChangeRecordList.java#L203-L246
|
149,265
|
uniform-java/uniform
|
src/main/java/net/uniform/api/html/OptionGroup.java
|
OptionGroup.removeOption
|
public OptionGroup removeOption(String value) {
if (value == null) {
value = "";
}
options.remove(value);
return this;
}
|
java
|
public OptionGroup removeOption(String value) {
if (value == null) {
value = "";
}
options.remove(value);
return this;
}
|
[
"public",
"OptionGroup",
"removeOption",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"\"\"",
";",
"}",
"options",
".",
"remove",
"(",
"value",
")",
";",
"return",
"this",
";",
"}"
] |
Removes an option from this group by value, if present
@param value Option value to remove
@return This group
|
[
"Removes",
"an",
"option",
"from",
"this",
"group",
"by",
"value",
"if",
"present"
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/api/html/OptionGroup.java#L118-L125
|
149,266
|
uniform-java/uniform
|
src/main/java/net/uniform/api/html/OptionGroup.java
|
OptionGroup.removeOption
|
public OptionGroup removeOption(Option option) {
if (option == null) {
throw new IllegalArgumentException("Option cannot be null");
}
options.remove(option.getValue());
return this;
}
|
java
|
public OptionGroup removeOption(Option option) {
if (option == null) {
throw new IllegalArgumentException("Option cannot be null");
}
options.remove(option.getValue());
return this;
}
|
[
"public",
"OptionGroup",
"removeOption",
"(",
"Option",
"option",
")",
"{",
"if",
"(",
"option",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Option cannot be null\"",
")",
";",
"}",
"options",
".",
"remove",
"(",
"option",
".",
"getValue",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Removes an option from this gruop, if present
@param option Option to remove
@return This group
|
[
"Removes",
"an",
"option",
"from",
"this",
"gruop",
"if",
"present"
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/api/html/OptionGroup.java#L133-L140
|
149,267
|
uniform-java/uniform
|
src/main/java/net/uniform/api/html/OptionGroup.java
|
OptionGroup.hasValueEnabled
|
public boolean hasValueEnabled(String value) {
return enabled && options.containsKey(value) && options.get(value).isEnabled();
}
|
java
|
public boolean hasValueEnabled(String value) {
return enabled && options.containsKey(value) && options.get(value).isEnabled();
}
|
[
"public",
"boolean",
"hasValueEnabled",
"(",
"String",
"value",
")",
"{",
"return",
"enabled",
"&&",
"options",
".",
"containsKey",
"(",
"value",
")",
"&&",
"options",
".",
"get",
"(",
"value",
")",
".",
"isEnabled",
"(",
")",
";",
"}"
] |
Indicates if the group has an option with the given value, which is also enabled.
This group must also be enabled.
@param value Option value to check
@return True if the option for the value exists, it's enabled and this group is enabled
|
[
"Indicates",
"if",
"the",
"group",
"has",
"an",
"option",
"with",
"the",
"given",
"value",
"which",
"is",
"also",
"enabled",
".",
"This",
"group",
"must",
"also",
"be",
"enabled",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/api/html/OptionGroup.java#L158-L160
|
149,268
|
uniform-java/uniform
|
src/main/java/net/uniform/api/html/OptionGroup.java
|
OptionGroup.getOptions
|
public List<Option> getOptions(boolean includeDisabled) {
List<Option> result = new ArrayList<>(); //Keep order
if (!includeDisabled && !enabled) {
return result;//This group is disabled entirely
}
for (Option option : options.values()) {
if (includeDisabled || option.isEnabled()) {
result.add(option);
}
}
return result;
}
|
java
|
public List<Option> getOptions(boolean includeDisabled) {
List<Option> result = new ArrayList<>(); //Keep order
if (!includeDisabled && !enabled) {
return result;//This group is disabled entirely
}
for (Option option : options.values()) {
if (includeDisabled || option.isEnabled()) {
result.add(option);
}
}
return result;
}
|
[
"public",
"List",
"<",
"Option",
">",
"getOptions",
"(",
"boolean",
"includeDisabled",
")",
"{",
"List",
"<",
"Option",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"//Keep order\r",
"if",
"(",
"!",
"includeDisabled",
"&&",
"!",
"enabled",
")",
"{",
"return",
"result",
";",
"//This group is disabled entirely\r",
"}",
"for",
"(",
"Option",
"option",
":",
"options",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"includeDisabled",
"||",
"option",
".",
"isEnabled",
"(",
")",
")",
"{",
"result",
".",
"add",
"(",
"option",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Returns all the options in this group, in list order.
@param includeDisabled Indicates if disabled options should be included in the list.
If the group itself is disabled, its options are also considered as disabled.
@return List of options
|
[
"Returns",
"all",
"the",
"options",
"in",
"this",
"group",
"in",
"list",
"order",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/api/html/OptionGroup.java#L178-L192
|
149,269
|
uniform-java/uniform
|
src/main/java/net/uniform/api/html/OptionGroup.java
|
OptionGroup.getEnabledOptionValues
|
public Set<String> getEnabledOptionValues() {
Set<String> result = new HashSet<>();
if (!enabled) {
return result;//This group is disabled entirely
}
for (Option option : options.values()) {
if (option.isEnabled()) {
result.add(option.getValue());
}
}
return result;
}
|
java
|
public Set<String> getEnabledOptionValues() {
Set<String> result = new HashSet<>();
if (!enabled) {
return result;//This group is disabled entirely
}
for (Option option : options.values()) {
if (option.isEnabled()) {
result.add(option.getValue());
}
}
return result;
}
|
[
"public",
"Set",
"<",
"String",
">",
"getEnabledOptionValues",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"!",
"enabled",
")",
"{",
"return",
"result",
";",
"//This group is disabled entirely\r",
"}",
"for",
"(",
"Option",
"option",
":",
"options",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"option",
".",
"isEnabled",
"(",
")",
")",
"{",
"result",
".",
"add",
"(",
"option",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Returns all the values of the options of this group that are enabled.
If the group itself is disabled, its options are also considered as disabled.
@return Set of values of enabled options
|
[
"Returns",
"all",
"the",
"values",
"of",
"the",
"options",
"of",
"this",
"group",
"that",
"are",
"enabled",
".",
"If",
"the",
"group",
"itself",
"is",
"disabled",
"its",
"options",
"are",
"also",
"considered",
"as",
"disabled",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/api/html/OptionGroup.java#L226-L239
|
149,270
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.newProcessBuilder
|
public B newProcessBuilder(Locale locale)
{
return newProcessBuilder(new Class[] {Queue.class, Locale.class}, new Object[] {this, locale});
}
|
java
|
public B newProcessBuilder(Locale locale)
{
return newProcessBuilder(new Class[] {Queue.class, Locale.class}, new Object[] {this, locale});
}
|
[
"public",
"B",
"newProcessBuilder",
"(",
"Locale",
"locale",
")",
"{",
"return",
"newProcessBuilder",
"(",
"new",
"Class",
"[",
"]",
"{",
"Queue",
".",
"class",
",",
"Locale",
".",
"class",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
",",
"locale",
"}",
")",
";",
"}"
] |
Get a new ProcessBuilder using the supplied Locale.
|
[
"Get",
"a",
"new",
"ProcessBuilder",
"using",
"the",
"supplied",
"Locale",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L118-L121
|
149,271
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.newProcessBuilder
|
private B newProcessBuilder(Class[] param_types, Object[] params)
{
if (process_builder_class != null)
{
try
{
Constructor<B> constructor = process_builder_class.getDeclaredConstructor(param_types);
return constructor.newInstance(params);
}
catch (Exception e)
{
throw new QueujException(e);
}
}
if (parent_queue != null)
return (B)parent_queue.newProcessBuilder(param_types, params);
// else
throw new QueujException("No ProcessBuilder exists for Queue");
}
|
java
|
private B newProcessBuilder(Class[] param_types, Object[] params)
{
if (process_builder_class != null)
{
try
{
Constructor<B> constructor = process_builder_class.getDeclaredConstructor(param_types);
return constructor.newInstance(params);
}
catch (Exception e)
{
throw new QueujException(e);
}
}
if (parent_queue != null)
return (B)parent_queue.newProcessBuilder(param_types, params);
// else
throw new QueujException("No ProcessBuilder exists for Queue");
}
|
[
"private",
"B",
"newProcessBuilder",
"(",
"Class",
"[",
"]",
"param_types",
",",
"Object",
"[",
"]",
"params",
")",
"{",
"if",
"(",
"process_builder_class",
"!=",
"null",
")",
"{",
"try",
"{",
"Constructor",
"<",
"B",
">",
"constructor",
"=",
"process_builder_class",
".",
"getDeclaredConstructor",
"(",
"param_types",
")",
";",
"return",
"constructor",
".",
"newInstance",
"(",
"params",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"QueujException",
"(",
"e",
")",
";",
"}",
"}",
"if",
"(",
"parent_queue",
"!=",
"null",
")",
"return",
"(",
"B",
")",
"parent_queue",
".",
"newProcessBuilder",
"(",
"param_types",
",",
"params",
")",
";",
"// else",
"throw",
"new",
"QueujException",
"(",
"\"No ProcessBuilder exists for Queue\"",
")",
";",
"}"
] |
Private method to instantiate the Queues ProcessBuilder. Will ask the parent Queue
to instantiate its ProcessBuilder if this Queue doesn't have one.
|
[
"Private",
"method",
"to",
"instantiate",
"the",
"Queues",
"ProcessBuilder",
".",
"Will",
"ask",
"the",
"parent",
"Queue",
"to",
"instantiate",
"its",
"ProcessBuilder",
"if",
"this",
"Queue",
"doesn",
"t",
"have",
"one",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L127-L147
|
149,272
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.newQueueBuilder
|
public <P extends ProcessBuilder> QueueBuilder<P> newQueueBuilder(Class<P> process_builder_class)
{
return QueueFactory.newQueueBuilder(this, process_builder_class);
}
|
java
|
public <P extends ProcessBuilder> QueueBuilder<P> newQueueBuilder(Class<P> process_builder_class)
{
return QueueFactory.newQueueBuilder(this, process_builder_class);
}
|
[
"public",
"<",
"P",
"extends",
"ProcessBuilder",
">",
"QueueBuilder",
"<",
"P",
">",
"newQueueBuilder",
"(",
"Class",
"<",
"P",
">",
"process_builder_class",
")",
"{",
"return",
"QueueFactory",
".",
"newQueueBuilder",
"(",
"this",
",",
"process_builder_class",
")",
";",
"}"
] |
Gets a new QueueBuilder using this Queue as the parent.
|
[
"Gets",
"a",
"new",
"QueueBuilder",
"using",
"this",
"Queue",
"as",
"the",
"parent",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L160-L163
|
149,273
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.getBatchProcessServer
|
public BatchProcessServer getBatchProcessServer()
{
if (process_server_class != null)
{
try
{
return process_server_class.newInstance();
}
catch (Exception e)
{
throw new QueujException(e);
}
}
if (parent_queue != null)
return parent_queue.getBatchProcessServer();
// else
throw new QueujException("No BatchProcessServer exists for Queue");
}
|
java
|
public BatchProcessServer getBatchProcessServer()
{
if (process_server_class != null)
{
try
{
return process_server_class.newInstance();
}
catch (Exception e)
{
throw new QueujException(e);
}
}
if (parent_queue != null)
return parent_queue.getBatchProcessServer();
// else
throw new QueujException("No BatchProcessServer exists for Queue");
}
|
[
"public",
"BatchProcessServer",
"getBatchProcessServer",
"(",
")",
"{",
"if",
"(",
"process_server_class",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"process_server_class",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"QueujException",
"(",
"e",
")",
";",
"}",
"}",
"if",
"(",
"parent_queue",
"!=",
"null",
")",
"return",
"parent_queue",
".",
"getBatchProcessServer",
"(",
")",
";",
"// else",
"throw",
"new",
"QueujException",
"(",
"\"No BatchProcessServer exists for Queue\"",
")",
";",
"}"
] |
Instantiate the Queues BatchProcessServer. Will ask the parent Queue
to instantiate its BatchProcessServer if this Queue doesn't have one.
|
[
"Instantiate",
"the",
"Queues",
"BatchProcessServer",
".",
"Will",
"ask",
"the",
"parent",
"Queue",
"to",
"instantiate",
"its",
"BatchProcessServer",
"if",
"this",
"Queue",
"doesn",
"t",
"have",
"one",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L169-L188
|
149,274
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.getDefaultOccurrence
|
Occurrence getDefaultOccurrence()
{
if (default_occurence != null)
return default_occurence;
if (parent_queue != null)
return parent_queue.getDefaultOccurrence();
return null;
}
|
java
|
Occurrence getDefaultOccurrence()
{
if (default_occurence != null)
return default_occurence;
if (parent_queue != null)
return parent_queue.getDefaultOccurrence();
return null;
}
|
[
"Occurrence",
"getDefaultOccurrence",
"(",
")",
"{",
"if",
"(",
"default_occurence",
"!=",
"null",
")",
"return",
"default_occurence",
";",
"if",
"(",
"parent_queue",
"!=",
"null",
")",
"return",
"parent_queue",
".",
"getDefaultOccurrence",
"(",
")",
";",
"return",
"null",
";",
"}"
] |
Gets the Queues default Occurrence. Will ask the parent Queue
to get its default Occurrence if this Queue doesn't have one.
|
[
"Gets",
"the",
"Queues",
"default",
"Occurrence",
".",
"Will",
"ask",
"the",
"parent",
"Queue",
"to",
"get",
"its",
"default",
"Occurrence",
"if",
"this",
"Queue",
"doesn",
"t",
"have",
"one",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L194-L203
|
149,275
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.getDefaultVisibility
|
Visibility getDefaultVisibility()
{
if (default_visibility != null)
return default_visibility;
if (parent_queue != null)
return parent_queue.getDefaultVisibility();
return null;
}
|
java
|
Visibility getDefaultVisibility()
{
if (default_visibility != null)
return default_visibility;
if (parent_queue != null)
return parent_queue.getDefaultVisibility();
return null;
}
|
[
"Visibility",
"getDefaultVisibility",
"(",
")",
"{",
"if",
"(",
"default_visibility",
"!=",
"null",
")",
"return",
"default_visibility",
";",
"if",
"(",
"parent_queue",
"!=",
"null",
")",
"return",
"parent_queue",
".",
"getDefaultVisibility",
"(",
")",
";",
"return",
"null",
";",
"}"
] |
Gets the Queues default Visibility. Will ask the parent Queue
to get its default Visibility if this Queue doesn't have one.
|
[
"Gets",
"the",
"Queues",
"default",
"Visibility",
".",
"Will",
"ask",
"the",
"parent",
"Queue",
"to",
"get",
"its",
"default",
"Visibility",
"if",
"this",
"Queue",
"doesn",
"t",
"have",
"one",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L209-L218
|
149,276
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.getDefaultAccess
|
Access getDefaultAccess()
{
if (default_access != null)
return default_access;
if (parent_queue != null)
return parent_queue.getDefaultAccess();
return null;
}
|
java
|
Access getDefaultAccess()
{
if (default_access != null)
return default_access;
if (parent_queue != null)
return parent_queue.getDefaultAccess();
return null;
}
|
[
"Access",
"getDefaultAccess",
"(",
")",
"{",
"if",
"(",
"default_access",
"!=",
"null",
")",
"return",
"default_access",
";",
"if",
"(",
"parent_queue",
"!=",
"null",
")",
"return",
"parent_queue",
".",
"getDefaultAccess",
"(",
")",
";",
"return",
"null",
";",
"}"
] |
Gets the Queues default Access. Will ask the parent Queue
to get its default Access if this Queue doesn't have one.
|
[
"Gets",
"the",
"Queues",
"default",
"Access",
".",
"Will",
"ask",
"the",
"parent",
"Queue",
"to",
"get",
"its",
"default",
"Access",
"if",
"this",
"Queue",
"doesn",
"t",
"have",
"one",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L224-L233
|
149,277
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.getDefaultResilience
|
Resilience getDefaultResilience()
{
if (default_resilience != null)
return default_resilience;
if (parent_queue != null)
return parent_queue.getDefaultResilience();
return null;
}
|
java
|
Resilience getDefaultResilience()
{
if (default_resilience != null)
return default_resilience;
if (parent_queue != null)
return parent_queue.getDefaultResilience();
return null;
}
|
[
"Resilience",
"getDefaultResilience",
"(",
")",
"{",
"if",
"(",
"default_resilience",
"!=",
"null",
")",
"return",
"default_resilience",
";",
"if",
"(",
"parent_queue",
"!=",
"null",
")",
"return",
"parent_queue",
".",
"getDefaultResilience",
"(",
")",
";",
"return",
"null",
";",
"}"
] |
Gets the Queues default Resilience. Will ask the parent Queue
to get its default Resilience if this Queue doesn't have one.
|
[
"Gets",
"the",
"Queues",
"default",
"Resilience",
".",
"Will",
"ask",
"the",
"parent",
"Queue",
"to",
"get",
"its",
"default",
"Resilience",
"if",
"this",
"Queue",
"doesn",
"t",
"have",
"one",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L239-L248
|
149,278
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.getDefaultOutput
|
Output getDefaultOutput()
{
if (default_output != null)
return default_output;
if (parent_queue != null)
return parent_queue.getDefaultOutput();
return null;
}
|
java
|
Output getDefaultOutput()
{
if (default_output != null)
return default_output;
if (parent_queue != null)
return parent_queue.getDefaultOutput();
return null;
}
|
[
"Output",
"getDefaultOutput",
"(",
")",
"{",
"if",
"(",
"default_output",
"!=",
"null",
")",
"return",
"default_output",
";",
"if",
"(",
"parent_queue",
"!=",
"null",
")",
"return",
"parent_queue",
".",
"getDefaultOutput",
"(",
")",
";",
"return",
"null",
";",
"}"
] |
Gets the Queues default Output. Will ask the parent Queue
to get its default Output if this Queue doesn't have one.
|
[
"Gets",
"the",
"Queues",
"default",
"Output",
".",
"Will",
"ask",
"the",
"parent",
"Queue",
"to",
"get",
"its",
"default",
"Output",
"if",
"this",
"Queue",
"doesn",
"t",
"have",
"one",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L254-L263
|
149,279
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.canRun
|
public boolean canRun(Process process)
{
boolean can_run = restriction == null ? true : restriction.canRun(process.getQueue(), process);
if (can_run && parent_queue != null)
return parent_queue.canRun(process);
return can_run;
}
|
java
|
public boolean canRun(Process process)
{
boolean can_run = restriction == null ? true : restriction.canRun(process.getQueue(), process);
if (can_run && parent_queue != null)
return parent_queue.canRun(process);
return can_run;
}
|
[
"public",
"boolean",
"canRun",
"(",
"Process",
"process",
")",
"{",
"boolean",
"can_run",
"=",
"restriction",
"==",
"null",
"?",
"true",
":",
"restriction",
".",
"canRun",
"(",
"process",
".",
"getQueue",
"(",
")",
",",
"process",
")",
";",
"if",
"(",
"can_run",
"&&",
"parent_queue",
"!=",
"null",
")",
"return",
"parent_queue",
".",
"canRun",
"(",
"process",
")",
";",
"return",
"can_run",
";",
"}"
] |
Check with this Queue and the parent Queue whether the supplied Process can run.
|
[
"Check",
"with",
"this",
"Queue",
"and",
"the",
"parent",
"Queue",
"whether",
"the",
"supplied",
"Process",
"can",
"run",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L280-L286
|
149,280
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.getSelfString
|
private String getSelfString()
{
String queue_string = " {" + new_line;
if (restriction != null)
queue_string += " restriction: " + restriction.toString() + new_line;
if (index != null)
queue_string += " index: " + index.getClass().getName() + new_line;
if (!implementation_options.isEmpty())
queue_string += " implementation options: " + implementation_options.toString() + new_line;
if (process_builder_class != null)
queue_string += " process builder: " + process_builder_class.getName() + new_line;
if (process_server_class != null)
queue_string += " process server: " + process_server_class.getName() + new_line;
if (default_occurence != null)
queue_string += " default occurrence: " + default_occurence.toString() + new_line;
if (default_visibility != null)
queue_string += " default visibility: " + default_visibility.getClass().getName() + new_line;
if (default_access != null)
queue_string += " default access: " + default_access.getClass().getName() + new_line;
if (default_resilience != null)
queue_string += " default resilience: " + default_resilience.toString() + new_line;
if (default_output != null)
queue_string += " default output: " + default_output.getClass().toString() + new_line;
return queue_string + "}" + new_line;
}
|
java
|
private String getSelfString()
{
String queue_string = " {" + new_line;
if (restriction != null)
queue_string += " restriction: " + restriction.toString() + new_line;
if (index != null)
queue_string += " index: " + index.getClass().getName() + new_line;
if (!implementation_options.isEmpty())
queue_string += " implementation options: " + implementation_options.toString() + new_line;
if (process_builder_class != null)
queue_string += " process builder: " + process_builder_class.getName() + new_line;
if (process_server_class != null)
queue_string += " process server: " + process_server_class.getName() + new_line;
if (default_occurence != null)
queue_string += " default occurrence: " + default_occurence.toString() + new_line;
if (default_visibility != null)
queue_string += " default visibility: " + default_visibility.getClass().getName() + new_line;
if (default_access != null)
queue_string += " default access: " + default_access.getClass().getName() + new_line;
if (default_resilience != null)
queue_string += " default resilience: " + default_resilience.toString() + new_line;
if (default_output != null)
queue_string += " default output: " + default_output.getClass().toString() + new_line;
return queue_string + "}" + new_line;
}
|
[
"private",
"String",
"getSelfString",
"(",
")",
"{",
"String",
"queue_string",
"=",
"\" {\"",
"+",
"new_line",
";",
"if",
"(",
"restriction",
"!=",
"null",
")",
"queue_string",
"+=",
"\" restriction: \"",
"+",
"restriction",
".",
"toString",
"(",
")",
"+",
"new_line",
";",
"if",
"(",
"index",
"!=",
"null",
")",
"queue_string",
"+=",
"\" index: \"",
"+",
"index",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"new_line",
";",
"if",
"(",
"!",
"implementation_options",
".",
"isEmpty",
"(",
")",
")",
"queue_string",
"+=",
"\" implementation options: \"",
"+",
"implementation_options",
".",
"toString",
"(",
")",
"+",
"new_line",
";",
"if",
"(",
"process_builder_class",
"!=",
"null",
")",
"queue_string",
"+=",
"\" process builder: \"",
"+",
"process_builder_class",
".",
"getName",
"(",
")",
"+",
"new_line",
";",
"if",
"(",
"process_server_class",
"!=",
"null",
")",
"queue_string",
"+=",
"\" process server: \"",
"+",
"process_server_class",
".",
"getName",
"(",
")",
"+",
"new_line",
";",
"if",
"(",
"default_occurence",
"!=",
"null",
")",
"queue_string",
"+=",
"\" default occurrence: \"",
"+",
"default_occurence",
".",
"toString",
"(",
")",
"+",
"new_line",
";",
"if",
"(",
"default_visibility",
"!=",
"null",
")",
"queue_string",
"+=",
"\" default visibility: \"",
"+",
"default_visibility",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"new_line",
";",
"if",
"(",
"default_access",
"!=",
"null",
")",
"queue_string",
"+=",
"\" default access: \"",
"+",
"default_access",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"new_line",
";",
"if",
"(",
"default_resilience",
"!=",
"null",
")",
"queue_string",
"+=",
"\" default resilience: \"",
"+",
"default_resilience",
".",
"toString",
"(",
")",
"+",
"new_line",
";",
"if",
"(",
"default_output",
"!=",
"null",
")",
"queue_string",
"+=",
"\" default output: \"",
"+",
"default_output",
".",
"getClass",
"(",
")",
".",
"toString",
"(",
")",
"+",
"new_line",
";",
"return",
"queue_string",
"+",
"\"}\"",
"+",
"new_line",
";",
"}"
] |
Get the unique String for this Queue.
|
[
"Get",
"the",
"unique",
"String",
"for",
"this",
"Queue",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L342-L366
|
149,281
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/Queue.java
|
Queue.setId
|
private static synchronized int setId(Queue queue)
{
String queue_string = queue.toString();
if (!queues.contains(queue_string))
queues.add(queue_string);
return queues.indexOf(queue_string);
}
|
java
|
private static synchronized int setId(Queue queue)
{
String queue_string = queue.toString();
if (!queues.contains(queue_string))
queues.add(queue_string);
return queues.indexOf(queue_string);
}
|
[
"private",
"static",
"synchronized",
"int",
"setId",
"(",
"Queue",
"queue",
")",
"{",
"String",
"queue_string",
"=",
"queue",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"queues",
".",
"contains",
"(",
"queue_string",
")",
")",
"queues",
".",
"add",
"(",
"queue_string",
")",
";",
"return",
"queues",
".",
"indexOf",
"(",
"queue_string",
")",
";",
"}"
] |
Set the unique id for this Queue.
|
[
"Set",
"the",
"unique",
"id",
"for",
"this",
"Queue",
"."
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/Queue.java#L374-L380
|
149,282
|
uniform-java/uniform
|
src/main/java/net/uniform/html/elements/DatePicker.java
|
DatePicker.getConvertedValue
|
@Override
public Date getConvertedValue() {
String dateStr = this.getFirstValue();
if (dateStr != null && !dateStr.trim().isEmpty()) {
dateStr = dateStr.trim();
try {
return dateFormat.parse(dateStr);
} catch (ParseException ex) {
throw new UniformException(String.format("Could not parse date %s", dateStr), ex);
}
}
return null;
}
|
java
|
@Override
public Date getConvertedValue() {
String dateStr = this.getFirstValue();
if (dateStr != null && !dateStr.trim().isEmpty()) {
dateStr = dateStr.trim();
try {
return dateFormat.parse(dateStr);
} catch (ParseException ex) {
throw new UniformException(String.format("Could not parse date %s", dateStr), ex);
}
}
return null;
}
|
[
"@",
"Override",
"public",
"Date",
"getConvertedValue",
"(",
")",
"{",
"String",
"dateStr",
"=",
"this",
".",
"getFirstValue",
"(",
")",
";",
"if",
"(",
"dateStr",
"!=",
"null",
"&&",
"!",
"dateStr",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"dateStr",
"=",
"dateStr",
".",
"trim",
"(",
")",
";",
"try",
"{",
"return",
"dateFormat",
".",
"parse",
"(",
"dateStr",
")",
";",
"}",
"catch",
"(",
"ParseException",
"ex",
")",
"{",
"throw",
"new",
"UniformException",
"(",
"String",
".",
"format",
"(",
"\"Could not parse date %s\"",
",",
"dateStr",
")",
",",
"ex",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Returns the value of this element as a Date, automatically converting the value string with the configured date format.
If the value is not empty and its format is incorrect, an exception will be thrown.
@return Date
|
[
"Returns",
"the",
"value",
"of",
"this",
"element",
"as",
"a",
"Date",
"automatically",
"converting",
"the",
"value",
"string",
"with",
"the",
"configured",
"date",
"format",
".",
"If",
"the",
"value",
"is",
"not",
"empty",
"and",
"its",
"format",
"is",
"incorrect",
"an",
"exception",
"will",
"be",
"thrown",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/html/elements/DatePicker.java#L90-L104
|
149,283
|
uniform-java/uniform
|
src/main/java/net/uniform/impl/ElementWithOptions.java
|
ElementWithOptions.addOptionGroup
|
public ElementWithOptions addOptionGroup(OptionGroup optionGroup) {
if (optionGroup == null) {
throw new IllegalArgumentException("Group cannot be null");
}
String groupId = optionGroup.getId();
if (optionGroups.containsKey(groupId)) {
throw new IllegalArgumentException("The group id '" + groupId + "' already present in this element");
}
Set<String> groupValues = optionGroup.getOptionValues();
for (String groupValue : groupValues) {
if (this.hasValue(groupValue)) {
throw new IllegalArgumentException("The value '" + groupValue + "' is already present in this element");
}
}
optionGroups.put(groupId, optionGroup);
return this;
}
|
java
|
public ElementWithOptions addOptionGroup(OptionGroup optionGroup) {
if (optionGroup == null) {
throw new IllegalArgumentException("Group cannot be null");
}
String groupId = optionGroup.getId();
if (optionGroups.containsKey(groupId)) {
throw new IllegalArgumentException("The group id '" + groupId + "' already present in this element");
}
Set<String> groupValues = optionGroup.getOptionValues();
for (String groupValue : groupValues) {
if (this.hasValue(groupValue)) {
throw new IllegalArgumentException("The value '" + groupValue + "' is already present in this element");
}
}
optionGroups.put(groupId, optionGroup);
return this;
}
|
[
"public",
"ElementWithOptions",
"addOptionGroup",
"(",
"OptionGroup",
"optionGroup",
")",
"{",
"if",
"(",
"optionGroup",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Group cannot be null\"",
")",
";",
"}",
"String",
"groupId",
"=",
"optionGroup",
".",
"getId",
"(",
")",
";",
"if",
"(",
"optionGroups",
".",
"containsKey",
"(",
"groupId",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The group id '\"",
"+",
"groupId",
"+",
"\"' already present in this element\"",
")",
";",
"}",
"Set",
"<",
"String",
">",
"groupValues",
"=",
"optionGroup",
".",
"getOptionValues",
"(",
")",
";",
"for",
"(",
"String",
"groupValue",
":",
"groupValues",
")",
"{",
"if",
"(",
"this",
".",
"hasValue",
"(",
"groupValue",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The value '\"",
"+",
"groupValue",
"+",
"\"' is already present in this element\"",
")",
";",
"}",
"}",
"optionGroups",
".",
"put",
"(",
"groupId",
",",
"optionGroup",
")",
";",
"return",
"this",
";",
"}"
] |
Adds an option group to this element.
@param optionGroup New group with unique id and unique values in this element
@return This element
|
[
"Adds",
"an",
"option",
"group",
"to",
"this",
"element",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L46-L65
|
149,284
|
uniform-java/uniform
|
src/main/java/net/uniform/impl/ElementWithOptions.java
|
ElementWithOptions.addOption
|
public ElementWithOptions addOption(Object value, String text) {
return addOptionToGroup(value, text, null);
}
|
java
|
public ElementWithOptions addOption(Object value, String text) {
return addOptionToGroup(value, text, null);
}
|
[
"public",
"ElementWithOptions",
"addOption",
"(",
"Object",
"value",
",",
"String",
"text",
")",
"{",
"return",
"addOptionToGroup",
"(",
"value",
",",
"text",
",",
"null",
")",
";",
"}"
] |
Adds an option to the default option group of this element.
@param value Unique value in this element
@param text Option text
@return This element
|
[
"Adds",
"an",
"option",
"to",
"the",
"default",
"option",
"group",
"of",
"this",
"element",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L84-L86
|
149,285
|
uniform-java/uniform
|
src/main/java/net/uniform/impl/ElementWithOptions.java
|
ElementWithOptions.removeOption
|
public ElementWithOptions removeOption(String value) {
for (OptionGroup group : optionGroups.values()) {
group.removeOption(value);
}
return this;
}
|
java
|
public ElementWithOptions removeOption(String value) {
for (OptionGroup group : optionGroups.values()) {
group.removeOption(value);
}
return this;
}
|
[
"public",
"ElementWithOptions",
"removeOption",
"(",
"String",
"value",
")",
"{",
"for",
"(",
"OptionGroup",
"group",
":",
"optionGroups",
".",
"values",
"(",
")",
")",
"{",
"group",
".",
"removeOption",
"(",
"value",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Removes an option of this element by value.
@param value Option value
@return This element
|
[
"Removes",
"an",
"option",
"of",
"this",
"element",
"by",
"value",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L172-L177
|
149,286
|
uniform-java/uniform
|
src/main/java/net/uniform/impl/ElementWithOptions.java
|
ElementWithOptions.removeOption
|
public ElementWithOptions removeOption(Option option) {
if (option == null) {
throw new IllegalArgumentException("Option cannot be null");
}
for (OptionGroup group : optionGroups.values()) {
group.removeOption(option);
}
return this;
}
|
java
|
public ElementWithOptions removeOption(Option option) {
if (option == null) {
throw new IllegalArgumentException("Option cannot be null");
}
for (OptionGroup group : optionGroups.values()) {
group.removeOption(option);
}
return this;
}
|
[
"public",
"ElementWithOptions",
"removeOption",
"(",
"Option",
"option",
")",
"{",
"if",
"(",
"option",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Option cannot be null\"",
")",
";",
"}",
"for",
"(",
"OptionGroup",
"group",
":",
"optionGroups",
".",
"values",
"(",
")",
")",
"{",
"group",
".",
"removeOption",
"(",
"option",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Removes an option of this element.
@param option Option
@return This element
|
[
"Removes",
"an",
"option",
"of",
"this",
"element",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L185-L194
|
149,287
|
uniform-java/uniform
|
src/main/java/net/uniform/impl/ElementWithOptions.java
|
ElementWithOptions.getOptions
|
public List<Option> getOptions(boolean includeDisabled) {
List< Option> result = new ArrayList<>();
for (OptionGroup group : optionGroups.values()) {
result.addAll(group.getOptions(includeDisabled));
}
return result;
}
|
java
|
public List<Option> getOptions(boolean includeDisabled) {
List< Option> result = new ArrayList<>();
for (OptionGroup group : optionGroups.values()) {
result.addAll(group.getOptions(includeDisabled));
}
return result;
}
|
[
"public",
"List",
"<",
"Option",
">",
"getOptions",
"(",
"boolean",
"includeDisabled",
")",
"{",
"List",
"<",
"Option",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"OptionGroup",
"group",
":",
"optionGroups",
".",
"values",
"(",
")",
")",
"{",
"result",
".",
"addAll",
"(",
"group",
".",
"getOptions",
"(",
"includeDisabled",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns all the options in this element, in list order.
@param includeDisabled Indicates if disabled options should be included in the list.
If a group itself is disabled, its options are also considered as disabled.
@return List of options
|
[
"Returns",
"all",
"the",
"options",
"in",
"this",
"element",
"in",
"list",
"order",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L202-L210
|
149,288
|
uniform-java/uniform
|
src/main/java/net/uniform/impl/ElementWithOptions.java
|
ElementWithOptions.getOptionsValues
|
public Set<String> getOptionsValues() {
Set<String> result = new HashSet<>();
for (OptionGroup group : optionGroups.values()) {
result.addAll(group.getOptionValues());
}
return result;
}
|
java
|
public Set<String> getOptionsValues() {
Set<String> result = new HashSet<>();
for (OptionGroup group : optionGroups.values()) {
result.addAll(group.getOptionValues());
}
return result;
}
|
[
"public",
"Set",
"<",
"String",
">",
"getOptionsValues",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"OptionGroup",
"group",
":",
"optionGroups",
".",
"values",
"(",
")",
")",
"{",
"result",
".",
"addAll",
"(",
"group",
".",
"getOptionValues",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns all the values of the options of this element.
@return Set of values
|
[
"Returns",
"all",
"the",
"values",
"of",
"the",
"options",
"of",
"this",
"element",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L235-L242
|
149,289
|
uniform-java/uniform
|
src/main/java/net/uniform/impl/ElementWithOptions.java
|
ElementWithOptions.getEnabledOptionValues
|
public Set<String> getEnabledOptionValues() {
Set<String> result = new HashSet<>();
for (OptionGroup group : optionGroups.values()) {
result.addAll(group.getEnabledOptionValues());
}
return result;
}
|
java
|
public Set<String> getEnabledOptionValues() {
Set<String> result = new HashSet<>();
for (OptionGroup group : optionGroups.values()) {
result.addAll(group.getEnabledOptionValues());
}
return result;
}
|
[
"public",
"Set",
"<",
"String",
">",
"getEnabledOptionValues",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"OptionGroup",
"group",
":",
"optionGroups",
".",
"values",
"(",
")",
")",
"{",
"result",
".",
"addAll",
"(",
"group",
".",
"getEnabledOptionValues",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns all the values of the options of this element that are enabled.
If a group itself is disabled, its options are also considered as disabled.
@return Set of values of enabled options
|
[
"Returns",
"all",
"the",
"values",
"of",
"the",
"options",
"of",
"this",
"element",
"that",
"are",
"enabled",
".",
"If",
"a",
"group",
"itself",
"is",
"disabled",
"its",
"options",
"are",
"also",
"considered",
"as",
"disabled",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L249-L256
|
149,290
|
uniform-java/uniform
|
src/main/java/net/uniform/impl/ElementWithOptions.java
|
ElementWithOptions.setOptions
|
public ElementWithOptions setOptions(LinkedHashMap<String, String> options) {
this.optionGroups.clear();
for (Map.Entry<String, String> entry : options.entrySet()) {
this.addOption(entry.getKey(), entry.getValue());
}
return this;
}
|
java
|
public ElementWithOptions setOptions(LinkedHashMap<String, String> options) {
this.optionGroups.clear();
for (Map.Entry<String, String> entry : options.entrySet()) {
this.addOption(entry.getKey(), entry.getValue());
}
return this;
}
|
[
"public",
"ElementWithOptions",
"setOptions",
"(",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"this",
".",
"optionGroups",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"options",
".",
"entrySet",
"(",
")",
")",
"{",
"this",
".",
"addOption",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Replaces all options of this element.
@param options Options to use. {@link LinkedHashMap} to keep options original ordering.
@return This element
|
[
"Replaces",
"all",
"options",
"of",
"this",
"element",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L283-L290
|
149,291
|
uniform-java/uniform
|
src/main/java/net/uniform/impl/ElementWithOptions.java
|
ElementWithOptions.hasValueEnabled
|
public boolean hasValueEnabled(String value) {
for (OptionGroup group : optionGroups.values()) {
if (group.hasValueEnabled(value)) {
return true;
}
}
return false;
}
|
java
|
public boolean hasValueEnabled(String value) {
for (OptionGroup group : optionGroups.values()) {
if (group.hasValueEnabled(value)) {
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"hasValueEnabled",
"(",
"String",
"value",
")",
"{",
"for",
"(",
"OptionGroup",
"group",
":",
"optionGroups",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"group",
".",
"hasValueEnabled",
"(",
"value",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Indicates if the element has an enabled value in any of its groups, that must also be enabled.
@param value Value
@return True if the value exists and is enabled, false otherwise
|
[
"Indicates",
"if",
"the",
"element",
"has",
"an",
"enabled",
"value",
"in",
"any",
"of",
"its",
"groups",
"that",
"must",
"also",
"be",
"enabled",
"."
] |
0b84f0db562253165bc06c69f631e464dca0cb48
|
https://github.com/uniform-java/uniform/blob/0b84f0db562253165bc06c69f631e464dca0cb48/src/main/java/net/uniform/impl/ElementWithOptions.java#L314-L322
|
149,292
|
mike10004/common-helper
|
native-helper/src/main/java/com/github/mike10004/nativehelper/subprocess/StreamConduit.java
|
StreamConduit.createProcessOutputPump
|
private void createProcessOutputPump(InputStream is, OutputStream os) {
outputThread = createPump(is, os, CLOSE_STDOUT_AND_STDERR_INSTREAMS_WHEN_EXHAUSTED);
}
|
java
|
private void createProcessOutputPump(InputStream is, OutputStream os) {
outputThread = createPump(is, os, CLOSE_STDOUT_AND_STDERR_INSTREAMS_WHEN_EXHAUSTED);
}
|
[
"private",
"void",
"createProcessOutputPump",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
")",
"{",
"outputThread",
"=",
"createPump",
"(",
"is",
",",
"os",
",",
"CLOSE_STDOUT_AND_STDERR_INSTREAMS_WHEN_EXHAUSTED",
")",
";",
"}"
] |
Create the pump to handle process output.
@param is the <code>InputStream</code>.
@param os the <code>OutputStream</code>.
|
[
"Create",
"the",
"pump",
"to",
"handle",
"process",
"output",
"."
] |
744f82d9b0768a9ad9c63a57a37ab2c93bf408f4
|
https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/native-helper/src/main/java/com/github/mike10004/nativehelper/subprocess/StreamConduit.java#L190-L192
|
149,293
|
mike10004/common-helper
|
native-helper/src/main/java/com/github/mike10004/nativehelper/subprocess/StreamConduit.java
|
StreamConduit.createProcessErrorPump
|
private void createProcessErrorPump(InputStream is, OutputStream os) {
errorThread = createPump(is, os, CLOSE_STDOUT_AND_STDERR_INSTREAMS_WHEN_EXHAUSTED);
}
|
java
|
private void createProcessErrorPump(InputStream is, OutputStream os) {
errorThread = createPump(is, os, CLOSE_STDOUT_AND_STDERR_INSTREAMS_WHEN_EXHAUSTED);
}
|
[
"private",
"void",
"createProcessErrorPump",
"(",
"InputStream",
"is",
",",
"OutputStream",
"os",
")",
"{",
"errorThread",
"=",
"createPump",
"(",
"is",
",",
"os",
",",
"CLOSE_STDOUT_AND_STDERR_INSTREAMS_WHEN_EXHAUSTED",
")",
";",
"}"
] |
Create the pump to handle error output.
@param is the input stream to copy from.
@param os the output stream to copy to.
|
[
"Create",
"the",
"pump",
"to",
"handle",
"error",
"output",
"."
] |
744f82d9b0768a9ad9c63a57a37ab2c93bf408f4
|
https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/native-helper/src/main/java/com/github/mike10004/nativehelper/subprocess/StreamConduit.java#L199-L201
|
149,294
|
workplacesystems/queuj
|
src/main/java/com/workplacesystems/queuj/process/java/JavaProcessSession.java
|
JavaProcessSession.incrementCurrentSection
|
public void incrementCurrentSection()
{
if (runner_controlled_sections)
{
// assume the current run object is at least a JavaProcessRunner!
rollback_section = current_section;
current_section = getCurrentSection().incrementCurrentSection(current_section);
}
else
{
// as previously
rollback_section = current_section;
current_section++;
}
}
|
java
|
public void incrementCurrentSection()
{
if (runner_controlled_sections)
{
// assume the current run object is at least a JavaProcessRunner!
rollback_section = current_section;
current_section = getCurrentSection().incrementCurrentSection(current_section);
}
else
{
// as previously
rollback_section = current_section;
current_section++;
}
}
|
[
"public",
"void",
"incrementCurrentSection",
"(",
")",
"{",
"if",
"(",
"runner_controlled_sections",
")",
"{",
"// assume the current run object is at least a JavaProcessRunner!",
"rollback_section",
"=",
"current_section",
";",
"current_section",
"=",
"getCurrentSection",
"(",
")",
".",
"incrementCurrentSection",
"(",
"current_section",
")",
";",
"}",
"else",
"{",
"// as previously ",
"rollback_section",
"=",
"current_section",
";",
"current_section",
"++",
";",
"}",
"}"
] |
normally just increments, but for Integration, defers to the run object
|
[
"normally",
"just",
"increments",
"but",
"for",
"Integration",
"defers",
"to",
"the",
"run",
"object"
] |
4293116b412b4a20ead99963b9b05a135812c501
|
https://github.com/workplacesystems/queuj/blob/4293116b412b4a20ead99963b9b05a135812c501/src/main/java/com/workplacesystems/queuj/process/java/JavaProcessSession.java#L88-L102
|
149,295
|
pryzach/midao
|
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java
|
QueryParameters.updateType
|
public QueryParameters updateType(String key, Integer type) {
this.types.put(processKey(key), type);
return this;
}
|
java
|
public QueryParameters updateType(String key, Integer type) {
this.types.put(processKey(key), type);
return this;
}
|
[
"public",
"QueryParameters",
"updateType",
"(",
"String",
"key",
",",
"Integer",
"type",
")",
"{",
"this",
".",
"types",
".",
"put",
"(",
"processKey",
"(",
"key",
")",
",",
"type",
")",
";",
"return",
"this",
";",
"}"
] |
Updates type of specified key
@param key Key
@param type SQL Type
@return this instance of QueryParameters
|
[
"Updates",
"type",
"of",
"specified",
"key"
] |
ed9048ed2c792a4794a2116a25779dfb84cd9447
|
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java#L288-L292
|
149,296
|
pryzach/midao
|
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java
|
QueryParameters.updateDirection
|
public QueryParameters updateDirection(String key, Direction direction) {
this.direction.put(processKey(key), direction);
return this;
}
|
java
|
public QueryParameters updateDirection(String key, Direction direction) {
this.direction.put(processKey(key), direction);
return this;
}
|
[
"public",
"QueryParameters",
"updateDirection",
"(",
"String",
"key",
",",
"Direction",
"direction",
")",
"{",
"this",
".",
"direction",
".",
"put",
"(",
"processKey",
"(",
"key",
")",
",",
"direction",
")",
";",
"return",
"this",
";",
"}"
] |
Updates direction of specified key
@param key Key
@param direction Direction
@return this instance of QueryParameters
|
[
"Updates",
"direction",
"of",
"specified",
"key"
] |
ed9048ed2c792a4794a2116a25779dfb84cd9447
|
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java#L301-L305
|
149,297
|
pryzach/midao
|
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java
|
QueryParameters.updatePosition
|
public QueryParameters updatePosition(String key, Integer position) {
while (this.order.size() < position + 1) {
this.order.add(null);
}
this.order.set(position, processKey(key));
return this;
}
|
java
|
public QueryParameters updatePosition(String key, Integer position) {
while (this.order.size() < position + 1) {
this.order.add(null);
}
this.order.set(position, processKey(key));
return this;
}
|
[
"public",
"QueryParameters",
"updatePosition",
"(",
"String",
"key",
",",
"Integer",
"position",
")",
"{",
"while",
"(",
"this",
".",
"order",
".",
"size",
"(",
")",
"<",
"position",
"+",
"1",
")",
"{",
"this",
".",
"order",
".",
"add",
"(",
"null",
")",
";",
"}",
"this",
".",
"order",
".",
"set",
"(",
"position",
",",
"processKey",
"(",
"key",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Updates position of specified key
@param key Key
@param position Position
@return this instance of QueryParameters
|
[
"Updates",
"position",
"of",
"specified",
"key"
] |
ed9048ed2c792a4794a2116a25779dfb84cd9447
|
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java#L314-L322
|
149,298
|
pryzach/midao
|
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java
|
QueryParameters.updateValue
|
public QueryParameters updateValue(String key, Object value) {
this.values.put(processKey(key), value);
return this;
}
|
java
|
public QueryParameters updateValue(String key, Object value) {
this.values.put(processKey(key), value);
return this;
}
|
[
"public",
"QueryParameters",
"updateValue",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"this",
".",
"values",
".",
"put",
"(",
"processKey",
"(",
"key",
")",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] |
Updates value of specified key
@param key Key
@param value Value
@return this instance of QueryParameters
|
[
"Updates",
"value",
"of",
"specified",
"key"
] |
ed9048ed2c792a4794a2116a25779dfb84cd9447
|
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java#L331-L335
|
149,299
|
pryzach/midao
|
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java
|
QueryParameters.getFirstPosition
|
public Integer getFirstPosition(String key) {
int position = -1;
String processedKey = processKey(key);
if (this.values.containsKey(processedKey) == true) {
position = this.order.indexOf(processedKey);
}
return position;
}
|
java
|
public Integer getFirstPosition(String key) {
int position = -1;
String processedKey = processKey(key);
if (this.values.containsKey(processedKey) == true) {
position = this.order.indexOf(processedKey);
}
return position;
}
|
[
"public",
"Integer",
"getFirstPosition",
"(",
"String",
"key",
")",
"{",
"int",
"position",
"=",
"-",
"1",
";",
"String",
"processedKey",
"=",
"processKey",
"(",
"key",
")",
";",
"if",
"(",
"this",
".",
"values",
".",
"containsKey",
"(",
"processedKey",
")",
"==",
"true",
")",
"{",
"position",
"=",
"this",
".",
"order",
".",
"indexOf",
"(",
"processedKey",
")",
";",
"}",
"return",
"position",
";",
"}"
] |
Returns position of specified key
@param key Key
@return this instance of QueryParameters
|
[
"Returns",
"position",
"of",
"specified",
"key"
] |
ed9048ed2c792a4794a2116a25779dfb84cd9447
|
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/QueryParameters.java#L343-L351
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.