repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
PawelAdamski/HttpClientMock | src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java | HttpClientMockBuilder.doReturnXML | public HttpClientResponseBuilder doReturnXML(String response, Charset charset) {
return responseBuilder.doReturnXML(response, charset);
} | java | public HttpClientResponseBuilder doReturnXML(String response, Charset charset) {
return responseBuilder.doReturnXML(response, charset);
} | [
"public",
"HttpClientResponseBuilder",
"doReturnXML",
"(",
"String",
"response",
",",
"Charset",
"charset",
")",
"{",
"return",
"responseBuilder",
".",
"doReturnXML",
"(",
"response",
",",
"charset",
")",
";",
"}"
] | Adds action which returns provided XML in UTF-8 and status 200. Additionally it sets "Content-type" header to "application/xml".
@param response JSON to return
@return response builder | [
"Adds",
"action",
"which",
"returns",
"provided",
"XML",
"in",
"UTF",
"-",
"8",
"and",
"status",
"200",
".",
"Additionally",
"it",
"sets",
"Content",
"-",
"type",
"header",
"to",
"application",
"/",
"xml",
"."
] | train | https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java#L255-L257 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java | MapIterate.forEachValue | public static <K, V> void forEachValue(Map<K, V> map, Procedure<? super V> procedure)
{
if (map == null)
{
throw new IllegalArgumentException("Cannot perform a forEachValue on null");
}
if (MapIterate.notEmpty(map))
{
if (map instanceof UnsortedMapIterable)
{
((MapIterable<K, V>) map).forEachValue(procedure);
}
else
{
IterableIterate.forEach(map.values(), procedure);
}
}
} | java | public static <K, V> void forEachValue(Map<K, V> map, Procedure<? super V> procedure)
{
if (map == null)
{
throw new IllegalArgumentException("Cannot perform a forEachValue on null");
}
if (MapIterate.notEmpty(map))
{
if (map instanceof UnsortedMapIterable)
{
((MapIterable<K, V>) map).forEachValue(procedure);
}
else
{
IterableIterate.forEach(map.values(), procedure);
}
}
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"forEachValue",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Procedure",
"<",
"?",
"super",
"V",
">",
"procedure",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"throw",
"new",
"Il... | For each value of the map, {@code procedure} is evaluated with the value as the parameter. | [
"For",
"each",
"value",
"of",
"the",
"map",
"{"
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L770-L788 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java | SeaGlassLookAndFeel.defineInternalFrames | private void defineInternalFrames(UIDefaults d) {
// Copied from nimbus
//Initialize InternalFrameTitlePane
d.put("InternalFrameTitlePane.contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put("InternalFrameTitlePane.maxFrameIconSize", new DimensionUIResource(18, 18));
//Initialize InternalFrame
d.put("InternalFrame.contentMargins", new InsetsUIResource(1, 6, 6, 6));
d.put("InternalFrame:InternalFrameTitlePane.contentMargins", new InsetsUIResource(3, 0, 3, 0));
d.put("InternalFrame:InternalFrameTitlePane.titleAlignment", "CENTER");
d.put("InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.menuButton\".contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put("InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.iconifyButton\".contentMargins", new InsetsUIResource(9, 9, 9, 9));
d.put("InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\".contentMargins", new InsetsUIResource(9, 9, 9, 9));
d.put("InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.closeButton\".contentMargins", new InsetsUIResource(9, 9, 9, 9));
// Seaglass starts below
if (PlatformUtils.isMac()) {
d.put("frameBaseActive", new Color(0xa8a8a8));
} else {
d.put("frameBaseActive", new Color(0x96adc4));
}
d.put("frameBaseInactive", new Color(0xe0e0e0));
d.put("frameBorderBase", new Color(0x545454));
d.put("frameInnerHighlightInactive", new Color(0x55ffffff, true));
d.put("frameInnerHighlightActive", new Color(0x55ffffff, true));
d.put("seaGlassTitlePaneButtonEnabledBorder", new Color(0x99000000, true));
d.put("seaGlassTitlePaneButtonEnabledCorner", new Color(0x26000000, true));
d.put("seaGlassTitlePaneButtonEnabledInterior", new Color(0x99ffffff, true));
d.put("seaGlassTitlePaneButtonHoverBorder", new Color(0xe5101010, true));
d.put("seaGlassTitlePaneButtonHoverCorner", new Color(0x267a7a7a, true));
d.put("seaGlassTitlePaneButtonHoverInterior", new Color(0xffffff));
d.put("seaGlassTitlePaneButtonPressedBorder", new Color(0xe50e0e0e, true));
d.put("seaGlassTitlePaneButtonPressedCorner", new Color(0x876e6e6e, true));
d.put("seaGlassTitlePaneButtonPressedInterior", new Color(0xe6e6e6));
String p = "InternalFrame";
String c = PAINTER_PREFIX + "FrameAndRootPainter";
d.put(p + ".titleFont", new DerivedFont("defaultFont", 1.0f, true, null));
d.put(p + ".States", "Enabled,WindowFocused");
d.put(p + ":InternalFrameTitlePane.WindowFocused", new TitlePaneWindowFocusedState());
d.put(p + ".WindowFocused", new InternalFrameWindowFocusedState());
d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, FrameAndRootPainter.Which.BACKGROUND_ENABLED));
d.put(p + "[Enabled+WindowFocused].backgroundPainter",
new LazyPainter(c,
FrameAndRootPainter.Which.BACKGROUND_ENABLED_WINDOWFOCUSED));
p = "InternalFrameTitlePane";
d.put(p + ".buttonSpacing", 0);
p = "InternalFrame:InternalFrameTitlePane";
d.put(p + "[Enabled].textForeground", d.get("seaGlassDisabledText"));
d.put(p + "[WindowFocused].textForeground", Color.BLACK);
} | java | private void defineInternalFrames(UIDefaults d) {
// Copied from nimbus
//Initialize InternalFrameTitlePane
d.put("InternalFrameTitlePane.contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put("InternalFrameTitlePane.maxFrameIconSize", new DimensionUIResource(18, 18));
//Initialize InternalFrame
d.put("InternalFrame.contentMargins", new InsetsUIResource(1, 6, 6, 6));
d.put("InternalFrame:InternalFrameTitlePane.contentMargins", new InsetsUIResource(3, 0, 3, 0));
d.put("InternalFrame:InternalFrameTitlePane.titleAlignment", "CENTER");
d.put("InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.menuButton\".contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put("InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.iconifyButton\".contentMargins", new InsetsUIResource(9, 9, 9, 9));
d.put("InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\".contentMargins", new InsetsUIResource(9, 9, 9, 9));
d.put("InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.closeButton\".contentMargins", new InsetsUIResource(9, 9, 9, 9));
// Seaglass starts below
if (PlatformUtils.isMac()) {
d.put("frameBaseActive", new Color(0xa8a8a8));
} else {
d.put("frameBaseActive", new Color(0x96adc4));
}
d.put("frameBaseInactive", new Color(0xe0e0e0));
d.put("frameBorderBase", new Color(0x545454));
d.put("frameInnerHighlightInactive", new Color(0x55ffffff, true));
d.put("frameInnerHighlightActive", new Color(0x55ffffff, true));
d.put("seaGlassTitlePaneButtonEnabledBorder", new Color(0x99000000, true));
d.put("seaGlassTitlePaneButtonEnabledCorner", new Color(0x26000000, true));
d.put("seaGlassTitlePaneButtonEnabledInterior", new Color(0x99ffffff, true));
d.put("seaGlassTitlePaneButtonHoverBorder", new Color(0xe5101010, true));
d.put("seaGlassTitlePaneButtonHoverCorner", new Color(0x267a7a7a, true));
d.put("seaGlassTitlePaneButtonHoverInterior", new Color(0xffffff));
d.put("seaGlassTitlePaneButtonPressedBorder", new Color(0xe50e0e0e, true));
d.put("seaGlassTitlePaneButtonPressedCorner", new Color(0x876e6e6e, true));
d.put("seaGlassTitlePaneButtonPressedInterior", new Color(0xe6e6e6));
String p = "InternalFrame";
String c = PAINTER_PREFIX + "FrameAndRootPainter";
d.put(p + ".titleFont", new DerivedFont("defaultFont", 1.0f, true, null));
d.put(p + ".States", "Enabled,WindowFocused");
d.put(p + ":InternalFrameTitlePane.WindowFocused", new TitlePaneWindowFocusedState());
d.put(p + ".WindowFocused", new InternalFrameWindowFocusedState());
d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, FrameAndRootPainter.Which.BACKGROUND_ENABLED));
d.put(p + "[Enabled+WindowFocused].backgroundPainter",
new LazyPainter(c,
FrameAndRootPainter.Which.BACKGROUND_ENABLED_WINDOWFOCUSED));
p = "InternalFrameTitlePane";
d.put(p + ".buttonSpacing", 0);
p = "InternalFrame:InternalFrameTitlePane";
d.put(p + "[Enabled].textForeground", d.get("seaGlassDisabledText"));
d.put(p + "[WindowFocused].textForeground", Color.BLACK);
} | [
"private",
"void",
"defineInternalFrames",
"(",
"UIDefaults",
"d",
")",
"{",
"// Copied from nimbus",
"//Initialize InternalFrameTitlePane",
"d",
".",
"put",
"(",
"\"InternalFrameTitlePane.contentMargins\"",
",",
"new",
"InsetsUIResource",
"(",
"0",
",",
"0",
",",
"0",
... | Set the icons to paint the title pane decorations.
@param d the UI defaults map. | [
"Set",
"the",
"icons",
"to",
"paint",
"the",
"title",
"pane",
"decorations",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1163-L1227 |
oasp/oasp4j | modules/security/src/main/java/io/oasp/module/security/common/base/accesscontrol/AbstractAccessControlBasedAuthenticationProvider.java | AbstractAccessControlBasedAuthenticationProvider.additionalAuthenticationChecks | @Override
protected void additionalAuthenticationChecks(UserDetails userDetails,
UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
// default implementation authentications via servlet API (container managed)
ServletRequestAttributes currentRequestAttributes =
(ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
HttpServletRequest request = currentRequestAttributes.getRequest();
String login = authentication.getName();
String password = null;
Object credentials = authentication.getCredentials();
if (credentials != null) {
password = credentials.toString();
}
try {
request.login(login, password);
} catch (ServletException e) {
LOG.warn("Authentication failed: {}", e.toString());
throw new BadCredentialsException("Authentication failed.", e);
}
authentication.setDetails(userDetails);
} | java | @Override
protected void additionalAuthenticationChecks(UserDetails userDetails,
UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
// default implementation authentications via servlet API (container managed)
ServletRequestAttributes currentRequestAttributes =
(ServletRequestAttributes) RequestContextHolder.currentRequestAttributes();
HttpServletRequest request = currentRequestAttributes.getRequest();
String login = authentication.getName();
String password = null;
Object credentials = authentication.getCredentials();
if (credentials != null) {
password = credentials.toString();
}
try {
request.login(login, password);
} catch (ServletException e) {
LOG.warn("Authentication failed: {}", e.toString());
throw new BadCredentialsException("Authentication failed.", e);
}
authentication.setDetails(userDetails);
} | [
"@",
"Override",
"protected",
"void",
"additionalAuthenticationChecks",
"(",
"UserDetails",
"userDetails",
",",
"UsernamePasswordAuthenticationToken",
"authentication",
")",
"throws",
"AuthenticationException",
"{",
"// default implementation authentications via servlet API (container ... | Here the actual authentication has to be implemented.<br/>
<br/> | [
"Here",
"the",
"actual",
"authentication",
"has",
"to",
"be",
"implemented",
".",
"<br",
"/",
">",
"<br",
"/",
">"
] | train | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/security/src/main/java/io/oasp/module/security/common/base/accesscontrol/AbstractAccessControlBasedAuthenticationProvider.java#L86-L108 |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/contract/Checks.java | Checks.checkNotEmpty | public static <T> T checkNotEmpty(T reference, @Nullable Object errorMessage) {
checkNotEmpty(reference, String.valueOf(errorMessage), EMPTY_ERROR_MESSAGE_ARGS);
return reference;
} | java | public static <T> T checkNotEmpty(T reference, @Nullable Object errorMessage) {
checkNotEmpty(reference, String.valueOf(errorMessage), EMPTY_ERROR_MESSAGE_ARGS);
return reference;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkNotEmpty",
"(",
"T",
"reference",
",",
"@",
"Nullable",
"Object",
"errorMessage",
")",
"{",
"checkNotEmpty",
"(",
"reference",
",",
"String",
".",
"valueOf",
"(",
"errorMessage",
")",
",",
"EMPTY_ERROR_MESSAGE_ARGS... | Performs emptiness and nullness check.
@param reference reference to check
@param errorMessage the exception message to use if the check fails; will
be converted to a string using {@link String#valueOf(Object)}
@param <T> the reference type
@return the checked reference
@throws IllegalArgumentException if the {@code reference} is empty
@throws NullPointerException if the {@code reference} is null
@see #checkNotEmpty(Object, String, Object...) | [
"Performs",
"emptiness",
"and",
"nullness",
"check",
"."
] | train | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/contract/Checks.java#L290-L293 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/ObjectGraphDump.java | ObjectGraphDump.visitComplexTypeWithDiff | private void visitComplexTypeWithDiff(final ObjectGraphNode node, final Object otherInstance) {
if (otherInstance == null) {
// Nothing to compare against, just use the default visit
visitComplexType(node);
} else {
Field[] fields = getAllInstanceFields(node.getValue());
for (int i = 0; i < fields.length; i++) {
Object fieldValue = readField(fields[i], node.getValue());
Object otherValue = readField(fields[i], otherInstance);
String fieldType = fields[i].getType().getName();
String nodeFieldName = fields[i].getName() + (Util.equals(fieldValue, otherValue) ? "" : "*");
ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, nodeFieldName,
fieldType, fieldValue);
node.add(childNode);
visit(childNode);
}
}
} | java | private void visitComplexTypeWithDiff(final ObjectGraphNode node, final Object otherInstance) {
if (otherInstance == null) {
// Nothing to compare against, just use the default visit
visitComplexType(node);
} else {
Field[] fields = getAllInstanceFields(node.getValue());
for (int i = 0; i < fields.length; i++) {
Object fieldValue = readField(fields[i], node.getValue());
Object otherValue = readField(fields[i], otherInstance);
String fieldType = fields[i].getType().getName();
String nodeFieldName = fields[i].getName() + (Util.equals(fieldValue, otherValue) ? "" : "*");
ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, nodeFieldName,
fieldType, fieldValue);
node.add(childNode);
visit(childNode);
}
}
} | [
"private",
"void",
"visitComplexTypeWithDiff",
"(",
"final",
"ObjectGraphNode",
"node",
",",
"final",
"Object",
"otherInstance",
")",
"{",
"if",
"(",
"otherInstance",
"==",
"null",
")",
"{",
"// Nothing to compare against, just use the default visit",
"visitComplexType",
... | Visits all the fields in the given complex object, noting differences.
@param node the ObjectGraphNode containing the object.
@param otherInstance the other instance to compare to | [
"Visits",
"all",
"the",
"fields",
"in",
"the",
"given",
"complex",
"object",
"noting",
"differences",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/ObjectGraphDump.java#L139-L158 |
jfinal/jfinal | src/main/java/com/jfinal/render/FreeMarkerRender.java | FreeMarkerRender.setSharedVariable | public static void setSharedVariable(String name, Object object) {
try {
FreeMarkerRender.getConfiguration().setSharedVariable(name, object);
} catch (TemplateException e) {
throw new RuntimeException(e);
}
} | java | public static void setSharedVariable(String name, Object object) {
try {
FreeMarkerRender.getConfiguration().setSharedVariable(name, object);
} catch (TemplateException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"void",
"setSharedVariable",
"(",
"String",
"name",
",",
"Object",
"object",
")",
"{",
"try",
"{",
"FreeMarkerRender",
".",
"getConfiguration",
"(",
")",
".",
"setSharedVariable",
"(",
"name",
",",
"object",
")",
";",
"}",
"catch",
"(",
... | 注入对象到 FreeMarker 页面供调用,通常注入一些辅助内容输出的工具类,相当于是 freemarker 的一种扩展方式
@param name 对象名
@param object 对象 | [
"注入对象到",
"FreeMarker",
"页面供调用,通常注入一些辅助内容输出的工具类,相当于是",
"freemarker",
"的一种扩展方式"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/render/FreeMarkerRender.java#L70-L76 |
alkacon/opencms-core | src/org/opencms/ui/apps/lists/CmsResultFacets.java | CmsResultFacets.prepareCategoryFacets | private Component prepareCategoryFacets(CmsSolrResultList solrResultList, CmsSearchResultWrapper resultWrapper) {
FacetField categoryFacets = solrResultList.getFacetField(CmsListManager.FIELD_CATEGORIES);
I_CmsSearchControllerFacetField facetController = resultWrapper.getController().getFieldFacets().getFieldFacetController().get(
CmsListManager.FIELD_CATEGORIES);
if ((categoryFacets != null) && (categoryFacets.getValueCount() > 0)) {
VerticalLayout catLayout = new VerticalLayout();
for (final Count value : categoryFacets.getValues()) {
Button cat = new Button(getCategoryLabel(value.getName()) + " (" + value.getCount() + ")");
cat.addStyleName(ValoTheme.BUTTON_TINY);
cat.addStyleName(ValoTheme.BUTTON_BORDERLESS);
Boolean selected = facetController.getState().getIsChecked().get(value.getName());
if ((selected != null) && selected.booleanValue()) {
cat.addStyleName(SELECTED_STYLE);
}
cat.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
if (isSelected(event.getComponent())) {
resetFacetsAndSearch();
} else {
selectFieldFacet(CmsListManager.FIELD_CATEGORIES, value.getName());
}
}
});
catLayout.addComponent(cat);
}
Panel catPanel = new Panel(CmsVaadinUtils.getMessageText(Messages.GUI_LISTMANAGER_FACET_CATEGORIES_0));
catPanel.setContent(catLayout);
return catPanel;
} else {
return null;
}
} | java | private Component prepareCategoryFacets(CmsSolrResultList solrResultList, CmsSearchResultWrapper resultWrapper) {
FacetField categoryFacets = solrResultList.getFacetField(CmsListManager.FIELD_CATEGORIES);
I_CmsSearchControllerFacetField facetController = resultWrapper.getController().getFieldFacets().getFieldFacetController().get(
CmsListManager.FIELD_CATEGORIES);
if ((categoryFacets != null) && (categoryFacets.getValueCount() > 0)) {
VerticalLayout catLayout = new VerticalLayout();
for (final Count value : categoryFacets.getValues()) {
Button cat = new Button(getCategoryLabel(value.getName()) + " (" + value.getCount() + ")");
cat.addStyleName(ValoTheme.BUTTON_TINY);
cat.addStyleName(ValoTheme.BUTTON_BORDERLESS);
Boolean selected = facetController.getState().getIsChecked().get(value.getName());
if ((selected != null) && selected.booleanValue()) {
cat.addStyleName(SELECTED_STYLE);
}
cat.addClickListener(new ClickListener() {
private static final long serialVersionUID = 1L;
public void buttonClick(ClickEvent event) {
if (isSelected(event.getComponent())) {
resetFacetsAndSearch();
} else {
selectFieldFacet(CmsListManager.FIELD_CATEGORIES, value.getName());
}
}
});
catLayout.addComponent(cat);
}
Panel catPanel = new Panel(CmsVaadinUtils.getMessageText(Messages.GUI_LISTMANAGER_FACET_CATEGORIES_0));
catPanel.setContent(catLayout);
return catPanel;
} else {
return null;
}
} | [
"private",
"Component",
"prepareCategoryFacets",
"(",
"CmsSolrResultList",
"solrResultList",
",",
"CmsSearchResultWrapper",
"resultWrapper",
")",
"{",
"FacetField",
"categoryFacets",
"=",
"solrResultList",
".",
"getFacetField",
"(",
"CmsListManager",
".",
"FIELD_CATEGORIES",
... | Prepares the category facets for the given search result.<p>
@param solrResultList the search result list
@param resultWrapper the result wrapper
@return the category facets component | [
"Prepares",
"the",
"category",
"facets",
"for",
"the",
"given",
"search",
"result",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/lists/CmsResultFacets.java#L319-L355 |
selenide/selenide | src/main/java/com/codeborne/selenide/Condition.java | Condition.selectedText | public static Condition selectedText(final String expectedText) {
return new Condition("selectedText") {
String actualResult = "";
@Override
public boolean apply(Driver driver, WebElement element) {
actualResult = driver.executeJavaScript(
"return arguments[0].value.substring(arguments[0].selectionStart, arguments[0].selectionEnd);", element);
return actualResult.equals(expectedText);
}
@Override
public String actualValue(Driver driver, WebElement element) {
return "'" + actualResult + "'";
}
@Override
public String toString() {
return name + " '" + expectedText + '\'';
}
};
} | java | public static Condition selectedText(final String expectedText) {
return new Condition("selectedText") {
String actualResult = "";
@Override
public boolean apply(Driver driver, WebElement element) {
actualResult = driver.executeJavaScript(
"return arguments[0].value.substring(arguments[0].selectionStart, arguments[0].selectionEnd);", element);
return actualResult.equals(expectedText);
}
@Override
public String actualValue(Driver driver, WebElement element) {
return "'" + actualResult + "'";
}
@Override
public String toString() {
return name + " '" + expectedText + '\'';
}
};
} | [
"public",
"static",
"Condition",
"selectedText",
"(",
"final",
"String",
"expectedText",
")",
"{",
"return",
"new",
"Condition",
"(",
"\"selectedText\"",
")",
"{",
"String",
"actualResult",
"=",
"\"\"",
";",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
... | Checks for selected text on a given input web element
<p>Sample: {@code $("input").shouldHave(selectedText("Text"))}</p>
<p>NB! Case sensitive</p>
@param expectedText expected selected text of the element | [
"Checks",
"for",
"selected",
"text",
"on",
"a",
"given",
"input",
"web",
"element"
] | train | https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/Condition.java#L267-L288 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamUtils.java | BamUtils.checkBamOrCramFile | public static void checkBamOrCramFile(InputStream is, String bamFileName) throws IOException {
checkBamOrCramFile(is, bamFileName, true);
} | java | public static void checkBamOrCramFile(InputStream is, String bamFileName) throws IOException {
checkBamOrCramFile(is, bamFileName, true);
} | [
"public",
"static",
"void",
"checkBamOrCramFile",
"(",
"InputStream",
"is",
",",
"String",
"bamFileName",
")",
"throws",
"IOException",
"{",
"checkBamOrCramFile",
"(",
"is",
",",
"bamFileName",
",",
"true",
")",
";",
"}"
] | Check if the file is a sorted binary bam file.
@param is Bam InputStream
@param bamFileName Bam FileName
@throws IOException | [
"Check",
"if",
"the",
"file",
"is",
"a",
"sorted",
"binary",
"bam",
"file",
"."
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamUtils.java#L122-L124 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/internal/CopyCallable.java | CopyCallable.copyPartsInParallel | private void copyPartsInParallel(CopyPartRequestFactory requestFactory) {
while (requestFactory.hasMoreRequests()) {
if (threadPool.isShutdown())
throw new CancellationException(
"TransferManager has been shutdown");
CopyPartRequest request = requestFactory.getNextCopyPartRequest();
futures.add(threadPool.submit(new CopyPartCallable(s3, request)));
}
} | java | private void copyPartsInParallel(CopyPartRequestFactory requestFactory) {
while (requestFactory.hasMoreRequests()) {
if (threadPool.isShutdown())
throw new CancellationException(
"TransferManager has been shutdown");
CopyPartRequest request = requestFactory.getNextCopyPartRequest();
futures.add(threadPool.submit(new CopyPartCallable(s3, request)));
}
} | [
"private",
"void",
"copyPartsInParallel",
"(",
"CopyPartRequestFactory",
"requestFactory",
")",
"{",
"while",
"(",
"requestFactory",
".",
"hasMoreRequests",
"(",
")",
")",
"{",
"if",
"(",
"threadPool",
".",
"isShutdown",
"(",
")",
")",
"throw",
"new",
"Cancellat... | Submits a callable for each part to be copied to our thread pool and
records its corresponding Future. | [
"Submits",
"a",
"callable",
"for",
"each",
"part",
"to",
"be",
"copied",
"to",
"our",
"thread",
"pool",
"and",
"records",
"its",
"corresponding",
"Future",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/internal/CopyCallable.java#L200-L208 |
alkacon/opencms-core | src/org/opencms/gwt/CmsIconUtil.java | CmsIconUtil.getResourceSubTypeIconClass | static String getResourceSubTypeIconClass(String resourceTypeName, String suffix, boolean small) {
StringBuffer buffer = new StringBuffer(CmsGwtConstants.TYPE_ICON_CLASS).append("_").append(
resourceTypeName.hashCode()).append("_").append(suffix);
if (small) {
buffer.append(SMALL_SUFFIX);
}
return buffer.toString();
} | java | static String getResourceSubTypeIconClass(String resourceTypeName, String suffix, boolean small) {
StringBuffer buffer = new StringBuffer(CmsGwtConstants.TYPE_ICON_CLASS).append("_").append(
resourceTypeName.hashCode()).append("_").append(suffix);
if (small) {
buffer.append(SMALL_SUFFIX);
}
return buffer.toString();
} | [
"static",
"String",
"getResourceSubTypeIconClass",
"(",
"String",
"resourceTypeName",
",",
"String",
"suffix",
",",
"boolean",
"small",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"CmsGwtConstants",
".",
"TYPE_ICON_CLASS",
")",
".",
"append"... | Returns the CSS class for a given resource type name and file name extension.<p>
@param resourceTypeName the resource type name
@param suffix the file name extension
@param small if true, get the icon class for the small icon, else for the biggest one available
@return the CSS class for the type and extension | [
"Returns",
"the",
"CSS",
"class",
"for",
"a",
"given",
"resource",
"type",
"name",
"and",
"file",
"name",
"extension",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsIconUtil.java#L433-L441 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DigestUtils.java | DigestUtils.shaBase64 | public static String shaBase64(final String salt, final String data, final String separator, final boolean chunked) {
val result = rawDigest(MessageDigestAlgorithms.SHA_1, salt, separator == null ? data : data + separator);
return EncodingUtils.encodeBase64(result, chunked);
} | java | public static String shaBase64(final String salt, final String data, final String separator, final boolean chunked) {
val result = rawDigest(MessageDigestAlgorithms.SHA_1, salt, separator == null ? data : data + separator);
return EncodingUtils.encodeBase64(result, chunked);
} | [
"public",
"static",
"String",
"shaBase64",
"(",
"final",
"String",
"salt",
",",
"final",
"String",
"data",
",",
"final",
"String",
"separator",
",",
"final",
"boolean",
"chunked",
")",
"{",
"val",
"result",
"=",
"rawDigest",
"(",
"MessageDigestAlgorithms",
"."... | Sha base 64 string.
@param salt the salt
@param data the data
@param separator a string separator, if any
@param chunked the chunked
@return the string | [
"Sha",
"base",
"64",
"string",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DigestUtils.java#L84-L87 |
jMetal/jMetal | jmetal-problem/src/main/java/org/uma/jmetal/problem/multiobjective/zdt/ZDT3.java | ZDT3.evalH | protected double evalH(double f, double g) {
double h ;
h = 1.0 - Math.sqrt(f / g)
- (f / g) * Math.sin(10.0 * Math.PI * f);
return h;
} | java | protected double evalH(double f, double g) {
double h ;
h = 1.0 - Math.sqrt(f / g)
- (f / g) * Math.sin(10.0 * Math.PI * f);
return h;
} | [
"protected",
"double",
"evalH",
"(",
"double",
"f",
",",
"double",
"g",
")",
"{",
"double",
"h",
";",
"h",
"=",
"1.0",
"-",
"Math",
".",
"sqrt",
"(",
"f",
"/",
"g",
")",
"-",
"(",
"f",
"/",
"g",
")",
"*",
"Math",
".",
"sin",
"(",
"10.0",
"*... | Returns the value of the ZDT3 function H.
@param f First argument of the function H.
@param g Second argument of the function H. | [
"Returns",
"the",
"value",
"of",
"the",
"ZDT3",
"function",
"H",
"."
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-problem/src/main/java/org/uma/jmetal/problem/multiobjective/zdt/ZDT3.java#L51-L56 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/samediff/SDLayerParams.java | SDLayerParams.addWeightParam | public void addWeightParam(@NonNull String paramKey, @NonNull long... paramShape) {
Preconditions.checkArgument(paramShape.length > 0, "Provided weight parameter shape is"
+ " invalid: length 0 provided for shape. Parameter: " + paramKey);
weightParams.put(paramKey, paramShape);
paramsList = null;
weightParamsList = null;
biasParamsList = null;
} | java | public void addWeightParam(@NonNull String paramKey, @NonNull long... paramShape) {
Preconditions.checkArgument(paramShape.length > 0, "Provided weight parameter shape is"
+ " invalid: length 0 provided for shape. Parameter: " + paramKey);
weightParams.put(paramKey, paramShape);
paramsList = null;
weightParamsList = null;
biasParamsList = null;
} | [
"public",
"void",
"addWeightParam",
"(",
"@",
"NonNull",
"String",
"paramKey",
",",
"@",
"NonNull",
"long",
"...",
"paramShape",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"paramShape",
".",
"length",
">",
"0",
",",
"\"Provided weight parameter shape is... | Add a weight parameter to the layer, with the specified shape. For example, a standard fully connected layer
could have weight parameters with shape [numInputs, layerSize]
@param paramKey The parameter key (name) for the weight parameter
@param paramShape Shape of the weight parameter array | [
"Add",
"a",
"weight",
"parameter",
"to",
"the",
"layer",
"with",
"the",
"specified",
"shape",
".",
"For",
"example",
"a",
"standard",
"fully",
"connected",
"layer",
"could",
"have",
"weight",
"parameters",
"with",
"shape",
"[",
"numInputs",
"layerSize",
"]"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/samediff/SDLayerParams.java#L65-L72 |
cbeust/jcommander | src/main/java/com/beust/jcommander/JCommander.java | JCommander.setProgramName | public void setProgramName(String name, String... aliases) {
programName = new ProgramName(name, Arrays.asList(aliases));
} | java | public void setProgramName(String name, String... aliases) {
programName = new ProgramName(name, Arrays.asList(aliases));
} | [
"public",
"void",
"setProgramName",
"(",
"String",
"name",
",",
"String",
"...",
"aliases",
")",
"{",
"programName",
"=",
"new",
"ProgramName",
"(",
"name",
",",
"Arrays",
".",
"asList",
"(",
"aliases",
")",
")",
";",
"}"
] | Set the program name
@param name program name
@param aliases aliases to the program name | [
"Set",
"the",
"program",
"name"
] | train | https://github.com/cbeust/jcommander/blob/85cb6f7217e15f62225185ffd97491f34b7b49bb/src/main/java/com/beust/jcommander/JCommander.java#L1014-L1016 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLConverter.java | AFPChainXMLConverter.toXML | public synchronized static void toXML(AFPChain afpChain, StringWriter swriter,Atom[] ca1, Atom[]ca2) throws IOException{
PrintWriter writer = new PrintWriter(swriter);
PrettyXMLWriter xml = new PrettyXMLWriter(writer);
xml.openTag("AFPChain");
printXMLHeader(xml,afpChain);
// that is the initial alignment...
// we don't serialize that at the present.
//int[] blockResSize = afpChain.getBlockResSize();
//int[][][] blockResList = afpChain.getBlockResList();
// get the alignment blocks
int blockNum = afpChain.getBlockNum();
//int[] optLen = afpChain.getOptLen();
//int[] blockSize = afpChain.getBlockSize();
for(int bk = 0; bk < blockNum; bk ++) {
xml.openTag("block");
printXMLBlockHeader(xml,afpChain, bk);
if ( ca1 == null || ca2 == null) {
try {
printXMLEQRKnownPositions(xml,afpChain,bk);
} catch (StructureException ex ){
throw new IOException(ex.getMessage());
}
}
else
printXMLEQRInferPositions(xml, afpChain,bk,ca1,ca2);
printXMLMatrixShift(xml, afpChain, bk);
xml.closeTag("block");
}
xml.closeTag("AFPChain");
writer.close();
} | java | public synchronized static void toXML(AFPChain afpChain, StringWriter swriter,Atom[] ca1, Atom[]ca2) throws IOException{
PrintWriter writer = new PrintWriter(swriter);
PrettyXMLWriter xml = new PrettyXMLWriter(writer);
xml.openTag("AFPChain");
printXMLHeader(xml,afpChain);
// that is the initial alignment...
// we don't serialize that at the present.
//int[] blockResSize = afpChain.getBlockResSize();
//int[][][] blockResList = afpChain.getBlockResList();
// get the alignment blocks
int blockNum = afpChain.getBlockNum();
//int[] optLen = afpChain.getOptLen();
//int[] blockSize = afpChain.getBlockSize();
for(int bk = 0; bk < blockNum; bk ++) {
xml.openTag("block");
printXMLBlockHeader(xml,afpChain, bk);
if ( ca1 == null || ca2 == null) {
try {
printXMLEQRKnownPositions(xml,afpChain,bk);
} catch (StructureException ex ){
throw new IOException(ex.getMessage());
}
}
else
printXMLEQRInferPositions(xml, afpChain,bk,ca1,ca2);
printXMLMatrixShift(xml, afpChain, bk);
xml.closeTag("block");
}
xml.closeTag("AFPChain");
writer.close();
} | [
"public",
"synchronized",
"static",
"void",
"toXML",
"(",
"AFPChain",
"afpChain",
",",
"StringWriter",
"swriter",
",",
"Atom",
"[",
"]",
"ca1",
",",
"Atom",
"[",
"]",
"ca2",
")",
"throws",
"IOException",
"{",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter... | Write the XML representation to a StringWriter
@param afpChain
@param swriter
@throws IOException | [
"Write",
"the",
"XML",
"representation",
"to",
"a",
"StringWriter"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLConverter.java#L56-L102 |
skyscreamer/JSONassert | src/main/java/org/skyscreamer/jsonassert/JSONAssert.java | JSONAssert.assertEquals | public static void assertEquals(String expectedStr, JSONArray actual, JSONCompareMode compareMode)
throws JSONException {
assertEquals("", expectedStr, actual, compareMode);
} | java | public static void assertEquals(String expectedStr, JSONArray actual, JSONCompareMode compareMode)
throws JSONException {
assertEquals("", expectedStr, actual, compareMode);
} | [
"public",
"static",
"void",
"assertEquals",
"(",
"String",
"expectedStr",
",",
"JSONArray",
"actual",
",",
"JSONCompareMode",
"compareMode",
")",
"throws",
"JSONException",
"{",
"assertEquals",
"(",
"\"\"",
",",
"expectedStr",
",",
"actual",
",",
"compareMode",
")... | Asserts that the JSONArray provided matches the expected string. If it isn't it throws an
{@link AssertionError}.
@param expectedStr Expected JSON string
@param actual JSONArray to compare
@param compareMode Specifies which comparison mode to use
@throws JSONException JSON parsing error | [
"Asserts",
"that",
"the",
"JSONArray",
"provided",
"matches",
"the",
"expected",
"string",
".",
"If",
"it",
"isn",
"t",
"it",
"throws",
"an",
"{",
"@link",
"AssertionError",
"}",
"."
] | train | https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L258-L261 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/PropertiesField.java | PropertiesField.updateOrigKey | public boolean updateOrigKey(Map<String,Object> propOrig, String strKey, String strOrigValue, String strNewValue, boolean bOrigChange)
{
if (((strNewValue != null) && (!strNewValue.equals(strOrigValue)))
|| ((strNewValue == null) && (strOrigValue != null)))
{ // If I am using the read value now (and it has changed from the orig value) change the orig value to the read value.
bOrigChange = true;
if (strNewValue != null)
propOrig.put(strKey, strNewValue); // Original must reflect the read value in case it changes again.
else
propOrig.remove(strKey); // Original must reflect the read value in case it changes again.
}
return bOrigChange;
} | java | public boolean updateOrigKey(Map<String,Object> propOrig, String strKey, String strOrigValue, String strNewValue, boolean bOrigChange)
{
if (((strNewValue != null) && (!strNewValue.equals(strOrigValue)))
|| ((strNewValue == null) && (strOrigValue != null)))
{ // If I am using the read value now (and it has changed from the orig value) change the orig value to the read value.
bOrigChange = true;
if (strNewValue != null)
propOrig.put(strKey, strNewValue); // Original must reflect the read value in case it changes again.
else
propOrig.remove(strKey); // Original must reflect the read value in case it changes again.
}
return bOrigChange;
} | [
"public",
"boolean",
"updateOrigKey",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"propOrig",
",",
"String",
"strKey",
",",
"String",
"strOrigValue",
",",
"String",
"strNewValue",
",",
"boolean",
"bOrigChange",
")",
"{",
"if",
"(",
"(",
"(",
"strNewValue"... | Given the read, original, and current values for this key, update the original key value.
@param propOrig
@param strKey
@param strReadValue
@param strOrigValue
@param strNewValue
@param bOrigChange
@return | [
"Given",
"the",
"read",
"original",
"and",
"current",
"values",
"for",
"this",
"key",
"update",
"the",
"original",
"key",
"value",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L591-L603 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/ChatApi.java | ChatApi.sendSystemCommand | public ApiSuccessResponse sendSystemCommand(String id, SystemCommandData systemCommandData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = sendSystemCommandWithHttpInfo(id, systemCommandData);
return resp.getData();
} | java | public ApiSuccessResponse sendSystemCommand(String id, SystemCommandData systemCommandData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = sendSystemCommandWithHttpInfo(id, systemCommandData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"sendSystemCommand",
"(",
"String",
"id",
",",
"SystemCommandData",
"systemCommandData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"sendSystemCommandWithHttpInfo",
"(",
"id",
",",
"sys... | Send a system command
Send a system command to the specified chat.
@param id The ID of the chat interaction. (required)
@param systemCommandData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Send",
"a",
"system",
"command",
"Send",
"a",
"system",
"command",
"to",
"the",
"specified",
"chat",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L1699-L1702 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionContext.java | SessionContext.addHttpSessionIdListener | public void addHttpSessionIdListener(ArrayList al, String j2eeName) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[ADD_HTTP_SESSION_ID_LISTENER], "addHttpSessionIdListener:" + al);
}
if (j2eeName != null) {
addToJ2eeNameList(j2eeName, al.size(), mHttpSessionIdListenersJ2eeNames);
}
synchronized (mHttpSessionIdListeners) {
mHttpSessionIdListeners.addAll(al);
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[ADD_HTTP_SESSION_LISTENER], "addHttpSessionListener:" + al);
}
} | java | public void addHttpSessionIdListener(ArrayList al, String j2eeName) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[ADD_HTTP_SESSION_ID_LISTENER], "addHttpSessionIdListener:" + al);
}
if (j2eeName != null) {
addToJ2eeNameList(j2eeName, al.size(), mHttpSessionIdListenersJ2eeNames);
}
synchronized (mHttpSessionIdListeners) {
mHttpSessionIdListeners.addAll(al);
}
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[ADD_HTTP_SESSION_LISTENER], "addHttpSessionListener:" + al);
}
} | [
"public",
"void",
"addHttpSessionIdListener",
"(",
"ArrayList",
"al",
",",
"String",
"j2eeName",
")",
"{",
"if",
"(",
"com",
".",
"ibm",
".",
"ejs",
".",
"ras",
".",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"LoggingUtil",
".",
"SESSION_L... | /*
Adds a list of Session ID Listeners
For shared session context or global sesions, we call
this method to add each app's listeners. | [
"/",
"*",
"Adds",
"a",
"list",
"of",
"Session",
"ID",
"Listeners",
"For",
"shared",
"session",
"context",
"or",
"global",
"sesions",
"we",
"call",
"this",
"method",
"to",
"add",
"each",
"app",
"s",
"listeners",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionContext.java#L1196-L1210 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_ZUpdateLineExtremities.java | ST_ZUpdateLineExtremities.updateZExtremities | public static Geometry updateZExtremities(Geometry geometry, double startZ, double endZ, boolean interpolate) {
if(geometry == null){
return null;
}
if (geometry instanceof LineString) {
return force3DStartEnd((LineString) geometry, startZ, endZ, interpolate);
} else if (geometry instanceof MultiLineString) {
int nbGeom = geometry.getNumGeometries();
LineString[] lines = new LineString[nbGeom];
for (int i = 0; i < nbGeom; i++) {
LineString subGeom = (LineString) geometry.getGeometryN(i);
lines[i] = (LineString) force3DStartEnd(subGeom, startZ, endZ, interpolate);
}
return FACTORY.createMultiLineString(lines);
} else {
return null;
}
} | java | public static Geometry updateZExtremities(Geometry geometry, double startZ, double endZ, boolean interpolate) {
if(geometry == null){
return null;
}
if (geometry instanceof LineString) {
return force3DStartEnd((LineString) geometry, startZ, endZ, interpolate);
} else if (geometry instanceof MultiLineString) {
int nbGeom = geometry.getNumGeometries();
LineString[] lines = new LineString[nbGeom];
for (int i = 0; i < nbGeom; i++) {
LineString subGeom = (LineString) geometry.getGeometryN(i);
lines[i] = (LineString) force3DStartEnd(subGeom, startZ, endZ, interpolate);
}
return FACTORY.createMultiLineString(lines);
} else {
return null;
}
} | [
"public",
"static",
"Geometry",
"updateZExtremities",
"(",
"Geometry",
"geometry",
",",
"double",
"startZ",
",",
"double",
"endZ",
",",
"boolean",
"interpolate",
")",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"("... | Update the start and end Z values. If the interpolate is true the
vertices are interpolated according the start and end z values.
@param geometry
@param startZ
@param endZ
@param interpolate
@return | [
"Update",
"the",
"start",
"and",
"end",
"Z",
"values",
".",
"If",
"the",
"interpolate",
"is",
"true",
"the",
"vertices",
"are",
"interpolated",
"according",
"the",
"start",
"and",
"end",
"z",
"values",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_ZUpdateLineExtremities.java#L60-L77 |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/threadContext/ComponentMetaDataAccessorImpl.java | ComponentMetaDataAccessorImpl.beginContext | public Object beginContext(ComponentMetaData cmd) { // modified to return object d131914
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (cmd != null)
Tr.debug(tc, "begin context " + cmd.getJ2EEName());
else
Tr.debug(tc, "NULL was passed.");
}
if (cmd == null) {
Tr.error(tc, "WSVR0603E"); // d143991
throw new IllegalArgumentException(Tr.formatMessage(tc, "WSVR0603E"));
}
return threadContext.beginContext(cmd); //131914
} | java | public Object beginContext(ComponentMetaData cmd) { // modified to return object d131914
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (cmd != null)
Tr.debug(tc, "begin context " + cmd.getJ2EEName());
else
Tr.debug(tc, "NULL was passed.");
}
if (cmd == null) {
Tr.error(tc, "WSVR0603E"); // d143991
throw new IllegalArgumentException(Tr.formatMessage(tc, "WSVR0603E"));
}
return threadContext.beginContext(cmd); //131914
} | [
"public",
"Object",
"beginContext",
"(",
"ComponentMetaData",
"cmd",
")",
"{",
"// modified to return object d131914",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"if",
"(",
"cmd",
"!=... | Begin the context for the ComponentMetaData provided.
@param ComponentMetaData It Must not be null. Tr.error will be logged if it is null.
@return Previous Object, which was on the stack. It can be null. | [
"Begin",
"the",
"context",
"for",
"the",
"ComponentMetaData",
"provided",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/threadContext/ComponentMetaDataAccessorImpl.java#L83-L97 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java | GVRPicker.getWorldPickRay | public final void getWorldPickRay(Vector3f origin, Vector3f direction)
{
GVRSceneObject owner = getOwnerObject();
if (owner == null) // should never come here, picker always
{ // owned by GVRGearCursorController pivot
owner = mScene.getMainCameraRig().getHeadTransformObject();
}
Matrix4f mtx = owner.getTransform().getModelMatrix4f();
origin.set(mRayOrigin);
direction.set(mRayDirection);
origin.mulPosition(mtx); // get ray in world coordinates
direction.mulDirection(mtx);
direction.normalize();
} | java | public final void getWorldPickRay(Vector3f origin, Vector3f direction)
{
GVRSceneObject owner = getOwnerObject();
if (owner == null) // should never come here, picker always
{ // owned by GVRGearCursorController pivot
owner = mScene.getMainCameraRig().getHeadTransformObject();
}
Matrix4f mtx = owner.getTransform().getModelMatrix4f();
origin.set(mRayOrigin);
direction.set(mRayDirection);
origin.mulPosition(mtx); // get ray in world coordinates
direction.mulDirection(mtx);
direction.normalize();
} | [
"public",
"final",
"void",
"getWorldPickRay",
"(",
"Vector3f",
"origin",
",",
"Vector3f",
"direction",
")",
"{",
"GVRSceneObject",
"owner",
"=",
"getOwnerObject",
"(",
")",
";",
"if",
"(",
"owner",
"==",
"null",
")",
"// should never come here, picker always",
"{"... | Gets the pick ray in world coordinates.
<p>
World coordinates are defined as the coordinate system at the
root of the scene graph before any camera viewing transformation
is applied.
<p>
You can get the pick ray relative to the scene object that
owns the picker (or the camera if no owner) by calling
{@link #getPickRay()}
@param origin world coordinate origin of the pick ray
@param direction world coordinate direction of the pick ray
@see #getPickRay()
@see #setPickRay(float, float, float, float, float, float) | [
"Gets",
"the",
"pick",
"ray",
"in",
"world",
"coordinates",
".",
"<p",
">",
"World",
"coordinates",
"are",
"defined",
"as",
"the",
"coordinate",
"system",
"at",
"the",
"root",
"of",
"the",
"scene",
"graph",
"before",
"any",
"camera",
"viewing",
"transformati... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L360-L374 |
hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/results/projectparser/performance/LrProjectScenarioResults.java | LrProjectScenarioResults.vTransactionMapInit | public static void vTransactionMapInit(SortedMap<String, Integer> map) {
map.put("Pass", 0);
map.put("Stop", 0);
map.put("Fail", 0);
map.put("Count", 0);
} | java | public static void vTransactionMapInit(SortedMap<String, Integer> map) {
map.put("Pass", 0);
map.put("Stop", 0);
map.put("Fail", 0);
map.put("Count", 0);
} | [
"public",
"static",
"void",
"vTransactionMapInit",
"(",
"SortedMap",
"<",
"String",
",",
"Integer",
">",
"map",
")",
"{",
"map",
".",
"put",
"(",
"\"Pass\"",
",",
"0",
")",
";",
"map",
".",
"put",
"(",
"\"Stop\"",
",",
"0",
")",
";",
"map",
".",
"p... | initilize vuser maps with required values
@param map the map | [
"initilize",
"vuser",
"maps",
"with",
"required",
"values"
] | train | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/projectparser/performance/LrProjectScenarioResults.java#L119-L124 |
termsuite/termsuite-core | src/main/java/fr/univnantes/termsuite/tools/CliUtil.java | CliUtil.logCommandLineOptions | public static void logCommandLineOptions(Logger logger, CommandLine line) {
for (Option myOption : line.getOptions()) {
String message;
String opt = "";
if(myOption.getOpt() != null) {
opt+="-"+myOption.getOpt();
if(myOption.getLongOpt() != null)
opt+=" (--"+myOption.getLongOpt()+")";
} else
opt+="--"+myOption.getLongOpt()+"";
if(myOption.hasArg())
message = opt + " " + myOption.getValue();
else
message = opt;
logger.info("with option: " + message);
}
} | java | public static void logCommandLineOptions(Logger logger, CommandLine line) {
for (Option myOption : line.getOptions()) {
String message;
String opt = "";
if(myOption.getOpt() != null) {
opt+="-"+myOption.getOpt();
if(myOption.getLongOpt() != null)
opt+=" (--"+myOption.getLongOpt()+")";
} else
opt+="--"+myOption.getLongOpt()+"";
if(myOption.hasArg())
message = opt + " " + myOption.getValue();
else
message = opt;
logger.info("with option: " + message);
}
} | [
"public",
"static",
"void",
"logCommandLineOptions",
"(",
"Logger",
"logger",
",",
"CommandLine",
"line",
")",
"{",
"for",
"(",
"Option",
"myOption",
":",
"line",
".",
"getOptions",
"(",
")",
")",
"{",
"String",
"message",
";",
"String",
"opt",
"=",
"\"\""... | Displays all command line options in log messages.
@param line | [
"Displays",
"all",
"command",
"line",
"options",
"in",
"log",
"messages",
"."
] | train | https://github.com/termsuite/termsuite-core/blob/731e5d0bc7c14180713c01a9c7dffe1925f26130/src/main/java/fr/univnantes/termsuite/tools/CliUtil.java#L91-L110 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java | JsonRpcBasicServer.handleArray | private JsonError handleArray(ArrayNode node, OutputStream output) throws IOException {
logger.debug("Handling {} requests", node.size());
JsonError result = JsonError.OK;
output.write('[');
int errorCount = 0;
for (int i = 0; i < node.size(); i++) {
JsonError nodeResult = handleJsonNodeRequest(node.get(i), output);
if (isError(nodeResult)) {
result = JsonError.BULK_ERROR;
errorCount += 1;
}
if (i != node.size() - 1) {
output.write(',');
}
}
output.write(']');
logger.debug("served {} requests, error {}, result {}", node.size(), errorCount, result);
// noinspection unchecked
return result;
} | java | private JsonError handleArray(ArrayNode node, OutputStream output) throws IOException {
logger.debug("Handling {} requests", node.size());
JsonError result = JsonError.OK;
output.write('[');
int errorCount = 0;
for (int i = 0; i < node.size(); i++) {
JsonError nodeResult = handleJsonNodeRequest(node.get(i), output);
if (isError(nodeResult)) {
result = JsonError.BULK_ERROR;
errorCount += 1;
}
if (i != node.size() - 1) {
output.write(',');
}
}
output.write(']');
logger.debug("served {} requests, error {}, result {}", node.size(), errorCount, result);
// noinspection unchecked
return result;
} | [
"private",
"JsonError",
"handleArray",
"(",
"ArrayNode",
"node",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"Handling {} requests\"",
",",
"node",
".",
"size",
"(",
")",
")",
";",
"JsonError",
"result",
"="... | Handles the given {@link ArrayNode} and writes the
responses to the given {@link OutputStream}.
@param node the {@link JsonNode}
@param output the {@link OutputStream}
@return the error code, or {@code 0} if none
@throws IOException on error | [
"Handles",
"the",
"given",
"{",
"@link",
"ArrayNode",
"}",
"and",
"writes",
"the",
"responses",
"to",
"the",
"given",
"{",
"@link",
"OutputStream",
"}",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java#L292-L311 |
wildfly/wildfly-maven-plugin | core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java | DeploymentOperations.addReplaceOperationSteps | static void addReplaceOperationSteps(final CompositeOperationBuilder builder, final Deployment deployment) {
final String name = deployment.getName();
final String runtimeName = deployment.getRuntimeName();
final ModelNode op = createOperation(DEPLOYMENT_FULL_REPLACE_OPERATION);
op.get(NAME).set(name);
if (runtimeName != null) {
op.get(RUNTIME_NAME).set(runtimeName);
}
addContent(builder, op, deployment);
op.get(ENABLED).set(deployment.isEnabled());
builder.addStep(op);
} | java | static void addReplaceOperationSteps(final CompositeOperationBuilder builder, final Deployment deployment) {
final String name = deployment.getName();
final String runtimeName = deployment.getRuntimeName();
final ModelNode op = createOperation(DEPLOYMENT_FULL_REPLACE_OPERATION);
op.get(NAME).set(name);
if (runtimeName != null) {
op.get(RUNTIME_NAME).set(runtimeName);
}
addContent(builder, op, deployment);
op.get(ENABLED).set(deployment.isEnabled());
builder.addStep(op);
} | [
"static",
"void",
"addReplaceOperationSteps",
"(",
"final",
"CompositeOperationBuilder",
"builder",
",",
"final",
"Deployment",
"deployment",
")",
"{",
"final",
"String",
"name",
"=",
"deployment",
".",
"getName",
"(",
")",
";",
"final",
"String",
"runtimeName",
"... | Adds a {@code full-replace-deployment} step for the deployment.
@param builder the builder to add the step to
@param deployment the deployment used to replace the existing deployment | [
"Adds",
"a",
"{",
"@code",
"full",
"-",
"replace",
"-",
"deployment",
"}",
"step",
"for",
"the",
"deployment",
"."
] | train | https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java#L403-L414 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/SavedState.java | SavedState.getNumber | public double getNumber(String nameOfField, double defaultValue) {
Double value = ((Double)numericData.get(nameOfField));
if (value == null) {
return defaultValue;
}
return value.doubleValue();
} | java | public double getNumber(String nameOfField, double defaultValue) {
Double value = ((Double)numericData.get(nameOfField));
if (value == null) {
return defaultValue;
}
return value.doubleValue();
} | [
"public",
"double",
"getNumber",
"(",
"String",
"nameOfField",
",",
"double",
"defaultValue",
")",
"{",
"Double",
"value",
"=",
"(",
"(",
"Double",
")",
"numericData",
".",
"get",
"(",
"nameOfField",
")",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
... | Get number stored at given location
@param nameOfField The name of the number to retrieve
@param defaultValue The value to return if the specified value hasn't been set
@return The number saved at this location | [
"Get",
"number",
"stored",
"at",
"given",
"location"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/SavedState.java#L72-L80 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/MethodUtils.java | MethodUtils.invokeGetter | public static Object invokeGetter(Object object, String getterName)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
return invokeMethod(object, getterName);
} | java | public static Object invokeGetter(Object object, String getterName)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
return invokeMethod(object, getterName);
} | [
"public",
"static",
"Object",
"invokeGetter",
"(",
"Object",
"object",
",",
"String",
"getterName",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"return",
"invokeMethod",
"(",
"object",
",",
"getterName",
... | Gets an Object property from a bean.
@param object the bean
@param getterName the property name or getter method name
@return the property value (as an Object)
@throws NoSuchMethodException the no such method exception
@throws IllegalAccessException the illegal access exception
@throws InvocationTargetException the invocation target exception | [
"Gets",
"an",
"Object",
"property",
"from",
"a",
"bean",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L94-L97 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/appwidget/AppWidgetManagerUtils.java | AppWidgetManagerUtils.getAppWidgetIds | public static int[] getAppWidgetIds(AppWidgetManager appWidgetManager, Context context, Class<?> clazz) {
return appWidgetManager.getAppWidgetIds(new ComponentName(context, clazz));
} | java | public static int[] getAppWidgetIds(AppWidgetManager appWidgetManager, Context context, Class<?> clazz) {
return appWidgetManager.getAppWidgetIds(new ComponentName(context, clazz));
} | [
"public",
"static",
"int",
"[",
"]",
"getAppWidgetIds",
"(",
"AppWidgetManager",
"appWidgetManager",
",",
"Context",
"context",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"return",
"appWidgetManager",
".",
"getAppWidgetIds",
"(",
"new",
"ComponentName",
"("... | Wrapper method of the {@link android.appwidget.AppWidgetManager#getAppWidgetIds(android.content.ComponentName)}.
@see android.appwidget.AppWidgetManager#getAppWidgetIds(android.content.ComponentName). | [
"Wrapper",
"method",
"of",
"the",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/appwidget/AppWidgetManagerUtils.java#L35-L37 |
googleapis/google-http-java-client | google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java | HttpRequestFactory.buildRequest | public HttpRequest buildRequest(String requestMethod, GenericUrl url, HttpContent content)
throws IOException {
HttpRequest request = transport.buildRequest();
if (initializer != null) {
initializer.initialize(request);
}
request.setRequestMethod(requestMethod);
if (url != null) {
request.setUrl(url);
}
if (content != null) {
request.setContent(content);
}
return request;
} | java | public HttpRequest buildRequest(String requestMethod, GenericUrl url, HttpContent content)
throws IOException {
HttpRequest request = transport.buildRequest();
if (initializer != null) {
initializer.initialize(request);
}
request.setRequestMethod(requestMethod);
if (url != null) {
request.setUrl(url);
}
if (content != null) {
request.setContent(content);
}
return request;
} | [
"public",
"HttpRequest",
"buildRequest",
"(",
"String",
"requestMethod",
",",
"GenericUrl",
"url",
",",
"HttpContent",
"content",
")",
"throws",
"IOException",
"{",
"HttpRequest",
"request",
"=",
"transport",
".",
"buildRequest",
"(",
")",
";",
"if",
"(",
"initi... | Builds a request for the given HTTP method, URL, and content.
@param requestMethod HTTP request method
@param url HTTP request URL or {@code null} for none
@param content HTTP request content or {@code null} for none
@return new HTTP request
@since 1.12 | [
"Builds",
"a",
"request",
"for",
"the",
"given",
"HTTP",
"method",
"URL",
"and",
"content",
"."
] | train | https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java#L84-L98 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/CcgParse.java | CcgParse.getLogicalFormForSpan | public SpannedExpression getLogicalFormForSpan(int spanStart, int spanEnd) {
CcgParse spanningParse = getParseForSpan(spanStart, spanEnd);
Expression2 lf = spanningParse.getPreUnaryLogicalForm();
if (lf != null) {
return new SpannedExpression(spanningParse.getHeadedSyntacticCategory(),
spanningParse.getLogicalForm(), spanningParse.getSpanStart(), spanningParse.getSpanEnd());
} else {
return null;
}
} | java | public SpannedExpression getLogicalFormForSpan(int spanStart, int spanEnd) {
CcgParse spanningParse = getParseForSpan(spanStart, spanEnd);
Expression2 lf = spanningParse.getPreUnaryLogicalForm();
if (lf != null) {
return new SpannedExpression(spanningParse.getHeadedSyntacticCategory(),
spanningParse.getLogicalForm(), spanningParse.getSpanStart(), spanningParse.getSpanEnd());
} else {
return null;
}
} | [
"public",
"SpannedExpression",
"getLogicalFormForSpan",
"(",
"int",
"spanStart",
",",
"int",
"spanEnd",
")",
"{",
"CcgParse",
"spanningParse",
"=",
"getParseForSpan",
"(",
"spanStart",
",",
"spanEnd",
")",
";",
"Expression2",
"lf",
"=",
"spanningParse",
".",
"getP... | Returns the logical form for the smallest subtree of the parse which
completely contains the given span.
@param spanStart
@param spanEnd
@return | [
"Returns",
"the",
"logical",
"form",
"for",
"the",
"smallest",
"subtree",
"of",
"the",
"parse",
"which",
"completely",
"contains",
"the",
"given",
"span",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/CcgParse.java#L241-L250 |
zeromq/jeromq | src/main/java/org/zeromq/ZThread.java | ZThread.fork | public static Socket fork(ZContext ctx, IAttachedRunnable runnable, Object... args)
{
Socket pipe = ctx.createSocket(SocketType.PAIR);
if (pipe != null) {
pipe.bind(String.format("inproc://zctx-pipe-%d", pipe.hashCode()));
}
else {
return null;
}
// Connect child pipe to our pipe
ZContext ccontext = ZContext.shadow(ctx);
Socket cpipe = ccontext.createSocket(SocketType.PAIR);
if (cpipe == null) {
return null;
}
cpipe.connect(String.format("inproc://zctx-pipe-%d", pipe.hashCode()));
// Prepare child thread
Thread shim = new ShimThread(ccontext, runnable, args, cpipe);
shim.start();
return pipe;
} | java | public static Socket fork(ZContext ctx, IAttachedRunnable runnable, Object... args)
{
Socket pipe = ctx.createSocket(SocketType.PAIR);
if (pipe != null) {
pipe.bind(String.format("inproc://zctx-pipe-%d", pipe.hashCode()));
}
else {
return null;
}
// Connect child pipe to our pipe
ZContext ccontext = ZContext.shadow(ctx);
Socket cpipe = ccontext.createSocket(SocketType.PAIR);
if (cpipe == null) {
return null;
}
cpipe.connect(String.format("inproc://zctx-pipe-%d", pipe.hashCode()));
// Prepare child thread
Thread shim = new ShimThread(ccontext, runnable, args, cpipe);
shim.start();
return pipe;
} | [
"public",
"static",
"Socket",
"fork",
"(",
"ZContext",
"ctx",
",",
"IAttachedRunnable",
"runnable",
",",
"Object",
"...",
"args",
")",
"{",
"Socket",
"pipe",
"=",
"ctx",
".",
"createSocket",
"(",
"SocketType",
".",
"PAIR",
")",
";",
"if",
"(",
"pipe",
"!... | pipe becomes unreadable. Returns pipe, or null if there was an error. | [
"pipe",
"becomes",
"unreadable",
".",
"Returns",
"pipe",
"or",
"null",
"if",
"there",
"was",
"an",
"error",
"."
] | train | https://github.com/zeromq/jeromq/blob/8b4a2960b468d08b7aebb0d40bfb947e08fed040/src/main/java/org/zeromq/ZThread.java#L87-L111 |
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.updateCompositeEntityRole | public OperationStatus updateCompositeEntityRole(UUID appId, String versionId, UUID cEntityId, UUID roleId, UpdateCompositeEntityRoleOptionalParameter updateCompositeEntityRoleOptionalParameter) {
return updateCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId, updateCompositeEntityRoleOptionalParameter).toBlocking().single().body();
} | java | public OperationStatus updateCompositeEntityRole(UUID appId, String versionId, UUID cEntityId, UUID roleId, UpdateCompositeEntityRoleOptionalParameter updateCompositeEntityRoleOptionalParameter) {
return updateCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, roleId, updateCompositeEntityRoleOptionalParameter).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateCompositeEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"cEntityId",
",",
"UUID",
"roleId",
",",
"UpdateCompositeEntityRoleOptionalParameter",
"updateCompositeEntityRoleOptionalParameter",
")",
"{",
"return",
... | Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param cEntityId The composite entity extractor ID.
@param roleId The entity role ID.
@param updateCompositeEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@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. | [
"Update",
"an",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | 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#L12454-L12456 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/ComputePoliciesInner.java | ComputePoliciesInner.updateAsync | public Observable<ComputePolicyInner> updateAsync(String resourceGroupName, String accountName, String computePolicyName, UpdateComputePolicyParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, computePolicyName, parameters).map(new Func1<ServiceResponse<ComputePolicyInner>, ComputePolicyInner>() {
@Override
public ComputePolicyInner call(ServiceResponse<ComputePolicyInner> response) {
return response.body();
}
});
} | java | public Observable<ComputePolicyInner> updateAsync(String resourceGroupName, String accountName, String computePolicyName, UpdateComputePolicyParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, computePolicyName, parameters).map(new Func1<ServiceResponse<ComputePolicyInner>, ComputePolicyInner>() {
@Override
public ComputePolicyInner call(ServiceResponse<ComputePolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ComputePolicyInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"computePolicyName",
",",
"UpdateComputePolicyParameters",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsy... | Updates the specified compute policy.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@param computePolicyName The name of the compute policy to update.
@param parameters Parameters supplied to update the compute policy.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ComputePolicyInner object | [
"Updates",
"the",
"specified",
"compute",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/ComputePoliciesInner.java#L538-L545 |
openbase/jul | pattern/launch/src/main/java/org/openbase/jul/pattern/launch/AbstractLauncher.java | AbstractLauncher.instantiateLaunchable | protected L instantiateLaunchable() throws CouldNotPerformException {
try {
return launchableClass.newInstance();
} catch (java.lang.InstantiationException | IllegalAccessException ex) {
throw new CouldNotPerformException("Could not load launchable class!", ex);
}
} | java | protected L instantiateLaunchable() throws CouldNotPerformException {
try {
return launchableClass.newInstance();
} catch (java.lang.InstantiationException | IllegalAccessException ex) {
throw new CouldNotPerformException("Could not load launchable class!", ex);
}
} | [
"protected",
"L",
"instantiateLaunchable",
"(",
")",
"throws",
"CouldNotPerformException",
"{",
"try",
"{",
"return",
"launchableClass",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"java",
".",
"lang",
".",
"InstantiationException",
"|",
"IllegalAccessEx... | Method creates a launchable instance without any arguments.. In case the launchable needs arguments you can overwrite this method and instantiate the launchable by ourself.
@return the new instantiated launchable.
@throws CouldNotPerformException is thrown in case the launchable could not properly be instantiated. | [
"Method",
"creates",
"a",
"launchable",
"instance",
"without",
"any",
"arguments",
"..",
"In",
"case",
"the",
"launchable",
"needs",
"arguments",
"you",
"can",
"overwrite",
"this",
"method",
"and",
"instantiate",
"the",
"launchable",
"by",
"ourself",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/pattern/launch/src/main/java/org/openbase/jul/pattern/launch/AbstractLauncher.java#L148-L154 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/serializer/ParameterSerializer.java | ParameterSerializer.parseTwoDimensionsArray | protected Object parseTwoDimensionsArray(GetterMethodCover method,
Object array) {
ISFSArray answer = new SFSArray();
int size = Array.getLength(array);
for(int i = 0 ; i < size ; i++) {
SFSDataType dtype = getSFSArrayDataType(method);
Object value = parseArrayOfTwoDimensionsArray(method, Array.get(array, i));
answer.add(new SFSDataWrapper(dtype, value));
}
return answer;
} | java | protected Object parseTwoDimensionsArray(GetterMethodCover method,
Object array) {
ISFSArray answer = new SFSArray();
int size = Array.getLength(array);
for(int i = 0 ; i < size ; i++) {
SFSDataType dtype = getSFSArrayDataType(method);
Object value = parseArrayOfTwoDimensionsArray(method, Array.get(array, i));
answer.add(new SFSDataWrapper(dtype, value));
}
return answer;
} | [
"protected",
"Object",
"parseTwoDimensionsArray",
"(",
"GetterMethodCover",
"method",
",",
"Object",
"array",
")",
"{",
"ISFSArray",
"answer",
"=",
"new",
"SFSArray",
"(",
")",
";",
"int",
"size",
"=",
"Array",
".",
"getLength",
"(",
"array",
")",
";",
"for"... | Serialize two-dimensions array to ISFSArray
@param method method's structure
@param array the two-dimensions array
@return ISFSArray object | [
"Serialize",
"two",
"-",
"dimensions",
"array",
"to",
"ISFSArray"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serializer/ParameterSerializer.java#L123-L133 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/GaliosFieldTableOps.java | GaliosFieldTableOps.polyEval | public int polyEval(GrowQueue_I8 input , int x ) {
int y = input.data[0]&0xFF;
for (int i = 1; i < input.size; i++) {
y = multiply(y,x) ^ (input.data[i]&0xFF);
}
return y;
} | java | public int polyEval(GrowQueue_I8 input , int x ) {
int y = input.data[0]&0xFF;
for (int i = 1; i < input.size; i++) {
y = multiply(y,x) ^ (input.data[i]&0xFF);
}
return y;
} | [
"public",
"int",
"polyEval",
"(",
"GrowQueue_I8",
"input",
",",
"int",
"x",
")",
"{",
"int",
"y",
"=",
"input",
".",
"data",
"[",
"0",
"]",
"&",
"0xFF",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"input",
".",
"size",
";",
"i",
"++... | Evaluate the polynomial using Horner's method. Avoids explicit calculating the powers of x.
<p>01x**4 + 0fx**3 + 36x**2 + 78x + 40 = (((01 x + 0f) x + 36) x + 78) x + 40</p>
<p>Coefficients for largest powers are first, e.g. 2*x**3 + 8*x**2+1 = [2,8,0,1]</p>
@param input Polynomial being evaluated
@param x Value of x
@return Output of function | [
"Evaluate",
"the",
"polynomial",
"using",
"Horner",
"s",
"method",
".",
"Avoids",
"explicit",
"calculating",
"the",
"powers",
"of",
"x",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/GaliosFieldTableOps.java#L295-L303 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/RepositoryApi.java | RepositoryApi.getRepositoryArchive | public InputStream getRepositoryArchive(Object projectIdOrPath, String sha, ArchiveFormat format) throws GitLabApiException {
if (format == null) {
format = ArchiveFormat.TAR_GZ;
}
/*
* Gitlab-ce has a bug when you try to download file archives with format by using "&format=zip(or tar... etc.)",
* there is a solution to request .../archive.:format instead of .../archive?format=:format.
*
* Issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/45992
* https://gitlab.com/gitlab-com/support-forum/issues/3067
*/
Form formData = new GitLabApiForm().withParam("sha", sha);
Response response = getWithAccepts(Response.Status.OK, formData.asMap(), MediaType.MEDIA_TYPE_WILDCARD,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "archive" + "." + format.toString());
return (response.readEntity(InputStream.class));
} | java | public InputStream getRepositoryArchive(Object projectIdOrPath, String sha, ArchiveFormat format) throws GitLabApiException {
if (format == null) {
format = ArchiveFormat.TAR_GZ;
}
/*
* Gitlab-ce has a bug when you try to download file archives with format by using "&format=zip(or tar... etc.)",
* there is a solution to request .../archive.:format instead of .../archive?format=:format.
*
* Issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/45992
* https://gitlab.com/gitlab-com/support-forum/issues/3067
*/
Form formData = new GitLabApiForm().withParam("sha", sha);
Response response = getWithAccepts(Response.Status.OK, formData.asMap(), MediaType.MEDIA_TYPE_WILDCARD,
"projects", getProjectIdOrPath(projectIdOrPath), "repository", "archive" + "." + format.toString());
return (response.readEntity(InputStream.class));
} | [
"public",
"InputStream",
"getRepositoryArchive",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"sha",
",",
"ArchiveFormat",
"format",
")",
"throws",
"GitLabApiException",
"{",
"if",
"(",
"format",
"==",
"null",
")",
"{",
"format",
"=",
"ArchiveFormat",
".",
"... | Get an archive of the complete repository by SHA (optional).
<pre><code>GitLab Endpoint: GET /projects/:id/repository/archive</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param sha the SHA of the archive to get
@param format The archive format, defaults to TAR_GZ if null
@return an input stream that can be used to save as a file or to read the content of the archive
@throws GitLabApiException if any exception occurs | [
"Get",
"an",
"archive",
"of",
"the",
"complete",
"repository",
"by",
"SHA",
"(",
"optional",
")",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryApi.java#L553-L570 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.expectPrivate | public static synchronized <T> IExpectationSetters<T> expectPrivate(Object instance, String methodName,
Object... arguments) throws Exception {
if (instance == null) {
throw new IllegalArgumentException("Instance or class cannot be null.");
}
return expectPrivate(instance, methodName, Whitebox.getType(instance), arguments);
} | java | public static synchronized <T> IExpectationSetters<T> expectPrivate(Object instance, String methodName,
Object... arguments) throws Exception {
if (instance == null) {
throw new IllegalArgumentException("Instance or class cannot be null.");
}
return expectPrivate(instance, methodName, Whitebox.getType(instance), arguments);
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"IExpectationSetters",
"<",
"T",
">",
"expectPrivate",
"(",
"Object",
"instance",
",",
"String",
"methodName",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"if",
"(",
"instance",
"==",
... | Used to specify expectations on methods using the method name. Works on
for example private or package private methods. | [
"Used",
"to",
"specify",
"expectations",
"on",
"methods",
"using",
"the",
"method",
"name",
".",
"Works",
"on",
"for",
"example",
"private",
"or",
"package",
"private",
"methods",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L1184-L1191 |
cchantep/acolyte | jdbc-driver/src/main/java/acolyte/jdbc/ParameterMetaData.java | ParameterMetaData.Float | public static ParameterDef Float(final float f) {
final BigDecimal bd = new BigDecimal(Float.toString(f));
return Scaled(Types.FLOAT, bd.scale());
} | java | public static ParameterDef Float(final float f) {
final BigDecimal bd = new BigDecimal(Float.toString(f));
return Scaled(Types.FLOAT, bd.scale());
} | [
"public",
"static",
"ParameterDef",
"Float",
"(",
"final",
"float",
"f",
")",
"{",
"final",
"BigDecimal",
"bd",
"=",
"new",
"BigDecimal",
"(",
"Float",
".",
"toString",
"(",
"f",
")",
")",
";",
"return",
"Scaled",
"(",
"Types",
".",
"FLOAT",
",",
"bd",... | Float constructor.
@param f the float value for the parameter
@return Parameter definition for given float value | [
"Float",
"constructor",
"."
] | train | https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/jdbc-driver/src/main/java/acolyte/jdbc/ParameterMetaData.java#L266-L270 |
czyzby/gdx-lml | lml/src/main/java/com/github/czyzby/lml/parser/impl/tag/Dtd.java | Dtd.saveMinifiedSchema | public static void saveMinifiedSchema(final LmlParser parser, final Appendable appendable) {
try {
new Dtd().setAppendComments(false).getDtdSchema(parser, appendable);
} catch (final IOException exception) {
throw new GdxRuntimeException("Unable to append to file.", exception);
}
} | java | public static void saveMinifiedSchema(final LmlParser parser, final Appendable appendable) {
try {
new Dtd().setAppendComments(false).getDtdSchema(parser, appendable);
} catch (final IOException exception) {
throw new GdxRuntimeException("Unable to append to file.", exception);
}
} | [
"public",
"static",
"void",
"saveMinifiedSchema",
"(",
"final",
"LmlParser",
"parser",
",",
"final",
"Appendable",
"appendable",
")",
"{",
"try",
"{",
"new",
"Dtd",
"(",
")",
".",
"setAppendComments",
"(",
"false",
")",
".",
"getDtdSchema",
"(",
"parser",
",... | Saves DTD schema file containing all possible tags and their attributes. Any problems with the generation will
be logged. This is a relatively heavy operation and should be done only during development. Comments will not be
appended, which will reduce the size of DTD file.
@param parser contains parsing data. Used to create mock-up actors. The skin MUST be fully loaded and contain all
used actors' styles for the generator to work properly.
@param appendable a reference to the file.
@see #getDtdSchema(LmlParser, Appendable)
@see #saveSchema(LmlParser, Appendable) | [
"Saves",
"DTD",
"schema",
"file",
"containing",
"all",
"possible",
"tags",
"and",
"their",
"attributes",
".",
"Any",
"problems",
"with",
"the",
"generation",
"will",
"be",
"logged",
".",
"This",
"is",
"a",
"relatively",
"heavy",
"operation",
"and",
"should",
... | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml/src/main/java/com/github/czyzby/lml/parser/impl/tag/Dtd.java#L71-L77 |
google/closure-compiler | src/com/google/javascript/jscomp/regex/RegExpTree.java | RegExpTree.matchesWholeInput | public static boolean matchesWholeInput(RegExpTree t, String flags) {
if (flags.indexOf('m') >= 0) { return false; }
if (!(t instanceof Concatenation)) {
return false;
}
Concatenation c = (Concatenation) t;
if (c.elements.isEmpty()) { return false; }
RegExpTree first = c.elements.get(0), last = Iterables.getLast(c.elements);
if (!(first instanceof Anchor && last instanceof Anchor)) { return false; }
return ((Anchor) first).type == '^' && ((Anchor) last).type == '$';
} | java | public static boolean matchesWholeInput(RegExpTree t, String flags) {
if (flags.indexOf('m') >= 0) { return false; }
if (!(t instanceof Concatenation)) {
return false;
}
Concatenation c = (Concatenation) t;
if (c.elements.isEmpty()) { return false; }
RegExpTree first = c.elements.get(0), last = Iterables.getLast(c.elements);
if (!(first instanceof Anchor && last instanceof Anchor)) { return false; }
return ((Anchor) first).type == '^' && ((Anchor) last).type == '$';
} | [
"public",
"static",
"boolean",
"matchesWholeInput",
"(",
"RegExpTree",
"t",
",",
"String",
"flags",
")",
"{",
"if",
"(",
"flags",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"(",
"t",
"insta... | True if, but not necessarily always when the, given regular expression
must match the whole input or none of it. | [
"True",
"if",
"but",
"not",
"necessarily",
"always",
"when",
"the",
"given",
"regular",
"expression",
"must",
"match",
"the",
"whole",
"input",
"or",
"none",
"of",
"it",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/regex/RegExpTree.java#L759-L771 |
tomgibara/bits | src/main/java/com/tomgibara/bits/Bits.java | Bits.asStore | public static BitStore asStore(boolean[] bits) {
if (bits == null) throw new IllegalArgumentException("null bits");
return new BooleansBitStore(bits, 0, bits.length, true);
} | java | public static BitStore asStore(boolean[] bits) {
if (bits == null) throw new IllegalArgumentException("null bits");
return new BooleansBitStore(bits, 0, bits.length, true);
} | [
"public",
"static",
"BitStore",
"asStore",
"(",
"boolean",
"[",
"]",
"bits",
")",
"{",
"if",
"(",
"bits",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"null bits\"",
")",
";",
"return",
"new",
"BooleansBitStore",
"(",
"bits",
",",
... | Exposes an array of booleans as a {@link BitStore}. The returned bit
store is a live view over the booleans; changes made to the array are
reflected in bit store and vice versa. The size of the returned bit
vector equals the length of the array with the bits of the
{@link BitStore} indexed as per the underlying array.
@param bits
the bit values
@return a {@link BitStore} over the boolean array | [
"Exposes",
"an",
"array",
"of",
"booleans",
"as",
"a",
"{",
"@link",
"BitStore",
"}",
".",
"The",
"returned",
"bit",
"store",
"is",
"a",
"live",
"view",
"over",
"the",
"booleans",
";",
"changes",
"made",
"to",
"the",
"array",
"are",
"reflected",
"in",
... | train | https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L558-L561 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/microdom/convert/MicroTypeConverterRegistry.java | MicroTypeConverterRegistry.iterateAllRegisteredMicroTypeConverters | public void iterateAllRegisteredMicroTypeConverters (@Nonnull final IMicroTypeConverterCallback aCallback)
{
// Create a static copy of the map (HashMap not weak!)
final ICommonsMap <Class <?>, IMicroTypeConverter <?>> aCopy = m_aRWLock.readLocked (m_aMap::getClone);
// And iterate the copy
for (final Map.Entry <Class <?>, IMicroTypeConverter <?>> aEntry : aCopy.entrySet ())
if (aCallback.call (aEntry.getKey (), aEntry.getValue ()).isBreak ())
break;
} | java | public void iterateAllRegisteredMicroTypeConverters (@Nonnull final IMicroTypeConverterCallback aCallback)
{
// Create a static copy of the map (HashMap not weak!)
final ICommonsMap <Class <?>, IMicroTypeConverter <?>> aCopy = m_aRWLock.readLocked (m_aMap::getClone);
// And iterate the copy
for (final Map.Entry <Class <?>, IMicroTypeConverter <?>> aEntry : aCopy.entrySet ())
if (aCallback.call (aEntry.getKey (), aEntry.getValue ()).isBreak ())
break;
} | [
"public",
"void",
"iterateAllRegisteredMicroTypeConverters",
"(",
"@",
"Nonnull",
"final",
"IMicroTypeConverterCallback",
"aCallback",
")",
"{",
"// Create a static copy of the map (HashMap not weak!)",
"final",
"ICommonsMap",
"<",
"Class",
"<",
"?",
">",
",",
"IMicroTypeConv... | Iterate all registered micro type converters. For informational purposes
only.
@param aCallback
The callback invoked for all iterations. | [
"Iterate",
"all",
"registered",
"micro",
"type",
"converters",
".",
"For",
"informational",
"purposes",
"only",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/convert/MicroTypeConverterRegistry.java#L210-L219 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.toSorted | public static <T> List<T> toSorted(Iterable<T> self, @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure closure) {
Comparator<T> comparator = (closure.getMaximumNumberOfParameters() == 1) ? new OrderBy<T>(closure) : new ClosureComparator<T>(closure);
return toSorted(self, comparator);
} | java | public static <T> List<T> toSorted(Iterable<T> self, @ClosureParams(value=FromString.class, options={"T","T,T"}) Closure closure) {
Comparator<T> comparator = (closure.getMaximumNumberOfParameters() == 1) ? new OrderBy<T>(closure) : new ClosureComparator<T>(closure);
return toSorted(self, comparator);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"toSorted",
"(",
"Iterable",
"<",
"T",
">",
"self",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"T\"",
",",
"\"T,T\"",
"}",
")",
"Cl... | Sorts this Iterable using the given Closure to determine the correct ordering. The elements are first placed
into a new list which is then sorted and returned - leaving the original Iterable unchanged.
<p>
If the Closure has two parameters
it is used like a traditional Comparator. I.e. it should compare
its two parameters for order, returning a negative integer,
zero, or a positive integer when the first parameter is less than,
equal to, or greater than the second respectively. Otherwise,
the Closure is assumed to take a single parameter and return a
Comparable (typically an Integer) which is then used for
further comparison.
<pre class="groovyTestCase">assert ["hi","hey","hello"] == ["hello","hi","hey"].sort { it.length() }</pre>
<pre class="groovyTestCase">assert ["hi","hey","hello"] == ["hello","hi","hey"].sort { a, b {@code ->} a.length() {@code <=>} b.length() }</pre>
@param self the Iterable to be sorted
@param closure a 1 or 2 arg Closure used to determine the correct ordering
@return a newly created sorted List
@see #toSorted(Iterable, Comparator)
@since 2.4.0 | [
"Sorts",
"this",
"Iterable",
"using",
"the",
"given",
"Closure",
"to",
"determine",
"the",
"correct",
"ordering",
".",
"The",
"elements",
"are",
"first",
"placed",
"into",
"a",
"new",
"list",
"which",
"is",
"then",
"sorted",
"and",
"returned",
"-",
"leaving"... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L9438-L9441 |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/tools/CommonUtils.java | CommonUtils.modifyBean | public static <T> T modifyBean(Map<String, ?> property, T bean) {
try {
BeanUtils.populate(bean, property);
return bean;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static <T> T modifyBean(Map<String, ?> property, T bean) {
try {
BeanUtils.populate(bean, property);
return bean;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"modifyBean",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"property",
",",
"T",
"bean",
")",
"{",
"try",
"{",
"BeanUtils",
".",
"populate",
"(",
"bean",
",",
"property",
")",
";",
"return",
"bean",
";",
"}",
... | 将Bean的属性值修改为Map中对应的值
@param property 一个Map对象,封装了相应的Bean类中的属性
@param bean 需要修改的Bean类
@return 返回一个属性已修改的Bean类实例 | [
"将Bean的属性值修改为Map中对应的值"
] | train | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/CommonUtils.java#L72-L79 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_task_mailinglist_GET | public ArrayList<Long> domain_task_mailinglist_GET(String domain, String account) throws IOException {
String qPath = "/email/domain/{domain}/task/mailinglist";
StringBuilder sb = path(qPath, domain);
query(sb, "account", account);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | java | public ArrayList<Long> domain_task_mailinglist_GET(String domain, String account) throws IOException {
String qPath = "/email/domain/{domain}/task/mailinglist";
StringBuilder sb = path(qPath, domain);
query(sb, "account", account);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"domain_task_mailinglist_GET",
"(",
"String",
"domain",
",",
"String",
"account",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/task/mailinglist\"",
";",
"StringBuilder",
"sb",
"=",
"path"... | Get Mailing List tasks
REST: GET /email/domain/{domain}/task/mailinglist
@param account [required] Account name
@param domain [required] Name of your domain name | [
"Get",
"Mailing",
"List",
"tasks"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1114-L1120 |
matthewhorridge/mdock | src/main/java/org/coode/mdock/SplitterNode.java | SplitterNode.replaceChild | public void replaceChild(Node current, Node with) {
double currentSplit = nodeSplits.get(current);
int index = children.indexOf(current);
children.remove(current);
addChild(with, index, currentSplit);
notifyStateChange();
} | java | public void replaceChild(Node current, Node with) {
double currentSplit = nodeSplits.get(current);
int index = children.indexOf(current);
children.remove(current);
addChild(with, index, currentSplit);
notifyStateChange();
} | [
"public",
"void",
"replaceChild",
"(",
"Node",
"current",
",",
"Node",
"with",
")",
"{",
"double",
"currentSplit",
"=",
"nodeSplits",
".",
"get",
"(",
"current",
")",
";",
"int",
"index",
"=",
"children",
".",
"indexOf",
"(",
"current",
")",
";",
"childr... | Replaces a child node with another node
@param current The child node which should be replaced
@param with The node that the child node should be replaced with | [
"Replaces",
"a",
"child",
"node",
"with",
"another",
"node"
] | train | https://github.com/matthewhorridge/mdock/blob/37839a56f30bdb73d56d82c4d1afe548d66b404b/src/main/java/org/coode/mdock/SplitterNode.java#L318-L324 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/animation/transformation/ParallelTransformation.java | ParallelTransformation.addTransformations | public ParallelTransformation addTransformations(Transformation<?, ?>... transformations)
{
for (Transformation<?, ?> transformation : transformations)
{
duration = Math.max(duration, transformation.totalDuration());
listTransformations.add(transformation);
}
return this;
} | java | public ParallelTransformation addTransformations(Transformation<?, ?>... transformations)
{
for (Transformation<?, ?> transformation : transformations)
{
duration = Math.max(duration, transformation.totalDuration());
listTransformations.add(transformation);
}
return this;
} | [
"public",
"ParallelTransformation",
"addTransformations",
"(",
"Transformation",
"<",
"?",
",",
"?",
">",
"...",
"transformations",
")",
"{",
"for",
"(",
"Transformation",
"<",
"?",
",",
"?",
">",
"transformation",
":",
"transformations",
")",
"{",
"duration",
... | Adds the {@link Transformation} this to {@link ParallelTransformation}
@param transformations the transformations
@return the parallel transformation | [
"Adds",
"the",
"{",
"@link",
"Transformation",
"}",
"this",
"to",
"{",
"@link",
"ParallelTransformation",
"}"
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/ParallelTransformation.java#L65-L74 |
chanjarster/weixin-java-tools | weixin-java-common/src/main/java/me/chanjar/weixin/common/util/fs/FileUtils.java | FileUtils.createTmpFile | public static File createTmpFile(InputStream inputStream, String name, String ext) throws IOException {
return createTmpFile(inputStream, name, ext, null);
} | java | public static File createTmpFile(InputStream inputStream, String name, String ext) throws IOException {
return createTmpFile(inputStream, name, ext, null);
} | [
"public",
"static",
"File",
"createTmpFile",
"(",
"InputStream",
"inputStream",
",",
"String",
"name",
",",
"String",
"ext",
")",
"throws",
"IOException",
"{",
"return",
"createTmpFile",
"(",
"inputStream",
",",
"name",
",",
"ext",
",",
"null",
")",
";",
"}"... | 创建临时文件
@param inputStream
@param name 文件名
@param ext 扩展名
@return
@throws IOException | [
"创建临时文件"
] | train | https://github.com/chanjarster/weixin-java-tools/blob/2a0b1c30c0f60c2de466cb8933c945bc0d391edf/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/fs/FileUtils.java#L62-L64 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ScriptBytecodeAdapter.java | ScriptBytecodeAdapter.getMethodPointer | public static Closure getMethodPointer(Object object, String methodName) {
return InvokerHelper.getMethodPointer(object, methodName);
} | java | public static Closure getMethodPointer(Object object, String methodName) {
return InvokerHelper.getMethodPointer(object, methodName);
} | [
"public",
"static",
"Closure",
"getMethodPointer",
"(",
"Object",
"object",
",",
"String",
"methodName",
")",
"{",
"return",
"InvokerHelper",
".",
"getMethodPointer",
"(",
"object",
",",
"methodName",
")",
";",
"}"
] | Returns the method pointer for the given object name
@param object the object containing the method
@param methodName the name of the method of interest
@return the resulting Closure | [
"Returns",
"the",
"method",
"pointer",
"for",
"the",
"given",
"object",
"name"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ScriptBytecodeAdapter.java#L580-L582 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java | XpathUtils.asByte | public static Byte asByte(String expression, Node node)
throws XPathExpressionException {
return asByte(expression, node, xpath());
} | java | public static Byte asByte(String expression, Node node)
throws XPathExpressionException {
return asByte(expression, node, xpath());
} | [
"public",
"static",
"Byte",
"asByte",
"(",
"String",
"expression",
",",
"Node",
"node",
")",
"throws",
"XPathExpressionException",
"{",
"return",
"asByte",
"(",
"expression",
",",
"node",
",",
"xpath",
"(",
")",
")",
";",
"}"
] | Evaluates the specified XPath expression and returns the result as a
Byte.
<p>
This method can be expensive as a new xpath is instantiated per
invocation. Consider passing in the xpath explicitly via {
{@link #asDouble(String, Node, XPath)} instead. Note {@link XPath} is
not thread-safe and not reentrant.
@param expression
The XPath expression to evaluate.
@param node
The node to run the expression on.
@return The Byte result.
@throws XPathExpressionException
If there was a problem processing the specified XPath
expression. | [
"Evaluates",
"the",
"specified",
"XPath",
"expression",
"and",
"returns",
"the",
"result",
"as",
"a",
"Byte",
".",
"<p",
">",
"This",
"method",
"can",
"be",
"expensive",
"as",
"a",
"new",
"xpath",
"is",
"instantiated",
"per",
"invocation",
".",
"Consider",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L417-L420 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/xml/AnnotationReader.java | AnnotationReader.hasAnnotation | public <A extends Annotation> boolean hasAnnotation(final Field field, final Class<A> annClass) {
return getAnnotation(field, annClass) != null;
} | java | public <A extends Annotation> boolean hasAnnotation(final Field field, final Class<A> annClass) {
return getAnnotation(field, annClass) != null;
} | [
"public",
"<",
"A",
"extends",
"Annotation",
">",
"boolean",
"hasAnnotation",
"(",
"final",
"Field",
"field",
",",
"final",
"Class",
"<",
"A",
">",
"annClass",
")",
"{",
"return",
"getAnnotation",
"(",
"field",
",",
"annClass",
")",
"!=",
"null",
";",
"}... | フィールドに付与されたアノテーションを持つか判定します。
@since 2.0
@param field 判定対象のフィールド
@param annClass アノテーションのタイプ
@return trueの場合、アノテーションを持ちます。 | [
"フィールドに付与されたアノテーションを持つか判定します。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/AnnotationReader.java#L225-L227 |
DDTH/ddth-kafka | src/main/java/com/github/ddth/kafka/internal/KafkaHelper.java | KafkaHelper.seekToBeginning | public static boolean seekToBeginning(KafkaConsumer<?, ?> consumer, String topic) {
boolean result = false;
synchronized (consumer) {
Set<TopicPartition> topicParts = consumer.assignment();
if (topicParts != null) {
for (TopicPartition tp : topicParts) {
if (StringUtils.equals(topic, tp.topic())) {
consumer.seekToBeginning(Arrays.asList(tp));
// we want to seek as soon as possible
// since seekToEnd evaluates lazily, invoke position()
// so
// that seeking will be committed.
consumer.position(tp);
result = true;
}
}
if (result) {
consumer.commitSync();
}
}
}
return result;
} | java | public static boolean seekToBeginning(KafkaConsumer<?, ?> consumer, String topic) {
boolean result = false;
synchronized (consumer) {
Set<TopicPartition> topicParts = consumer.assignment();
if (topicParts != null) {
for (TopicPartition tp : topicParts) {
if (StringUtils.equals(topic, tp.topic())) {
consumer.seekToBeginning(Arrays.asList(tp));
// we want to seek as soon as possible
// since seekToEnd evaluates lazily, invoke position()
// so
// that seeking will be committed.
consumer.position(tp);
result = true;
}
}
if (result) {
consumer.commitSync();
}
}
}
return result;
} | [
"public",
"static",
"boolean",
"seekToBeginning",
"(",
"KafkaConsumer",
"<",
"?",
",",
"?",
">",
"consumer",
",",
"String",
"topic",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"synchronized",
"(",
"consumer",
")",
"{",
"Set",
"<",
"TopicPartition",
... | Seeks the consumer's cursor to the beginning of a topic.
<p>
This method only set cursors of topic's partitions that are assigned to
the consumer!
</p>
@param consumer
@param topic
@return {@code true} if the consumer has subscribed to the specified
topic, {@code false} otherwise. | [
"Seeks",
"the",
"consumer",
"s",
"cursor",
"to",
"the",
"beginning",
"of",
"a",
"topic",
"."
] | train | https://github.com/DDTH/ddth-kafka/blob/aaeb8536e28a109ac0b69022f0ea4bbf5696b76f/src/main/java/com/github/ddth/kafka/internal/KafkaHelper.java#L72-L94 |
lucee/Lucee | core/src/main/java/lucee/commons/lang/ClassUtil.java | ClassUtil.loadClass | public static Class loadClass(String className, Class defaultValue) {
// OSGI env
Class clazz = _loadClass(new OSGiBasedClassLoading(), className, null, null);
if (clazz != null) return clazz;
// core classloader
clazz = _loadClass(new ClassLoaderBasedClassLoading(SystemUtil.getCoreClassLoader()), className, null, null);
if (clazz != null) return clazz;
// loader classloader
clazz = _loadClass(new ClassLoaderBasedClassLoading(SystemUtil.getLoaderClassLoader()), className, null, null);
if (clazz != null) return clazz;
return defaultValue;
} | java | public static Class loadClass(String className, Class defaultValue) {
// OSGI env
Class clazz = _loadClass(new OSGiBasedClassLoading(), className, null, null);
if (clazz != null) return clazz;
// core classloader
clazz = _loadClass(new ClassLoaderBasedClassLoading(SystemUtil.getCoreClassLoader()), className, null, null);
if (clazz != null) return clazz;
// loader classloader
clazz = _loadClass(new ClassLoaderBasedClassLoading(SystemUtil.getLoaderClassLoader()), className, null, null);
if (clazz != null) return clazz;
return defaultValue;
} | [
"public",
"static",
"Class",
"loadClass",
"(",
"String",
"className",
",",
"Class",
"defaultValue",
")",
"{",
"// OSGI env",
"Class",
"clazz",
"=",
"_loadClass",
"(",
"new",
"OSGiBasedClassLoading",
"(",
")",
",",
"className",
",",
"null",
",",
"null",
")",
... | loads a class from a String classname
@param className
@param defaultValue
@return matching Class | [
"loads",
"a",
"class",
"from",
"a",
"String",
"classname"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L167-L181 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/index/idistance/InMemoryIDistanceIndex.java | InMemoryIDistanceIndex.binarySearch | protected static void binarySearch(ModifiableDoubleDBIDList index, DoubleDBIDListIter iter, double val) {
// Binary search. TODO: move this into the DoubleDBIDList class.
int left = 0, right = index.size();
while(left < right) {
final int mid = (left + right) >>> 1;
final double curd = iter.seek(mid).doubleValue();
if(val < curd) {
right = mid;
}
else if(val > curd) {
left = mid + 1;
}
else {
left = mid;
break;
}
}
if(left >= index.size()) {
--left;
}
iter.seek(left);
} | java | protected static void binarySearch(ModifiableDoubleDBIDList index, DoubleDBIDListIter iter, double val) {
// Binary search. TODO: move this into the DoubleDBIDList class.
int left = 0, right = index.size();
while(left < right) {
final int mid = (left + right) >>> 1;
final double curd = iter.seek(mid).doubleValue();
if(val < curd) {
right = mid;
}
else if(val > curd) {
left = mid + 1;
}
else {
left = mid;
break;
}
}
if(left >= index.size()) {
--left;
}
iter.seek(left);
} | [
"protected",
"static",
"void",
"binarySearch",
"(",
"ModifiableDoubleDBIDList",
"index",
",",
"DoubleDBIDListIter",
"iter",
",",
"double",
"val",
")",
"{",
"// Binary search. TODO: move this into the DoubleDBIDList class.",
"int",
"left",
"=",
"0",
",",
"right",
"=",
"i... | Seek an iterator to the desired position, using binary search.
@param index Index to search
@param iter Iterator
@param val Distance to search to | [
"Seek",
"an",
"iterator",
"to",
"the",
"desired",
"position",
"using",
"binary",
"search",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/index/idistance/InMemoryIDistanceIndex.java#L277-L298 |
gocd/gocd | base/src/main/java/com/thoughtworks/go/util/SelectorUtils.java | SelectorUtils.tokenizePath | public static Vector tokenizePath (String path, String separator) {
Vector ret = new Vector();
if (FileUtil.isAbsolutePath(path)) {
String[] s = FileUtil.dissect(path);
ret.add(s[0]);
path = s[1];
}
StringTokenizer st = new StringTokenizer(path, separator);
while (st.hasMoreTokens()) {
ret.addElement(st.nextToken());
}
return ret;
} | java | public static Vector tokenizePath (String path, String separator) {
Vector ret = new Vector();
if (FileUtil.isAbsolutePath(path)) {
String[] s = FileUtil.dissect(path);
ret.add(s[0]);
path = s[1];
}
StringTokenizer st = new StringTokenizer(path, separator);
while (st.hasMoreTokens()) {
ret.addElement(st.nextToken());
}
return ret;
} | [
"public",
"static",
"Vector",
"tokenizePath",
"(",
"String",
"path",
",",
"String",
"separator",
")",
"{",
"Vector",
"ret",
"=",
"new",
"Vector",
"(",
")",
";",
"if",
"(",
"FileUtil",
".",
"isAbsolutePath",
"(",
"path",
")",
")",
"{",
"String",
"[",
"]... | Breaks a path up into a Vector of path elements, tokenizing on
@param path Path to tokenize. Must not be <code>null</code>.
@param separator the separator against which to tokenize.
@return a Vector of path elements from the tokenized path
@since Ant 1.6 | [
"Breaks",
"a",
"path",
"up",
"into",
"a",
"Vector",
"of",
"path",
"elements",
"tokenizing",
"on"
] | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/SelectorUtils.java#L487-L499 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.dateFormat | public static String dateFormat(long ts, String format, TimeZone tz) {
SimpleDateFormat formatter = FORMATTER_CACHE.get(format);
formatter.setTimeZone(tz);
Date dateTime = new Date(ts);
return formatter.format(dateTime);
} | java | public static String dateFormat(long ts, String format, TimeZone tz) {
SimpleDateFormat formatter = FORMATTER_CACHE.get(format);
formatter.setTimeZone(tz);
Date dateTime = new Date(ts);
return formatter.format(dateTime);
} | [
"public",
"static",
"String",
"dateFormat",
"(",
"long",
"ts",
",",
"String",
"format",
",",
"TimeZone",
"tz",
")",
"{",
"SimpleDateFormat",
"formatter",
"=",
"FORMATTER_CACHE",
".",
"get",
"(",
"format",
")",
";",
"formatter",
".",
"setTimeZone",
"(",
"tz",... | Format a timestamp as specific.
@param ts the timestamp to format.
@param format the string formatter.
@param tz the time zone | [
"Format",
"a",
"timestamp",
"as",
"specific",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L326-L331 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/Marshaller.java | Marshaller.marshalWithExplodedStrategy | private void marshalWithExplodedStrategy(EmbeddedMetadata embeddedMetadata, Object target) {
try {
Object embeddedObject = initializeEmbedded(embeddedMetadata, target);
for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
marshalField(propertyMetadata, embeddedObject);
}
for (EmbeddedMetadata embeddedMetadata2 : embeddedMetadata.getEmbeddedMetadataCollection()) {
marshalWithExplodedStrategy(embeddedMetadata2, embeddedObject);
}
} catch (Throwable t) {
throw new EntityManagerException(t);
}
} | java | private void marshalWithExplodedStrategy(EmbeddedMetadata embeddedMetadata, Object target) {
try {
Object embeddedObject = initializeEmbedded(embeddedMetadata, target);
for (PropertyMetadata propertyMetadata : embeddedMetadata.getPropertyMetadataCollection()) {
marshalField(propertyMetadata, embeddedObject);
}
for (EmbeddedMetadata embeddedMetadata2 : embeddedMetadata.getEmbeddedMetadataCollection()) {
marshalWithExplodedStrategy(embeddedMetadata2, embeddedObject);
}
} catch (Throwable t) {
throw new EntityManagerException(t);
}
} | [
"private",
"void",
"marshalWithExplodedStrategy",
"(",
"EmbeddedMetadata",
"embeddedMetadata",
",",
"Object",
"target",
")",
"{",
"try",
"{",
"Object",
"embeddedObject",
"=",
"initializeEmbedded",
"(",
"embeddedMetadata",
",",
"target",
")",
";",
"for",
"(",
"Proper... | Marshals an embedded field represented by the given metadata.
@param embeddedMetadata
the metadata of the embedded field
@param target
the target object to which the embedded object belongs | [
"Marshals",
"an",
"embedded",
"field",
"represented",
"by",
"the",
"given",
"metadata",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L497-L509 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEManager.java | CmsADEManager.setShowEditorHelp | public void setShowEditorHelp(CmsObject cms, boolean showHelp) throws CmsException {
CmsUser user = cms.getRequestContext().getCurrentUser();
user.setAdditionalInfo(ADDINFO_ADE_SHOW_EDITOR_HELP, String.valueOf(showHelp));
cms.writeUser(user);
} | java | public void setShowEditorHelp(CmsObject cms, boolean showHelp) throws CmsException {
CmsUser user = cms.getRequestContext().getCurrentUser();
user.setAdditionalInfo(ADDINFO_ADE_SHOW_EDITOR_HELP, String.valueOf(showHelp));
cms.writeUser(user);
} | [
"public",
"void",
"setShowEditorHelp",
"(",
"CmsObject",
"cms",
",",
"boolean",
"showHelp",
")",
"throws",
"CmsException",
"{",
"CmsUser",
"user",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getCurrentUser",
"(",
")",
";",
"user",
".",
"setAdditional... | Sets the show editor help flag.<p>
@param cms the cms context
@param showHelp the show help flag
@throws CmsException if writing the user info fails | [
"Sets",
"the",
"show",
"editor",
"help",
"flag",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L1270-L1275 |
OpenTSDB/opentsdb | src/tools/UidManager.java | UidManager.extactLookupName | private static int extactLookupName(final HBaseClient client,
final byte[] table,
final short idwidth,
final String kind,
final String name) {
final UniqueId uid = new UniqueId(client, table, kind, (int) idwidth);
try {
final byte[] id = uid.getId(name);
System.out.println(kind + ' ' + name + ": " + Arrays.toString(id));
return 0;
} catch (NoSuchUniqueName e) {
LOG.error(e.getMessage());
return 1;
}
} | java | private static int extactLookupName(final HBaseClient client,
final byte[] table,
final short idwidth,
final String kind,
final String name) {
final UniqueId uid = new UniqueId(client, table, kind, (int) idwidth);
try {
final byte[] id = uid.getId(name);
System.out.println(kind + ' ' + name + ": " + Arrays.toString(id));
return 0;
} catch (NoSuchUniqueName e) {
LOG.error(e.getMessage());
return 1;
}
} | [
"private",
"static",
"int",
"extactLookupName",
"(",
"final",
"HBaseClient",
"client",
",",
"final",
"byte",
"[",
"]",
"table",
",",
"final",
"short",
"idwidth",
",",
"final",
"String",
"kind",
",",
"final",
"String",
"name",
")",
"{",
"final",
"UniqueId",
... | Looks up a name for a given kind, and prints it if found.
@param client The HBase client to use.
@param idwidth Number of bytes on which the UIDs should be.
@param kind The 'kind' of the ID (must not be {@code null}).
@param name The name to look for.
@return 0 if the name for this kind was found, 1 otherwise. | [
"Looks",
"up",
"a",
"name",
"for",
"a",
"given",
"kind",
"and",
"prints",
"it",
"if",
"found",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/UidManager.java#L958-L972 |
jbundle/jbundle | base/model/src/main/java/org/jbundle/base/model/Utility.java | Utility.convertObjectToString | public static String convertObjectToString(Object objData, Class<?> classData, Object objDefault)
{
try {
objData = Converter.convertObjectToDatatype(objData, classData, objDefault);
} catch (Exception ex) {
objData = null;
}
if (objData == null)
return null;
return objData.toString();
} | java | public static String convertObjectToString(Object objData, Class<?> classData, Object objDefault)
{
try {
objData = Converter.convertObjectToDatatype(objData, classData, objDefault);
} catch (Exception ex) {
objData = null;
}
if (objData == null)
return null;
return objData.toString();
} | [
"public",
"static",
"String",
"convertObjectToString",
"(",
"Object",
"objData",
",",
"Class",
"<",
"?",
">",
"classData",
",",
"Object",
"objDefault",
")",
"{",
"try",
"{",
"objData",
"=",
"Converter",
".",
"convertObjectToDatatype",
"(",
"objData",
",",
"cla... | Convert this object to an unfomatted string (ie., toString).
@param properties The map object to get the property from.
@param strKey The key of the property.
@param classData The target class to convert the property to.
@param objDefault The default value.
@return The data in the correct class. | [
"Convert",
"this",
"object",
"to",
"an",
"unfomatted",
"string",
"(",
"ie",
".",
"toString",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/model/src/main/java/org/jbundle/base/model/Utility.java#L526-L536 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java | JBossASClient.createRequest | public static ModelNode createRequest(String operation, Address address, ModelNode extra) {
final ModelNode request = (extra != null) ? extra.clone() : new ModelNode();
request.get(OPERATION).set(operation);
request.get(ADDRESS).set(address.getAddressNode());
return request;
} | java | public static ModelNode createRequest(String operation, Address address, ModelNode extra) {
final ModelNode request = (extra != null) ? extra.clone() : new ModelNode();
request.get(OPERATION).set(operation);
request.get(ADDRESS).set(address.getAddressNode());
return request;
} | [
"public",
"static",
"ModelNode",
"createRequest",
"(",
"String",
"operation",
",",
"Address",
"address",
",",
"ModelNode",
"extra",
")",
"{",
"final",
"ModelNode",
"request",
"=",
"(",
"extra",
"!=",
"null",
")",
"?",
"extra",
".",
"clone",
"(",
")",
":",
... | Convienence method that builds a partial operation request node, with additional
node properties supplied by the given node.
@param operation the operation to be requested
@param address identifies the target resource
@param extra provides additional properties to add to the returned request node.
@return the partial operation request node - caller can fill this in further to complete the node | [
"Convienence",
"method",
"that",
"builds",
"a",
"partial",
"operation",
"request",
"node",
"with",
"additional",
"node",
"properties",
"supplied",
"by",
"the",
"given",
"node",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L138-L143 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskClient.java | RegionDiskClient.insertRegionDisk | @BetaApi
public final Operation insertRegionDisk(String region, Disk diskResource) {
InsertRegionDiskHttpRequest request =
InsertRegionDiskHttpRequest.newBuilder()
.setRegion(region)
.setDiskResource(diskResource)
.build();
return insertRegionDisk(request);
} | java | @BetaApi
public final Operation insertRegionDisk(String region, Disk diskResource) {
InsertRegionDiskHttpRequest request =
InsertRegionDiskHttpRequest.newBuilder()
.setRegion(region)
.setDiskResource(diskResource)
.build();
return insertRegionDisk(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertRegionDisk",
"(",
"String",
"region",
",",
"Disk",
"diskResource",
")",
"{",
"InsertRegionDiskHttpRequest",
"request",
"=",
"InsertRegionDiskHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setRegion",
"(",
"reg... | Creates a persistent regional disk in the specified project using the data included in the
request.
<p>Sample code:
<pre><code>
try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
Disk diskResource = Disk.newBuilder().build();
Operation response = regionDiskClient.insertRegionDisk(region.toString(), diskResource);
}
</code></pre>
@param region Name of the region for this request.
@param diskResource A Disk resource. (== resource_for beta.disks ==) (== resource_for v1.disks
==)
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"persistent",
"regional",
"disk",
"in",
"the",
"specified",
"project",
"using",
"the",
"data",
"included",
"in",
"the",
"request",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RegionDiskClient.java#L520-L529 |
phax/ph-css | ph-css/src/main/java/com/helger/css/writer/CSSWriter.java | CSSWriter.writeCSS | public void writeCSS (@Nonnull final ICSSWriteable aCSS, @Nonnull @WillClose final Writer aWriter) throws IOException
{
ValueEnforcer.notNull (aCSS, "CSS");
ValueEnforcer.notNull (aWriter, "Writer");
try
{
aWriter.write (aCSS.getAsCSSString (m_aSettings));
}
finally
{
StreamHelper.close (aWriter);
}
} | java | public void writeCSS (@Nonnull final ICSSWriteable aCSS, @Nonnull @WillClose final Writer aWriter) throws IOException
{
ValueEnforcer.notNull (aCSS, "CSS");
ValueEnforcer.notNull (aWriter, "Writer");
try
{
aWriter.write (aCSS.getAsCSSString (m_aSettings));
}
finally
{
StreamHelper.close (aWriter);
}
} | [
"public",
"void",
"writeCSS",
"(",
"@",
"Nonnull",
"final",
"ICSSWriteable",
"aCSS",
",",
"@",
"Nonnull",
"@",
"WillClose",
"final",
"Writer",
"aWriter",
")",
"throws",
"IOException",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aCSS",
",",
"\"CSS\"",
")",
";... | Write the CSS content to the passed writer. No specific charset is used.
@param aCSS
The CSS to write. May not be <code>null</code>.
@param aWriter
The write to write the text to. May not be <code>null</code>. Is
automatically closed after the writing!
@throws IOException
In case writing fails.
@throws IllegalStateException
In case some elements cannot be written in the version supplied in
the constructor.
@see #getCSSAsString(ICSSWriteable) | [
"Write",
"the",
"CSS",
"content",
"to",
"the",
"passed",
"writer",
".",
"No",
"specific",
"charset",
"is",
"used",
"."
] | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/writer/CSSWriter.java#L395-L408 |
sitoolkit/sit-wt-all | sit-wt-runtime/src/main/java/io/sitoolkit/wt/domain/evidence/LogRecord.java | LogRecord.create | public static LogRecord create(SitLogger logger, LogLevelVo logLevel, TestStep testStep,
String messageKey, Object... params) {
String msg = MessageManager.getMessage(messageKey, params);
switch (logLevel) {
case INFO:
logger.infoMsg(msg);
break;
case DEBUG:
logger.debugMsg(msg);
break;
case ERROR:
logger.errorMsg(msg);
break;
case WARN:
logger.warnMsg(msg);
break;
default:
logger.infoMsg(msg);
}
String testStepNo = testStep == null ? "xxx" : testStep.getNo();
return new LogRecord(testStepNo, msg);
} | java | public static LogRecord create(SitLogger logger, LogLevelVo logLevel, TestStep testStep,
String messageKey, Object... params) {
String msg = MessageManager.getMessage(messageKey, params);
switch (logLevel) {
case INFO:
logger.infoMsg(msg);
break;
case DEBUG:
logger.debugMsg(msg);
break;
case ERROR:
logger.errorMsg(msg);
break;
case WARN:
logger.warnMsg(msg);
break;
default:
logger.infoMsg(msg);
}
String testStepNo = testStep == null ? "xxx" : testStep.getNo();
return new LogRecord(testStepNo, msg);
} | [
"public",
"static",
"LogRecord",
"create",
"(",
"SitLogger",
"logger",
",",
"LogLevelVo",
"logLevel",
",",
"TestStep",
"testStep",
",",
"String",
"messageKey",
",",
"Object",
"...",
"params",
")",
"{",
"String",
"msg",
"=",
"MessageManager",
".",
"getMessage",
... | 操作ログオブジェクトを作成します。
@param logger
ロガー
@param logLevel
ログレベル
@param testStep
テストステップ
@param messageKey
メッセージキー
@param params
メッセージパラメーター
@return 操作ログ | [
"操作ログオブジェクトを作成します。"
] | train | https://github.com/sitoolkit/sit-wt-all/blob/efabde27aa731a5602d2041e137721a22f4fd27a/sit-wt-runtime/src/main/java/io/sitoolkit/wt/domain/evidence/LogRecord.java#L151-L176 |
houbb/log-integration | src/main/java/com/github/houbb/log/integration/adaptors/jdbc/PreparedStatementLogger.java | PreparedStatementLogger.newInstance | public static PreparedStatement newInstance(PreparedStatement stmt, Log statementLog, int queryStack) {
InvocationHandler handler = new PreparedStatementLogger(stmt, statementLog, queryStack);
ClassLoader cl = PreparedStatement.class.getClassLoader();
return (PreparedStatement) Proxy.newProxyInstance(cl, new Class[]{PreparedStatement.class, CallableStatement.class}, handler);
} | java | public static PreparedStatement newInstance(PreparedStatement stmt, Log statementLog, int queryStack) {
InvocationHandler handler = new PreparedStatementLogger(stmt, statementLog, queryStack);
ClassLoader cl = PreparedStatement.class.getClassLoader();
return (PreparedStatement) Proxy.newProxyInstance(cl, new Class[]{PreparedStatement.class, CallableStatement.class}, handler);
} | [
"public",
"static",
"PreparedStatement",
"newInstance",
"(",
"PreparedStatement",
"stmt",
",",
"Log",
"statementLog",
",",
"int",
"queryStack",
")",
"{",
"InvocationHandler",
"handler",
"=",
"new",
"PreparedStatementLogger",
"(",
"stmt",
",",
"statementLog",
",",
"q... | /*
Creates a logging version of a PreparedStatement
@param stmt - the statement
@param sql - the sql statement
@return - the proxy | [
"/",
"*",
"Creates",
"a",
"logging",
"version",
"of",
"a",
"PreparedStatement"
] | train | https://github.com/houbb/log-integration/blob/c5e979719aec12a02f7d22b24b04b6fbb1789ca5/src/main/java/com/github/houbb/log/integration/adaptors/jdbc/PreparedStatementLogger.java#L99-L103 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java | PosixHelp.checkFileType | public static final void checkFileType(Path path, String perms)
{
if (perms.length() != 10)
{
throw new IllegalArgumentException(perms+" not permission. E.g. -rwxr--r--");
}
switch (perms.charAt(0))
{
case '-':
if (!Files.isRegularFile(path))
{
throw new IllegalArgumentException("file is not regular file");
}
break;
case 'd':
if (!Files.isDirectory(path))
{
throw new IllegalArgumentException("file is not directory");
}
break;
case 'l':
if (!Files.isSymbolicLink(path))
{
throw new IllegalArgumentException("file is not symbolic link");
}
break;
default:
throw new UnsupportedOperationException(perms+" not supported");
}
} | java | public static final void checkFileType(Path path, String perms)
{
if (perms.length() != 10)
{
throw new IllegalArgumentException(perms+" not permission. E.g. -rwxr--r--");
}
switch (perms.charAt(0))
{
case '-':
if (!Files.isRegularFile(path))
{
throw new IllegalArgumentException("file is not regular file");
}
break;
case 'd':
if (!Files.isDirectory(path))
{
throw new IllegalArgumentException("file is not directory");
}
break;
case 'l':
if (!Files.isSymbolicLink(path))
{
throw new IllegalArgumentException("file is not symbolic link");
}
break;
default:
throw new UnsupportedOperationException(perms+" not supported");
}
} | [
"public",
"static",
"final",
"void",
"checkFileType",
"(",
"Path",
"path",
",",
"String",
"perms",
")",
"{",
"if",
"(",
"perms",
".",
"length",
"(",
")",
"!=",
"10",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"perms",
"+",
"\" not permissio... | Throws IllegalArgumentException if perms length != 10 or files type doesn't
match with permission.
@param path
@param perms | [
"Throws",
"IllegalArgumentException",
"if",
"perms",
"length",
"!",
"=",
"10",
"or",
"files",
"type",
"doesn",
"t",
"match",
"with",
"permission",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L242-L271 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.getTimeInstance | static final public DateFormat getTimeInstance(Calendar cal, int timeStyle) {
return getTimeInstance(cal, timeStyle, ULocale.getDefault(Category.FORMAT));
} | java | static final public DateFormat getTimeInstance(Calendar cal, int timeStyle) {
return getTimeInstance(cal, timeStyle, ULocale.getDefault(Category.FORMAT));
} | [
"static",
"final",
"public",
"DateFormat",
"getTimeInstance",
"(",
"Calendar",
"cal",
",",
"int",
"timeStyle",
")",
"{",
"return",
"getTimeInstance",
"(",
"cal",
",",
"timeStyle",
",",
"ULocale",
".",
"getDefault",
"(",
"Category",
".",
"FORMAT",
")",
")",
"... | Creates a {@link DateFormat} object that can be used to format times in
the calendar system specified by <code>cal</code>.
@param cal The calendar system for which a time format is desired.
@param timeStyle The type of time format desired. This can be
{@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
etc.
@see DateFormat#getTimeInstance | [
"Creates",
"a",
"{",
"@link",
"DateFormat",
"}",
"object",
"that",
"can",
"be",
"used",
"to",
"format",
"times",
"in",
"the",
"calendar",
"system",
"specified",
"by",
"<code",
">",
"cal<",
"/",
"code",
">",
".",
"@param",
"cal",
"The",
"calendar",
"syste... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1918-L1920 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java | Collections.anyIn | public static SatisfiesBuilder anyIn(String variable, Expression expression) {
return new SatisfiesBuilder(x("ANY"), variable, expression, true);
} | java | public static SatisfiesBuilder anyIn(String variable, Expression expression) {
return new SatisfiesBuilder(x("ANY"), variable, expression, true);
} | [
"public",
"static",
"SatisfiesBuilder",
"anyIn",
"(",
"String",
"variable",
",",
"Expression",
"expression",
")",
"{",
"return",
"new",
"SatisfiesBuilder",
"(",
"x",
"(",
"\"ANY\"",
")",
",",
"variable",
",",
"expression",
",",
"true",
")",
";",
"}"
] | Create an ANY comprehension with a first IN range.
ANY is a range predicate that allows you to test a Boolean condition over the
elements or attributes of a collection, object, or objects. It uses the IN and WITHIN operators to range through
the collection. IN ranges in the direct elements of its array expression, WITHIN also ranges in its descendants.
If at least one item in the array satisfies the ANY expression, then ANY returns TRUE, otherwise returns FALSE. | [
"Create",
"an",
"ANY",
"comprehension",
"with",
"a",
"first",
"IN",
"range",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/Collections.java#L155-L157 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java | PatternsImpl.deletePatternsAsync | public Observable<OperationStatus> deletePatternsAsync(UUID appId, String versionId, List<UUID> patternIds) {
return deletePatternsWithServiceResponseAsync(appId, versionId, patternIds).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | java | public Observable<OperationStatus> deletePatternsAsync(UUID appId, String versionId, List<UUID> patternIds) {
return deletePatternsWithServiceResponseAsync(appId, versionId, patternIds).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"deletePatternsAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"List",
"<",
"UUID",
">",
"patternIds",
")",
"{",
"return",
"deletePatternsWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
... | Deletes the patterns with the specified IDs.
@param appId The application ID.
@param versionId The version ID.
@param patternIds The patterns IDs.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Deletes",
"the",
"patterns",
"with",
"the",
"specified",
"IDs",
"."
] | 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/PatternsImpl.java#L595-L602 |
SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java | Settings.getString | @CheckForNull
public String getString(String key) {
String effectiveKey = definitions.validKey(key);
Optional<String> value = getRawString(effectiveKey);
if (!value.isPresent()) {
// default values cannot be encrypted, so return value as-is.
return getDefaultValue(effectiveKey);
}
if (encryption.isEncrypted(value.get())) {
try {
return encryption.decrypt(value.get());
} catch (Exception e) {
throw new IllegalStateException("Fail to decrypt the property " + effectiveKey + ". Please check your secret key.", e);
}
}
return value.get();
} | java | @CheckForNull
public String getString(String key) {
String effectiveKey = definitions.validKey(key);
Optional<String> value = getRawString(effectiveKey);
if (!value.isPresent()) {
// default values cannot be encrypted, so return value as-is.
return getDefaultValue(effectiveKey);
}
if (encryption.isEncrypted(value.get())) {
try {
return encryption.decrypt(value.get());
} catch (Exception e) {
throw new IllegalStateException("Fail to decrypt the property " + effectiveKey + ". Please check your secret key.", e);
}
}
return value.get();
} | [
"@",
"CheckForNull",
"public",
"String",
"getString",
"(",
"String",
"key",
")",
"{",
"String",
"effectiveKey",
"=",
"definitions",
".",
"validKey",
"(",
"key",
")",
";",
"Optional",
"<",
"String",
">",
"value",
"=",
"getRawString",
"(",
"effectiveKey",
")",... | The effective value of the specified property. Can return
{@code null} if the property is not set and has no
defined default value.
<p>
If the property is encrypted with a secret key,
then the returned value is decrypted.
</p>
@throws IllegalStateException if value is encrypted but fails to be decrypted. | [
"The",
"effective",
"value",
"of",
"the",
"specified",
"property",
".",
"Can",
"return",
"{",
"@code",
"null",
"}",
"if",
"the",
"property",
"is",
"not",
"set",
"and",
"has",
"no",
"defined",
"default",
"value",
".",
"<p",
">",
"If",
"the",
"property",
... | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java#L142-L158 |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/GosuParserFactoryImpl.java | GosuParserFactoryImpl.createParser | public IGosuParser createParser(
ISymbolTable symTable, IScriptabilityModifier scriptabilityConstraint )
{
IGosuParser parser = new GosuParser( symTable, scriptabilityConstraint );
return parser;
} | java | public IGosuParser createParser(
ISymbolTable symTable, IScriptabilityModifier scriptabilityConstraint )
{
IGosuParser parser = new GosuParser( symTable, scriptabilityConstraint );
return parser;
} | [
"public",
"IGosuParser",
"createParser",
"(",
"ISymbolTable",
"symTable",
",",
"IScriptabilityModifier",
"scriptabilityConstraint",
")",
"{",
"IGosuParser",
"parser",
"=",
"new",
"GosuParser",
"(",
"symTable",
",",
"scriptabilityConstraint",
")",
";",
"return",
"parser"... | Creates an IGosuParser appropriate for parsing and executing Gosu.
@param symTable The symbol table the parser uses to parse and execute script.
@return A parser appropriate for parsing Gosu source. | [
"Creates",
"an",
"IGosuParser",
"appropriate",
"for",
"parsing",
"and",
"executing",
"Gosu",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/GosuParserFactoryImpl.java#L64-L69 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/PropertyTypes.java | PropertyTypes.createTranslator | public static DPTXlator createTranslator(int dataType, byte[] data)
throws KNXException
{
final DPTXlator t = createTranslator(dataType);
t.setData(data);
return t;
} | java | public static DPTXlator createTranslator(int dataType, byte[] data)
throws KNXException
{
final DPTXlator t = createTranslator(dataType);
t.setData(data);
return t;
} | [
"public",
"static",
"DPTXlator",
"createTranslator",
"(",
"int",
"dataType",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"KNXException",
"{",
"final",
"DPTXlator",
"t",
"=",
"createTranslator",
"(",
"dataType",
")",
";",
"t",
".",
"setData",
"(",
"data",
... | Utility method, like {@link #createTranslator(int)}, with the additional
capability to set the data to be used by the DPT translator.
<p>
@param dataType property data type to get the associated translator for
@param data array with KNX DPT formatted data, the number of contained items is
determined by the used DPT
@return the created DPT translator with the set data
@throws KNXException on PDT not found or translator could not be created
@see #createTranslator(int) | [
"Utility",
"method",
"like",
"{",
"@link",
"#createTranslator",
"(",
"int",
")",
"}",
"with",
"the",
"additional",
"capability",
"to",
"set",
"the",
"data",
"to",
"be",
"used",
"by",
"the",
"DPT",
"translator",
".",
"<p",
">"
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/PropertyTypes.java#L447-L453 |
bingoohuang/excel2javabeans | src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java | PoiUtil.searchRowCell | public static Cell searchRowCell(Sheet sheet, int rowIndex, String searchKey) {
if (StringUtils.isEmpty(searchKey)) return null;
return searchRow(sheet.getRow(rowIndex), searchKey);
} | java | public static Cell searchRowCell(Sheet sheet, int rowIndex, String searchKey) {
if (StringUtils.isEmpty(searchKey)) return null;
return searchRow(sheet.getRow(rowIndex), searchKey);
} | [
"public",
"static",
"Cell",
"searchRowCell",
"(",
"Sheet",
"sheet",
",",
"int",
"rowIndex",
",",
"String",
"searchKey",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"searchKey",
")",
")",
"return",
"null",
";",
"return",
"searchRow",
"(",
"shee... | 查找单元格。
@param sheet 表单
@param rowIndex 行索引
@param searchKey 单元格中包含的关键字
@return 单元格,没有找到时返回null | [
"查找单元格。"
] | train | https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java#L348-L352 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/crypto/totp/TOTPValidator.java | TOTPValidator.isValid | public boolean isValid(byte[] key, long timeStep, int digits, HmacShaAlgorithm hmacShaAlgorithm, String value, long validationTime) {
boolean result = false;
TOTPBuilder builder = TOTP.key(key).timeStep(timeStep).digits(digits).hmacSha(hmacShaAlgorithm);
for (int i = -window; i <= window; i++) {
final long time = validationTime + (i * timeStep);
final TOTP vtotp = builder.build(time);
if (vtotp.value().equals(value)) {
result = true;
break;
}
}
return result;
} | java | public boolean isValid(byte[] key, long timeStep, int digits, HmacShaAlgorithm hmacShaAlgorithm, String value, long validationTime) {
boolean result = false;
TOTPBuilder builder = TOTP.key(key).timeStep(timeStep).digits(digits).hmacSha(hmacShaAlgorithm);
for (int i = -window; i <= window; i++) {
final long time = validationTime + (i * timeStep);
final TOTP vtotp = builder.build(time);
if (vtotp.value().equals(value)) {
result = true;
break;
}
}
return result;
} | [
"public",
"boolean",
"isValid",
"(",
"byte",
"[",
"]",
"key",
",",
"long",
"timeStep",
",",
"int",
"digits",
",",
"HmacShaAlgorithm",
"hmacShaAlgorithm",
",",
"String",
"value",
",",
"long",
"validationTime",
")",
"{",
"boolean",
"result",
"=",
"false",
";",... | Returns {@code true} if the specified TOTP {@code value} matches the
value of the TOTP generated at validation, otherwise {@code false}.
@param key
the encoded shared secret key
@param timeStep
the time step size in milliseconds
@param digits
the number of digits a TOTP should contain
@param hmacShaAlgorithm
{@link HmacShaAlgorithm}
@param value
the TOTP value to validate
@param validationTime
the validation reference time in milliseconds
@return {@code true} if the specified TOTP {@code code} value matches the
code value of the TOTP generated at validation, otherwise
{@code false}. | [
"Returns",
"{",
"@code",
"true",
"}",
"if",
"the",
"specified",
"TOTP",
"{",
"@code",
"value",
"}",
"matches",
"the",
"value",
"of",
"the",
"TOTP",
"generated",
"at",
"validation",
"otherwise",
"{",
"@code",
"false",
"}",
"."
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/crypto/totp/TOTPValidator.java#L144-L156 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java | ApiOvhSms.serviceName_users_login_outgoing_GET | public ArrayList<Long> serviceName_users_login_outgoing_GET(String serviceName, String login, Long deliveryReceipt, Long differedDelivery, Long ptt, String receiver, String sender, String tag) throws IOException {
String qPath = "/sms/{serviceName}/users/{login}/outgoing";
StringBuilder sb = path(qPath, serviceName, login);
query(sb, "deliveryReceipt", deliveryReceipt);
query(sb, "differedDelivery", differedDelivery);
query(sb, "ptt", ptt);
query(sb, "receiver", receiver);
query(sb, "sender", sender);
query(sb, "tag", tag);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> serviceName_users_login_outgoing_GET(String serviceName, String login, Long deliveryReceipt, Long differedDelivery, Long ptt, String receiver, String sender, String tag) throws IOException {
String qPath = "/sms/{serviceName}/users/{login}/outgoing";
StringBuilder sb = path(qPath, serviceName, login);
query(sb, "deliveryReceipt", deliveryReceipt);
query(sb, "differedDelivery", differedDelivery);
query(sb, "ptt", ptt);
query(sb, "receiver", receiver);
query(sb, "sender", sender);
query(sb, "tag", tag);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_users_login_outgoing_GET",
"(",
"String",
"serviceName",
",",
"String",
"login",
",",
"Long",
"deliveryReceipt",
",",
"Long",
"differedDelivery",
",",
"Long",
"ptt",
",",
"String",
"receiver",
",",
"String",
"s... | Sms sent associated to the sms user
REST: GET /sms/{serviceName}/users/{login}/outgoing
@param differedDelivery [required] Filter the value of differedDelivery property (=)
@param tag [required] Filter the value of tag property (=)
@param ptt [required] Filter the value of ptt property (=)
@param receiver [required] Filter the value of receiver property (=)
@param sender [required] Filter the value of sender property (=)
@param deliveryReceipt [required] Filter the value of deliveryReceipt property (=)
@param serviceName [required] The internal name of your SMS offer
@param login [required] The sms user login | [
"Sms",
"sent",
"associated",
"to",
"the",
"sms",
"user"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L840-L851 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.unregisterPropertyOnType | public void unregisterPropertyOnType(String propertyName, JSType type) {
// TODO(bashir): typesIndexedByProperty should also be updated!
Map<String, ObjectType> typeSet =
eachRefTypeIndexedByProperty.get(propertyName);
if (typeSet != null) {
typeSet.remove(type.toObjectType().getReferenceName());
}
} | java | public void unregisterPropertyOnType(String propertyName, JSType type) {
// TODO(bashir): typesIndexedByProperty should also be updated!
Map<String, ObjectType> typeSet =
eachRefTypeIndexedByProperty.get(propertyName);
if (typeSet != null) {
typeSet.remove(type.toObjectType().getReferenceName());
}
} | [
"public",
"void",
"unregisterPropertyOnType",
"(",
"String",
"propertyName",
",",
"JSType",
"type",
")",
"{",
"// TODO(bashir): typesIndexedByProperty should also be updated!",
"Map",
"<",
"String",
",",
"ObjectType",
">",
"typeSet",
"=",
"eachRefTypeIndexedByProperty",
"."... | Removes the index's reference to a property on the given type (if it is
currently registered). If the property is not registered on the type yet,
this method will not change internal state.
@param propertyName the name of the property to unregister
@param type the type to unregister the property on. | [
"Removes",
"the",
"index",
"s",
"reference",
"to",
"a",
"property",
"on",
"the",
"given",
"type",
"(",
"if",
"it",
"is",
"currently",
"registered",
")",
".",
"If",
"the",
"property",
"is",
"not",
"registered",
"on",
"the",
"type",
"yet",
"this",
"method"... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L953-L960 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getUsersBatch | public OneLoginResponse<User> getUsersBatch(int batchSize) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getUsersBatch(batchSize, null);
} | java | public OneLoginResponse<User> getUsersBatch(int batchSize) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getUsersBatch(batchSize, null);
} | [
"public",
"OneLoginResponse",
"<",
"User",
">",
"getUsersBatch",
"(",
"int",
"batchSize",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"return",
"getUsersBatch",
"(",
"batchSize",
",",
"null",
")",
";",
"}"
] | Get a batch Users.
This is usually the first version of the user batching methods to call as it requires no after-cursor information.
@param batchSize Size of the Batch
@return OneLoginResponse of User (Batch)
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the getResource call
@see com.onelogin.sdk.model.User
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/users/get-users">Get Users documentation</a> | [
"Get",
"a",
"batch",
"Users",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L357-L359 |
apache/groovy | subprojects/groovy-swing/src/main/java/groovy/model/DefaultTableColumn.java | DefaultTableColumn.getValue | public Object getValue(Object row, int rowIndex, int columnIndex) {
if (valueModel instanceof NestedValueModel) {
NestedValueModel nestedModel = (NestedValueModel) valueModel;
nestedModel.getSourceModel().setValue(row);
}
return valueModel.getValue();
} | java | public Object getValue(Object row, int rowIndex, int columnIndex) {
if (valueModel instanceof NestedValueModel) {
NestedValueModel nestedModel = (NestedValueModel) valueModel;
nestedModel.getSourceModel().setValue(row);
}
return valueModel.getValue();
} | [
"public",
"Object",
"getValue",
"(",
"Object",
"row",
",",
"int",
"rowIndex",
",",
"int",
"columnIndex",
")",
"{",
"if",
"(",
"valueModel",
"instanceof",
"NestedValueModel",
")",
"{",
"NestedValueModel",
"nestedModel",
"=",
"(",
"NestedValueModel",
")",
"valueMo... | Evaluates the value of a cell
@return the value
@param row the row of interest
@param rowIndex the index of the row of interest
@param columnIndex the column of interest | [
"Evaluates",
"the",
"value",
"of",
"a",
"cell"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/groovy/model/DefaultTableColumn.java#L56-L62 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cloud_project_serviceName_ip_GET | public OvhOrder cloud_project_serviceName_ip_GET(String serviceName, OvhGeolocationEnum country, String instanceId, Long quantity) throws IOException {
String qPath = "/order/cloud/project/{serviceName}/ip";
StringBuilder sb = path(qPath, serviceName);
query(sb, "country", country);
query(sb, "instanceId", instanceId);
query(sb, "quantity", quantity);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder cloud_project_serviceName_ip_GET(String serviceName, OvhGeolocationEnum country, String instanceId, Long quantity) throws IOException {
String qPath = "/order/cloud/project/{serviceName}/ip";
StringBuilder sb = path(qPath, serviceName);
query(sb, "country", country);
query(sb, "instanceId", instanceId);
query(sb, "quantity", quantity);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"cloud_project_serviceName_ip_GET",
"(",
"String",
"serviceName",
",",
"OvhGeolocationEnum",
"country",
",",
"String",
"instanceId",
",",
"Long",
"quantity",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cloud/project/{serviceN... | Get prices and contracts information
REST: GET /order/cloud/project/{serviceName}/ip
@param instanceId [required] Instance id where ip will be routed to
@param country [required] IP geolocation
@param quantity [required] Number of failover ip
@param serviceName [required] The project id | [
"Get",
"prices",
"and",
"contracts",
"information"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2926-L2934 |
pravega/pravega | controller/src/main/java/io/pravega/controller/server/SegmentHelper.java | SegmentHelper.deleteTableSegment | public CompletableFuture<Boolean> deleteTableSegment(final String tableName,
final boolean mustBeEmpty,
String delegationToken,
final long clientRequestId) {
final CompletableFuture<Boolean> result = new CompletableFuture<>();
final Controller.NodeUri uri = getTableUri(tableName);
final WireCommandType type = WireCommandType.DELETE_TABLE_SEGMENT;
final long requestId = (clientRequestId == RequestTag.NON_EXISTENT_ID) ? idGenerator.get() : clientRequestId;
final FailingReplyProcessor replyProcessor = new FailingReplyProcessor() {
@Override
public void connectionDropped() {
log.warn(requestId, "deleteTableSegment {} Connection dropped.", tableName);
result.completeExceptionally(
new WireCommandFailedException(type, WireCommandFailedException.Reason.ConnectionDropped));
}
@Override
public void wrongHost(WireCommands.WrongHost wrongHost) {
log.warn(requestId, "deleteTableSegment {} wrong host.", tableName);
result.completeExceptionally(new WireCommandFailedException(type, WireCommandFailedException.Reason.UnknownHost));
}
@Override
public void noSuchSegment(WireCommands.NoSuchSegment noSuchSegment) {
log.info(requestId, "deleteTableSegment {} NoSuchSegment.", tableName);
result.complete(true);
}
@Override
public void segmentDeleted(WireCommands.SegmentDeleted segmentDeleted) {
log.info(requestId, "deleteTableSegment {} SegmentDeleted.", tableName);
result.complete(true);
}
@Override
public void tableSegmentNotEmpty(WireCommands.TableSegmentNotEmpty tableSegmentNotEmpty) {
log.warn(requestId, "deleteTableSegment {} TableSegmentNotEmpty.", tableName);
result.completeExceptionally(new WireCommandFailedException(type, WireCommandFailedException.Reason.TableSegmentNotEmpty));
}
@Override
public void processingFailure(Exception error) {
log.error(requestId, "deleteTableSegment {} failed.", tableName, error);
handleError(error, result, type);
}
@Override
public void authTokenCheckFailed(WireCommands.AuthTokenCheckFailed authTokenCheckFailed) {
result.completeExceptionally(
new WireCommandFailedException(new AuthenticationException(authTokenCheckFailed.toString()),
type, WireCommandFailedException.Reason.AuthFailed));
}
};
WireCommands.DeleteTableSegment request = new WireCommands.DeleteTableSegment(requestId, tableName, mustBeEmpty, delegationToken);
sendRequestAsync(request, replyProcessor, result, ModelHelper.encode(uri));
return result;
} | java | public CompletableFuture<Boolean> deleteTableSegment(final String tableName,
final boolean mustBeEmpty,
String delegationToken,
final long clientRequestId) {
final CompletableFuture<Boolean> result = new CompletableFuture<>();
final Controller.NodeUri uri = getTableUri(tableName);
final WireCommandType type = WireCommandType.DELETE_TABLE_SEGMENT;
final long requestId = (clientRequestId == RequestTag.NON_EXISTENT_ID) ? idGenerator.get() : clientRequestId;
final FailingReplyProcessor replyProcessor = new FailingReplyProcessor() {
@Override
public void connectionDropped() {
log.warn(requestId, "deleteTableSegment {} Connection dropped.", tableName);
result.completeExceptionally(
new WireCommandFailedException(type, WireCommandFailedException.Reason.ConnectionDropped));
}
@Override
public void wrongHost(WireCommands.WrongHost wrongHost) {
log.warn(requestId, "deleteTableSegment {} wrong host.", tableName);
result.completeExceptionally(new WireCommandFailedException(type, WireCommandFailedException.Reason.UnknownHost));
}
@Override
public void noSuchSegment(WireCommands.NoSuchSegment noSuchSegment) {
log.info(requestId, "deleteTableSegment {} NoSuchSegment.", tableName);
result.complete(true);
}
@Override
public void segmentDeleted(WireCommands.SegmentDeleted segmentDeleted) {
log.info(requestId, "deleteTableSegment {} SegmentDeleted.", tableName);
result.complete(true);
}
@Override
public void tableSegmentNotEmpty(WireCommands.TableSegmentNotEmpty tableSegmentNotEmpty) {
log.warn(requestId, "deleteTableSegment {} TableSegmentNotEmpty.", tableName);
result.completeExceptionally(new WireCommandFailedException(type, WireCommandFailedException.Reason.TableSegmentNotEmpty));
}
@Override
public void processingFailure(Exception error) {
log.error(requestId, "deleteTableSegment {} failed.", tableName, error);
handleError(error, result, type);
}
@Override
public void authTokenCheckFailed(WireCommands.AuthTokenCheckFailed authTokenCheckFailed) {
result.completeExceptionally(
new WireCommandFailedException(new AuthenticationException(authTokenCheckFailed.toString()),
type, WireCommandFailedException.Reason.AuthFailed));
}
};
WireCommands.DeleteTableSegment request = new WireCommands.DeleteTableSegment(requestId, tableName, mustBeEmpty, delegationToken);
sendRequestAsync(request, replyProcessor, result, ModelHelper.encode(uri));
return result;
} | [
"public",
"CompletableFuture",
"<",
"Boolean",
">",
"deleteTableSegment",
"(",
"final",
"String",
"tableName",
",",
"final",
"boolean",
"mustBeEmpty",
",",
"String",
"delegationToken",
",",
"final",
"long",
"clientRequestId",
")",
"{",
"final",
"CompletableFuture",
... | This method sends a WireCommand to delete a table segment.
@param tableName Qualified table name.
@param mustBeEmpty Flag to check if the table segment should be empty before deletion.
@param delegationToken The token to be presented to the segmentstore.
@param clientRequestId Request id.
@return A CompletableFuture that, when completed normally, will indicate the table segment deletion completed
successfully. If the operation failed, the future will be failed with the causing exception. If the exception
can be retried then the future will be failed with {@link WireCommandFailedException}. | [
"This",
"method",
"sends",
"a",
"WireCommand",
"to",
"delete",
"a",
"table",
"segment",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/SegmentHelper.java#L696-L755 |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.iterateAttributeValues | public static void iterateAttributeValues(Attribute attribute, AttributeValueCallbackHandler callbackHandler) {
Assert.notNull(attribute, "Attribute must not be null");
Assert.notNull(callbackHandler, "callbackHandler must not be null");
if (attribute instanceof Iterable) {
int i = 0;
for (Object obj : (Iterable) attribute) {
handleAttributeValue(attribute.getID(), obj, i, callbackHandler);
i++;
}
}
else {
for (int i = 0; i < attribute.size(); i++) {
try {
handleAttributeValue(attribute.getID(), attribute.get(i), i, callbackHandler);
} catch (javax.naming.NamingException e) {
throw convertLdapException(e);
}
}
}
} | java | public static void iterateAttributeValues(Attribute attribute, AttributeValueCallbackHandler callbackHandler) {
Assert.notNull(attribute, "Attribute must not be null");
Assert.notNull(callbackHandler, "callbackHandler must not be null");
if (attribute instanceof Iterable) {
int i = 0;
for (Object obj : (Iterable) attribute) {
handleAttributeValue(attribute.getID(), obj, i, callbackHandler);
i++;
}
}
else {
for (int i = 0; i < attribute.size(); i++) {
try {
handleAttributeValue(attribute.getID(), attribute.get(i), i, callbackHandler);
} catch (javax.naming.NamingException e) {
throw convertLdapException(e);
}
}
}
} | [
"public",
"static",
"void",
"iterateAttributeValues",
"(",
"Attribute",
"attribute",
",",
"AttributeValueCallbackHandler",
"callbackHandler",
")",
"{",
"Assert",
".",
"notNull",
"(",
"attribute",
",",
"\"Attribute must not be null\"",
")",
";",
"Assert",
".",
"notNull",... | Iterate through all the values of the specified Attribute calling back to
the specified callbackHandler.
@param attribute the Attribute to work with; not <code>null</code>.
@param callbackHandler the callbackHandler; not <code>null</code>.
@since 1.3 | [
"Iterate",
"through",
"all",
"the",
"values",
"of",
"the",
"specified",
"Attribute",
"calling",
"back",
"to",
"the",
"specified",
"callbackHandler",
"."
] | train | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L298-L318 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/util/ComponentUtil.java | ComponentUtil.hasChangesOfChildren | private static boolean hasChangesOfChildren(long last, PageContext pc, Class clazz) {
java.lang.reflect.Method[] methods = clazz.getMethods();
java.lang.reflect.Method method;
Class[] params;
for (int i = 0; i < methods.length; i++) {
method = methods[i];
if (method.getDeclaringClass() == clazz) {
if (_hasChangesOfChildren(pc, last, method.getReturnType())) return true;
params = method.getParameterTypes();
for (int y = 0; y < params.length; y++) {
if (_hasChangesOfChildren(pc, last, params[y])) return true;
}
}
}
return false;
} | java | private static boolean hasChangesOfChildren(long last, PageContext pc, Class clazz) {
java.lang.reflect.Method[] methods = clazz.getMethods();
java.lang.reflect.Method method;
Class[] params;
for (int i = 0; i < methods.length; i++) {
method = methods[i];
if (method.getDeclaringClass() == clazz) {
if (_hasChangesOfChildren(pc, last, method.getReturnType())) return true;
params = method.getParameterTypes();
for (int y = 0; y < params.length; y++) {
if (_hasChangesOfChildren(pc, last, params[y])) return true;
}
}
}
return false;
} | [
"private",
"static",
"boolean",
"hasChangesOfChildren",
"(",
"long",
"last",
",",
"PageContext",
"pc",
",",
"Class",
"clazz",
")",
"{",
"java",
".",
"lang",
".",
"reflect",
".",
"Method",
"[",
"]",
"methods",
"=",
"clazz",
".",
"getMethods",
"(",
")",
";... | check if one of the children is changed
@param component
@param pc
@param clazz
@return return true if children has changed | [
"check",
"if",
"one",
"of",
"the",
"children",
"is",
"changed"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ComponentUtil.java#L221-L237 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201902/companyservice/CreateCompanies.java | CreateCompanies.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the CompanyService.
CompanyServiceInterface companyService =
adManagerServices.get(session, CompanyServiceInterface.class);
// Create an advertiser.
Company advertiser = new Company();
advertiser.setName("Advertiser #" + new Random().nextInt(Integer.MAX_VALUE));
advertiser.setType(CompanyType.ADVERTISER);
// Create an agency.
Company agency = new Company();
agency.setName("Agency #" + new Random().nextInt(Integer.MAX_VALUE));
agency.setType(CompanyType.AGENCY);
// Create the companies on the server.
Company[] companies = companyService.createCompanies(new Company[] {advertiser, agency});
for (Company createdCompany : companies) {
System.out.printf(
"A company with ID %d, name '%s', and type '%s' was created.%n",
createdCompany.getId(), createdCompany.getName(), createdCompany.getType());
}
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the CompanyService.
CompanyServiceInterface companyService =
adManagerServices.get(session, CompanyServiceInterface.class);
// Create an advertiser.
Company advertiser = new Company();
advertiser.setName("Advertiser #" + new Random().nextInt(Integer.MAX_VALUE));
advertiser.setType(CompanyType.ADVERTISER);
// Create an agency.
Company agency = new Company();
agency.setName("Agency #" + new Random().nextInt(Integer.MAX_VALUE));
agency.setType(CompanyType.AGENCY);
// Create the companies on the server.
Company[] companies = companyService.createCompanies(new Company[] {advertiser, agency});
for (Company createdCompany : companies) {
System.out.printf(
"A company with ID %d, name '%s', and type '%s' was created.%n",
createdCompany.getId(), createdCompany.getName(), createdCompany.getType());
}
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the CompanyService.",
"CompanyServiceInterface",
"companyService",
"=",
"adManagerServices",
".",
"get",... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/companyservice/CreateCompanies.java#L51-L75 |
tvesalainen/util | util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java | ChannelHelper.write | public static final long write(WritableByteChannel channel, ByteBuffer[] srcs, int offset, int length) throws IOException
{
long res = 0;
for (int ii=0;ii<length;ii++)
{
ByteBuffer bb = srcs[ii+offset];
if (bb.hasRemaining())
{
res += channel.write(bb);
if (bb.hasRemaining())
{
break;
}
}
}
return res;
} | java | public static final long write(WritableByteChannel channel, ByteBuffer[] srcs, int offset, int length) throws IOException
{
long res = 0;
for (int ii=0;ii<length;ii++)
{
ByteBuffer bb = srcs[ii+offset];
if (bb.hasRemaining())
{
res += channel.write(bb);
if (bb.hasRemaining())
{
break;
}
}
}
return res;
} | [
"public",
"static",
"final",
"long",
"write",
"(",
"WritableByteChannel",
"channel",
",",
"ByteBuffer",
"[",
"]",
"srcs",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"long",
"res",
"=",
"0",
";",
"for",
"(",
"int",
"ii"... | GatheringChannel support.
@param channel
@param srcs
@param offset
@param length
@return
@throws IOException | [
"GatheringChannel",
"support",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/ChannelHelper.java#L236-L252 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/chart/CcgExactChart.java | CcgExactChart.longMultisetsEqual | private static final boolean longMultisetsEqual(long[] firstDeps, long[] secondDeps) {
if (firstDeps.length != secondDeps.length) {
return false;
}
Arrays.sort(firstDeps);
Arrays.sort(secondDeps);
for (int i = 0; i < firstDeps.length; i++) {
if (firstDeps[i] != secondDeps[i]) {
return false;
}
}
return true;
} | java | private static final boolean longMultisetsEqual(long[] firstDeps, long[] secondDeps) {
if (firstDeps.length != secondDeps.length) {
return false;
}
Arrays.sort(firstDeps);
Arrays.sort(secondDeps);
for (int i = 0; i < firstDeps.length; i++) {
if (firstDeps[i] != secondDeps[i]) {
return false;
}
}
return true;
} | [
"private",
"static",
"final",
"boolean",
"longMultisetsEqual",
"(",
"long",
"[",
"]",
"firstDeps",
",",
"long",
"[",
"]",
"secondDeps",
")",
"{",
"if",
"(",
"firstDeps",
".",
"length",
"!=",
"secondDeps",
".",
"length",
")",
"{",
"return",
"false",
";",
... | Checks if two multisets of long numbers contain the same keys
with the same frequency
@param first
@param second
@return | [
"Checks",
"if",
"two",
"multisets",
"of",
"long",
"numbers",
"contain",
"the",
"same",
"keys",
"with",
"the",
"same",
"frequency"
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/chart/CcgExactChart.java#L171-L184 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java | XmlReader.readByte | public byte readByte(byte defaultValue, String attribute)
{
return Byte.parseByte(getValue(String.valueOf(defaultValue), attribute));
} | java | public byte readByte(byte defaultValue, String attribute)
{
return Byte.parseByte(getValue(String.valueOf(defaultValue), attribute));
} | [
"public",
"byte",
"readByte",
"(",
"byte",
"defaultValue",
",",
"String",
"attribute",
")",
"{",
"return",
"Byte",
".",
"parseByte",
"(",
"getValue",
"(",
"String",
".",
"valueOf",
"(",
"defaultValue",
")",
",",
"attribute",
")",
")",
";",
"}"
] | Read a byte.
@param defaultValue The value returned if attribute not found.
@param attribute The integer name (must not be <code>null</code>).
@return The byte value. | [
"Read",
"a",
"byte",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/XmlReader.java#L160-L163 |
mazerty/torii | src/main/java/fr/mazerty/torii/cdi/LanguageProxy.java | LanguageProxy.set | public void set(Language language) {
this.language = language;
Cookie cookie = new Cookie(COOKIE_NAME, language.name());
cookie.setPath("/");
cookie.setMaxAge(Integer.MAX_VALUE);
VaadinService.getCurrentResponse().addCookie(cookie);
} | java | public void set(Language language) {
this.language = language;
Cookie cookie = new Cookie(COOKIE_NAME, language.name());
cookie.setPath("/");
cookie.setMaxAge(Integer.MAX_VALUE);
VaadinService.getCurrentResponse().addCookie(cookie);
} | [
"public",
"void",
"set",
"(",
"Language",
"language",
")",
"{",
"this",
".",
"language",
"=",
"language",
";",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"COOKIE_NAME",
",",
"language",
".",
"name",
"(",
")",
")",
";",
"cookie",
".",
"setPath",
"("... | Saves the new selected language in this session bean and in a cookie for future use
@param language the new selected language | [
"Saves",
"the",
"new",
"selected",
"language",
"in",
"this",
"session",
"bean",
"and",
"in",
"a",
"cookie",
"for",
"future",
"use"
] | train | https://github.com/mazerty/torii/blob/d162dff0a50b9c2b0a6415f6d359562461bf0cf1/src/main/java/fr/mazerty/torii/cdi/LanguageProxy.java#L50-L57 |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java | ChatController.queryEventsRecursively | private Observable<ComapiResult<ConversationEventsResponse>> queryEventsRecursively(final RxComapiClient client, final String conversationId, final long lastEventId, final int count, final List<Boolean> successes) {
return client.service().messaging().queryConversationEvents(conversationId, lastEventId, eventsPerQuery)
.flatMap(result -> processEventsQueryResponse(result, successes))
.flatMap(result -> {
if (result.getResult() != null && result.getResult().getEventsInOrder().size() >= eventsPerQuery && count < maxEventQueries) {
return queryEventsRecursively(client, conversationId, lastEventId + result.getResult().getEventsInOrder().size(), count + 1, successes);
} else {
return Observable.just(result);
}
});
} | java | private Observable<ComapiResult<ConversationEventsResponse>> queryEventsRecursively(final RxComapiClient client, final String conversationId, final long lastEventId, final int count, final List<Boolean> successes) {
return client.service().messaging().queryConversationEvents(conversationId, lastEventId, eventsPerQuery)
.flatMap(result -> processEventsQueryResponse(result, successes))
.flatMap(result -> {
if (result.getResult() != null && result.getResult().getEventsInOrder().size() >= eventsPerQuery && count < maxEventQueries) {
return queryEventsRecursively(client, conversationId, lastEventId + result.getResult().getEventsInOrder().size(), count + 1, successes);
} else {
return Observable.just(result);
}
});
} | [
"private",
"Observable",
"<",
"ComapiResult",
"<",
"ConversationEventsResponse",
">",
">",
"queryEventsRecursively",
"(",
"final",
"RxComapiClient",
"client",
",",
"final",
"String",
"conversationId",
",",
"final",
"long",
"lastEventId",
",",
"final",
"int",
"count",
... | Synchronise missing events for particular conversation.
@param client Foundation client.
@param conversationId Unique ID of a conversation.
@param lastEventId Last known event id - query should start form it.
@param count Number of queries already made.
@param successes list of query & processing results in recursive call.
@return Observable with the merged result of operations. | [
"Synchronise",
"missing",
"events",
"for",
"particular",
"conversation",
"."
] | train | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java#L600-L611 |
hdecarne/java-default | src/main/java/de/carne/util/SystemProperties.java | SystemProperties.booleanValue | public static boolean booleanValue(Class<?> clazz, String key, boolean defaultValue) {
return booleanValue(clazz.getName() + key, defaultValue);
} | java | public static boolean booleanValue(Class<?> clazz, String key, boolean defaultValue) {
return booleanValue(clazz.getName() + key, defaultValue);
} | [
"public",
"static",
"boolean",
"booleanValue",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"return",
"booleanValue",
"(",
"clazz",
".",
"getName",
"(",
")",
"+",
"key",
",",
"defaultValue",
")",
"... | Gets a {@code boolean} system property value.
@param clazz the {@linkplain Class} to derive the property key from.
@param key the system property key (relative to the submitted {@linkplain Class}) to get.
@param defaultValue The default value to return in case the property is not defined.
@return The property value or the submitted default value if the property is not defined. | [
"Gets",
"a",
"{",
"@code",
"boolean",
"}",
"system",
"property",
"value",
"."
] | train | https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/SystemProperties.java#L103-L105 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java | StringSupport.getStackTrace | public static String getStackTrace(Throwable t, int depth, String prefix) {
StringBuffer retval = new StringBuffer();
int nrWritten = 0;
retval.append(t.toString() + " with message: " + t.getMessage());
StackTraceElement[] elements = t.getStackTrace();
for (int i = 0; nrWritten < depth && i < elements.length; i++) {
String line = elements[i].toString();
if (prefix == null || line.startsWith(prefix)) {
retval.append("\n" + line);
nrWritten++;
}
}
return retval.toString();
} | java | public static String getStackTrace(Throwable t, int depth, String prefix) {
StringBuffer retval = new StringBuffer();
int nrWritten = 0;
retval.append(t.toString() + " with message: " + t.getMessage());
StackTraceElement[] elements = t.getStackTrace();
for (int i = 0; nrWritten < depth && i < elements.length; i++) {
String line = elements[i].toString();
if (prefix == null || line.startsWith(prefix)) {
retval.append("\n" + line);
nrWritten++;
}
}
return retval.toString();
} | [
"public",
"static",
"String",
"getStackTrace",
"(",
"Throwable",
"t",
",",
"int",
"depth",
",",
"String",
"prefix",
")",
"{",
"StringBuffer",
"retval",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"nrWritten",
"=",
"0",
";",
"retval",
".",
"append",
... | Retrieves stack trace from throwable.
@param t
@param depth
@param prefix
@return | [
"Retrieves",
"stack",
"trace",
"from",
"throwable",
"."
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L976-L989 |
graphhopper/map-matching | matching-core/src/main/java/com/graphhopper/matching/MapMatching.java | MapMatching.computeViterbiSequence | private List<SequenceState<State, Observation, Path>> computeViterbiSequence(
List<TimeStep<State, Observation, Path>> timeSteps, int originalGpxEntriesCount,
QueryGraph queryGraph) {
final HmmProbabilities probabilities
= new HmmProbabilities(measurementErrorSigma, transitionProbabilityBeta);
final ViterbiAlgorithm<State, Observation, Path> viterbi = new ViterbiAlgorithm<>();
logger.debug("\n=============== Paths ===============");
int timeStepCounter = 0;
TimeStep<State, Observation, Path> prevTimeStep = null;
int i = 1;
for (TimeStep<State, Observation, Path> timeStep : timeSteps) {
logger.debug("\nPaths to time step {}", i++);
computeEmissionProbabilities(timeStep, probabilities);
if (prevTimeStep == null) {
viterbi.startWithInitialObservation(timeStep.observation, timeStep.candidates,
timeStep.emissionLogProbabilities);
} else {
computeTransitionProbabilities(prevTimeStep, timeStep, probabilities, queryGraph);
viterbi.nextStep(timeStep.observation, timeStep.candidates,
timeStep.emissionLogProbabilities, timeStep.transitionLogProbabilities,
timeStep.roadPaths);
}
if (viterbi.isBroken()) {
String likelyReasonStr = "";
if (prevTimeStep != null) {
Observation prevGPXE = prevTimeStep.observation;
Observation gpxe = timeStep.observation;
double dist = distanceCalc.calcDist(prevGPXE.getPoint().lat, prevGPXE.getPoint().lon,
gpxe.getPoint().lat, gpxe.getPoint().lon);
if (dist > 2000) {
likelyReasonStr = "Too long distance to previous measurement? "
+ Math.round(dist) + "m, ";
}
}
throw new IllegalArgumentException("Sequence is broken for submitted track at time step "
+ timeStepCounter + " (" + originalGpxEntriesCount + " points). "
+ likelyReasonStr + "observation:" + timeStep.observation + ", "
+ timeStep.candidates.size() + " candidates: "
+ getSnappedCandidates(timeStep.candidates)
+ ". If a match is expected consider increasing max_visited_nodes.");
}
timeStepCounter++;
prevTimeStep = timeStep;
}
return viterbi.computeMostLikelySequence();
} | java | private List<SequenceState<State, Observation, Path>> computeViterbiSequence(
List<TimeStep<State, Observation, Path>> timeSteps, int originalGpxEntriesCount,
QueryGraph queryGraph) {
final HmmProbabilities probabilities
= new HmmProbabilities(measurementErrorSigma, transitionProbabilityBeta);
final ViterbiAlgorithm<State, Observation, Path> viterbi = new ViterbiAlgorithm<>();
logger.debug("\n=============== Paths ===============");
int timeStepCounter = 0;
TimeStep<State, Observation, Path> prevTimeStep = null;
int i = 1;
for (TimeStep<State, Observation, Path> timeStep : timeSteps) {
logger.debug("\nPaths to time step {}", i++);
computeEmissionProbabilities(timeStep, probabilities);
if (prevTimeStep == null) {
viterbi.startWithInitialObservation(timeStep.observation, timeStep.candidates,
timeStep.emissionLogProbabilities);
} else {
computeTransitionProbabilities(prevTimeStep, timeStep, probabilities, queryGraph);
viterbi.nextStep(timeStep.observation, timeStep.candidates,
timeStep.emissionLogProbabilities, timeStep.transitionLogProbabilities,
timeStep.roadPaths);
}
if (viterbi.isBroken()) {
String likelyReasonStr = "";
if (prevTimeStep != null) {
Observation prevGPXE = prevTimeStep.observation;
Observation gpxe = timeStep.observation;
double dist = distanceCalc.calcDist(prevGPXE.getPoint().lat, prevGPXE.getPoint().lon,
gpxe.getPoint().lat, gpxe.getPoint().lon);
if (dist > 2000) {
likelyReasonStr = "Too long distance to previous measurement? "
+ Math.round(dist) + "m, ";
}
}
throw new IllegalArgumentException("Sequence is broken for submitted track at time step "
+ timeStepCounter + " (" + originalGpxEntriesCount + " points). "
+ likelyReasonStr + "observation:" + timeStep.observation + ", "
+ timeStep.candidates.size() + " candidates: "
+ getSnappedCandidates(timeStep.candidates)
+ ". If a match is expected consider increasing max_visited_nodes.");
}
timeStepCounter++;
prevTimeStep = timeStep;
}
return viterbi.computeMostLikelySequence();
} | [
"private",
"List",
"<",
"SequenceState",
"<",
"State",
",",
"Observation",
",",
"Path",
">",
">",
"computeViterbiSequence",
"(",
"List",
"<",
"TimeStep",
"<",
"State",
",",
"Observation",
",",
"Path",
">",
">",
"timeSteps",
",",
"int",
"originalGpxEntriesCount... | Computes the most likely candidate sequence for the GPX entries. | [
"Computes",
"the",
"most",
"likely",
"candidate",
"sequence",
"for",
"the",
"GPX",
"entries",
"."
] | train | https://github.com/graphhopper/map-matching/blob/32cd83f14cb990c2be83c8781f22dfb59e0dbeb4/matching-core/src/main/java/com/graphhopper/matching/MapMatching.java#L362-L412 |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/TemplateRestEntity.java | TemplateRestEntity.createTemplate | @POST
public Response createTemplate(@Context UriInfo uriInfo, TemplateParam templateParam) throws NotFoundException, ConflictException, InternalException {
logger.debug("StartOf createTemplate - Insert /templates");
TemplateHelperE templateRestHelper = getTemplateHelper();
String id, location = null;
try {
id = templateRestHelper.createTemplate(templateParam.getTemplate(), templateParam.getOriginalSerialzedTemplate());
location = buildResourceLocation(uriInfo.getAbsolutePath().toString() ,id);
} catch (DBMissingHelperException e) {
logger.info("createTemplate ConflictException"+ e.getMessage());
throw new ConflictException(e.getMessage());
} catch (DBExistsHelperException e) {
logger.info("createTemplate ConflictException"+ e.getMessage());
throw new ConflictException(e.getMessage());
} catch (InternalHelperException e) {
logger.info("createTemplate InternalException", e);
throw new InternalException(e.getMessage());
} catch (ParserHelperException e) {
logger.info("createTemplate ParserHelperException", e);
throw new InternalException(e.getMessage());
}
logger.debug("EndOf createTemplate");
return buildResponsePOST(
HttpStatus.CREATED,
createMessage(
HttpStatus.CREATED, id,
"The template has been stored successfully in the SLA Repository Database. It has location "+location),location);
} | java | @POST
public Response createTemplate(@Context UriInfo uriInfo, TemplateParam templateParam) throws NotFoundException, ConflictException, InternalException {
logger.debug("StartOf createTemplate - Insert /templates");
TemplateHelperE templateRestHelper = getTemplateHelper();
String id, location = null;
try {
id = templateRestHelper.createTemplate(templateParam.getTemplate(), templateParam.getOriginalSerialzedTemplate());
location = buildResourceLocation(uriInfo.getAbsolutePath().toString() ,id);
} catch (DBMissingHelperException e) {
logger.info("createTemplate ConflictException"+ e.getMessage());
throw new ConflictException(e.getMessage());
} catch (DBExistsHelperException e) {
logger.info("createTemplate ConflictException"+ e.getMessage());
throw new ConflictException(e.getMessage());
} catch (InternalHelperException e) {
logger.info("createTemplate InternalException", e);
throw new InternalException(e.getMessage());
} catch (ParserHelperException e) {
logger.info("createTemplate ParserHelperException", e);
throw new InternalException(e.getMessage());
}
logger.debug("EndOf createTemplate");
return buildResponsePOST(
HttpStatus.CREATED,
createMessage(
HttpStatus.CREATED, id,
"The template has been stored successfully in the SLA Repository Database. It has location "+location),location);
} | [
"@",
"POST",
"public",
"Response",
"createTemplate",
"(",
"@",
"Context",
"UriInfo",
"uriInfo",
",",
"TemplateParam",
"templateParam",
")",
"throws",
"NotFoundException",
",",
"ConflictException",
",",
"InternalException",
"{",
"logger",
".",
"debug",
"(",
"\"StartO... | Returns the information of an specific template If the template it is not
in the database, it returns 404 with empty payload /** Creates a new
template
<pre>
POST /templates
Request:
POST /templates HTTP/1.1
Accept: application/xml
Response:
HTTP/1.1 201 Created
Content-type: application/xml
Location: http://.../templates/$uuid
{@code
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<message code="201" message= "The template has been stored successfully in the SLA Repository Database"/>
}
</pre>
Example: <li>curl -H "Content-type: application/xml" -X POST -d @template01.xml localhost:8080/sla-service/templates</li>
@return XML information that the template has been created successfully
@throws NotFoundException
@throws ConflictException
@throws InternalException | [
"Returns",
"the",
"information",
"of",
"an",
"specific",
"template",
"If",
"the",
"template",
"it",
"is",
"not",
"in",
"the",
"database",
"it",
"returns",
"404",
"with",
"empty",
"payload",
"/",
"**",
"Creates",
"a",
"new",
"template"
] | train | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/TemplateRestEntity.java#L298-L327 |
scireum/parsii | src/main/java/parsii/tokenizer/Tokenizer.java | Tokenizer.addWarning | public void addWarning(Position pos, String message, Object... parameters) {
getProblemCollector().add(ParseError.warning(pos, String.format(message, parameters)));
} | java | public void addWarning(Position pos, String message, Object... parameters) {
getProblemCollector().add(ParseError.warning(pos, String.format(message, parameters)));
} | [
"public",
"void",
"addWarning",
"(",
"Position",
"pos",
",",
"String",
"message",
",",
"Object",
"...",
"parameters",
")",
"{",
"getProblemCollector",
"(",
")",
".",
"add",
"(",
"ParseError",
".",
"warning",
"(",
"pos",
",",
"String",
".",
"format",
"(",
... | Adds a warning to the internal problem collector.
<p>
A warning indicates an anomaly which might lead to an error but still, the parser can continue to complete its
work.
@param pos the position of the warning. Note that {@link Token} implements {@link Position}.
Therefore the current token is often a good choice for this parameter.
@param message the message to describe the earning. Can contain formatting parameters like %s or %d as
defined by {@link String#format(String, Object...)}
@param parameters Contains the parameters used to format the given message | [
"Adds",
"a",
"warning",
"to",
"the",
"internal",
"problem",
"collector",
".",
"<p",
">",
"A",
"warning",
"indicates",
"an",
"anomaly",
"which",
"might",
"lead",
"to",
"an",
"error",
"but",
"still",
"the",
"parser",
"can",
"continue",
"to",
"complete",
"its... | train | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Tokenizer.java#L814-L816 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java | TenantService.modifyTenant | public TenantDefinition modifyTenant(String tenantName, TenantDefinition newTenantDef) {
checkServiceState();
TenantDefinition oldTenantDef = getTenantDef(tenantName);
Utils.require(oldTenantDef != null, "Tenant '%s' does not exist", tenantName);
modifyTenantProperties(oldTenantDef, newTenantDef);
validateTenantUsers(newTenantDef);
validateTenantUpdate(oldTenantDef, newTenantDef);
storeTenantDefinition(newTenantDef);
DBManagerService.instance().updateTenantDef(newTenantDef);
TenantDefinition updatedTenantDef = getTenantDef(tenantName);
if (updatedTenantDef == null) {
throw new RuntimeException("Tenant definition could not be retrieved after creation: " + tenantName);
}
removeUserHashes(updatedTenantDef);
return updatedTenantDef;
} | java | public TenantDefinition modifyTenant(String tenantName, TenantDefinition newTenantDef) {
checkServiceState();
TenantDefinition oldTenantDef = getTenantDef(tenantName);
Utils.require(oldTenantDef != null, "Tenant '%s' does not exist", tenantName);
modifyTenantProperties(oldTenantDef, newTenantDef);
validateTenantUsers(newTenantDef);
validateTenantUpdate(oldTenantDef, newTenantDef);
storeTenantDefinition(newTenantDef);
DBManagerService.instance().updateTenantDef(newTenantDef);
TenantDefinition updatedTenantDef = getTenantDef(tenantName);
if (updatedTenantDef == null) {
throw new RuntimeException("Tenant definition could not be retrieved after creation: " + tenantName);
}
removeUserHashes(updatedTenantDef);
return updatedTenantDef;
} | [
"public",
"TenantDefinition",
"modifyTenant",
"(",
"String",
"tenantName",
",",
"TenantDefinition",
"newTenantDef",
")",
"{",
"checkServiceState",
"(",
")",
";",
"TenantDefinition",
"oldTenantDef",
"=",
"getTenantDef",
"(",
"tenantName",
")",
";",
"Utils",
".",
"req... | Modify the tenant with the given name to match the given definition, and return the
updated definition.
@param tenantName Name of tenant to be modified.
@param newTenantDef Updated {@link TenantDefinition} to apply to tenant.
@return Updated {@link TenantDefinition}. | [
"Modify",
"the",
"tenant",
"with",
"the",
"given",
"name",
"to",
"match",
"the",
"given",
"definition",
"and",
"return",
"the",
"updated",
"definition",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java#L279-L294 |
CloudSlang/cs-actions | cs-powershell/src/main/java/io/cloudslang/content/utils/WSManUtils.java | WSManUtils.validateUUID | public static void validateUUID(String uuid, String uuidValueOf) throws RuntimeException {
if (!WSManUtils.isUUID(uuid)) {
throw new RuntimeException("The returned " + uuidValueOf + " is not a valid UUID value! " + uuidValueOf + ": " + uuid);
}
} | java | public static void validateUUID(String uuid, String uuidValueOf) throws RuntimeException {
if (!WSManUtils.isUUID(uuid)) {
throw new RuntimeException("The returned " + uuidValueOf + " is not a valid UUID value! " + uuidValueOf + ": " + uuid);
}
} | [
"public",
"static",
"void",
"validateUUID",
"(",
"String",
"uuid",
",",
"String",
"uuidValueOf",
")",
"throws",
"RuntimeException",
"{",
"if",
"(",
"!",
"WSManUtils",
".",
"isUUID",
"(",
"uuid",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"The ... | Validates a UUID value and throws a specific exception if UUID is invalid.
@param uuid The UUID value to validate.
@param uuidValueOf The property associated to the given UUID value.
@throws RuntimeException | [
"Validates",
"a",
"UUID",
"value",
"and",
"throws",
"a",
"specific",
"exception",
"if",
"UUID",
"is",
"invalid",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-powershell/src/main/java/io/cloudslang/content/utils/WSManUtils.java#L118-L122 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/WritableSessionCache.java | WritableSessionCache.rollback | private void rollback(Transaction txn, Exception cause) throws Exception {
try {
txn.rollback();
} catch (Exception e) {
logger.debug(e, "Error while rolling back transaction " + txn);
} finally {
throw cause;
}
} | java | private void rollback(Transaction txn, Exception cause) throws Exception {
try {
txn.rollback();
} catch (Exception e) {
logger.debug(e, "Error while rolling back transaction " + txn);
} finally {
throw cause;
}
} | [
"private",
"void",
"rollback",
"(",
"Transaction",
"txn",
",",
"Exception",
"cause",
")",
"throws",
"Exception",
"{",
"try",
"{",
"txn",
".",
"rollback",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"debug",
"(",
"e",
... | Rolling back given transaction caused by given cause.
@param txn the transaction
@param cause roll back cause
@throws Exception roll back cause. | [
"Rolling",
"back",
"given",
"transaction",
"caused",
"by",
"given",
"cause",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/WritableSessionCache.java#L872-L880 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.