repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseShapeInfoProvider.java | BaseShapeInfoProvider.createShapeInformation | @Override
public Pair<DataBuffer, long[]> createShapeInformation(long[] shape, DataType dataType) {
char order = Nd4j.order();
return createShapeInformation(shape, order, dataType);
} | java | @Override
public Pair<DataBuffer, long[]> createShapeInformation(long[] shape, DataType dataType) {
char order = Nd4j.order();
return createShapeInformation(shape, order, dataType);
} | [
"@",
"Override",
"public",
"Pair",
"<",
"DataBuffer",
",",
"long",
"[",
"]",
">",
"createShapeInformation",
"(",
"long",
"[",
"]",
"shape",
",",
"DataType",
"dataType",
")",
"{",
"char",
"order",
"=",
"Nd4j",
".",
"order",
"(",
")",
";",
"return",
"cre... | This method creates shapeInformation buffer, based on shape being passed in
@param shape
@return | [
"This",
"method",
"creates",
"shapeInformation",
"buffer",
"based",
"on",
"shape",
"being",
"passed",
"in"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseShapeInfoProvider.java#L43-L48 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.setRow | public static void setRow(final double[][] m1, final int r, final double[] row) {
final int columndimension = getColumnDimensionality(m1);
assert row.length == columndimension : ERR_DIMENSIONS;
System.arraycopy(row, 0, m1[r], 0, columndimension);
} | java | public static void setRow(final double[][] m1, final int r, final double[] row) {
final int columndimension = getColumnDimensionality(m1);
assert row.length == columndimension : ERR_DIMENSIONS;
System.arraycopy(row, 0, m1[r], 0, columndimension);
} | [
"public",
"static",
"void",
"setRow",
"(",
"final",
"double",
"[",
"]",
"[",
"]",
"m1",
",",
"final",
"int",
"r",
",",
"final",
"double",
"[",
"]",
"row",
")",
"{",
"final",
"int",
"columndimension",
"=",
"getColumnDimensionality",
"(",
"m1",
")",
";",... | Sets the <code>r</code>th row of this matrix to the specified vector.
@param m1 Original matrix
@param r the index of the column to be set
@param row the value of the column to be set | [
"Sets",
"the",
"<code",
">",
"r<",
"/",
"code",
">",
"th",
"row",
"of",
"this",
"matrix",
"to",
"the",
"specified",
"vector",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1078-L1082 |
italiangrid/voms-clients | src/main/java/org/italiangrid/voms/clients/util/UsageProvider.java | UsageProvider.displayUsage | public static void displayUsage(String cmdLineSyntax, Options options) {
HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.printHelp(cmdLineSyntax, options);
} | java | public static void displayUsage(String cmdLineSyntax, Options options) {
HelpFormatter helpFormatter = new HelpFormatter();
helpFormatter.printHelp(cmdLineSyntax, options);
} | [
"public",
"static",
"void",
"displayUsage",
"(",
"String",
"cmdLineSyntax",
",",
"Options",
"options",
")",
"{",
"HelpFormatter",
"helpFormatter",
"=",
"new",
"HelpFormatter",
"(",
")",
";",
"helpFormatter",
".",
"printHelp",
"(",
"cmdLineSyntax",
",",
"options",
... | Displays usage.
@param cmdLineSyntax
the string that will be displayed on top of the usage message
@param options
the command options | [
"Displays",
"usage",
"."
] | train | https://github.com/italiangrid/voms-clients/blob/069cbe324c85286fa454bd78c3f76c23e97e5768/src/main/java/org/italiangrid/voms/clients/util/UsageProvider.java#L38-L42 |
jamesagnew/hapi-fhir | hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java | BaseHapiFhirDao.createForcedIdIfNeeded | protected ForcedId createForcedIdIfNeeded(ResourceTable theEntity, IIdType theId, boolean theCreateForPureNumericIds) {
if (theId.isEmpty() == false && theId.hasIdPart() && theEntity.getForcedId() == null) {
if (!theCreateForPureNumericIds && IdHelperService.isValidPid(theId)) {
return null;
}
ForcedId fid = new ForcedId();
fid.setResourceType(theEntity.getResourceType());
fid.setForcedId(theId.getIdPart());
fid.setResource(theEntity);
theEntity.setForcedId(fid);
return fid;
}
return null;
} | java | protected ForcedId createForcedIdIfNeeded(ResourceTable theEntity, IIdType theId, boolean theCreateForPureNumericIds) {
if (theId.isEmpty() == false && theId.hasIdPart() && theEntity.getForcedId() == null) {
if (!theCreateForPureNumericIds && IdHelperService.isValidPid(theId)) {
return null;
}
ForcedId fid = new ForcedId();
fid.setResourceType(theEntity.getResourceType());
fid.setForcedId(theId.getIdPart());
fid.setResource(theEntity);
theEntity.setForcedId(fid);
return fid;
}
return null;
} | [
"protected",
"ForcedId",
"createForcedIdIfNeeded",
"(",
"ResourceTable",
"theEntity",
",",
"IIdType",
"theId",
",",
"boolean",
"theCreateForPureNumericIds",
")",
"{",
"if",
"(",
"theId",
".",
"isEmpty",
"(",
")",
"==",
"false",
"&&",
"theId",
".",
"hasIdPart",
"... | Returns the newly created forced ID. If the entity already had a forced ID, or if
none was created, returns null. | [
"Returns",
"the",
"newly",
"created",
"forced",
"ID",
".",
"If",
"the",
"entity",
"already",
"had",
"a",
"forced",
"ID",
"or",
"if",
"none",
"was",
"created",
"returns",
"null",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java#L193-L208 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java | HCRenderer.getAsNode | @Nullable
public static IMicroNode getAsNode (@Nonnull final IHCNode aHCNode)
{
return getAsNode (aHCNode, HCSettings.getConversionSettings ());
} | java | @Nullable
public static IMicroNode getAsNode (@Nonnull final IHCNode aHCNode)
{
return getAsNode (aHCNode, HCSettings.getConversionSettings ());
} | [
"@",
"Nullable",
"public",
"static",
"IMicroNode",
"getAsNode",
"(",
"@",
"Nonnull",
"final",
"IHCNode",
"aHCNode",
")",
"{",
"return",
"getAsNode",
"(",
"aHCNode",
",",
"HCSettings",
".",
"getConversionSettings",
"(",
")",
")",
";",
"}"
] | Convert the passed HC node to a micro node using the default conversion
settings.
@param aHCNode
The node to be converted. May not be <code>null</code>.
@return The fully created HTML node | [
"Convert",
"the",
"passed",
"HC",
"node",
"to",
"a",
"micro",
"node",
"using",
"the",
"default",
"conversion",
"settings",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/render/HCRenderer.java#L176-L180 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/util/zip/ZipUtils.java | ZipUtils.resolveZipEntryName | static String resolveZipEntryName(File zipDirectory, File file) {
return Optional.ofNullable(zipDirectory)
.filter(File::isDirectory)
.map(File::getName)
.filter(StringUtils::hasText)
.map(zipDirectoryName -> {
String filePath = file.getAbsolutePath();
int index = filePath.indexOf(zipDirectoryName);
return index > -1 ? filePath.substring(index) : null;
})
.orElseGet(file::getName);
} | java | static String resolveZipEntryName(File zipDirectory, File file) {
return Optional.ofNullable(zipDirectory)
.filter(File::isDirectory)
.map(File::getName)
.filter(StringUtils::hasText)
.map(zipDirectoryName -> {
String filePath = file.getAbsolutePath();
int index = filePath.indexOf(zipDirectoryName);
return index > -1 ? filePath.substring(index) : null;
})
.orElseGet(file::getName);
} | [
"static",
"String",
"resolveZipEntryName",
"(",
"File",
"zipDirectory",
",",
"File",
"file",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"zipDirectory",
")",
".",
"filter",
"(",
"File",
"::",
"isDirectory",
")",
".",
"map",
"(",
"File",
"::",
"... | Tries to resolve the {@link String} of the {@link ZipEntry} given the {@link File directory} being zipped
and the {@link File} from when the {@link ZipEntry} is being constructed.
The resolved {@link ZipEntry} {@link String name} will be the relative path of the given {@link File}
if the {@link File} is relative to the given {@link File directory}, otherwise the {@link ZipEntry}
{@link String name} will be the {@link String name} of the given {@link File}.
If {@link File diretory} is {@literal null}, or is not a valid {@link File directory},
or the {@link File directory} refers to the root of the file system (i.e. the {@link File#getName() name}
of the {@link File directory} is {@link String empty}), then the resolved {@link ZipEntry} {@link String name}
will be the {@link String name} of the given {@link File}.
@param zipDirectory {@link File directory} being zipped.
@param file {@link File} used to construct the {@link ZipEntry}; must not be {@literal null}.
@return the resolved {@link String name} of the {@link ZipEntry}.
@see java.io.File | [
"Tries",
"to",
"resolve",
"the",
"{",
"@link",
"String",
"}",
"of",
"the",
"{",
"@link",
"ZipEntry",
"}",
"given",
"the",
"{",
"@link",
"File",
"directory",
"}",
"being",
"zipped",
"and",
"the",
"{",
"@link",
"File",
"}",
"from",
"when",
"the",
"{",
... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/zip/ZipUtils.java#L93-L108 |
tzaeschke/zoodb | src/org/zoodb/internal/query/TypeConverterTools.java | TypeConverterTools.checkAssignability | public static void checkAssignability(Object o, Class<?> type) {
COMPARISON_TYPE ctO = COMPARISON_TYPE.fromObject(o);
COMPARISON_TYPE ctT = COMPARISON_TYPE.fromClass(type);
try {
COMPARISON_TYPE.fromOperands(ctO, ctT);
} catch (Exception e) {
throw DBLogger.newUser("Cannot assign " + o.getClass() + " to " + type, e);
}
} | java | public static void checkAssignability(Object o, Class<?> type) {
COMPARISON_TYPE ctO = COMPARISON_TYPE.fromObject(o);
COMPARISON_TYPE ctT = COMPARISON_TYPE.fromClass(type);
try {
COMPARISON_TYPE.fromOperands(ctO, ctT);
} catch (Exception e) {
throw DBLogger.newUser("Cannot assign " + o.getClass() + " to " + type, e);
}
} | [
"public",
"static",
"void",
"checkAssignability",
"(",
"Object",
"o",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"COMPARISON_TYPE",
"ctO",
"=",
"COMPARISON_TYPE",
".",
"fromObject",
"(",
"o",
")",
";",
"COMPARISON_TYPE",
"ctT",
"=",
"COMPARISON_TYPE",
".... | This assumes that comparability implies assignability or convertability...
@param o object
@param type type | [
"This",
"assumes",
"that",
"comparability",
"implies",
"assignability",
"or",
"convertability",
"..."
] | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/query/TypeConverterTools.java#L168-L176 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.join | public static <K, V> String join(Map<K, V> map, String separator, String keyValueSeparator, boolean isIgnoreNull) {
final StringBuilder strBuilder = StrUtil.builder();
boolean isFirst = true;
for (Entry<K, V> entry : map.entrySet()) {
if (false == isIgnoreNull || entry.getKey() != null && entry.getValue() != null) {
if (isFirst) {
isFirst = false;
} else {
strBuilder.append(separator);
}
strBuilder.append(Convert.toStr(entry.getKey())).append(keyValueSeparator).append(Convert.toStr(entry.getValue()));
}
}
return strBuilder.toString();
} | java | public static <K, V> String join(Map<K, V> map, String separator, String keyValueSeparator, boolean isIgnoreNull) {
final StringBuilder strBuilder = StrUtil.builder();
boolean isFirst = true;
for (Entry<K, V> entry : map.entrySet()) {
if (false == isIgnoreNull || entry.getKey() != null && entry.getValue() != null) {
if (isFirst) {
isFirst = false;
} else {
strBuilder.append(separator);
}
strBuilder.append(Convert.toStr(entry.getKey())).append(keyValueSeparator).append(Convert.toStr(entry.getValue()));
}
}
return strBuilder.toString();
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"String",
"join",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"String",
"separator",
",",
"String",
"keyValueSeparator",
",",
"boolean",
"isIgnoreNull",
")",
"{",
"final",
"StringBuilder",
"strBuilder",
"... | 将map转成字符串
@param <K> 键类型
@param <V> 值类型
@param map Map
@param separator entry之间的连接符
@param keyValueSeparator kv之间的连接符
@param isIgnoreNull 是否忽略null的键和值
@return 连接后的字符串
@since 3.1.1 | [
"将map转成字符串"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L458-L472 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.scaleCol | public static void scaleCol( double alpha , DMatrixRMaj A , int col ) {
int idx = col;
for (int row = 0; row < A.numRows; row++, idx += A.numCols) {
A.data[idx] *= alpha;
}
} | java | public static void scaleCol( double alpha , DMatrixRMaj A , int col ) {
int idx = col;
for (int row = 0; row < A.numRows; row++, idx += A.numCols) {
A.data[idx] *= alpha;
}
} | [
"public",
"static",
"void",
"scaleCol",
"(",
"double",
"alpha",
",",
"DMatrixRMaj",
"A",
",",
"int",
"col",
")",
"{",
"int",
"idx",
"=",
"col",
";",
"for",
"(",
"int",
"row",
"=",
"0",
";",
"row",
"<",
"A",
".",
"numRows",
";",
"row",
"++",
",",
... | In-place scaling of a column in A
@param alpha scale factor
@param A matrix
@param col which row in A | [
"In",
"-",
"place",
"scaling",
"of",
"a",
"column",
"in",
"A"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2412-L2417 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/types/StringValue.java | StringValue.setValue | public void setValue(CharSequence value, int offset, int len) {
Validate.notNull(value);
if (offset < 0 || len < 0 || offset > value.length() - len) {
throw new IndexOutOfBoundsException("offset: " + offset + " len: " + len + " value.len: " + len);
}
ensureSize(len);
this.len = len;
for (int i = 0; i < len; i++) {
this.value[i] = value.charAt(offset + i);
}
this.len = len;
this.hashCode = 0;
} | java | public void setValue(CharSequence value, int offset, int len) {
Validate.notNull(value);
if (offset < 0 || len < 0 || offset > value.length() - len) {
throw new IndexOutOfBoundsException("offset: " + offset + " len: " + len + " value.len: " + len);
}
ensureSize(len);
this.len = len;
for (int i = 0; i < len; i++) {
this.value[i] = value.charAt(offset + i);
}
this.len = len;
this.hashCode = 0;
} | [
"public",
"void",
"setValue",
"(",
"CharSequence",
"value",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"Validate",
".",
"notNull",
"(",
"value",
")",
";",
"if",
"(",
"offset",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"offset",
">",
"value",
"... | Sets the value of the StringValue to a substring of the given string.
@param value The new string value.
@param offset The position to start the substring.
@param len The length of the substring. | [
"Sets",
"the",
"value",
"of",
"the",
"StringValue",
"to",
"a",
"substring",
"of",
"the",
"given",
"string",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/types/StringValue.java#L178-L191 |
Jasig/uPortal | uPortal-web/src/main/java/org/apereo/portal/portlets/error/PortletErrorController.java | PortletErrorController.renderError | @RequestMapping("VIEW")
public String renderError(RenderRequest request, RenderResponse response, ModelMap model)
throws Exception {
HttpServletRequest httpRequest = this.portalRequestUtils.getPortletHttpRequest(request);
IPortletWindowId currentFailedPortletWindowId =
(IPortletWindowId)
request.getAttribute(REQUEST_ATTRIBUTE__CURRENT_FAILED_PORTLET_WINDOW_ID);
model.addAttribute("portletWindowId", currentFailedPortletWindowId);
Exception cause =
(Exception) request.getAttribute(REQUEST_ATTRIBUTE__CURRENT_EXCEPTION_CAUSE);
model.addAttribute("exception", cause);
final String rootCauseMessage = ExceptionUtils.getRootCauseMessage(cause);
model.addAttribute("rootCauseMessage", rootCauseMessage);
// Maintenance Mode?
if (cause != null && cause instanceof MaintenanceModeException) {
return "/jsp/PortletError/maintenance";
}
IUserInstance userInstance = this.userInstanceManager.getUserInstance(httpRequest);
if (hasAdminPrivileges(userInstance)) {
IPortletWindow window =
this.portletWindowRegistry.getPortletWindow(
httpRequest, currentFailedPortletWindowId);
window.setRenderParameters(new ParameterMap());
IPortalUrlBuilder adminRetryUrl =
this.portalUrlProvider.getPortalUrlBuilderByPortletWindow(
httpRequest, currentFailedPortletWindowId, UrlType.RENDER);
model.addAttribute("adminRetryUrl", adminRetryUrl.getUrlString());
final IPortletWindow portletWindow =
portletWindowRegistry.getPortletWindow(
httpRequest, currentFailedPortletWindowId);
final IPortletEntity parentPortletEntity = portletWindow.getPortletEntity();
final IPortletDefinition parentPortletDefinition =
parentPortletEntity.getPortletDefinition();
model.addAttribute("channelDefinition", parentPortletDefinition);
StringWriter stackTraceWriter = new StringWriter();
cause.printStackTrace(new PrintWriter(stackTraceWriter));
model.addAttribute("stackTrace", stackTraceWriter.toString());
return "/jsp/PortletError/detailed";
}
// no admin privileges, return generic view
return "/jsp/PortletError/generic";
} | java | @RequestMapping("VIEW")
public String renderError(RenderRequest request, RenderResponse response, ModelMap model)
throws Exception {
HttpServletRequest httpRequest = this.portalRequestUtils.getPortletHttpRequest(request);
IPortletWindowId currentFailedPortletWindowId =
(IPortletWindowId)
request.getAttribute(REQUEST_ATTRIBUTE__CURRENT_FAILED_PORTLET_WINDOW_ID);
model.addAttribute("portletWindowId", currentFailedPortletWindowId);
Exception cause =
(Exception) request.getAttribute(REQUEST_ATTRIBUTE__CURRENT_EXCEPTION_CAUSE);
model.addAttribute("exception", cause);
final String rootCauseMessage = ExceptionUtils.getRootCauseMessage(cause);
model.addAttribute("rootCauseMessage", rootCauseMessage);
// Maintenance Mode?
if (cause != null && cause instanceof MaintenanceModeException) {
return "/jsp/PortletError/maintenance";
}
IUserInstance userInstance = this.userInstanceManager.getUserInstance(httpRequest);
if (hasAdminPrivileges(userInstance)) {
IPortletWindow window =
this.portletWindowRegistry.getPortletWindow(
httpRequest, currentFailedPortletWindowId);
window.setRenderParameters(new ParameterMap());
IPortalUrlBuilder adminRetryUrl =
this.portalUrlProvider.getPortalUrlBuilderByPortletWindow(
httpRequest, currentFailedPortletWindowId, UrlType.RENDER);
model.addAttribute("adminRetryUrl", adminRetryUrl.getUrlString());
final IPortletWindow portletWindow =
portletWindowRegistry.getPortletWindow(
httpRequest, currentFailedPortletWindowId);
final IPortletEntity parentPortletEntity = portletWindow.getPortletEntity();
final IPortletDefinition parentPortletDefinition =
parentPortletEntity.getPortletDefinition();
model.addAttribute("channelDefinition", parentPortletDefinition);
StringWriter stackTraceWriter = new StringWriter();
cause.printStackTrace(new PrintWriter(stackTraceWriter));
model.addAttribute("stackTrace", stackTraceWriter.toString());
return "/jsp/PortletError/detailed";
}
// no admin privileges, return generic view
return "/jsp/PortletError/generic";
} | [
"@",
"RequestMapping",
"(",
"\"VIEW\"",
")",
"public",
"String",
"renderError",
"(",
"RenderRequest",
"request",
",",
"RenderResponse",
"response",
",",
"ModelMap",
"model",
")",
"throws",
"Exception",
"{",
"HttpServletRequest",
"httpRequest",
"=",
"this",
".",
"p... | Render the error portlet view.
@param request
@param response
@param model
@return the name of the view to display
@throws Exception | [
"Render",
"the",
"error",
"portlet",
"view",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-web/src/main/java/org/apereo/portal/portlets/error/PortletErrorController.java#L101-L149 |
kotcrab/vis-ui | ui/src/main/java/com/kotcrab/vis/ui/util/ToastManager.java | ToastManager.show | public void show (String text, float timeSec) {
VisTable table = new VisTable();
table.add(text).grow();
show(table, timeSec);
} | java | public void show (String text, float timeSec) {
VisTable table = new VisTable();
table.add(text).grow();
show(table, timeSec);
} | [
"public",
"void",
"show",
"(",
"String",
"text",
",",
"float",
"timeSec",
")",
"{",
"VisTable",
"table",
"=",
"new",
"VisTable",
"(",
")",
";",
"table",
".",
"add",
"(",
"text",
")",
".",
"grow",
"(",
")",
";",
"show",
"(",
"table",
",",
"timeSec",... | Displays basic toast with provided text as message. Toast will be displayed for given amount of seconds. | [
"Displays",
"basic",
"toast",
"with",
"provided",
"text",
"as",
"message",
".",
"Toast",
"will",
"be",
"displayed",
"for",
"given",
"amount",
"of",
"seconds",
"."
] | train | https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/ToastManager.java#L81-L85 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java | MethodWriterImpl.addReturnType | protected void addReturnType(ExecutableElement method, Content htmltree) {
TypeMirror type = utils.getReturnType(method);
if (type != null) {
Content linkContent = writer.getLink(
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
htmltree.addContent(linkContent);
htmltree.addContent(Contents.SPACE);
}
} | java | protected void addReturnType(ExecutableElement method, Content htmltree) {
TypeMirror type = utils.getReturnType(method);
if (type != null) {
Content linkContent = writer.getLink(
new LinkInfoImpl(configuration, LinkInfoImpl.Kind.RETURN_TYPE, type));
htmltree.addContent(linkContent);
htmltree.addContent(Contents.SPACE);
}
} | [
"protected",
"void",
"addReturnType",
"(",
"ExecutableElement",
"method",
",",
"Content",
"htmltree",
")",
"{",
"TypeMirror",
"type",
"=",
"utils",
".",
"getReturnType",
"(",
"method",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"Content",
"linkCont... | Add the return type.
@param method the method being documented.
@param htmltree the content tree to which the return type will be added | [
"Add",
"the",
"return",
"type",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java#L404-L412 |
vdmeer/skb-java-base | src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java | SkbShellFactory.newCommand | public static SkbShellCommand newCommand(String command, SkbShellArgument argument, SkbShellCommandCategory category, String description, String addedHelp){
if(argument==null){
return new AbstractShellCommand(command, null, category, description, addedHelp);
}
return SkbShellFactory.newCommand(command, new SkbShellArgument[]{argument}, category, description, addedHelp);
} | java | public static SkbShellCommand newCommand(String command, SkbShellArgument argument, SkbShellCommandCategory category, String description, String addedHelp){
if(argument==null){
return new AbstractShellCommand(command, null, category, description, addedHelp);
}
return SkbShellFactory.newCommand(command, new SkbShellArgument[]{argument}, category, description, addedHelp);
} | [
"public",
"static",
"SkbShellCommand",
"newCommand",
"(",
"String",
"command",
",",
"SkbShellArgument",
"argument",
",",
"SkbShellCommandCategory",
"category",
",",
"String",
"description",
",",
"String",
"addedHelp",
")",
"{",
"if",
"(",
"argument",
"==",
"null",
... | Returns a new shell command, use the factory to create one.
@param command the actual command
@param argument the command's argument, can be null
@param category the command's category, can be null
@param description the command's description
@param addedHelp additional help, can be null
@return new shell command
@throws IllegalArgumentException if command or description was null | [
"Returns",
"a",
"new",
"shell",
"command",
"use",
"the",
"factory",
"to",
"create",
"one",
"."
] | train | https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/shell/SkbShellFactory.java#L124-L129 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java | Stylesheet.replaceTemplate | public void replaceTemplate(ElemTemplate v, int i) throws TransformerException
{
if (null == m_templates)
throw new ArrayIndexOutOfBoundsException();
replaceChild(v, (ElemTemplateElement)m_templates.elementAt(i));
m_templates.setElementAt(v, i);
v.setStylesheet(this);
} | java | public void replaceTemplate(ElemTemplate v, int i) throws TransformerException
{
if (null == m_templates)
throw new ArrayIndexOutOfBoundsException();
replaceChild(v, (ElemTemplateElement)m_templates.elementAt(i));
m_templates.setElementAt(v, i);
v.setStylesheet(this);
} | [
"public",
"void",
"replaceTemplate",
"(",
"ElemTemplate",
"v",
",",
"int",
"i",
")",
"throws",
"TransformerException",
"{",
"if",
"(",
"null",
"==",
"m_templates",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
")",
";",
"replaceChild",
"(",
"v",
... | Replace an "xsl:template" property.
This is a hook for CompilingStylesheetHandler, to allow
us to access a template, compile it, instantiate it,
and replace the original with the compiled instance.
ADDED 9/5/2000 to support compilation experiment
@param v Compiled template to replace with
@param i Index of template to be replaced
@throws TransformerException | [
"Replace",
"an",
"xsl",
":",
"template",
"property",
".",
"This",
"is",
"a",
"hook",
"for",
"CompilingStylesheetHandler",
"to",
"allow",
"us",
"to",
"access",
"a",
"template",
"compile",
"it",
"instantiate",
"it",
"and",
"replace",
"the",
"original",
"with",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java#L1372-L1381 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java | WebUtilities.getAncestorOfClass | public static <T> T getAncestorOfClass(final Class<T> clazz, final WComponent comp) {
if (comp == null || clazz == null) {
return null;
}
WComponent parent = comp.getParent();
while (parent != null) {
if (clazz.isInstance(parent)) {
return (T) parent;
}
parent = parent.getParent();
}
return null;
} | java | public static <T> T getAncestorOfClass(final Class<T> clazz, final WComponent comp) {
if (comp == null || clazz == null) {
return null;
}
WComponent parent = comp.getParent();
while (parent != null) {
if (clazz.isInstance(parent)) {
return (T) parent;
}
parent = parent.getParent();
}
return null;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getAncestorOfClass",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"WComponent",
"comp",
")",
"{",
"if",
"(",
"comp",
"==",
"null",
"||",
"clazz",
"==",
"null",
")",
"{",
"return",
"null",
";",
... | Attempts to find a component which is an ancestor of the given component, and that is assignable to the given
class.
@param clazz the class to look for
@param comp the component to start at.
@return the matching ancestor, if found, otherwise null.
@param <T> the ancestor class | [
"Attempts",
"to",
"find",
"a",
"component",
"which",
"is",
"an",
"ancestor",
"of",
"the",
"given",
"component",
"and",
"that",
"is",
"assignable",
"to",
"the",
"given",
"class",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WebUtilities.java#L225-L239 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-core/src/main/java/com/ibm/cloud/objectstorage/auth/profile/internal/securitytoken/STSProfileCredentialsServiceProvider.java | STSProfileCredentialsServiceProvider.getProfileCredentialService | private static synchronized ProfileCredentialsService getProfileCredentialService() {
if (STS_CREDENTIALS_SERVICE == null) {
try {
STS_CREDENTIALS_SERVICE = (ProfileCredentialsService) Class.forName(CLASS_NAME)
.newInstance();
} catch (ClassNotFoundException ex) {
throw new SdkClientException(
"To use assume role profiles the aws-java-sdk-sts module must be on the class path.",
ex);
} catch (InstantiationException ex) {
throw new SdkClientException("Failed to instantiate " + CLASS_NAME, ex);
} catch (IllegalAccessException ex) {
throw new SdkClientException("Failed to instantiate " + CLASS_NAME, ex);
}
}
return STS_CREDENTIALS_SERVICE;
} | java | private static synchronized ProfileCredentialsService getProfileCredentialService() {
if (STS_CREDENTIALS_SERVICE == null) {
try {
STS_CREDENTIALS_SERVICE = (ProfileCredentialsService) Class.forName(CLASS_NAME)
.newInstance();
} catch (ClassNotFoundException ex) {
throw new SdkClientException(
"To use assume role profiles the aws-java-sdk-sts module must be on the class path.",
ex);
} catch (InstantiationException ex) {
throw new SdkClientException("Failed to instantiate " + CLASS_NAME, ex);
} catch (IllegalAccessException ex) {
throw new SdkClientException("Failed to instantiate " + CLASS_NAME, ex);
}
}
return STS_CREDENTIALS_SERVICE;
} | [
"private",
"static",
"synchronized",
"ProfileCredentialsService",
"getProfileCredentialService",
"(",
")",
"{",
"if",
"(",
"STS_CREDENTIALS_SERVICE",
"==",
"null",
")",
"{",
"try",
"{",
"STS_CREDENTIALS_SERVICE",
"=",
"(",
"ProfileCredentialsService",
")",
"Class",
".",... | Only called once per creation of each profile credential provider so we don't bother with any
double checked locking. | [
"Only",
"called",
"once",
"per",
"creation",
"of",
"each",
"profile",
"credential",
"provider",
"so",
"we",
"don",
"t",
"bother",
"with",
"any",
"double",
"checked",
"locking",
"."
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-core/src/main/java/com/ibm/cloud/objectstorage/auth/profile/internal/securitytoken/STSProfileCredentialsServiceProvider.java#L50-L66 |
junit-team/junit4 | src/main/java/junit/framework/Assert.java | Assert.assertEquals | static public void assertEquals(String message, byte expected, byte actual) {
assertEquals(message, Byte.valueOf(expected), Byte.valueOf(actual));
} | java | static public void assertEquals(String message, byte expected, byte actual) {
assertEquals(message, Byte.valueOf(expected), Byte.valueOf(actual));
} | [
"static",
"public",
"void",
"assertEquals",
"(",
"String",
"message",
",",
"byte",
"expected",
",",
"byte",
"actual",
")",
"{",
"assertEquals",
"(",
"message",
",",
"Byte",
".",
"valueOf",
"(",
"expected",
")",
",",
"Byte",
".",
"valueOf",
"(",
"actual",
... | Asserts that two bytes are equal. If they are not
an AssertionFailedError is thrown with the given message. | [
"Asserts",
"that",
"two",
"bytes",
"are",
"equal",
".",
"If",
"they",
"are",
"not",
"an",
"AssertionFailedError",
"is",
"thrown",
"with",
"the",
"given",
"message",
"."
] | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/junit/framework/Assert.java#L188-L190 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerImpl.java | TransformerImpl.setParameter | public void setParameter(String name, String namespace, Object value)
{
VariableStack varstack = getXPathContext().getVarStack();
QName qname = new QName(namespace, name);
XObject xobject = XObject.create(value, getXPathContext());
StylesheetRoot sroot = m_stylesheetRoot;
Vector vars = sroot.getVariablesAndParamsComposed();
int i = vars.size();
while (--i >= 0)
{
ElemVariable variable = (ElemVariable)vars.elementAt(i);
if(variable.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE &&
variable.getName().equals(qname))
{
varstack.setGlobalVariable(i, xobject);
}
}
} | java | public void setParameter(String name, String namespace, Object value)
{
VariableStack varstack = getXPathContext().getVarStack();
QName qname = new QName(namespace, name);
XObject xobject = XObject.create(value, getXPathContext());
StylesheetRoot sroot = m_stylesheetRoot;
Vector vars = sroot.getVariablesAndParamsComposed();
int i = vars.size();
while (--i >= 0)
{
ElemVariable variable = (ElemVariable)vars.elementAt(i);
if(variable.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE &&
variable.getName().equals(qname))
{
varstack.setGlobalVariable(i, xobject);
}
}
} | [
"public",
"void",
"setParameter",
"(",
"String",
"name",
",",
"String",
"namespace",
",",
"Object",
"value",
")",
"{",
"VariableStack",
"varstack",
"=",
"getXPathContext",
"(",
")",
".",
"getVarStack",
"(",
")",
";",
"QName",
"qname",
"=",
"new",
"QName",
... | Set a parameter for the templates.
@param name The name of the parameter.
@param namespace The namespace of the parameter.
@param value The value object. This can be any valid Java object
-- it's up to the processor to provide the proper
coersion to the object, or simply pass it on for use
in extensions. | [
"Set",
"a",
"parameter",
"for",
"the",
"templates",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerImpl.java#L1382-L1401 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newHandler | protected SslHandler newHandler(ByteBufAllocator alloc, boolean startTls, Executor executor) {
return new SslHandler(newEngine(alloc), startTls, executor);
} | java | protected SslHandler newHandler(ByteBufAllocator alloc, boolean startTls, Executor executor) {
return new SslHandler(newEngine(alloc), startTls, executor);
} | [
"protected",
"SslHandler",
"newHandler",
"(",
"ByteBufAllocator",
"alloc",
",",
"boolean",
"startTls",
",",
"Executor",
"executor",
")",
"{",
"return",
"new",
"SslHandler",
"(",
"newEngine",
"(",
"alloc",
")",
",",
"startTls",
",",
"executor",
")",
";",
"}"
] | Create a new SslHandler.
@see #newHandler(ByteBufAllocator, String, int, boolean, Executor) | [
"Create",
"a",
"new",
"SslHandler",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L932-L934 |
czyzby/gdx-lml | lml/src/main/java/com/github/czyzby/lml/parser/impl/AbstractLmlView.java | AbstractLmlView.resize | public void resize(final int width, final int height, final boolean centerCamera) {
stage.getViewport().update(width, height, centerCamera);
} | java | public void resize(final int width, final int height, final boolean centerCamera) {
stage.getViewport().update(width, height, centerCamera);
} | [
"public",
"void",
"resize",
"(",
"final",
"int",
"width",
",",
"final",
"int",
"height",
",",
"final",
"boolean",
"centerCamera",
")",
"{",
"stage",
".",
"getViewport",
"(",
")",
".",
"update",
"(",
"width",
",",
"height",
",",
"centerCamera",
")",
";",
... | Updates stage's viewport.
@param width new width of the screen.
@param height new height of the screen.
@param centerCamera false by default. Some viewports seem to require it to be true for proper behavior (
{@link com.badlogic.gdx.utils.viewport.ScreenViewport}, for example). | [
"Updates",
"stage",
"s",
"viewport",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml/src/main/java/com/github/czyzby/lml/parser/impl/AbstractLmlView.java#L63-L65 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/BrokerHelper.java | BrokerHelper.representsNull | public boolean representsNull(FieldDescriptor fld, Object aValue)
{
if(aValue == null) return true;
boolean result = false;
if(((aValue instanceof Number) && (((Number) aValue).longValue() == 0)))
{
Class type = fld.getPersistentField().getType();
/*
AnonymousPersistentFields will *always* have a null type according to the
javadoc comments in AnonymousPersistentField.getType() and never represents
a primitve java field with value 0, thus we return always 'false' in this case.
(If the value object is null, the first check above return true)
*/
if(type != null)
{
result = type.isPrimitive();
}
}
// TODO: Do we need this check?? String could be nullified, why should we assume
// it's 'null' on empty string?
else if((aValue instanceof String) && (((String) aValue).length() == 0))
{
result = fld.isPrimaryKey();
}
return result;
} | java | public boolean representsNull(FieldDescriptor fld, Object aValue)
{
if(aValue == null) return true;
boolean result = false;
if(((aValue instanceof Number) && (((Number) aValue).longValue() == 0)))
{
Class type = fld.getPersistentField().getType();
/*
AnonymousPersistentFields will *always* have a null type according to the
javadoc comments in AnonymousPersistentField.getType() and never represents
a primitve java field with value 0, thus we return always 'false' in this case.
(If the value object is null, the first check above return true)
*/
if(type != null)
{
result = type.isPrimitive();
}
}
// TODO: Do we need this check?? String could be nullified, why should we assume
// it's 'null' on empty string?
else if((aValue instanceof String) && (((String) aValue).length() == 0))
{
result = fld.isPrimaryKey();
}
return result;
} | [
"public",
"boolean",
"representsNull",
"(",
"FieldDescriptor",
"fld",
",",
"Object",
"aValue",
")",
"{",
"if",
"(",
"aValue",
"==",
"null",
")",
"return",
"true",
";",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"(",
"(",
"aValue",
"instanceof",
"... | Decide if the given object value represents 'null'.<br/>
- If given value is 'null' itself, true will be returned<br/>
- If given value is instance of Number with value 0 and the field-descriptor
represents a primitive field, true will be returned<br/>
- If given value is instance of String with length 0 and the field-descriptor
is a primary key, true will be returned<br/> | [
"Decide",
"if",
"the",
"given",
"object",
"value",
"represents",
"null",
".",
"<br",
"/",
">"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/BrokerHelper.java#L255-L281 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getAchievementGroupInfo | public void getAchievementGroupInfo(String[] ids, Callback<List<AchievementGroup>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getAchievementGroupInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getAchievementGroupInfo(String[] ids, Callback<List<AchievementGroup>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getAchievementGroupInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getAchievementGroupInfo",
"(",
"String",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"AchievementGroup",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChec... | For more info on achievements groups API go <a href="https://wiki.guildwars2.com/wiki/API:2/achievements/groups">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of achievement group id(s)
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid API key
@throws NullPointerException if given {@link Callback} is empty
@see AchievementGroup achievement group info | [
"For",
"more",
"info",
"on",
"achievements",
"groups",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"achievements",
"/",
"groups",
">",
"here<",
"/",
"a",
">",
"<... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L563-L566 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addPreQualifiedStrongClassLink | public void addPreQualifiedStrongClassLink(LinkInfoImpl.Kind context, TypeElement typeElement, Content contentTree) {
addPreQualifiedClassLink(context, typeElement, true, contentTree);
} | java | public void addPreQualifiedStrongClassLink(LinkInfoImpl.Kind context, TypeElement typeElement, Content contentTree) {
addPreQualifiedClassLink(context, typeElement, true, contentTree);
} | [
"public",
"void",
"addPreQualifiedStrongClassLink",
"(",
"LinkInfoImpl",
".",
"Kind",
"context",
",",
"TypeElement",
"typeElement",
",",
"Content",
"contentTree",
")",
"{",
"addPreQualifiedClassLink",
"(",
"context",
",",
"typeElement",
",",
"true",
",",
"contentTree"... | Add the class link, with only class name as the strong link and prefixing
plain package name.
@param context the id of the context where the link will be added
@param typeElement the class to link to
@param contentTree the content tree to which the link with be added | [
"Add",
"the",
"class",
"link",
"with",
"only",
"class",
"name",
"as",
"the",
"strong",
"link",
"and",
"prefixing",
"plain",
"package",
"name",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1339-L1341 |
BioPAX/Paxtools | paxtools-core/src/main/java/org/biopax/paxtools/controller/Fetcher.java | Fetcher.subgraphContains | public boolean subgraphContains(final BioPAXElement root, final String uri,
final Class<? extends BioPAXElement> type) {
final AtomicBoolean found = new AtomicBoolean(false);
Traverser traverser = new AbstractTraverser(editorMap, filters) {
@Override
protected void visit(Object range, BioPAXElement domain, Model model, PropertyEditor editor)
{
if (range instanceof BioPAXElement && !found.get())
{
if( ((BioPAXElement) range).getUri().equals(uri) )
found.set(true); //set global flag; done.
else
if(!(skipSubPathways && (range instanceof Pathway)))
traverse((BioPAXElement)range, model);
}
}
};
traverser.traverse(root, null);
return found.get();
} | java | public boolean subgraphContains(final BioPAXElement root, final String uri,
final Class<? extends BioPAXElement> type) {
final AtomicBoolean found = new AtomicBoolean(false);
Traverser traverser = new AbstractTraverser(editorMap, filters) {
@Override
protected void visit(Object range, BioPAXElement domain, Model model, PropertyEditor editor)
{
if (range instanceof BioPAXElement && !found.get())
{
if( ((BioPAXElement) range).getUri().equals(uri) )
found.set(true); //set global flag; done.
else
if(!(skipSubPathways && (range instanceof Pathway)))
traverse((BioPAXElement)range, model);
}
}
};
traverser.traverse(root, null);
return found.get();
} | [
"public",
"boolean",
"subgraphContains",
"(",
"final",
"BioPAXElement",
"root",
",",
"final",
"String",
"uri",
",",
"final",
"Class",
"<",
"?",
"extends",
"BioPAXElement",
">",
"type",
")",
"{",
"final",
"AtomicBoolean",
"found",
"=",
"new",
"AtomicBoolean",
"... | Iterates over child objects of the given biopax element,
using BioPAX object-type properties, until the element
with specified URI and class (including its sub-classes).
is found.
@param root biopax element to process
@param uri URI to match
@param type class to match
@return true if the match found; false - otherwise | [
"Iterates",
"over",
"child",
"objects",
"of",
"the",
"given",
"biopax",
"element",
"using",
"BioPAX",
"object",
"-",
"type",
"properties",
"until",
"the",
"element",
"with",
"specified",
"URI",
"and",
"class",
"(",
"including",
"its",
"sub",
"-",
"classes",
... | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/controller/Fetcher.java#L270-L294 |
jaxio/celerio | celerio-engine/src/main/java/com/jaxio/celerio/factory/RelationCollisionUtil.java | RelationCollisionUtil.getManyToOneIntermediateNamer | public Namer getManyToOneIntermediateNamer(Namer fromEntityNamer, ColumnConfig pointsOnToEntity, Namer toEntityNamer) {
// new configuration
Namer result = getManyToOneNamerFromConf(pointsOnToEntity, toEntityNamer);
// fallback
if (result == null) {
// NOTE: we use the many to many fallback as it is totally complient with intermediate m2o fallback expectations.
result = getManyToManyNamerFallBack(fromEntityNamer, pointsOnToEntity, toEntityNamer);
}
return result;
} | java | public Namer getManyToOneIntermediateNamer(Namer fromEntityNamer, ColumnConfig pointsOnToEntity, Namer toEntityNamer) {
// new configuration
Namer result = getManyToOneNamerFromConf(pointsOnToEntity, toEntityNamer);
// fallback
if (result == null) {
// NOTE: we use the many to many fallback as it is totally complient with intermediate m2o fallback expectations.
result = getManyToManyNamerFallBack(fromEntityNamer, pointsOnToEntity, toEntityNamer);
}
return result;
} | [
"public",
"Namer",
"getManyToOneIntermediateNamer",
"(",
"Namer",
"fromEntityNamer",
",",
"ColumnConfig",
"pointsOnToEntity",
",",
"Namer",
"toEntityNamer",
")",
"{",
"// new configuration",
"Namer",
"result",
"=",
"getManyToOneNamerFromConf",
"(",
"pointsOnToEntity",
",",
... | Compute the appropriate namer for the Java field @ManyToOne (with intermediate table) | [
"Compute",
"the",
"appropriate",
"namer",
"for",
"the",
"Java",
"field"
] | train | https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/factory/RelationCollisionUtil.java#L105-L117 |
LAW-Unimi/BUbiNG | src/it/unimi/di/law/bubing/util/ByteArrayDiskQueue.java | ByteArrayDiskQueue.createFromFile | public static ByteArrayDiskQueue createFromFile(final long size, final File file, final int bufferSize, final boolean direct) throws IOException {
final ByteArrayDiskQueue byteArrayDiskQueue = new ByteArrayDiskQueue(ByteDiskQueue.createFromFile(file, bufferSize, direct));
byteArrayDiskQueue.size = size;
return byteArrayDiskQueue;
} | java | public static ByteArrayDiskQueue createFromFile(final long size, final File file, final int bufferSize, final boolean direct) throws IOException {
final ByteArrayDiskQueue byteArrayDiskQueue = new ByteArrayDiskQueue(ByteDiskQueue.createFromFile(file, bufferSize, direct));
byteArrayDiskQueue.size = size;
return byteArrayDiskQueue;
} | [
"public",
"static",
"ByteArrayDiskQueue",
"createFromFile",
"(",
"final",
"long",
"size",
",",
"final",
"File",
"file",
",",
"final",
"int",
"bufferSize",
",",
"final",
"boolean",
"direct",
")",
"throws",
"IOException",
"{",
"final",
"ByteArrayDiskQueue",
"byteArr... | Creates a new disk-based queue of byte arrays using an existing file.
<p>Note that you have to supply the correct number of byte arrays contained in the dump file of
the underlying {@link ByteDiskQueue}. Failure to do so will cause unpredictable behaviour.
@param size the number of byte arrays contained in {@code file}.
@param file the file that will be used to dump the queue on disk.
@param bufferSize the number of items in the circular buffer (will be possibly decreased so to be a power of two).
@param direct whether the {@link ByteBuffer} used by this queue should be {@linkplain ByteBuffer#allocateDirect(int) allocated directly}.
@see ByteDiskQueue#createFromFile(File, int, boolean) | [
"Creates",
"a",
"new",
"disk",
"-",
"based",
"queue",
"of",
"byte",
"arrays",
"using",
"an",
"existing",
"file",
"."
] | train | https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/ByteArrayDiskQueue.java#L81-L85 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/DocTreePath.java | DocTreePath.getPath | public static DocTreePath getPath(DocTreePath path, DocTree target) {
Objects.requireNonNull(path); //null check
Objects.requireNonNull(target); //null check
class Result extends Error {
static final long serialVersionUID = -5942088234594905625L;
DocTreePath path;
Result(DocTreePath path) {
this.path = path;
}
}
class PathFinder extends DocTreePathScanner<DocTreePath,DocTree> {
@Override
public DocTreePath scan(DocTree tree, DocTree target) {
if (tree == target) {
throw new Result(new DocTreePath(getCurrentPath(), target));
}
return super.scan(tree, target);
}
}
if (path.getLeaf() == target) {
return path;
}
try {
new PathFinder().scan(path, target);
} catch (Result result) {
return result.path;
}
return null;
} | java | public static DocTreePath getPath(DocTreePath path, DocTree target) {
Objects.requireNonNull(path); //null check
Objects.requireNonNull(target); //null check
class Result extends Error {
static final long serialVersionUID = -5942088234594905625L;
DocTreePath path;
Result(DocTreePath path) {
this.path = path;
}
}
class PathFinder extends DocTreePathScanner<DocTreePath,DocTree> {
@Override
public DocTreePath scan(DocTree tree, DocTree target) {
if (tree == target) {
throw new Result(new DocTreePath(getCurrentPath(), target));
}
return super.scan(tree, target);
}
}
if (path.getLeaf() == target) {
return path;
}
try {
new PathFinder().scan(path, target);
} catch (Result result) {
return result.path;
}
return null;
} | [
"public",
"static",
"DocTreePath",
"getPath",
"(",
"DocTreePath",
"path",
",",
"DocTree",
"target",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"path",
")",
";",
"//null check",
"Objects",
".",
"requireNonNull",
"(",
"target",
")",
";",
"//null check",
"c... | Returns a documentation tree path for a tree node within a subtree
identified by a DocTreePath object, or {@code null} if the node is not found.
@param path a path identifying a node within a doc comment tree
@param target a node to be located within the given node
@return a path identifying the target node | [
"Returns",
"a",
"documentation",
"tree",
"path",
"for",
"a",
"tree",
"node",
"within",
"a",
"subtree",
"identified",
"by",
"a",
"DocTreePath",
"object",
"or",
"{"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreePath.java#L60-L92 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java | EasyRandomParameters.stringLengthRange | public EasyRandomParameters stringLengthRange(final int minStringLength, final int maxStringLength) {
if (minStringLength < 0) {
throw new IllegalArgumentException("minStringLength must be >= 0");
}
if (minStringLength > maxStringLength) {
throw new IllegalArgumentException(format("minStringLength (%s) must be <= than maxStringLength (%s)",
minStringLength, maxStringLength));
}
setStringLengthRange(new Range<>(minStringLength, maxStringLength));
return this;
} | java | public EasyRandomParameters stringLengthRange(final int minStringLength, final int maxStringLength) {
if (minStringLength < 0) {
throw new IllegalArgumentException("minStringLength must be >= 0");
}
if (minStringLength > maxStringLength) {
throw new IllegalArgumentException(format("minStringLength (%s) must be <= than maxStringLength (%s)",
minStringLength, maxStringLength));
}
setStringLengthRange(new Range<>(minStringLength, maxStringLength));
return this;
} | [
"public",
"EasyRandomParameters",
"stringLengthRange",
"(",
"final",
"int",
"minStringLength",
",",
"final",
"int",
"maxStringLength",
")",
"{",
"if",
"(",
"minStringLength",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"minStringLength must ... | Set the string length range.
@param minStringLength the minimum string length
@param maxStringLength the maximum string length
@return the current {@link EasyRandomParameters} instance for method chaining | [
"Set",
"the",
"string",
"length",
"range",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java#L402-L412 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/checksum/ChecksumExtensions.java | ChecksumExtensions.getChecksum | public static String getChecksum(final File file, final String algorithm)
throws NoSuchAlgorithmException, IOException
{
return getChecksum(ReadFileExtensions.toByteArray(file), algorithm);
} | java | public static String getChecksum(final File file, final String algorithm)
throws NoSuchAlgorithmException, IOException
{
return getChecksum(ReadFileExtensions.toByteArray(file), algorithm);
} | [
"public",
"static",
"String",
"getChecksum",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"algorithm",
")",
"throws",
"NoSuchAlgorithmException",
",",
"IOException",
"{",
"return",
"getChecksum",
"(",
"ReadFileExtensions",
".",
"toByteArray",
"(",
"file",
... | Gets the checksum from the given file with an instance of the given algorithm.
@param file
the file.
@param algorithm
the algorithm to get the checksum. This could be for instance "MD4", "MD5",
"SHA-1", "SHA-256", "SHA-384" or "SHA-512".
@return The checksum from the file as a String object.
@throws NoSuchAlgorithmException
Is thrown if the algorithm is not supported or does not exists.
{@link java.security.MessageDigest} object.
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"checksum",
"from",
"the",
"given",
"file",
"with",
"an",
"instance",
"of",
"the",
"given",
"algorithm",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/checksum/ChecksumExtensions.java#L255-L259 |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java | KinesisDataFetcher.updateState | protected final void updateState(int shardStateIndex, SequenceNumber lastSequenceNumber) {
synchronized (checkpointLock) {
subscribedShardsState.get(shardStateIndex).setLastProcessedSequenceNum(lastSequenceNumber);
// if a shard's state is updated to be SENTINEL_SHARD_ENDING_SEQUENCE_NUM by its consumer thread,
// we've finished reading the shard and should determine it to be non-active
if (lastSequenceNumber.equals(SentinelSequenceNumber.SENTINEL_SHARD_ENDING_SEQUENCE_NUM.get())) {
LOG.info("Subtask {} has reached the end of subscribed shard: {}",
indexOfThisConsumerSubtask, subscribedShardsState.get(shardStateIndex).getStreamShardHandle());
// check if we need to mark the source as idle;
// note that on resharding, if registerNewSubscribedShardState was invoked for newly discovered shards
// AFTER the old shards had reached the end, the subtask's status will be automatically toggled back to
// be active immediately afterwards as soon as we collect records from the new shards
if (this.numberOfActiveShards.decrementAndGet() == 0) {
LOG.info("Subtask {} has reached the end of all currently subscribed shards; marking the subtask as temporarily idle ...",
indexOfThisConsumerSubtask);
sourceContext.markAsTemporarilyIdle();
}
}
}
} | java | protected final void updateState(int shardStateIndex, SequenceNumber lastSequenceNumber) {
synchronized (checkpointLock) {
subscribedShardsState.get(shardStateIndex).setLastProcessedSequenceNum(lastSequenceNumber);
// if a shard's state is updated to be SENTINEL_SHARD_ENDING_SEQUENCE_NUM by its consumer thread,
// we've finished reading the shard and should determine it to be non-active
if (lastSequenceNumber.equals(SentinelSequenceNumber.SENTINEL_SHARD_ENDING_SEQUENCE_NUM.get())) {
LOG.info("Subtask {} has reached the end of subscribed shard: {}",
indexOfThisConsumerSubtask, subscribedShardsState.get(shardStateIndex).getStreamShardHandle());
// check if we need to mark the source as idle;
// note that on resharding, if registerNewSubscribedShardState was invoked for newly discovered shards
// AFTER the old shards had reached the end, the subtask's status will be automatically toggled back to
// be active immediately afterwards as soon as we collect records from the new shards
if (this.numberOfActiveShards.decrementAndGet() == 0) {
LOG.info("Subtask {} has reached the end of all currently subscribed shards; marking the subtask as temporarily idle ...",
indexOfThisConsumerSubtask);
sourceContext.markAsTemporarilyIdle();
}
}
}
} | [
"protected",
"final",
"void",
"updateState",
"(",
"int",
"shardStateIndex",
",",
"SequenceNumber",
"lastSequenceNumber",
")",
"{",
"synchronized",
"(",
"checkpointLock",
")",
"{",
"subscribedShardsState",
".",
"get",
"(",
"shardStateIndex",
")",
".",
"setLastProcessed... | Update the shard to last processed sequence number state.
This method is called by {@link ShardConsumer}s.
@param shardStateIndex index of the shard to update in subscribedShardsState;
this index should be the returned value from
{@link KinesisDataFetcher#registerNewSubscribedShardState(KinesisStreamShardState)}, called
when the shard state was registered.
@param lastSequenceNumber the last sequence number value to update | [
"Update",
"the",
"shard",
"to",
"last",
"processed",
"sequence",
"number",
"state",
".",
"This",
"method",
"is",
"called",
"by",
"{",
"@link",
"ShardConsumer",
"}",
"s",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/KinesisDataFetcher.java#L641-L663 |
amaembo/streamex | src/main/java/one/util/streamex/DoubleStreamEx.java | DoubleStreamEx.pairMap | public DoubleStreamEx pairMap(DoubleBinaryOperator mapper) {
return delegate(new PairSpliterator.PSOfDouble(mapper, null, spliterator(), PairSpliterator.MODE_PAIRS));
} | java | public DoubleStreamEx pairMap(DoubleBinaryOperator mapper) {
return delegate(new PairSpliterator.PSOfDouble(mapper, null, spliterator(), PairSpliterator.MODE_PAIRS));
} | [
"public",
"DoubleStreamEx",
"pairMap",
"(",
"DoubleBinaryOperator",
"mapper",
")",
"{",
"return",
"delegate",
"(",
"new",
"PairSpliterator",
".",
"PSOfDouble",
"(",
"mapper",
",",
"null",
",",
"spliterator",
"(",
")",
",",
"PairSpliterator",
".",
"MODE_PAIRS",
"... | Returns a stream consisting of the results of applying the given function
to the every adjacent pair of elements of this stream.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
<p>
The output stream will contain one element less than this stream. If this
stream contains zero or one element the output stream will be empty.
@param mapper a non-interfering, stateless function to apply to each
adjacent pair of this stream elements.
@return the new stream
@since 0.2.1 | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"every",
"adjacent",
"pair",
"of",
"elements",
"of",
"this",
"stream",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/DoubleStreamEx.java#L1321-L1323 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java | GeneratedDi18nDaoImpl.queryByLocale | public Iterable<Di18n> queryByLocale(java.lang.String locale) {
return queryByField(null, Di18nMapper.Field.LOCALE.getFieldName(), locale);
} | java | public Iterable<Di18n> queryByLocale(java.lang.String locale) {
return queryByField(null, Di18nMapper.Field.LOCALE.getFieldName(), locale);
} | [
"public",
"Iterable",
"<",
"Di18n",
">",
"queryByLocale",
"(",
"java",
".",
"lang",
".",
"String",
"locale",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"Di18nMapper",
".",
"Field",
".",
"LOCALE",
".",
"getFieldName",
"(",
")",
",",
"locale",
"... | query-by method for field locale
@param locale the specified attribute
@return an Iterable of Di18ns for the specified locale | [
"query",
"-",
"by",
"method",
"for",
"field",
"locale"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java#L79-L81 |
JavaMoney/jsr354-api | src/main/java/javax/money/Monetary.java | Monetary.getCurrency | public static CurrencyUnit getCurrency(Locale locale, String... providers) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrency(locale, providers);
} | java | public static CurrencyUnit getCurrency(Locale locale, String... providers) {
return Optional.ofNullable(MONETARY_CURRENCIES_SINGLETON_SPI()).orElseThrow(
() -> new MonetaryException("No MonetaryCurrenciesSingletonSpi loaded, check your system setup."))
.getCurrency(locale, providers);
} | [
"public",
"static",
"CurrencyUnit",
"getCurrency",
"(",
"Locale",
"locale",
",",
"String",
"...",
"providers",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"MONETARY_CURRENCIES_SINGLETON_SPI",
"(",
")",
")",
".",
"orElseThrow",
"(",
"(",
")",
"->",
... | Access a new instance based on the {@link Locale}. Currencies are
available as provided by {@link CurrencyProviderSpi} instances registered
with the {@link javax.money.spi.Bootstrap}.
@param locale the target {@link Locale}, typically representing an ISO
country, not {@code null}.
@param providers the (optional) specification of providers to consider.
@return the corresponding {@link CurrencyUnit} instance.
@throws UnknownCurrencyException if no such currency exists. | [
"Access",
"a",
"new",
"instance",
"based",
"on",
"the",
"{",
"@link",
"Locale",
"}",
".",
"Currencies",
"are",
"available",
"as",
"provided",
"by",
"{",
"@link",
"CurrencyProviderSpi",
"}",
"instances",
"registered",
"with",
"the",
"{",
"@link",
"javax",
"."... | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L403-L407 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/WorldToCameraToPixel.java | WorldToCameraToPixel.configure | public void configure(LensDistortionNarrowFOV distortion , Se3_F64 worldToCamera ) {
this.worldToCamera = worldToCamera;
normToPixel = distortion.distort_F64(false,true);
} | java | public void configure(LensDistortionNarrowFOV distortion , Se3_F64 worldToCamera ) {
this.worldToCamera = worldToCamera;
normToPixel = distortion.distort_F64(false,true);
} | [
"public",
"void",
"configure",
"(",
"LensDistortionNarrowFOV",
"distortion",
",",
"Se3_F64",
"worldToCamera",
")",
"{",
"this",
".",
"worldToCamera",
"=",
"worldToCamera",
";",
"normToPixel",
"=",
"distortion",
".",
"distort_F64",
"(",
"false",
",",
"true",
")",
... | Specifies intrinsic camera parameters and the transform from world to camera.
@param distortion camera parameters
@param worldToCamera transform from world to camera | [
"Specifies",
"intrinsic",
"camera",
"parameters",
"and",
"the",
"transform",
"from",
"world",
"to",
"camera",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/WorldToCameraToPixel.java#L67-L71 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java | ArrayUtil.writeLong | public static void writeLong(byte b[], int offset, long value) {
b[offset++] = (byte) (value >>> 56);
b[offset++] = (byte) (value >>> 48);
b[offset++] = (byte) (value >>> 40);
b[offset++] = (byte) (value >>> 32);
b[offset++] = (byte) (value >>> 24);
b[offset++] = (byte) (value >>> 16);
b[offset++] = (byte) (value >>> 8);
b[offset] = (byte)value;
} | java | public static void writeLong(byte b[], int offset, long value) {
b[offset++] = (byte) (value >>> 56);
b[offset++] = (byte) (value >>> 48);
b[offset++] = (byte) (value >>> 40);
b[offset++] = (byte) (value >>> 32);
b[offset++] = (byte) (value >>> 24);
b[offset++] = (byte) (value >>> 16);
b[offset++] = (byte) (value >>> 8);
b[offset] = (byte)value;
} | [
"public",
"static",
"void",
"writeLong",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"offset",
",",
"long",
"value",
")",
"{",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"56",
")",
";",
"b",
"[",
"offset",
"++",
"]",... | Serializes a long into a byte array at a specific offset in big-endian order
@param b byte array in which to write a long value.
@param offset offset within byte array to start writing.
@param value long to write to byte array. | [
"Serializes",
"a",
"long",
"into",
"a",
"byte",
"array",
"at",
"a",
"specific",
"offset",
"in",
"big",
"-",
"endian",
"order"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L68-L77 |
couchbase/java-dcp-client | src/main/java/com/couchbase/client/dcp/transport/netty/AuthHandler.java | AuthHandler.checkIsAuthed | private void checkIsAuthed(final ChannelHandlerContext ctx, final ResponseStatus status) {
if (status.isSuccess()) {
LOGGER.debug("Successfully authenticated against node {}", ctx.channel().remoteAddress());
ctx.pipeline().remove(this);
originalPromise().setSuccess();
ctx.fireChannelActive();
} else if (status == AUTH_ERROR) {
originalPromise().setFailure(new AuthenticationException("SASL Authentication Failure"));
} else {
originalPromise().setFailure(new AuthenticationException("Unhandled SASL auth status: " + status));
}
} | java | private void checkIsAuthed(final ChannelHandlerContext ctx, final ResponseStatus status) {
if (status.isSuccess()) {
LOGGER.debug("Successfully authenticated against node {}", ctx.channel().remoteAddress());
ctx.pipeline().remove(this);
originalPromise().setSuccess();
ctx.fireChannelActive();
} else if (status == AUTH_ERROR) {
originalPromise().setFailure(new AuthenticationException("SASL Authentication Failure"));
} else {
originalPromise().setFailure(new AuthenticationException("Unhandled SASL auth status: " + status));
}
} | [
"private",
"void",
"checkIsAuthed",
"(",
"final",
"ChannelHandlerContext",
"ctx",
",",
"final",
"ResponseStatus",
"status",
")",
"{",
"if",
"(",
"status",
".",
"isSuccess",
"(",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Successfully authenticated against node... | Check if the authentication process succeeded or failed based on the response status. | [
"Check",
"if",
"the",
"authentication",
"process",
"succeeded",
"or",
"failed",
"based",
"on",
"the",
"response",
"status",
"."
] | train | https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/transport/netty/AuthHandler.java#L174-L187 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java | PosixHelp.getFileTypeLetter | public static final char getFileTypeLetter(Path path)
{
if (Files.isRegularFile(path))
{
return '-';
}
if (Files.isDirectory(path))
{
return 'd';
}
if (Files.isSymbolicLink(path))
{
return 'l';
}
throw new IllegalArgumentException(path+" is either regular file, directory or symbolic link");
} | java | public static final char getFileTypeLetter(Path path)
{
if (Files.isRegularFile(path))
{
return '-';
}
if (Files.isDirectory(path))
{
return 'd';
}
if (Files.isSymbolicLink(path))
{
return 'l';
}
throw new IllegalArgumentException(path+" is either regular file, directory or symbolic link");
} | [
"public",
"static",
"final",
"char",
"getFileTypeLetter",
"(",
"Path",
"path",
")",
"{",
"if",
"(",
"Files",
".",
"isRegularFile",
"(",
"path",
")",
")",
"{",
"return",
"'",
"'",
";",
"}",
"if",
"(",
"Files",
".",
"isDirectory",
"(",
"path",
")",
")"... | Returns '-' for regular file, 'd' for directory or 'l' for symbolic link.
@param path
@return | [
"Returns",
"-",
"for",
"regular",
"file",
"d",
"for",
"directory",
"or",
"l",
"for",
"symbolic",
"link",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L277-L292 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java | TrajectoryEnvelope.getFootprint | public static Geometry getFootprint(Polygon fp, double x, double y, double theta) {
AffineTransformation at = new AffineTransformation();
at.rotate(theta);
at.translate(x,y);
Geometry rect = at.transform(fp);
return rect;
} | java | public static Geometry getFootprint(Polygon fp, double x, double y, double theta) {
AffineTransformation at = new AffineTransformation();
at.rotate(theta);
at.translate(x,y);
Geometry rect = at.transform(fp);
return rect;
} | [
"public",
"static",
"Geometry",
"getFootprint",
"(",
"Polygon",
"fp",
",",
"double",
"x",
",",
"double",
"y",
",",
"double",
"theta",
")",
"{",
"AffineTransformation",
"at",
"=",
"new",
"AffineTransformation",
"(",
")",
";",
"at",
".",
"rotate",
"(",
"thet... | Returns a {@link Geometry} representing the footprint of a robot in a given pose.
@param fp A polygon representing the footprint of the robot centered in (0,0)
and appropriately oriented (can be obtained from a {@link TrajectoryEnvelope} instance
via method {@link TrajectoryEnvelope#getFootprint()}).
@param x The x coordinate of the pose used to create the footprint.
@param y The y coordinate of the pose used to create the footprint.
@param theta The orientation of the pose used to create the footprint.
@return A {@link Geometry} representing the footprint of the robot in a given pose. | [
"Returns",
"a",
"{"
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java#L616-L622 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java | TupleGenerator.getFailureTupleSet | private VarTupleSet getFailureTupleSet( RandSeq randSeq, FunctionInputDef inputDef)
{
List<Tuple> failureTuples = new ArrayList<Tuple>();
for( VarDefIterator vars = new VarDefIterator( inputDef); vars.hasNext(); )
{
VarDef var = vars.next();
for( Iterator<VarValueDef> failures = var.getFailureValues(); failures.hasNext(); )
{
failureTuples.add( new Tuple( new VarBindingDef( var, failures.next())));
}
}
return new VarTupleSet( RandSeq.reorderIf( randSeq, failureTuples));
} | java | private VarTupleSet getFailureTupleSet( RandSeq randSeq, FunctionInputDef inputDef)
{
List<Tuple> failureTuples = new ArrayList<Tuple>();
for( VarDefIterator vars = new VarDefIterator( inputDef); vars.hasNext(); )
{
VarDef var = vars.next();
for( Iterator<VarValueDef> failures = var.getFailureValues(); failures.hasNext(); )
{
failureTuples.add( new Tuple( new VarBindingDef( var, failures.next())));
}
}
return new VarTupleSet( RandSeq.reorderIf( randSeq, failureTuples));
} | [
"private",
"VarTupleSet",
"getFailureTupleSet",
"(",
"RandSeq",
"randSeq",
",",
"FunctionInputDef",
"inputDef",
")",
"{",
"List",
"<",
"Tuple",
">",
"failureTuples",
"=",
"new",
"ArrayList",
"<",
"Tuple",
">",
"(",
")",
";",
"for",
"(",
"VarDefIterator",
"vars... | Returns the all failure input tuples required for generated test cases. | [
"Returns",
"the",
"all",
"failure",
"input",
"tuples",
"required",
"for",
"generated",
"test",
"cases",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleGenerator.java#L714-L728 |
xerial/larray | larray-buffer/src/main/java/xerial/larray/buffer/LBufferAPI.java | LBufferAPI.copyTo | public void copyTo(long srcOffset, LBufferAPI dest, long destOffset, long size) {
unsafe.copyMemory(address() + srcOffset, dest.address() + destOffset, size);
} | java | public void copyTo(long srcOffset, LBufferAPI dest, long destOffset, long size) {
unsafe.copyMemory(address() + srcOffset, dest.address() + destOffset, size);
} | [
"public",
"void",
"copyTo",
"(",
"long",
"srcOffset",
",",
"LBufferAPI",
"dest",
",",
"long",
"destOffset",
",",
"long",
"size",
")",
"{",
"unsafe",
".",
"copyMemory",
"(",
"address",
"(",
")",
"+",
"srcOffset",
",",
"dest",
".",
"address",
"(",
")",
"... | Copy the contents of this buffer to the destination LBuffer
@param srcOffset
@param dest
@param destOffset
@param size | [
"Copy",
"the",
"contents",
"of",
"this",
"buffer",
"to",
"the",
"destination",
"LBuffer"
] | train | https://github.com/xerial/larray/blob/9a1462623c0e56ca67c5341ea29832963c29479f/larray-buffer/src/main/java/xerial/larray/buffer/LBufferAPI.java#L255-L257 |
jiaqi/jcli | src/main/java/org/cyclopsgroup/jcli/spi/CommandLineBuilder.java | CommandLineBuilder.withLongOption | public CommandLineBuilder withLongOption(String name, String value) {
cl.addOptionValue(name, value, false);
return this;
} | java | public CommandLineBuilder withLongOption(String name, String value) {
cl.addOptionValue(name, value, false);
return this;
} | [
"public",
"CommandLineBuilder",
"withLongOption",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"cl",
".",
"addOptionValue",
"(",
"name",
",",
"value",
",",
"false",
")",
";",
"return",
"this",
";",
"}"
] | Add an option with its long name
@param name Long name of the option to add
@param value Value of the option to add
@return Builder itself | [
"Add",
"an",
"option",
"with",
"its",
"long",
"name"
] | train | https://github.com/jiaqi/jcli/blob/3854b3bb3c26bbe7407bf1b6600d8b25592d398e/src/main/java/org/cyclopsgroup/jcli/spi/CommandLineBuilder.java#L60-L63 |
google/closure-templates | java/src/com/google/template/soy/data/SoyValueConverter.java | SoyValueConverter.newDictFromMap | public SoyDict newDictFromMap(Map<String, ?> javaStringMap) {
// Create a dictionary backed by a map which has eagerly converted each value into a lazy
// value provider. Specifically, the map iteration is done eagerly so that the lazy value
// provider can cache its value.
ImmutableMap.Builder<String, SoyValueProvider> builder = ImmutableMap.builder();
for (Map.Entry<String, ?> entry : javaStringMap.entrySet()) {
builder.put(entry.getKey(), convertLazy(entry.getValue()));
}
return DictImpl.forProviderMap(
builder.build(),
// This Java map could represent a Soy legacy_object_map, a Soy map, or a Soy record.
// We don't know which until one of the SoyMap, SoyLegacyObjectMap, or SoyRecord methods
// is invoked on it.
RuntimeMapTypeTracker.Type.UNKNOWN);
} | java | public SoyDict newDictFromMap(Map<String, ?> javaStringMap) {
// Create a dictionary backed by a map which has eagerly converted each value into a lazy
// value provider. Specifically, the map iteration is done eagerly so that the lazy value
// provider can cache its value.
ImmutableMap.Builder<String, SoyValueProvider> builder = ImmutableMap.builder();
for (Map.Entry<String, ?> entry : javaStringMap.entrySet()) {
builder.put(entry.getKey(), convertLazy(entry.getValue()));
}
return DictImpl.forProviderMap(
builder.build(),
// This Java map could represent a Soy legacy_object_map, a Soy map, or a Soy record.
// We don't know which until one of the SoyMap, SoyLegacyObjectMap, or SoyRecord methods
// is invoked on it.
RuntimeMapTypeTracker.Type.UNKNOWN);
} | [
"public",
"SoyDict",
"newDictFromMap",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"javaStringMap",
")",
"{",
"// Create a dictionary backed by a map which has eagerly converted each value into a lazy",
"// value provider. Specifically, the map iteration is done eagerly so that the lazy va... | Creates a Soy dictionary from a Java string map. While this is O(n) in the map's shallow size,
the Java values are converted into Soy values lazily and only once. | [
"Creates",
"a",
"Soy",
"dictionary",
"from",
"a",
"Java",
"string",
"map",
".",
"While",
"this",
"is",
"O",
"(",
"n",
")",
"in",
"the",
"map",
"s",
"shallow",
"size",
"the",
"Java",
"values",
"are",
"converted",
"into",
"Soy",
"values",
"lazily",
"and"... | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SoyValueConverter.java#L350-L364 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/tools/HOSECodeGenerator.java | HOSECodeGenerator.getHOSECode | public String getHOSECode(IAtomContainer ac, IAtom root, int noOfSpheres) throws CDKException {
return getHOSECode(ac, root, noOfSpheres, false);
} | java | public String getHOSECode(IAtomContainer ac, IAtom root, int noOfSpheres) throws CDKException {
return getHOSECode(ac, root, noOfSpheres, false);
} | [
"public",
"String",
"getHOSECode",
"(",
"IAtomContainer",
"ac",
",",
"IAtom",
"root",
",",
"int",
"noOfSpheres",
")",
"throws",
"CDKException",
"{",
"return",
"getHOSECode",
"(",
"ac",
",",
"root",
",",
"noOfSpheres",
",",
"false",
")",
";",
"}"
] | Produces a HOSE code for Atom <code>root</code> in the {@link IAtomContainer} <code>ac</code>. The HOSE
code is produced for the number of spheres given by <code>noOfSpheres</code>.
IMPORTANT: if you want aromaticity to be included in the code, you need
to run the IAtomContainer <code>ac</code> to the {@link org.openscience.cdk.aromaticity.CDKHueckelAromaticityDetector} prior to
using <code>getHOSECode()</code>. This method only gives proper results if the molecule is
fully saturated (if not, the order of the HOSE code might depend on atoms in higher spheres).
This method is known to fail for protons sometimes.
IMPORTANT: Your molecule must contain implicit or explicit hydrogens
for this method to work properly.
@param ac The {@link IAtomContainer} with the molecular skeleton in which the root atom resides
@param root The root atom for which to produce the HOSE code
@param noOfSpheres The number of spheres to look at
@return The HOSECode value
@exception org.openscience.cdk.exception.CDKException Thrown if something is wrong | [
"Produces",
"a",
"HOSE",
"code",
"for",
"Atom",
"<code",
">",
"root<",
"/",
"code",
">",
"in",
"the",
"{",
"@link",
"IAtomContainer",
"}",
"<code",
">",
"ac<",
"/",
"code",
">",
".",
"The",
"HOSE",
"code",
"is",
"produced",
"for",
"the",
"number",
"o... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/HOSECodeGenerator.java#L217-L219 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/file/FileHelper.java | FileHelper.isFileNewer | public static boolean isFileNewer (@Nonnull final File aFile1, @Nonnull final File aFile2)
{
ValueEnforcer.notNull (aFile1, "File1");
ValueEnforcer.notNull (aFile2, "aFile2");
// Compare with the same file?
if (aFile1.equals (aFile2))
return false;
// if the first file does not exists, always false
if (!aFile1.exists ())
return false;
// first file exists, but second file does not
if (!aFile2.exists ())
return true;
// both exist, compare file times
return aFile1.lastModified () > aFile2.lastModified ();
} | java | public static boolean isFileNewer (@Nonnull final File aFile1, @Nonnull final File aFile2)
{
ValueEnforcer.notNull (aFile1, "File1");
ValueEnforcer.notNull (aFile2, "aFile2");
// Compare with the same file?
if (aFile1.equals (aFile2))
return false;
// if the first file does not exists, always false
if (!aFile1.exists ())
return false;
// first file exists, but second file does not
if (!aFile2.exists ())
return true;
// both exist, compare file times
return aFile1.lastModified () > aFile2.lastModified ();
} | [
"public",
"static",
"boolean",
"isFileNewer",
"(",
"@",
"Nonnull",
"final",
"File",
"aFile1",
",",
"@",
"Nonnull",
"final",
"File",
"aFile2",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aFile1",
",",
"\"File1\"",
")",
";",
"ValueEnforcer",
".",
"notNull... | Returns <code>true</code> if the first file is newer than the second file.
Returns <code>true</code> if the first file exists and the second file does
not exist. Returns <code>false</code> if the first file is older than the
second file. Returns <code>false</code> if the first file does not exists
but the second does. Returns <code>false</code> if none of the files exist.
@param aFile1
First file. May not be <code>null</code>.
@param aFile2
Second file. May not be <code>null</code>.
@return <code>true</code> if the first file is newer than the second file,
<code>false</code> otherwise. | [
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"first",
"file",
"is",
"newer",
"than",
"the",
"second",
"file",
".",
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"first",
"file",
"exists",
"and",
"the",
"second",
... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/FileHelper.java#L535-L554 |
fcrepo3/fcrepo | fcrepo-webapp/fcrepo-webapp-fop/src/main/java/org/fcrepo/localservices/fop/FOPServlet.java | FOPServlet.renderFO | protected void renderFO(String fo, HttpServletResponse response)
throws FOPException, TransformerException, IOException {
//Setup source
Source foSrc = convertString2Source(fo);
//Setup the identity transformation
Transformer transformer = this.transFactory.newTransformer();
transformer.setURIResolver(this.uriResolver);
//Start transformation and rendering process
render(foSrc, transformer, response);
} | java | protected void renderFO(String fo, HttpServletResponse response)
throws FOPException, TransformerException, IOException {
//Setup source
Source foSrc = convertString2Source(fo);
//Setup the identity transformation
Transformer transformer = this.transFactory.newTransformer();
transformer.setURIResolver(this.uriResolver);
//Start transformation and rendering process
render(foSrc, transformer, response);
} | [
"protected",
"void",
"renderFO",
"(",
"String",
"fo",
",",
"HttpServletResponse",
"response",
")",
"throws",
"FOPException",
",",
"TransformerException",
",",
"IOException",
"{",
"//Setup source",
"Source",
"foSrc",
"=",
"convertString2Source",
"(",
"fo",
")",
";",
... | Renders an XSL-FO file into a PDF file. The PDF is written to a byte
array that is returned as the method's result.
@param fo the XSL-FO file
@param response HTTP response object
@throws FOPException If an error occurs during the rendering of the
XSL-FO
@throws TransformerException If an error occurs while parsing the input
file
@throws IOException In case of an I/O problem | [
"Renders",
"an",
"XSL",
"-",
"FO",
"file",
"into",
"a",
"PDF",
"file",
".",
"The",
"PDF",
"is",
"written",
"to",
"a",
"byte",
"array",
"that",
"is",
"returned",
"as",
"the",
"method",
"s",
"result",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-webapp/fcrepo-webapp-fop/src/main/java/org/fcrepo/localservices/fop/FOPServlet.java#L139-L151 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/pattern/Patterns.java | Patterns.matchString | private static int matchString(String str, CharSequence src, int begin, int end) {
final int patternLength = str.length();
int i = 0;
for (; (i < patternLength) && ((begin + i) < end); i++) {
final char exp = str.charAt(i);
final char enc = src.charAt(begin + i);
if (exp != enc) return Pattern.MISMATCH;
}
return i;
} | java | private static int matchString(String str, CharSequence src, int begin, int end) {
final int patternLength = str.length();
int i = 0;
for (; (i < patternLength) && ((begin + i) < end); i++) {
final char exp = str.charAt(i);
final char enc = src.charAt(begin + i);
if (exp != enc) return Pattern.MISMATCH;
}
return i;
} | [
"private",
"static",
"int",
"matchString",
"(",
"String",
"str",
",",
"CharSequence",
"src",
",",
"int",
"begin",
",",
"int",
"end",
")",
"{",
"final",
"int",
"patternLength",
"=",
"str",
".",
"length",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"for"... | Matches (part of) a character sequence against a pattern string.
@param str the pattern string.
@param src the input sequence. Must not be null.
@param begin start of index to scan characters from <code>src</code>.
@param end end of index to scan characters from <code>src</code>.
@return the number of characters matched, or {@link Pattern#MISMATCH} if an unexpected character is encountered. | [
"Matches",
"(",
"part",
"of",
")",
"a",
"character",
"sequence",
"against",
"a",
"pattern",
"string",
"."
] | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/pattern/Patterns.java#L598-L607 |
Azure/azure-sdk-for-java | policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionsInner.java | PolicyDefinitionsInner.getAtManagementGroupAsync | public Observable<PolicyDefinitionInner> getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) {
return getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1<ServiceResponse<PolicyDefinitionInner>, PolicyDefinitionInner>() {
@Override
public PolicyDefinitionInner call(ServiceResponse<PolicyDefinitionInner> response) {
return response.body();
}
});
} | java | public Observable<PolicyDefinitionInner> getAtManagementGroupAsync(String policyDefinitionName, String managementGroupId) {
return getAtManagementGroupWithServiceResponseAsync(policyDefinitionName, managementGroupId).map(new Func1<ServiceResponse<PolicyDefinitionInner>, PolicyDefinitionInner>() {
@Override
public PolicyDefinitionInner call(ServiceResponse<PolicyDefinitionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PolicyDefinitionInner",
">",
"getAtManagementGroupAsync",
"(",
"String",
"policyDefinitionName",
",",
"String",
"managementGroupId",
")",
"{",
"return",
"getAtManagementGroupWithServiceResponseAsync",
"(",
"policyDefinitionName",
",",
"managementGr... | Gets the policy definition at management group level.
@param policyDefinitionName The name of the policy definition to get.
@param managementGroupId The ID of the management group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PolicyDefinitionInner object | [
"Gets",
"the",
"policy",
"definition",
"at",
"management",
"group",
"level",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/policy/v2016_12_01/implementation/PolicyDefinitionsInner.java#L648-L655 |
groupon/odo | proxylib/src/main/java/com/groupon/odo/proxylib/EditService.java | EditService.removePathnameFromProfile | public void removePathnameFromProfile(int path_id, int profileId) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"DELETE FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE +
" WHERE " + Constants.ENABLED_OVERRIDES_PATH_ID + " = ?"
);
statement.setInt(1, path_id);
statement.executeUpdate();
statement.close();
statement = sqlConnection.prepareStatement(
"DELETE FROM " + Constants.DB_TABLE_PATH +
" WHERE " + Constants.GENERIC_ID + " = ?"
);
statement.setInt(1, path_id);
statement.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} | java | public void removePathnameFromProfile(int path_id, int profileId) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"DELETE FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE +
" WHERE " + Constants.ENABLED_OVERRIDES_PATH_ID + " = ?"
);
statement.setInt(1, path_id);
statement.executeUpdate();
statement.close();
statement = sqlConnection.prepareStatement(
"DELETE FROM " + Constants.DB_TABLE_PATH +
" WHERE " + Constants.GENERIC_ID + " = ?"
);
statement.setInt(1, path_id);
statement.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} | [
"public",
"void",
"removePathnameFromProfile",
"(",
"int",
"path_id",
",",
"int",
"profileId",
")",
"{",
"PreparedStatement",
"statement",
"=",
"null",
";",
"try",
"(",
"Connection",
"sqlConnection",
"=",
"sqlService",
".",
"getConnection",
"(",
")",
")",
"{",
... | Remove a path from a profile
@param path_id path ID to remove
@param profileId profile ID to remove path from | [
"Remove",
"a",
"path",
"from",
"a",
"profile"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/EditService.java#L150-L177 |
albfernandez/itext2 | src/main/java/com/lowagie/text/ImgWMF.java | ImgWMF.readWMF | public void readWMF(PdfTemplate template) throws IOException, DocumentException {
setTemplateData(template);
template.setWidth(getWidth());
template.setHeight(getHeight());
InputStream is = null;
try {
if (rawData == null){
is = url.openStream();
}
else{
is = new java.io.ByteArrayInputStream(rawData);
}
MetaDo meta = new MetaDo(is, template);
meta.readAll();
}
finally {
if (is != null) {
is.close();
}
}
} | java | public void readWMF(PdfTemplate template) throws IOException, DocumentException {
setTemplateData(template);
template.setWidth(getWidth());
template.setHeight(getHeight());
InputStream is = null;
try {
if (rawData == null){
is = url.openStream();
}
else{
is = new java.io.ByteArrayInputStream(rawData);
}
MetaDo meta = new MetaDo(is, template);
meta.readAll();
}
finally {
if (is != null) {
is.close();
}
}
} | [
"public",
"void",
"readWMF",
"(",
"PdfTemplate",
"template",
")",
"throws",
"IOException",
",",
"DocumentException",
"{",
"setTemplateData",
"(",
"template",
")",
";",
"template",
".",
"setWidth",
"(",
"getWidth",
"(",
")",
")",
";",
"template",
".",
"setHeigh... | Reads the WMF into a template.
@param template the template to read to
@throws IOException on error
@throws DocumentException on error | [
"Reads",
"the",
"WMF",
"into",
"a",
"template",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/ImgWMF.java#L169-L189 |
xebia-france/xebia-servlet-extras | src/main/java/fr/xebia/servlet/filter/ExpiresFilter.java | ExpiresFilter.substringBefore | protected static String substringBefore(String str, String separator) {
if (isEmpty(str) || separator == null) {
return null;
}
if (separator.length() == 0) {
return "";
}
int separatorIndex = str.indexOf(separator);
if (separatorIndex == -1) {
return str;
}
return str.substring(0, separatorIndex);
} | java | protected static String substringBefore(String str, String separator) {
if (isEmpty(str) || separator == null) {
return null;
}
if (separator.length() == 0) {
return "";
}
int separatorIndex = str.indexOf(separator);
if (separatorIndex == -1) {
return str;
}
return str.substring(0, separatorIndex);
} | [
"protected",
"static",
"String",
"substringBefore",
"(",
"String",
"str",
",",
"String",
"separator",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"str",
")",
"||",
"separator",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"separator",
".",
"... | Return the subset of the given <code>str</code> that is before the first
occurence of the given <code>separator</code>. Return <code>null</code>
if the given <code>str</code> or the given <code>separator</code> is
null. Return and empty string if the <code>separator</code> is empty.
@param str
can be <code>null</code>
@param separator
can be <code>null</code>
@return | [
"Return",
"the",
"subset",
"of",
"the",
"given",
"<code",
">",
"str<",
"/",
"code",
">",
"that",
"is",
"before",
"the",
"first",
"occurence",
"of",
"the",
"given",
"<code",
">",
"separator<",
"/",
"code",
">",
".",
"Return",
"<code",
">",
"null<",
"/",... | train | https://github.com/xebia-france/xebia-servlet-extras/blob/b263636fc78f8794dde57d92b835edb5e95ce379/src/main/java/fr/xebia/servlet/filter/ExpiresFilter.java#L1193-L1207 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java | BaseNeo4jAssociationQueries.initFindRelationshipQuery | private static String initFindRelationshipQuery(EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata) {
int offset = 0;
StringBuilder queryBuilder = new StringBuilder( "MATCH " );
queryBuilder.append( "(n:" );
queryBuilder.append( ENTITY );
queryBuilder.append( ":" );
appendLabel( ownerEntityKeyMetadata, queryBuilder );
appendProperties( ownerEntityKeyMetadata, queryBuilder );
queryBuilder.append( ") - " );
queryBuilder.append( "[r" );
queryBuilder.append( ":" );
appendRelationshipType( queryBuilder, associationKeyMetadata );
offset = ownerEntityKeyMetadata.getColumnNames().length;
if ( associationKeyMetadata.getRowKeyIndexColumnNames().length > 0 ) {
appendProperties( queryBuilder, associationKeyMetadata.getRowKeyIndexColumnNames(), offset );
queryBuilder.append( "] - (t" );
}
else {
queryBuilder.append( "] - (t" );
appendProperties( queryBuilder, associationKeyMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata().getColumnNames(), offset );
}
queryBuilder.append( ")" );
queryBuilder.append( " RETURN r" );
return queryBuilder.toString();
} | java | private static String initFindRelationshipQuery(EntityKeyMetadata ownerEntityKeyMetadata, AssociationKeyMetadata associationKeyMetadata) {
int offset = 0;
StringBuilder queryBuilder = new StringBuilder( "MATCH " );
queryBuilder.append( "(n:" );
queryBuilder.append( ENTITY );
queryBuilder.append( ":" );
appendLabel( ownerEntityKeyMetadata, queryBuilder );
appendProperties( ownerEntityKeyMetadata, queryBuilder );
queryBuilder.append( ") - " );
queryBuilder.append( "[r" );
queryBuilder.append( ":" );
appendRelationshipType( queryBuilder, associationKeyMetadata );
offset = ownerEntityKeyMetadata.getColumnNames().length;
if ( associationKeyMetadata.getRowKeyIndexColumnNames().length > 0 ) {
appendProperties( queryBuilder, associationKeyMetadata.getRowKeyIndexColumnNames(), offset );
queryBuilder.append( "] - (t" );
}
else {
queryBuilder.append( "] - (t" );
appendProperties( queryBuilder, associationKeyMetadata.getAssociatedEntityKeyMetadata().getEntityKeyMetadata().getColumnNames(), offset );
}
queryBuilder.append( ")" );
queryBuilder.append( " RETURN r" );
return queryBuilder.toString();
} | [
"private",
"static",
"String",
"initFindRelationshipQuery",
"(",
"EntityKeyMetadata",
"ownerEntityKeyMetadata",
",",
"AssociationKeyMetadata",
"associationKeyMetadata",
")",
"{",
"int",
"offset",
"=",
"0",
";",
"StringBuilder",
"queryBuilder",
"=",
"new",
"StringBuilder",
... | /*
Example with target node:
MATCH (n:ENTITY:table {id: {0}}) -[r:role] - (t {id: {1}})
RETURN r
Example with relationship indexes:
MATCH (n:ENTITY:table {id: {0}}) -[r:role {index: {1}}] - (t)
RETURN r | [
"/",
"*",
"Example",
"with",
"target",
"node",
":"
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/dialect/impl/BaseNeo4jAssociationQueries.java#L79-L103 |
Red5/red5-io | src/main/java/org/red5/io/utils/ConversionUtils.java | ConversionUtils.convertMapToBean | public static Object convertMapToBean(Map<String, ? extends Object> source, Class<?> target) throws ConversionException {
Object bean = newInstance(target);
if (bean == null) {
//try with just the target name as specified in Trac #352
bean = newInstance(target.getName());
if (bean == null) {
throw new ConversionException("Unable to create bean using empty constructor");
}
}
try {
BeanUtils.populate(bean, source);
} catch (Exception e) {
throw new ConversionException("Error populating bean", e);
}
return bean;
} | java | public static Object convertMapToBean(Map<String, ? extends Object> source, Class<?> target) throws ConversionException {
Object bean = newInstance(target);
if (bean == null) {
//try with just the target name as specified in Trac #352
bean = newInstance(target.getName());
if (bean == null) {
throw new ConversionException("Unable to create bean using empty constructor");
}
}
try {
BeanUtils.populate(bean, source);
} catch (Exception e) {
throw new ConversionException("Error populating bean", e);
}
return bean;
} | [
"public",
"static",
"Object",
"convertMapToBean",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"source",
",",
"Class",
"<",
"?",
">",
"target",
")",
"throws",
"ConversionException",
"{",
"Object",
"bean",
"=",
"newInstance",
"(",
"target",
... | Convert map to bean
@param source
Source map
@param target
Target class
@return Bean of that class
@throws ConversionException
on failure | [
"Convert",
"map",
"to",
"bean"
] | train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L416-L431 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateHierarchicalEntity | public OperationStatus updateHierarchicalEntity(UUID appId, String versionId, UUID hEntityId, HierarchicalEntityModel hierarchicalModelUpdateObject) {
return updateHierarchicalEntityWithServiceResponseAsync(appId, versionId, hEntityId, hierarchicalModelUpdateObject).toBlocking().single().body();
} | java | public OperationStatus updateHierarchicalEntity(UUID appId, String versionId, UUID hEntityId, HierarchicalEntityModel hierarchicalModelUpdateObject) {
return updateHierarchicalEntityWithServiceResponseAsync(appId, versionId, hEntityId, hierarchicalModelUpdateObject).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateHierarchicalEntity",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
",",
"HierarchicalEntityModel",
"hierarchicalModelUpdateObject",
")",
"{",
"return",
"updateHierarchicalEntityWithServiceResponseAsync",
"(",
"... | Updates the name and children of a hierarchical entity model.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@param hierarchicalModelUpdateObject Model containing names of the children of the hierarchical entity.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Updates",
"the",
"name",
"and",
"children",
"of",
"a",
"hierarchical",
"entity",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L3748-L3750 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java | JavacProcessingEnvironment.importStringToPattern | private static Pattern importStringToPattern(String s, Processor p, Log log) {
if (isValidImportString(s)) {
return validImportStringToPattern(s);
} else {
log.warning("proc.malformed.supported.string", s, p.getClass().getName());
return noMatches; // won't match any valid identifier
}
} | java | private static Pattern importStringToPattern(String s, Processor p, Log log) {
if (isValidImportString(s)) {
return validImportStringToPattern(s);
} else {
log.warning("proc.malformed.supported.string", s, p.getClass().getName());
return noMatches; // won't match any valid identifier
}
} | [
"private",
"static",
"Pattern",
"importStringToPattern",
"(",
"String",
"s",
",",
"Processor",
"p",
",",
"Log",
"log",
")",
"{",
"if",
"(",
"isValidImportString",
"(",
"s",
")",
")",
"{",
"return",
"validImportStringToPattern",
"(",
"s",
")",
";",
"}",
"el... | Convert import-style string for supported annotations into a
regex matching that string. If the string is a valid
import-style string, return a regex that won't match anything. | [
"Convert",
"import",
"-",
"style",
"string",
"for",
"supported",
"annotations",
"into",
"a",
"regex",
"matching",
"that",
"string",
".",
"If",
"the",
"string",
"is",
"a",
"valid",
"import",
"-",
"style",
"string",
"return",
"a",
"regex",
"that",
"won",
"t"... | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#L1456-L1463 |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java | ParseTreeUtils.collectNodesByPath | public static <V, C extends Collection<Node<V>>> C collectNodesByPath(Node<V> parent, String path, C collection) {
checkArgNotNull(path, "path");
checkArgNotNull(collection, "collection");
return parent != null && hasChildren(parent) ?
collectNodesByPath(parent.getChildren(), path, collection) : collection;
} | java | public static <V, C extends Collection<Node<V>>> C collectNodesByPath(Node<V> parent, String path, C collection) {
checkArgNotNull(path, "path");
checkArgNotNull(collection, "collection");
return parent != null && hasChildren(parent) ?
collectNodesByPath(parent.getChildren(), path, collection) : collection;
} | [
"public",
"static",
"<",
"V",
",",
"C",
"extends",
"Collection",
"<",
"Node",
"<",
"V",
">",
">",
">",
"C",
"collectNodesByPath",
"(",
"Node",
"<",
"V",
">",
"parent",
",",
"String",
"path",
",",
"C",
"collection",
")",
"{",
"checkArgNotNull",
"(",
"... | Collects all nodes underneath the given parent that match the given path.
The path is a '/' separated list of node label prefixes describing the ancestor chain of the node to look for
relative to the given parent node.
@param parent the parent Node
@param path the path to the Nodes being searched for
@param collection the collection to collect the found Nodes into
@return the same collection instance passed as a parameter | [
"Collects",
"all",
"nodes",
"underneath",
"the",
"given",
"parent",
"that",
"match",
"the",
"given",
"path",
".",
"The",
"path",
"is",
"a",
"/",
"separated",
"list",
"of",
"node",
"label",
"prefixes",
"describing",
"the",
"ancestor",
"chain",
"of",
"the",
... | train | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L98-L103 |
kiswanij/jk-util | src/main/java/com/jk/util/zip/JKZipUtility.java | JKZipUtility.extractFile | protected static void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
byte[] bytesIn = new byte[BUFFER_SIZE];
int read = 0;
while ((read = zipIn.read(bytesIn)) != -1) {
bos.write(bytesIn, 0, read);
}
bos.close();
} | java | protected static void extractFile(ZipInputStream zipIn, String filePath) throws IOException {
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath));
byte[] bytesIn = new byte[BUFFER_SIZE];
int read = 0;
while ((read = zipIn.read(bytesIn)) != -1) {
bos.write(bytesIn, 0, read);
}
bos.close();
} | [
"protected",
"static",
"void",
"extractFile",
"(",
"ZipInputStream",
"zipIn",
",",
"String",
"filePath",
")",
"throws",
"IOException",
"{",
"BufferedOutputStream",
"bos",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"filePath",
")",
")",
... | Extracts a zip entry (file entry)
@param zipIn
@param filePath
@throws IOException | [
"Extracts",
"a",
"zip",
"entry",
"(",
"file",
"entry",
")"
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/zip/JKZipUtility.java#L69-L77 |
jglobus/JGlobus | gss/src/main/java/org/globus/gsi/gssapi/SSLUtil.java | SSLUtil.writeInt | public static void writeInt(int v, byte[] buf, int off) {
buf[off] = (byte)((v >>> 24) & 0xFF);
buf[off+1] = (byte)((v >>> 16) & 0xFF);
buf[off+2] = (byte)((v >>> 8) & 0xFF);
buf[off+3] = (byte)((v >>> 0) & 0xFF);
} | java | public static void writeInt(int v, byte[] buf, int off) {
buf[off] = (byte)((v >>> 24) & 0xFF);
buf[off+1] = (byte)((v >>> 16) & 0xFF);
buf[off+2] = (byte)((v >>> 8) & 0xFF);
buf[off+3] = (byte)((v >>> 0) & 0xFF);
} | [
"public",
"static",
"void",
"writeInt",
"(",
"int",
"v",
",",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
")",
"{",
"buf",
"[",
"off",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"v",
">>>",
"24",
")",
"&",
"0xFF",
")",
";",
"buf",
"[",
"off",
"+... | Converts the specified int value into
4 bytes. The bytes are put into the
specified byte array at a given offset
location.
@param v the int value to convert into 4 bytes.
@param buf the byte array to put the resulting
4 bytes.
@param off offset in the byte array | [
"Converts",
"the",
"specified",
"int",
"value",
"into",
"4",
"bytes",
".",
"The",
"bytes",
"are",
"put",
"into",
"the",
"specified",
"byte",
"array",
"at",
"a",
"given",
"offset",
"location",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/gsi/gssapi/SSLUtil.java#L185-L190 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java | PageServiceImpl.toStream | StreamSource toStream(byte[] buffer, int rowOffset, byte []blobBuffer)
{
Row row = _table.row();
return new RowStreamSource(row.getInSkeleton(), buffer, rowOffset,
_table.getPageActor());
} | java | StreamSource toStream(byte[] buffer, int rowOffset, byte []blobBuffer)
{
Row row = _table.row();
return new RowStreamSource(row.getInSkeleton(), buffer, rowOffset,
_table.getPageActor());
} | [
"StreamSource",
"toStream",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"rowOffset",
",",
"byte",
"[",
"]",
"blobBuffer",
")",
"{",
"Row",
"row",
"=",
"_table",
".",
"row",
"(",
")",
";",
"return",
"new",
"RowStreamSource",
"(",
"row",
".",
"getInSkel... | /*
private StreamSource toStreamOld(byte[] buffer, int rowOffset, byte []blobBuffer)
{
try {
TempStore tempStore = _table.getTempStore();
TempWriter tos = tempStore.openWriter();
Row row = _table.getRow();
row.writeStream(tos, buffer, rowOffset, blobBuffer, this);
if (tos.getLength() <= 0) {
Thread.dumpStack();
}
StreamSource source = tos.getStreamSource();
return source;
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"/",
"*",
"private",
"StreamSource",
"toStreamOld",
"(",
"byte",
"[]",
"buffer",
"int",
"rowOffset",
"byte",
"[]",
"blobBuffer",
")",
"{",
"try",
"{",
"TempStore",
"tempStore",
"=",
"_table",
".",
"getTempStore",
"()",
";"
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageServiceImpl.java#L1312-L1318 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java | JdbcCpoXaAdapter.insertObject | @Override
public <T> long insertObject(String name, T obj) throws CpoException {
return getCurrentResource().insertObject(name, obj);
} | java | @Override
public <T> long insertObject(String name, T obj) throws CpoException {
return getCurrentResource().insertObject(name, obj);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"long",
"insertObject",
"(",
"String",
"name",
",",
"T",
"obj",
")",
"throws",
"CpoException",
"{",
"return",
"getCurrentResource",
"(",
")",
".",
"insertObject",
"(",
"name",
",",
"obj",
")",
";",
"}"
] | Creates the Object in the datasource. The assumption is that the object does not exist in the datasource. This
method creates and stores the object in the datasource
<p>
<pre>Example:
<code>
<p>
class SomeObject so = new SomeObject();
class CpoAdapter cpo = null;
<p>
try {
cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
} catch (CpoException ce) {
// Handle the error
cpo = null;
}
if (cpo!=null) {
so.setId(1);
so.setName("SomeName");
try{
cpo.insertObject("IDNameInsert",so);
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The String name of the CREATE Function Group that will be used to create the object in the datasource.
null signifies that the default rules will be used which is equivalent to insertObject(Object obj);
@param obj This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown.
@return The number of objects created in the datasource
@throws CpoException Thrown if there are errors accessing the datasource | [
"Creates",
"the",
"Object",
"in",
"the",
"datasource",
".",
"The",
"assumption",
"is",
"that",
"the",
"object",
"does",
"not",
"exist",
"in",
"the",
"datasource",
".",
"This",
"method",
"creates",
"and",
"stores",
"the",
"object",
"in",
"the",
"datasource",
... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L199-L202 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/util/VelocityParser.java | VelocityParser.getVar | public int getVar(char[] array, int currentIndex, StringBuffer velocityBlock, VelocityParserContext context)
throws InvalidVelocityException
{
return getVar(array, currentIndex, null, velocityBlock, context);
} | java | public int getVar(char[] array, int currentIndex, StringBuffer velocityBlock, VelocityParserContext context)
throws InvalidVelocityException
{
return getVar(array, currentIndex, null, velocityBlock, context);
} | [
"public",
"int",
"getVar",
"(",
"char",
"[",
"]",
"array",
",",
"int",
"currentIndex",
",",
"StringBuffer",
"velocityBlock",
",",
"VelocityParserContext",
"context",
")",
"throws",
"InvalidVelocityException",
"{",
"return",
"getVar",
"(",
"array",
",",
"currentInd... | Get any valid Velocity starting with a <code>$</code>.
@param array the source to parse
@param currentIndex the current index in the <code>array</code>
@param velocityBlock the buffer where to append matched velocity block
@param context the parser context to put some informations
@return the index in the <code>array</code> after the matched block
@throws InvalidVelocityException not a valid velocity block | [
"Get",
"any",
"valid",
"Velocity",
"starting",
"with",
"a",
"<code",
">",
"$<",
"/",
"code",
">",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/internal/util/VelocityParser.java#L356-L360 |
denisneuling/apitrary.jar | apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java | ClassUtil.getValueOf | public static <T> T getValueOf(String fieldName, Object reference, Class<?> referenceClazz, Class<T> valueType) {
try {
Field field = referenceClazz.getDeclaredField(fieldName);
field.setAccessible(true);
@SuppressWarnings("unchecked")
T toReturn = (T) field.get(reference);
return toReturn;
} catch (Exception e) {
log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
return null;
}
} | java | public static <T> T getValueOf(String fieldName, Object reference, Class<?> referenceClazz, Class<T> valueType) {
try {
Field field = referenceClazz.getDeclaredField(fieldName);
field.setAccessible(true);
@SuppressWarnings("unchecked")
T toReturn = (T) field.get(reference);
return toReturn;
} catch (Exception e) {
log.warning(e.getClass().getSimpleName() + ": " + e.getMessage());
return null;
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getValueOf",
"(",
"String",
"fieldName",
",",
"Object",
"reference",
",",
"Class",
"<",
"?",
">",
"referenceClazz",
",",
"Class",
"<",
"T",
">",
"valueType",
")",
"{",
"try",
"{",
"Field",
"field",
"=",
"referen... | <p>
getValueOf.
</p>
@param fieldName
a {@link java.lang.String} object.
@param referenceClazz
a {@link java.lang.Class} object.
@param valueType
a {@link java.lang.Class} object.
@param <T>
a T object.
@return a T object. | [
"<p",
">",
"getValueOf",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java#L215-L227 |
scalanlp/breeze | math/src/main/java/breeze/linalg/operators/DenseVectorSupportMethods.java | DenseVectorSupportMethods.smallDotProduct_Double | public static double smallDotProduct_Double(double[] a, double[] b, int length) {
double sumA = 0.0;
double sumB = 0.0;
switch (length) {
case 7:
sumA = a[6] * b[6];
case 6:
sumB = a[5] * b[5];
case 5:
sumA += a[4] * b[4];
case 4:
sumB += a[3] * b[3];
case 3:
sumA += a[2] * b[2];
case 2:
sumB += a[1] * b[1];
case 1:
sumA += a[0] * b[0];
case 0:
default:
return sumA + sumB;
}
} | java | public static double smallDotProduct_Double(double[] a, double[] b, int length) {
double sumA = 0.0;
double sumB = 0.0;
switch (length) {
case 7:
sumA = a[6] * b[6];
case 6:
sumB = a[5] * b[5];
case 5:
sumA += a[4] * b[4];
case 4:
sumB += a[3] * b[3];
case 3:
sumA += a[2] * b[2];
case 2:
sumB += a[1] * b[1];
case 1:
sumA += a[0] * b[0];
case 0:
default:
return sumA + sumB;
}
} | [
"public",
"static",
"double",
"smallDotProduct_Double",
"(",
"double",
"[",
"]",
"a",
",",
"double",
"[",
"]",
"b",
",",
"int",
"length",
")",
"{",
"double",
"sumA",
"=",
"0.0",
";",
"double",
"sumB",
"=",
"0.0",
";",
"switch",
"(",
"length",
")",
"{... | WARNING: only returns the right answer for vectors of length < MAX_SMALL_DOT_PRODUCT_LENGTH
@param a
@param b
@param length
@return | [
"WARNING",
":",
"only",
"returns",
"the",
"right",
"answer",
"for",
"vectors",
"of",
"length",
"<",
"MAX_SMALL_DOT_PRODUCT_LENGTH"
] | train | https://github.com/scalanlp/breeze/blob/aeb3360ce77d79490fe48bc5fe2bb40f18289908/math/src/main/java/breeze/linalg/operators/DenseVectorSupportMethods.java#L19-L41 |
alkacon/opencms-core | src/org/opencms/xml/content/CmsXmlContentFactory.java | CmsXmlContentFactory.createDocument | public static CmsXmlContent createDocument(CmsObject cms, Locale locale, String modelUri) throws CmsException {
// create the XML content
CmsXmlContent content = new CmsXmlContent(cms, locale, modelUri);
// call prepare for use content handler and return the result
return content.getContentDefinition().getContentHandler().prepareForUse(cms, content);
} | java | public static CmsXmlContent createDocument(CmsObject cms, Locale locale, String modelUri) throws CmsException {
// create the XML content
CmsXmlContent content = new CmsXmlContent(cms, locale, modelUri);
// call prepare for use content handler and return the result
return content.getContentDefinition().getContentHandler().prepareForUse(cms, content);
} | [
"public",
"static",
"CmsXmlContent",
"createDocument",
"(",
"CmsObject",
"cms",
",",
"Locale",
"locale",
",",
"String",
"modelUri",
")",
"throws",
"CmsException",
"{",
"// create the XML content",
"CmsXmlContent",
"content",
"=",
"new",
"CmsXmlContent",
"(",
"cms",
... | Create a new instance of an XML content based on the given default content,
hat will have all language nodes of the default content and ensures the presence of the given locale.<p>
The given encoding is used when marshalling the XML again later.<p>
@param cms the current users OpenCms content
@param locale the locale to generate the default content for
@param modelUri the absolute path to the XML content file acting as model
@throws CmsException in case the model file is not found or not valid
@return the created XML content | [
"Create",
"a",
"new",
"instance",
"of",
"an",
"XML",
"content",
"based",
"on",
"the",
"given",
"default",
"content",
"hat",
"will",
"have",
"all",
"language",
"nodes",
"of",
"the",
"default",
"content",
"and",
"ensures",
"the",
"presence",
"of",
"the",
"gi... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentFactory.java#L106-L112 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.divide | public static void divide(double alpha , DMatrixD1 a , DMatrixD1 b)
{
b.reshape(a.numRows,a.numCols);
final int size = a.getNumElements();
for( int i = 0; i < size; i++ ) {
b.data[i] = alpha/a.data[i];
}
} | java | public static void divide(double alpha , DMatrixD1 a , DMatrixD1 b)
{
b.reshape(a.numRows,a.numCols);
final int size = a.getNumElements();
for( int i = 0; i < size; i++ ) {
b.data[i] = alpha/a.data[i];
}
} | [
"public",
"static",
"void",
"divide",
"(",
"double",
"alpha",
",",
"DMatrixD1",
"a",
",",
"DMatrixD1",
"b",
")",
"{",
"b",
".",
"reshape",
"(",
"a",
".",
"numRows",
",",
"a",
".",
"numCols",
")",
";",
"final",
"int",
"size",
"=",
"a",
".",
"getNumE... | <p>
Performs an element by element scalar division with the scalar on top.<br>
<br>
b<sub>ij</sub> = α/a<sub>ij</sub>
</p>
@param alpha The numerator.
@param a The matrix whose elements are the divisor. Not modified.
@param b Where the results are stored. Modified. | [
"<p",
">",
"Performs",
"an",
"element",
"by",
"element",
"scalar",
"division",
"with",
"the",
"scalar",
"on",
"top",
".",
"<br",
">",
"<br",
">",
"b<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"&alpha",
";",
"/",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2468-L2477 |
hellosign/hellosign-java-sdk | src/main/java/com/hellosign/sdk/http/HttpClient.java | HttpClient.disableStrictSSL | private void disableStrictSSL() {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
} };
// Ignore differences between given hostname and certificate hostname
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
// Install the all-trusting trust manager
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(hv);
} catch (Exception e) {
}
} | java | private void disableStrictSSL() {
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
} };
// Ignore differences between given hostname and certificate hostname
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
// Install the all-trusting trust manager
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(hv);
} catch (Exception e) {
}
} | [
"private",
"void",
"disableStrictSSL",
"(",
")",
"{",
"// Create a trust manager that does not validate certificate chains",
"TrustManager",
"[",
"]",
"trustAllCerts",
"=",
"new",
"TrustManager",
"[",
"]",
"{",
"new",
"X509TrustManager",
"(",
")",
"{",
"public",
"X509Ce... | Helper method that allows this client to ignore SSL certificates when
making API requests. | [
"Helper",
"method",
"that",
"allows",
"this",
"client",
"to",
"ignore",
"SSL",
"certificates",
"when",
"making",
"API",
"requests",
"."
] | train | https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/http/HttpClient.java#L360-L389 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata/model/curves/DiscountCurveInterpolation.java | DiscountCurveInterpolation.createDiscountCurveFromZeroRates | public static DiscountCurveInterpolation createDiscountCurveFromZeroRates(
String name, LocalDate referenceDate,
double[] times, double[] givenZeroRates, boolean[] isParameter,
InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) {
double[] givenDiscountFactors = new double[givenZeroRates.length];
for(int timeIndex=0; timeIndex<times.length;timeIndex++) {
givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
}
return createDiscountCurveFromDiscountFactors(name, referenceDate, times, givenDiscountFactors, isParameter, interpolationMethod, extrapolationMethod, interpolationEntity);
} | java | public static DiscountCurveInterpolation createDiscountCurveFromZeroRates(
String name, LocalDate referenceDate,
double[] times, double[] givenZeroRates, boolean[] isParameter,
InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) {
double[] givenDiscountFactors = new double[givenZeroRates.length];
for(int timeIndex=0; timeIndex<times.length;timeIndex++) {
givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
}
return createDiscountCurveFromDiscountFactors(name, referenceDate, times, givenDiscountFactors, isParameter, interpolationMethod, extrapolationMethod, interpolationEntity);
} | [
"public",
"static",
"DiscountCurveInterpolation",
"createDiscountCurveFromZeroRates",
"(",
"String",
"name",
",",
"LocalDate",
"referenceDate",
",",
"double",
"[",
"]",
"times",
",",
"double",
"[",
"]",
"givenZeroRates",
",",
"boolean",
"[",
"]",
"isParameter",
",",... | Create a discount curve from given times and given zero rates using given interpolation and extrapolation methods.
The discount factor is determined by
<code>
givenDiscountFactors[timeIndex] = Math.exp(- givenZeroRates[timeIndex] * times[timeIndex]);
</code>
@param name The name of this discount curve.
@param referenceDate The reference date for this curve, i.e., the date which defined t=0.
@param times Array of times as doubles.
@param givenZeroRates Array of corresponding zero rates.
@param isParameter Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves).
@param interpolationMethod The interpolation method used for the curve.
@param extrapolationMethod The extrapolation method used for the curve.
@param interpolationEntity The entity interpolated/extrapolated.
@return A new discount factor object. | [
"Create",
"a",
"discount",
"curve",
"from",
"given",
"times",
"and",
"given",
"zero",
"rates",
"using",
"given",
"interpolation",
"and",
"extrapolation",
"methods",
".",
"The",
"discount",
"factor",
"is",
"determined",
"by",
"<code",
">",
"givenDiscountFactors",
... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/curves/DiscountCurveInterpolation.java#L183-L195 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.createCustomField | public CustomFields createCustomField(String accountId, CustomField customField, AccountsApi.CreateCustomFieldOptions options) throws ApiException {
Object localVarPostBody = customField;
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling createCustomField");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/custom_fields".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "apply_to_templates", options.applyToTemplates));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<CustomFields> localVarReturnType = new GenericType<CustomFields>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | java | public CustomFields createCustomField(String accountId, CustomField customField, AccountsApi.CreateCustomFieldOptions options) throws ApiException {
Object localVarPostBody = customField;
// verify the required parameter 'accountId' is set
if (accountId == null) {
throw new ApiException(400, "Missing the required parameter 'accountId' when calling createCustomField");
}
// create path and map variables
String localVarPath = "/v2/accounts/{accountId}/custom_fields".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString()));
// query params
java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>();
java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>();
java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>();
if (options != null) {
localVarQueryParams.addAll(apiClient.parameterToPairs("", "apply_to_templates", options.applyToTemplates));
}
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ };
GenericType<CustomFields> localVarReturnType = new GenericType<CustomFields>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | [
"public",
"CustomFields",
"createCustomField",
"(",
"String",
"accountId",
",",
"CustomField",
"customField",
",",
"AccountsApi",
".",
"CreateCustomFieldOptions",
"options",
")",
"throws",
"ApiException",
"{",
"Object",
"localVarPostBody",
"=",
"customField",
";",
"// v... | Creates an acount custom field.
@param accountId The external account number (int) or account ID Guid. (required)
@param customField (optional)
@param options for modifying the method behavior.
@return CustomFields
@throws ApiException if fails to make API call | [
"Creates",
"an",
"acount",
"custom",
"field",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L212-L248 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java | CmsCloneModuleThread.adjustConfigs | private void adjustConfigs(CmsModule targetModule, Map<I_CmsResourceType, I_CmsResourceType> resTypeMap)
throws CmsException, UnsupportedEncodingException {
String modPath = CmsWorkplace.VFS_PATH_MODULES + targetModule.getName() + "/";
CmsObject cms = getCms();
if (((m_cloneInfo.getSourceNamePrefix() != null) && (m_cloneInfo.getTargetNamePrefix() != null))
|| !m_cloneInfo.getSourceNamePrefix().equals(m_cloneInfo.getTargetNamePrefix())) {
// replace resource type names in formatter configurations
List<CmsResource> resources = cms.readResources(
modPath,
CmsResourceFilter.requireType(
OpenCms.getResourceManager().getResourceType(
CmsFormatterConfigurationCache.TYPE_FORMATTER_CONFIG)));
String source = "<Type><!\\[CDATA\\[" + m_cloneInfo.getSourceNamePrefix();
String target = "<Type><!\\[CDATA\\[" + m_cloneInfo.getTargetNamePrefix();
Function<String, String> replaceType = new ReplaceAll(source, target);
for (CmsResource resource : resources) {
transformResource(resource, replaceType);
}
resources.clear();
}
// replace resource type names in module configuration
try {
CmsResource config = cms.readResource(
modPath + CmsADEManager.CONFIG_FILE_NAME,
CmsResourceFilter.requireType(
OpenCms.getResourceManager().getResourceType(CmsADEManager.MODULE_CONFIG_TYPE)));
Function<String, String> substitution = Functions.identity();
// compose the substitution functions from simple substitution functions for each type
for (Map.Entry<I_CmsResourceType, I_CmsResourceType> mapping : resTypeMap.entrySet()) {
substitution = Functions.compose(
new ReplaceAll(mapping.getKey().getTypeName(), mapping.getValue().getTypeName()),
substitution);
}
// Either replace prefix in or prepend it to the folder name value
Function<String, String> replaceFolderName = new ReplaceAll(
"(<Folder>[ \n]*<Name><!\\[CDATA\\[)(" + m_cloneInfo.getSourceNamePrefix() + ")?",
"$1" + m_cloneInfo.getTargetNamePrefix());
substitution = Functions.compose(replaceFolderName, substitution);
transformResource(config, substitution);
} catch (CmsVfsResourceNotFoundException e) {
LOG.info(e.getLocalizedMessage(), e);
}
} | java | private void adjustConfigs(CmsModule targetModule, Map<I_CmsResourceType, I_CmsResourceType> resTypeMap)
throws CmsException, UnsupportedEncodingException {
String modPath = CmsWorkplace.VFS_PATH_MODULES + targetModule.getName() + "/";
CmsObject cms = getCms();
if (((m_cloneInfo.getSourceNamePrefix() != null) && (m_cloneInfo.getTargetNamePrefix() != null))
|| !m_cloneInfo.getSourceNamePrefix().equals(m_cloneInfo.getTargetNamePrefix())) {
// replace resource type names in formatter configurations
List<CmsResource> resources = cms.readResources(
modPath,
CmsResourceFilter.requireType(
OpenCms.getResourceManager().getResourceType(
CmsFormatterConfigurationCache.TYPE_FORMATTER_CONFIG)));
String source = "<Type><!\\[CDATA\\[" + m_cloneInfo.getSourceNamePrefix();
String target = "<Type><!\\[CDATA\\[" + m_cloneInfo.getTargetNamePrefix();
Function<String, String> replaceType = new ReplaceAll(source, target);
for (CmsResource resource : resources) {
transformResource(resource, replaceType);
}
resources.clear();
}
// replace resource type names in module configuration
try {
CmsResource config = cms.readResource(
modPath + CmsADEManager.CONFIG_FILE_NAME,
CmsResourceFilter.requireType(
OpenCms.getResourceManager().getResourceType(CmsADEManager.MODULE_CONFIG_TYPE)));
Function<String, String> substitution = Functions.identity();
// compose the substitution functions from simple substitution functions for each type
for (Map.Entry<I_CmsResourceType, I_CmsResourceType> mapping : resTypeMap.entrySet()) {
substitution = Functions.compose(
new ReplaceAll(mapping.getKey().getTypeName(), mapping.getValue().getTypeName()),
substitution);
}
// Either replace prefix in or prepend it to the folder name value
Function<String, String> replaceFolderName = new ReplaceAll(
"(<Folder>[ \n]*<Name><!\\[CDATA\\[)(" + m_cloneInfo.getSourceNamePrefix() + ")?",
"$1" + m_cloneInfo.getTargetNamePrefix());
substitution = Functions.compose(replaceFolderName, substitution);
transformResource(config, substitution);
} catch (CmsVfsResourceNotFoundException e) {
LOG.info(e.getLocalizedMessage(), e);
}
} | [
"private",
"void",
"adjustConfigs",
"(",
"CmsModule",
"targetModule",
",",
"Map",
"<",
"I_CmsResourceType",
",",
"I_CmsResourceType",
">",
"resTypeMap",
")",
"throws",
"CmsException",
",",
"UnsupportedEncodingException",
"{",
"String",
"modPath",
"=",
"CmsWorkplace",
... | Adjusts the module configuration file and the formatter configurations.<p>
@param targetModule the target module
@param resTypeMap the resource type mapping
@throws CmsException if something goes wrong
@throws UnsupportedEncodingException if the file content could not be read with the determined encoding | [
"Adjusts",
"the",
"module",
"configuration",
"file",
"and",
"the",
"formatter",
"configurations",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java#L345-L393 |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java | PropPatchResponseEntity.removeProperty | private String removeProperty(Node node, HierarchicalProperty property)
{
try
{
node.getProperty(property.getStringName()).remove();
node.save();
return WebDavConst.getStatusDescription(HTTPStatus.OK);
}
catch (AccessDeniedException e)
{
return WebDavConst.getStatusDescription(HTTPStatus.FORBIDDEN);
}
catch (ItemNotFoundException e)
{
return WebDavConst.getStatusDescription(HTTPStatus.NOT_FOUND);
}
catch (PathNotFoundException e)
{
return WebDavConst.getStatusDescription(HTTPStatus.NOT_FOUND);
}
catch (RepositoryException e)
{
return WebDavConst.getStatusDescription(HTTPStatus.CONFLICT);
}
} | java | private String removeProperty(Node node, HierarchicalProperty property)
{
try
{
node.getProperty(property.getStringName()).remove();
node.save();
return WebDavConst.getStatusDescription(HTTPStatus.OK);
}
catch (AccessDeniedException e)
{
return WebDavConst.getStatusDescription(HTTPStatus.FORBIDDEN);
}
catch (ItemNotFoundException e)
{
return WebDavConst.getStatusDescription(HTTPStatus.NOT_FOUND);
}
catch (PathNotFoundException e)
{
return WebDavConst.getStatusDescription(HTTPStatus.NOT_FOUND);
}
catch (RepositoryException e)
{
return WebDavConst.getStatusDescription(HTTPStatus.CONFLICT);
}
} | [
"private",
"String",
"removeProperty",
"(",
"Node",
"node",
",",
"HierarchicalProperty",
"property",
")",
"{",
"try",
"{",
"node",
".",
"getProperty",
"(",
"property",
".",
"getStringName",
"(",
")",
")",
".",
"remove",
"(",
")",
";",
"node",
".",
"save",
... | Removes the property.
@param node node
@param property property
@return status | [
"Removes",
"the",
"property",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/proppatch/PropPatchResponseEntity.java#L418-L444 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DateUtils.java | DateUtils.getFragmentInDays | @GwtIncompatible("incompatible method")
public static long getFragmentInDays(final Date date, final int fragment) {
return getFragment(date, fragment, TimeUnit.DAYS);
} | java | @GwtIncompatible("incompatible method")
public static long getFragmentInDays(final Date date, final int fragment) {
return getFragment(date, fragment, TimeUnit.DAYS);
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"long",
"getFragmentInDays",
"(",
"final",
"Date",
"date",
",",
"final",
"int",
"fragment",
")",
"{",
"return",
"getFragment",
"(",
"date",
",",
"fragment",
",",
"TimeUnit",
".",
... | <p>Returns the number of days within the
fragment. All datefields greater than the fragment will be ignored.</p>
<p>Asking the days of any date will only return the number of days
of the current month (resulting in a number between 1 and 31). This
method will retrieve the number of days for any fragment.
For example, if you want to calculate the number of days past this year,
your fragment is Calendar.YEAR. The result will be all days of the
past month(s).</p>
<p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
A fragment less than or equal to a DAY field will return 0.</p>
<ul>
<li>January 28, 2008 with Calendar.MONTH as fragment will return 28
(equivalent to deprecated date.getDay())</li>
<li>February 28, 2008 with Calendar.MONTH as fragment will return 28
(equivalent to deprecated date.getDay())</li>
<li>January 28, 2008 with Calendar.YEAR as fragment will return 28</li>
<li>February 28, 2008 with Calendar.YEAR as fragment will return 59</li>
<li>January 28, 2008 with Calendar.MILLISECOND as fragment will return 0
(a millisecond cannot be split in days)</li>
</ul>
@param date the date to work with, not null
@param fragment the {@code Calendar} field part of date to calculate
@return number of days within the fragment of date
@throws IllegalArgumentException if the date is <code>null</code> or
fragment is not supported
@since 2.4 | [
"<p",
">",
"Returns",
"the",
"number",
"of",
"days",
"within",
"the",
"fragment",
".",
"All",
"datefields",
"greater",
"than",
"the",
"fragment",
"will",
"be",
"ignored",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L1452-L1455 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobTracker.java | CoronaJobTracker.updateTaskStatus | private void updateTaskStatus(TaskTrackerInfo info, TaskStatus report) {
TaskAttemptID taskId = report.getTaskID();
// Here we want strict job id comparison.
if (!this.jobId.equals(taskId.getJobID())) {
LOG.warn("Task " + taskId + " belongs to unknown job "
+ taskId.getJobID());
return;
}
TaskInProgress tip = taskLookupTable.getTIP(taskId);
if (tip == null) {
return;
}
TaskStatus status = tip.getTaskStatus(taskId);
TaskStatus.State knownState = (status == null) ? null : status
.getRunState();
// Remove it from the expired task list
if (report.getRunState() != TaskStatus.State.UNASSIGNED) {
expireTasks.removeTask(taskId);
}
// Fallback heartbeats may claim that task is RUNNING, while it was killed
if (report.getRunState() == TaskStatus.State.RUNNING
&& !TaskStatus.TERMINATING_STATES.contains(knownState)) {
expireTasks.updateTask(taskId);
}
// Clone TaskStatus object here, because CoronaJobInProgress
// or TaskInProgress can modify this object and
// the changes should not get reflected in TaskTrackerStatus.
// An old TaskTrackerStatus is used later in countMapTasks, etc.
job.updateTaskStatus(tip, (TaskStatus) report.clone(), info);
} | java | private void updateTaskStatus(TaskTrackerInfo info, TaskStatus report) {
TaskAttemptID taskId = report.getTaskID();
// Here we want strict job id comparison.
if (!this.jobId.equals(taskId.getJobID())) {
LOG.warn("Task " + taskId + " belongs to unknown job "
+ taskId.getJobID());
return;
}
TaskInProgress tip = taskLookupTable.getTIP(taskId);
if (tip == null) {
return;
}
TaskStatus status = tip.getTaskStatus(taskId);
TaskStatus.State knownState = (status == null) ? null : status
.getRunState();
// Remove it from the expired task list
if (report.getRunState() != TaskStatus.State.UNASSIGNED) {
expireTasks.removeTask(taskId);
}
// Fallback heartbeats may claim that task is RUNNING, while it was killed
if (report.getRunState() == TaskStatus.State.RUNNING
&& !TaskStatus.TERMINATING_STATES.contains(knownState)) {
expireTasks.updateTask(taskId);
}
// Clone TaskStatus object here, because CoronaJobInProgress
// or TaskInProgress can modify this object and
// the changes should not get reflected in TaskTrackerStatus.
// An old TaskTrackerStatus is used later in countMapTasks, etc.
job.updateTaskStatus(tip, (TaskStatus) report.clone(), info);
} | [
"private",
"void",
"updateTaskStatus",
"(",
"TaskTrackerInfo",
"info",
",",
"TaskStatus",
"report",
")",
"{",
"TaskAttemptID",
"taskId",
"=",
"report",
".",
"getTaskID",
"(",
")",
";",
"// Here we want strict job id comparison.",
"if",
"(",
"!",
"this",
".",
"jobI... | Updates job and tasks state according to TaskStatus from given TaskTracker.
This function only updates internal job state, it shall NOT issue any
actions directly.
@param info TaskTrackerInfo object
@param report TaskStatus report | [
"Updates",
"job",
"and",
"tasks",
"state",
"according",
"to",
"TaskStatus",
"from",
"given",
"TaskTracker",
".",
"This",
"function",
"only",
"updates",
"internal",
"job",
"state",
"it",
"shall",
"NOT",
"issue",
"any",
"actions",
"directly",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobTracker.java#L1953-L1987 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.doubleToIntFunction | public static DoubleToIntFunction doubleToIntFunction(CheckedDoubleToIntFunction function, Consumer<Throwable> handler) {
return t -> {
try {
return function.applyAsInt(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static DoubleToIntFunction doubleToIntFunction(CheckedDoubleToIntFunction function, Consumer<Throwable> handler) {
return t -> {
try {
return function.applyAsInt(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"DoubleToIntFunction",
"doubleToIntFunction",
"(",
"CheckedDoubleToIntFunction",
"function",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"t",
"->",
"{",
"try",
"{",
"return",
"function",
".",
"applyAsInt",
"(",
"t",
... | Wrap a {@link CheckedDoubleToIntFunction} in a {@link DoubleToIntFunction} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
DoubleStream.of(1.0, 2.0, 3.0).mapToInt(Unchecked.doubleToIntFunction(
d -> {
if (d < 0.0)
throw new Exception("Only positive numbers allowed");
return (int) d;
},
e -> {
throw new IllegalStateException(e);
}
));
</pre></code> | [
"Wrap",
"a",
"{",
"@link",
"CheckedDoubleToIntFunction",
"}",
"in",
"a",
"{",
"@link",
"DoubleToIntFunction",
"}",
"with",
"a",
"custom",
"handler",
"for",
"checked",
"exceptions",
".",
"<p",
">",
"Example",
":",
"<code",
">",
"<pre",
">",
"DoubleStream",
".... | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1403-L1414 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPP14Reader.java | MPP14Reader.readBitFields | private void readBitFields(MppBitFlag[] flags, FieldContainer container, byte[] data)
{
for (MppBitFlag flag : flags)
{
flag.setValue(container, data);
}
} | java | private void readBitFields(MppBitFlag[] flags, FieldContainer container, byte[] data)
{
for (MppBitFlag flag : flags)
{
flag.setValue(container, data);
}
} | [
"private",
"void",
"readBitFields",
"(",
"MppBitFlag",
"[",
"]",
"flags",
",",
"FieldContainer",
"container",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"for",
"(",
"MppBitFlag",
"flag",
":",
"flags",
")",
"{",
"flag",
".",
"setValue",
"(",
"container",
",... | Iterate through a set of bit field flags and set the value for each one
in the supplied container.
@param flags bit field flags
@param container field container
@param data source data | [
"Iterate",
"through",
"a",
"set",
"of",
"bit",
"field",
"flags",
"and",
"set",
"the",
"value",
"for",
"each",
"one",
"in",
"the",
"supplied",
"container",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L2039-L2045 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java | ListManagementImagesImpl.addImageUrlInputWithServiceResponseAsync | public Observable<ServiceResponse<Image>> addImageUrlInputWithServiceResponseAsync(String listId, String contentType, BodyModelModel imageUrl, AddImageUrlInputOptionalParameter addImageUrlInputOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (listId == null) {
throw new IllegalArgumentException("Parameter listId is required and cannot be null.");
}
if (contentType == null) {
throw new IllegalArgumentException("Parameter contentType is required and cannot be null.");
}
if (imageUrl == null) {
throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null.");
}
Validator.validate(imageUrl);
final Integer tag = addImageUrlInputOptionalParameter != null ? addImageUrlInputOptionalParameter.tag() : null;
final String label = addImageUrlInputOptionalParameter != null ? addImageUrlInputOptionalParameter.label() : null;
return addImageUrlInputWithServiceResponseAsync(listId, contentType, imageUrl, tag, label);
} | java | public Observable<ServiceResponse<Image>> addImageUrlInputWithServiceResponseAsync(String listId, String contentType, BodyModelModel imageUrl, AddImageUrlInputOptionalParameter addImageUrlInputOptionalParameter) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (listId == null) {
throw new IllegalArgumentException("Parameter listId is required and cannot be null.");
}
if (contentType == null) {
throw new IllegalArgumentException("Parameter contentType is required and cannot be null.");
}
if (imageUrl == null) {
throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null.");
}
Validator.validate(imageUrl);
final Integer tag = addImageUrlInputOptionalParameter != null ? addImageUrlInputOptionalParameter.tag() : null;
final String label = addImageUrlInputOptionalParameter != null ? addImageUrlInputOptionalParameter.label() : null;
return addImageUrlInputWithServiceResponseAsync(listId, contentType, imageUrl, tag, label);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Image",
">",
">",
"addImageUrlInputWithServiceResponseAsync",
"(",
"String",
"listId",
",",
"String",
"contentType",
",",
"BodyModelModel",
"imageUrl",
",",
"AddImageUrlInputOptionalParameter",
"addImageUrlInputOptionalPar... | Add an image to the list with list Id equal to list Id passed.
@param listId List Id of the image list.
@param contentType The content type.
@param imageUrl The image url.
@param addImageUrlInputOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Image object | [
"Add",
"an",
"image",
"to",
"the",
"list",
"with",
"list",
"Id",
"equal",
"to",
"list",
"Id",
"passed",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java#L553-L571 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java | TiledMap.getObjectY | public int getObjectY(int groupID, int objectID) {
if (groupID >= 0 && groupID < objectGroups.size()) {
ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID);
if (objectID >= 0 && objectID < grp.objects.size()) {
GroupObject object = (GroupObject) grp.objects.get(objectID);
return object.y;
}
}
return -1;
} | java | public int getObjectY(int groupID, int objectID) {
if (groupID >= 0 && groupID < objectGroups.size()) {
ObjectGroup grp = (ObjectGroup) objectGroups.get(groupID);
if (objectID >= 0 && objectID < grp.objects.size()) {
GroupObject object = (GroupObject) grp.objects.get(objectID);
return object.y;
}
}
return -1;
} | [
"public",
"int",
"getObjectY",
"(",
"int",
"groupID",
",",
"int",
"objectID",
")",
"{",
"if",
"(",
"groupID",
">=",
"0",
"&&",
"groupID",
"<",
"objectGroups",
".",
"size",
"(",
")",
")",
"{",
"ObjectGroup",
"grp",
"=",
"(",
"ObjectGroup",
")",
"objectG... | Returns the y-coordinate of a specific object from a specific group.
@param groupID
Index of a group
@param objectID
Index of an object
@return The y-coordinate of an object, or -1, when error occurred | [
"Returns",
"the",
"y",
"-",
"coordinate",
"of",
"a",
"specific",
"object",
"from",
"a",
"specific",
"group",
"."
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L866-L875 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/TextBox.java | TextBox.stringWidth | private int stringWidth(FontMetrics fm, String text)
{
int w = fm.stringWidth(text);
if (wordSpacing != null)
{
//count spaces and add
float add = 0.0f;
for (int i = 0; i < text.length(); i++)
{
if (text.charAt(i) == ' ')
add += wordSpacing;
}
w = Math.round(w + add);
}
return w;
} | java | private int stringWidth(FontMetrics fm, String text)
{
int w = fm.stringWidth(text);
if (wordSpacing != null)
{
//count spaces and add
float add = 0.0f;
for (int i = 0; i < text.length(); i++)
{
if (text.charAt(i) == ' ')
add += wordSpacing;
}
w = Math.round(w + add);
}
return w;
} | [
"private",
"int",
"stringWidth",
"(",
"FontMetrics",
"fm",
",",
"String",
"text",
")",
"{",
"int",
"w",
"=",
"fm",
".",
"stringWidth",
"(",
"text",
")",
";",
"if",
"(",
"wordSpacing",
"!=",
"null",
")",
"{",
"//count spaces and add",
"float",
"add",
"=",... | Computes the final width of a string while considering word-spacing
@param fm the font metrics used for calculation
@param text the string to be measured
@return the resulting width in pixels | [
"Computes",
"the",
"final",
"width",
"of",
"a",
"string",
"while",
"considering",
"word",
"-",
"spacing"
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/TextBox.java#L1020-L1035 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.invokeStaticQuiet | public MethodHandle invokeStaticQuiet(MethodHandles.Lookup lookup, Class<?> target, String name) {
try {
return invokeStatic(lookup, target, name);
} catch (IllegalAccessException | NoSuchMethodException e) {
throw new InvalidTransformException(e);
}
} | java | public MethodHandle invokeStaticQuiet(MethodHandles.Lookup lookup, Class<?> target, String name) {
try {
return invokeStatic(lookup, target, name);
} catch (IllegalAccessException | NoSuchMethodException e) {
throw new InvalidTransformException(e);
}
} | [
"public",
"MethodHandle",
"invokeStaticQuiet",
"(",
"MethodHandles",
".",
"Lookup",
"lookup",
",",
"Class",
"<",
"?",
">",
"target",
",",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"invokeStatic",
"(",
"lookup",
",",
"target",
",",
"name",
")",
";",... | Apply the chain of transforms and bind them to a static method specified
using the end signature plus the given class and name. The method will
be retrieved using the given Lookup and must match the end signature
exactly.
If the final handle's type does not exactly match the initial type for
this Binder, an additional cast will be attempted.
This version is "quiet" in that it throws an unchecked InvalidTransformException
if the target method does not exist or is inaccessible.
@param lookup the MethodHandles.Lookup to use to look up the method
@param target the class in which to find the method
@param name the name of the method to invoke
@return the full handle chain, bound to the given method | [
"Apply",
"the",
"chain",
"of",
"transforms",
"and",
"bind",
"them",
"to",
"a",
"static",
"method",
"specified",
"using",
"the",
"end",
"signature",
"plus",
"the",
"given",
"class",
"and",
"name",
".",
"The",
"method",
"will",
"be",
"retrieved",
"using",
"t... | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1231-L1237 |
structr/structr | structr-ui/src/main/java/org/structr/web/common/FileHelper.java | FileHelper.setFileData | public static void setFileData(final File file, final byte[] fileData, final String contentType) throws FrameworkException, IOException {
FileHelper.setFileData(file, fileData, contentType, true);
} | java | public static void setFileData(final File file, final byte[] fileData, final String contentType) throws FrameworkException, IOException {
FileHelper.setFileData(file, fileData, contentType, true);
} | [
"public",
"static",
"void",
"setFileData",
"(",
"final",
"File",
"file",
",",
"final",
"byte",
"[",
"]",
"fileData",
",",
"final",
"String",
"contentType",
")",
"throws",
"FrameworkException",
",",
"IOException",
"{",
"FileHelper",
".",
"setFileData",
"(",
"fi... | Write image data from the given byte[] to the given file node and set checksum and size.
@param file
@param fileData
@param contentType if null, try to auto-detect content type
@param updateMetadata
@throws FrameworkException
@throws IOException | [
"Write",
"image",
"data",
"from",
"the",
"given",
"byte",
"[]",
"to",
"the",
"given",
"file",
"node",
"and",
"set",
"checksum",
"and",
"size",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L271-L273 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Stream.java | Stream.flatMapToLong | @NotNull
public LongStream flatMapToLong(@NotNull final Function<? super T, ? extends LongStream> mapper) {
return new LongStream(params, new ObjFlatMapToLong<T>(iterator, mapper));
} | java | @NotNull
public LongStream flatMapToLong(@NotNull final Function<? super T, ? extends LongStream> mapper) {
return new LongStream(params, new ObjFlatMapToLong<T>(iterator, mapper));
} | [
"@",
"NotNull",
"public",
"LongStream",
"flatMapToLong",
"(",
"@",
"NotNull",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"LongStream",
">",
"mapper",
")",
"{",
"return",
"new",
"LongStream",
"(",
"params",
",",
"new",
"ObjFlatMapToLong... | Returns a stream consisting of the results of replacing each element of
this stream with the contents of a mapped stream produced by applying
the provided mapping function to each element.
<p>This is an intermediate operation.
@param mapper the mapper function used to apply to each element
@return the new {@code LongStream}
@see #flatMap(com.annimon.stream.function.Function) | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"results",
"of",
"replacing",
"each",
"element",
"of",
"this",
"stream",
"with",
"the",
"contents",
"of",
"a",
"mapped",
"stream",
"produced",
"by",
"applying",
"the",
"provided",
"mapping",
"function",
"to"... | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Stream.java#L896-L899 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.beginDeleteInstancesAsync | public Observable<OperationStatusResponseInner> beginDeleteInstancesAsync(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) {
return beginDeleteInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> beginDeleteInstancesAsync(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) {
return beginDeleteInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"beginDeleteInstancesAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"List",
"<",
"String",
">",
"instanceIds",
")",
"{",
"return",
"beginDeleteInstancesWithServiceResponseAs... | Deletes virtual machines in a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@param instanceIds The virtual machine scale set instance ids.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatusResponseInner object | [
"Deletes",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L1226-L1233 |
elastic/elasticsearch-hadoop | mr/src/main/java/org/elasticsearch/hadoop/rest/NetworkUtils.java | NetworkUtils.addAllInterfaces | private static void addAllInterfaces(List<NetworkInterface> target, List<NetworkInterface> level) {
if (!level.isEmpty()) {
target.addAll(level);
for (NetworkInterface intf : level) {
addAllInterfaces(target, Collections.list(intf.getSubInterfaces()));
}
}
} | java | private static void addAllInterfaces(List<NetworkInterface> target, List<NetworkInterface> level) {
if (!level.isEmpty()) {
target.addAll(level);
for (NetworkInterface intf : level) {
addAllInterfaces(target, Collections.list(intf.getSubInterfaces()));
}
}
} | [
"private",
"static",
"void",
"addAllInterfaces",
"(",
"List",
"<",
"NetworkInterface",
">",
"target",
",",
"List",
"<",
"NetworkInterface",
">",
"level",
")",
"{",
"if",
"(",
"!",
"level",
".",
"isEmpty",
"(",
")",
")",
"{",
"target",
".",
"addAll",
"(",... | Helper for getInterfaces, recursively adds subinterfaces to {@code target} | [
"Helper",
"for",
"getInterfaces",
"recursively",
"adds",
"subinterfaces",
"to",
"{"
] | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/rest/NetworkUtils.java#L33-L40 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java | VMCommandLine.launchVMWithClassPath | public static Process launchVMWithClassPath(String classToLaunch, File[] classpath,
String... additionalParams) throws IOException {
final StringBuilder b = new StringBuilder();
for (final File f : classpath) {
if (b.length() > 0) {
b.append(File.pathSeparator);
}
b.append(f.getAbsolutePath());
}
return launchVMWithClassPath(classToLaunch, b.toString(), additionalParams);
} | java | public static Process launchVMWithClassPath(String classToLaunch, File[] classpath,
String... additionalParams) throws IOException {
final StringBuilder b = new StringBuilder();
for (final File f : classpath) {
if (b.length() > 0) {
b.append(File.pathSeparator);
}
b.append(f.getAbsolutePath());
}
return launchVMWithClassPath(classToLaunch, b.toString(), additionalParams);
} | [
"public",
"static",
"Process",
"launchVMWithClassPath",
"(",
"String",
"classToLaunch",
",",
"File",
"[",
"]",
"classpath",
",",
"String",
"...",
"additionalParams",
")",
"throws",
"IOException",
"{",
"final",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"("... | Run a new VM with the given class path.
@param classToLaunch is the class to launch.
@param classpath is the class path to use.
@param additionalParams is the list of additional parameters
@return the process that is running the new virtual machine, neither <code>null</code>
@throws IOException when a IO error occurs.
@since 6.2 | [
"Run",
"a",
"new",
"VM",
"with",
"the",
"given",
"class",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java#L235-L245 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/square/DetectFiducialSquareBinary.java | DetectFiducialSquareBinary.findBitCounts | protected void findBitCounts(GrayF32 gray , double threshold ) {
// compute binary image using an adaptive algorithm to handle shadows
ThresholdImageOps.threshold(gray,binaryInner,(float)threshold,true);
Arrays.fill(counts, 0);
for (int row = 0; row < gridWidth; row++) {
int y0 = row * binaryInner.width / gridWidth + 2;
int y1 = (row + 1) * binaryInner.width / gridWidth - 2;
for (int col = 0; col < gridWidth; col++) {
int x0 = col * binaryInner.width / gridWidth + 2;
int x1 = (col + 1) * binaryInner.width / gridWidth - 2;
int total = 0;
for (int i = y0; i < y1; i++) {
int index = i * binaryInner.width + x0;
for (int j = x0; j < x1; j++) {
total += binaryInner.data[index++];
}
}
counts[row * gridWidth + col] = total;
}
}
} | java | protected void findBitCounts(GrayF32 gray , double threshold ) {
// compute binary image using an adaptive algorithm to handle shadows
ThresholdImageOps.threshold(gray,binaryInner,(float)threshold,true);
Arrays.fill(counts, 0);
for (int row = 0; row < gridWidth; row++) {
int y0 = row * binaryInner.width / gridWidth + 2;
int y1 = (row + 1) * binaryInner.width / gridWidth - 2;
for (int col = 0; col < gridWidth; col++) {
int x0 = col * binaryInner.width / gridWidth + 2;
int x1 = (col + 1) * binaryInner.width / gridWidth - 2;
int total = 0;
for (int i = y0; i < y1; i++) {
int index = i * binaryInner.width + x0;
for (int j = x0; j < x1; j++) {
total += binaryInner.data[index++];
}
}
counts[row * gridWidth + col] = total;
}
}
} | [
"protected",
"void",
"findBitCounts",
"(",
"GrayF32",
"gray",
",",
"double",
"threshold",
")",
"{",
"// compute binary image using an adaptive algorithm to handle shadows",
"ThresholdImageOps",
".",
"threshold",
"(",
"gray",
",",
"binaryInner",
",",
"(",
"float",
")",
"... | Converts the gray scale image into a binary number. Skip the outer 1 pixel of each inner square. These
tend to be incorrectly classified due to distortion. | [
"Converts",
"the",
"gray",
"scale",
"image",
"into",
"a",
"binary",
"number",
".",
"Skip",
"the",
"outer",
"1",
"pixel",
"of",
"each",
"inner",
"square",
".",
"These",
"tend",
"to",
"be",
"incorrectly",
"classified",
"due",
"to",
"distortion",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/square/DetectFiducialSquareBinary.java#L252-L275 |
apache/flink | flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java | SortOperationFactory.createLimitWithFetch | public TableOperation createLimitWithFetch(int fetch, TableOperation child) {
SortTableOperation previousSort = validateAndGetChildSort(child);
if (fetch < 0) {
throw new ValidationException("Fetch should be greater or equal 0");
}
int offset = Math.max(previousSort.getOffset(), 0);
return new SortTableOperation(previousSort.getOrder(), previousSort.getChild(), offset, fetch);
} | java | public TableOperation createLimitWithFetch(int fetch, TableOperation child) {
SortTableOperation previousSort = validateAndGetChildSort(child);
if (fetch < 0) {
throw new ValidationException("Fetch should be greater or equal 0");
}
int offset = Math.max(previousSort.getOffset(), 0);
return new SortTableOperation(previousSort.getOrder(), previousSort.getChild(), offset, fetch);
} | [
"public",
"TableOperation",
"createLimitWithFetch",
"(",
"int",
"fetch",
",",
"TableOperation",
"child",
")",
"{",
"SortTableOperation",
"previousSort",
"=",
"validateAndGetChildSort",
"(",
"child",
")",
";",
"if",
"(",
"fetch",
"<",
"0",
")",
"{",
"throw",
"new... | Adds fetch to the underlying {@link SortTableOperation} if it is a valid one.
@param fetch fetch number to add
@param child should be {@link SortTableOperation}
@return valid sort operation with applied fetch | [
"Adds",
"fetch",
"to",
"the",
"underlying",
"{",
"@link",
"SortTableOperation",
"}",
"if",
"it",
"is",
"a",
"valid",
"one",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/operations/SortOperationFactory.java#L94-L104 |
kiswanij/jk-util | src/main/java/com/jk/util/model/table/JKDefaultTableModel.java | JKDefaultTableModel.setDataVector | public void setDataVector(final Vector dataVector, final Vector columnIdentifiers) {
this.dataVector = nonNullVector(dataVector);
this.columnIdentifiers = nonNullVector(columnIdentifiers);
justifyRows(0, getRowCount());
fireTableStructureChanged();
} | java | public void setDataVector(final Vector dataVector, final Vector columnIdentifiers) {
this.dataVector = nonNullVector(dataVector);
this.columnIdentifiers = nonNullVector(columnIdentifiers);
justifyRows(0, getRowCount());
fireTableStructureChanged();
} | [
"public",
"void",
"setDataVector",
"(",
"final",
"Vector",
"dataVector",
",",
"final",
"Vector",
"columnIdentifiers",
")",
"{",
"this",
".",
"dataVector",
"=",
"nonNullVector",
"(",
"dataVector",
")",
";",
"this",
".",
"columnIdentifiers",
"=",
"nonNullVector",
... | Replaces the current <code>dataVector</code> instance variable with the new
<code>Vector</code> of rows, <code>dataVector</code>. Each row is represented
in <code>dataVector</code> as a <code>Vector</code> of <code>Object</code>
values. <code>columnIdentifiers</code> are the names of the new columns. The
first name in <code>columnIdentifiers</code> is mapped to column 0 in
<code>dataVector</code>. Each row in <code>dataVector</code> is adjusted to
match the number of columns in <code>columnIdentifiers</code> either by
truncating the <code>Vector</code> if it is too long, or adding
<code>null</code> values if it is too short.
<p>
Note that passing in a <code>null</code> value for <code>dataVector</code>
results in unspecified behavior, an possibly an exception.
@param dataVector the new data vector
@param columnIdentifiers the names of the columns
@see #getDataVector | [
"Replaces",
"the",
"current",
"<code",
">",
"dataVector<",
"/",
"code",
">",
"instance",
"variable",
"with",
"the",
"new",
"<code",
">",
"Vector<",
"/",
"code",
">",
"of",
"rows",
"<code",
">",
"dataVector<",
"/",
"code",
">",
".",
"Each",
"row",
"is",
... | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/model/table/JKDefaultTableModel.java#L659-L664 |
mapbox/mapbox-navigation-android | libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineNavigator.java | OfflineNavigator.removeTiles | void removeTiles(String tilePath, Point southwest, Point northeast, OnOfflineTilesRemovedCallback callback) {
new RemoveTilesTask(navigator, tilePath, southwest, northeast, callback).execute();
} | java | void removeTiles(String tilePath, Point southwest, Point northeast, OnOfflineTilesRemovedCallback callback) {
new RemoveTilesTask(navigator, tilePath, southwest, northeast, callback).execute();
} | [
"void",
"removeTiles",
"(",
"String",
"tilePath",
",",
"Point",
"southwest",
",",
"Point",
"northeast",
",",
"OnOfflineTilesRemovedCallback",
"callback",
")",
"{",
"new",
"RemoveTilesTask",
"(",
"navigator",
",",
"tilePath",
",",
"southwest",
",",
"northeast",
","... | Removes tiles within / intersected by a bounding box
@param tilePath directory path where the tiles are located
@param southwest lower left {@link Point} of the bounding box
@param northeast upper right {@link Point} of the bounding box
@param callback a callback that will be fired when the routing tiles have been removed completely | [
"Removes",
"tiles",
"within",
"/",
"intersected",
"by",
"a",
"bounding",
"box"
] | train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/navigation/OfflineNavigator.java#L54-L56 |
anotheria/moskito | moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/parser/ApacheStatusParser.java | ApacheStatusParser.parseScoreboard | private static void parseScoreboard(final StatusData<ApacheMetrics> statusData, final String scoreboard) {
statusData.put(ApacheMetrics.SCOREBOARD_WAITINGFORCONNECTION, charCount(scoreboard, '_'));
statusData.put(ApacheMetrics.SCOREBOARD_STARTINGUP, charCount(scoreboard, 'S'));
statusData.put(ApacheMetrics.SCOREBOARD_READINGREQUEST, charCount(scoreboard, 'R'));
statusData.put(ApacheMetrics.SCOREBOARD_SENDINGREPLY, charCount(scoreboard, 'W'));
statusData.put(ApacheMetrics.SCOREBOARD_KEEPALIVE, charCount(scoreboard, 'K'));
statusData.put(ApacheMetrics.SCOREBOARD_DNSLOOKUP, charCount(scoreboard, 'D'));
statusData.put(ApacheMetrics.SCOREBOARD_CLOSINGCONNECTION, charCount(scoreboard, 'C'));
statusData.put(ApacheMetrics.SCOREBOARD_LOGGING, charCount(scoreboard, 'L'));
statusData.put(ApacheMetrics.SCOREBOARD_GRACEFULLYFINISHING, charCount(scoreboard, 'G'));
statusData.put(ApacheMetrics.SCOREBOARD_IDLECLEANUP, charCount(scoreboard, 'I'));
statusData.put(ApacheMetrics.SCOREBOARD_OPENSLOT, charCount(scoreboard, '.'));
statusData.put(ApacheMetrics.SCOREBOARD_TOTAL, scoreboard.length());
} | java | private static void parseScoreboard(final StatusData<ApacheMetrics> statusData, final String scoreboard) {
statusData.put(ApacheMetrics.SCOREBOARD_WAITINGFORCONNECTION, charCount(scoreboard, '_'));
statusData.put(ApacheMetrics.SCOREBOARD_STARTINGUP, charCount(scoreboard, 'S'));
statusData.put(ApacheMetrics.SCOREBOARD_READINGREQUEST, charCount(scoreboard, 'R'));
statusData.put(ApacheMetrics.SCOREBOARD_SENDINGREPLY, charCount(scoreboard, 'W'));
statusData.put(ApacheMetrics.SCOREBOARD_KEEPALIVE, charCount(scoreboard, 'K'));
statusData.put(ApacheMetrics.SCOREBOARD_DNSLOOKUP, charCount(scoreboard, 'D'));
statusData.put(ApacheMetrics.SCOREBOARD_CLOSINGCONNECTION, charCount(scoreboard, 'C'));
statusData.put(ApacheMetrics.SCOREBOARD_LOGGING, charCount(scoreboard, 'L'));
statusData.put(ApacheMetrics.SCOREBOARD_GRACEFULLYFINISHING, charCount(scoreboard, 'G'));
statusData.put(ApacheMetrics.SCOREBOARD_IDLECLEANUP, charCount(scoreboard, 'I'));
statusData.put(ApacheMetrics.SCOREBOARD_OPENSLOT, charCount(scoreboard, '.'));
statusData.put(ApacheMetrics.SCOREBOARD_TOTAL, scoreboard.length());
} | [
"private",
"static",
"void",
"parseScoreboard",
"(",
"final",
"StatusData",
"<",
"ApacheMetrics",
">",
"statusData",
",",
"final",
"String",
"scoreboard",
")",
"{",
"statusData",
".",
"put",
"(",
"ApacheMetrics",
".",
"SCOREBOARD_WAITINGFORCONNECTION",
",",
"charCou... | Parse scoreboard line.
Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process | [
"Parse",
"scoreboard",
"line",
".",
"Scoreboard",
"Key",
":",
"_",
"Waiting",
"for",
"Connection",
"S",
"Starting",
"up",
"R",
"Reading",
"Request",
"W",
"Sending",
"Reply",
"K",
"Keepalive",
"(",
"read",
")",
"D",
"DNS",
"Lookup",
"C",
"Closing",
"connect... | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/parser/ApacheStatusParser.java#L102-L115 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfDocument.java | PdfDocument.localGoto | void localGoto(String name, float llx, float lly, float urx, float ury) {
PdfAction action = getLocalGotoAction(name);
annotationsImp.addPlainAnnotation(new PdfAnnotation(writer, llx, lly, urx, ury, action));
} | java | void localGoto(String name, float llx, float lly, float urx, float ury) {
PdfAction action = getLocalGotoAction(name);
annotationsImp.addPlainAnnotation(new PdfAnnotation(writer, llx, lly, urx, ury, action));
} | [
"void",
"localGoto",
"(",
"String",
"name",
",",
"float",
"llx",
",",
"float",
"lly",
",",
"float",
"urx",
",",
"float",
"ury",
")",
"{",
"PdfAction",
"action",
"=",
"getLocalGotoAction",
"(",
"name",
")",
";",
"annotationsImp",
".",
"addPlainAnnotation",
... | Implements a link to other part of the document. The jump will
be made to a local destination with the same name, that must exist.
@param name the name for this link
@param llx the lower left x corner of the activation area
@param lly the lower left y corner of the activation area
@param urx the upper right x corner of the activation area
@param ury the upper right y corner of the activation area | [
"Implements",
"a",
"link",
"to",
"other",
"part",
"of",
"the",
"document",
".",
"The",
"jump",
"will",
"be",
"made",
"to",
"a",
"local",
"destination",
"with",
"the",
"same",
"name",
"that",
"must",
"exist",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfDocument.java#L2013-L2016 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java | ControlBar.addControlListener | public boolean addControlListener(String name, Widget.OnTouchListener listener) {
Widget control = findChildByName(name);
if (control != null) {
return control.addTouchListener(listener);
}
return false;
} | java | public boolean addControlListener(String name, Widget.OnTouchListener listener) {
Widget control = findChildByName(name);
if (control != null) {
return control.addTouchListener(listener);
}
return false;
} | [
"public",
"boolean",
"addControlListener",
"(",
"String",
"name",
",",
"Widget",
".",
"OnTouchListener",
"listener",
")",
"{",
"Widget",
"control",
"=",
"findChildByName",
"(",
"name",
")",
";",
"if",
"(",
"control",
"!=",
"null",
")",
"{",
"return",
"contro... | Add a touch listener for the button specified by {@code name}. The listener is only
registered if the button is actually present.
@param name The {@linkplain Widget#getName() name} of the button to listen to
@param listener A valid listener or null to clear
@return {@code True} if a valid listener was passed and the named button is present;
{@code false} in all other cases. | [
"Add",
"a",
"touch",
"listener",
"for",
"the",
"button",
"specified",
"by",
"{",
"@code",
"name",
"}",
".",
"The",
"listener",
"is",
"only",
"registered",
"if",
"the",
"button",
"is",
"actually",
"present",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/custom/ControlBar.java#L231-L238 |
openbase/jul | extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java | TimestampProcessor.copyTimestamp | public static <M extends MessageOrBuilder> M copyTimestamp(final M sourceMessageOrBuilder, final M targetMessageOrBuilder, final Logger logger) {
try {
return TimestampProcessor.copyTimestamp(sourceMessageOrBuilder, targetMessageOrBuilder);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger);
return targetMessageOrBuilder;
}
} | java | public static <M extends MessageOrBuilder> M copyTimestamp(final M sourceMessageOrBuilder, final M targetMessageOrBuilder, final Logger logger) {
try {
return TimestampProcessor.copyTimestamp(sourceMessageOrBuilder, targetMessageOrBuilder);
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger);
return targetMessageOrBuilder;
}
} | [
"public",
"static",
"<",
"M",
"extends",
"MessageOrBuilder",
">",
"M",
"copyTimestamp",
"(",
"final",
"M",
"sourceMessageOrBuilder",
",",
"final",
"M",
"targetMessageOrBuilder",
",",
"final",
"Logger",
"logger",
")",
"{",
"try",
"{",
"return",
"TimestampProcessor"... | Method copies the timestamp field of the source message into the target message.
In case of an error the original message is returned.
@param <M> the message type of the message to update.
@param sourceMessageOrBuilder the message providing a timestamp.
@param targetMessageOrBuilder the message offering a timestamp field to update.
@param logger the logger which is used for printing the exception stack in case something went wrong.
@return the updated message or the original one in case of errors. | [
"Method",
"copies",
"the",
"timestamp",
"field",
"of",
"the",
"source",
"message",
"into",
"the",
"target",
"message",
".",
"In",
"case",
"of",
"an",
"error",
"the",
"original",
"message",
"is",
"returned",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java#L197-L204 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java | SyncMembersInner.refreshMemberSchemaAsync | public Observable<Void> refreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) {
return refreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> refreshMemberSchemaAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName) {
return refreshMemberSchemaWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"refreshMemberSchemaAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"syncGroupName",
",",
"String",
"syncMemberName",
")",
"{",
"return",
"refreshMemberSch... | Refreshes a sync member database schema.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database on which the sync group is hosted.
@param syncGroupName The name of the sync group on which the sync member is hosted.
@param syncMemberName The name of the sync member.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Refreshes",
"a",
"sync",
"member",
"database",
"schema",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java#L1182-L1189 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.beginChangeVnetWithServiceResponseAsync | public Observable<ServiceResponse<Page<SiteInner>>> beginChangeVnetWithServiceResponseAsync(final String resourceGroupName, final String name, final VirtualNetworkProfile vnetInfo) {
return beginChangeVnetSinglePageAsync(resourceGroupName, name, vnetInfo)
.concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(beginChangeVnetNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<SiteInner>>> beginChangeVnetWithServiceResponseAsync(final String resourceGroupName, final String name, final VirtualNetworkProfile vnetInfo) {
return beginChangeVnetSinglePageAsync(resourceGroupName, name, vnetInfo)
.concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() {
@Override
public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(beginChangeVnetNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"SiteInner",
">",
">",
">",
"beginChangeVnetWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"VirtualNetworkProfile",
"vnetInfo",
")"... | Move an App Service Environment to a different VNET.
Move an App Service Environment to a different VNET.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param vnetInfo Details for the new virtual network.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SiteInner> object | [
"Move",
"an",
"App",
"Service",
"Environment",
"to",
"a",
"different",
"VNET",
".",
"Move",
"an",
"App",
"Service",
"Environment",
"to",
"a",
"different",
"VNET",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceEnvironmentsInner.java#L1740-L1752 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java | MapDotApi.dotAssoc | public static Map dotAssoc(final Map map, final String pathString, final Object value) {
return dotAssoc(map, map.getClass(), pathString, value);
} | java | public static Map dotAssoc(final Map map, final String pathString, final Object value) {
return dotAssoc(map, map.getClass(), pathString, value);
} | [
"public",
"static",
"Map",
"dotAssoc",
"(",
"final",
"Map",
"map",
",",
"final",
"String",
"pathString",
",",
"final",
"Object",
"value",
")",
"{",
"return",
"dotAssoc",
"(",
"map",
",",
"map",
".",
"getClass",
"(",
")",
",",
"pathString",
",",
"value",
... | Associates new value in map placed at path. New nodes are created with same class as map if needed.
@param map subject original map
@param pathString nodes to walk in map path to place new value
@param value new value
@return original map | [
"Associates",
"new",
"value",
"in",
"map",
"placed",
"at",
"path",
".",
"New",
"nodes",
"are",
"created",
"with",
"same",
"class",
"as",
"map",
"if",
"needed",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L331-L333 |
baratine/baratine | web/src/main/java/com/caucho/v5/web/builder/WebServerBuilderImpl.java | WebServerBuilderImpl.service | @Override
public <T> ServiceRef.ServiceBuilder service(Class<T> serviceClass)
{
Objects.requireNonNull(serviceClass);
validator().serviceClass(serviceClass);
Key<?> key = Key.of(serviceClass, ServiceImpl.class);
ServiceBuilderWebImpl service
= new ServiceBuilderWebImpl(this, key, serviceClass);
_includes.add(service);
return service;
} | java | @Override
public <T> ServiceRef.ServiceBuilder service(Class<T> serviceClass)
{
Objects.requireNonNull(serviceClass);
validator().serviceClass(serviceClass);
Key<?> key = Key.of(serviceClass, ServiceImpl.class);
ServiceBuilderWebImpl service
= new ServiceBuilderWebImpl(this, key, serviceClass);
_includes.add(service);
return service;
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"ServiceRef",
".",
"ServiceBuilder",
"service",
"(",
"Class",
"<",
"T",
">",
"serviceClass",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"serviceClass",
")",
";",
"validator",
"(",
")",
".",
"serviceClass",
"(... | /*
@Override
public <T,U> BindingBuilder<T> provider(Key<U> parent, Method m)
{
Objects.requireNonNull(parent);
Objects.requireNonNull(m);
return _injectServer.provider(parent, m);
} | [
"/",
"*",
"@Override",
"public",
"<T",
"U",
">",
"BindingBuilder<T",
">",
"provider",
"(",
"Key<U",
">",
"parent",
"Method",
"m",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"parent",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"m",
")",
";"
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/web/builder/WebServerBuilderImpl.java#L485-L500 |
soulgalore/crawler | src/main/java/com/soulgalore/crawler/util/HeaderUtil.java | HeaderUtil.createHeadersFromString | public Map<String, String> createHeadersFromString(String headersAndValues) {
if (headersAndValues == null || headersAndValues.isEmpty()) return Collections.emptyMap();
final StringTokenizer token = new StringTokenizer(headersAndValues, "@");
final Map<String, String> theHeaders = new HashMap<String, String>(token.countTokens());
while (token.hasMoreTokens()) {
final String headerAndValue = token.nextToken();
if (!headerAndValue.contains(":"))
throw new IllegalArgumentException(
"Request headers wrongly configured, missing separator :" + headersAndValues);
final String header = headerAndValue.substring(0, headerAndValue.indexOf(":"));
final String value =
headerAndValue.substring(headerAndValue.indexOf(":") + 1, headerAndValue.length());
theHeaders.put(header, value);
}
return theHeaders;
} | java | public Map<String, String> createHeadersFromString(String headersAndValues) {
if (headersAndValues == null || headersAndValues.isEmpty()) return Collections.emptyMap();
final StringTokenizer token = new StringTokenizer(headersAndValues, "@");
final Map<String, String> theHeaders = new HashMap<String, String>(token.countTokens());
while (token.hasMoreTokens()) {
final String headerAndValue = token.nextToken();
if (!headerAndValue.contains(":"))
throw new IllegalArgumentException(
"Request headers wrongly configured, missing separator :" + headersAndValues);
final String header = headerAndValue.substring(0, headerAndValue.indexOf(":"));
final String value =
headerAndValue.substring(headerAndValue.indexOf(":") + 1, headerAndValue.length());
theHeaders.put(header, value);
}
return theHeaders;
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"createHeadersFromString",
"(",
"String",
"headersAndValues",
")",
"{",
"if",
"(",
"headersAndValues",
"==",
"null",
"||",
"headersAndValues",
".",
"isEmpty",
"(",
")",
")",
"return",
"Collections",
".",
"emp... | Create headers from a string.
@param headersAndValues by the header1:value1,header2:value2...
@return the Headers as a Set | [
"Create",
"headers",
"from",
"a",
"string",
"."
] | train | https://github.com/soulgalore/crawler/blob/715ee7f1454eec14bebcb6d12563dfc32d9bbf48/src/main/java/com/soulgalore/crawler/util/HeaderUtil.java#L63-L85 |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java | MatrixFeatures_DSCC.isOrthogonal | public static boolean isOrthogonal(DMatrixSparseCSC Q , double tol )
{
if( Q.numRows < Q.numCols ) {
throw new IllegalArgumentException("The number of rows must be more than or equal to the number of columns");
}
IGrowArray gw=new IGrowArray();
DGrowArray gx=new DGrowArray();
for( int i = 0; i < Q.numRows; i++ ) {
for( int j = i+1; j < Q.numCols; j++ ) {
double val = CommonOps_DSCC.dotInnerColumns(Q,i,Q,j,gw,gx);
if( !(Math.abs(val) <= tol))
return false;
}
}
return true;
} | java | public static boolean isOrthogonal(DMatrixSparseCSC Q , double tol )
{
if( Q.numRows < Q.numCols ) {
throw new IllegalArgumentException("The number of rows must be more than or equal to the number of columns");
}
IGrowArray gw=new IGrowArray();
DGrowArray gx=new DGrowArray();
for( int i = 0; i < Q.numRows; i++ ) {
for( int j = i+1; j < Q.numCols; j++ ) {
double val = CommonOps_DSCC.dotInnerColumns(Q,i,Q,j,gw,gx);
if( !(Math.abs(val) <= tol))
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isOrthogonal",
"(",
"DMatrixSparseCSC",
"Q",
",",
"double",
"tol",
")",
"{",
"if",
"(",
"Q",
".",
"numRows",
"<",
"Q",
".",
"numCols",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The number of rows must be more t... | <p>
Checks to see if a matrix is orthogonal or isometric.
</p>
@param Q The matrix being tested. Not modified.
@param tol Tolerance.
@return True if it passes the test. | [
"<p",
">",
"Checks",
"to",
"see",
"if",
"a",
"matrix",
"is",
"orthogonal",
"or",
"isometric",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/MatrixFeatures_DSCC.java#L283-L303 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/NotificationsApi.java | NotificationsApi.notificationsConnectWithHttpInfo | public ApiResponse<Void> notificationsConnectWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = notificationsConnectValidateBeforeCall(null, null);
return apiClient.execute(call);
} | java | public ApiResponse<Void> notificationsConnectWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = notificationsConnectValidateBeforeCall(null, null);
return apiClient.execute(call);
} | [
"public",
"ApiResponse",
"<",
"Void",
">",
"notificationsConnectWithHttpInfo",
"(",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"notificationsConnectValidateBeforeCall",
"(",
"null",
",",
"null",
")",
";",
... | CometD connect
See the [CometD documentation](https://docs.cometd.org/current/reference/#_bayeux_meta_connect) for details.
@return ApiResponse<Void>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"CometD",
"connect",
"See",
"the",
"[",
"CometD",
"documentation",
"]",
"(",
"https",
":",
"//",
"docs",
".",
"cometd",
".",
"org",
"/",
"current",
"/",
"reference",
"/",
"#_bayeux_meta_connect",
")",
"for",
"details",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/NotificationsApi.java#L237-L240 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.toBean | public static <T> T toBean(ServletRequest request, Class<T> beanClass, boolean isIgnoreError) {
return fillBean(request, ReflectUtil.newInstance(beanClass), isIgnoreError);
} | java | public static <T> T toBean(ServletRequest request, Class<T> beanClass, boolean isIgnoreError) {
return fillBean(request, ReflectUtil.newInstance(beanClass), isIgnoreError);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"toBean",
"(",
"ServletRequest",
"request",
",",
"Class",
"<",
"T",
">",
"beanClass",
",",
"boolean",
"isIgnoreError",
")",
"{",
"return",
"fillBean",
"(",
"request",
",",
"ReflectUtil",
".",
"newInstance",
"(",
"bea... | ServletRequest 参数转Bean
@param <T> Bean类型
@param request ServletRequest
@param beanClass Bean Class
@param isIgnoreError 是否忽略注入错误
@return Bean | [
"ServletRequest",
"参数转Bean"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L172-L174 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/xml/XmlIO.java | XmlIO.load | public static AnnotationMappingInfo load(final InputStream in) throws XmlOperateException {
ArgUtils.notNull(in, "in");
final AnnotationMappingInfo xmlInfo;
try {
xmlInfo = JAXB.unmarshal(in, AnnotationMappingInfo.class);
} catch (DataBindingException e) {
throw new XmlOperateException("fail load xml with JAXB.", e);
}
return xmlInfo;
} | java | public static AnnotationMappingInfo load(final InputStream in) throws XmlOperateException {
ArgUtils.notNull(in, "in");
final AnnotationMappingInfo xmlInfo;
try {
xmlInfo = JAXB.unmarshal(in, AnnotationMappingInfo.class);
} catch (DataBindingException e) {
throw new XmlOperateException("fail load xml with JAXB.", e);
}
return xmlInfo;
} | [
"public",
"static",
"AnnotationMappingInfo",
"load",
"(",
"final",
"InputStream",
"in",
")",
"throws",
"XmlOperateException",
"{",
"ArgUtils",
".",
"notNull",
"(",
"in",
",",
"\"in\"",
")",
";",
"final",
"AnnotationMappingInfo",
"xmlInfo",
";",
"try",
"{",
"xmlI... | XMLを読み込み、{@link AnnotationMappingInfo}として取得する。
@param in
@return
@throws XmlOperateException XMLの読み込みに失敗した場合。
@throws IllegalArgumentException in is null. | [
"XMLを読み込み、",
"{"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/XmlIO.java#L40-L52 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.