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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
apruve/apruve-java | src/main/java/com/apruve/models/SubscriptionAdjustment.java | SubscriptionAdjustment.get | public static ApruveResponse<SubscriptionAdjustment> get(
String subscriptionId, String adjustmentId) {
return ApruveClient.getInstance().get(
getSubscriptionAdjustmentsPath(subscriptionId) + adjustmentId,
SubscriptionAdjustment.class);
} | java | public static ApruveResponse<SubscriptionAdjustment> get(
String subscriptionId, String adjustmentId) {
return ApruveClient.getInstance().get(
getSubscriptionAdjustmentsPath(subscriptionId) + adjustmentId,
SubscriptionAdjustment.class);
} | [
"public",
"static",
"ApruveResponse",
"<",
"SubscriptionAdjustment",
">",
"get",
"(",
"String",
"subscriptionId",
",",
"String",
"adjustmentId",
")",
"{",
"return",
"ApruveClient",
".",
"getInstance",
"(",
")",
".",
"get",
"(",
"getSubscriptionAdjustmentsPath",
"(",... | Get the SubscriptionAdjustment with the given ID
@param subscriptionId
The ID of the {@link Subscription} that owns the
SubscriptionAdjustment
@param adjustmentId
The ID of the SubscriptionAdjustment
@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",
"SubscriptionAdjustment",
"with",
"the",
"given",
"ID"
] | b188d6b17f777823c2e46427847318849978685e | https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/SubscriptionAdjustment.java#L88-L93 | train |
apruve/apruve-java | src/main/java/com/apruve/models/SubscriptionAdjustment.java | SubscriptionAdjustment.getAllAdjustments | public static ApruveResponse<List<SubscriptionAdjustment>> getAllAdjustments(
String subscriptionId) {
return ApruveClient.getInstance().index(
getSubscriptionAdjustmentsPath(subscriptionId),
new GenericType<List<SubscriptionAdjustment>>() {
});
} | java | public static ApruveResponse<List<SubscriptionAdjustment>> getAllAdjustments(
String subscriptionId) {
return ApruveClient.getInstance().index(
getSubscriptionAdjustmentsPath(subscriptionId),
new GenericType<List<SubscriptionAdjustment>>() {
});
} | [
"public",
"static",
"ApruveResponse",
"<",
"List",
"<",
"SubscriptionAdjustment",
">",
">",
"getAllAdjustments",
"(",
"String",
"subscriptionId",
")",
"{",
"return",
"ApruveClient",
".",
"getInstance",
"(",
")",
".",
"index",
"(",
"getSubscriptionAdjustmentsPath",
"... | Get all SubscriptionAdjustments for the specified Subscription.
@param subscriptionId
The ID of the {@link Subscription} that owns the
SubscriptionAdjustment
@see <a
href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a>
@return List of SubscriptionAdjustment | [
"Get",
"all",
"SubscriptionAdjustments",
"for",
"the",
"specified",
"Subscription",
"."
] | b188d6b17f777823c2e46427847318849978685e | https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/SubscriptionAdjustment.java#L106-L112 | train |
apruve/apruve-java | src/main/java/com/apruve/models/SubscriptionAdjustment.java | SubscriptionAdjustment.create | public ApruveResponse<SubscriptionAdjustmentCreateResponse> create(
String subscriptionId) {
return ApruveClient.getInstance().post(
getSubscriptionAdjustmentsPath(subscriptionId), this,
SubscriptionAdjustmentCreateResponse.class);
} | java | public ApruveResponse<SubscriptionAdjustmentCreateResponse> create(
String subscriptionId) {
return ApruveClient.getInstance().post(
getSubscriptionAdjustmentsPath(subscriptionId), this,
SubscriptionAdjustmentCreateResponse.class);
} | [
"public",
"ApruveResponse",
"<",
"SubscriptionAdjustmentCreateResponse",
">",
"create",
"(",
"String",
"subscriptionId",
")",
"{",
"return",
"ApruveClient",
".",
"getInstance",
"(",
")",
".",
"post",
"(",
"getSubscriptionAdjustmentsPath",
"(",
"subscriptionId",
")",
"... | Create this SubscriptionAdjustment on the Apruve servers.
@param subscriptionId
The ID of the {@link Subscription} that will own the
SubscriptionAdjustment
@see <a
href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a>
@return {@link SubscriptionAdjustmentCreateResponse} | [
"Create",
"this",
"SubscriptionAdjustment",
"on",
"the",
"Apruve",
"servers",
"."
] | b188d6b17f777823c2e46427847318849978685e | https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/SubscriptionAdjustment.java#L125-L130 | train |
apruve/apruve-java | src/main/java/com/apruve/models/SubscriptionAdjustment.java | SubscriptionAdjustment.delete | public static ApruveResponse<SubscriptionAdjustmentDeleteResponse> delete(
String subscriptionId, String adjustmentId) {
return ApruveClient.getInstance().delete(
getSubscriptionAdjustmentsPath(subscriptionId) + adjustmentId,
SubscriptionAdjustmentDeleteResponse.class);
} | java | public static ApruveResponse<SubscriptionAdjustmentDeleteResponse> delete(
String subscriptionId, String adjustmentId) {
return ApruveClient.getInstance().delete(
getSubscriptionAdjustmentsPath(subscriptionId) + adjustmentId,
SubscriptionAdjustmentDeleteResponse.class);
} | [
"public",
"static",
"ApruveResponse",
"<",
"SubscriptionAdjustmentDeleteResponse",
">",
"delete",
"(",
"String",
"subscriptionId",
",",
"String",
"adjustmentId",
")",
"{",
"return",
"ApruveClient",
".",
"getInstance",
"(",
")",
".",
"delete",
"(",
"getSubscriptionAdju... | Delete the specified SubscriptionAdjustment from the Apruve servers. This
is only allowed for SubscriptionAdjustments that are not in APPLIED
status.
@param subscriptionId
The ID of the {@link Subscription} that will own the
SubscriptionAdjustment
@param adjustmentId
The ID of the SubscriptionAdjustment to delete
@return {@link SubscriptionAdjustmentDeleteResponse} | [
"Delete",
"the",
"specified",
"SubscriptionAdjustment",
"from",
"the",
"Apruve",
"servers",
".",
"This",
"is",
"only",
"allowed",
"for",
"SubscriptionAdjustments",
"that",
"are",
"not",
"in",
"APPLIED",
"status",
"."
] | b188d6b17f777823c2e46427847318849978685e | https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/SubscriptionAdjustment.java#L145-L150 | train |
seedstack/shed | src/main/java/org/seedstack/shed/text/TextWrapper.java | TextWrapper.wrap | public String wrap(String text) {
StringBuilder sb = new StringBuilder();
int continuationLength = continuation.length();
int currentPosition = 0;
for (String word : text.split(" ")) {
String lastWord;
int wordLength = word.length();
if (currentPosition + wordLength <= width) {
if (currentPosition != 0) {
sb.append(" ");
currentPosition += 1;
}
sb.append(lastWord = word);
currentPosition += wordLength;
} else {
if (currentPosition > 0) {
sb.append(LINE_SEPARATOR);
currentPosition = 0;
}
if (wordLength > width && strict) {
int i = 0;
while (i + width < wordLength) {
sb.append(word.substring(i, width - continuationLength)).append(continuation)
.append(LINE_SEPARATOR);
i += width - continuationLength;
}
String endOfWord = word.substring(i);
sb.append(lastWord = endOfWord);
currentPosition = endOfWord.length();
} else {
sb.append(lastWord = word);
currentPosition += wordLength;
}
}
int lastNewLine = lastWord.lastIndexOf("\n");
if (lastNewLine != -1) {
currentPosition = lastWord.length() - lastNewLine;
}
}
return sb.toString();
} | java | public String wrap(String text) {
StringBuilder sb = new StringBuilder();
int continuationLength = continuation.length();
int currentPosition = 0;
for (String word : text.split(" ")) {
String lastWord;
int wordLength = word.length();
if (currentPosition + wordLength <= width) {
if (currentPosition != 0) {
sb.append(" ");
currentPosition += 1;
}
sb.append(lastWord = word);
currentPosition += wordLength;
} else {
if (currentPosition > 0) {
sb.append(LINE_SEPARATOR);
currentPosition = 0;
}
if (wordLength > width && strict) {
int i = 0;
while (i + width < wordLength) {
sb.append(word.substring(i, width - continuationLength)).append(continuation)
.append(LINE_SEPARATOR);
i += width - continuationLength;
}
String endOfWord = word.substring(i);
sb.append(lastWord = endOfWord);
currentPosition = endOfWord.length();
} else {
sb.append(lastWord = word);
currentPosition += wordLength;
}
}
int lastNewLine = lastWord.lastIndexOf("\n");
if (lastNewLine != -1) {
currentPosition = lastWord.length() - lastNewLine;
}
}
return sb.toString();
} | [
"public",
"String",
"wrap",
"(",
"String",
"text",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"continuationLength",
"=",
"continuation",
".",
"length",
"(",
")",
";",
"int",
"currentPosition",
"=",
"0",
";",
"for",
... | Wrap the specified text.
@param text the text to wrap.
@return the wrapped text. | [
"Wrap",
"the",
"specified",
"text",
"."
] | 49ecb25aa3777539ab0f29f89abaae5ee93b572e | https://github.com/seedstack/shed/blob/49ecb25aa3777539ab0f29f89abaae5ee93b572e/src/main/java/org/seedstack/shed/text/TextWrapper.java#L70-L116 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/processing/JavacMessager.java | JavacMessager.printMessage | public void printMessage(Diagnostic.Kind kind, CharSequence msg,
Element e, AnnotationMirror a, AnnotationValue v) {
JavaFileObject oldSource = null;
JavaFileObject newSource = null;
JCDiagnostic.DiagnosticPosition pos = null;
JavacElements elemUtils = processingEnv.getElementUtils();
Pair<JCTree, JCCompilationUnit> treeTop = elemUtils.getTreeAndTopLevel(e, a, v);
if (treeTop != null) {
newSource = treeTop.snd.sourcefile;
if (newSource != null) {
// save the old version and reinstate it later
oldSource = log.useSource(newSource);
pos = treeTop.fst.pos();
}
}
try {
switch (kind) {
case ERROR:
errorCount++;
boolean prev = log.multipleErrors;
log.multipleErrors = true;
try {
log.error(pos, "proc.messager", msg.toString());
} finally {
log.multipleErrors = prev;
}
break;
case WARNING:
warningCount++;
log.warning(pos, "proc.messager", msg.toString());
break;
case MANDATORY_WARNING:
warningCount++;
log.mandatoryWarning(pos, "proc.messager", msg.toString());
break;
default:
log.note(pos, "proc.messager", msg.toString());
break;
}
} finally {
// reinstate the saved version, only if it was saved earlier
if (newSource != null)
log.useSource(oldSource);
}
} | java | public void printMessage(Diagnostic.Kind kind, CharSequence msg,
Element e, AnnotationMirror a, AnnotationValue v) {
JavaFileObject oldSource = null;
JavaFileObject newSource = null;
JCDiagnostic.DiagnosticPosition pos = null;
JavacElements elemUtils = processingEnv.getElementUtils();
Pair<JCTree, JCCompilationUnit> treeTop = elemUtils.getTreeAndTopLevel(e, a, v);
if (treeTop != null) {
newSource = treeTop.snd.sourcefile;
if (newSource != null) {
// save the old version and reinstate it later
oldSource = log.useSource(newSource);
pos = treeTop.fst.pos();
}
}
try {
switch (kind) {
case ERROR:
errorCount++;
boolean prev = log.multipleErrors;
log.multipleErrors = true;
try {
log.error(pos, "proc.messager", msg.toString());
} finally {
log.multipleErrors = prev;
}
break;
case WARNING:
warningCount++;
log.warning(pos, "proc.messager", msg.toString());
break;
case MANDATORY_WARNING:
warningCount++;
log.mandatoryWarning(pos, "proc.messager", msg.toString());
break;
default:
log.note(pos, "proc.messager", msg.toString());
break;
}
} finally {
// reinstate the saved version, only if it was saved earlier
if (newSource != null)
log.useSource(oldSource);
}
} | [
"public",
"void",
"printMessage",
"(",
"Diagnostic",
".",
"Kind",
"kind",
",",
"CharSequence",
"msg",
",",
"Element",
"e",
",",
"AnnotationMirror",
"a",
",",
"AnnotationValue",
"v",
")",
"{",
"JavaFileObject",
"oldSource",
"=",
"null",
";",
"JavaFileObject",
"... | Prints a message of the specified kind at the location of the
annotation value inside the annotation mirror of the annotated
element.
@param kind the kind of message
@param msg the message, or an empty string if none
@param e the annotated element
@param a the annotation containing the annotaiton value
@param v the annotation value to use as a position hint | [
"Prints",
"a",
"message",
"of",
"the",
"specified",
"kind",
"at",
"the",
"location",
"of",
"the",
"annotation",
"value",
"inside",
"the",
"annotation",
"mirror",
"of",
"the",
"annotated",
"element",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/processing/JavacMessager.java#L92-L139 | train |
base2Services/kagura | shared/reporting-core/src/main/java/com/base2/kagura/core/report/freemarker/WhereContext.java | WhereContext.addWhereClause | public void addWhereClause(FreemarkerWhereClause freemarkerWhereClause) {
String outputBody = freemarkerWhereClause.getOutputBody();
if (StringUtils.isNotBlank(outputBody))
freemarkerWhereClauses.add(outputBody);
} | java | public void addWhereClause(FreemarkerWhereClause freemarkerWhereClause) {
String outputBody = freemarkerWhereClause.getOutputBody();
if (StringUtils.isNotBlank(outputBody))
freemarkerWhereClauses.add(outputBody);
} | [
"public",
"void",
"addWhereClause",
"(",
"FreemarkerWhereClause",
"freemarkerWhereClause",
")",
"{",
"String",
"outputBody",
"=",
"freemarkerWhereClause",
".",
"getOutputBody",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"outputBody",
")",
")",
... | Adds a where clause to the current context. Only performed on where clauses which are rendered.
@param freemarkerWhereClause | [
"Adds",
"a",
"where",
"clause",
"to",
"the",
"current",
"context",
".",
"Only",
"performed",
"on",
"where",
"clauses",
"which",
"are",
"rendered",
"."
] | 5564aa71bfa2cb3baaae2eb098c6c673dd4e82ee | https://github.com/base2Services/kagura/blob/5564aa71bfa2cb3baaae2eb098c6c673dd4e82ee/shared/reporting-core/src/main/java/com/base2/kagura/core/report/freemarker/WhereContext.java#L46-L50 | train |
rFlex/SCJavaTools | src/main/java/me/corsin/javatools/reflect/ReflectionUtils.java | ReflectionUtils.invoke | public static Object invoke(Object object, String methodName, Object ... parameters) {
Method method = getMethodThatMatchesParameters(object.getClass(), methodName, parameters);
if (method != null) {
try {
return method.invoke(object, parameters);
} catch (IllegalAccessException e) {
throw new RuntimeException("Unable to invoke method", e);
} catch (IllegalArgumentException e) {
throw new RuntimeException("Unable to invoke method", e);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof RuntimeException) {
throw (RuntimeException)e.getCause();
}
throw new RuntimeException(e.getCause());
}
} else {
throw new RuntimeException("No method that matches [" + methodName + "] for class " + object.getClass().getSimpleName());
}
} | java | public static Object invoke(Object object, String methodName, Object ... parameters) {
Method method = getMethodThatMatchesParameters(object.getClass(), methodName, parameters);
if (method != null) {
try {
return method.invoke(object, parameters);
} catch (IllegalAccessException e) {
throw new RuntimeException("Unable to invoke method", e);
} catch (IllegalArgumentException e) {
throw new RuntimeException("Unable to invoke method", e);
} catch (InvocationTargetException e) {
if (e.getCause() instanceof RuntimeException) {
throw (RuntimeException)e.getCause();
}
throw new RuntimeException(e.getCause());
}
} else {
throw new RuntimeException("No method that matches [" + methodName + "] for class " + object.getClass().getSimpleName());
}
} | [
"public",
"static",
"Object",
"invoke",
"(",
"Object",
"object",
",",
"String",
"methodName",
",",
"Object",
"...",
"parameters",
")",
"{",
"Method",
"method",
"=",
"getMethodThatMatchesParameters",
"(",
"object",
".",
"getClass",
"(",
")",
",",
"methodName",
... | Silently invoke the specified methodName using reflection.
@param object
@param methodName
@param parameters
@return true if the invoke was successful | [
"Silently",
"invoke",
"the",
"specified",
"methodName",
"using",
"reflection",
"."
] | 6bafee99f12a6ad73265db64776edac2bab71f67 | https://github.com/rFlex/SCJavaTools/blob/6bafee99f12a6ad73265db64776edac2bab71f67/src/main/java/me/corsin/javatools/reflect/ReflectionUtils.java#L196-L216 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/documents/OutputFileWriter.java | OutputFileWriter.getContents | public byte[] getContents(FileColumn[] columns, List<String[]> lines)
throws IOException
{
byte[] ret;
// Excel spreadsheet
if(format.isExcel())
{
ret = getExcelOutput(columns, lines);
}
else // Assume it's a CSV file
{
ret = getCSVOutput(lines);
}
return ret;
} | java | public byte[] getContents(FileColumn[] columns, List<String[]> lines)
throws IOException
{
byte[] ret;
// Excel spreadsheet
if(format.isExcel())
{
ret = getExcelOutput(columns, lines);
}
else // Assume it's a CSV file
{
ret = getCSVOutput(lines);
}
return ret;
} | [
"public",
"byte",
"[",
"]",
"getContents",
"(",
"FileColumn",
"[",
"]",
"columns",
",",
"List",
"<",
"String",
"[",
"]",
">",
"lines",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"ret",
";",
"// Excel spreadsheet",
"if",
"(",
"format",
".",
"i... | Returns the formatted output file contents.
@param columns The column definitions for the output file
@param lines The lines to add to the output file
@return The formatted output file contents
@throws IOException if the file cannot be opened | [
"Returns",
"the",
"formatted",
"output",
"file",
"contents",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/OutputFileWriter.java#L202-L218 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/documents/OutputFileWriter.java | OutputFileWriter.getCSVOutput | private byte[] getCSVOutput(List<String[]> lines)
{
StringWriter writer = new StringWriter();
csv = new CSVWriter(writer, delimiter.separator().charAt(0));
for(int i = 0; i < lines.size(); i++)
{
csv.writeNext((String[])lines.get(i), quotes);
}
// The contents returned is the CSV string
return writer.toString().getBytes();
} | java | private byte[] getCSVOutput(List<String[]> lines)
{
StringWriter writer = new StringWriter();
csv = new CSVWriter(writer, delimiter.separator().charAt(0));
for(int i = 0; i < lines.size(); i++)
{
csv.writeNext((String[])lines.get(i), quotes);
}
// The contents returned is the CSV string
return writer.toString().getBytes();
} | [
"private",
"byte",
"[",
"]",
"getCSVOutput",
"(",
"List",
"<",
"String",
"[",
"]",
">",
"lines",
")",
"{",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"csv",
"=",
"new",
"CSVWriter",
"(",
"writer",
",",
"delimiter",
".",
"separ... | Returns the CSV output file data.
@param lines The lines to add to the output file
@return The byte array representing the CSV output file data | [
"Returns",
"the",
"CSV",
"output",
"file",
"data",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/OutputFileWriter.java#L225-L236 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/documents/OutputFileWriter.java | OutputFileWriter.getExcelOutput | private byte[] getExcelOutput(FileColumn[] columns, List<String[]> lines) throws IOException
{
// Create the workbook
baos = new ByteArrayOutputStream(1024);
if(existing != null)
workbook = Workbook.createWorkbook(format, baos, existing);
else
workbook = Workbook.createWorkbook(format, baos);
workbook.setHeaders(hasHeaders());
if(append && workbook.getSheet(worksheet) != null)
workbook.appendToSheet(columns, lines, worksheet);
else
workbook.createSheet(columns, lines, worksheet);
// Write out the workbook to the stream
workbook.write();
workbook.close();
// The contents returned is the byte array
return baos.toByteArray();
} | java | private byte[] getExcelOutput(FileColumn[] columns, List<String[]> lines) throws IOException
{
// Create the workbook
baos = new ByteArrayOutputStream(1024);
if(existing != null)
workbook = Workbook.createWorkbook(format, baos, existing);
else
workbook = Workbook.createWorkbook(format, baos);
workbook.setHeaders(hasHeaders());
if(append && workbook.getSheet(worksheet) != null)
workbook.appendToSheet(columns, lines, worksheet);
else
workbook.createSheet(columns, lines, worksheet);
// Write out the workbook to the stream
workbook.write();
workbook.close();
// The contents returned is the byte array
return baos.toByteArray();
} | [
"private",
"byte",
"[",
"]",
"getExcelOutput",
"(",
"FileColumn",
"[",
"]",
"columns",
",",
"List",
"<",
"String",
"[",
"]",
">",
"lines",
")",
"throws",
"IOException",
"{",
"// Create the workbook",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
"1024",
... | Returns the XLS or XLSX output file data.
@param columns The column definitions for the output file
@param lines The lines to add to the output file
@return The XLS or XLSX output file data | [
"Returns",
"the",
"XLS",
"or",
"XLSX",
"output",
"file",
"data",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/OutputFileWriter.java#L244-L266 | train |
magik6k/JWWF | src/main/java/net/magik6k/jwwf/core/MainFrame.java | MainFrame.put | public MainFrame put(Widget widget) {
widget.addTo(user);
content = widget != null ? widget.getID() : -1;
this.sendElement();
return this;
} | java | public MainFrame put(Widget widget) {
widget.addTo(user);
content = widget != null ? widget.getID() : -1;
this.sendElement();
return this;
} | [
"public",
"MainFrame",
"put",
"(",
"Widget",
"widget",
")",
"{",
"widget",
".",
"addTo",
"(",
"user",
")",
";",
"content",
"=",
"widget",
"!=",
"null",
"?",
"widget",
".",
"getID",
"(",
")",
":",
"-",
"1",
";",
"this",
".",
"sendElement",
"(",
")",... | Adds widget to page
@param widget Widget/container to present
@return This instance for chaining | [
"Adds",
"widget",
"to",
"page"
] | 8ba334501396c3301495da8708733f6014f20665 | https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/core/MainFrame.java#L41-L46 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/SortUtils.java | SortUtils.greaterThanOrEquals | public static <T extends Comparable<? super T>> boolean greaterThanOrEquals(final T object,
final T other) {
return JudgeUtils.greaterThanOrEquals(object, other);
} | java | public static <T extends Comparable<? super T>> boolean greaterThanOrEquals(final T object,
final T other) {
return JudgeUtils.greaterThanOrEquals(object, other);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"boolean",
"greaterThanOrEquals",
"(",
"final",
"T",
"object",
",",
"final",
"T",
"other",
")",
"{",
"return",
"JudgeUtils",
".",
"greaterThanOrEquals",
"(",
"object",
... | Returns true if object equals other or object greater than other; false
otherwise.
@param object
comparable object to test.
@param other
comparable object to test.
@return true if object equals other or object above other; false
otherwise. | [
"Returns",
"true",
"if",
"object",
"equals",
"other",
"or",
"object",
"greater",
"than",
"other",
";",
"false",
"otherwise",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/SortUtils.java#L35-L39 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/SortUtils.java | SortUtils.greaterThan | public static <T extends Comparable<? super T>> boolean greaterThan(final T object,
final T other) {
return JudgeUtils.greaterThan(object, other);
} | java | public static <T extends Comparable<? super T>> boolean greaterThan(final T object,
final T other) {
return JudgeUtils.greaterThan(object, other);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"boolean",
"greaterThan",
"(",
"final",
"T",
"object",
",",
"final",
"T",
"other",
")",
"{",
"return",
"JudgeUtils",
".",
"greaterThan",
"(",
"object",
",",
"other",... | Returns true if object greater than other; false otherwise.
@param object
comparable object to test.
@param other
comparable object to test.
@return true if object greater than other; false otherwise. | [
"Returns",
"true",
"if",
"object",
"greater",
"than",
"other",
";",
"false",
"otherwise",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/SortUtils.java#L50-L54 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/SortUtils.java | SortUtils.lessThanOrEquals | public static <T extends Comparable<? super T>> boolean lessThanOrEquals(final T object,
final T other) {
return JudgeUtils.lessThanOrEquals(object, other);
} | java | public static <T extends Comparable<? super T>> boolean lessThanOrEquals(final T object,
final T other) {
return JudgeUtils.lessThanOrEquals(object, other);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"boolean",
"lessThanOrEquals",
"(",
"final",
"T",
"object",
",",
"final",
"T",
"other",
")",
"{",
"return",
"JudgeUtils",
".",
"lessThanOrEquals",
"(",
"object",
",",
... | Returns true if object equals other or object less than other; false
otherwise.
@param object
comparable object to test.
@param other
comparable object to test.
@return true if object equals other or object above other; false
otherwise. | [
"Returns",
"true",
"if",
"object",
"equals",
"other",
"or",
"object",
"less",
"than",
"other",
";",
"false",
"otherwise",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/SortUtils.java#L67-L71 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/SortUtils.java | SortUtils.lessThan | public static <T extends Comparable<? super T>> boolean lessThan(final T object, final T other) {
return JudgeUtils.lessThan(object, other);
} | java | public static <T extends Comparable<? super T>> boolean lessThan(final T object, final T other) {
return JudgeUtils.lessThan(object, other);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"boolean",
"lessThan",
"(",
"final",
"T",
"object",
",",
"final",
"T",
"other",
")",
"{",
"return",
"JudgeUtils",
".",
"lessThan",
"(",
"object",
",",
"other",
")"... | Returns true if object less than other; false otherwise.
@param object
comparable object to test.
@param other
comparable object to test.
@return true if object less than other; false otherwise. | [
"Returns",
"true",
"if",
"object",
"less",
"than",
"other",
";",
"false",
"otherwise",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/SortUtils.java#L82-L85 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/SortUtils.java | SortUtils.ascDeep | public static <T extends Comparable<? super T>> void ascDeep(final T[] comparableArray) {
if (ArrayUtils.isEmpty(comparableArray)) {
return;
}
ascByReflex(comparableArray);
} | java | public static <T extends Comparable<? super T>> void ascDeep(final T[] comparableArray) {
if (ArrayUtils.isEmpty(comparableArray)) {
return;
}
ascByReflex(comparableArray);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"ascDeep",
"(",
"final",
"T",
"[",
"]",
"comparableArray",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isEmpty",
"(",
"comparableArray",
")",
")",
"{",
"retur... | Orders given comparable array by ascending.
@param comparableArray
comparable array to be handed. | [
"Orders",
"given",
"comparable",
"array",
"by",
"ascending",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/SortUtils.java#L110-L116 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/SortUtils.java | SortUtils.descDeep | public static <T extends Comparable<? super T>> void descDeep(final T[] comparableArray) {
if (ArrayUtils.isEmpty(comparableArray)) {
return;
}
descByReflex(comparableArray);
} | java | public static <T extends Comparable<? super T>> void descDeep(final T[] comparableArray) {
if (ArrayUtils.isEmpty(comparableArray)) {
return;
}
descByReflex(comparableArray);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"descDeep",
"(",
"final",
"T",
"[",
"]",
"comparableArray",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isEmpty",
"(",
"comparableArray",
")",
")",
"{",
"retu... | Orders given comparable array by descending.
@param comparableArray
comparable array to be handed. | [
"Orders",
"given",
"comparable",
"array",
"by",
"descending",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/SortUtils.java#L141-L147 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/SortUtils.java | SortUtils.reverse | public static <T> void reverse(final T array) {
if (ArrayUtils.isArray(array)) {
int mlength = Array.getLength(array) - 1;
Object temp = null;
for (int i = 0, j = mlength; i < mlength; i++, j--) {
Object arg0 = Array.get(array, i);
Object arg1 = Array.get(array, j);
temp = arg0;
Array.set(array, i, arg1);
Array.set(array, j, temp);
}
}
} | java | public static <T> void reverse(final T array) {
if (ArrayUtils.isArray(array)) {
int mlength = Array.getLength(array) - 1;
Object temp = null;
for (int i = 0, j = mlength; i < mlength; i++, j--) {
Object arg0 = Array.get(array, i);
Object arg1 = Array.get(array, j);
temp = arg0;
Array.set(array, i, arg1);
Array.set(array, j, temp);
}
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"reverse",
"(",
"final",
"T",
"array",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isArray",
"(",
"array",
")",
")",
"{",
"int",
"mlength",
"=",
"Array",
".",
"getLength",
"(",
"array",
")",
"-",
"1",
";",
... | Sort the array in reverse order.
@param array
object to be handled. | [
"Sort",
"the",
"array",
"in",
"reverse",
"order",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/SortUtils.java#L215-L228 | train |
brianwhu/xillium | core/src/main/java/org/xillium/core/management/ManagedPlatform.java | ManagedPlatform.contextInitialized | @Override
public void contextInitialized(ServletContextEvent event) {
_registry.put(INSTANCE, new Pair<Service, Persistence>(this, null));
_context = event.getServletContext();
_application = _context.getContextPath();
_logger.config("application: " + _application);
if (_application.charAt(0) == '/') _application = _application.substring(1);
try { ManagementFactory.getPlatformMBeanServer().setAttribute(
new ObjectName("Catalina:host=localhost,name=AccessLogValve,type=Valve"), new Attribute("condition", "intrinsic")
); } catch (Exception x) {}
} | java | @Override
public void contextInitialized(ServletContextEvent event) {
_registry.put(INSTANCE, new Pair<Service, Persistence>(this, null));
_context = event.getServletContext();
_application = _context.getContextPath();
_logger.config("application: " + _application);
if (_application.charAt(0) == '/') _application = _application.substring(1);
try { ManagementFactory.getPlatformMBeanServer().setAttribute(
new ObjectName("Catalina:host=localhost,name=AccessLogValve,type=Valve"), new Attribute("condition", "intrinsic")
); } catch (Exception x) {}
} | [
"@",
"Override",
"public",
"void",
"contextInitialized",
"(",
"ServletContextEvent",
"event",
")",
"{",
"_registry",
".",
"put",
"(",
"INSTANCE",
",",
"new",
"Pair",
"<",
"Service",
",",
"Persistence",
">",
"(",
"this",
",",
"null",
")",
")",
";",
"_contex... | Initializes the servlet context. | [
"Initializes",
"the",
"servlet",
"context",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/management/ManagedPlatform.java#L60-L72 | train |
theHilikus/JRoboCom | jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/player/Bank.java | Bank.plugInterfaces | final public void plugInterfaces(RobotAction newControl, RobotStatus newStatus, WorldInfo newWorld) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new GamePermission("connectBank"));
}
control = newControl;
info = newStatus;
world = newWorld;
} | java | final public void plugInterfaces(RobotAction newControl, RobotStatus newStatus, WorldInfo newWorld) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new GamePermission("connectBank"));
}
control = newControl;
info = newStatus;
world = newWorld;
} | [
"final",
"public",
"void",
"plugInterfaces",
"(",
"RobotAction",
"newControl",
",",
"RobotStatus",
"newStatus",
",",
"WorldInfo",
"newWorld",
")",
"{",
"SecurityManager",
"sm",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"sm",
"!=",
"nu... | Attaches a control to a bank
@param newControl control to attach
@param newStatus status provider to attach
@param newWorld world info provider to attach | [
"Attaches",
"a",
"control",
"to",
"a",
"bank"
] | 0e31c1ecf1006e35f68c229ff66c37640effffac | https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/player/Bank.java#L75-L84 | train |
theHilikus/JRoboCom | jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/player/Bank.java | Bank.setTeamId | final public void setTeamId(int newId) {
if (teamId != -1) {
throw new IllegalStateException("Team Id cannot be modified");
}
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new GamePermission("setTeamId"));
}
teamId = newId;
} | java | final public void setTeamId(int newId) {
if (teamId != -1) {
throw new IllegalStateException("Team Id cannot be modified");
}
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new GamePermission("setTeamId"));
}
teamId = newId;
} | [
"final",
"public",
"void",
"setTeamId",
"(",
"int",
"newId",
")",
"{",
"if",
"(",
"teamId",
"!=",
"-",
"1",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Team Id cannot be modified\"",
")",
";",
"}",
"SecurityManager",
"sm",
"=",
"System",
".",
... | Sets the team id. Can only be called once, otherwise it will throw an exception
@param newId the team id of the bank | [
"Sets",
"the",
"team",
"id",
".",
"Can",
"only",
"be",
"called",
"once",
"otherwise",
"it",
"will",
"throw",
"an",
"exception"
] | 0e31c1ecf1006e35f68c229ff66c37640effffac | https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/player/Bank.java#L102-L112 | train |
jcuda/jcufft | JCufftJava/src/main/java/jcuda/jcufft/cufftCompatibility.java | cufftCompatibility.stringFor | public static String stringFor(int m)
{
if (m == CUFFT_COMPATIBILITY_NATIVE)
{
return "CUFFT_COMPATIBILITY_NATIVE";
}
if ((m & CUFFT_COMPATIBILITY_FFTW_ALL) == CUFFT_COMPATIBILITY_FFTW_ALL)
{
return "CUFFT_COMPATIBILITY_FFTW_ALL";
}
StringBuilder sb = new StringBuilder();
if ((m & CUFFT_COMPATIBILITY_FFTW_PADDING) != 0)
{
sb.append("CUFFT_COMPATIBILITY_FFTW_PADDING ");
}
if ((m & CUFFT_COMPATIBILITY_FFTW_ASYMMETRIC) != 0)
{
sb.append("CUFFT_COMPATIBILITY_FFTW_ASYMMETRIC ");
}
return sb.toString();
} | java | public static String stringFor(int m)
{
if (m == CUFFT_COMPATIBILITY_NATIVE)
{
return "CUFFT_COMPATIBILITY_NATIVE";
}
if ((m & CUFFT_COMPATIBILITY_FFTW_ALL) == CUFFT_COMPATIBILITY_FFTW_ALL)
{
return "CUFFT_COMPATIBILITY_FFTW_ALL";
}
StringBuilder sb = new StringBuilder();
if ((m & CUFFT_COMPATIBILITY_FFTW_PADDING) != 0)
{
sb.append("CUFFT_COMPATIBILITY_FFTW_PADDING ");
}
if ((m & CUFFT_COMPATIBILITY_FFTW_ASYMMETRIC) != 0)
{
sb.append("CUFFT_COMPATIBILITY_FFTW_ASYMMETRIC ");
}
return sb.toString();
} | [
"public",
"static",
"String",
"stringFor",
"(",
"int",
"m",
")",
"{",
"if",
"(",
"m",
"==",
"CUFFT_COMPATIBILITY_NATIVE",
")",
"{",
"return",
"\"CUFFT_COMPATIBILITY_NATIVE\"",
";",
"}",
"if",
"(",
"(",
"m",
"&",
"CUFFT_COMPATIBILITY_FFTW_ALL",
")",
"==",
"CUFF... | Returns the String identifying the given cufftCompatibility
@param m The cufftType
@return The String identifying the given cufftCompatibility | [
"Returns",
"the",
"String",
"identifying",
"the",
"given",
"cufftCompatibility"
] | 833c87ffb0864f7ee7270fddef8af57f48939b3a | https://github.com/jcuda/jcufft/blob/833c87ffb0864f7ee7270fddef8af57f48939b3a/JCufftJava/src/main/java/jcuda/jcufft/cufftCompatibility.java#L83-L103 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/FormatUtilities.java | FormatUtilities.getFormattedBytes | static public String getFormattedBytes(long bytes, String units, String format)
{
double num = bytes;
String[] prefix = {"", "K", "M", "G", "T"};
int count = 0;
while(num >= 1024.0)
{
num = num/1024.0;
++count;
}
DecimalFormat f = new DecimalFormat(format);
return f.format(num)+" "+prefix[count]+units;
} | java | static public String getFormattedBytes(long bytes, String units, String format)
{
double num = bytes;
String[] prefix = {"", "K", "M", "G", "T"};
int count = 0;
while(num >= 1024.0)
{
num = num/1024.0;
++count;
}
DecimalFormat f = new DecimalFormat(format);
return f.format(num)+" "+prefix[count]+units;
} | [
"static",
"public",
"String",
"getFormattedBytes",
"(",
"long",
"bytes",
",",
"String",
"units",
",",
"String",
"format",
")",
"{",
"double",
"num",
"=",
"bytes",
";",
"String",
"[",
"]",
"prefix",
"=",
"{",
"\"\"",
",",
"\"K\"",
",",
"\"M\"",
",",
"\"... | Returns the given bytes number formatted as KBytes, MBytes or GBytes as appropriate.
@param bytes The bytes to be converted
@param units The units to be displayed with the converted bytes
@param format The format to use to display the bytes
@return The given bytes number formatted as KBytes, MBytes or GBytes as appropriate | [
"Returns",
"the",
"given",
"bytes",
"number",
"formatted",
"as",
"KBytes",
"MBytes",
"or",
"GBytes",
"as",
"appropriate",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/FormatUtilities.java#L69-L83 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/FormatUtilities.java | FormatUtilities.getFormattedDate | static public String getFormattedDate(long dt)
{
String ret = "";
SimpleDateFormat df = null;
try
{
if(dt > 0)
{
df = formatPool.getFormat(DATE_FORMAT);
df.setTimeZone(DateUtilities.getCurrentTimeZone());
ret = df.format(new Date(dt));
}
}
catch(Exception e)
{
}
if(df != null)
formatPool.release(df);
return ret;
} | java | static public String getFormattedDate(long dt)
{
String ret = "";
SimpleDateFormat df = null;
try
{
if(dt > 0)
{
df = formatPool.getFormat(DATE_FORMAT);
df.setTimeZone(DateUtilities.getCurrentTimeZone());
ret = df.format(new Date(dt));
}
}
catch(Exception e)
{
}
if(df != null)
formatPool.release(df);
return ret;
} | [
"static",
"public",
"String",
"getFormattedDate",
"(",
"long",
"dt",
")",
"{",
"String",
"ret",
"=",
"\"\"",
";",
"SimpleDateFormat",
"df",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"dt",
">",
"0",
")",
"{",
"df",
"=",
"formatPool",
".",
"getFormat",
... | Returns the given date parsed using "dd-MM-yyyy".
@param dt The date to be parsed
@return The given date parsed using "dd-MM-yyyy" | [
"Returns",
"the",
"given",
"date",
"parsed",
"using",
"dd",
"-",
"MM",
"-",
"yyyy",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/FormatUtilities.java#L340-L362 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/util/FormatUtilities.java | FormatUtilities.getLongFormattedDays | static public String getLongFormattedDays(long dt)
{
StringBuffer ret = new StringBuffer();
long days = dt/86400000L;
long millis = dt-(days*86400000L);
if(days > 0)
{
ret.append(Long.toString(days));
ret.append(" day");
if(days > 1)
ret.append("s");
}
long hours = millis/3600000L;
millis = millis-(hours*3600000L);
if(hours > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(hours));
ret.append(" hour");
if(hours > 1)
ret.append("s");
}
long minutes = millis/60000L;
millis = millis-(minutes*60000L);
if(minutes > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(minutes));
ret.append(" minute");
if(minutes > 1)
ret.append("s");
}
long seconds = millis/1000L;
if(seconds > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(seconds));
ret.append(" second");
if(seconds > 1)
ret.append("s");
}
return ret.toString();
} | java | static public String getLongFormattedDays(long dt)
{
StringBuffer ret = new StringBuffer();
long days = dt/86400000L;
long millis = dt-(days*86400000L);
if(days > 0)
{
ret.append(Long.toString(days));
ret.append(" day");
if(days > 1)
ret.append("s");
}
long hours = millis/3600000L;
millis = millis-(hours*3600000L);
if(hours > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(hours));
ret.append(" hour");
if(hours > 1)
ret.append("s");
}
long minutes = millis/60000L;
millis = millis-(minutes*60000L);
if(minutes > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(minutes));
ret.append(" minute");
if(minutes > 1)
ret.append("s");
}
long seconds = millis/1000L;
if(seconds > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(seconds));
ret.append(" second");
if(seconds > 1)
ret.append("s");
}
return ret.toString();
} | [
"static",
"public",
"String",
"getLongFormattedDays",
"(",
"long",
"dt",
")",
"{",
"StringBuffer",
"ret",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"long",
"days",
"=",
"dt",
"/",
"86400000L",
";",
"long",
"millis",
"=",
"dt",
"-",
"(",
"days",
"*",
"... | Returns the given time formatted as a number of days, hours and minutes.
@param dt The time to be parsed
@return The given time formatted as a number of days, hours and minutes | [
"Returns",
"the",
"given",
"time",
"formatted",
"as",
"a",
"number",
"of",
"days",
"hours",
"and",
"minutes",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/util/FormatUtilities.java#L445-L497 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javadoc/DocEnv.java | DocEnv.loadClass | public ClassDocImpl loadClass(String name) {
try {
ClassSymbol c = reader.loadClass(names.fromString(name));
return getClassDoc(c);
} catch (CompletionFailure ex) {
chk.completionError(null, ex);
return null;
}
} | java | public ClassDocImpl loadClass(String name) {
try {
ClassSymbol c = reader.loadClass(names.fromString(name));
return getClassDoc(c);
} catch (CompletionFailure ex) {
chk.completionError(null, ex);
return null;
}
} | [
"public",
"ClassDocImpl",
"loadClass",
"(",
"String",
"name",
")",
"{",
"try",
"{",
"ClassSymbol",
"c",
"=",
"reader",
".",
"loadClass",
"(",
"names",
".",
"fromString",
"(",
"name",
")",
")",
";",
"return",
"getClassDoc",
"(",
"c",
")",
";",
"}",
"cat... | Load ClassDoc by qualified name. | [
"Load",
"ClassDoc",
"by",
"qualified",
"name",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/DocEnv.java#L179-L187 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java | AbstractProfileIndexWriter.buildProfileIndexFile | protected void buildProfileIndexFile(String title, boolean includeScript) throws IOException {
String windowOverview = configuration.getText(title);
Content body = getBody(includeScript, getWindowTitle(windowOverview));
addNavigationBarHeader(body);
addOverviewHeader(body);
addIndex(body);
addOverview(body);
addNavigationBarFooter(body);
printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
configuration.doctitle), includeScript, body);
} | java | protected void buildProfileIndexFile(String title, boolean includeScript) throws IOException {
String windowOverview = configuration.getText(title);
Content body = getBody(includeScript, getWindowTitle(windowOverview));
addNavigationBarHeader(body);
addOverviewHeader(body);
addIndex(body);
addOverview(body);
addNavigationBarFooter(body);
printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
configuration.doctitle), includeScript, body);
} | [
"protected",
"void",
"buildProfileIndexFile",
"(",
"String",
"title",
",",
"boolean",
"includeScript",
")",
"throws",
"IOException",
"{",
"String",
"windowOverview",
"=",
"configuration",
".",
"getText",
"(",
"title",
")",
";",
"Content",
"body",
"=",
"getBody",
... | Generate and prints the contents in the profile index file. Call appropriate
methods from the sub-class in order to generate Frame or Non
Frame format.
@param title the title of the window.
@param includeScript boolean set true if windowtitle script is to be included | [
"Generate",
"and",
"prints",
"the",
"contents",
"in",
"the",
"profile",
"index",
"file",
".",
"Call",
"appropriate",
"methods",
"from",
"the",
"sub",
"-",
"class",
"in",
"order",
"to",
"generate",
"Frame",
"or",
"Non",
"Frame",
"format",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java#L118-L128 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java | AbstractProfileIndexWriter.buildProfilePackagesIndexFile | protected void buildProfilePackagesIndexFile(String title,
boolean includeScript, String profileName) throws IOException {
String windowOverview = configuration.getText(title);
Content body = getBody(includeScript, getWindowTitle(windowOverview));
addNavigationBarHeader(body);
addOverviewHeader(body);
addProfilePackagesIndex(body, profileName);
addOverview(body);
addNavigationBarFooter(body);
printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
configuration.doctitle), includeScript, body);
} | java | protected void buildProfilePackagesIndexFile(String title,
boolean includeScript, String profileName) throws IOException {
String windowOverview = configuration.getText(title);
Content body = getBody(includeScript, getWindowTitle(windowOverview));
addNavigationBarHeader(body);
addOverviewHeader(body);
addProfilePackagesIndex(body, profileName);
addOverview(body);
addNavigationBarFooter(body);
printHtmlDocument(configuration.metakeywords.getOverviewMetaKeywords(title,
configuration.doctitle), includeScript, body);
} | [
"protected",
"void",
"buildProfilePackagesIndexFile",
"(",
"String",
"title",
",",
"boolean",
"includeScript",
",",
"String",
"profileName",
")",
"throws",
"IOException",
"{",
"String",
"windowOverview",
"=",
"configuration",
".",
"getText",
"(",
"title",
")",
";",
... | Generate and prints the contents in the profile packages index file. Call appropriate
methods from the sub-class in order to generate Frame or Non
Frame format.
@param title the title of the window.
@param includeScript boolean set true if windowtitle script is to be included
@param profileName the name of the profile being documented | [
"Generate",
"and",
"prints",
"the",
"contents",
"in",
"the",
"profile",
"packages",
"index",
"file",
".",
"Call",
"appropriate",
"methods",
"from",
"the",
"sub",
"-",
"class",
"in",
"order",
"to",
"generate",
"Frame",
"or",
"Non",
"Frame",
"format",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java#L139-L150 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java | AbstractProfileIndexWriter.addIndex | protected void addIndex(Content body) {
addIndexContents(profiles, "doclet.Profile_Summary",
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Profile_Summary"),
configuration.getText("doclet.profiles")), body);
} | java | protected void addIndex(Content body) {
addIndexContents(profiles, "doclet.Profile_Summary",
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Profile_Summary"),
configuration.getText("doclet.profiles")), body);
} | [
"protected",
"void",
"addIndex",
"(",
"Content",
"body",
")",
"{",
"addIndexContents",
"(",
"profiles",
",",
"\"doclet.Profile_Summary\"",
",",
"configuration",
".",
"getText",
"(",
"\"doclet.Member_Table_Summary\"",
",",
"configuration",
".",
"getText",
"(",
"\"docle... | Adds the frame or non-frame profile index to the documentation tree.
@param body the document tree to which the index will be added | [
"Adds",
"the",
"frame",
"or",
"non",
"-",
"frame",
"profile",
"index",
"to",
"the",
"documentation",
"tree",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java#L165-L170 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java | AbstractProfileIndexWriter.addProfilePackagesIndex | protected void addProfilePackagesIndex(Content body, String profileName) {
addProfilePackagesIndexContents(profiles, "doclet.Profile_Summary",
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Profile_Summary"),
configuration.getText("doclet.profiles")), body, profileName);
} | java | protected void addProfilePackagesIndex(Content body, String profileName) {
addProfilePackagesIndexContents(profiles, "doclet.Profile_Summary",
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Profile_Summary"),
configuration.getText("doclet.profiles")), body, profileName);
} | [
"protected",
"void",
"addProfilePackagesIndex",
"(",
"Content",
"body",
",",
"String",
"profileName",
")",
"{",
"addProfilePackagesIndexContents",
"(",
"profiles",
",",
"\"doclet.Profile_Summary\"",
",",
"configuration",
".",
"getText",
"(",
"\"doclet.Member_Table_Summary\"... | Adds the frame or non-frame profile packages index to the documentation tree.
@param body the document tree to which the index will be added
@param profileName the name of the profile being documented | [
"Adds",
"the",
"frame",
"or",
"non",
"-",
"frame",
"profile",
"packages",
"index",
"to",
"the",
"documentation",
"tree",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java#L178-L183 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java | AbstractProfileIndexWriter.addIndexContents | protected void addIndexContents(Profiles profiles, String text,
String tableSummary, Content body) {
if (profiles.getProfileCount() > 0) {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexHeader);
addAllClassesLink(div);
addAllPackagesLink(div);
body.addContent(div);
addProfilesList(profiles, text, tableSummary, body);
}
} | java | protected void addIndexContents(Profiles profiles, String text,
String tableSummary, Content body) {
if (profiles.getProfileCount() > 0) {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexHeader);
addAllClassesLink(div);
addAllPackagesLink(div);
body.addContent(div);
addProfilesList(profiles, text, tableSummary, body);
}
} | [
"protected",
"void",
"addIndexContents",
"(",
"Profiles",
"profiles",
",",
"String",
"text",
",",
"String",
"tableSummary",
",",
"Content",
"body",
")",
"{",
"if",
"(",
"profiles",
".",
"getProfileCount",
"(",
")",
">",
"0",
")",
"{",
"HtmlTree",
"div",
"=... | Adds profile index contents. Call appropriate methods from
the sub-classes. Adds it to the body HtmlTree
@param profiles profiles to be documented
@param text string which will be used as the heading
@param tableSummary summary for the table
@param body the document tree to which the index contents will be added | [
"Adds",
"profile",
"index",
"contents",
".",
"Call",
"appropriate",
"methods",
"from",
"the",
"sub",
"-",
"classes",
".",
"Adds",
"it",
"to",
"the",
"body",
"HtmlTree"
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java#L194-L204 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java | AbstractProfileIndexWriter.addProfilePackagesIndexContents | protected void addProfilePackagesIndexContents(Profiles profiles, String text,
String tableSummary, Content body, String profileName) {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexHeader);
addAllClassesLink(div);
addAllPackagesLink(div);
addAllProfilesLink(div);
body.addContent(div);
addProfilePackagesList(profiles, text, tableSummary, body, profileName);
} | java | protected void addProfilePackagesIndexContents(Profiles profiles, String text,
String tableSummary, Content body, String profileName) {
HtmlTree div = new HtmlTree(HtmlTag.DIV);
div.addStyle(HtmlStyle.indexHeader);
addAllClassesLink(div);
addAllPackagesLink(div);
addAllProfilesLink(div);
body.addContent(div);
addProfilePackagesList(profiles, text, tableSummary, body, profileName);
} | [
"protected",
"void",
"addProfilePackagesIndexContents",
"(",
"Profiles",
"profiles",
",",
"String",
"text",
",",
"String",
"tableSummary",
",",
"Content",
"body",
",",
"String",
"profileName",
")",
"{",
"HtmlTree",
"div",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
... | Adds profile packages index contents. Call appropriate methods from
the sub-classes. Adds it to the body HtmlTree
@param profiles profiles to be documented
@param text string which will be used as the heading
@param tableSummary summary for the table
@param body the document tree to which the index contents will be added
@param profileName the name of the profile being documented | [
"Adds",
"profile",
"packages",
"index",
"contents",
".",
"Call",
"appropriate",
"methods",
"from",
"the",
"sub",
"-",
"classes",
".",
"Adds",
"it",
"to",
"the",
"body",
"HtmlTree"
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractProfileIndexWriter.java#L216-L225 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByBirthday | public Iterable<DContact> queryByBirthday(Object parent, java.util.Date birthday) {
return queryByField(parent, DContactMapper.Field.BIRTHDAY.getFieldName(), birthday);
} | java | public Iterable<DContact> queryByBirthday(Object parent, java.util.Date birthday) {
return queryByField(parent, DContactMapper.Field.BIRTHDAY.getFieldName(), birthday);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByBirthday",
"(",
"Object",
"parent",
",",
"java",
".",
"util",
".",
"Date",
"birthday",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"BIRTHDAY",
".",
"getField... | query-by method for field birthday
@param birthday the specified attribute
@return an Iterable of DContacts for the specified birthday | [
"query",
"-",
"by",
"method",
"for",
"field",
"birthday"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L97-L99 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByCompanyName | public Iterable<DContact> queryByCompanyName(Object parent, java.lang.String companyName) {
return queryByField(parent, DContactMapper.Field.COMPANYNAME.getFieldName(), companyName);
} | java | public Iterable<DContact> queryByCompanyName(Object parent, java.lang.String companyName) {
return queryByField(parent, DContactMapper.Field.COMPANYNAME.getFieldName(), companyName);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByCompanyName",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"companyName",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"COMPANYNAME",
".",
... | query-by method for field companyName
@param companyName the specified attribute
@return an Iterable of DContacts for the specified companyName | [
"query",
"-",
"by",
"method",
"for",
"field",
"companyName"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L115-L117 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByEmail | public Iterable<DContact> queryByEmail(Object parent, java.lang.String email) {
return queryByField(parent, DContactMapper.Field.EMAIL.getFieldName(), email);
} | java | public Iterable<DContact> queryByEmail(Object parent, java.lang.String email) {
return queryByField(parent, DContactMapper.Field.EMAIL.getFieldName(), email);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByEmail",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"email",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"EMAIL",
".",
"getFieldName",
... | query-by method for field email
@param email the specified attribute
@return an Iterable of DContacts for the specified email | [
"query",
"-",
"by",
"method",
"for",
"field",
"email"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L151-L153 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByFacebook | public Iterable<DContact> queryByFacebook(Object parent, java.lang.String facebook) {
return queryByField(parent, DContactMapper.Field.FACEBOOK.getFieldName(), facebook);
} | java | public Iterable<DContact> queryByFacebook(Object parent, java.lang.String facebook) {
return queryByField(parent, DContactMapper.Field.FACEBOOK.getFieldName(), facebook);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByFacebook",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"facebook",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"FACEBOOK",
".",
"getFie... | query-by method for field facebook
@param facebook the specified attribute
@return an Iterable of DContacts for the specified facebook | [
"query",
"-",
"by",
"method",
"for",
"field",
"facebook"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L160-L162 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByHomePhone | public Iterable<DContact> queryByHomePhone(Object parent, java.lang.String homePhone) {
return queryByField(parent, DContactMapper.Field.HOMEPHONE.getFieldName(), homePhone);
} | java | public Iterable<DContact> queryByHomePhone(Object parent, java.lang.String homePhone) {
return queryByField(parent, DContactMapper.Field.HOMEPHONE.getFieldName(), homePhone);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByHomePhone",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"homePhone",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"HOMEPHONE",
".",
"get... | query-by method for field homePhone
@param homePhone the specified attribute
@return an Iterable of DContacts for the specified homePhone | [
"query",
"-",
"by",
"method",
"for",
"field",
"homePhone"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L178-L180 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByLatitude | public Iterable<DContact> queryByLatitude(Object parent, java.lang.Float latitude) {
return queryByField(parent, DContactMapper.Field.LATITUDE.getFieldName(), latitude);
} | java | public Iterable<DContact> queryByLatitude(Object parent, java.lang.Float latitude) {
return queryByField(parent, DContactMapper.Field.LATITUDE.getFieldName(), latitude);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByLatitude",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"Float",
"latitude",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"LATITUDE",
".",
"getFiel... | query-by method for field latitude
@param latitude the specified attribute
@return an Iterable of DContacts for the specified latitude | [
"query",
"-",
"by",
"method",
"for",
"field",
"latitude"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L196-L198 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByLinkedIn | public Iterable<DContact> queryByLinkedIn(Object parent, java.lang.String linkedIn) {
return queryByField(parent, DContactMapper.Field.LINKEDIN.getFieldName(), linkedIn);
} | java | public Iterable<DContact> queryByLinkedIn(Object parent, java.lang.String linkedIn) {
return queryByField(parent, DContactMapper.Field.LINKEDIN.getFieldName(), linkedIn);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByLinkedIn",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"linkedIn",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"LINKEDIN",
".",
"getFie... | query-by method for field linkedIn
@param linkedIn the specified attribute
@return an Iterable of DContacts for the specified linkedIn | [
"query",
"-",
"by",
"method",
"for",
"field",
"linkedIn"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L205-L207 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByLongitude | public Iterable<DContact> queryByLongitude(Object parent, java.lang.Float longitude) {
return queryByField(parent, DContactMapper.Field.LONGITUDE.getFieldName(), longitude);
} | java | public Iterable<DContact> queryByLongitude(Object parent, java.lang.Float longitude) {
return queryByField(parent, DContactMapper.Field.LONGITUDE.getFieldName(), longitude);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByLongitude",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"Float",
"longitude",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"LONGITUDE",
".",
"getF... | query-by method for field longitude
@param longitude the specified attribute
@return an Iterable of DContacts for the specified longitude | [
"query",
"-",
"by",
"method",
"for",
"field",
"longitude"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L214-L216 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByMobilePhone | public Iterable<DContact> queryByMobilePhone(Object parent, java.lang.String mobilePhone) {
return queryByField(parent, DContactMapper.Field.MOBILEPHONE.getFieldName(), mobilePhone);
} | java | public Iterable<DContact> queryByMobilePhone(Object parent, java.lang.String mobilePhone) {
return queryByField(parent, DContactMapper.Field.MOBILEPHONE.getFieldName(), mobilePhone);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByMobilePhone",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"mobilePhone",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"MOBILEPHONE",
".",
... | query-by method for field mobilePhone
@param mobilePhone the specified attribute
@return an Iterable of DContacts for the specified mobilePhone | [
"query",
"-",
"by",
"method",
"for",
"field",
"mobilePhone"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L223-L225 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByOtherEmail | public Iterable<DContact> queryByOtherEmail(Object parent, java.lang.String otherEmail) {
return queryByField(parent, DContactMapper.Field.OTHEREMAIL.getFieldName(), otherEmail);
} | java | public Iterable<DContact> queryByOtherEmail(Object parent, java.lang.String otherEmail) {
return queryByField(parent, DContactMapper.Field.OTHEREMAIL.getFieldName(), otherEmail);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByOtherEmail",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"otherEmail",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"OTHEREMAIL",
".",
"... | query-by method for field otherEmail
@param otherEmail the specified attribute
@return an Iterable of DContacts for the specified otherEmail | [
"query",
"-",
"by",
"method",
"for",
"field",
"otherEmail"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L232-L234 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByOtherPhone | public Iterable<DContact> queryByOtherPhone(Object parent, java.lang.String otherPhone) {
return queryByField(parent, DContactMapper.Field.OTHERPHONE.getFieldName(), otherPhone);
} | java | public Iterable<DContact> queryByOtherPhone(Object parent, java.lang.String otherPhone) {
return queryByField(parent, DContactMapper.Field.OTHERPHONE.getFieldName(), otherPhone);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByOtherPhone",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"otherPhone",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"OTHERPHONE",
".",
"... | query-by method for field otherPhone
@param otherPhone the specified attribute
@return an Iterable of DContacts for the specified otherPhone | [
"query",
"-",
"by",
"method",
"for",
"field",
"otherPhone"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L241-L243 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByPrimaryCustomIndex | public Iterable<DContact> queryByPrimaryCustomIndex(Object parent, java.lang.String primaryCustomIndex) {
return queryByField(parent, DContactMapper.Field.PRIMARYCUSTOMINDEX.getFieldName(), primaryCustomIndex);
} | java | public Iterable<DContact> queryByPrimaryCustomIndex(Object parent, java.lang.String primaryCustomIndex) {
return queryByField(parent, DContactMapper.Field.PRIMARYCUSTOMINDEX.getFieldName(), primaryCustomIndex);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByPrimaryCustomIndex",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"primaryCustomIndex",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"PRIMARY... | query-by method for field primaryCustomIndex
@param primaryCustomIndex the specified attribute
@return an Iterable of DContacts for the specified primaryCustomIndex | [
"query",
"-",
"by",
"method",
"for",
"field",
"primaryCustomIndex"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L250-L252 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryBySecondaryCustomIndex | public Iterable<DContact> queryBySecondaryCustomIndex(Object parent, java.lang.String secondaryCustomIndex) {
return queryByField(parent, DContactMapper.Field.SECONDARYCUSTOMINDEX.getFieldName(), secondaryCustomIndex);
} | java | public Iterable<DContact> queryBySecondaryCustomIndex(Object parent, java.lang.String secondaryCustomIndex) {
return queryByField(parent, DContactMapper.Field.SECONDARYCUSTOMINDEX.getFieldName(), secondaryCustomIndex);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryBySecondaryCustomIndex",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"secondaryCustomIndex",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"SEC... | query-by method for field secondaryCustomIndex
@param secondaryCustomIndex the specified attribute
@return an Iterable of DContacts for the specified secondaryCustomIndex | [
"query",
"-",
"by",
"method",
"for",
"field",
"secondaryCustomIndex"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L259-L261 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByTags | public Iterable<DContact> queryByTags(Object parent, java.lang.Object tags) {
return queryByField(parent, DContactMapper.Field.TAGS.getFieldName(), tags);
} | java | public Iterable<DContact> queryByTags(Object parent, java.lang.Object tags) {
return queryByField(parent, DContactMapper.Field.TAGS.getFieldName(), tags);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByTags",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"Object",
"tags",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"TAGS",
".",
"getFieldName",
"... | query-by method for field tags
@param tags the specified attribute
@return an Iterable of DContacts for the specified tags | [
"query",
"-",
"by",
"method",
"for",
"field",
"tags"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L268-L270 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByTwitter | public Iterable<DContact> queryByTwitter(Object parent, java.lang.String twitter) {
return queryByField(parent, DContactMapper.Field.TWITTER.getFieldName(), twitter);
} | java | public Iterable<DContact> queryByTwitter(Object parent, java.lang.String twitter) {
return queryByField(parent, DContactMapper.Field.TWITTER.getFieldName(), twitter);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByTwitter",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"twitter",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"TWITTER",
".",
"getFieldN... | query-by method for field twitter
@param twitter the specified attribute
@return an Iterable of DContacts for the specified twitter | [
"query",
"-",
"by",
"method",
"for",
"field",
"twitter"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L277-L279 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.findByUniqueTag | public DContact findByUniqueTag(Object parent, java.lang.String uniqueTag) {
return queryUniqueByField(parent, DContactMapper.Field.UNIQUETAG.getFieldName(), uniqueTag);
} | java | public DContact findByUniqueTag(Object parent, java.lang.String uniqueTag) {
return queryUniqueByField(parent, DContactMapper.Field.UNIQUETAG.getFieldName(), uniqueTag);
} | [
"public",
"DContact",
"findByUniqueTag",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"uniqueTag",
")",
"{",
"return",
"queryUniqueByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"UNIQUETAG",
".",
"getFieldName",
"(",
")... | find-by method for unique field uniqueTag
@param uniqueTag the unique attribute
@return the unique DContact for the specified uniqueTag | [
"find",
"-",
"by",
"method",
"for",
"unique",
"field",
"uniqueTag"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L286-L288 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByWebPage | public Iterable<DContact> queryByWebPage(Object parent, java.lang.String webPage) {
return queryByField(parent, DContactMapper.Field.WEBPAGE.getFieldName(), webPage);
} | java | public Iterable<DContact> queryByWebPage(Object parent, java.lang.String webPage) {
return queryByField(parent, DContactMapper.Field.WEBPAGE.getFieldName(), webPage);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByWebPage",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"webPage",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"WEBPAGE",
".",
"getFieldN... | query-by method for field webPage
@param webPage the specified attribute
@return an Iterable of DContacts for the specified webPage | [
"query",
"-",
"by",
"method",
"for",
"field",
"webPage"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L313-L315 | train |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByWorkPhone | public Iterable<DContact> queryByWorkPhone(Object parent, java.lang.String workPhone) {
return queryByField(parent, DContactMapper.Field.WORKPHONE.getFieldName(), workPhone);
} | java | public Iterable<DContact> queryByWorkPhone(Object parent, java.lang.String workPhone) {
return queryByField(parent, DContactMapper.Field.WORKPHONE.getFieldName(), workPhone);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByWorkPhone",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"workPhone",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"WORKPHONE",
".",
"get... | query-by method for field workPhone
@param workPhone the specified attribute
@return an Iterable of DContacts for the specified workPhone | [
"query",
"-",
"by",
"method",
"for",
"field",
"workPhone"
] | eb8ba8e6794a96ea0dd9744cada4f9ad9618f114 | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L322-L324 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/util/Convert.java | Convert.string2int | public static int string2int(String s, int radix)
throws NumberFormatException {
if (radix == 10) {
return Integer.parseInt(s, radix);
} else {
char[] cs = s.toCharArray();
int limit = Integer.MAX_VALUE / (radix/2);
int n = 0;
for (int i = 0; i < cs.length; i++) {
int d = Character.digit(cs[i], radix);
if (n < 0 ||
n > limit ||
n * radix > Integer.MAX_VALUE - d)
throw new NumberFormatException();
n = n * radix + d;
}
return n;
}
} | java | public static int string2int(String s, int radix)
throws NumberFormatException {
if (radix == 10) {
return Integer.parseInt(s, radix);
} else {
char[] cs = s.toCharArray();
int limit = Integer.MAX_VALUE / (radix/2);
int n = 0;
for (int i = 0; i < cs.length; i++) {
int d = Character.digit(cs[i], radix);
if (n < 0 ||
n > limit ||
n * radix > Integer.MAX_VALUE - d)
throw new NumberFormatException();
n = n * radix + d;
}
return n;
}
} | [
"public",
"static",
"int",
"string2int",
"(",
"String",
"s",
",",
"int",
"radix",
")",
"throws",
"NumberFormatException",
"{",
"if",
"(",
"radix",
"==",
"10",
")",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"s",
",",
"radix",
")",
";",
"}",
"else"... | Convert string to integer. | [
"Convert",
"string",
"to",
"integer",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/util/Convert.java#L58-L76 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/util/Convert.java | Convert.string2long | public static long string2long(String s, int radix)
throws NumberFormatException {
if (radix == 10) {
return Long.parseLong(s, radix);
} else {
char[] cs = s.toCharArray();
long limit = Long.MAX_VALUE / (radix/2);
long n = 0;
for (int i = 0; i < cs.length; i++) {
int d = Character.digit(cs[i], radix);
if (n < 0 ||
n > limit ||
n * radix > Long.MAX_VALUE - d)
throw new NumberFormatException();
n = n * radix + d;
}
return n;
}
} | java | public static long string2long(String s, int radix)
throws NumberFormatException {
if (radix == 10) {
return Long.parseLong(s, radix);
} else {
char[] cs = s.toCharArray();
long limit = Long.MAX_VALUE / (radix/2);
long n = 0;
for (int i = 0; i < cs.length; i++) {
int d = Character.digit(cs[i], radix);
if (n < 0 ||
n > limit ||
n * radix > Long.MAX_VALUE - d)
throw new NumberFormatException();
n = n * radix + d;
}
return n;
}
} | [
"public",
"static",
"long",
"string2long",
"(",
"String",
"s",
",",
"int",
"radix",
")",
"throws",
"NumberFormatException",
"{",
"if",
"(",
"radix",
"==",
"10",
")",
"{",
"return",
"Long",
".",
"parseLong",
"(",
"s",
",",
"radix",
")",
";",
"}",
"else"... | Convert string to long integer. | [
"Convert",
"string",
"to",
"long",
"integer",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/util/Convert.java#L80-L98 | train |
syphr42/libmythtv-java | control/src/main/java/org/syphr/mythtv/control/impl/Control0_24Utils.java | Control0_24Utils.getResponseMaybe | public static String getResponseMaybe(SocketManager socketManager, String message) throws IOException
{
try
{
return socketManager.sendAndWait(message);
}
catch (ResponseTimeoutException e)
{
/*
* If the timeout was hit in the previous send-and-wait, then the
* socket manager will be expecting the next message that arrives to
* be an orphan connected to this command that didn't come back in
* time. To get things back in sync, a throwaway command (help) will
* be sent.
*/
socketManager.send("help");
return "";
}
} | java | public static String getResponseMaybe(SocketManager socketManager, String message) throws IOException
{
try
{
return socketManager.sendAndWait(message);
}
catch (ResponseTimeoutException e)
{
/*
* If the timeout was hit in the previous send-and-wait, then the
* socket manager will be expecting the next message that arrives to
* be an orphan connected to this command that didn't come back in
* time. To get things back in sync, a throwaway command (help) will
* be sent.
*/
socketManager.send("help");
return "";
}
} | [
"public",
"static",
"String",
"getResponseMaybe",
"(",
"SocketManager",
"socketManager",
",",
"String",
"message",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"socketManager",
".",
"sendAndWait",
"(",
"message",
")",
";",
"}",
"catch",
"(",
"Respons... | Send a message and wait for a short period for a response. If no response
comes in that time, it is assumed that there will be no response from the
frontend. This is useful for commands that get a response when there is
data available and silence otherwise.
@param socketManager
the socket manager to use for communicating with the frontend
@param message
the message to send
@return the response if there was one; otherwise an empty string
@throws IOException
if there is a communication or protocol error | [
"Send",
"a",
"message",
"and",
"wait",
"for",
"a",
"short",
"period",
"for",
"a",
"response",
".",
"If",
"no",
"response",
"comes",
"in",
"that",
"time",
"it",
"is",
"assumed",
"that",
"there",
"will",
"be",
"no",
"response",
"from",
"the",
"frontend",
... | cc7a2012fbd4a4ba2562dda6b2614fb0548526ea | https://github.com/syphr42/libmythtv-java/blob/cc7a2012fbd4a4ba2562dda6b2614fb0548526ea/control/src/main/java/org/syphr/mythtv/control/impl/Control0_24Utils.java#L204-L222 | train |
devnull-tools/trugger | src/main/java/tools/devnull/trugger/reflection/Reflection.java | Reflection.parsePropertyName | public static String parsePropertyName(Method method) {
String name = method.getName();
int i = 0;
if (name.startsWith("get") || name.startsWith("set")) {
i = 3;
} else if (name.startsWith("is")) {
i = 2;
}
return Character.toLowerCase(name.charAt(i)) + name.substring(i + 1);
} | java | public static String parsePropertyName(Method method) {
String name = method.getName();
int i = 0;
if (name.startsWith("get") || name.startsWith("set")) {
i = 3;
} else if (name.startsWith("is")) {
i = 2;
}
return Character.toLowerCase(name.charAt(i)) + name.substring(i + 1);
} | [
"public",
"static",
"String",
"parsePropertyName",
"(",
"Method",
"method",
")",
"{",
"String",
"name",
"=",
"method",
".",
"getName",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"get\"",
")",
"||",
"name",
... | Parses the method name to return a property name if it is a getter or a setter.
@param method the method to evaluate
@return a property name
@since 4.1 | [
"Parses",
"the",
"method",
"name",
"to",
"return",
"a",
"property",
"name",
"if",
"it",
"is",
"a",
"getter",
"or",
"a",
"setter",
"."
] | 614d5f0b30daf82fc251a46fb436d0fc5e787627 | https://github.com/devnull-tools/trugger/blob/614d5f0b30daf82fc251a46fb436d0fc5e787627/src/main/java/tools/devnull/trugger/reflection/Reflection.java#L96-L105 | train |
devnull-tools/trugger | src/main/java/tools/devnull/trugger/reflection/Reflection.java | Reflection.invoke | public static <E> OptionalFunction<Selection<Method>, E> invoke(Object... args) {
return OptionalFunction.of(selection -> factory.createInvoker(selection.result()).on(selection.target()).withArgs(args));
} | java | public static <E> OptionalFunction<Selection<Method>, E> invoke(Object... args) {
return OptionalFunction.of(selection -> factory.createInvoker(selection.result()).on(selection.target()).withArgs(args));
} | [
"public",
"static",
"<",
"E",
">",
"OptionalFunction",
"<",
"Selection",
"<",
"Method",
">",
",",
"E",
">",
"invoke",
"(",
"Object",
"...",
"args",
")",
"{",
"return",
"OptionalFunction",
".",
"of",
"(",
"selection",
"->",
"factory",
".",
"createInvoker",
... | Returns a function that invokes a selected method.
@param args the arguments for invoking the method
@return a function that invokes a selected method | [
"Returns",
"a",
"function",
"that",
"invokes",
"a",
"selected",
"method",
"."
] | 614d5f0b30daf82fc251a46fb436d0fc5e787627 | https://github.com/devnull-tools/trugger/blob/614d5f0b30daf82fc251a46fb436d0fc5e787627/src/main/java/tools/devnull/trugger/reflection/Reflection.java#L164-L166 | train |
devnull-tools/trugger | src/main/java/tools/devnull/trugger/reflection/Reflection.java | Reflection.instantiate | public static <E> OptionalFunction<Selection<Constructor<?>>, E> instantiate(Object... args) {
return OptionalFunction.of(selection -> factory.createInvoker(selection.result()).withArgs(args));
} | java | public static <E> OptionalFunction<Selection<Constructor<?>>, E> instantiate(Object... args) {
return OptionalFunction.of(selection -> factory.createInvoker(selection.result()).withArgs(args));
} | [
"public",
"static",
"<",
"E",
">",
"OptionalFunction",
"<",
"Selection",
"<",
"Constructor",
"<",
"?",
">",
">",
",",
"E",
">",
"instantiate",
"(",
"Object",
"...",
"args",
")",
"{",
"return",
"OptionalFunction",
".",
"of",
"(",
"selection",
"->",
"facto... | Returns a function that invokes a selected constructor.
@param args the arguments for invoking the constructor
@return a function that invokes a selected constructor | [
"Returns",
"a",
"function",
"that",
"invokes",
"a",
"selected",
"constructor",
"."
] | 614d5f0b30daf82fc251a46fb436d0fc5e787627 | https://github.com/devnull-tools/trugger/blob/614d5f0b30daf82fc251a46fb436d0fc5e787627/src/main/java/tools/devnull/trugger/reflection/Reflection.java#L174-L176 | train |
devnull-tools/trugger | src/main/java/tools/devnull/trugger/reflection/Reflection.java | Reflection.getValue | public static <E> OptionalFunction<Selection<Field>, E> getValue() {
return OptionalFunction.of(selection -> factory.createHandler(selection.result()).on(selection.target()).getValue());
} | java | public static <E> OptionalFunction<Selection<Field>, E> getValue() {
return OptionalFunction.of(selection -> factory.createHandler(selection.result()).on(selection.target()).getValue());
} | [
"public",
"static",
"<",
"E",
">",
"OptionalFunction",
"<",
"Selection",
"<",
"Field",
">",
",",
"E",
">",
"getValue",
"(",
")",
"{",
"return",
"OptionalFunction",
".",
"of",
"(",
"selection",
"->",
"factory",
".",
"createHandler",
"(",
"selection",
".",
... | Returns a function that gets the value of a selected field.
@return a function that gets the value of a selected field. | [
"Returns",
"a",
"function",
"that",
"gets",
"the",
"value",
"of",
"a",
"selected",
"field",
"."
] | 614d5f0b30daf82fc251a46fb436d0fc5e787627 | https://github.com/devnull-tools/trugger/blob/614d5f0b30daf82fc251a46fb436d0fc5e787627/src/main/java/tools/devnull/trugger/reflection/Reflection.java#L183-L185 | train |
devnull-tools/trugger | src/main/java/tools/devnull/trugger/reflection/Reflection.java | Reflection.setValue | public static Consumer<Selection<Field>> setValue(Object newValue) {
return selection -> factory.createHandler(selection.result()).on(selection.target()).setValue(newValue);
} | java | public static Consumer<Selection<Field>> setValue(Object newValue) {
return selection -> factory.createHandler(selection.result()).on(selection.target()).setValue(newValue);
} | [
"public",
"static",
"Consumer",
"<",
"Selection",
"<",
"Field",
">",
">",
"setValue",
"(",
"Object",
"newValue",
")",
"{",
"return",
"selection",
"->",
"factory",
".",
"createHandler",
"(",
"selection",
".",
"result",
"(",
")",
")",
".",
"on",
"(",
"sele... | Returns a consumer that sets the value of a selected field.
@param newValue the value to set
@return a consumer that sets the value of a selected field. | [
"Returns",
"a",
"consumer",
"that",
"sets",
"the",
"value",
"of",
"a",
"selected",
"field",
"."
] | 614d5f0b30daf82fc251a46fb436d0fc5e787627 | https://github.com/devnull-tools/trugger/blob/614d5f0b30daf82fc251a46fb436d0fc5e787627/src/main/java/tools/devnull/trugger/reflection/Reflection.java#L193-L195 | train |
base2Services/kagura | services/example-authrest/src/main/java/com/base2/kagura/services/exampleRestAuth/MyAuthImpl.java | MyAuthImpl.users | public Object users() {
return new ArrayList<Map<String, Object>>()
{{
add(new HashMap<String, Object>()
{{
put("username","testUser1");
put("groups", Arrays.asList("group1"));
put("password","thisMechWillChange");
}});
add(new HashMap<String, Object>()
{{
put("username","testUser2");
put("groups", Arrays.asList("group2"));
put("password","thisMechWillChange");
}});
}};
} | java | public Object users() {
return new ArrayList<Map<String, Object>>()
{{
add(new HashMap<String, Object>()
{{
put("username","testUser1");
put("groups", Arrays.asList("group1"));
put("password","thisMechWillChange");
}});
add(new HashMap<String, Object>()
{{
put("username","testUser2");
put("groups", Arrays.asList("group2"));
put("password","thisMechWillChange");
}});
}};
} | [
"public",
"Object",
"users",
"(",
")",
"{",
"return",
"new",
"ArrayList",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"(",
")",
"{",
"{",
"add",
"(",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
"{",
"{",
"put",
"(",
"... | Avoiding adding extra dependencies, so using hash map. | [
"Avoiding",
"adding",
"extra",
"dependencies",
"so",
"using",
"hash",
"map",
"."
] | 5564aa71bfa2cb3baaae2eb098c6c673dd4e82ee | https://github.com/base2Services/kagura/blob/5564aa71bfa2cb3baaae2eb098c6c673dd4e82ee/services/example-authrest/src/main/java/com/base2/kagura/services/exampleRestAuth/MyAuthImpl.java#L26-L42 | train |
pierre/serialization | hadoop/src/main/java/com/ning/metrics/serialization/hadoop/SmileRecordReader.java | SmileRecordReader.nextKeyValue | @Override
public boolean nextKeyValue() throws IOException, InterruptedException
{
if (!deserializer.hasNextEvent()) {
return false;
}
else {
value = deserializer.getNextEvent();
key = value.getEventDateTime();
return true;
}
} | java | @Override
public boolean nextKeyValue() throws IOException, InterruptedException
{
if (!deserializer.hasNextEvent()) {
return false;
}
else {
value = deserializer.getNextEvent();
key = value.getEventDateTime();
return true;
}
} | [
"@",
"Override",
"public",
"boolean",
"nextKeyValue",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"!",
"deserializer",
".",
"hasNextEvent",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"value",
"=",
"des... | Read the next key, value pair.
@return true if a key/value pair was read
@throws java.io.IOException
@throws InterruptedException | [
"Read",
"the",
"next",
"key",
"value",
"pair",
"."
] | b15b7c749ba78bfe94dce8fc22f31b30b2e6830b | https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/hadoop/src/main/java/com/ning/metrics/serialization/hadoop/SmileRecordReader.java#L83-L94 | train |
pierre/serialization | hadoop/src/main/java/com/ning/metrics/serialization/hadoop/SmileRecordReader.java | SmileRecordReader.getProgress | @Override
public float getProgress() throws IOException, InterruptedException
{
if (start == end) {
return 0.0f;
}
else {
return Math.min(1.0f, (pos - start) / (float) (end - start));
}
} | java | @Override
public float getProgress() throws IOException, InterruptedException
{
if (start == end) {
return 0.0f;
}
else {
return Math.min(1.0f, (pos - start) / (float) (end - start));
}
} | [
"@",
"Override",
"public",
"float",
"getProgress",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"if",
"(",
"start",
"==",
"end",
")",
"{",
"return",
"0.0f",
";",
"}",
"else",
"{",
"return",
"Math",
".",
"min",
"(",
"1.0f",
",",
... | The current progress of the record reader through its data.
@return a number between 0.0 and 1.0 that is the fraction of the data read
@throws java.io.IOException
@throws InterruptedException | [
"The",
"current",
"progress",
"of",
"the",
"record",
"reader",
"through",
"its",
"data",
"."
] | b15b7c749ba78bfe94dce8fc22f31b30b2e6830b | https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/hadoop/src/main/java/com/ning/metrics/serialization/hadoop/SmileRecordReader.java#L129-L138 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.addAttr | public void addAttr(HtmlAttr attrName, String attrValue) {
if (attrs.isEmpty())
attrs = new LinkedHashMap<HtmlAttr,String>(3);
attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue));
} | java | public void addAttr(HtmlAttr attrName, String attrValue) {
if (attrs.isEmpty())
attrs = new LinkedHashMap<HtmlAttr,String>(3);
attrs.put(nullCheck(attrName), escapeHtmlChars(attrValue));
} | [
"public",
"void",
"addAttr",
"(",
"HtmlAttr",
"attrName",
",",
"String",
"attrValue",
")",
"{",
"if",
"(",
"attrs",
".",
"isEmpty",
"(",
")",
")",
"attrs",
"=",
"new",
"LinkedHashMap",
"<",
"HtmlAttr",
",",
"String",
">",
"(",
"3",
")",
";",
"attrs",
... | Adds an attribute for the HTML tag.
@param attrName name of the attribute
@param attrValue value of the attribute | [
"Adds",
"an",
"attribute",
"for",
"the",
"HTML",
"tag",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L80-L84 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.addContent | public void addContent(Content tagContent) {
if (tagContent instanceof ContentBuilder) {
for (Content content: ((ContentBuilder)tagContent).contents) {
addContent(content);
}
}
else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
if (content.isEmpty())
content = new ArrayList<Content>();
content.add(tagContent);
}
} | java | public void addContent(Content tagContent) {
if (tagContent instanceof ContentBuilder) {
for (Content content: ((ContentBuilder)tagContent).contents) {
addContent(content);
}
}
else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
if (content.isEmpty())
content = new ArrayList<Content>();
content.add(tagContent);
}
} | [
"public",
"void",
"addContent",
"(",
"Content",
"tagContent",
")",
"{",
"if",
"(",
"tagContent",
"instanceof",
"ContentBuilder",
")",
"{",
"for",
"(",
"Content",
"content",
":",
"(",
"(",
"ContentBuilder",
")",
"tagContent",
")",
".",
"contents",
")",
"{",
... | Adds content for the HTML tag.
@param tagContent tag content to be added | [
"Adds",
"content",
"for",
"the",
"HTML",
"tag",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L104-L115 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.A_NAME | public static HtmlTree A_NAME(String name, Content body) {
HtmlTree htmltree = HtmlTree.A_NAME(name);
htmltree.addContent(nullCheck(body));
return htmltree;
} | java | public static HtmlTree A_NAME(String name, Content body) {
HtmlTree htmltree = HtmlTree.A_NAME(name);
htmltree.addContent(nullCheck(body));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"A_NAME",
"(",
"String",
"name",
",",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"HtmlTree",
".",
"A_NAME",
"(",
"name",
")",
";",
"htmltree",
".",
"addContent",
"(",
"nullCheck",
"(",
"body",
")",
")",
";",... | Generates an HTML anchor tag with name attribute and content.
@param name name for the anchor tag
@param body content for the anchor tag
@return an HtmlTree object | [
"Generates",
"an",
"HTML",
"anchor",
"tag",
"with",
"name",
"attribute",
"and",
"content",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L232-L236 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.A_NAME | public static HtmlTree A_NAME(String name) {
HtmlTree htmltree = new HtmlTree(HtmlTag.A);
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
return htmltree;
} | java | public static HtmlTree A_NAME(String name) {
HtmlTree htmltree = new HtmlTree(HtmlTag.A);
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"A_NAME",
"(",
"String",
"name",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"A",
")",
";",
"htmltree",
".",
"addAttr",
"(",
"HtmlAttr",
".",
"NAME",
",",
"nullCheck",
"(",
"name",
")",
... | Generates an HTML anchor tag with name attribute.
@param name name for the anchor tag
@return an HtmlTree object | [
"Generates",
"an",
"HTML",
"anchor",
"tag",
"with",
"name",
"attribute",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L244-L248 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.FRAME | public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
if (scrolling != null)
htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
return htmltree;
} | java | public static HtmlTree FRAME(String src, String name, String title, String scrolling) {
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAME);
htmltree.addAttr(HtmlAttr.SRC, nullCheck(src));
htmltree.addAttr(HtmlAttr.NAME, nullCheck(name));
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
if (scrolling != null)
htmltree.addAttr(HtmlAttr.SCROLLING, scrolling);
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"FRAME",
"(",
"String",
"src",
",",
"String",
"name",
",",
"String",
"title",
",",
"String",
"scrolling",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"FRAME",
")",
";",
"htmltree",
".",
"... | Generates a FRAME tag.
@param src the url of the document to be shown in the frame
@param name specifies the name of the frame
@param title the title for the frame
@param scrolling specifies whether to display scrollbars in the frame
@return an HtmlTree object for the FRAME tag | [
"Generates",
"a",
"FRAME",
"tag",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L339-L347 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.FRAME | public static HtmlTree FRAME(String src, String name, String title) {
return FRAME(src, name, title, null);
} | java | public static HtmlTree FRAME(String src, String name, String title) {
return FRAME(src, name, title, null);
} | [
"public",
"static",
"HtmlTree",
"FRAME",
"(",
"String",
"src",
",",
"String",
"name",
",",
"String",
"title",
")",
"{",
"return",
"FRAME",
"(",
"src",
",",
"name",
",",
"title",
",",
"null",
")",
";",
"}"
] | Generates a Frame tag.
@param src the url of the document to be shown in the frame
@param name specifies the name of the frame
@param title the title for the frame
@return an HtmlTree object for the SPAN tag | [
"Generates",
"a",
"Frame",
"tag",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L357-L359 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.FRAMESET | public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
if (cols != null)
htmltree.addAttr(HtmlAttr.COLS, cols);
if (rows != null)
htmltree.addAttr(HtmlAttr.ROWS, rows);
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
return htmltree;
} | java | public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
if (cols != null)
htmltree.addAttr(HtmlAttr.COLS, cols);
if (rows != null)
htmltree.addAttr(HtmlAttr.ROWS, rows);
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"FRAMESET",
"(",
"String",
"cols",
",",
"String",
"rows",
",",
"String",
"title",
",",
"String",
"onload",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"FRAMESET",
")",
";",
"if",
"(",
"co... | Generates a FRAMESET tag.
@param cols the size of columns in the frameset
@param rows the size of rows in the frameset
@param title the title for the frameset
@param onload the script to run when the document loads
@return an HtmlTree object for the FRAMESET tag | [
"Generates",
"a",
"FRAMESET",
"tag",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L370-L379 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.TABLE | public static HtmlTree TABLE(HtmlStyle styleClass, int border, int cellPadding,
int cellSpacing, String summary, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
htmltree.addAttr(HtmlAttr.CELLPADDING, Integer.toString(cellPadding));
htmltree.addAttr(HtmlAttr.CELLSPACING, Integer.toString(cellSpacing));
htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
return htmltree;
} | java | public static HtmlTree TABLE(HtmlStyle styleClass, int border, int cellPadding,
int cellSpacing, String summary, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.TABLE, nullCheck(body));
if (styleClass != null)
htmltree.addStyle(styleClass);
htmltree.addAttr(HtmlAttr.BORDER, Integer.toString(border));
htmltree.addAttr(HtmlAttr.CELLPADDING, Integer.toString(cellPadding));
htmltree.addAttr(HtmlAttr.CELLSPACING, Integer.toString(cellSpacing));
htmltree.addAttr(HtmlAttr.SUMMARY, nullCheck(summary));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"TABLE",
"(",
"HtmlStyle",
"styleClass",
",",
"int",
"border",
",",
"int",
"cellPadding",
",",
"int",
"cellSpacing",
",",
"String",
"summary",
",",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"... | Generates a Table tag with style class, border, cell padding,
cellspacing and summary attributes and some content.
@param styleClass style of the table
@param border border for the table
@param cellPadding cell padding for the table
@param cellSpacing cell spacing for the table
@param summary summary for the table
@param body content for the table
@return an HtmlTree object for the TABLE tag | [
"Generates",
"a",
"Table",
"tag",
"with",
"style",
"class",
"border",
"cell",
"padding",
"cellspacing",
"and",
"summary",
"attributes",
"and",
"some",
"content",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L638-L648 | train |
lightblueseas/jcommons-lang | src/main/java/de/alpharogroup/shell/LinuxShellExecutor.java | LinuxShellExecutor.execute | public static String execute(final boolean withResponse, final String... command)
throws IOException
{
final List<String> commands = new ArrayList<>();
commands.add("bash");
commands.add("-c");
commands.addAll(Arrays.asList(command));
String response = "";
final ProcessBuilder pb = new ProcessBuilder(commands);
pb.redirectErrorStream(true);
final Process shell = pb.start();
if (withResponse)
{
try (InputStream shellIn = shell.getInputStream())
{
response = toString(shellIn);
}
}
return response;
} | java | public static String execute(final boolean withResponse, final String... command)
throws IOException
{
final List<String> commands = new ArrayList<>();
commands.add("bash");
commands.add("-c");
commands.addAll(Arrays.asList(command));
String response = "";
final ProcessBuilder pb = new ProcessBuilder(commands);
pb.redirectErrorStream(true);
final Process shell = pb.start();
if (withResponse)
{
try (InputStream shellIn = shell.getInputStream())
{
response = toString(shellIn);
}
}
return response;
} | [
"public",
"static",
"String",
"execute",
"(",
"final",
"boolean",
"withResponse",
",",
"final",
"String",
"...",
"command",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
"String",
">",
"commands",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"c... | Execute the given commands and return the result.
@param withResponse
the with response
@param command
the command(s)
@return the string
@throws IOException
Signals that an I/O exception has occurred. | [
"Execute",
"the",
"given",
"commands",
"and",
"return",
"the",
"result",
"."
] | 000e1f198e949ec3e721fd0fc3f5946e945232a3 | https://github.com/lightblueseas/jcommons-lang/blob/000e1f198e949ec3e721fd0fc3f5946e945232a3/src/main/java/de/alpharogroup/shell/LinuxShellExecutor.java#L55-L78 | train |
jcuda/jcufft | JCufftJava/src/main/java/jcuda/jcufft/JCufft.java | JCufft.checkResult | private static int checkResult(int result)
{
if (exceptionsEnabled && result != cufftResult.CUFFT_SUCCESS)
{
throw new CudaException(cufftResult.stringFor(result));
}
return result;
} | java | private static int checkResult(int result)
{
if (exceptionsEnabled && result != cufftResult.CUFFT_SUCCESS)
{
throw new CudaException(cufftResult.stringFor(result));
}
return result;
} | [
"private",
"static",
"int",
"checkResult",
"(",
"int",
"result",
")",
"{",
"if",
"(",
"exceptionsEnabled",
"&&",
"result",
"!=",
"cufftResult",
".",
"CUFFT_SUCCESS",
")",
"{",
"throw",
"new",
"CudaException",
"(",
"cufftResult",
".",
"stringFor",
"(",
"result"... | If the given result is different to cufftResult.CUFFT_SUCCESS and
exceptions have been enabled, this method will throw a
CudaException with an error message that corresponds to the
given result code. Otherwise, the given result is simply
returned.
@param result The result to check
@return The result that was given as the parameter
@throws CudaException If exceptions have been enabled and
the given result code is not cufftResult.CUFFT_SUCCESS | [
"If",
"the",
"given",
"result",
"is",
"different",
"to",
"cufftResult",
".",
"CUFFT_SUCCESS",
"and",
"exceptions",
"have",
"been",
"enabled",
"this",
"method",
"will",
"throw",
"a",
"CudaException",
"with",
"an",
"error",
"message",
"that",
"corresponds",
"to",
... | 833c87ffb0864f7ee7270fddef8af57f48939b3a | https://github.com/jcuda/jcufft/blob/833c87ffb0864f7ee7270fddef8af57f48939b3a/JCufftJava/src/main/java/jcuda/jcufft/JCufft.java#L140-L147 | train |
wanglinsong/th-lipermi | src/main/java/net/sf/lipermi/handler/CallProxy.java | CallProxy.invoke | @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return connectionHandler.remoteInvocation(proxy, method, args);
} | java | @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return connectionHandler.remoteInvocation(proxy, method, args);
} | [
"@",
"Override",
"public",
"Object",
"invoke",
"(",
"Object",
"proxy",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"Throwable",
"{",
"return",
"connectionHandler",
".",
"remoteInvocation",
"(",
"proxy",
",",
"method",
",",
"args"... | Delegates call to this proxy to it's ConnectionHandler
@throws java.lang.Throwable any error | [
"Delegates",
"call",
"to",
"this",
"proxy",
"to",
"it",
"s",
"ConnectionHandler"
] | 5fa9ab1d7085b5133dc37ce3ba201d44a7bf25f0 | https://github.com/wanglinsong/th-lipermi/blob/5fa9ab1d7085b5133dc37ce3ba201d44a7bf25f0/src/main/java/net/sf/lipermi/handler/CallProxy.java#L58-L61 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/ImageUtils.java | ImageUtils.getImageReader | public static ImageReader getImageReader(final Object sourceImage) throws IOException {
ImageInputStream imageInputStream = ImageIO.createImageInputStream(sourceImage);
Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(imageInputStream);
ImageReader destinationImageReader = null;
if (imageReaders.hasNext()) {
destinationImageReader = imageReaders.next();
setImageReaderHaveInputStream(destinationImageReader, imageInputStream);
}
return destinationImageReader;
} | java | public static ImageReader getImageReader(final Object sourceImage) throws IOException {
ImageInputStream imageInputStream = ImageIO.createImageInputStream(sourceImage);
Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(imageInputStream);
ImageReader destinationImageReader = null;
if (imageReaders.hasNext()) {
destinationImageReader = imageReaders.next();
setImageReaderHaveInputStream(destinationImageReader, imageInputStream);
}
return destinationImageReader;
} | [
"public",
"static",
"ImageReader",
"getImageReader",
"(",
"final",
"Object",
"sourceImage",
")",
"throws",
"IOException",
"{",
"ImageInputStream",
"imageInputStream",
"=",
"ImageIO",
".",
"createImageInputStream",
"(",
"sourceImage",
")",
";",
"Iterator",
"<",
"ImageR... | Get image reader from given source image.
@param sourceImage
the image object you want to handle.
@return an image read object has given source image data.
@throws IOException | [
"Get",
"image",
"reader",
"from",
"given",
"source",
"image",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/ImageUtils.java#L39-L49 | train |
defei/codelogger-utils | src/main/java/org/codelogger/utils/ImageUtils.java | ImageUtils.getImageReaderFromHttpImage | public static ImageReader getImageReaderFromHttpImage(final String sourceImageHttpURL)
throws IOException {
InputStream inputStream = new URL(sourceImageHttpURL).openConnection().getInputStream();
return getImageReader(inputStream);
} | java | public static ImageReader getImageReaderFromHttpImage(final String sourceImageHttpURL)
throws IOException {
InputStream inputStream = new URL(sourceImageHttpURL).openConnection().getInputStream();
return getImageReader(inputStream);
} | [
"public",
"static",
"ImageReader",
"getImageReaderFromHttpImage",
"(",
"final",
"String",
"sourceImageHttpURL",
")",
"throws",
"IOException",
"{",
"InputStream",
"inputStream",
"=",
"new",
"URL",
"(",
"sourceImageHttpURL",
")",
".",
"openConnection",
"(",
")",
".",
... | Get image reader from given web image.
@param sourceImageHttpURL
the web image object you want to handle.
@return an image read object has given source image data.
@throws IOException | [
"Get",
"image",
"reader",
"from",
"given",
"web",
"image",
"."
] | d906f5d217b783c7ae3e53442cd6fb87b20ecc0a | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/ImageUtils.java#L59-L64 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/util/Context.java | Context.get | public <T> T get(Key<T> key) {
checkState(ht);
Object o = ht.get(key);
if (o instanceof Factory<?>) {
Factory<?> fac = (Factory<?>)o;
o = fac.make(this);
if (o instanceof Factory<?>)
throw new AssertionError("T extends Context.Factory");
Assert.check(ht.get(key) == o);
}
/* The following cast can't fail unless there was
* cheating elsewhere, because of the invariant on ht.
* Since we found a key of type Key<T>, the value must
* be of type T.
*/
return Context.<T>uncheckedCast(o);
} | java | public <T> T get(Key<T> key) {
checkState(ht);
Object o = ht.get(key);
if (o instanceof Factory<?>) {
Factory<?> fac = (Factory<?>)o;
o = fac.make(this);
if (o instanceof Factory<?>)
throw new AssertionError("T extends Context.Factory");
Assert.check(ht.get(key) == o);
}
/* The following cast can't fail unless there was
* cheating elsewhere, because of the invariant on ht.
* Since we found a key of type Key<T>, the value must
* be of type T.
*/
return Context.<T>uncheckedCast(o);
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"Key",
"<",
"T",
">",
"key",
")",
"{",
"checkState",
"(",
"ht",
")",
";",
"Object",
"o",
"=",
"ht",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"o",
"instanceof",
"Factory",
"<",
"?",
">",
")",
"{"... | Get the value for the key in this context. | [
"Get",
"the",
"value",
"for",
"the",
"key",
"in",
"this",
"context",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/util/Context.java#L145-L162 | train |
brianwhu/xillium | core/src/main/java/org/xillium/core/util/RemoteServiceChannel.java | RemoteServiceChannel.configure | protected void configure(Properties p) {
_properties = p;
_host = (String)p.remove(HOST);
if (_host == null) throw new NoSuchElementException(HOST);
_path = (String)p.remove(PATH);
if (_path == null) throw new NoSuchElementException(PATH);
} | java | protected void configure(Properties p) {
_properties = p;
_host = (String)p.remove(HOST);
if (_host == null) throw new NoSuchElementException(HOST);
_path = (String)p.remove(PATH);
if (_path == null) throw new NoSuchElementException(PATH);
} | [
"protected",
"void",
"configure",
"(",
"Properties",
"p",
")",
"{",
"_properties",
"=",
"p",
";",
"_host",
"=",
"(",
"String",
")",
"p",
".",
"remove",
"(",
"HOST",
")",
";",
"if",
"(",
"_host",
"==",
"null",
")",
"throw",
"new",
"NoSuchElementExceptio... | Configures the RemoteServiceChannel with given properties. | [
"Configures",
"the",
"RemoteServiceChannel",
"with",
"given",
"properties",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/util/RemoteServiceChannel.java#L62-L68 | train |
brianwhu/xillium | gear/src/main/java/org/xillium/gear/util/RemoteSynchronization.java | RemoteSynchronization.call | public <T> RemoteService.Response call(long pause, Functor<T, String> reporter) throws Exception {
String message = null;
while (true) {
RemoteService.Response response = _caller.call();
String news = response.params.get("message");
if (news == null) {
if (_state != null && message != null) {
_state.param = null;
_state.markAttempt();
}
return response;
} else {
if (!news.equals(message)) {
if (_state != null) {
if (reporter != null) reporter.invoke("Attempting " + _state.state + ": " + news);
_state.param = Progressive.State.clean(news);
_state.markAttempt();
} else {
if (reporter != null) reporter.invoke(news);
}
message = news;
}
Thread.sleep(pause < PAUSE_BETWEEN_RETRIES ? PAUSE_BETWEEN_RETRIES : pause);
}
}
} | java | public <T> RemoteService.Response call(long pause, Functor<T, String> reporter) throws Exception {
String message = null;
while (true) {
RemoteService.Response response = _caller.call();
String news = response.params.get("message");
if (news == null) {
if (_state != null && message != null) {
_state.param = null;
_state.markAttempt();
}
return response;
} else {
if (!news.equals(message)) {
if (_state != null) {
if (reporter != null) reporter.invoke("Attempting " + _state.state + ": " + news);
_state.param = Progressive.State.clean(news);
_state.markAttempt();
} else {
if (reporter != null) reporter.invoke(news);
}
message = news;
}
Thread.sleep(pause < PAUSE_BETWEEN_RETRIES ? PAUSE_BETWEEN_RETRIES : pause);
}
}
} | [
"public",
"<",
"T",
">",
"RemoteService",
".",
"Response",
"call",
"(",
"long",
"pause",
",",
"Functor",
"<",
"T",
",",
"String",
">",
"reporter",
")",
"throws",
"Exception",
"{",
"String",
"message",
"=",
"null",
";",
"while",
"(",
"true",
")",
"{",
... | Calls the remote service continuously until a "final" response is received, reporting progress messages
via the reporter. | [
"Calls",
"the",
"remote",
"service",
"continuously",
"until",
"a",
"final",
"response",
"is",
"received",
"reporting",
"progress",
"messages",
"via",
"the",
"reporter",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/gear/src/main/java/org/xillium/gear/util/RemoteSynchronization.java#L51-L78 | train |
brianwhu/xillium | gear/src/main/java/org/xillium/gear/util/LeastRecentlyUsedCache.java | LeastRecentlyUsedCache.invalidate | public synchronized V invalidate(K key) {
Singleton<V> singleton = _cache.get(key);
if (singleton != null) {
return singleton.clear();
} else {
return null;
}
} | java | public synchronized V invalidate(K key) {
Singleton<V> singleton = _cache.get(key);
if (singleton != null) {
return singleton.clear();
} else {
return null;
}
} | [
"public",
"synchronized",
"V",
"invalidate",
"(",
"K",
"key",
")",
"{",
"Singleton",
"<",
"V",
">",
"singleton",
"=",
"_cache",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"singleton",
"!=",
"null",
")",
"{",
"return",
"singleton",
".",
"clear",
"("... | Invalidates an entry in the cache. This operation does not constitute a cache replacement.
@param key the identity of the object
@return the matching object that is being discarded, if any | [
"Invalidates",
"an",
"entry",
"in",
"the",
"cache",
".",
"This",
"operation",
"does",
"not",
"constitute",
"a",
"cache",
"replacement",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/gear/src/main/java/org/xillium/gear/util/LeastRecentlyUsedCache.java#L86-L93 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/code/Symbol.java | Symbol.getRawAttributes | public List<Attribute.Compound> getRawAttributes() {
return (metadata == null)
? List.<Attribute.Compound>nil()
: metadata.getDeclarationAttributes();
} | java | public List<Attribute.Compound> getRawAttributes() {
return (metadata == null)
? List.<Attribute.Compound>nil()
: metadata.getDeclarationAttributes();
} | [
"public",
"List",
"<",
"Attribute",
".",
"Compound",
">",
"getRawAttributes",
"(",
")",
"{",
"return",
"(",
"metadata",
"==",
"null",
")",
"?",
"List",
".",
"<",
"Attribute",
".",
"Compound",
">",
"nil",
"(",
")",
":",
"metadata",
".",
"getDeclarationAtt... | An accessor method for the attributes of this symbol.
Attributes of class symbols should be accessed through the accessor
method to make sure that the class symbol is loaded. | [
"An",
"accessor",
"method",
"for",
"the",
"attributes",
"of",
"this",
"symbol",
".",
"Attributes",
"of",
"class",
"symbols",
"should",
"be",
"accessed",
"through",
"the",
"accessor",
"method",
"to",
"make",
"sure",
"that",
"the",
"class",
"symbol",
"is",
"lo... | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Symbol.java#L110-L114 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/code/Symbol.java | Symbol.getRawTypeAttributes | public List<Attribute.TypeCompound> getRawTypeAttributes() {
return (metadata == null)
? List.<Attribute.TypeCompound>nil()
: metadata.getTypeAttributes();
} | java | public List<Attribute.TypeCompound> getRawTypeAttributes() {
return (metadata == null)
? List.<Attribute.TypeCompound>nil()
: metadata.getTypeAttributes();
} | [
"public",
"List",
"<",
"Attribute",
".",
"TypeCompound",
">",
"getRawTypeAttributes",
"(",
")",
"{",
"return",
"(",
"metadata",
"==",
"null",
")",
"?",
"List",
".",
"<",
"Attribute",
".",
"TypeCompound",
">",
"nil",
"(",
")",
":",
"metadata",
".",
"getTy... | An accessor method for the type attributes of this symbol.
Attributes of class symbols should be accessed through the accessor
method to make sure that the class symbol is loaded. | [
"An",
"accessor",
"method",
"for",
"the",
"type",
"attributes",
"of",
"this",
"symbol",
".",
"Attributes",
"of",
"class",
"symbols",
"should",
"be",
"accessed",
"through",
"the",
"accessor",
"method",
"to",
"make",
"sure",
"that",
"the",
"class",
"symbol",
"... | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Symbol.java#L120-L124 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/code/Symbol.java | Symbol.enclClass | public ClassSymbol enclClass() {
Symbol c = this;
while (c != null &&
((c.kind & TYP) == 0 || !c.type.hasTag(CLASS))) {
c = c.owner;
}
return (ClassSymbol)c;
} | java | public ClassSymbol enclClass() {
Symbol c = this;
while (c != null &&
((c.kind & TYP) == 0 || !c.type.hasTag(CLASS))) {
c = c.owner;
}
return (ClassSymbol)c;
} | [
"public",
"ClassSymbol",
"enclClass",
"(",
")",
"{",
"Symbol",
"c",
"=",
"this",
";",
"while",
"(",
"c",
"!=",
"null",
"&&",
"(",
"(",
"c",
".",
"kind",
"&",
"TYP",
")",
"==",
"0",
"||",
"!",
"c",
".",
"type",
".",
"hasTag",
"(",
"CLASS",
")",
... | The closest enclosing class of this symbol's declaration. | [
"The",
"closest",
"enclosing",
"class",
"of",
"this",
"symbol",
"s",
"declaration",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Symbol.java#L413-L420 | train |
brianwhu/xillium | base/src/main/java/org/xillium/base/util/Mathematical.java | Mathematical.floor | public static int floor(int n, int m) {
return n >= 0 ? (n / m) * m : ((n - m + 1) / m) * m;
} | java | public static int floor(int n, int m) {
return n >= 0 ? (n / m) * m : ((n - m + 1) / m) * m;
} | [
"public",
"static",
"int",
"floor",
"(",
"int",
"n",
",",
"int",
"m",
")",
"{",
"return",
"n",
">=",
"0",
"?",
"(",
"n",
"/",
"m",
")",
"*",
"m",
":",
"(",
"(",
"n",
"-",
"m",
"+",
"1",
")",
"/",
"m",
")",
"*",
"m",
";",
"}"
] | Rounds n down to the nearest multiple of m
@param n an integer
@param m an integer
@return the value after rounding {@code n} down to the nearest multiple of {@code m} | [
"Rounds",
"n",
"down",
"to",
"the",
"nearest",
"multiple",
"of",
"m"
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/util/Mathematical.java#L15-L17 | train |
brianwhu/xillium | base/src/main/java/org/xillium/base/util/Mathematical.java | Mathematical.ceiling | public static int ceiling(int n, int m) {
return n >= 0 ? ((n + m - 1) / m) * m : (n / m) * m;
} | java | public static int ceiling(int n, int m) {
return n >= 0 ? ((n + m - 1) / m) * m : (n / m) * m;
} | [
"public",
"static",
"int",
"ceiling",
"(",
"int",
"n",
",",
"int",
"m",
")",
"{",
"return",
"n",
">=",
"0",
"?",
"(",
"(",
"n",
"+",
"m",
"-",
"1",
")",
"/",
"m",
")",
"*",
"m",
":",
"(",
"n",
"/",
"m",
")",
"*",
"m",
";",
"}"
] | Rounds n up to the nearest multiple of m
@param n an integer
@param m an integer
@return the value after rounding {@code n} up to the nearest multiple of {@code m} | [
"Rounds",
"n",
"up",
"to",
"the",
"nearest",
"multiple",
"of",
"m"
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/util/Mathematical.java#L37-L39 | train |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/provider/newrelic/PluginComponentCache.java | PluginComponentCache.add | public void add(Collection<PluginComponent> components)
{
for(PluginComponent component : components)
this.components.put(component.getId(), component);
} | java | public void add(Collection<PluginComponent> components)
{
for(PluginComponent component : components)
this.components.put(component.getId(), component);
} | [
"public",
"void",
"add",
"(",
"Collection",
"<",
"PluginComponent",
">",
"components",
")",
"{",
"for",
"(",
"PluginComponent",
"component",
":",
"components",
")",
"this",
".",
"components",
".",
"put",
"(",
"component",
".",
"getId",
"(",
")",
",",
"comp... | Adds the plugin component list to the plugin components for the account.
@param components The plugin components to add | [
"Adds",
"the",
"plugin",
"component",
"list",
"to",
"the",
"plugin",
"components",
"for",
"the",
"account",
"."
] | c48904f7e8d029fd45357811ec38a735e261e3fd | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/PluginComponentCache.java#L67-L71 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java | ZipFileIndex.checkIndex | private void checkIndex() throws IOException {
boolean isUpToDate = true;
if (!isUpToDate()) {
closeFile();
isUpToDate = false;
}
if (zipRandomFile != null || isUpToDate) {
lastReferenceTimeStamp = System.currentTimeMillis();
return;
}
hasPopulatedData = true;
if (readIndex()) {
lastReferenceTimeStamp = System.currentTimeMillis();
return;
}
directories = Collections.<RelativeDirectory, DirectoryEntry>emptyMap();
allDirs = Collections.<RelativeDirectory>emptySet();
try {
openFile();
long totalLength = zipRandomFile.length();
ZipDirectory directory = new ZipDirectory(zipRandomFile, 0L, totalLength, this);
directory.buildIndex();
} finally {
if (zipRandomFile != null) {
closeFile();
}
}
lastReferenceTimeStamp = System.currentTimeMillis();
} | java | private void checkIndex() throws IOException {
boolean isUpToDate = true;
if (!isUpToDate()) {
closeFile();
isUpToDate = false;
}
if (zipRandomFile != null || isUpToDate) {
lastReferenceTimeStamp = System.currentTimeMillis();
return;
}
hasPopulatedData = true;
if (readIndex()) {
lastReferenceTimeStamp = System.currentTimeMillis();
return;
}
directories = Collections.<RelativeDirectory, DirectoryEntry>emptyMap();
allDirs = Collections.<RelativeDirectory>emptySet();
try {
openFile();
long totalLength = zipRandomFile.length();
ZipDirectory directory = new ZipDirectory(zipRandomFile, 0L, totalLength, this);
directory.buildIndex();
} finally {
if (zipRandomFile != null) {
closeFile();
}
}
lastReferenceTimeStamp = System.currentTimeMillis();
} | [
"private",
"void",
"checkIndex",
"(",
")",
"throws",
"IOException",
"{",
"boolean",
"isUpToDate",
"=",
"true",
";",
"if",
"(",
"!",
"isUpToDate",
"(",
")",
")",
"{",
"closeFile",
"(",
")",
";",
"isUpToDate",
"=",
"false",
";",
"}",
"if",
"(",
"zipRando... | Here we need to make sure that the ZipFileIndex is valid. Check the timestamp of the file and
if its the same as the one at the time the index was build we don't need to reopen anything. | [
"Here",
"we",
"need",
"to",
"make",
"sure",
"that",
"the",
"ZipFileIndex",
"is",
"valid",
".",
"Check",
"the",
"timestamp",
"of",
"the",
"file",
"and",
"if",
"its",
"the",
"same",
"as",
"the",
"one",
"at",
"the",
"time",
"the",
"index",
"was",
"build",... | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java#L165-L199 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java | ZipFileIndex.getZipIndexEntry | synchronized Entry getZipIndexEntry(RelativePath path) {
try {
checkIndex();
DirectoryEntry de = directories.get(path.dirname());
String lookFor = path.basename();
return (de == null) ? null : de.getEntry(lookFor);
}
catch (IOException e) {
return null;
}
} | java | synchronized Entry getZipIndexEntry(RelativePath path) {
try {
checkIndex();
DirectoryEntry de = directories.get(path.dirname());
String lookFor = path.basename();
return (de == null) ? null : de.getEntry(lookFor);
}
catch (IOException e) {
return null;
}
} | [
"synchronized",
"Entry",
"getZipIndexEntry",
"(",
"RelativePath",
"path",
")",
"{",
"try",
"{",
"checkIndex",
"(",
")",
";",
"DirectoryEntry",
"de",
"=",
"directories",
".",
"get",
"(",
"path",
".",
"dirname",
"(",
")",
")",
";",
"String",
"lookFor",
"=",
... | Returns the ZipFileIndexEntry for a path, if there is one. | [
"Returns",
"the",
"ZipFileIndexEntry",
"for",
"a",
"path",
"if",
"there",
"is",
"one",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java#L233-L243 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java | ZipFileIndex.getFiles | public synchronized com.sun.tools.javac.util.List<String> getFiles(RelativeDirectory path) {
try {
checkIndex();
DirectoryEntry de = directories.get(path);
com.sun.tools.javac.util.List<String> ret = de == null ? null : de.getFiles();
if (ret == null) {
return com.sun.tools.javac.util.List.<String>nil();
}
return ret;
}
catch (IOException e) {
return com.sun.tools.javac.util.List.<String>nil();
}
} | java | public synchronized com.sun.tools.javac.util.List<String> getFiles(RelativeDirectory path) {
try {
checkIndex();
DirectoryEntry de = directories.get(path);
com.sun.tools.javac.util.List<String> ret = de == null ? null : de.getFiles();
if (ret == null) {
return com.sun.tools.javac.util.List.<String>nil();
}
return ret;
}
catch (IOException e) {
return com.sun.tools.javac.util.List.<String>nil();
}
} | [
"public",
"synchronized",
"com",
".",
"sun",
".",
"tools",
".",
"javac",
".",
"util",
".",
"List",
"<",
"String",
">",
"getFiles",
"(",
"RelativeDirectory",
"path",
")",
"{",
"try",
"{",
"checkIndex",
"(",
")",
";",
"DirectoryEntry",
"de",
"=",
"director... | Returns a javac List of filenames within a directory in the ZipFileIndex. | [
"Returns",
"a",
"javac",
"List",
"of",
"filenames",
"within",
"a",
"directory",
"in",
"the",
"ZipFileIndex",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java#L248-L263 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java | ZipFileIndex.contains | public synchronized boolean contains(RelativePath path) {
try {
checkIndex();
return getZipIndexEntry(path) != null;
}
catch (IOException e) {
return false;
}
} | java | public synchronized boolean contains(RelativePath path) {
try {
checkIndex();
return getZipIndexEntry(path) != null;
}
catch (IOException e) {
return false;
}
} | [
"public",
"synchronized",
"boolean",
"contains",
"(",
"RelativePath",
"path",
")",
"{",
"try",
"{",
"checkIndex",
"(",
")",
";",
"return",
"getZipIndexEntry",
"(",
"path",
")",
"!=",
"null",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"return",
... | Tests if a specific path exists in the zip. This method will return true
for file entries and directories.
@param path A path within the zip.
@return True if the path is a file or dir, false otherwise. | [
"Tests",
"if",
"a",
"specific",
"path",
"exists",
"in",
"the",
"zip",
".",
"This",
"method",
"will",
"return",
"true",
"for",
"file",
"entries",
"and",
"directories",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java#L304-L312 | train |
pierre/serialization | common/src/main/java/com/ning/metrics/serialization/event/Events.java | Events.fromFile | public static List<Event> fromFile(final File file) throws IOException, ClassNotFoundException
{
return fromInputStream(new FileInputStream(file));
} | java | public static List<Event> fromFile(final File file) throws IOException, ClassNotFoundException
{
return fromInputStream(new FileInputStream(file));
} | [
"public",
"static",
"List",
"<",
"Event",
">",
"fromFile",
"(",
"final",
"File",
"file",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"return",
"fromInputStream",
"(",
"new",
"FileInputStream",
"(",
"file",
")",
")",
";",
"}"
] | Given a file written by the serialization-writer library, extract all events.
This assumes the file was written using ObjectOutputStream.
@param file file to deserialize
@return events contained in the file
@throws java.io.IOException generic IOException
@throws ClassNotFoundException if the underlying Event class is not in the classpath | [
"Given",
"a",
"file",
"written",
"by",
"the",
"serialization",
"-",
"writer",
"library",
"extract",
"all",
"events",
".",
"This",
"assumes",
"the",
"file",
"was",
"written",
"using",
"ObjectOutputStream",
"."
] | b15b7c749ba78bfe94dce8fc22f31b30b2e6830b | https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/common/src/main/java/com/ning/metrics/serialization/event/Events.java#L38-L41 | train |
redlink-gmbh/redlink-java-sdk | src/main/java/io/redlink/sdk/impl/data/model/LDPathResult.java | LDPathResult.add | public boolean add(String field, List<RDFNode> result) {
this.result.put(field, result);
return true;
} | java | public boolean add(String field, List<RDFNode> result) {
this.result.put(field, result);
return true;
} | [
"public",
"boolean",
"add",
"(",
"String",
"field",
",",
"List",
"<",
"RDFNode",
">",
"result",
")",
"{",
"this",
".",
"result",
".",
"put",
"(",
"field",
",",
"result",
")",
";",
"return",
"true",
";",
"}"
] | Add a new result
@param field
@param result
@return | [
"Add",
"a",
"new",
"result"
] | c412ff11bd80da52ade09f2483ab29cdbff5a28a | https://github.com/redlink-gmbh/redlink-java-sdk/blob/c412ff11bd80da52ade09f2483ab29cdbff5a28a/src/main/java/io/redlink/sdk/impl/data/model/LDPathResult.java#L58-L61 | train |
redlink-gmbh/redlink-java-sdk | src/main/java/io/redlink/sdk/impl/data/model/LDPathResult.java | LDPathResult.add | public boolean add(String field, RDFNode result) {
if (!this.result.containsKey(field)) {
this.result.put(field, new ArrayList<RDFNode>());
}
this.result.get(field).add(result);
return true;
} | java | public boolean add(String field, RDFNode result) {
if (!this.result.containsKey(field)) {
this.result.put(field, new ArrayList<RDFNode>());
}
this.result.get(field).add(result);
return true;
} | [
"public",
"boolean",
"add",
"(",
"String",
"field",
",",
"RDFNode",
"result",
")",
"{",
"if",
"(",
"!",
"this",
".",
"result",
".",
"containsKey",
"(",
"field",
")",
")",
"{",
"this",
".",
"result",
".",
"put",
"(",
"field",
",",
"new",
"ArrayList",
... | Add a single result
@param field
@param result
@return | [
"Add",
"a",
"single",
"result"
] | c412ff11bd80da52ade09f2483ab29cdbff5a28a | https://github.com/redlink-gmbh/redlink-java-sdk/blob/c412ff11bd80da52ade09f2483ab29cdbff5a28a/src/main/java/io/redlink/sdk/impl/data/model/LDPathResult.java#L70-L76 | train |
mcpat/microjiac-public | tools/microjiac-midlet-maven-plugin/src/main/java/de/jiac/micro/util/ReducedArchiver.java | ReducedArchiver.getManifest | public Manifest getManifest(MavenProject project, ManifestConfiguration config) throws ManifestException, DependencyResolutionRequiredException {
// Added basic entries
Manifest m = new Manifest();
Manifest.Attribute buildAttr = new Manifest.Attribute("Built-By", System.getProperty("user.name"));
m.addConfiguredAttribute(buildAttr);
Manifest.Attribute createdAttr = new Manifest.Attribute("Created-By", "Apache Maven");
m.addConfiguredAttribute(createdAttr);
if (config.getPackageName() != null) {
Manifest.Attribute packageAttr = new Manifest.Attribute("Package", config.getPackageName());
m.addConfiguredAttribute(packageAttr);
}
Manifest.Attribute buildJdkAttr = new Manifest.Attribute("Build-Jdk", System.getProperty("java.version"));
m.addConfiguredAttribute(buildJdkAttr);
if (config.isAddClasspath()) {
StringBuffer classpath = new StringBuffer();
List artifacts = project.getRuntimeClasspathElements();
String classpathPrefix = config.getClasspathPrefix();
for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
File f = new File((String) iter.next());
if (f.isFile()) {
if (classpath.length() > 0) {
classpath.append(" ");
}
classpath.append(classpathPrefix);
classpath.append(f.getName());
}
}
if (classpath.length() > 0) {
Manifest.Attribute classpathAttr = new Manifest.Attribute("Class-Path", classpath.toString());
m.addConfiguredAttribute(classpathAttr);
}
}
String mainClass = config.getMainClass();
if (mainClass != null && !"".equals(mainClass)) {
Manifest.Attribute mainClassAttr = new Manifest.Attribute("Main-Class", mainClass);
m.addConfiguredAttribute(mainClassAttr);
}
return m;
} | java | public Manifest getManifest(MavenProject project, ManifestConfiguration config) throws ManifestException, DependencyResolutionRequiredException {
// Added basic entries
Manifest m = new Manifest();
Manifest.Attribute buildAttr = new Manifest.Attribute("Built-By", System.getProperty("user.name"));
m.addConfiguredAttribute(buildAttr);
Manifest.Attribute createdAttr = new Manifest.Attribute("Created-By", "Apache Maven");
m.addConfiguredAttribute(createdAttr);
if (config.getPackageName() != null) {
Manifest.Attribute packageAttr = new Manifest.Attribute("Package", config.getPackageName());
m.addConfiguredAttribute(packageAttr);
}
Manifest.Attribute buildJdkAttr = new Manifest.Attribute("Build-Jdk", System.getProperty("java.version"));
m.addConfiguredAttribute(buildJdkAttr);
if (config.isAddClasspath()) {
StringBuffer classpath = new StringBuffer();
List artifacts = project.getRuntimeClasspathElements();
String classpathPrefix = config.getClasspathPrefix();
for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
File f = new File((String) iter.next());
if (f.isFile()) {
if (classpath.length() > 0) {
classpath.append(" ");
}
classpath.append(classpathPrefix);
classpath.append(f.getName());
}
}
if (classpath.length() > 0) {
Manifest.Attribute classpathAttr = new Manifest.Attribute("Class-Path", classpath.toString());
m.addConfiguredAttribute(classpathAttr);
}
}
String mainClass = config.getMainClass();
if (mainClass != null && !"".equals(mainClass)) {
Manifest.Attribute mainClassAttr = new Manifest.Attribute("Main-Class", mainClass);
m.addConfiguredAttribute(mainClassAttr);
}
return m;
} | [
"public",
"Manifest",
"getManifest",
"(",
"MavenProject",
"project",
",",
"ManifestConfiguration",
"config",
")",
"throws",
"ManifestException",
",",
"DependencyResolutionRequiredException",
"{",
"// Added basic entries",
"Manifest",
"m",
"=",
"new",
"Manifest",
"(",
")",... | Return a pre-configured manifest
@todo Add user attributes list and user groups list | [
"Return",
"a",
"pre",
"-",
"configured",
"manifest"
] | 3c649e44846981a68e84cc4578719532414d8d35 | https://github.com/mcpat/microjiac-public/blob/3c649e44846981a68e84cc4578719532414d8d35/tools/microjiac-midlet-maven-plugin/src/main/java/de/jiac/micro/util/ReducedArchiver.java#L60-L105 | train |
coopernurse/barrister-java | src/main/java/com/bitmechanic/barrister/RpcResponse.java | RpcResponse.marshal | @SuppressWarnings("unchecked")
public Map marshal() {
HashMap map = new HashMap();
map.put("jsonrpc", "2.0");
if (id != null)
map.put("id", id);
if (error != null)
map.put("error", error.toMap());
else
map.put("result", result);
return map;
} | java | @SuppressWarnings("unchecked")
public Map marshal() {
HashMap map = new HashMap();
map.put("jsonrpc", "2.0");
if (id != null)
map.put("id", id);
if (error != null)
map.put("error", error.toMap());
else
map.put("result", result);
return map;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Map",
"marshal",
"(",
")",
"{",
"HashMap",
"map",
"=",
"new",
"HashMap",
"(",
")",
";",
"map",
".",
"put",
"(",
"\"jsonrpc\"",
",",
"\"2.0\"",
")",
";",
"if",
"(",
"id",
"!=",
"null",
")"... | Marshals this response to a Map that can be serialized | [
"Marshals",
"this",
"response",
"to",
"a",
"Map",
"that",
"can",
"be",
"serialized"
] | c2b639634c88a25002b66d1fb4a8f5fb51ade6a2 | https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/RpcResponse.java#L83-L94 | train |
brianwhu/xillium | core/src/main/java/org/xillium/core/util/ServiceModule.java | ServiceModule.scan | public static void scan(ServletContext c, Set<String> jars, Functor<Void, ServiceModule>collector, Logger logger) {
for (String j : jars) {
logger.config("... " + j);
try (JarInputStream jis = new JarInputStream(j.startsWith("/") ? c.getResourceAsStream(j) : new URL(j).openStream())) {
Attributes attrs = jis.getManifest().getMainAttributes();
String d = attrs.getValue(DOMAIN_NAME), n = attrs.getValue(MODULE_NAME), s = attrs.getValue(SIMPLE_NAME);
if (d != null && n != null && s != null) {
collector.invoke(new ServiceModule(d, n, s, attrs.getValue(MODULE_BASE), j));
}
} catch (IOException x) {
logger.log(Level.WARNING, "Unexpected error during jar inspection, ignored", x);
} catch (Exception x) {
logger.config("Unknown resource ignored");
}
}
} | java | public static void scan(ServletContext c, Set<String> jars, Functor<Void, ServiceModule>collector, Logger logger) {
for (String j : jars) {
logger.config("... " + j);
try (JarInputStream jis = new JarInputStream(j.startsWith("/") ? c.getResourceAsStream(j) : new URL(j).openStream())) {
Attributes attrs = jis.getManifest().getMainAttributes();
String d = attrs.getValue(DOMAIN_NAME), n = attrs.getValue(MODULE_NAME), s = attrs.getValue(SIMPLE_NAME);
if (d != null && n != null && s != null) {
collector.invoke(new ServiceModule(d, n, s, attrs.getValue(MODULE_BASE), j));
}
} catch (IOException x) {
logger.log(Level.WARNING, "Unexpected error during jar inspection, ignored", x);
} catch (Exception x) {
logger.config("Unknown resource ignored");
}
}
} | [
"public",
"static",
"void",
"scan",
"(",
"ServletContext",
"c",
",",
"Set",
"<",
"String",
">",
"jars",
",",
"Functor",
"<",
"Void",
",",
"ServiceModule",
">",
"collector",
",",
"Logger",
"logger",
")",
"{",
"for",
"(",
"String",
"j",
":",
"jars",
")",... | Scans a collection of jar files, passing recognized Xillium application modules as ServiceModule objects to
a collector.
@param c a ServletContext
@param jars a collection of file or URL paths
@param collector a Functor that is to be invoked for each recognized Xillium application module
@param logger a Logger that can be used to log warning messages | [
"Scans",
"a",
"collection",
"of",
"jar",
"files",
"passing",
"recognized",
"Xillium",
"application",
"modules",
"as",
"ServiceModule",
"objects",
"to",
"a",
"collector",
"."
] | e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799 | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/util/ServiceModule.java#L66-L81 | train |
pierre/serialization | smile/src/main/java/com/ning/metrics/serialization/event/SmileEnvelopeEvent.java | SmileEnvelopeEvent.writeToJsonGenerator | public void writeToJsonGenerator(final JsonGenerator gen) throws IOException
{
// writes '{eventName:<name>,payload:{<data>}}' --it's kind of silly but ultimately inconsequential to nest them like this.
gen.writeStartObject();
gen.writeStringField("eventName", eventName);
gen.writeFieldName("payload");
/* Note: output format used depends completely on generator we are being passed
* and NOT on which mapper we use -- mappers are format independent and rely
* on underlying JsonParser/JsonGenerator for low-level handling.
*/
getObjectMapper().writeTree(gen, root);
gen.writeEndObject();
} | java | public void writeToJsonGenerator(final JsonGenerator gen) throws IOException
{
// writes '{eventName:<name>,payload:{<data>}}' --it's kind of silly but ultimately inconsequential to nest them like this.
gen.writeStartObject();
gen.writeStringField("eventName", eventName);
gen.writeFieldName("payload");
/* Note: output format used depends completely on generator we are being passed
* and NOT on which mapper we use -- mappers are format independent and rely
* on underlying JsonParser/JsonGenerator for low-level handling.
*/
getObjectMapper().writeTree(gen, root);
gen.writeEndObject();
} | [
"public",
"void",
"writeToJsonGenerator",
"(",
"final",
"JsonGenerator",
"gen",
")",
"throws",
"IOException",
"{",
"// writes '{eventName:<name>,payload:{<data>}}' --it's kind of silly but ultimately inconsequential to nest them like this.",
"gen",
".",
"writeStartObject",
"(",
")",
... | having to know all the events ahead of time. | [
"having",
"to",
"know",
"all",
"the",
"events",
"ahead",
"of",
"time",
"."
] | b15b7c749ba78bfe94dce8fc22f31b30b2e6830b | https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/smile/src/main/java/com/ning/metrics/serialization/event/SmileEnvelopeEvent.java#L314-L326 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/sjavac/server/PortFile.java | PortFile.waitForValidValues | public synchronized boolean waitForValidValues() throws IOException, FileNotFoundException {
for (int tries = 0; tries < 50; tries++) {
lock();
getValues();
unlock();
if (containsPortInfo) {
Log.debug("Found valid values in port file after waiting "+(tries*100)+"ms");
return true;
}
try {
Thread.sleep(100);
} catch (InterruptedException e)
{}
}
Log.debug("Gave up waiting for valid values in port file");
return false;
} | java | public synchronized boolean waitForValidValues() throws IOException, FileNotFoundException {
for (int tries = 0; tries < 50; tries++) {
lock();
getValues();
unlock();
if (containsPortInfo) {
Log.debug("Found valid values in port file after waiting "+(tries*100)+"ms");
return true;
}
try {
Thread.sleep(100);
} catch (InterruptedException e)
{}
}
Log.debug("Gave up waiting for valid values in port file");
return false;
} | [
"public",
"synchronized",
"boolean",
"waitForValidValues",
"(",
")",
"throws",
"IOException",
",",
"FileNotFoundException",
"{",
"for",
"(",
"int",
"tries",
"=",
"0",
";",
"tries",
"<",
"50",
";",
"tries",
"++",
")",
"{",
"lock",
"(",
")",
";",
"getValues"... | Wait for the port file to contain values that look valid.
Return true, if a-ok, false if the valid values did not materialize within 5 seconds. | [
"Wait",
"for",
"the",
"port",
"file",
"to",
"contain",
"values",
"that",
"look",
"valid",
".",
"Return",
"true",
"if",
"a",
"-",
"ok",
"false",
"if",
"the",
"valid",
"values",
"did",
"not",
"materialize",
"within",
"5",
"seconds",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/server/PortFile.java#L204-L220 | train |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/sjavac/server/PortFile.java | PortFile.stillMyValues | public synchronized boolean stillMyValues() throws IOException, FileNotFoundException {
for (;;) {
try {
lock();
getValues();
unlock();
if (containsPortInfo) {
if (serverPort == myServerPort &&
serverCookie == myServerCookie) {
// Everything is ok.
return true;
}
// Someone has overwritten the port file.
// Probably another javac server, lets quit.
return false;
}
// Something else is wrong with the portfile. Lets quit.
return false;
} catch (FileLockInterruptionException e) {
continue;
}
catch (ClosedChannelException e) {
// The channel has been closed since sjavac is exiting.
return false;
}
}
} | java | public synchronized boolean stillMyValues() throws IOException, FileNotFoundException {
for (;;) {
try {
lock();
getValues();
unlock();
if (containsPortInfo) {
if (serverPort == myServerPort &&
serverCookie == myServerCookie) {
// Everything is ok.
return true;
}
// Someone has overwritten the port file.
// Probably another javac server, lets quit.
return false;
}
// Something else is wrong with the portfile. Lets quit.
return false;
} catch (FileLockInterruptionException e) {
continue;
}
catch (ClosedChannelException e) {
// The channel has been closed since sjavac is exiting.
return false;
}
}
} | [
"public",
"synchronized",
"boolean",
"stillMyValues",
"(",
")",
"throws",
"IOException",
",",
"FileNotFoundException",
"{",
"for",
"(",
";",
";",
")",
"{",
"try",
"{",
"lock",
"(",
")",
";",
"getValues",
"(",
")",
";",
"unlock",
"(",
")",
";",
"if",
"(... | Check if the portfile still contains my values, assuming that I am the server. | [
"Check",
"if",
"the",
"portfile",
"still",
"contains",
"my",
"values",
"assuming",
"that",
"I",
"am",
"the",
"server",
"."
] | 8812d28c20f4de070a0dd6de1b45602431379834 | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/server/PortFile.java#L225-L251 | train |
seedstack/shed | src/main/java/org/seedstack/shed/reflect/Classes.java | Classes.instantiateDefault | @SuppressWarnings("unchecked")
public static <T> T instantiateDefault(Class<T> someClass) {
if (someClass.isArray()) {
return (T) Array.newInstance(someClass.getComponentType(), 0);
} else {
if (boolean.class.equals(someClass) || Boolean.class.equals(someClass)) {
return (T) Boolean.FALSE;
} else if (int.class.equals(someClass) || Integer.class.equals(someClass)) {
return (T) Integer.valueOf(0);
} else if (long.class.equals(someClass) || Long.class.equals(someClass)) {
return (T) Long.valueOf(0L);
} else if (short.class.equals(someClass) || Short.class.equals(someClass)) {
return (T) Short.valueOf((short) 0);
} else if (float.class.equals(someClass) || Float.class.equals(someClass)) {
return (T) Float.valueOf(0f);
} else if (double.class.equals(someClass) || Double.class.equals(someClass)) {
return (T) Double.valueOf(0d);
} else if (byte.class.equals(someClass) || Byte.class.equals(someClass)) {
return (T) Byte.valueOf((byte) 0);
} else if (char.class.equals(someClass) || Character.class.equals(someClass)) {
return (T) Character.valueOf((char) 0);
} else {
try {
Constructor<T> defaultConstructor = someClass.getDeclaredConstructor();
defaultConstructor.setAccessible(true);
return defaultConstructor.newInstance();
} catch (Exception e) {
throw ShedException.wrap(e, ShedErrorCode.UNABLE_TO_INSTANTIATE_CLASS)
.put("class", someClass);
}
}
}
} | java | @SuppressWarnings("unchecked")
public static <T> T instantiateDefault(Class<T> someClass) {
if (someClass.isArray()) {
return (T) Array.newInstance(someClass.getComponentType(), 0);
} else {
if (boolean.class.equals(someClass) || Boolean.class.equals(someClass)) {
return (T) Boolean.FALSE;
} else if (int.class.equals(someClass) || Integer.class.equals(someClass)) {
return (T) Integer.valueOf(0);
} else if (long.class.equals(someClass) || Long.class.equals(someClass)) {
return (T) Long.valueOf(0L);
} else if (short.class.equals(someClass) || Short.class.equals(someClass)) {
return (T) Short.valueOf((short) 0);
} else if (float.class.equals(someClass) || Float.class.equals(someClass)) {
return (T) Float.valueOf(0f);
} else if (double.class.equals(someClass) || Double.class.equals(someClass)) {
return (T) Double.valueOf(0d);
} else if (byte.class.equals(someClass) || Byte.class.equals(someClass)) {
return (T) Byte.valueOf((byte) 0);
} else if (char.class.equals(someClass) || Character.class.equals(someClass)) {
return (T) Character.valueOf((char) 0);
} else {
try {
Constructor<T> defaultConstructor = someClass.getDeclaredConstructor();
defaultConstructor.setAccessible(true);
return defaultConstructor.newInstance();
} catch (Exception e) {
throw ShedException.wrap(e, ShedErrorCode.UNABLE_TO_INSTANTIATE_CLASS)
.put("class", someClass);
}
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"instantiateDefault",
"(",
"Class",
"<",
"T",
">",
"someClass",
")",
"{",
"if",
"(",
"someClass",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"(",
"T",
")",
... | Instantiate a class by invoking its default constructor. If the specified class denotes an
array, an empty array of the correct component type is created. If the specified class denotes
a primitive, the primitive is created with its default value.
@param someClass the class to instantiate.
@param <T> the type of the object to instantiate.
@return the instantiated object. | [
"Instantiate",
"a",
"class",
"by",
"invoking",
"its",
"default",
"constructor",
".",
"If",
"the",
"specified",
"class",
"denotes",
"an",
"array",
"an",
"empty",
"array",
"of",
"the",
"correct",
"component",
"type",
"is",
"created",
".",
"If",
"the",
"specifi... | 49ecb25aa3777539ab0f29f89abaae5ee93b572e | https://github.com/seedstack/shed/blob/49ecb25aa3777539ab0f29f89abaae5ee93b572e/src/main/java/org/seedstack/shed/reflect/Classes.java#L45-L77 | train |
seedstack/shed | src/main/java/org/seedstack/shed/reflect/Classes.java | Classes.optional | @SuppressWarnings("unchecked")
public static <T> Optional<Class<T>> optional(String dependency) {
try {
return Optional.of((Class<T>) Class.forName(dependency));
} catch (ClassNotFoundException | NoClassDefFoundError e) {
return Optional.empty();
}
} | java | @SuppressWarnings("unchecked")
public static <T> Optional<Class<T>> optional(String dependency) {
try {
return Optional.of((Class<T>) Class.forName(dependency));
} catch (ClassNotFoundException | NoClassDefFoundError e) {
return Optional.empty();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"Class",
"<",
"T",
">",
">",
"optional",
"(",
"String",
"dependency",
")",
"{",
"try",
"{",
"return",
"Optional",
".",
"of",
"(",
"(",
"Class",
"<",... | Checks if a class exists in the classpath.
@param dependency class to look for.
@return an {@link Optional} of the class (empty if class is not present). | [
"Checks",
"if",
"a",
"class",
"exists",
"in",
"the",
"classpath",
"."
] | 49ecb25aa3777539ab0f29f89abaae5ee93b572e | https://github.com/seedstack/shed/blob/49ecb25aa3777539ab0f29f89abaae5ee93b572e/src/main/java/org/seedstack/shed/reflect/Classes.java#L85-L92 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.