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 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
brianwhu/xillium | base/src/main/java/org/xillium/base/util/Pair.java | Pair.cleanse | @SuppressWarnings("unchecked")
public static <T> T cleanse(T list, T element) {
if (list == null || list == element) {
return null;
} else if (list instanceof Pair) {
Pair<T, T> pair = (Pair<T, T>)list;
if (pair.first == element) {
return pair.second;
} else if (pair.second == element) {
return pair.first;
} else if (pair.second instanceof Pair) {
pair.second = cleanse(pair.second, element);
}
}
return list;
} | java | @SuppressWarnings("unchecked")
public static <T> T cleanse(T list, T element) {
if (list == null || list == element) {
return null;
} else if (list instanceof Pair) {
Pair<T, T> pair = (Pair<T, T>)list;
if (pair.first == element) {
return pair.second;
} else if (pair.second == element) {
return pair.first;
} else if (pair.second instanceof Pair) {
pair.second = cleanse(pair.second, element);
}
}
return list;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"cleanse",
"(",
"T",
"list",
",",
"T",
"element",
")",
"{",
"if",
"(",
"list",
"==",
"null",
"||",
"list",
"==",
"element",
")",
"{",
"return",
"null",
";",
... | Cleanses an isomorphic list of a particular element. Only one thread should be updating the list at a time.
Usage: {@code feature = Pair.cleanse(feature, f2);}
@param <T> the type of the elements in the isomorphic list
@param list a list represented by the first Pair object isomorphic to the elements, or an element when the list is trivial
@param element the element to remove
@return the original isomorphic list with the given element cleansed | [
"Cleanses",
"an",
"isomorphic",
"list",
"of",
"a",
"particular",
"element",
".",
"Only",
"one",
"thread",
"should",
"be",
"updating",
"the",
"list",
"at",
"a",
"time",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/util/Pair.java#L46-L62 | train |
brianwhu/xillium | base/src/main/java/org/xillium/base/util/Pair.java | Pair.includes | @SuppressWarnings("unchecked")
public static <T> boolean includes(T list, T element) {
if (list == null) {
return false;
} else if (list == element) {
return true;
} else if (list instanceof Pair) {
Pair<T, T> pair = (Pair<T, T>)list;
if (pair.first == element || pair.second == element) {
return true;
} else if (pair.second instanceof Pair) {
return includes(pair.second, element);
} else {
return false;
}
} else {
return false;
}
} | java | @SuppressWarnings("unchecked")
public static <T> boolean includes(T list, T element) {
if (list == null) {
return false;
} else if (list == element) {
return true;
} else if (list instanceof Pair) {
Pair<T, T> pair = (Pair<T, T>)list;
if (pair.first == element || pair.second == element) {
return true;
} else if (pair.second instanceof Pair) {
return includes(pair.second, element);
} else {
return false;
}
} else {
return false;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"boolean",
"includes",
"(",
"T",
"list",
",",
"T",
"element",
")",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
... | Tests whether an isomorphic list includes a particular element.
@param <T> the type of the elements in the isomorphic list
@param list a list represented by the first Pair object isomorphic to the elements, or an element when the list is trivial
@param element the element to look for
@return whether the list includes the element | [
"Tests",
"whether",
"an",
"isomorphic",
"list",
"includes",
"a",
"particular",
"element",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/util/Pair.java#L72-L90 | train |
brianwhu/xillium | base/src/main/java/org/xillium/base/util/Pair.java | Pair.count | @SuppressWarnings("unchecked")
public static <T> int count(T list) {
if (list == null) {
return 0;
} else if (list instanceof Pair) {
return 1 + count(((Pair<T, T>)list).second);
} else {
return 1;
}
} | java | @SuppressWarnings("unchecked")
public static <T> int count(T list) {
if (list == null) {
return 0;
} else if (list instanceof Pair) {
return 1 + count(((Pair<T, T>)list).second);
} else {
return 1;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"int",
"count",
"(",
"T",
"list",
")",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"list",
"instanceof",
"Pair",
... | Counts the number of elements in an isomorphic list.
@param <T> the type of the elements in the isomorphic list
@param list - a list represented by the first Pair object isomorphic to the elements, or an element when the list is trivial
@return the number of elements discovered | [
"Counts",
"the",
"number",
"of",
"elements",
"in",
"an",
"isomorphic",
"list",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/util/Pair.java#L99-L108 | train |
brianwhu/xillium | base/src/main/java/org/xillium/base/util/Pair.java | Pair.traverse | @SuppressWarnings("unchecked")
public static <T> int traverse(T list, Functor<?, T> func) {
if (list == null) {
return 0;
} else if (list instanceof Pair) {
Pair<T, T> pair = (Pair<T, T>)list;
func.invoke(pair.first);
return 1 + traverse(pair.second, func);
} else {
func.invoke(list);
return 1;
}
} | java | @SuppressWarnings("unchecked")
public static <T> int traverse(T list, Functor<?, T> func) {
if (list == null) {
return 0;
} else if (list instanceof Pair) {
Pair<T, T> pair = (Pair<T, T>)list;
func.invoke(pair.first);
return 1 + traverse(pair.second, func);
} else {
func.invoke(list);
return 1;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"int",
"traverse",
"(",
"T",
"list",
",",
"Functor",
"<",
"?",
",",
"T",
">",
"func",
")",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"return",
"0",
";",
... | Traverses an isomorphic list using a Functor. The return values from the functor are discarded.
@param <T> the type of the elements in the isomorphic list
@param list - a list represented by the first Pair object isomorphic to the elements, or an element when the list is trivial
@param func - a functor that will be invoked to inspect the elements, one at a time
@return the number of elements traversed | [
"Traverses",
"an",
"isomorphic",
"list",
"using",
"a",
"Functor",
".",
"The",
"return",
"values",
"from",
"the",
"functor",
"are",
"discarded",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/util/Pair.java#L118-L130 | train |
brianwhu/xillium | base/src/main/java/org/xillium/base/beans/JSONBuilder.java | JSONBuilder.quote | public JSONBuilder quote(String value) {
_sb.append('"');
for (int i = 0; i < value.length(); ++i) {
char c = value.charAt(i);
switch (c) {
case '"':
_sb.append("\\\"");
break;
case '\\':
_sb.append("\\\\");
break;
default:
if (c < 0x20) {
_sb.append(CTRLCHARS[c]);
} else {
_sb.append(c);
}
break;
}
}
_sb.append('"');
return this;
} | java | public JSONBuilder quote(String value) {
_sb.append('"');
for (int i = 0; i < value.length(); ++i) {
char c = value.charAt(i);
switch (c) {
case '"':
_sb.append("\\\"");
break;
case '\\':
_sb.append("\\\\");
break;
default:
if (c < 0x20) {
_sb.append(CTRLCHARS[c]);
} else {
_sb.append(c);
}
break;
}
}
_sb.append('"');
return this;
} | [
"public",
"JSONBuilder",
"quote",
"(",
"String",
"value",
")",
"{",
"_sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"value",
".",
"length",
"(",
")",
";",
"++",
"i",
")",
"{",
"char",
"c",
"=",
... | Quotes properly a string and appends it to the JSON stream.
@param value - a liternal string to quote and then append
@return the JSONBuilder itself | [
"Quotes",
"properly",
"a",
"string",
"and",
"appends",
"it",
"to",
"the",
"JSON",
"stream",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/beans/JSONBuilder.java#L65-L87 | train |
brianwhu/xillium | base/src/main/java/org/xillium/base/beans/JSONBuilder.java | JSONBuilder.serialize | public JSONBuilder serialize(Object value) {
if (value == null) {
_sb.append("null");
} else {
Class<?> t = value.getClass();
if (t.isArray()) {
_sb.append('[');
boolean hasElements = false;
for (int i = 0, ii = Array.getLength(value); i < ii; ++i) {
serialize(Array.get(value, i));
_sb.append(',');
hasElements = true;
}
if (hasElements) {
_sb.setCharAt(_sb.length()-1, ']');
} else {
_sb.append(']');
}
} else if (Iterable.class.isAssignableFrom(t)) {
_sb.append('[');
boolean hasElements = false;
for (Object object: (Iterable<?>)value) {
serialize(object);
_sb.append(',');
hasElements = true;
}
if (hasElements) {
_sb.setCharAt(_sb.length()-1, ']');
} else {
_sb.append(']');
}
} else if (Number.class.isAssignableFrom(t) || Boolean.class.isAssignableFrom(t)) {
_sb.append(value.toString());
} else if (String.class == t) {
quote((String)value);
} else {
quote(value.toString());
}
}
return this;
} | java | public JSONBuilder serialize(Object value) {
if (value == null) {
_sb.append("null");
} else {
Class<?> t = value.getClass();
if (t.isArray()) {
_sb.append('[');
boolean hasElements = false;
for (int i = 0, ii = Array.getLength(value); i < ii; ++i) {
serialize(Array.get(value, i));
_sb.append(',');
hasElements = true;
}
if (hasElements) {
_sb.setCharAt(_sb.length()-1, ']');
} else {
_sb.append(']');
}
} else if (Iterable.class.isAssignableFrom(t)) {
_sb.append('[');
boolean hasElements = false;
for (Object object: (Iterable<?>)value) {
serialize(object);
_sb.append(',');
hasElements = true;
}
if (hasElements) {
_sb.setCharAt(_sb.length()-1, ']');
} else {
_sb.append(']');
}
} else if (Number.class.isAssignableFrom(t) || Boolean.class.isAssignableFrom(t)) {
_sb.append(value.toString());
} else if (String.class == t) {
quote((String)value);
} else {
quote(value.toString());
}
}
return this;
} | [
"public",
"JSONBuilder",
"serialize",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"_sb",
".",
"append",
"(",
"\"null\"",
")",
";",
"}",
"else",
"{",
"Class",
"<",
"?",
">",
"t",
"=",
"value",
".",
"getClass",
"(",
... | Serializes an object and appends it to the stream.
@param value - an object to serialize
@return the JSONBuilder itself | [
"Serializes",
"an",
"object",
"and",
"appends",
"it",
"to",
"the",
"stream",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/beans/JSONBuilder.java#L95-L135 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/ExceptionThrower.java | ExceptionThrower.createExceptionMessage | protected String createExceptionMessage(final String message, final Object... messageParameters) {
if (ArrayUtils.isEmpty(messageParameters)) {
return message;
} else {
return String.format(message, messageParameters);
}
} | java | protected String createExceptionMessage(final String message, final Object... messageParameters) {
if (ArrayUtils.isEmpty(messageParameters)) {
return message;
} else {
return String.format(message, messageParameters);
}
} | [
"protected",
"String",
"createExceptionMessage",
"(",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"messageParameters",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isEmpty",
"(",
"messageParameters",
")",
")",
"{",
"return",
"message",
";",
"}",
"... | Create a string message by string format.
@param message
@param messageParameters
@return | [
"Create",
"a",
"string",
"message",
"by",
"string",
"format",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/ExceptionThrower.java#L65-L72 | train |
apruve/apruve-java | src/main/java/com/apruve/models/PaymentRequest.java | PaymentRequest.get | public static ApruveResponse<PaymentRequest> get(String paymentRequestId) {
return ApruveClient.getInstance().get(
PAYMENT_REQUESTS_PATH + paymentRequestId, PaymentRequest.class);
} | java | public static ApruveResponse<PaymentRequest> get(String paymentRequestId) {
return ApruveClient.getInstance().get(
PAYMENT_REQUESTS_PATH + paymentRequestId, PaymentRequest.class);
} | [
"public",
"static",
"ApruveResponse",
"<",
"PaymentRequest",
">",
"get",
"(",
"String",
"paymentRequestId",
")",
"{",
"return",
"ApruveClient",
".",
"getInstance",
"(",
")",
".",
"get",
"(",
"PAYMENT_REQUESTS_PATH",
"+",
"paymentRequestId",
",",
"PaymentRequest",
... | Fetches the PaymentRequest with the given ID from Apruve.
@see <a
href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a>
@param paymentRequestId
@return PaymentRequest, or null if not found | [
"Fetches",
"the",
"PaymentRequest",
"with",
"the",
"given",
"ID",
"from",
"Apruve",
"."
] | b188d6b17f777823c2e46427847318849978685e | https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/PaymentRequest.java#L110-L113 | train |
apruve/apruve-java | src/main/java/com/apruve/models/PaymentRequest.java | PaymentRequest.toSecureHash | public String toSecureHash() {
String apiKey = ApruveClient.getInstance().getApiKey();
String shaInput = apiKey + toValueString();
return ShaUtil.getDigest(shaInput);
} | java | public String toSecureHash() {
String apiKey = ApruveClient.getInstance().getApiKey();
String shaInput = apiKey + toValueString();
return ShaUtil.getDigest(shaInput);
} | [
"public",
"String",
"toSecureHash",
"(",
")",
"{",
"String",
"apiKey",
"=",
"ApruveClient",
".",
"getInstance",
"(",
")",
".",
"getApiKey",
"(",
")",
";",
"String",
"shaInput",
"=",
"apiKey",
"+",
"toValueString",
"(",
")",
";",
"return",
"ShaUtil",
".",
... | For use by merchants, and depends on proper initialization of
ApruveClient. Returns the secure hash for a PaymentRequest, suitable for
use with the property of apruve.js JavaScript library on a merchant
checkout page. Use this to populate the value of apruve.secureHash.
@return | [
"For",
"use",
"by",
"merchants",
"and",
"depends",
"on",
"proper",
"initialization",
"of",
"ApruveClient",
".",
"Returns",
"the",
"secure",
"hash",
"for",
"a",
"PaymentRequest",
"suitable",
"for",
"use",
"with",
"the",
"property",
"of",
"apruve",
".",
"js",
... | b188d6b17f777823c2e46427847318849978685e | https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/PaymentRequest.java#L180-L185 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javadoc/AnnotationTypeElementDocImpl.java | AnnotationTypeElementDocImpl.defaultValue | public AnnotationValue defaultValue() {
return (sym.defaultValue == null)
? null
: new AnnotationValueImpl(env, sym.defaultValue);
} | java | public AnnotationValue defaultValue() {
return (sym.defaultValue == null)
? null
: new AnnotationValueImpl(env, sym.defaultValue);
} | [
"public",
"AnnotationValue",
"defaultValue",
"(",
")",
"{",
"return",
"(",
"sym",
".",
"defaultValue",
"==",
"null",
")",
"?",
"null",
":",
"new",
"AnnotationValueImpl",
"(",
"env",
",",
"sym",
".",
"defaultValue",
")",
";",
"}"
] | Returns the default value of this element.
Returns null if this element has no default. | [
"Returns",
"the",
"default",
"value",
"of",
"this",
"element",
".",
"Returns",
"null",
"if",
"this",
"element",
"has",
"no",
"default",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/AnnotationTypeElementDocImpl.java#L85-L89 | train |
theHilikus/JRoboCom | jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/GUI.java | GUI.sessionReady | public void sessionReady(boolean isReady) {
if (isReady) {
speedSlider.setValue(session.getClockPeriod());
}
startAction.setEnabled(isReady);
speedSlider.setEnabled(isReady);
stepAction.setEnabled(isReady);
reloadAction.setEnabled(isReady);
} | java | public void sessionReady(boolean isReady) {
if (isReady) {
speedSlider.setValue(session.getClockPeriod());
}
startAction.setEnabled(isReady);
speedSlider.setEnabled(isReady);
stepAction.setEnabled(isReady);
reloadAction.setEnabled(isReady);
} | [
"public",
"void",
"sessionReady",
"(",
"boolean",
"isReady",
")",
"{",
"if",
"(",
"isReady",
")",
"{",
"speedSlider",
".",
"setValue",
"(",
"session",
".",
"getClockPeriod",
"(",
")",
")",
";",
"}",
"startAction",
".",
"setEnabled",
"(",
"isReady",
")",
... | Changes the UI depending on whether the session is ready or not
@param isReady true if session was configured correctly; false otherwise | [
"Changes",
"the",
"UI",
"depending",
"on",
"whether",
"the",
"session",
"is",
"ready",
"or",
"not"
] | 0e31c1ecf1006e35f68c229ff66c37640effffac | https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/GUI.java#L298-L307 | train |
xerial/xerial | xerial-core/src/main/scala/xerial/core/io/ReaderInputStream.java | ReaderInputStream.mark | @Override
public synchronized void mark(final int limit) {
try {
in.mark(limit);
}
catch (IOException ioe) {
throw new RuntimeException(ioe.getMessage());
}
} | java | @Override
public synchronized void mark(final int limit) {
try {
in.mark(limit);
}
catch (IOException ioe) {
throw new RuntimeException(ioe.getMessage());
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"mark",
"(",
"final",
"int",
"limit",
")",
"{",
"try",
"{",
"in",
".",
"mark",
"(",
"limit",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"ioe",... | Marks the read limit of the StringReader.
@param limit
the maximum limit of bytes that can be read before the mark
position becomes invalid | [
"Marks",
"the",
"read",
"limit",
"of",
"the",
"StringReader",
"."
] | 049741cf73ed0214717f2f587994a553bee63a2c | https://github.com/xerial/xerial/blob/049741cf73ed0214717f2f587994a553bee63a2c/xerial-core/src/main/scala/xerial/core/io/ReaderInputStream.java#L176-L184 | train |
xerial/xerial | xerial-core/src/main/scala/xerial/core/io/ReaderInputStream.java | ReaderInputStream.reset | @Override
public synchronized void reset() throws IOException {
if (in == null) {
throw new IOException("Stream Closed");
}
slack = null;
in.reset();
} | java | @Override
public synchronized void reset() throws IOException {
if (in == null) {
throw new IOException("Stream Closed");
}
slack = null;
in.reset();
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"reset",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"in",
"==",
"null",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Stream Closed\"",
")",
";",
"}",
"slack",
"=",
"null",
";",
"in",
".",
"... | Resets the StringReader.
@exception IOException
if the StringReader fails to be reset | [
"Resets",
"the",
"StringReader",
"."
] | 049741cf73ed0214717f2f587994a553bee63a2c | https://github.com/xerial/xerial/blob/049741cf73ed0214717f2f587994a553bee63a2c/xerial-core/src/main/scala/xerial/core/io/ReaderInputStream.java#L221-L228 | train |
xerial/xerial | xerial-core/src/main/scala/xerial/core/io/ReaderInputStream.java | ReaderInputStream.close | @Override
public synchronized void close() throws IOException {
if(in != null)
in.close();
slack = null;
in = null;
} | java | @Override
public synchronized void close() throws IOException {
if(in != null)
in.close();
slack = null;
in = null;
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"in",
"!=",
"null",
")",
"in",
".",
"close",
"(",
")",
";",
"slack",
"=",
"null",
";",
"in",
"=",
"null",
";",
"}"
] | Closes the Stringreader.
@exception IOException
if the original StringReader fails to be closed | [
"Closes",
"the",
"Stringreader",
"."
] | 049741cf73ed0214717f2f587994a553bee63a2c | https://github.com/xerial/xerial/blob/049741cf73ed0214717f2f587994a553bee63a2c/xerial-core/src/main/scala/xerial/core/io/ReaderInputStream.java#L236-L242 | train |
redlink-gmbh/redlink-java-sdk | src/main/java/io/redlink/sdk/impl/analysis/model/Entity.java | Entity.getValues | public Collection<String> getValues(String property) {
Multimap<Optional<String>, String> values = properties.get(property);
if (values == null) {
return Collections.emptyList();
}
return values.values();
} | java | public Collection<String> getValues(String property) {
Multimap<Optional<String>, String> values = properties.get(property);
if (values == null) {
return Collections.emptyList();
}
return values.values();
} | [
"public",
"Collection",
"<",
"String",
">",
"getValues",
"(",
"String",
"property",
")",
"{",
"Multimap",
"<",
"Optional",
"<",
"String",
">",
",",
"String",
">",
"values",
"=",
"properties",
".",
"get",
"(",
"property",
")",
";",
"if",
"(",
"values",
... | Get all literal values for the property passed by parameter
@param property Property URI
@return | [
"Get",
"all",
"literal",
"values",
"for",
"the",
"property",
"passed",
"by",
"parameter"
] | c412ff11bd80da52ade09f2483ab29cdbff5a28a | https://github.com/redlink-gmbh/redlink-java-sdk/blob/c412ff11bd80da52ade09f2483ab29cdbff5a28a/src/main/java/io/redlink/sdk/impl/analysis/model/Entity.java#L120-L127 | train |
redlink-gmbh/redlink-java-sdk | src/main/java/io/redlink/sdk/impl/analysis/model/Entity.java | Entity.getValue | public String getValue(String property, String language) {
Multimap<Optional<String>, String> values = properties.get(property);
if (values == null) {
return null;
}
Iterator<String> it = values.get(Optional.of(language)).iterator();
return it.hasNext() ? it.next() : null;
} | java | public String getValue(String property, String language) {
Multimap<Optional<String>, String> values = properties.get(property);
if (values == null) {
return null;
}
Iterator<String> it = values.get(Optional.of(language)).iterator();
return it.hasNext() ? it.next() : null;
} | [
"public",
"String",
"getValue",
"(",
"String",
"property",
",",
"String",
"language",
")",
"{",
"Multimap",
"<",
"Optional",
"<",
"String",
">",
",",
"String",
">",
"values",
"=",
"properties",
".",
"get",
"(",
"property",
")",
";",
"if",
"(",
"values",
... | Get a literal value for a property and language passed by parameters
@param property Property URI
@param language Language code
@return | [
"Get",
"a",
"literal",
"value",
"for",
"a",
"property",
"and",
"language",
"passed",
"by",
"parameters"
] | c412ff11bd80da52ade09f2483ab29cdbff5a28a | https://github.com/redlink-gmbh/redlink-java-sdk/blob/c412ff11bd80da52ade09f2483ab29cdbff5a28a/src/main/java/io/redlink/sdk/impl/analysis/model/Entity.java#L153-L162 | train |
redlink-gmbh/redlink-java-sdk | src/main/java/io/redlink/sdk/impl/analysis/model/Entity.java | Entity.getFirstPropertyValue | public String getFirstPropertyValue(String property) {
Iterator<String> it = getValues(property).iterator();
return it.hasNext() ? it.next() : null;
} | java | public String getFirstPropertyValue(String property) {
Iterator<String> it = getValues(property).iterator();
return it.hasNext() ? it.next() : null;
} | [
"public",
"String",
"getFirstPropertyValue",
"(",
"String",
"property",
")",
"{",
"Iterator",
"<",
"String",
">",
"it",
"=",
"getValues",
"(",
"property",
")",
".",
"iterator",
"(",
")",
";",
"return",
"it",
".",
"hasNext",
"(",
")",
"?",
"it",
".",
"n... | Return the first value associated to the property passed by parameter
@param property Property URI
@return | [
"Return",
"the",
"first",
"value",
"associated",
"to",
"the",
"property",
"passed",
"by",
"parameter"
] | c412ff11bd80da52ade09f2483ab29cdbff5a28a | https://github.com/redlink-gmbh/redlink-java-sdk/blob/c412ff11bd80da52ade09f2483ab29cdbff5a28a/src/main/java/io/redlink/sdk/impl/analysis/model/Entity.java#L179-L182 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.findByAccessToken | public DConnection findByAccessToken(java.lang.String accessToken) {
return queryUniqueByField(null, DConnectionMapper.Field.ACCESSTOKEN.getFieldName(), accessToken);
} | java | public DConnection findByAccessToken(java.lang.String accessToken) {
return queryUniqueByField(null, DConnectionMapper.Field.ACCESSTOKEN.getFieldName(), accessToken);
} | [
"public",
"DConnection",
"findByAccessToken",
"(",
"java",
".",
"lang",
".",
"String",
"accessToken",
")",
"{",
"return",
"queryUniqueByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"ACCESSTOKEN",
".",
"getFieldName",
"(",
")",
",",
"accessTo... | find-by method for unique field accessToken
@param accessToken the unique attribute
@return the unique DConnection for the specified accessToken | [
"find",
"-",
"by",
"method",
"for",
"unique",
"field",
"accessToken"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L43-L45 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByExpireTime | public Iterable<DConnection> queryByExpireTime(java.util.Date expireTime) {
return queryByField(null, DConnectionMapper.Field.EXPIRETIME.getFieldName(), expireTime);
} | java | public Iterable<DConnection> queryByExpireTime(java.util.Date expireTime) {
return queryByField(null, DConnectionMapper.Field.EXPIRETIME.getFieldName(), expireTime);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByExpireTime",
"(",
"java",
".",
"util",
".",
"Date",
"expireTime",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"EXPIRETIME",
".",
"getFieldName",
"(",
")",
... | query-by method for field expireTime
@param expireTime the specified attribute
@return an Iterable of DConnections for the specified expireTime | [
"query",
"-",
"by",
"method",
"for",
"field",
"expireTime"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L88-L90 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByImageUrl | public Iterable<DConnection> queryByImageUrl(java.lang.String imageUrl) {
return queryByField(null, DConnectionMapper.Field.IMAGEURL.getFieldName(), imageUrl);
} | java | public Iterable<DConnection> queryByImageUrl(java.lang.String imageUrl) {
return queryByField(null, DConnectionMapper.Field.IMAGEURL.getFieldName(), imageUrl);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByImageUrl",
"(",
"java",
".",
"lang",
".",
"String",
"imageUrl",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"IMAGEURL",
".",
"getFieldName",
"(",
")",
",... | query-by method for field imageUrl
@param imageUrl the specified attribute
@return an Iterable of DConnections for the specified imageUrl | [
"query",
"-",
"by",
"method",
"for",
"field",
"imageUrl"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L97-L99 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByProfileUrl | public Iterable<DConnection> queryByProfileUrl(java.lang.String profileUrl) {
return queryByField(null, DConnectionMapper.Field.PROFILEURL.getFieldName(), profileUrl);
} | java | public Iterable<DConnection> queryByProfileUrl(java.lang.String profileUrl) {
return queryByField(null, DConnectionMapper.Field.PROFILEURL.getFieldName(), profileUrl);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByProfileUrl",
"(",
"java",
".",
"lang",
".",
"String",
"profileUrl",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"PROFILEURL",
".",
"getFieldName",
"(",
")"... | query-by method for field profileUrl
@param profileUrl the specified attribute
@return an Iterable of DConnections for the specified profileUrl | [
"query",
"-",
"by",
"method",
"for",
"field",
"profileUrl"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L106-L108 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByProviderId | public Iterable<DConnection> queryByProviderId(java.lang.String providerId) {
return queryByField(null, DConnectionMapper.Field.PROVIDERID.getFieldName(), providerId);
} | java | public Iterable<DConnection> queryByProviderId(java.lang.String providerId) {
return queryByField(null, DConnectionMapper.Field.PROVIDERID.getFieldName(), providerId);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByProviderId",
"(",
"java",
".",
"lang",
".",
"String",
"providerId",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"PROVIDERID",
".",
"getFieldName",
"(",
")"... | query-by method for field providerId
@param providerId the specified attribute
@return an Iterable of DConnections for the specified providerId | [
"query",
"-",
"by",
"method",
"for",
"field",
"providerId"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L115-L117 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByProviderUserId | public Iterable<DConnection> queryByProviderUserId(java.lang.String providerUserId) {
return queryByField(null, DConnectionMapper.Field.PROVIDERUSERID.getFieldName(), providerUserId);
} | java | public Iterable<DConnection> queryByProviderUserId(java.lang.String providerUserId) {
return queryByField(null, DConnectionMapper.Field.PROVIDERUSERID.getFieldName(), providerUserId);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByProviderUserId",
"(",
"java",
".",
"lang",
".",
"String",
"providerUserId",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"PROVIDERUSERID",
".",
"getFieldName",
... | query-by method for field providerUserId
@param providerUserId the specified attribute
@return an Iterable of DConnections for the specified providerUserId | [
"query",
"-",
"by",
"method",
"for",
"field",
"providerUserId"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L124-L126 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.findByRefreshToken | public DConnection findByRefreshToken(java.lang.String refreshToken) {
return queryUniqueByField(null, DConnectionMapper.Field.REFRESHTOKEN.getFieldName(), refreshToken);
} | java | public DConnection findByRefreshToken(java.lang.String refreshToken) {
return queryUniqueByField(null, DConnectionMapper.Field.REFRESHTOKEN.getFieldName(), refreshToken);
} | [
"public",
"DConnection",
"findByRefreshToken",
"(",
"java",
".",
"lang",
".",
"String",
"refreshToken",
")",
"{",
"return",
"queryUniqueByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"REFRESHTOKEN",
".",
"getFieldName",
"(",
")",
",",
"refre... | find-by method for unique field refreshToken
@param refreshToken the unique attribute
@return the unique DConnection for the specified refreshToken | [
"find",
"-",
"by",
"method",
"for",
"unique",
"field",
"refreshToken"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L133-L135 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryBySecret | public Iterable<DConnection> queryBySecret(java.lang.String secret) {
return queryByField(null, DConnectionMapper.Field.SECRET.getFieldName(), secret);
} | java | public Iterable<DConnection> queryBySecret(java.lang.String secret) {
return queryByField(null, DConnectionMapper.Field.SECRET.getFieldName(), secret);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryBySecret",
"(",
"java",
".",
"lang",
".",
"String",
"secret",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"SECRET",
".",
"getFieldName",
"(",
")",
",",
"... | query-by method for field secret
@param secret the specified attribute
@return an Iterable of DConnections for the specified secret | [
"query",
"-",
"by",
"method",
"for",
"field",
"secret"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L142-L144 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByUserId | public Iterable<DConnection> queryByUserId(java.lang.Long userId) {
return queryByField(null, DConnectionMapper.Field.USERID.getFieldName(), userId);
} | java | public Iterable<DConnection> queryByUserId(java.lang.Long userId) {
return queryByField(null, DConnectionMapper.Field.USERID.getFieldName(), userId);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByUserId",
"(",
"java",
".",
"lang",
".",
"Long",
"userId",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"USERID",
".",
"getFieldName",
"(",
")",
",",
"us... | query-by method for field userId
@param userId the specified attribute
@return an Iterable of DConnections for the specified userId | [
"query",
"-",
"by",
"method",
"for",
"field",
"userId"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L169-L171 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByUserRoles | public Iterable<DConnection> queryByUserRoles(java.lang.String userRoles) {
return queryByField(null, DConnectionMapper.Field.USERROLES.getFieldName(), userRoles);
} | java | public Iterable<DConnection> queryByUserRoles(java.lang.String userRoles) {
return queryByField(null, DConnectionMapper.Field.USERROLES.getFieldName(), userRoles);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByUserRoles",
"(",
"java",
".",
"lang",
".",
"String",
"userRoles",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"USERROLES",
".",
"getFieldName",
"(",
")",
... | query-by method for field userRoles
@param userRoles the specified attribute
@return an Iterable of DConnections for the specified userRoles | [
"query",
"-",
"by",
"method",
"for",
"field",
"userRoles"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L178-L180 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/provider/newrelic/LabelCache.java | LabelCache.add | public void add(Collection<Label> labels)
{
for(Label label : labels)
this.labels.put(label.getKey(), label);
} | java | public void add(Collection<Label> labels)
{
for(Label label : labels)
this.labels.put(label.getKey(), label);
} | [
"public",
"void",
"add",
"(",
"Collection",
"<",
"Label",
">",
"labels",
")",
"{",
"for",
"(",
"Label",
"label",
":",
"labels",
")",
"this",
".",
"labels",
".",
"put",
"(",
"label",
".",
"getKey",
"(",
")",
",",
"label",
")",
";",
"}"
] | Adds the label list to the labels for the account.
@param labels The labels to add | [
"Adds",
"the",
"label",
"list",
"to",
"the",
"labels",
"for",
"the",
"account",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/LabelCache.java#L95-L99 | train |
magik6k/JWWF | src/main/java/net/magik6k/jwwf/core/User.java | User.sendGlobal | public final void sendGlobal(String handler, String data) {
try {
connection.sendMessage("{\"id\":-1,\"type\":\"global\",\"handler\":"
+ Json.escapeString(handler) + ",\"data\":" + data + "}");
} catch (IOException e) {
e.printStackTrace();
}
} | java | public final void sendGlobal(String handler, String data) {
try {
connection.sendMessage("{\"id\":-1,\"type\":\"global\",\"handler\":"
+ Json.escapeString(handler) + ",\"data\":" + data + "}");
} catch (IOException e) {
e.printStackTrace();
}
} | [
"public",
"final",
"void",
"sendGlobal",
"(",
"String",
"handler",
",",
"String",
"data",
")",
"{",
"try",
"{",
"connection",
".",
"sendMessage",
"(",
"\"{\\\"id\\\":-1,\\\"type\\\":\\\"global\\\",\\\"handler\\\":\"",
"+",
"Json",
".",
"escapeString",
"(",
"handler",
... | This function is mainly made for plug-in use, it sends
data to global user handler for example to perform some tasks
that aren't related directly to widgets. Global handler is a javascript
function in array named 'global', under key that is passed to this function as
handler parameter. As first argument the javascript function is given
data object that is passed as JSON here
@param handler Name of client-side handler, generally syntax
should be [PluginName]-[HandlerName], like JWWF-UserData
@param data Data to send, JSON-formatted | [
"This",
"function",
"is",
"mainly",
"made",
"for",
"plug",
"-",
"in",
"use",
"it",
"sends",
"data",
"to",
"global",
"user",
"handler",
"for",
"example",
"to",
"perform",
"some",
"tasks",
"that",
"aren",
"t",
"related",
"directly",
"to",
"widgets",
".",
"... | 8ba334501396c3301495da8708733f6014f20665 | https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/core/User.java#L58-L65 | train |
pierre/serialization | thrift/src/main/java/com/ning/metrics/serialization/thrift/ThriftEnvelope.java | ThriftEnvelope.replaceWith | public void replaceWith(final ThriftEnvelope thriftEnvelope)
{
this.typeName = thriftEnvelope.typeName;
this.name = thriftEnvelope.name;
this.payload.clear();
this.payload.addAll(thriftEnvelope.payload);
} | java | public void replaceWith(final ThriftEnvelope thriftEnvelope)
{
this.typeName = thriftEnvelope.typeName;
this.name = thriftEnvelope.name;
this.payload.clear();
this.payload.addAll(thriftEnvelope.payload);
} | [
"public",
"void",
"replaceWith",
"(",
"final",
"ThriftEnvelope",
"thriftEnvelope",
")",
"{",
"this",
".",
"typeName",
"=",
"thriftEnvelope",
".",
"typeName",
";",
"this",
".",
"name",
"=",
"thriftEnvelope",
".",
"name",
";",
"this",
".",
"payload",
".",
"cle... | hack method to allow hadoop to re-use this object | [
"hack",
"method",
"to",
"allow",
"hadoop",
"to",
"re",
"-",
"use",
"this",
"object"
] | b15b7c749ba78bfe94dce8fc22f31b30b2e6830b | https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/thrift/src/main/java/com/ning/metrics/serialization/thrift/ThriftEnvelope.java#L91-L97 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java | FrameOutputWriter.addFrameWarning | protected void addFrameWarning(Content contentTree) {
Content noframes = new HtmlTree(HtmlTag.NOFRAMES);
Content noScript = HtmlTree.NOSCRIPT(
HtmlTree.DIV(getResource("doclet.No_Script_Message")));
noframes.addContent(noScript);
Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Frame_Alert"));
noframes.addContent(noframesHead);
Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message",
getHyperLink(configuration.topFile,
configuration.getText("doclet.Non_Frame_Version"))));
noframes.addContent(p);
contentTree.addContent(noframes);
} | java | protected void addFrameWarning(Content contentTree) {
Content noframes = new HtmlTree(HtmlTag.NOFRAMES);
Content noScript = HtmlTree.NOSCRIPT(
HtmlTree.DIV(getResource("doclet.No_Script_Message")));
noframes.addContent(noScript);
Content noframesHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
getResource("doclet.Frame_Alert"));
noframes.addContent(noframesHead);
Content p = HtmlTree.P(getResource("doclet.Frame_Warning_Message",
getHyperLink(configuration.topFile,
configuration.getText("doclet.Non_Frame_Version"))));
noframes.addContent(p);
contentTree.addContent(noframes);
} | [
"protected",
"void",
"addFrameWarning",
"(",
"Content",
"contentTree",
")",
"{",
"Content",
"noframes",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"NOFRAMES",
")",
";",
"Content",
"noScript",
"=",
"HtmlTree",
".",
"NOSCRIPT",
"(",
"HtmlTree",
".",
"DIV",
"... | Add the code for issueing the warning for a non-frame capable web
client. Also provide links to the non-frame version documentation.
@param contentTree the content tree to which the non-frames information will be added | [
"Add",
"the",
"code",
"for",
"issueing",
"the",
"warning",
"for",
"a",
"non",
"-",
"frame",
"capable",
"web",
"client",
".",
"Also",
"provide",
"links",
"to",
"the",
"non",
"-",
"frame",
"version",
"documentation",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java#L115-L128 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java | FrameOutputWriter.addAllPackagesFrameTag | private void addAllPackagesFrameTag(Content contentTree) {
HtmlTree frame = HtmlTree.FRAME(DocPaths.OVERVIEW_FRAME.getPath(),
"packageListFrame", configuration.getText("doclet.All_Packages"));
contentTree.addContent(frame);
} | java | private void addAllPackagesFrameTag(Content contentTree) {
HtmlTree frame = HtmlTree.FRAME(DocPaths.OVERVIEW_FRAME.getPath(),
"packageListFrame", configuration.getText("doclet.All_Packages"));
contentTree.addContent(frame);
} | [
"private",
"void",
"addAllPackagesFrameTag",
"(",
"Content",
"contentTree",
")",
"{",
"HtmlTree",
"frame",
"=",
"HtmlTree",
".",
"FRAME",
"(",
"DocPaths",
".",
"OVERVIEW_FRAME",
".",
"getPath",
"(",
")",
",",
"\"packageListFrame\"",
",",
"configuration",
".",
"g... | Add the FRAME tag for the frame that lists all packages.
@param contentTree the content tree to which the information will be added | [
"Add",
"the",
"FRAME",
"tag",
"for",
"the",
"frame",
"that",
"lists",
"all",
"packages",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java#L157-L161 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java | FrameOutputWriter.addAllClassesFrameTag | private void addAllClassesFrameTag(Content contentTree) {
HtmlTree frame = HtmlTree.FRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
"packageFrame", configuration.getText("doclet.All_classes_and_interfaces"));
contentTree.addContent(frame);
} | java | private void addAllClassesFrameTag(Content contentTree) {
HtmlTree frame = HtmlTree.FRAME(DocPaths.ALLCLASSES_FRAME.getPath(),
"packageFrame", configuration.getText("doclet.All_classes_and_interfaces"));
contentTree.addContent(frame);
} | [
"private",
"void",
"addAllClassesFrameTag",
"(",
"Content",
"contentTree",
")",
"{",
"HtmlTree",
"frame",
"=",
"HtmlTree",
".",
"FRAME",
"(",
"DocPaths",
".",
"ALLCLASSES_FRAME",
".",
"getPath",
"(",
")",
",",
"\"packageFrame\"",
",",
"configuration",
".",
"getT... | Add the FRAME tag for the frame that lists all classes.
@param contentTree the content tree to which the information will be added | [
"Add",
"the",
"FRAME",
"tag",
"for",
"the",
"frame",
"that",
"lists",
"all",
"classes",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java#L168-L172 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java | FrameOutputWriter.addClassFrameTag | private void addClassFrameTag(Content contentTree) {
HtmlTree frame = HtmlTree.FRAME(configuration.topFile.getPath(), "classFrame",
configuration.getText("doclet.Package_class_and_interface_descriptions"),
SCROLL_YES);
contentTree.addContent(frame);
} | java | private void addClassFrameTag(Content contentTree) {
HtmlTree frame = HtmlTree.FRAME(configuration.topFile.getPath(), "classFrame",
configuration.getText("doclet.Package_class_and_interface_descriptions"),
SCROLL_YES);
contentTree.addContent(frame);
} | [
"private",
"void",
"addClassFrameTag",
"(",
"Content",
"contentTree",
")",
"{",
"HtmlTree",
"frame",
"=",
"HtmlTree",
".",
"FRAME",
"(",
"configuration",
".",
"topFile",
".",
"getPath",
"(",
")",
",",
"\"classFrame\"",
",",
"configuration",
".",
"getText",
"("... | Add the FRAME tag for the frame that describes the class in detail.
@param contentTree the content tree to which the information will be added | [
"Add",
"the",
"FRAME",
"tag",
"for",
"the",
"frame",
"that",
"describes",
"the",
"class",
"in",
"detail",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java#L179-L184 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/tree/TreeInfo.java | TreeInfo.declarationFor | public static JCTree declarationFor(final Symbol sym, final JCTree tree) {
class DeclScanner extends TreeScanner {
JCTree result = null;
public void scan(JCTree tree) {
if (tree!=null && result==null)
tree.accept(this);
}
public void visitTopLevel(JCCompilationUnit that) {
if (that.packge == sym) result = that;
else super.visitTopLevel(that);
}
public void visitClassDef(JCClassDecl that) {
if (that.sym == sym) result = that;
else super.visitClassDef(that);
}
public void visitMethodDef(JCMethodDecl that) {
if (that.sym == sym) result = that;
else super.visitMethodDef(that);
}
public void visitVarDef(JCVariableDecl that) {
if (that.sym == sym) result = that;
else super.visitVarDef(that);
}
public void visitTypeParameter(JCTypeParameter that) {
if (that.type != null && that.type.tsym == sym) result = that;
else super.visitTypeParameter(that);
}
}
DeclScanner s = new DeclScanner();
tree.accept(s);
return s.result;
} | java | public static JCTree declarationFor(final Symbol sym, final JCTree tree) {
class DeclScanner extends TreeScanner {
JCTree result = null;
public void scan(JCTree tree) {
if (tree!=null && result==null)
tree.accept(this);
}
public void visitTopLevel(JCCompilationUnit that) {
if (that.packge == sym) result = that;
else super.visitTopLevel(that);
}
public void visitClassDef(JCClassDecl that) {
if (that.sym == sym) result = that;
else super.visitClassDef(that);
}
public void visitMethodDef(JCMethodDecl that) {
if (that.sym == sym) result = that;
else super.visitMethodDef(that);
}
public void visitVarDef(JCVariableDecl that) {
if (that.sym == sym) result = that;
else super.visitVarDef(that);
}
public void visitTypeParameter(JCTypeParameter that) {
if (that.type != null && that.type.tsym == sym) result = that;
else super.visitTypeParameter(that);
}
}
DeclScanner s = new DeclScanner();
tree.accept(s);
return s.result;
} | [
"public",
"static",
"JCTree",
"declarationFor",
"(",
"final",
"Symbol",
"sym",
",",
"final",
"JCTree",
"tree",
")",
"{",
"class",
"DeclScanner",
"extends",
"TreeScanner",
"{",
"JCTree",
"result",
"=",
"null",
";",
"public",
"void",
"scan",
"(",
"JCTree",
"tr... | Find the declaration for a symbol, where
that symbol is defined somewhere in the given tree. | [
"Find",
"the",
"declaration",
"for",
"a",
"symbol",
"where",
"that",
"symbol",
"is",
"defined",
"somewhere",
"in",
"the",
"given",
"tree",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L653-L684 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/tree/TreeInfo.java | TreeInfo.types | public static List<Type> types(List<? extends JCTree> trees) {
ListBuffer<Type> ts = new ListBuffer<Type>();
for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
ts.append(l.head.type);
return ts.toList();
} | java | public static List<Type> types(List<? extends JCTree> trees) {
ListBuffer<Type> ts = new ListBuffer<Type>();
for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
ts.append(l.head.type);
return ts.toList();
} | [
"public",
"static",
"List",
"<",
"Type",
">",
"types",
"(",
"List",
"<",
"?",
"extends",
"JCTree",
">",
"trees",
")",
"{",
"ListBuffer",
"<",
"Type",
">",
"ts",
"=",
"new",
"ListBuffer",
"<",
"Type",
">",
"(",
")",
";",
"for",
"(",
"List",
"<",
"... | Return the types of a list of trees. | [
"Return",
"the",
"types",
"of",
"a",
"list",
"of",
"trees",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java#L759-L764 | train |
brianwhu/xillium | core/src/main/java/org/xillium/core/util/EmailChannel.java | EmailChannel.configure | protected void configure(Properties properties) {
_properties = properties;
_recipients = properties.getProperty("mail.smtp.to").split(" *[,;] *");
_authenticator = new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(_properties.getProperty("mail.smtp.user"), _properties.getProperty("mail.smtp.pass"));
}
};
} | java | protected void configure(Properties properties) {
_properties = properties;
_recipients = properties.getProperty("mail.smtp.to").split(" *[,;] *");
_authenticator = new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(_properties.getProperty("mail.smtp.user"), _properties.getProperty("mail.smtp.pass"));
}
};
} | [
"protected",
"void",
"configure",
"(",
"Properties",
"properties",
")",
"{",
"_properties",
"=",
"properties",
";",
"_recipients",
"=",
"properties",
".",
"getProperty",
"(",
"\"mail.smtp.to\"",
")",
".",
"split",
"(",
"\" *[,;] *\"",
")",
";",
"_authenticator",
... | Configures the EmailChannel with given properties. | [
"Configures",
"the",
"EmailChannel",
"with",
"given",
"properties",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/util/EmailChannel.java#L41-L49 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java | TagletManager.initStandardTagsLowercase | private void initStandardTagsLowercase() {
Iterator<String> it = standardTags.iterator();
while (it.hasNext()) {
standardTagsLowercase.add(StringUtils.toLowerCase(it.next()));
}
} | java | private void initStandardTagsLowercase() {
Iterator<String> it = standardTags.iterator();
while (it.hasNext()) {
standardTagsLowercase.add(StringUtils.toLowerCase(it.next()));
}
} | [
"private",
"void",
"initStandardTagsLowercase",
"(",
")",
"{",
"Iterator",
"<",
"String",
">",
"it",
"=",
"standardTags",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"standardTagsLowercase",
".",
"add",
"(",
"S... | Initialize lowercase version of standard Javadoc tags. | [
"Initialize",
"lowercase",
"version",
"of",
"standard",
"Javadoc",
"tags",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java#L709-L714 | train |
apruve/apruve-java | src/main/java/com/apruve/models/Subscription.java | Subscription.get | public static ApruveResponse<Subscription> get(String suscriptionId) {
return ApruveClient.getInstance().get(
getSubscriptionsPath() + suscriptionId, Subscription.class);
} | java | public static ApruveResponse<Subscription> get(String suscriptionId) {
return ApruveClient.getInstance().get(
getSubscriptionsPath() + suscriptionId, Subscription.class);
} | [
"public",
"static",
"ApruveResponse",
"<",
"Subscription",
">",
"get",
"(",
"String",
"suscriptionId",
")",
"{",
"return",
"ApruveClient",
".",
"getInstance",
"(",
")",
".",
"get",
"(",
"getSubscriptionsPath",
"(",
")",
"+",
"suscriptionId",
",",
"Subscription",... | Get the Subscription with the given ID
@param suscriptionId
The ID of the Subscription to get
@see <a
href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a>
@return Subscription, or null if not found | [
"Get",
"the",
"Subscription",
"with",
"the",
"given",
"ID"
] | b188d6b17f777823c2e46427847318849978685e | https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/Subscription.java#L60-L63 | train |
apruve/apruve-java | src/main/java/com/apruve/models/Subscription.java | Subscription.cancel | public static ApruveResponse<SubscriptionCancelResponse> cancel(
String subscriptionId) {
return ApruveClient.getInstance().post(getCancelPath(subscriptionId),
"", SubscriptionCancelResponse.class);
} | java | public static ApruveResponse<SubscriptionCancelResponse> cancel(
String subscriptionId) {
return ApruveClient.getInstance().post(getCancelPath(subscriptionId),
"", SubscriptionCancelResponse.class);
} | [
"public",
"static",
"ApruveResponse",
"<",
"SubscriptionCancelResponse",
">",
"cancel",
"(",
"String",
"subscriptionId",
")",
"{",
"return",
"ApruveClient",
".",
"getInstance",
"(",
")",
".",
"post",
"(",
"getCancelPath",
"(",
"subscriptionId",
")",
",",
"\"\"",
... | Cancels the Subscription with the given ID. This cannot be undone once
completed, so use with care!
@see <a
href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a>
@return SubscriptionCancelResponse | [
"Cancels",
"the",
"Subscription",
"with",
"the",
"given",
"ID",
".",
"This",
"cannot",
"be",
"undone",
"once",
"completed",
"so",
"use",
"with",
"care!"
] | b188d6b17f777823c2e46427847318849978685e | https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/Subscription.java#L97-L101 | train |
rFlex/SCJavaTools | src/main/java/me/corsin/javatools/task/TaskQueue.java | TaskQueue.handleNextTask | public boolean handleNextTask() {
Runnable task = this.getNextTask();
if (task != null) {
synchronized (this.tasksReachesZero) {
this.runningTasks++;
}
try {
task.run();
} catch (Throwable t) {
t.printStackTrace();
}
synchronized (this.tasksReachesZero) {
this.runningTasks--;
if (this.runningTasks == 0) {
this.tasksReachesZero.notifyAll();
}
}
synchronized (task) {
task.notifyAll();
}
return true;
}
return false;
} | java | public boolean handleNextTask() {
Runnable task = this.getNextTask();
if (task != null) {
synchronized (this.tasksReachesZero) {
this.runningTasks++;
}
try {
task.run();
} catch (Throwable t) {
t.printStackTrace();
}
synchronized (this.tasksReachesZero) {
this.runningTasks--;
if (this.runningTasks == 0) {
this.tasksReachesZero.notifyAll();
}
}
synchronized (task) {
task.notifyAll();
}
return true;
}
return false;
} | [
"public",
"boolean",
"handleNextTask",
"(",
")",
"{",
"Runnable",
"task",
"=",
"this",
".",
"getNextTask",
"(",
")",
";",
"if",
"(",
"task",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"this",
".",
"tasksReachesZero",
")",
"{",
"this",
".",
"runningTask... | Process the next pending Task synchronously.
@return true if a task has been processed, false otherwise (no task is ready to be processed) | [
"Process",
"the",
"next",
"pending",
"Task",
"synchronously",
"."
] | 6bafee99f12a6ad73265db64776edac2bab71f67 | https://github.com/rFlex/SCJavaTools/blob/6bafee99f12a6ad73265db64776edac2bab71f67/src/main/java/me/corsin/javatools/task/TaskQueue.java#L72-L98 | train |
rFlex/SCJavaTools | src/main/java/me/corsin/javatools/task/TaskQueue.java | TaskQueue.executeSync | public <T extends Runnable> T executeSync(T runnable) {
synchronized (runnable) {
this.executeAsync(runnable);
try {
runnable.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return runnable;
} | java | public <T extends Runnable> T executeSync(T runnable) {
synchronized (runnable) {
this.executeAsync(runnable);
try {
runnable.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return runnable;
} | [
"public",
"<",
"T",
"extends",
"Runnable",
">",
"T",
"executeSync",
"(",
"T",
"runnable",
")",
"{",
"synchronized",
"(",
"runnable",
")",
"{",
"this",
".",
"executeAsync",
"(",
"runnable",
")",
";",
"try",
"{",
"runnable",
".",
"wait",
"(",
")",
";",
... | Add a Task to the queue and wait until it's run. It is guaranteed that the Runnable will be processed
when this method returns.
@param the runnable to be executed
@return the runnable, as a convenience method | [
"Add",
"a",
"Task",
"to",
"the",
"queue",
"and",
"wait",
"until",
"it",
"s",
"run",
".",
"It",
"is",
"guaranteed",
"that",
"the",
"Runnable",
"will",
"be",
"processed",
"when",
"this",
"method",
"returns",
"."
] | 6bafee99f12a6ad73265db64776edac2bab71f67 | https://github.com/rFlex/SCJavaTools/blob/6bafee99f12a6ad73265db64776edac2bab71f67/src/main/java/me/corsin/javatools/task/TaskQueue.java#L159-L170 | train |
rFlex/SCJavaTools | src/main/java/me/corsin/javatools/task/TaskQueue.java | TaskQueue.executeSyncTimed | public <T extends Runnable> T executeSyncTimed(T runnable, long inMs) {
try {
Thread.sleep(inMs);
this.executeSync(runnable);
} catch (InterruptedException e) {
e.printStackTrace();
}
return runnable;
} | java | public <T extends Runnable> T executeSyncTimed(T runnable, long inMs) {
try {
Thread.sleep(inMs);
this.executeSync(runnable);
} catch (InterruptedException e) {
e.printStackTrace();
}
return runnable;
} | [
"public",
"<",
"T",
"extends",
"Runnable",
">",
"T",
"executeSyncTimed",
"(",
"T",
"runnable",
",",
"long",
"inMs",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"inMs",
")",
";",
"this",
".",
"executeSync",
"(",
"runnable",
")",
";",
"}",
"catc... | Add a Task to the queue and wait until it's run. The Task will be executed after "inMs" milliseconds. It is guaranteed that the Runnable will be processed
when this method returns.
@param the runnable to be executed
@param inMs The time after which the task should be processed
@return the runnable, as a convenience method | [
"Add",
"a",
"Task",
"to",
"the",
"queue",
"and",
"wait",
"until",
"it",
"s",
"run",
".",
"The",
"Task",
"will",
"be",
"executed",
"after",
"inMs",
"milliseconds",
".",
"It",
"is",
"guaranteed",
"that",
"the",
"Runnable",
"will",
"be",
"processed",
"when"... | 6bafee99f12a6ad73265db64776edac2bab71f67 | https://github.com/rFlex/SCJavaTools/blob/6bafee99f12a6ad73265db64776edac2bab71f67/src/main/java/me/corsin/javatools/task/TaskQueue.java#L179-L188 | train |
rFlex/SCJavaTools | src/main/java/me/corsin/javatools/task/TaskQueue.java | TaskQueue.executeAsyncTimed | public <T extends Runnable> T executeAsyncTimed(T runnable, long inMs) {
final Runnable theRunnable = runnable;
// This implementation is not really suitable for now as the timer uses its own thread
// The TaskQueue itself should be able in the future to handle this without using a new thread
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
TaskQueue.this.executeAsync(theRunnable);
}
}, inMs);
return runnable;
} | java | public <T extends Runnable> T executeAsyncTimed(T runnable, long inMs) {
final Runnable theRunnable = runnable;
// This implementation is not really suitable for now as the timer uses its own thread
// The TaskQueue itself should be able in the future to handle this without using a new thread
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
TaskQueue.this.executeAsync(theRunnable);
}
}, inMs);
return runnable;
} | [
"public",
"<",
"T",
"extends",
"Runnable",
">",
"T",
"executeAsyncTimed",
"(",
"T",
"runnable",
",",
"long",
"inMs",
")",
"{",
"final",
"Runnable",
"theRunnable",
"=",
"runnable",
";",
"// This implementation is not really suitable for now as the timer uses its own thread... | Add a Task to the queue. The Task will be executed after "inMs" milliseconds.
@param the runnable to be executed
@param inMs The time after which the task should be processed
@return the runnable, as a convenience method | [
"Add",
"a",
"Task",
"to",
"the",
"queue",
".",
"The",
"Task",
"will",
"be",
"executed",
"after",
"inMs",
"milliseconds",
"."
] | 6bafee99f12a6ad73265db64776edac2bab71f67 | https://github.com/rFlex/SCJavaTools/blob/6bafee99f12a6ad73265db64776edac2bab71f67/src/main/java/me/corsin/javatools/task/TaskQueue.java#L197-L212 | train |
rFlex/SCJavaTools | src/main/java/me/corsin/javatools/task/TaskQueue.java | TaskQueue.waitForTasks | protected boolean waitForTasks() {
synchronized (this.tasks) {
while (!this.closed && !this.hasTaskPending()) {
try {
this.tasks.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
return !this.closed;
} | java | protected boolean waitForTasks() {
synchronized (this.tasks) {
while (!this.closed && !this.hasTaskPending()) {
try {
this.tasks.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
return !this.closed;
} | [
"protected",
"boolean",
"waitForTasks",
"(",
")",
"{",
"synchronized",
"(",
"this",
".",
"tasks",
")",
"{",
"while",
"(",
"!",
"this",
".",
"closed",
"&&",
"!",
"this",
".",
"hasTaskPending",
"(",
")",
")",
"{",
"try",
"{",
"this",
".",
"tasks",
".",... | Wait until the TaskQueue has a Task ready to process. If the TaskQueue is closed this method will also return
but giving the value "false".
@return true if the TaskQueue has a Task ready to process, false if it has been closed | [
"Wait",
"until",
"the",
"TaskQueue",
"has",
"a",
"Task",
"ready",
"to",
"process",
".",
"If",
"the",
"TaskQueue",
"is",
"closed",
"this",
"method",
"will",
"also",
"return",
"but",
"giving",
"the",
"value",
"false",
"."
] | 6bafee99f12a6ad73265db64776edac2bab71f67 | https://github.com/rFlex/SCJavaTools/blob/6bafee99f12a6ad73265db64776edac2bab71f67/src/main/java/me/corsin/javatools/task/TaskQueue.java#L219-L231 | train |
rFlex/SCJavaTools | src/main/java/me/corsin/javatools/task/TaskQueue.java | TaskQueue.waitAllTasks | public void waitAllTasks() {
synchronized (this.tasks) {
while (this.hasTaskPending()) {
try {
this.tasks.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
synchronized (this.tasksReachesZero) {
if (this.runningTasks > 0) {
try {
this.tasksReachesZero.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
} | java | public void waitAllTasks() {
synchronized (this.tasks) {
while (this.hasTaskPending()) {
try {
this.tasks.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
synchronized (this.tasksReachesZero) {
if (this.runningTasks > 0) {
try {
this.tasksReachesZero.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
} | [
"public",
"void",
"waitAllTasks",
"(",
")",
"{",
"synchronized",
"(",
"this",
".",
"tasks",
")",
"{",
"while",
"(",
"this",
".",
"hasTaskPending",
"(",
")",
")",
"{",
"try",
"{",
"this",
".",
"tasks",
".",
"wait",
"(",
")",
";",
"}",
"catch",
"(",
... | Wait that every pending task are processed.
This method will return once it has no pending task or once it has been closed | [
"Wait",
"that",
"every",
"pending",
"task",
"are",
"processed",
".",
"This",
"method",
"will",
"return",
"once",
"it",
"has",
"no",
"pending",
"task",
"or",
"once",
"it",
"has",
"been",
"closed"
] | 6bafee99f12a6ad73265db64776edac2bab71f67 | https://github.com/rFlex/SCJavaTools/blob/6bafee99f12a6ad73265db64776edac2bab71f67/src/main/java/me/corsin/javatools/task/TaskQueue.java#L237-L256 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.scanConnection | protected List<SchemaDescriptor> scanConnection(String url, String user, String password, String infoLevelName, String bundledDriverName,
Properties properties, Store store) throws IOException {
LOGGER.info("Scanning schema '{}'", url);
Catalog catalog = getCatalog(url, user, password, infoLevelName, bundledDriverName, properties);
return createSchemas(catalog, store);
} | java | protected List<SchemaDescriptor> scanConnection(String url, String user, String password, String infoLevelName, String bundledDriverName,
Properties properties, Store store) throws IOException {
LOGGER.info("Scanning schema '{}'", url);
Catalog catalog = getCatalog(url, user, password, infoLevelName, bundledDriverName, properties);
return createSchemas(catalog, store);
} | [
"protected",
"List",
"<",
"SchemaDescriptor",
">",
"scanConnection",
"(",
"String",
"url",
",",
"String",
"user",
",",
"String",
"password",
",",
"String",
"infoLevelName",
",",
"String",
"bundledDriverName",
",",
"Properties",
"properties",
",",
"Store",
"store",... | Scans the connection identified by the given parameters.
@param url The url.
@param user The user.
@param password The password.
@param properties The properties to pass to schema crawler.
@param infoLevelName The name of the info level to use.
@param bundledDriverName The name of the bundled driver as provided by schema crawler.
@param store The store.
@return The list of created schema descriptors.
@throws java.io.IOException If retrieval fails. | [
"Scans",
"the",
"connection",
"identified",
"by",
"the",
"given",
"parameters",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L53-L58 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.getCatalog | protected Catalog getCatalog(String url, String user, String password, String infoLevelName, String bundledDriverName, Properties properties)
throws IOException {
// Determine info level
InfoLevel level = InfoLevel.valueOf(infoLevelName.toLowerCase());
SchemaInfoLevel schemaInfoLevel = level.getSchemaInfoLevel();
// Set options
for (InfoLevelOption option : InfoLevelOption.values()) {
String value = properties.getProperty(option.getPropertyName());
if (value != null) {
LOGGER.info("Setting option " + option.name() + "=" + value);
option.set(schemaInfoLevel, Boolean.valueOf(value.toLowerCase()));
}
}
SchemaCrawlerOptions options;
if (bundledDriverName != null) {
options = getOptions(bundledDriverName, level);
} else {
options = new SchemaCrawlerOptions();
}
options.setSchemaInfoLevel(schemaInfoLevel);
LOGGER.debug("Scanning database schemas on '" + url + "' (user='" + user + "', info level='" + level.name() + "')");
Catalog catalog;
try (Connection connection = DriverManager.getConnection(url, user, password)) {
catalog = SchemaCrawlerUtility.getCatalog(connection, options);
} catch (SQLException | SchemaCrawlerException e) {
throw new IOException(String.format("Cannot scan schema (url='%s', user='%s'", url, user), e);
}
return catalog;
} | java | protected Catalog getCatalog(String url, String user, String password, String infoLevelName, String bundledDriverName, Properties properties)
throws IOException {
// Determine info level
InfoLevel level = InfoLevel.valueOf(infoLevelName.toLowerCase());
SchemaInfoLevel schemaInfoLevel = level.getSchemaInfoLevel();
// Set options
for (InfoLevelOption option : InfoLevelOption.values()) {
String value = properties.getProperty(option.getPropertyName());
if (value != null) {
LOGGER.info("Setting option " + option.name() + "=" + value);
option.set(schemaInfoLevel, Boolean.valueOf(value.toLowerCase()));
}
}
SchemaCrawlerOptions options;
if (bundledDriverName != null) {
options = getOptions(bundledDriverName, level);
} else {
options = new SchemaCrawlerOptions();
}
options.setSchemaInfoLevel(schemaInfoLevel);
LOGGER.debug("Scanning database schemas on '" + url + "' (user='" + user + "', info level='" + level.name() + "')");
Catalog catalog;
try (Connection connection = DriverManager.getConnection(url, user, password)) {
catalog = SchemaCrawlerUtility.getCatalog(connection, options);
} catch (SQLException | SchemaCrawlerException e) {
throw new IOException(String.format("Cannot scan schema (url='%s', user='%s'", url, user), e);
}
return catalog;
} | [
"protected",
"Catalog",
"getCatalog",
"(",
"String",
"url",
",",
"String",
"user",
",",
"String",
"password",
",",
"String",
"infoLevelName",
",",
"String",
"bundledDriverName",
",",
"Properties",
"properties",
")",
"throws",
"IOException",
"{",
"// Determine info l... | Retrieves the catalog metadata using schema crawler.
@param url The url.
@param user The user.
@param password The password.
@param properties The properties to pass to schema crawler.
@param infoLevelName The name of the info level to use.
@param bundledDriverName The name of the bundled driver as provided by schema crawler.
@return The catalog.
@throws java.io.IOException If retrieval fails. | [
"Retrieves",
"the",
"catalog",
"metadata",
"using",
"schema",
"crawler",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L72-L100 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.getOptions | private SchemaCrawlerOptions getOptions(String bundledDriverName, InfoLevel level) throws IOException {
for (BundledDriver bundledDriver : BundledDriver.values()) {
if (bundledDriver.name().toLowerCase().equals(bundledDriverName.toLowerCase())) {
return bundledDriver.getOptions(level);
}
}
throw new IOException("Unknown bundled driver name '" + bundledDriverName + "', supported values are " + Arrays.asList(BundledDriver.values()));
} | java | private SchemaCrawlerOptions getOptions(String bundledDriverName, InfoLevel level) throws IOException {
for (BundledDriver bundledDriver : BundledDriver.values()) {
if (bundledDriver.name().toLowerCase().equals(bundledDriverName.toLowerCase())) {
return bundledDriver.getOptions(level);
}
}
throw new IOException("Unknown bundled driver name '" + bundledDriverName + "', supported values are " + Arrays.asList(BundledDriver.values()));
} | [
"private",
"SchemaCrawlerOptions",
"getOptions",
"(",
"String",
"bundledDriverName",
",",
"InfoLevel",
"level",
")",
"throws",
"IOException",
"{",
"for",
"(",
"BundledDriver",
"bundledDriver",
":",
"BundledDriver",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"... | Loads the bundled driver options
@param bundledDriverName The driver name.
@param level The info level.
@return The options or <code>null</code>.
@throws java.io.IOException If loading fails. | [
"Loads",
"the",
"bundled",
"driver",
"options"
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L110-L117 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.createSchemas | private List<SchemaDescriptor> createSchemas(Catalog catalog, Store store) throws IOException {
List<SchemaDescriptor> schemaDescriptors = new ArrayList<>();
Map<String, ColumnTypeDescriptor> columnTypes = new HashMap<>();
Map<Column, ColumnDescriptor> allColumns = new HashMap<>();
Set<ForeignKey> allForeignKeys = new HashSet<>();
for (Schema schema : catalog.getSchemas()) {
SchemaDescriptor schemaDescriptor = store.create(SchemaDescriptor.class);
schemaDescriptor.setName(schema.getName());
// Tables
createTables(catalog, schema, schemaDescriptor, columnTypes, allColumns, allForeignKeys, store);
// Sequences
createSequences(catalog.getSequences(schema), schemaDescriptor, store);
// Procedures and Functions
createRoutines(catalog.getRoutines(schema), schemaDescriptor, columnTypes, store);
schemaDescriptors.add(schemaDescriptor);
}
// Foreign keys
createForeignKeys(allForeignKeys, allColumns, store);
return schemaDescriptors;
} | java | private List<SchemaDescriptor> createSchemas(Catalog catalog, Store store) throws IOException {
List<SchemaDescriptor> schemaDescriptors = new ArrayList<>();
Map<String, ColumnTypeDescriptor> columnTypes = new HashMap<>();
Map<Column, ColumnDescriptor> allColumns = new HashMap<>();
Set<ForeignKey> allForeignKeys = new HashSet<>();
for (Schema schema : catalog.getSchemas()) {
SchemaDescriptor schemaDescriptor = store.create(SchemaDescriptor.class);
schemaDescriptor.setName(schema.getName());
// Tables
createTables(catalog, schema, schemaDescriptor, columnTypes, allColumns, allForeignKeys, store);
// Sequences
createSequences(catalog.getSequences(schema), schemaDescriptor, store);
// Procedures and Functions
createRoutines(catalog.getRoutines(schema), schemaDescriptor, columnTypes, store);
schemaDescriptors.add(schemaDescriptor);
}
// Foreign keys
createForeignKeys(allForeignKeys, allColumns, store);
return schemaDescriptors;
} | [
"private",
"List",
"<",
"SchemaDescriptor",
">",
"createSchemas",
"(",
"Catalog",
"catalog",
",",
"Store",
"store",
")",
"throws",
"IOException",
"{",
"List",
"<",
"SchemaDescriptor",
">",
"schemaDescriptors",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Map... | Stores the data.
@param catalog The catalog.
@param store The store.
@return The list of created schema descriptors.
@throws java.io.IOException If an error occurs. | [
"Stores",
"the",
"data",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L127-L146 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.createTables | private void createTables(Catalog catalog, Schema schema, SchemaDescriptor schemaDescriptor, Map<String, ColumnTypeDescriptor> columnTypes,
Map<Column, ColumnDescriptor> allColumns, Set<ForeignKey> allForeignKeys, Store store) {
for (Table table : catalog.getTables(schema)) {
TableDescriptor tableDescriptor = getTableDescriptor(table, schemaDescriptor, store);
Map<String, ColumnDescriptor> localColumns = new HashMap<>();
for (Column column : table.getColumns()) {
ColumnDescriptor columnDescriptor = createColumnDescriptor(column, ColumnDescriptor.class, columnTypes, store);
columnDescriptor.setDefaultValue(column.getDefaultValue());
columnDescriptor.setGenerated(column.isGenerated());
columnDescriptor.setPartOfIndex(column.isPartOfIndex());
columnDescriptor.setPartOfPrimaryKey(column.isPartOfPrimaryKey());
columnDescriptor.setPartOfForeignKey(column.isPartOfForeignKey());
columnDescriptor.setAutoIncremented(column.isAutoIncremented());
tableDescriptor.getColumns().add(columnDescriptor);
localColumns.put(column.getName(), columnDescriptor);
allColumns.put(column, columnDescriptor);
}
// Primary key
PrimaryKey primaryKey = table.getPrimaryKey();
if (primaryKey != null) {
PrimaryKeyDescriptor primaryKeyDescriptor = storeIndex(primaryKey, tableDescriptor, localColumns, PrimaryKeyDescriptor.class,
PrimaryKeyOnColumnDescriptor.class, store);
tableDescriptor.setPrimaryKey(primaryKeyDescriptor);
}
// Indices
for (Index index : table.getIndices()) {
IndexDescriptor indexDescriptor = storeIndex(index, tableDescriptor, localColumns, IndexDescriptor.class, IndexOnColumnDescriptor.class, store);
tableDescriptor.getIndices().add(indexDescriptor);
}
// Trigger
for (Trigger trigger : table.getTriggers()) {
TriggerDescriptor triggerDescriptor = store.create(TriggerDescriptor.class);
triggerDescriptor.setName(trigger.getName());
triggerDescriptor.setActionCondition(trigger.getActionCondition());
triggerDescriptor.setActionOrder(trigger.getActionOrder());
triggerDescriptor.setActionOrientation(trigger.getActionOrientation().name());
triggerDescriptor.setActionStatement(trigger.getActionStatement());
triggerDescriptor.setConditionTiming(trigger.getConditionTiming().name());
triggerDescriptor.setEventManipulationTime(trigger.getEventManipulationType().name());
tableDescriptor.getTriggers().add(triggerDescriptor);
}
allForeignKeys.addAll(table.getForeignKeys());
}
} | java | private void createTables(Catalog catalog, Schema schema, SchemaDescriptor schemaDescriptor, Map<String, ColumnTypeDescriptor> columnTypes,
Map<Column, ColumnDescriptor> allColumns, Set<ForeignKey> allForeignKeys, Store store) {
for (Table table : catalog.getTables(schema)) {
TableDescriptor tableDescriptor = getTableDescriptor(table, schemaDescriptor, store);
Map<String, ColumnDescriptor> localColumns = new HashMap<>();
for (Column column : table.getColumns()) {
ColumnDescriptor columnDescriptor = createColumnDescriptor(column, ColumnDescriptor.class, columnTypes, store);
columnDescriptor.setDefaultValue(column.getDefaultValue());
columnDescriptor.setGenerated(column.isGenerated());
columnDescriptor.setPartOfIndex(column.isPartOfIndex());
columnDescriptor.setPartOfPrimaryKey(column.isPartOfPrimaryKey());
columnDescriptor.setPartOfForeignKey(column.isPartOfForeignKey());
columnDescriptor.setAutoIncremented(column.isAutoIncremented());
tableDescriptor.getColumns().add(columnDescriptor);
localColumns.put(column.getName(), columnDescriptor);
allColumns.put(column, columnDescriptor);
}
// Primary key
PrimaryKey primaryKey = table.getPrimaryKey();
if (primaryKey != null) {
PrimaryKeyDescriptor primaryKeyDescriptor = storeIndex(primaryKey, tableDescriptor, localColumns, PrimaryKeyDescriptor.class,
PrimaryKeyOnColumnDescriptor.class, store);
tableDescriptor.setPrimaryKey(primaryKeyDescriptor);
}
// Indices
for (Index index : table.getIndices()) {
IndexDescriptor indexDescriptor = storeIndex(index, tableDescriptor, localColumns, IndexDescriptor.class, IndexOnColumnDescriptor.class, store);
tableDescriptor.getIndices().add(indexDescriptor);
}
// Trigger
for (Trigger trigger : table.getTriggers()) {
TriggerDescriptor triggerDescriptor = store.create(TriggerDescriptor.class);
triggerDescriptor.setName(trigger.getName());
triggerDescriptor.setActionCondition(trigger.getActionCondition());
triggerDescriptor.setActionOrder(trigger.getActionOrder());
triggerDescriptor.setActionOrientation(trigger.getActionOrientation().name());
triggerDescriptor.setActionStatement(trigger.getActionStatement());
triggerDescriptor.setConditionTiming(trigger.getConditionTiming().name());
triggerDescriptor.setEventManipulationTime(trigger.getEventManipulationType().name());
tableDescriptor.getTriggers().add(triggerDescriptor);
}
allForeignKeys.addAll(table.getForeignKeys());
}
} | [
"private",
"void",
"createTables",
"(",
"Catalog",
"catalog",
",",
"Schema",
"schema",
",",
"SchemaDescriptor",
"schemaDescriptor",
",",
"Map",
"<",
"String",
",",
"ColumnTypeDescriptor",
">",
"columnTypes",
",",
"Map",
"<",
"Column",
",",
"ColumnDescriptor",
">",... | Create the table descriptors.
@param catalog The catalog.
@param schema The schema.
@param schemaDescriptor The schema descriptor.
@param columnTypes The cached data types.
@param allColumns The map to collect all columns.
@param allForeignKeys The map to collect all foreign keys.
@param store The store. | [
"Create",
"the",
"table",
"descriptors",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L159-L202 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.createColumnDescriptor | private <T extends BaseColumnDescriptor> T createColumnDescriptor(BaseColumn column, Class<T> descriptorType,
Map<String, ColumnTypeDescriptor> columnTypes, Store store) {
T columnDescriptor = store.create(descriptorType);
columnDescriptor.setName(column.getName());
columnDescriptor.setNullable(column.isNullable());
columnDescriptor.setSize(column.getSize());
columnDescriptor.setDecimalDigits(column.getDecimalDigits());
ColumnDataType columnDataType = column.getColumnDataType();
ColumnTypeDescriptor columnTypeDescriptor = getColumnTypeDescriptor(columnDataType, columnTypes, store);
columnDescriptor.setColumnType(columnTypeDescriptor);
return columnDescriptor;
} | java | private <T extends BaseColumnDescriptor> T createColumnDescriptor(BaseColumn column, Class<T> descriptorType,
Map<String, ColumnTypeDescriptor> columnTypes, Store store) {
T columnDescriptor = store.create(descriptorType);
columnDescriptor.setName(column.getName());
columnDescriptor.setNullable(column.isNullable());
columnDescriptor.setSize(column.getSize());
columnDescriptor.setDecimalDigits(column.getDecimalDigits());
ColumnDataType columnDataType = column.getColumnDataType();
ColumnTypeDescriptor columnTypeDescriptor = getColumnTypeDescriptor(columnDataType, columnTypes, store);
columnDescriptor.setColumnType(columnTypeDescriptor);
return columnDescriptor;
} | [
"private",
"<",
"T",
"extends",
"BaseColumnDescriptor",
">",
"T",
"createColumnDescriptor",
"(",
"BaseColumn",
"column",
",",
"Class",
"<",
"T",
">",
"descriptorType",
",",
"Map",
"<",
"String",
",",
"ColumnTypeDescriptor",
">",
"columnTypes",
",",
"Store",
"sto... | Create a column descriptor.
@param column The column.
@param descriptorType The type to create.
@param columnTypes The column types.
@param store The store.
@return The column descriptor. | [
"Create",
"a",
"column",
"descriptor",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L213-L224 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.createForeignKeys | private void createForeignKeys(Set<ForeignKey> allForeignKeys, Map<Column, ColumnDescriptor> allColumns, Store store) {
// Foreign keys
for (ForeignKey foreignKey : allForeignKeys) {
ForeignKeyDescriptor foreignKeyDescriptor = store.create(ForeignKeyDescriptor.class);
foreignKeyDescriptor.setName(foreignKey.getName());
foreignKeyDescriptor.setDeferrability(foreignKey.getDeferrability().name());
foreignKeyDescriptor.setDeleteRule(foreignKey.getDeleteRule().name());
foreignKeyDescriptor.setUpdateRule(foreignKey.getUpdateRule().name());
for (ForeignKeyColumnReference columnReference : foreignKey.getColumnReferences()) {
ForeignKeyReferenceDescriptor keyReferenceDescriptor = store.create(ForeignKeyReferenceDescriptor.class);
// foreign key table and column
Column foreignKeyColumn = columnReference.getForeignKeyColumn();
ColumnDescriptor foreignKeyColumnDescriptor = allColumns.get(foreignKeyColumn);
keyReferenceDescriptor.setForeignKeyColumn(foreignKeyColumnDescriptor);
// primary key table and column
Column primaryKeyColumn = columnReference.getPrimaryKeyColumn();
ColumnDescriptor primaryKeyColumnDescriptor = allColumns.get(primaryKeyColumn);
keyReferenceDescriptor.setPrimaryKeyColumn(primaryKeyColumnDescriptor);
foreignKeyDescriptor.getForeignKeyReferences().add(keyReferenceDescriptor);
}
}
} | java | private void createForeignKeys(Set<ForeignKey> allForeignKeys, Map<Column, ColumnDescriptor> allColumns, Store store) {
// Foreign keys
for (ForeignKey foreignKey : allForeignKeys) {
ForeignKeyDescriptor foreignKeyDescriptor = store.create(ForeignKeyDescriptor.class);
foreignKeyDescriptor.setName(foreignKey.getName());
foreignKeyDescriptor.setDeferrability(foreignKey.getDeferrability().name());
foreignKeyDescriptor.setDeleteRule(foreignKey.getDeleteRule().name());
foreignKeyDescriptor.setUpdateRule(foreignKey.getUpdateRule().name());
for (ForeignKeyColumnReference columnReference : foreignKey.getColumnReferences()) {
ForeignKeyReferenceDescriptor keyReferenceDescriptor = store.create(ForeignKeyReferenceDescriptor.class);
// foreign key table and column
Column foreignKeyColumn = columnReference.getForeignKeyColumn();
ColumnDescriptor foreignKeyColumnDescriptor = allColumns.get(foreignKeyColumn);
keyReferenceDescriptor.setForeignKeyColumn(foreignKeyColumnDescriptor);
// primary key table and column
Column primaryKeyColumn = columnReference.getPrimaryKeyColumn();
ColumnDescriptor primaryKeyColumnDescriptor = allColumns.get(primaryKeyColumn);
keyReferenceDescriptor.setPrimaryKeyColumn(primaryKeyColumnDescriptor);
foreignKeyDescriptor.getForeignKeyReferences().add(keyReferenceDescriptor);
}
}
} | [
"private",
"void",
"createForeignKeys",
"(",
"Set",
"<",
"ForeignKey",
">",
"allForeignKeys",
",",
"Map",
"<",
"Column",
",",
"ColumnDescriptor",
">",
"allColumns",
",",
"Store",
"store",
")",
"{",
"// Foreign keys",
"for",
"(",
"ForeignKey",
"foreignKey",
":",
... | Create the foreign key descriptors.
@param allForeignKeys All collected foreign keys.
@param allColumns All collected columns.
@param store The store. | [
"Create",
"the",
"foreign",
"key",
"descriptors",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L233-L254 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.createRoutines | private void createRoutines(Collection<Routine> routines, SchemaDescriptor schemaDescriptor, Map<String, ColumnTypeDescriptor> columnTypes, Store store)
throws IOException {
for (Routine routine : routines) {
RoutineDescriptor routineDescriptor;
String returnType;
switch (routine.getRoutineType()) {
case procedure:
routineDescriptor = store.create(ProcedureDescriptor.class);
returnType = ((ProcedureReturnType) routine.getReturnType()).name();
schemaDescriptor.getProcedures().add((ProcedureDescriptor) routineDescriptor);
break;
case function:
routineDescriptor = store.create(FunctionDescriptor.class);
returnType = ((FunctionReturnType) routine.getReturnType()).name();
schemaDescriptor.getFunctions().add((FunctionDescriptor) routineDescriptor);
break;
case unknown:
routineDescriptor = store.create(RoutineDescriptor.class);
returnType = null;
schemaDescriptor.getUnknownRoutines().add(routineDescriptor);
break;
default:
throw new IOException("Unsupported routine type " + routine.getRoutineType());
}
routineDescriptor.setName(routine.getName());
routineDescriptor.setReturnType(returnType);
routineDescriptor.setBodyType(routine.getRoutineBodyType().name());
routineDescriptor.setDefinition(routine.getDefinition());
for (RoutineColumn<? extends Routine> routineColumn : routine.getColumns()) {
RoutineColumnDescriptor columnDescriptor = createColumnDescriptor(routineColumn, RoutineColumnDescriptor.class, columnTypes, store);
routineDescriptor.getColumns().add(columnDescriptor);
RoutineColumnType columnType = routineColumn.getColumnType();
if (columnType instanceof ProcedureColumnType) {
ProcedureColumnType procedureColumnType = (ProcedureColumnType) columnType;
columnDescriptor.setType(procedureColumnType.name());
} else if (columnType instanceof FunctionColumnType) {
FunctionColumnType functionColumnType = (FunctionColumnType) columnType;
columnDescriptor.setType(functionColumnType.name());
} else {
throw new IOException("Unsupported routine column type " + columnType.getClass().getName());
}
}
}
} | java | private void createRoutines(Collection<Routine> routines, SchemaDescriptor schemaDescriptor, Map<String, ColumnTypeDescriptor> columnTypes, Store store)
throws IOException {
for (Routine routine : routines) {
RoutineDescriptor routineDescriptor;
String returnType;
switch (routine.getRoutineType()) {
case procedure:
routineDescriptor = store.create(ProcedureDescriptor.class);
returnType = ((ProcedureReturnType) routine.getReturnType()).name();
schemaDescriptor.getProcedures().add((ProcedureDescriptor) routineDescriptor);
break;
case function:
routineDescriptor = store.create(FunctionDescriptor.class);
returnType = ((FunctionReturnType) routine.getReturnType()).name();
schemaDescriptor.getFunctions().add((FunctionDescriptor) routineDescriptor);
break;
case unknown:
routineDescriptor = store.create(RoutineDescriptor.class);
returnType = null;
schemaDescriptor.getUnknownRoutines().add(routineDescriptor);
break;
default:
throw new IOException("Unsupported routine type " + routine.getRoutineType());
}
routineDescriptor.setName(routine.getName());
routineDescriptor.setReturnType(returnType);
routineDescriptor.setBodyType(routine.getRoutineBodyType().name());
routineDescriptor.setDefinition(routine.getDefinition());
for (RoutineColumn<? extends Routine> routineColumn : routine.getColumns()) {
RoutineColumnDescriptor columnDescriptor = createColumnDescriptor(routineColumn, RoutineColumnDescriptor.class, columnTypes, store);
routineDescriptor.getColumns().add(columnDescriptor);
RoutineColumnType columnType = routineColumn.getColumnType();
if (columnType instanceof ProcedureColumnType) {
ProcedureColumnType procedureColumnType = (ProcedureColumnType) columnType;
columnDescriptor.setType(procedureColumnType.name());
} else if (columnType instanceof FunctionColumnType) {
FunctionColumnType functionColumnType = (FunctionColumnType) columnType;
columnDescriptor.setType(functionColumnType.name());
} else {
throw new IOException("Unsupported routine column type " + columnType.getClass().getName());
}
}
}
} | [
"private",
"void",
"createRoutines",
"(",
"Collection",
"<",
"Routine",
">",
"routines",
",",
"SchemaDescriptor",
"schemaDescriptor",
",",
"Map",
"<",
"String",
",",
"ColumnTypeDescriptor",
">",
"columnTypes",
",",
"Store",
"store",
")",
"throws",
"IOException",
"... | Create routines, i.e. functions and procedures.
@param routines The routines.
@param schemaDescriptor The schema descriptor.
@param columnTypes The column types.
@param store The store.
@throws java.io.IOException If an unsupported routine type has been found. | [
"Create",
"routines",
"i",
".",
"e",
".",
"functions",
"and",
"procedures",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L265-L308 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.createSequences | private void createSequences(Collection<Sequence> sequences, SchemaDescriptor schemaDescriptor, Store store) {
for (Sequence sequence : sequences) {
SequenceDesriptor sequenceDesriptor = store.create(SequenceDesriptor.class);
sequenceDesriptor.setName(sequence.getName());
sequenceDesriptor.setIncrement(sequence.getIncrement());
sequenceDesriptor.setMinimumValue(sequence.getMinimumValue().longValue());
sequenceDesriptor.setMaximumValue(sequence.getMaximumValue().longValue());
sequenceDesriptor.setCycle(sequence.isCycle());
schemaDescriptor.getSequences().add(sequenceDesriptor);
}
} | java | private void createSequences(Collection<Sequence> sequences, SchemaDescriptor schemaDescriptor, Store store) {
for (Sequence sequence : sequences) {
SequenceDesriptor sequenceDesriptor = store.create(SequenceDesriptor.class);
sequenceDesriptor.setName(sequence.getName());
sequenceDesriptor.setIncrement(sequence.getIncrement());
sequenceDesriptor.setMinimumValue(sequence.getMinimumValue().longValue());
sequenceDesriptor.setMaximumValue(sequence.getMaximumValue().longValue());
sequenceDesriptor.setCycle(sequence.isCycle());
schemaDescriptor.getSequences().add(sequenceDesriptor);
}
} | [
"private",
"void",
"createSequences",
"(",
"Collection",
"<",
"Sequence",
">",
"sequences",
",",
"SchemaDescriptor",
"schemaDescriptor",
",",
"Store",
"store",
")",
"{",
"for",
"(",
"Sequence",
"sequence",
":",
"sequences",
")",
"{",
"SequenceDesriptor",
"sequence... | Add the sequences of a schema to the schema descriptor.
@param sequences The sequences.
@param schemaDescriptor The schema descriptor.
@param store The store. | [
"Add",
"the",
"sequences",
"of",
"a",
"schema",
"to",
"the",
"schema",
"descriptor",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L317-L327 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.getTableDescriptor | private TableDescriptor getTableDescriptor(Table table, SchemaDescriptor schemaDescriptor, Store store) {
TableDescriptor tableDescriptor;
if (table instanceof View) {
View view = (View) table;
ViewDescriptor viewDescriptor = store.create(ViewDescriptor.class);
viewDescriptor.setUpdatable(view.isUpdatable());
CheckOptionType checkOption = view.getCheckOption();
if (checkOption != null) {
viewDescriptor.setCheckOption(checkOption.name());
}
schemaDescriptor.getViews().add(viewDescriptor);
tableDescriptor = viewDescriptor;
} else {
tableDescriptor = store.create(TableDescriptor.class);
schemaDescriptor.getTables().add(tableDescriptor);
}
tableDescriptor.setName(table.getName());
return tableDescriptor;
} | java | private TableDescriptor getTableDescriptor(Table table, SchemaDescriptor schemaDescriptor, Store store) {
TableDescriptor tableDescriptor;
if (table instanceof View) {
View view = (View) table;
ViewDescriptor viewDescriptor = store.create(ViewDescriptor.class);
viewDescriptor.setUpdatable(view.isUpdatable());
CheckOptionType checkOption = view.getCheckOption();
if (checkOption != null) {
viewDescriptor.setCheckOption(checkOption.name());
}
schemaDescriptor.getViews().add(viewDescriptor);
tableDescriptor = viewDescriptor;
} else {
tableDescriptor = store.create(TableDescriptor.class);
schemaDescriptor.getTables().add(tableDescriptor);
}
tableDescriptor.setName(table.getName());
return tableDescriptor;
} | [
"private",
"TableDescriptor",
"getTableDescriptor",
"(",
"Table",
"table",
",",
"SchemaDescriptor",
"schemaDescriptor",
",",
"Store",
"store",
")",
"{",
"TableDescriptor",
"tableDescriptor",
";",
"if",
"(",
"table",
"instanceof",
"View",
")",
"{",
"View",
"view",
... | Create a table descriptor for the given table.
@param store The store
@param table The table
@return The table descriptor | [
"Create",
"a",
"table",
"descriptor",
"for",
"the",
"given",
"table",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L336-L354 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.storeIndex | private <I extends IndexDescriptor> I storeIndex(Index index, TableDescriptor tableDescriptor, Map<String, ColumnDescriptor> columns, Class<I> indexType,
Class<? extends OnColumnDescriptor> onColumnType, Store store) {
I indexDescriptor = store.create(indexType);
indexDescriptor.setName(index.getName());
indexDescriptor.setUnique(index.isUnique());
indexDescriptor.setCardinality(index.getCardinality());
indexDescriptor.setIndexType(index.getIndexType().name());
indexDescriptor.setPages(index.getPages());
for (IndexColumn indexColumn : index.getColumns()) {
ColumnDescriptor columnDescriptor = columns.get(indexColumn.getName());
OnColumnDescriptor onColumnDescriptor = store.create(indexDescriptor, onColumnType, columnDescriptor);
onColumnDescriptor.setIndexOrdinalPosition(indexColumn.getIndexOrdinalPosition());
onColumnDescriptor.setSortSequence(indexColumn.getSortSequence().name());
}
return indexDescriptor;
} | java | private <I extends IndexDescriptor> I storeIndex(Index index, TableDescriptor tableDescriptor, Map<String, ColumnDescriptor> columns, Class<I> indexType,
Class<? extends OnColumnDescriptor> onColumnType, Store store) {
I indexDescriptor = store.create(indexType);
indexDescriptor.setName(index.getName());
indexDescriptor.setUnique(index.isUnique());
indexDescriptor.setCardinality(index.getCardinality());
indexDescriptor.setIndexType(index.getIndexType().name());
indexDescriptor.setPages(index.getPages());
for (IndexColumn indexColumn : index.getColumns()) {
ColumnDescriptor columnDescriptor = columns.get(indexColumn.getName());
OnColumnDescriptor onColumnDescriptor = store.create(indexDescriptor, onColumnType, columnDescriptor);
onColumnDescriptor.setIndexOrdinalPosition(indexColumn.getIndexOrdinalPosition());
onColumnDescriptor.setSortSequence(indexColumn.getSortSequence().name());
}
return indexDescriptor;
} | [
"private",
"<",
"I",
"extends",
"IndexDescriptor",
">",
"I",
"storeIndex",
"(",
"Index",
"index",
",",
"TableDescriptor",
"tableDescriptor",
",",
"Map",
"<",
"String",
",",
"ColumnDescriptor",
">",
"columns",
",",
"Class",
"<",
"I",
">",
"indexType",
",",
"C... | Stores index data.
@param index The index.
@param tableDescriptor The table descriptor.
@param columns The cached columns.
@param indexType The index type to create.
@param onColumnType The type representing "on column" to create.
@param store The store.
@return The created index descriptor. | [
"Stores",
"index",
"data",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L367-L382 | train |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.getColumnTypeDescriptor | private ColumnTypeDescriptor getColumnTypeDescriptor(ColumnDataType columnDataType, Map<String, ColumnTypeDescriptor> columnTypes, Store store) {
String databaseSpecificTypeName = columnDataType.getDatabaseSpecificTypeName();
ColumnTypeDescriptor columnTypeDescriptor = columnTypes.get(databaseSpecificTypeName);
if (columnTypeDescriptor == null) {
columnTypeDescriptor = store.find(ColumnTypeDescriptor.class, databaseSpecificTypeName);
if (columnTypeDescriptor == null) {
columnTypeDescriptor = store.create(ColumnTypeDescriptor.class);
columnTypeDescriptor.setDatabaseType(databaseSpecificTypeName);
columnTypeDescriptor.setAutoIncrementable(columnDataType.isAutoIncrementable());
columnTypeDescriptor.setCaseSensitive(columnDataType.isCaseSensitive());
columnTypeDescriptor.setPrecision(columnDataType.getPrecision());
columnTypeDescriptor.setMinimumScale(columnDataType.getMinimumScale());
columnTypeDescriptor.setMaximumScale(columnDataType.getMaximumScale());
columnTypeDescriptor.setFixedPrecisionScale(columnDataType.isFixedPrecisionScale());
columnTypeDescriptor.setNumericPrecisionRadix(columnDataType.getNumPrecisionRadix());
columnTypeDescriptor.setUnsigned(columnDataType.isUnsigned());
columnTypeDescriptor.setUserDefined(columnDataType.isUserDefined());
columnTypeDescriptor.setNullable(columnDataType.isNullable());
}
columnTypes.put(databaseSpecificTypeName, columnTypeDescriptor);
}
return columnTypeDescriptor;
} | java | private ColumnTypeDescriptor getColumnTypeDescriptor(ColumnDataType columnDataType, Map<String, ColumnTypeDescriptor> columnTypes, Store store) {
String databaseSpecificTypeName = columnDataType.getDatabaseSpecificTypeName();
ColumnTypeDescriptor columnTypeDescriptor = columnTypes.get(databaseSpecificTypeName);
if (columnTypeDescriptor == null) {
columnTypeDescriptor = store.find(ColumnTypeDescriptor.class, databaseSpecificTypeName);
if (columnTypeDescriptor == null) {
columnTypeDescriptor = store.create(ColumnTypeDescriptor.class);
columnTypeDescriptor.setDatabaseType(databaseSpecificTypeName);
columnTypeDescriptor.setAutoIncrementable(columnDataType.isAutoIncrementable());
columnTypeDescriptor.setCaseSensitive(columnDataType.isCaseSensitive());
columnTypeDescriptor.setPrecision(columnDataType.getPrecision());
columnTypeDescriptor.setMinimumScale(columnDataType.getMinimumScale());
columnTypeDescriptor.setMaximumScale(columnDataType.getMaximumScale());
columnTypeDescriptor.setFixedPrecisionScale(columnDataType.isFixedPrecisionScale());
columnTypeDescriptor.setNumericPrecisionRadix(columnDataType.getNumPrecisionRadix());
columnTypeDescriptor.setUnsigned(columnDataType.isUnsigned());
columnTypeDescriptor.setUserDefined(columnDataType.isUserDefined());
columnTypeDescriptor.setNullable(columnDataType.isNullable());
}
columnTypes.put(databaseSpecificTypeName, columnTypeDescriptor);
}
return columnTypeDescriptor;
} | [
"private",
"ColumnTypeDescriptor",
"getColumnTypeDescriptor",
"(",
"ColumnDataType",
"columnDataType",
",",
"Map",
"<",
"String",
",",
"ColumnTypeDescriptor",
">",
"columnTypes",
",",
"Store",
"store",
")",
"{",
"String",
"databaseSpecificTypeName",
"=",
"columnDataType",... | Return the column type descriptor for the given data type.
@param columnDataType The data type.
@param columnTypes The cached data types.
@param store The store.
@return The column type descriptor. | [
"Return",
"the",
"column",
"type",
"descriptor",
"for",
"the",
"given",
"data",
"type",
"."
] | 96c3919907deee00175cf5ab005867d76e01ba62 | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L392-L414 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java | ProfilePackageSummaryBuilder.getInstance | public static ProfilePackageSummaryBuilder getInstance(Context context,
PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
Profile profile) {
return new ProfilePackageSummaryBuilder(context, pkg, profilePackageWriter,
profile);
} | java | public static ProfilePackageSummaryBuilder getInstance(Context context,
PackageDoc pkg, ProfilePackageSummaryWriter profilePackageWriter,
Profile profile) {
return new ProfilePackageSummaryBuilder(context, pkg, profilePackageWriter,
profile);
} | [
"public",
"static",
"ProfilePackageSummaryBuilder",
"getInstance",
"(",
"Context",
"context",
",",
"PackageDoc",
"pkg",
",",
"ProfilePackageSummaryWriter",
"profilePackageWriter",
",",
"Profile",
"profile",
")",
"{",
"return",
"new",
"ProfilePackageSummaryBuilder",
"(",
"... | Construct a new ProfilePackageSummaryBuilder.
@param context the build context.
@param pkg the profile package being documented.
@param profilePackageWriter the doclet specific writer that will output the
result.
@param profile the profile being documented.
@return an instance of a ProfilePackageSummaryBuilder. | [
"Construct",
"a",
"new",
"ProfilePackageSummaryBuilder",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java#L106-L111 | train |
theHilikus/JRoboCom | jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java | BoardPanel.addItem | public void addItem(Point coordinates, Drawable item) {
assertEDT();
if (coordinates == null || item == null) {
throw new IllegalArgumentException("Coordinates and added item cannot be null");
}
log.trace("[addItem] New item added @ {}", coordinates);
getPanelAt(coordinates).addModel(item);
getPanelAt(coordinates).repaint();
} | java | public void addItem(Point coordinates, Drawable item) {
assertEDT();
if (coordinates == null || item == null) {
throw new IllegalArgumentException("Coordinates and added item cannot be null");
}
log.trace("[addItem] New item added @ {}", coordinates);
getPanelAt(coordinates).addModel(item);
getPanelAt(coordinates).repaint();
} | [
"public",
"void",
"addItem",
"(",
"Point",
"coordinates",
",",
"Drawable",
"item",
")",
"{",
"assertEDT",
"(",
")",
";",
"if",
"(",
"coordinates",
"==",
"null",
"||",
"item",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Coord... | Adds an item to draw in a particular position
@param coordinates the position of the item
@param item the drawable element | [
"Adds",
"an",
"item",
"to",
"draw",
"in",
"a",
"particular",
"position"
] | 0e31c1ecf1006e35f68c229ff66c37640effffac | https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java#L66-L75 | train |
theHilikus/JRoboCom | jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java | BoardPanel.moveItem | public void moveItem(Point oldCoordinates, Point newCoordinates) {
assertEDT();
if (oldCoordinates == null || newCoordinates == null) {
throw new IllegalArgumentException("Coordinates cannot be null");
}
if (getPanelAt(newCoordinates).hasModel()) {
throw new IllegalStateException(
"New position contains a model in the UI already. New position = " + newCoordinates);
}
if (!getPanelAt(oldCoordinates).hasModel()) {
throw new IllegalStateException("Old position doesn't contain a model in the UI. Old position = "
+ oldCoordinates);
}
// all good
Drawable item = getPanelAt(oldCoordinates).getModel();
removeItem(oldCoordinates);
addItem(newCoordinates, item);
} | java | public void moveItem(Point oldCoordinates, Point newCoordinates) {
assertEDT();
if (oldCoordinates == null || newCoordinates == null) {
throw new IllegalArgumentException("Coordinates cannot be null");
}
if (getPanelAt(newCoordinates).hasModel()) {
throw new IllegalStateException(
"New position contains a model in the UI already. New position = " + newCoordinates);
}
if (!getPanelAt(oldCoordinates).hasModel()) {
throw new IllegalStateException("Old position doesn't contain a model in the UI. Old position = "
+ oldCoordinates);
}
// all good
Drawable item = getPanelAt(oldCoordinates).getModel();
removeItem(oldCoordinates);
addItem(newCoordinates, item);
} | [
"public",
"void",
"moveItem",
"(",
"Point",
"oldCoordinates",
",",
"Point",
"newCoordinates",
")",
"{",
"assertEDT",
"(",
")",
";",
"if",
"(",
"oldCoordinates",
"==",
"null",
"||",
"newCoordinates",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentExcep... | Changes the position of the item in the specified location
@param oldCoordinates position of the item to move
@param newCoordinates position to move the item to | [
"Changes",
"the",
"position",
"of",
"the",
"item",
"in",
"the",
"specified",
"location"
] | 0e31c1ecf1006e35f68c229ff66c37640effffac | https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java#L102-L120 | train |
theHilikus/JRoboCom | jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java | BoardPanel.clear | public void clear() {
assertEDT();
log.debug("[clear] Cleaning board");
for (int row = 0; row < SIZE; row++) {
for (int col = 0; col < SIZE; col++) {
removeItem(new Point(col, row));
}
}
} | java | public void clear() {
assertEDT();
log.debug("[clear] Cleaning board");
for (int row = 0; row < SIZE; row++) {
for (int col = 0; col < SIZE; col++) {
removeItem(new Point(col, row));
}
}
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"assertEDT",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"[clear] Cleaning board\"",
")",
";",
"for",
"(",
"int",
"row",
"=",
"0",
";",
"row",
"<",
"SIZE",
";",
"row",
"++",
")",
"{",
"for",
"(",
"int",
"c... | Removes all the drawn elements | [
"Removes",
"all",
"the",
"drawn",
"elements"
] | 0e31c1ecf1006e35f68c229ff66c37640effffac | https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java#L125-L133 | train |
theHilikus/JRoboCom | jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java | BoardPanel.refresh | public void refresh(Point coordinates) {
assertEDT();
if (coordinates == null) {
throw new IllegalArgumentException("Coordinates cannot be null");
}
getPanelAt(coordinates).repaint();
} | java | public void refresh(Point coordinates) {
assertEDT();
if (coordinates == null) {
throw new IllegalArgumentException("Coordinates cannot be null");
}
getPanelAt(coordinates).repaint();
} | [
"public",
"void",
"refresh",
"(",
"Point",
"coordinates",
")",
"{",
"assertEDT",
"(",
")",
";",
"if",
"(",
"coordinates",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Coordinates cannot be null\"",
")",
";",
"}",
"getPanelAt",
"(... | Repaints the item specified
@param coordinates location of the item | [
"Repaints",
"the",
"item",
"specified"
] | 0e31c1ecf1006e35f68c229ff66c37640effffac | https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java#L144-L151 | train |
magik6k/JWWF | src/main/java/net/magik6k/jwwf/widgets/basic/panel/TablePanel.java | TablePanel.removeAll | public TablePanel removeAll() {
for (int i = 0; i < content.length; ++i)
for (int j = 0; j < content[i].length; ++j)
content[i][j] = null;
this.sendElement();
return this;
} | java | public TablePanel removeAll() {
for (int i = 0; i < content.length; ++i)
for (int j = 0; j < content[i].length; ++j)
content[i][j] = null;
this.sendElement();
return this;
} | [
"public",
"TablePanel",
"removeAll",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"content",
".",
"length",
";",
"++",
"i",
")",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"content",
"[",
"i",
"]",
".",
"length",
";",... | Removes all elements stored in this container
@return This instance for chaining | [
"Removes",
"all",
"elements",
"stored",
"in",
"this",
"container"
] | 8ba334501396c3301495da8708733f6014f20665 | https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/widgets/basic/panel/TablePanel.java#L135-L141 | train |
magik6k/JWWF | src/main/java/net/magik6k/jwwf/widgets/basic/panel/TablePanel.java | TablePanel.remove | public TablePanel remove(Widget widget) {
for (int i = 0; i < content.length; ++i)
for (int j = 0; j < content[i].length; ++j)
if (content[i][j] == widget) content[i][j] = null;
this.sendElement();
return this;
} | java | public TablePanel remove(Widget widget) {
for (int i = 0; i < content.length; ++i)
for (int j = 0; j < content[i].length; ++j)
if (content[i][j] == widget) content[i][j] = null;
this.sendElement();
return this;
} | [
"public",
"TablePanel",
"remove",
"(",
"Widget",
"widget",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"content",
".",
"length",
";",
"++",
"i",
")",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"content",
"[",
"i",
"]",
".... | Removes all elements that are instance of specified element
@param widget Instance of widget to remove from container
@return This instance for chaining | [
"Removes",
"all",
"elements",
"that",
"are",
"instance",
"of",
"specified",
"element"
] | 8ba334501396c3301495da8708733f6014f20665 | https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/widgets/basic/panel/TablePanel.java#L162-L168 | train |
magik6k/JWWF | src/main/java/net/magik6k/jwwf/widgets/basic/panel/TablePanel.java | TablePanel.put | public TablePanel put(Widget widget, int x, int y) {
if (x < 0 || y < 0 || x >= content.length || y >= content[x].length)
throw new IndexOutOfBoundsException();
attach(widget);
content[x][y] = widget;
this.sendElement();
return this;
} | java | public TablePanel put(Widget widget, int x, int y) {
if (x < 0 || y < 0 || x >= content.length || y >= content[x].length)
throw new IndexOutOfBoundsException();
attach(widget);
content[x][y] = widget;
this.sendElement();
return this;
} | [
"public",
"TablePanel",
"put",
"(",
"Widget",
"widget",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"x",
"<",
"0",
"||",
"y",
"<",
"0",
"||",
"x",
">=",
"content",
".",
"length",
"||",
"y",
">=",
"content",
"[",
"x",
"]",
".",
"len... | Set widget to certain cell in table
@param widget Widget to set
@param x Column
@param y Row
@return This instance for chaining | [
"Set",
"widget",
"to",
"certain",
"cell",
"in",
"table"
] | 8ba334501396c3301495da8708733f6014f20665 | https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/widgets/basic/panel/TablePanel.java#L195-L202 | train |
SixDimensions/Component-Bindings-Provider | impl/src/main/java/com/sixdimensions/wcm/cq/component/bindings/impl/ComponentBindingsProviderWebConsole.java | ComponentBindingsProviderWebConsole.loadProperties | private Map<String, String> loadProperties(ServiceReference reference) {
log.trace("loadProperties");
Map<String, String> properties = new HashMap<String, String>();
properties.put("id", OsgiUtil.toString(
reference.getProperty(Constants.SERVICE_ID), ""));
properties.put("class", OsgiUtil.toString(
reference.getProperty(Constants.SERVICE_PID), ""));
properties.put("description", OsgiUtil.toString(
reference.getProperty(Constants.SERVICE_DESCRIPTION), ""));
properties.put(
"vendor",
OsgiUtil.toString(
reference.getProperty(Constants.SERVICE_VENDOR), ""));
properties
.put("resourceTypes",
Arrays.toString(OsgiUtil.toStringArray(
reference
.getProperty(ComponentBindingsProvider.RESOURCE_TYPE_PROP),
new String[0])));
properties.put("priority", OsgiUtil.toString(
reference.getProperty(ComponentBindingsProvider.PRIORITY), ""));
properties.put("bundle_id",
String.valueOf(reference.getBundle().getBundleId()));
properties.put("bundle_name", reference.getBundle().getSymbolicName());
log.debug("Loaded properties {}", properties);
return properties;
} | java | private Map<String, String> loadProperties(ServiceReference reference) {
log.trace("loadProperties");
Map<String, String> properties = new HashMap<String, String>();
properties.put("id", OsgiUtil.toString(
reference.getProperty(Constants.SERVICE_ID), ""));
properties.put("class", OsgiUtil.toString(
reference.getProperty(Constants.SERVICE_PID), ""));
properties.put("description", OsgiUtil.toString(
reference.getProperty(Constants.SERVICE_DESCRIPTION), ""));
properties.put(
"vendor",
OsgiUtil.toString(
reference.getProperty(Constants.SERVICE_VENDOR), ""));
properties
.put("resourceTypes",
Arrays.toString(OsgiUtil.toStringArray(
reference
.getProperty(ComponentBindingsProvider.RESOURCE_TYPE_PROP),
new String[0])));
properties.put("priority", OsgiUtil.toString(
reference.getProperty(ComponentBindingsProvider.PRIORITY), ""));
properties.put("bundle_id",
String.valueOf(reference.getBundle().getBundleId()));
properties.put("bundle_name", reference.getBundle().getSymbolicName());
log.debug("Loaded properties {}", properties);
return properties;
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"loadProperties",
"(",
"ServiceReference",
"reference",
")",
"{",
"log",
".",
"trace",
"(",
"\"loadProperties\"",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
"=",
"new",
"HashMap",
... | Loads the properties from the specified Service Reference into a map.
@param reference
the reference from which to load the properties
@return the properties | [
"Loads",
"the",
"properties",
"from",
"the",
"specified",
"Service",
"Reference",
"into",
"a",
"map",
"."
] | 1d4da2f8c274d32edcd0a2593bec1255b8340b5b | https://github.com/SixDimensions/Component-Bindings-Provider/blob/1d4da2f8c274d32edcd0a2593bec1255b8340b5b/impl/src/main/java/com/sixdimensions/wcm/cq/component/bindings/impl/ComponentBindingsProviderWebConsole.java#L130-L157 | train |
SixDimensions/Component-Bindings-Provider | impl/src/main/java/com/sixdimensions/wcm/cq/component/bindings/impl/ComponentBindingsProviderWebConsole.java | ComponentBindingsProviderWebConsole.renderBlock | private void renderBlock(HttpServletResponse res, String templateName,
Map<String, String> properties) throws IOException {
InputStream is = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
String template = null;
try {
is = getClass().getClassLoader().getResourceAsStream(templateName);
if (is != null) {
IOUtils.copy(is, baos);
template = baos.toString();
} else {
throw new IOException("Unable to load template " + templateName);
}
} finally {
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(baos);
}
StrSubstitutor sub = new StrSubstitutor(properties);
res.getWriter().write(sub.replace(template));
} | java | private void renderBlock(HttpServletResponse res, String templateName,
Map<String, String> properties) throws IOException {
InputStream is = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
String template = null;
try {
is = getClass().getClassLoader().getResourceAsStream(templateName);
if (is != null) {
IOUtils.copy(is, baos);
template = baos.toString();
} else {
throw new IOException("Unable to load template " + templateName);
}
} finally {
IOUtils.closeQuietly(is);
IOUtils.closeQuietly(baos);
}
StrSubstitutor sub = new StrSubstitutor(properties);
res.getWriter().write(sub.replace(template));
} | [
"private",
"void",
"renderBlock",
"(",
"HttpServletResponse",
"res",
",",
"String",
"templateName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"null",
";",
"ByteArrayOutputStream",
"b... | Loads the template with the specified name from the classloader and uses
it to templatize the properties using Apache Commons Lang's
StrSubstitutor and writes it to the response.
@param res
the response to write to
@param template
the template file to load from the classpath
@param properties
the properties to templatize
@throws IOException | [
"Loads",
"the",
"template",
"with",
"the",
"specified",
"name",
"from",
"the",
"classloader",
"and",
"uses",
"it",
"to",
"templatize",
"the",
"properties",
"using",
"Apache",
"Commons",
"Lang",
"s",
"StrSubstitutor",
"and",
"writes",
"it",
"to",
"the",
"respon... | 1d4da2f8c274d32edcd0a2593bec1255b8340b5b | https://github.com/SixDimensions/Component-Bindings-Provider/blob/1d4da2f8c274d32edcd0a2593bec1255b8340b5b/impl/src/main/java/com/sixdimensions/wcm/cq/component/bindings/impl/ComponentBindingsProviderWebConsole.java#L172-L191 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/documents/XlsxWorksheet.java | XlsxWorksheet.unmarshall | private void unmarshall()
{
sheetData = sheet.getJaxbElement().getSheetData();
rows = sheetData.getRow();
if(rows != null && rows.size() > 0)
{
Row r = (Row)rows.get(0);
numColumns = r.getC().size();
}
} | java | private void unmarshall()
{
sheetData = sheet.getJaxbElement().getSheetData();
rows = sheetData.getRow();
if(rows != null && rows.size() > 0)
{
Row r = (Row)rows.get(0);
numColumns = r.getC().size();
}
} | [
"private",
"void",
"unmarshall",
"(",
")",
"{",
"sheetData",
"=",
"sheet",
".",
"getJaxbElement",
"(",
")",
".",
"getSheetData",
"(",
")",
";",
"rows",
"=",
"sheetData",
".",
"getRow",
"(",
")",
";",
"if",
"(",
"rows",
"!=",
"null",
"&&",
"rows",
"."... | Unmarshall the data in this worksheet. | [
"Unmarshall",
"the",
"data",
"in",
"this",
"worksheet",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/XlsxWorksheet.java#L54-L63 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/documents/XlsxWorksheet.java | XlsxWorksheet.getRows | public int getRows()
{
if(sheetData == null)
unmarshall();
int ret = 0;
if(rows != null)
ret = rows.size();
return ret;
} | java | public int getRows()
{
if(sheetData == null)
unmarshall();
int ret = 0;
if(rows != null)
ret = rows.size();
return ret;
} | [
"public",
"int",
"getRows",
"(",
")",
"{",
"if",
"(",
"sheetData",
"==",
"null",
")",
"unmarshall",
"(",
")",
";",
"int",
"ret",
"=",
"0",
";",
"if",
"(",
"rows",
"!=",
"null",
")",
"ret",
"=",
"rows",
".",
"size",
"(",
")",
";",
"return",
"ret... | Returns the number of rows in this worksheet.
@return The number of rows in this worksheet | [
"Returns",
"the",
"number",
"of",
"rows",
"in",
"this",
"worksheet",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/XlsxWorksheet.java#L91-L99 | train |
lightblueseas/jcommons-lang | src/main/java/de/alpharogroup/lang/util/ManifestVersionFactory.java | ManifestVersionFactory.get | public static ManifestVersion get(final Class<?> clazz)
{
final String manifestUrl = ClassExtensions.getManifestUrl(clazz);
try
{
return of(manifestUrl != null ? new URL(manifestUrl) : null);
}
catch (final MalformedURLException ignore)
{
return of(null);
}
} | java | public static ManifestVersion get(final Class<?> clazz)
{
final String manifestUrl = ClassExtensions.getManifestUrl(clazz);
try
{
return of(manifestUrl != null ? new URL(manifestUrl) : null);
}
catch (final MalformedURLException ignore)
{
return of(null);
}
} | [
"public",
"static",
"ManifestVersion",
"get",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"final",
"String",
"manifestUrl",
"=",
"ClassExtensions",
".",
"getManifestUrl",
"(",
"clazz",
")",
";",
"try",
"{",
"return",
"of",
"(",
"manifestUrl",
... | Returns a ManifestVersion object by reading the manifest file from the JAR, WAR or EAR file
that contains the given class.
@param clazz
the clazz
@return the manifest version | [
"Returns",
"a",
"ManifestVersion",
"object",
"by",
"reading",
"the",
"manifest",
"file",
"from",
"the",
"JAR",
"WAR",
"or",
"EAR",
"file",
"that",
"contains",
"the",
"given",
"class",
"."
] | 000e1f198e949ec3e721fd0fc3f5946e945232a3 | https://github.com/lightblueseas/jcommons-lang/blob/000e1f198e949ec3e721fd0fc3f5946e945232a3/src/main/java/de/alpharogroup/lang/util/ManifestVersionFactory.java#L56-L67 | train |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/service/UserAdminTask.java | UserAdminTask.processTask | @Override
public Object processTask(String taskName, Map<String, String[]> parameterMap) {
if ("createAdmin".equalsIgnoreCase(taskName)) {
return userService.createDefaultAdmin();
}
return null;
} | java | @Override
public Object processTask(String taskName, Map<String, String[]> parameterMap) {
if ("createAdmin".equalsIgnoreCase(taskName)) {
return userService.createDefaultAdmin();
}
return null;
} | [
"@",
"Override",
"public",
"Object",
"processTask",
"(",
"String",
"taskName",
",",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"parameterMap",
")",
"{",
"if",
"(",
"\"createAdmin\"",
".",
"equalsIgnoreCase",
"(",
"taskName",
")",
")",
"{",
"return... | Create a default admin in the datastore. | [
"Create",
"a",
"default",
"admin",
"in",
"the",
"datastore",
"."
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/service/UserAdminTask.java#L54-L63 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/beans/StorageComponent.java | StorageComponent.get | public ValueType get(final KeyType... keys) {
if (ArrayUtils.isEmpty(keys)) {
return null;
}
int keysLength = keys.length;
if (keysLength == 1) {
return get(keys[0]);
} else {
StorageComponent<KeyType, ValueType> storageComponent = this;
int lastKeyIndex = keysLength - 1;
for (int i = 0; i < lastKeyIndex; i++) {
KeyType storageComponentKey = keys[i];
storageComponent = storageComponent.getStorageComponent(storageComponentKey);
}
return storageComponent.get(keys[lastKeyIndex]);
}
} | java | public ValueType get(final KeyType... keys) {
if (ArrayUtils.isEmpty(keys)) {
return null;
}
int keysLength = keys.length;
if (keysLength == 1) {
return get(keys[0]);
} else {
StorageComponent<KeyType, ValueType> storageComponent = this;
int lastKeyIndex = keysLength - 1;
for (int i = 0; i < lastKeyIndex; i++) {
KeyType storageComponentKey = keys[i];
storageComponent = storageComponent.getStorageComponent(storageComponentKey);
}
return storageComponent.get(keys[lastKeyIndex]);
}
} | [
"public",
"ValueType",
"get",
"(",
"final",
"KeyType",
"...",
"keys",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isEmpty",
"(",
"keys",
")",
")",
"{",
"return",
"null",
";",
"}",
"int",
"keysLength",
"=",
"keys",
".",
"length",
";",
"if",
"(",
"keysLen... | Returns value of keys reference.
@param keys
the keys to get value.
@return value of keys reference. | [
"Returns",
"value",
"of",
"keys",
"reference",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/beans/StorageComponent.java#L62-L79 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/beans/StorageComponent.java | StorageComponent.put | public void put(final ValueType value, final KeyType... keys) {
if (ArrayUtils.isEmpty(keys)) {
return;
}
int keysLength = keys.length;
if (keysLength == 1) {
put(value, keys[0]);
} else {
StorageComponent<KeyType, ValueType> childStorageComponent = getStorageComponent(keys[0]);
int lastKeyIndex = keysLength - 1;
for (int i = 1; i < lastKeyIndex; i++) {
childStorageComponent = childStorageComponent.getStorageComponent(keys[i]);
}
childStorageComponent.put(value, keys[lastKeyIndex]);
}
} | java | public void put(final ValueType value, final KeyType... keys) {
if (ArrayUtils.isEmpty(keys)) {
return;
}
int keysLength = keys.length;
if (keysLength == 1) {
put(value, keys[0]);
} else {
StorageComponent<KeyType, ValueType> childStorageComponent = getStorageComponent(keys[0]);
int lastKeyIndex = keysLength - 1;
for (int i = 1; i < lastKeyIndex; i++) {
childStorageComponent = childStorageComponent.getStorageComponent(keys[i]);
}
childStorageComponent.put(value, keys[lastKeyIndex]);
}
} | [
"public",
"void",
"put",
"(",
"final",
"ValueType",
"value",
",",
"final",
"KeyType",
"...",
"keys",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isEmpty",
"(",
"keys",
")",
")",
"{",
"return",
";",
"}",
"int",
"keysLength",
"=",
"keys",
".",
"length",
"... | Storages the value by keys.
@param value
the value to storage.
@param keys
the keys to storage value. | [
"Storages",
"the",
"value",
"by",
"keys",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/beans/StorageComponent.java#L145-L161 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/beans/StorageComponent.java | StorageComponent.getStorageComponent | public StorageComponent<KeyType, ValueType> getStorageComponent(final KeyType key) {
KeyToStorageComponent<KeyType, ValueType> storage = getkeyToStorage();
StorageComponent<KeyType, ValueType> storageComponent = storage.get(key);
if (storageComponent == null) {
storageComponent = new StorageComponent<KeyType, ValueType>();
storage.put(key, storageComponent);
}
return storageComponent;
} | java | public StorageComponent<KeyType, ValueType> getStorageComponent(final KeyType key) {
KeyToStorageComponent<KeyType, ValueType> storage = getkeyToStorage();
StorageComponent<KeyType, ValueType> storageComponent = storage.get(key);
if (storageComponent == null) {
storageComponent = new StorageComponent<KeyType, ValueType>();
storage.put(key, storageComponent);
}
return storageComponent;
} | [
"public",
"StorageComponent",
"<",
"KeyType",
",",
"ValueType",
">",
"getStorageComponent",
"(",
"final",
"KeyType",
"key",
")",
"{",
"KeyToStorageComponent",
"<",
"KeyType",
",",
"ValueType",
">",
"storage",
"=",
"getkeyToStorage",
"(",
")",
";",
"StorageComponen... | Returns child StorageComponent by given key.
@param key
the key of children StorageComponent.
@return a StorageComponent object. | [
"Returns",
"child",
"StorageComponent",
"by",
"given",
"key",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/beans/StorageComponent.java#L183-L192 | train |
rFlex/SCJavaTools | src/main/java/me/corsin/javatools/reflect/ClassIndexer.java | ClassIndexer.add | public boolean add(T element, Class<?> accessibleClass) {
boolean added = false;
while (accessibleClass != null && accessibleClass != this.baseClass) {
added |= this.addSingle(element, accessibleClass);
for (Class<?> interf : accessibleClass.getInterfaces()) {
this.addSingle(element, interf);
}
accessibleClass = accessibleClass.getSuperclass();
}
return added;
} | java | public boolean add(T element, Class<?> accessibleClass) {
boolean added = false;
while (accessibleClass != null && accessibleClass != this.baseClass) {
added |= this.addSingle(element, accessibleClass);
for (Class<?> interf : accessibleClass.getInterfaces()) {
this.addSingle(element, interf);
}
accessibleClass = accessibleClass.getSuperclass();
}
return added;
} | [
"public",
"boolean",
"add",
"(",
"T",
"element",
",",
"Class",
"<",
"?",
">",
"accessibleClass",
")",
"{",
"boolean",
"added",
"=",
"false",
";",
"while",
"(",
"accessibleClass",
"!=",
"null",
"&&",
"accessibleClass",
"!=",
"this",
".",
"baseClass",
")",
... | Associate the element with accessibleClass and any of the the superclass and interfaces
of the accessibleClass until baseClass
@param element
@param accessibleClass
@return | [
"Associate",
"the",
"element",
"with",
"accessibleClass",
"and",
"any",
"of",
"the",
"the",
"superclass",
"and",
"interfaces",
"of",
"the",
"accessibleClass",
"until",
"baseClass"
] | 6bafee99f12a6ad73265db64776edac2bab71f67 | https://github.com/rFlex/SCJavaTools/blob/6bafee99f12a6ad73265db64776edac2bab71f67/src/main/java/me/corsin/javatools/reflect/ClassIndexer.java#L77-L91 | train |
rFlex/SCJavaTools | src/main/java/me/corsin/javatools/reflect/ClassIndexer.java | ClassIndexer.remove | public void remove(T element, Class<?> accessibleClass) {
while (accessibleClass != null && accessibleClass != this.baseClass) {
this.removeSingle(element, accessibleClass);
for (Class<?> interf : accessibleClass.getInterfaces()) {
this.removeSingle(element, interf);
}
accessibleClass = accessibleClass.getSuperclass();
}
} | java | public void remove(T element, Class<?> accessibleClass) {
while (accessibleClass != null && accessibleClass != this.baseClass) {
this.removeSingle(element, accessibleClass);
for (Class<?> interf : accessibleClass.getInterfaces()) {
this.removeSingle(element, interf);
}
accessibleClass = accessibleClass.getSuperclass();
}
} | [
"public",
"void",
"remove",
"(",
"T",
"element",
",",
"Class",
"<",
"?",
">",
"accessibleClass",
")",
"{",
"while",
"(",
"accessibleClass",
"!=",
"null",
"&&",
"accessibleClass",
"!=",
"this",
".",
"baseClass",
")",
"{",
"this",
".",
"removeSingle",
"(",
... | Remove the element from accessible class and any of the superclass and
interfaces of the accessibleClass until baseClass
@param element
@param accessibleClass | [
"Remove",
"the",
"element",
"from",
"accessible",
"class",
"and",
"any",
"of",
"the",
"superclass",
"and",
"interfaces",
"of",
"the",
"accessibleClass",
"until",
"baseClass"
] | 6bafee99f12a6ad73265db64776edac2bab71f67 | https://github.com/rFlex/SCJavaTools/blob/6bafee99f12a6ad73265db64776edac2bab71f67/src/main/java/me/corsin/javatools/reflect/ClassIndexer.java#L99-L109 | train |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANManager.java | IBANManager._readIBANDataFromXML | private static void _readIBANDataFromXML ()
{
final IMicroDocument aDoc = MicroReader.readMicroXML (new ClassPathResource ("codelists/iban-country-data.xml"));
if (aDoc == null)
throw new InitializationException ("Failed to read IBAN country data [1]");
if (aDoc.getDocumentElement () == null)
throw new InitializationException ("Failed to read IBAN country data [2]");
final DateTimeFormatter aDTPattern = DateTimeFormatter.ISO_DATE;
for (final IMicroElement eCountry : aDoc.getDocumentElement ().getAllChildElements (ELEMENT_COUNTRY))
{
// get descriptive string
final String sDesc = eCountry.getTextContent ();
final String sCountryCode = sDesc.substring (0, 2);
if (CountryCache.getInstance ().getCountry (sCountryCode) == null)
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("IBAN country data: no such country code '" + sCountryCode + "' - be careful");
LocalDate aValidFrom = null;
if (eCountry.hasAttribute (ATTR_VALIDFROM))
{
// Constant format, conforming to XML date
aValidFrom = PDTFromString.getLocalDateFromString (eCountry.getAttributeValue (ATTR_VALIDFROM), aDTPattern);
}
LocalDate aValidTo = null;
if (eCountry.hasAttribute (ATTR_VALIDUNTIL))
{
// Constant format, conforming to XML date
aValidTo = PDTFromString.getLocalDateFromString (eCountry.getAttributeValue (ATTR_VALIDUNTIL), aDTPattern);
}
final String sLayout = eCountry.getAttributeValue (ATTR_LAYOUT);
final String sCheckDigits = eCountry.getAttributeValue (ATTR_CHECKDIGITS);
// get expected length
final String sLen = eCountry.getAttributeValue (ATTR_LEN);
final int nExpectedLength = StringParser.parseInt (sLen, CGlobal.ILLEGAL_UINT);
if (nExpectedLength == CGlobal.ILLEGAL_UINT)
throw new InitializationException ("Failed to convert length '" + sLen + "' to int!");
if (s_aIBANData.containsKey (sCountryCode))
throw new IllegalArgumentException ("Country " + sCountryCode + " is already contained!");
s_aIBANData.put (sCountryCode,
IBANCountryData.createFromString (sCountryCode,
nExpectedLength,
sLayout,
sCheckDigits,
aValidFrom,
aValidTo,
sDesc));
}
} | java | private static void _readIBANDataFromXML ()
{
final IMicroDocument aDoc = MicroReader.readMicroXML (new ClassPathResource ("codelists/iban-country-data.xml"));
if (aDoc == null)
throw new InitializationException ("Failed to read IBAN country data [1]");
if (aDoc.getDocumentElement () == null)
throw new InitializationException ("Failed to read IBAN country data [2]");
final DateTimeFormatter aDTPattern = DateTimeFormatter.ISO_DATE;
for (final IMicroElement eCountry : aDoc.getDocumentElement ().getAllChildElements (ELEMENT_COUNTRY))
{
// get descriptive string
final String sDesc = eCountry.getTextContent ();
final String sCountryCode = sDesc.substring (0, 2);
if (CountryCache.getInstance ().getCountry (sCountryCode) == null)
if (LOGGER.isWarnEnabled ())
LOGGER.warn ("IBAN country data: no such country code '" + sCountryCode + "' - be careful");
LocalDate aValidFrom = null;
if (eCountry.hasAttribute (ATTR_VALIDFROM))
{
// Constant format, conforming to XML date
aValidFrom = PDTFromString.getLocalDateFromString (eCountry.getAttributeValue (ATTR_VALIDFROM), aDTPattern);
}
LocalDate aValidTo = null;
if (eCountry.hasAttribute (ATTR_VALIDUNTIL))
{
// Constant format, conforming to XML date
aValidTo = PDTFromString.getLocalDateFromString (eCountry.getAttributeValue (ATTR_VALIDUNTIL), aDTPattern);
}
final String sLayout = eCountry.getAttributeValue (ATTR_LAYOUT);
final String sCheckDigits = eCountry.getAttributeValue (ATTR_CHECKDIGITS);
// get expected length
final String sLen = eCountry.getAttributeValue (ATTR_LEN);
final int nExpectedLength = StringParser.parseInt (sLen, CGlobal.ILLEGAL_UINT);
if (nExpectedLength == CGlobal.ILLEGAL_UINT)
throw new InitializationException ("Failed to convert length '" + sLen + "' to int!");
if (s_aIBANData.containsKey (sCountryCode))
throw new IllegalArgumentException ("Country " + sCountryCode + " is already contained!");
s_aIBANData.put (sCountryCode,
IBANCountryData.createFromString (sCountryCode,
nExpectedLength,
sLayout,
sCheckDigits,
aValidFrom,
aValidTo,
sDesc));
}
} | [
"private",
"static",
"void",
"_readIBANDataFromXML",
"(",
")",
"{",
"final",
"IMicroDocument",
"aDoc",
"=",
"MicroReader",
".",
"readMicroXML",
"(",
"new",
"ClassPathResource",
"(",
"\"codelists/iban-country-data.xml\"",
")",
")",
";",
"if",
"(",
"aDoc",
"==",
"nu... | Read all IBAN country data from a file. | [
"Read",
"all",
"IBAN",
"country",
"data",
"from",
"a",
"file",
"."
] | ca5e0b03c735b30b47930c018bfb5e71f00d0ff4 | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANManager.java#L104-L158 | train |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANManager.java | IBANManager.getCountryData | @Nullable
public static IBANCountryData getCountryData (@Nonnull final String sCountryCode)
{
ValueEnforcer.notNull (sCountryCode, "CountryCode");
return s_aIBANData.get (sCountryCode.toUpperCase (Locale.US));
} | java | @Nullable
public static IBANCountryData getCountryData (@Nonnull final String sCountryCode)
{
ValueEnforcer.notNull (sCountryCode, "CountryCode");
return s_aIBANData.get (sCountryCode.toUpperCase (Locale.US));
} | [
"@",
"Nullable",
"public",
"static",
"IBANCountryData",
"getCountryData",
"(",
"@",
"Nonnull",
"final",
"String",
"sCountryCode",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"sCountryCode",
",",
"\"CountryCode\"",
")",
";",
"return",
"s_aIBANData",
".",
"get",... | Get the country data for the given country code.
@param sCountryCode
The country code to use. May not be <code>null</code> and needs to
have exactly 2 characters to work.
@return <code>null</code> if the passed country has no IBAN support. | [
"Get",
"the",
"country",
"data",
"for",
"the",
"given",
"country",
"code",
"."
] | ca5e0b03c735b30b47930c018bfb5e71f00d0ff4 | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANManager.java#L168-L174 | train |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANManager.java | IBANManager.unifyIBAN | @Nullable
public static String unifyIBAN (@Nullable final String sIBAN)
{
if (sIBAN == null)
return null;
// to uppercase
String sRealIBAN = sIBAN.toUpperCase (Locale.US);
// kick all non-IBAN chars
sRealIBAN = RegExHelper.stringReplacePattern ("[^0-9A-Z]", sRealIBAN, "");
if (sRealIBAN.length () < 4)
return null;
return sRealIBAN;
} | java | @Nullable
public static String unifyIBAN (@Nullable final String sIBAN)
{
if (sIBAN == null)
return null;
// to uppercase
String sRealIBAN = sIBAN.toUpperCase (Locale.US);
// kick all non-IBAN chars
sRealIBAN = RegExHelper.stringReplacePattern ("[^0-9A-Z]", sRealIBAN, "");
if (sRealIBAN.length () < 4)
return null;
return sRealIBAN;
} | [
"@",
"Nullable",
"public",
"static",
"String",
"unifyIBAN",
"(",
"@",
"Nullable",
"final",
"String",
"sIBAN",
")",
"{",
"if",
"(",
"sIBAN",
"==",
"null",
")",
"return",
"null",
";",
"// to uppercase",
"String",
"sRealIBAN",
"=",
"sIBAN",
".",
"toUpperCase",
... | Make an IBAN that can be parsed. It is converted to upper case and all
non-alphanumeric characters are removed.
@param sIBAN
The IBAN to be unified.
@return The unified string or <code>null</code> if this is no IBAN at all. | [
"Make",
"an",
"IBAN",
"that",
"can",
"be",
"parsed",
".",
"It",
"is",
"converted",
"to",
"upper",
"case",
"and",
"all",
"non",
"-",
"alphanumeric",
"characters",
"are",
"removed",
"."
] | ca5e0b03c735b30b47930c018bfb5e71f00d0ff4 | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANManager.java#L225-L240 | train |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANManager.java | IBANManager.isValidIBAN | public static boolean isValidIBAN (@Nullable final String sIBAN, final boolean bReturnCodeIfNoCountryData)
{
// kick all non-IBAN chars
final String sRealIBAN = unifyIBAN (sIBAN);
if (sRealIBAN == null)
return false;
// is the country supported?
final IBANCountryData aData = s_aIBANData.get (sRealIBAN.substring (0, 2));
if (aData == null)
return bReturnCodeIfNoCountryData;
// Does the length match the expected length?
if (aData.getExpectedLength () != sRealIBAN.length ())
return false;
// Are the checksum characters valid?
if (!_isValidChecksumChar (sRealIBAN.charAt (2)) || !_isValidChecksumChar (sRealIBAN.charAt (3)))
return false;
// Is existing checksum valid?
if (_calculateChecksum (sRealIBAN) != 1)
return false;
// Perform pattern check
if (!aData.matchesPattern (sRealIBAN))
return false;
return true;
} | java | public static boolean isValidIBAN (@Nullable final String sIBAN, final boolean bReturnCodeIfNoCountryData)
{
// kick all non-IBAN chars
final String sRealIBAN = unifyIBAN (sIBAN);
if (sRealIBAN == null)
return false;
// is the country supported?
final IBANCountryData aData = s_aIBANData.get (sRealIBAN.substring (0, 2));
if (aData == null)
return bReturnCodeIfNoCountryData;
// Does the length match the expected length?
if (aData.getExpectedLength () != sRealIBAN.length ())
return false;
// Are the checksum characters valid?
if (!_isValidChecksumChar (sRealIBAN.charAt (2)) || !_isValidChecksumChar (sRealIBAN.charAt (3)))
return false;
// Is existing checksum valid?
if (_calculateChecksum (sRealIBAN) != 1)
return false;
// Perform pattern check
if (!aData.matchesPattern (sRealIBAN))
return false;
return true;
} | [
"public",
"static",
"boolean",
"isValidIBAN",
"(",
"@",
"Nullable",
"final",
"String",
"sIBAN",
",",
"final",
"boolean",
"bReturnCodeIfNoCountryData",
")",
"{",
"// kick all non-IBAN chars",
"final",
"String",
"sRealIBAN",
"=",
"unifyIBAN",
"(",
"sIBAN",
")",
";",
... | Check if the passed IBAN is valid and the country is supported!
@param sIBAN
The IBAN number string to check.
@param bReturnCodeIfNoCountryData
The return value if no country data is present for the specified
IBAN.
@return <code>true</code> if the IBAN is valid and supported. | [
"Check",
"if",
"the",
"passed",
"IBAN",
"is",
"valid",
"and",
"the",
"country",
"is",
"supported!"
] | ca5e0b03c735b30b47930c018bfb5e71f00d0ff4 | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANManager.java#L264-L293 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java | PackageSummaryBuilder.buildContent | public void buildContent(XMLNode node, Content contentTree) {
Content packageContentTree = packageWriter.getContentHeader();
buildChildren(node, packageContentTree);
contentTree.addContent(packageContentTree);
} | java | public void buildContent(XMLNode node, Content contentTree) {
Content packageContentTree = packageWriter.getContentHeader();
buildChildren(node, packageContentTree);
contentTree.addContent(packageContentTree);
} | [
"public",
"void",
"buildContent",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"{",
"Content",
"packageContentTree",
"=",
"packageWriter",
".",
"getContentHeader",
"(",
")",
";",
"buildChildren",
"(",
"node",
",",
"packageContentTree",
")",
";",
"... | Build the content for the package doc.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the package contents
will be added | [
"Build",
"the",
"content",
"for",
"the",
"package",
"doc",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PackageSummaryBuilder.java#L138-L142 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java | JavacTaskImpl.asJavaFileObject | public JavaFileObject asJavaFileObject(File file) {
JavacFileManager fm = (JavacFileManager)context.get(JavaFileManager.class);
return fm.getRegularFile(file);
} | java | public JavaFileObject asJavaFileObject(File file) {
JavacFileManager fm = (JavacFileManager)context.get(JavaFileManager.class);
return fm.getRegularFile(file);
} | [
"public",
"JavaFileObject",
"asJavaFileObject",
"(",
"File",
"file",
")",
"{",
"JavacFileManager",
"fm",
"=",
"(",
"JavacFileManager",
")",
"context",
".",
"get",
"(",
"JavaFileManager",
".",
"class",
")",
";",
"return",
"fm",
".",
"getRegularFile",
"(",
"file... | Construct a JavaFileObject from the given file.
<p><b>TODO: this method is useless here</b></p>
@param file a file
@return a JavaFileObject from the standard file manager. | [
"Construct",
"a",
"JavaFileObject",
"from",
"the",
"given",
"file",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java#L220-L223 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java | JavacTaskImpl.parse | public Iterable<? extends CompilationUnitTree> parse() throws IOException {
try {
prepareCompiler();
List<JCCompilationUnit> units = compiler.parseFiles(fileObjects);
for (JCCompilationUnit unit: units) {
JavaFileObject file = unit.getSourceFile();
if (notYetEntered.containsKey(file))
notYetEntered.put(file, unit);
}
return units;
}
finally {
parsed = true;
if (compiler != null && compiler.log != null)
compiler.log.flush();
}
} | java | public Iterable<? extends CompilationUnitTree> parse() throws IOException {
try {
prepareCompiler();
List<JCCompilationUnit> units = compiler.parseFiles(fileObjects);
for (JCCompilationUnit unit: units) {
JavaFileObject file = unit.getSourceFile();
if (notYetEntered.containsKey(file))
notYetEntered.put(file, unit);
}
return units;
}
finally {
parsed = true;
if (compiler != null && compiler.log != null)
compiler.log.flush();
}
} | [
"public",
"Iterable",
"<",
"?",
"extends",
"CompilationUnitTree",
">",
"parse",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"prepareCompiler",
"(",
")",
";",
"List",
"<",
"JCCompilationUnit",
">",
"units",
"=",
"compiler",
".",
"parseFiles",
"(",
"fi... | Parse the specified files returning a list of abstract syntax trees.
@throws java.io.IOException TODO
@return a list of abstract syntax trees | [
"Parse",
"the",
"specified",
"files",
"returning",
"a",
"list",
"of",
"abstract",
"syntax",
"trees",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/api/JavacTaskImpl.java#L231-L247 | train |
seedstack/shed | src/main/java/org/seedstack/shed/ClassLoaders.java | ClassLoaders.findMostCompleteClassLoader | public static ClassLoader findMostCompleteClassLoader(Class<?> target) {
// Try the most complete class loader we can get
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// Then fallback to the class loader from a specific class given
if (classLoader == null && target != null) {
classLoader = target.getClassLoader();
}
// Then fallback to the class loader that loaded this class
if (classLoader == null) {
classLoader = ClassLoaders.class.getClassLoader();
}
// Then fallback to the system class loader
if (classLoader == null) {
classLoader = ClassLoader.getSystemClassLoader();
}
// Throw an exception if no classloader was found at all
if (classLoader == null) {
throw new RuntimeException("Unable to find a classloader");
}
return classLoader;
} | java | public static ClassLoader findMostCompleteClassLoader(Class<?> target) {
// Try the most complete class loader we can get
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// Then fallback to the class loader from a specific class given
if (classLoader == null && target != null) {
classLoader = target.getClassLoader();
}
// Then fallback to the class loader that loaded this class
if (classLoader == null) {
classLoader = ClassLoaders.class.getClassLoader();
}
// Then fallback to the system class loader
if (classLoader == null) {
classLoader = ClassLoader.getSystemClassLoader();
}
// Throw an exception if no classloader was found at all
if (classLoader == null) {
throw new RuntimeException("Unable to find a classloader");
}
return classLoader;
} | [
"public",
"static",
"ClassLoader",
"findMostCompleteClassLoader",
"(",
"Class",
"<",
"?",
">",
"target",
")",
"{",
"// Try the most complete class loader we can get",
"ClassLoader",
"classLoader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader"... | Find the most complete class loader by trying the current thread context class loader, then
the classloader of the
given class if any, then the class loader that loaded SEED core, then the system class loader.
@param target the class to get the class loader from if no current thread context class
loader is present. May be null.
@return the most complete class loader it found. | [
"Find",
"the",
"most",
"complete",
"class",
"loader",
"by",
"trying",
"the",
"current",
"thread",
"context",
"class",
"loader",
"then",
"the",
"classloader",
"of",
"the",
"given",
"class",
"if",
"any",
"then",
"the",
"class",
"loader",
"that",
"loaded",
"SEE... | 49ecb25aa3777539ab0f29f89abaae5ee93b572e | https://github.com/seedstack/shed/blob/49ecb25aa3777539ab0f29f89abaae5ee93b572e/src/main/java/org/seedstack/shed/ClassLoaders.java#L24-L49 | train |
brianwhu/xillium | core/src/main/java/org/xillium/core/management/ManagedComponent.java | ManagedComponent.emit | @Override
public void emit(Level level, String message, long sequence) {
if (_broadcaster != null) _broadcaster.sendNotification(new Notification(
level.toString(),
_name != null ? _name : this,
sequence,
message
));
} | java | @Override
public void emit(Level level, String message, long sequence) {
if (_broadcaster != null) _broadcaster.sendNotification(new Notification(
level.toString(),
_name != null ? _name : this,
sequence,
message
));
} | [
"@",
"Override",
"public",
"void",
"emit",
"(",
"Level",
"level",
",",
"String",
"message",
",",
"long",
"sequence",
")",
"{",
"if",
"(",
"_broadcaster",
"!=",
"null",
")",
"_broadcaster",
".",
"sendNotification",
"(",
"new",
"Notification",
"(",
"level",
... | Emits a notification through this manageable. | [
"Emits",
"a",
"notification",
"through",
"this",
"manageable",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/management/ManagedComponent.java#L117-L125 | train |
brianwhu/xillium | core/src/main/java/org/xillium/core/management/ManagedComponent.java | ManagedComponent.emit | @Override
public <T extends Throwable> T emit(T throwable, String message, long sequence) {
if (_broadcaster != null) _broadcaster.sendNotification(new Notification(
Level.WARNING.toString(),
_name != null ? _name : this,
sequence,
message == null ? Throwables.getFullMessage(throwable) : message + ": " + Throwables.getFullMessage(throwable)
));
return throwable;
} | java | @Override
public <T extends Throwable> T emit(T throwable, String message, long sequence) {
if (_broadcaster != null) _broadcaster.sendNotification(new Notification(
Level.WARNING.toString(),
_name != null ? _name : this,
sequence,
message == null ? Throwables.getFullMessage(throwable) : message + ": " + Throwables.getFullMessage(throwable)
));
return throwable;
} | [
"@",
"Override",
"public",
"<",
"T",
"extends",
"Throwable",
">",
"T",
"emit",
"(",
"T",
"throwable",
",",
"String",
"message",
",",
"long",
"sequence",
")",
"{",
"if",
"(",
"_broadcaster",
"!=",
"null",
")",
"_broadcaster",
".",
"sendNotification",
"(",
... | Emits an alert for a caught Throwable through this manageable. | [
"Emits",
"an",
"alert",
"for",
"a",
"caught",
"Throwable",
"through",
"this",
"manageable",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/management/ManagedComponent.java#L130-L139 | train |
brianwhu/xillium | core/src/main/java/org/xillium/core/management/ManagedComponent.java | ManagedComponent.emit | @Override
public void emit(Level level, String message, long sequence, Logger logger) {
emit(level, message, sequence);
logger.log(level, message);
} | java | @Override
public void emit(Level level, String message, long sequence, Logger logger) {
emit(level, message, sequence);
logger.log(level, message);
} | [
"@",
"Override",
"public",
"void",
"emit",
"(",
"Level",
"level",
",",
"String",
"message",
",",
"long",
"sequence",
",",
"Logger",
"logger",
")",
"{",
"emit",
"(",
"level",
",",
"message",
",",
"sequence",
")",
";",
"logger",
".",
"log",
"(",
"level",... | Emits a notification through this manageable, entering the notification into a logger along the way. | [
"Emits",
"a",
"notification",
"through",
"this",
"manageable",
"entering",
"the",
"notification",
"into",
"a",
"logger",
"along",
"the",
"way",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/management/ManagedComponent.java#L144-L148 | train |
brianwhu/xillium | core/src/main/java/org/xillium/core/management/ManagedComponent.java | ManagedComponent.emit | @Override
public <T extends Throwable> T emit(T throwable, String message, long sequence, Logger logger) {
message = message == null ? Throwables.getFullMessage(throwable) : message + ": " + Throwables.getFullMessage(throwable);
emit(Level.WARNING, message, sequence, logger);
return throwable;
} | java | @Override
public <T extends Throwable> T emit(T throwable, String message, long sequence, Logger logger) {
message = message == null ? Throwables.getFullMessage(throwable) : message + ": " + Throwables.getFullMessage(throwable);
emit(Level.WARNING, message, sequence, logger);
return throwable;
} | [
"@",
"Override",
"public",
"<",
"T",
"extends",
"Throwable",
">",
"T",
"emit",
"(",
"T",
"throwable",
",",
"String",
"message",
",",
"long",
"sequence",
",",
"Logger",
"logger",
")",
"{",
"message",
"=",
"message",
"==",
"null",
"?",
"Throwables",
".",
... | Emits an alert for a caught Throwable through this manageable, entering the alert into a logger along the way. | [
"Emits",
"an",
"alert",
"for",
"a",
"caught",
"Throwable",
"through",
"this",
"manageable",
"entering",
"the",
"alert",
"into",
"a",
"logger",
"along",
"the",
"way",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/management/ManagedComponent.java#L153-L158 | train |
pierre/serialization | common/src/main/java/com/ning/metrics/serialization/schema/Schema.java | Schema.getSchema | public ArrayList<SchemaField> getSchema()
{
final ArrayList<SchemaField> items = new ArrayList<SchemaField>(schemaFields.values());
Collections.sort(items, new Comparator<SchemaField>()
{
@Override
public int compare(final SchemaField left, final SchemaField right)
{
return left.getId() - right.getId();
}
});
return items;
} | java | public ArrayList<SchemaField> getSchema()
{
final ArrayList<SchemaField> items = new ArrayList<SchemaField>(schemaFields.values());
Collections.sort(items, new Comparator<SchemaField>()
{
@Override
public int compare(final SchemaField left, final SchemaField right)
{
return left.getId() - right.getId();
}
});
return items;
} | [
"public",
"ArrayList",
"<",
"SchemaField",
">",
"getSchema",
"(",
")",
"{",
"final",
"ArrayList",
"<",
"SchemaField",
">",
"items",
"=",
"new",
"ArrayList",
"<",
"SchemaField",
">",
"(",
"schemaFields",
".",
"values",
"(",
")",
")",
";",
"Collections",
"."... | Get the schema as a collection of fields.
We guarantee the ordering by field id.
@return the sorted collection of fields | [
"Get",
"the",
"schema",
"as",
"a",
"collection",
"of",
"fields",
".",
"We",
"guarantee",
"the",
"ordering",
"by",
"field",
"id",
"."
] | b15b7c749ba78bfe94dce8fc22f31b30b2e6830b | https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/common/src/main/java/com/ning/metrics/serialization/schema/Schema.java#L73-L87 | train |
brianwhu/xillium | core/src/main/java/org/xillium/core/PlatformControl.java | PlatformControl.bind | PlatformControl bind(ServicePlatform p, XmlWebApplicationContext c, ClassLoader l) {
_platform = p;
_root = c;
_cloader = l;
return this;
} | java | PlatformControl bind(ServicePlatform p, XmlWebApplicationContext c, ClassLoader l) {
_platform = p;
_root = c;
_cloader = l;
return this;
} | [
"PlatformControl",
"bind",
"(",
"ServicePlatform",
"p",
",",
"XmlWebApplicationContext",
"c",
",",
"ClassLoader",
"l",
")",
"{",
"_platform",
"=",
"p",
";",
"_root",
"=",
"c",
";",
"_cloader",
"=",
"l",
";",
"return",
"this",
";",
"}"
] | To be called by ServicePlatform when detected in the top-level application context. | [
"To",
"be",
"called",
"by",
"ServicePlatform",
"when",
"detected",
"in",
"the",
"top",
"-",
"level",
"application",
"context",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/PlatformControl.java#L23-L28 | train |
arakelian/more-commons | src/main/java/com/arakelian/core/utils/MediaTypeUtils.java | MediaTypeUtils.isSafeMediaType | public static boolean isSafeMediaType(final String mediaType) {
return mediaType != null && VALID_MIME_TYPE.matcher(mediaType).matches()
&& !DANGEROUS_MEDIA_TYPES.contains(mediaType);
} | java | public static boolean isSafeMediaType(final String mediaType) {
return mediaType != null && VALID_MIME_TYPE.matcher(mediaType).matches()
&& !DANGEROUS_MEDIA_TYPES.contains(mediaType);
} | [
"public",
"static",
"boolean",
"isSafeMediaType",
"(",
"final",
"String",
"mediaType",
")",
"{",
"return",
"mediaType",
"!=",
"null",
"&&",
"VALID_MIME_TYPE",
".",
"matcher",
"(",
"mediaType",
")",
".",
"matches",
"(",
")",
"&&",
"!",
"DANGEROUS_MEDIA_TYPES",
... | Returns true if the given string is a valid media type
@param mediaType
media type
@return true if given string is a valid media type | [
"Returns",
"true",
"if",
"the",
"given",
"string",
"is",
"a",
"valid",
"media",
"type"
] | 83c607044f64a7f6c005a67866c0ef7cb68d6e29 | https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/MediaTypeUtils.java#L273-L276 | train |
tomgibara/streams | src/main/java/com/tomgibara/streams/StreamBytes.java | StreamBytes.writeStream | public WriteStream writeStream() {
detachReader();
if (writer == null) {
writer = new BytesWriteStream(bytes, maxCapacity);
}
return writer;
} | java | public WriteStream writeStream() {
detachReader();
if (writer == null) {
writer = new BytesWriteStream(bytes, maxCapacity);
}
return writer;
} | [
"public",
"WriteStream",
"writeStream",
"(",
")",
"{",
"detachReader",
"(",
")",
";",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"writer",
"=",
"new",
"BytesWriteStream",
"(",
"bytes",
",",
"maxCapacity",
")",
";",
"}",
"return",
"writer",
";",
"}"
] | Attaches a writer to the object. If there is already an attached writer,
the existing writer is returned. If a reader is attached to the object
when this method is called, the reader is closed and immediately detached
before a writer is created.
@return the writer attached to this object | [
"Attaches",
"a",
"writer",
"to",
"the",
"object",
".",
"If",
"there",
"is",
"already",
"an",
"attached",
"writer",
"the",
"existing",
"writer",
"is",
"returned",
".",
"If",
"a",
"reader",
"is",
"attached",
"to",
"the",
"object",
"when",
"this",
"method",
... | 553dc97293a1f1fd2d88e08d26e19369e9ffa6d3 | https://github.com/tomgibara/streams/blob/553dc97293a1f1fd2d88e08d26e19369e9ffa6d3/src/main/java/com/tomgibara/streams/StreamBytes.java#L108-L114 | train |
tomgibara/streams | src/main/java/com/tomgibara/streams/StreamBytes.java | StreamBytes.readStream | public ReadStream readStream() {
detachWriter();
if (reader == null) {
reader = new BytesReadStream(bytes, 0, length);
}
return reader;
} | java | public ReadStream readStream() {
detachWriter();
if (reader == null) {
reader = new BytesReadStream(bytes, 0, length);
}
return reader;
} | [
"public",
"ReadStream",
"readStream",
"(",
")",
"{",
"detachWriter",
"(",
")",
";",
"if",
"(",
"reader",
"==",
"null",
")",
"{",
"reader",
"=",
"new",
"BytesReadStream",
"(",
"bytes",
",",
"0",
",",
"length",
")",
";",
"}",
"return",
"reader",
";",
"... | Attaches a reader to the object. If there is already any attached reader,
the existing reader is returned. If a writer is attached to the object
when this method is called, the writer is closed and immediately detached
before the reader is created.
@return the reader attached to this object | [
"Attaches",
"a",
"reader",
"to",
"the",
"object",
".",
"If",
"there",
"is",
"already",
"any",
"attached",
"reader",
"the",
"existing",
"reader",
"is",
"returned",
".",
"If",
"a",
"writer",
"is",
"attached",
"to",
"the",
"object",
"when",
"this",
"method",
... | 553dc97293a1f1fd2d88e08d26e19369e9ffa6d3 | https://github.com/tomgibara/streams/blob/553dc97293a1f1fd2d88e08d26e19369e9ffa6d3/src/main/java/com/tomgibara/streams/StreamBytes.java#L125-L131 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/provider/newrelic/EntityCache.java | EntityCache.add | public void add(Collection<Entity> entities)
{
for(Entity entity : entities)
this.entities.put(entity.getId(), entity);
} | java | public void add(Collection<Entity> entities)
{
for(Entity entity : entities)
this.entities.put(entity.getId(), entity);
} | [
"public",
"void",
"add",
"(",
"Collection",
"<",
"Entity",
">",
"entities",
")",
"{",
"for",
"(",
"Entity",
"entity",
":",
"entities",
")",
"this",
".",
"entities",
".",
"put",
"(",
"entity",
".",
"getId",
"(",
")",
",",
"entity",
")",
";",
"}"
] | Adds the entity list to the entities for the account.
@param entities The entities to add | [
"Adds",
"the",
"entity",
"list",
"to",
"the",
"entities",
"for",
"the",
"account",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/EntityCache.java#L55-L59 | train |
sbang/jsr330activator | jsr330activator.mocks/src/main/java/no/steria/osgi/mocks/MockBundle.java | MockBundle.loadClass | @Override
public Class<?> loadClass(String classname) throws ClassNotFoundException {
return getClass().getClassLoader().loadClass(classname);
} | java | @Override
public Class<?> loadClass(String classname) throws ClassNotFoundException {
return getClass().getClassLoader().loadClass(classname);
} | [
"@",
"Override",
"public",
"Class",
"<",
"?",
">",
"loadClass",
"(",
"String",
"classname",
")",
"throws",
"ClassNotFoundException",
"{",
"return",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"loadClass",
"(",
"classname",
")",
";",
"}"
] | Get the class loader of the mock, rather than that of the bundle. | [
"Get",
"the",
"class",
"loader",
"of",
"the",
"mock",
"rather",
"than",
"that",
"of",
"the",
"bundle",
"."
] | a9e106db3242f1bfcf76ec391b5a3026679b9645 | https://github.com/sbang/jsr330activator/blob/a9e106db3242f1bfcf76ec391b5a3026679b9645/jsr330activator.mocks/src/main/java/no/steria/osgi/mocks/MockBundle.java#L43-L46 | train |
pierre/serialization | hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/SmileStorage.java | SmileStorage.getSchema | @Override
public ResourceSchema getSchema(final String location, final Job job) throws IOException
{
final List<Schema.FieldSchema> schemaList = new ArrayList<Schema.FieldSchema>();
for (final GoodwillSchemaField field : schema.getSchema()) {
schemaList.add(new Schema.FieldSchema(field.getName(), getPigType(field.getType())));
}
return new ResourceSchema(new Schema(schemaList));
} | java | @Override
public ResourceSchema getSchema(final String location, final Job job) throws IOException
{
final List<Schema.FieldSchema> schemaList = new ArrayList<Schema.FieldSchema>();
for (final GoodwillSchemaField field : schema.getSchema()) {
schemaList.add(new Schema.FieldSchema(field.getName(), getPigType(field.getType())));
}
return new ResourceSchema(new Schema(schemaList));
} | [
"@",
"Override",
"public",
"ResourceSchema",
"getSchema",
"(",
"final",
"String",
"location",
",",
"final",
"Job",
"job",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
"Schema",
".",
"FieldSchema",
">",
"schemaList",
"=",
"new",
"ArrayList",
"<",
... | Get a schema for the data to be loaded.
@param location Location as returned by
{@link org.apache.pig.LoadFunc#relativeToAbsolutePath(String, org.apache.hadoop.fs.Path)}
@param job The {@link org.apache.hadoop.mapreduce.Job} object - this should be used only to obtain
cluster properties through {@link org.apache.hadoop.mapreduce.Job#getConfiguration()} and not to set/query
any runtime job information.
@return schema for the data to be loaded. This schema should represent
all tuples of the returned data. If the schema is unknown or it is
not possible to return a schema that represents all returned data,
then null should be returned. The schema should not be affected by pushProjection, ie.
getSchema should always return the original schema even after pushProjection
@throws java.io.IOException if an exception occurs while determining the schema | [
"Get",
"a",
"schema",
"for",
"the",
"data",
"to",
"be",
"loaded",
"."
] | b15b7c749ba78bfe94dce8fc22f31b30b2e6830b | https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/hadoop/src/main/java/com/ning/metrics/serialization/hadoop/pig/SmileStorage.java#L264-L273 | train |
lightblueseas/jcommons-lang | src/main/java/de/alpharogroup/config/ConfigurationExtensions.java | ConfigurationExtensions.getUserApplicationConfigurationFilePath | public static String getUserApplicationConfigurationFilePath(
@NonNull final String applicationName, @NonNull final String configFileName)
{
return System.getProperty(USER_HOME_PROPERTY_KEY) + File.separator + applicationName
+ File.separator + configFileName;
} | java | public static String getUserApplicationConfigurationFilePath(
@NonNull final String applicationName, @NonNull final String configFileName)
{
return System.getProperty(USER_HOME_PROPERTY_KEY) + File.separator + applicationName
+ File.separator + configFileName;
} | [
"public",
"static",
"String",
"getUserApplicationConfigurationFilePath",
"(",
"@",
"NonNull",
"final",
"String",
"applicationName",
",",
"@",
"NonNull",
"final",
"String",
"configFileName",
")",
"{",
"return",
"System",
".",
"getProperty",
"(",
"USER_HOME_PROPERTY_KEY",... | Gets the user application configuration file path.
@param applicationName
the application name
@param configFileName
the config file name
@return the user application configuration file path | [
"Gets",
"the",
"user",
"application",
"configuration",
"file",
"path",
"."
] | 000e1f198e949ec3e721fd0fc3f5946e945232a3 | https://github.com/lightblueseas/jcommons-lang/blob/000e1f198e949ec3e721fd0fc3f5946e945232a3/src/main/java/de/alpharogroup/config/ConfigurationExtensions.java#L52-L57 | train |
lightblueseas/jcommons-lang | src/main/java/de/alpharogroup/config/ConfigurationExtensions.java | ConfigurationExtensions.getTemporaryApplicationConfigurationFilePath | public static String getTemporaryApplicationConfigurationFilePath(
@NonNull final String applicationName, @NonNull final String fileName)
{
return System.getProperty(JAVA_IO_TPMDIR_PROPERTY_KEY) + File.separator + applicationName
+ File.separator + fileName;
} | java | public static String getTemporaryApplicationConfigurationFilePath(
@NonNull final String applicationName, @NonNull final String fileName)
{
return System.getProperty(JAVA_IO_TPMDIR_PROPERTY_KEY) + File.separator + applicationName
+ File.separator + fileName;
} | [
"public",
"static",
"String",
"getTemporaryApplicationConfigurationFilePath",
"(",
"@",
"NonNull",
"final",
"String",
"applicationName",
",",
"@",
"NonNull",
"final",
"String",
"fileName",
")",
"{",
"return",
"System",
".",
"getProperty",
"(",
"JAVA_IO_TPMDIR_PROPERTY_K... | Gets the specific temporary directory path for from the given arguments. It is indeded for
any application temporary files
@param applicationName
the application name
@param fileName
the file name
@return the specific temporary directory path from the given arguments | [
"Gets",
"the",
"specific",
"temporary",
"directory",
"path",
"for",
"from",
"the",
"given",
"arguments",
".",
"It",
"is",
"indeded",
"for",
"any",
"application",
"temporary",
"files"
] | 000e1f198e949ec3e721fd0fc3f5946e945232a3 | https://github.com/lightblueseas/jcommons-lang/blob/000e1f198e949ec3e721fd0fc3f5946e945232a3/src/main/java/de/alpharogroup/config/ConfigurationExtensions.java#L69-L74 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/ClassUtils.java | ClassUtils.instantiateClass | public static <T> T instantiateClass(final Class<T> clazz) throws IllegalArgumentException,
BeanInstantiationException {
return instantiateClass(clazz, MethodUtils.EMPTY_PARAMETER_CLASSTYPES,
MethodUtils.EMPTY_PARAMETER_VALUES);
} | java | public static <T> T instantiateClass(final Class<T> clazz) throws IllegalArgumentException,
BeanInstantiationException {
return instantiateClass(clazz, MethodUtils.EMPTY_PARAMETER_CLASSTYPES,
MethodUtils.EMPTY_PARAMETER_VALUES);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"instantiateClass",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"IllegalArgumentException",
",",
"BeanInstantiationException",
"{",
"return",
"instantiateClass",
"(",
"clazz",
",",
"MethodUtils",
".",
"EM... | Create and initialize a new instance of the given class by default
constructor.
@param clazz can not be null.
@return a newly allocated instance of the class represented by this class.
@throws IllegalArgumentException if given class is null.
@throws BeanInstantiationException if given class no default constructor
found. | [
"Create",
"and",
"initialize",
"a",
"new",
"instance",
"of",
"the",
"given",
"class",
"by",
"default",
"constructor",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/ClassUtils.java#L180-L185 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.