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 |
|---|---|---|---|---|---|---|---|---|---|---|
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/FieldAnnotation.java | FieldAnnotation.fromBCELField | public static FieldAnnotation fromBCELField(@DottedClassName String className, Field field) {
return new FieldAnnotation(className, field.getName(), field.getSignature(), field.isStatic());
} | java | public static FieldAnnotation fromBCELField(@DottedClassName String className, Field field) {
return new FieldAnnotation(className, field.getName(), field.getSignature(), field.isStatic());
} | [
"public",
"static",
"FieldAnnotation",
"fromBCELField",
"(",
"@",
"DottedClassName",
"String",
"className",
",",
"Field",
"field",
")",
"{",
"return",
"new",
"FieldAnnotation",
"(",
"className",
",",
"field",
".",
"getName",
"(",
")",
",",
"field",
".",
"getSi... | Factory method. Construct from class name and BCEL Field object.
@param className
the name of the class which defines the field
@param field
the BCEL Field object
@return the FieldAnnotation | [
"Factory",
"method",
".",
"Construct",
"from",
"class",
"name",
"and",
"BCEL",
"Field",
"object",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FieldAnnotation.java#L159-L161 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/AmountFormats.java | AmountFormats.wordBased | public static String wordBased(Period period, Locale locale) {
Objects.requireNonNull(period, "period must not be null");
Objects.requireNonNull(locale, "locale must not be null");
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
UnitFormat[] formats = {
UnitFormat.of(bundle, WORDBASED_YEAR),
UnitFormat.of(bundle, WORDBASED_MONTH),
UnitFormat.of(bundle, WORDBASED_WEEK),
UnitFormat.of(bundle, WORDBASED_DAY)};
WordBased wb = new WordBased(formats, bundle.getString(WORDBASED_COMMASPACE), bundle.getString(WORDBASED_SPACEANDSPACE));
Period normPeriod = oppositeSigns(period.getMonths(), period.getYears()) ? period.normalized() : period;
int weeks = 0, days = 0;
if (normPeriod.getDays() % DAYS_PER_WEEK == 0) {
weeks = normPeriod.getDays() / DAYS_PER_WEEK;
} else {
days = normPeriod.getDays();
}
int[] values = {normPeriod.getYears(), normPeriod.getMonths(), weeks, days};
return wb.format(values);
} | java | public static String wordBased(Period period, Locale locale) {
Objects.requireNonNull(period, "period must not be null");
Objects.requireNonNull(locale, "locale must not be null");
ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);
UnitFormat[] formats = {
UnitFormat.of(bundle, WORDBASED_YEAR),
UnitFormat.of(bundle, WORDBASED_MONTH),
UnitFormat.of(bundle, WORDBASED_WEEK),
UnitFormat.of(bundle, WORDBASED_DAY)};
WordBased wb = new WordBased(formats, bundle.getString(WORDBASED_COMMASPACE), bundle.getString(WORDBASED_SPACEANDSPACE));
Period normPeriod = oppositeSigns(period.getMonths(), period.getYears()) ? period.normalized() : period;
int weeks = 0, days = 0;
if (normPeriod.getDays() % DAYS_PER_WEEK == 0) {
weeks = normPeriod.getDays() / DAYS_PER_WEEK;
} else {
days = normPeriod.getDays();
}
int[] values = {normPeriod.getYears(), normPeriod.getMonths(), weeks, days};
return wb.format(values);
} | [
"public",
"static",
"String",
"wordBased",
"(",
"Period",
"period",
",",
"Locale",
"locale",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"period",
",",
"\"period must not be null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"locale",
",",
"\"locale ... | Formats a period to a string in a localized word-based format.
<p>
This returns a word-based format for the period.
The year and month are printed as supplied unless the signs differ, in which case they are normalized.
The words are configured in a resource bundle text file -
{@code org.threeten.extra.wordbased.properties} - with overrides per language.
@param period the period to format
@param locale the locale to use
@return the localized word-based format for the period | [
"Formats",
"a",
"period",
"to",
"a",
"string",
"in",
"a",
"localized",
"word",
"-",
"based",
"format",
".",
"<p",
">",
"This",
"returns",
"a",
"word",
"-",
"based",
"format",
"for",
"the",
"period",
".",
"The",
"year",
"and",
"month",
"are",
"printed",... | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/AmountFormats.java#L174-L194 |
h2oai/h2o-3 | h2o-core/src/main/java/water/rapids/Rapids.java | Rapids.parseFunctionDefinition | private AstFunction parseFunctionDefinition() {
eatChar('{');
// Parse the list of ids
ArrayList<String> ids = new ArrayList<>();
ids.add(""); // 1-based ID list
while (skipWS() != '.') {
String id = token();
if (!Character.isJavaIdentifierStart(id.charAt(0)))
throw new IllegalASTException("variable must be a valid Java identifier: " + id);
for (char c : id.toCharArray())
if (!Character.isJavaIdentifierPart(c))
throw new IllegalASTException("variable must be a valid Java identifier: " + id);
ids.add(id);
}
// Single dot separates the list of ids from the body of the function
eatChar('.');
// Parse the body
AstRoot body = parseNext();
if (skipWS() != '}')
throw new IllegalASTException("Expected the end of the function, but found '" + peek(0) + "'");
eatChar('}');
return new AstFunction(ids, body);
} | java | private AstFunction parseFunctionDefinition() {
eatChar('{');
// Parse the list of ids
ArrayList<String> ids = new ArrayList<>();
ids.add(""); // 1-based ID list
while (skipWS() != '.') {
String id = token();
if (!Character.isJavaIdentifierStart(id.charAt(0)))
throw new IllegalASTException("variable must be a valid Java identifier: " + id);
for (char c : id.toCharArray())
if (!Character.isJavaIdentifierPart(c))
throw new IllegalASTException("variable must be a valid Java identifier: " + id);
ids.add(id);
}
// Single dot separates the list of ids from the body of the function
eatChar('.');
// Parse the body
AstRoot body = parseNext();
if (skipWS() != '}')
throw new IllegalASTException("Expected the end of the function, but found '" + peek(0) + "'");
eatChar('}');
return new AstFunction(ids, body);
} | [
"private",
"AstFunction",
"parseFunctionDefinition",
"(",
")",
"{",
"eatChar",
"(",
"'",
"'",
")",
";",
"// Parse the list of ids",
"ArrayList",
"<",
"String",
">",
"ids",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"ids",
".",
"add",
"(",
"\"\"",
")",
... | Parse and return a user defined function of the form "{arg1 arg2 . (expr)}" | [
"Parse",
"and",
"return",
"a",
"user",
"defined",
"function",
"of",
"the",
"form",
"{",
"arg1",
"arg2",
".",
"(",
"expr",
")",
"}"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/Rapids.java#L183-L209 |
duraspace/fcrepo-cloudsync | fcrepo-cloudsync-service/src/main/java/org/duraspace/fcrepo/cloudsync/service/util/StringUtil.java | StringUtil.validate | public static String validate(String name, String value, int maxLen)
throws IllegalArgumentException {
String normVal = normalize(value);
if (normVal == null) {
throw new IllegalArgumentException("A value must be specified for"
+ " '" + name + "'");
} else if (normVal.length() > maxLen) {
throw new IllegalArgumentException("The value specified for"
+ " '" + name + "' was too long. It must not exceed"
+ " " + maxLen + " characters.");
}
return normVal;
} | java | public static String validate(String name, String value, int maxLen)
throws IllegalArgumentException {
String normVal = normalize(value);
if (normVal == null) {
throw new IllegalArgumentException("A value must be specified for"
+ " '" + name + "'");
} else if (normVal.length() > maxLen) {
throw new IllegalArgumentException("The value specified for"
+ " '" + name + "' was too long. It must not exceed"
+ " " + maxLen + " characters.");
}
return normVal;
} | [
"public",
"static",
"String",
"validate",
"(",
"String",
"name",
",",
"String",
"value",
",",
"int",
"maxLen",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"normVal",
"=",
"normalize",
"(",
"value",
")",
";",
"if",
"(",
"normVal",
"==",
"null",
... | Checks that the given value's normalized length is in the allowed range.
@param name the name of the property being checked, for error reporting.
@param value the value.
@param maxLen the maximum length allowed.
@return the normalized value.
@throws IllegalArgumentException if the normalized value is null,
zero-length, or exceeds the maximum length specified. | [
"Checks",
"that",
"the",
"given",
"value",
"s",
"normalized",
"length",
"is",
"in",
"the",
"allowed",
"range",
"."
] | train | https://github.com/duraspace/fcrepo-cloudsync/blob/2d90e2c9c84a827f2605607ff40e116c67eff9b9/fcrepo-cloudsync-service/src/main/java/org/duraspace/fcrepo/cloudsync/service/util/StringUtil.java#L29-L41 |
wcm-io-caravan/caravan-hal | docs/src/main/java/io/wcm/caravan/hal/docs/impl/TemplateRenderer.java | TemplateRenderer.renderServiceHtml | public String renderServiceHtml(io.wcm.caravan.hal.docs.impl.model.Service service) throws IOException {
Map<String, Object> model = ImmutableMap.<String, Object>builder()
.put("service", service)
.build();
return render(service, model, serviceTemplate);
} | java | public String renderServiceHtml(io.wcm.caravan.hal.docs.impl.model.Service service) throws IOException {
Map<String, Object> model = ImmutableMap.<String, Object>builder()
.put("service", service)
.build();
return render(service, model, serviceTemplate);
} | [
"public",
"String",
"renderServiceHtml",
"(",
"io",
".",
"wcm",
".",
"caravan",
".",
"hal",
".",
"docs",
".",
"impl",
".",
"model",
".",
"Service",
"service",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"model",
"=",
"I... | Generate HTML file for service.
@param service Service
@return Rendered markup
@throws IOException | [
"Generate",
"HTML",
"file",
"for",
"service",
"."
] | train | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs/src/main/java/io/wcm/caravan/hal/docs/impl/TemplateRenderer.java#L69-L74 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphicsGLRegisterBuffer | public static int cuGraphicsGLRegisterBuffer(CUgraphicsResource pCudaResource, int buffer, int Flags)
{
return checkResult(cuGraphicsGLRegisterBufferNative(pCudaResource, buffer, Flags));
} | java | public static int cuGraphicsGLRegisterBuffer(CUgraphicsResource pCudaResource, int buffer, int Flags)
{
return checkResult(cuGraphicsGLRegisterBufferNative(pCudaResource, buffer, Flags));
} | [
"public",
"static",
"int",
"cuGraphicsGLRegisterBuffer",
"(",
"CUgraphicsResource",
"pCudaResource",
",",
"int",
"buffer",
",",
"int",
"Flags",
")",
"{",
"return",
"checkResult",
"(",
"cuGraphicsGLRegisterBufferNative",
"(",
"pCudaResource",
",",
"buffer",
",",
"Flags... | Registers an OpenGL buffer object.
<pre>
CUresult cuGraphicsGLRegisterBuffer (
CUgraphicsResource* pCudaResource,
GLuint buffer,
unsigned int Flags )
</pre>
<div>
<p>Registers an OpenGL buffer object.
Registers the buffer object specified by <tt>buffer</tt> for access
by CUDA. A handle to the registered object is returned as <tt>pCudaResource</tt>. The register flags <tt>Flags</tt> specify the
intended usage, as follows:
</p>
<ul>
<li>
<p>CU_GRAPHICS_REGISTER_FLAGS_NONE:
Specifies no hints about how this resource will be used. It is therefore
assumed that this
resource will be read from and
written to by CUDA. This is the default value.
</p>
</li>
<li>
<p>CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY:
Specifies that CUDA will not write to this resource.
</p>
</li>
<li>
<p>CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD: Specifies that CUDA will
not read from this resource and will write over the entire
contents of the resource, so
none of the data previously stored in the resource will be preserved.
</p>
</li>
</ul>
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param pCudaResource Pointer to the returned object handle
@param buffer name of buffer object to be registered
@param Flags Register flags
@return CUDA_SUCCESS, CUDA_ERROR_INVALID_HANDLE, CUDA_ERROR_ALREADY_MAPPED,
CUDA_ERROR_INVALID_CONTEXT,
@see JCudaDriver#cuGraphicsUnregisterResource
@see JCudaDriver#cuGraphicsMapResources
@see JCudaDriver#cuGraphicsResourceGetMappedPointer | [
"Registers",
"an",
"OpenGL",
"buffer",
"object",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L15252-L15255 |
jbundle/jbundle | thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java | JAltGridScreen.addGridHeading | public void addGridHeading()
{
JPanel panel = new JPanel();
panel.setOpaque(false);
panel.setAlignmentX(LEFT_ALIGNMENT);
panel.setAlignmentY(TOP_ALIGNMENT);
this.add(panel);
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
m_rgcompHeadings = new JLabel[this.getModel().getColumnCount()];
for (int iColumnIndex = 0; iColumnIndex < m_rgcompHeadings.length; iColumnIndex++)
{
panel.add(m_rgcompHeadings[iColumnIndex] = new JLabel(this.getModel().getColumnName(iColumnIndex) + " "));
}
} | java | public void addGridHeading()
{
JPanel panel = new JPanel();
panel.setOpaque(false);
panel.setAlignmentX(LEFT_ALIGNMENT);
panel.setAlignmentY(TOP_ALIGNMENT);
this.add(panel);
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
m_rgcompHeadings = new JLabel[this.getModel().getColumnCount()];
for (int iColumnIndex = 0; iColumnIndex < m_rgcompHeadings.length; iColumnIndex++)
{
panel.add(m_rgcompHeadings[iColumnIndex] = new JLabel(this.getModel().getColumnName(iColumnIndex) + " "));
}
} | [
"public",
"void",
"addGridHeading",
"(",
")",
"{",
"JPanel",
"panel",
"=",
"new",
"JPanel",
"(",
")",
";",
"panel",
".",
"setOpaque",
"(",
"false",
")",
";",
"panel",
".",
"setAlignmentX",
"(",
"LEFT_ALIGNMENT",
")",
";",
"panel",
".",
"setAlignmentY",
"... | Add the column <quantity> <description> headings to the grid panel. | [
"Add",
"the",
"column",
"<quantity",
">",
"<description",
">",
"headings",
"to",
"the",
"grid",
"panel",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/opt/JAltGridScreen.java#L171-L185 |
canoo/open-dolphin | subprojects/server/src/main/groovy/org/opendolphin/server/adapter/DolphinServlet.java | DolphinServlet.createServerConnector | protected ServerConnector createServerConnector(ServerModelStore modelStore, Codec codec) {
ServerConnector connector = new ServerConnector();
connector.setServerModelStore(modelStore);
connector.setCodec(codec);
return connector;
} | java | protected ServerConnector createServerConnector(ServerModelStore modelStore, Codec codec) {
ServerConnector connector = new ServerConnector();
connector.setServerModelStore(modelStore);
connector.setCodec(codec);
return connector;
} | [
"protected",
"ServerConnector",
"createServerConnector",
"(",
"ServerModelStore",
"modelStore",
",",
"Codec",
"codec",
")",
"{",
"ServerConnector",
"connector",
"=",
"new",
"ServerConnector",
"(",
")",
";",
"connector",
".",
"setServerModelStore",
"(",
"modelStore",
"... | Creates a new {@code ServerConnector}.
Subclasses may override this method to customize how this instance should be created.
@param modelStore - the {@code ServerModelStore} to be attached to the {@code ServerConnector}.
@param codec - the {@code Codec} to be attached to the {@code ServerConnector}.
@return a freshly created {@code ServerConnector}. | [
"Creates",
"a",
"new",
"{",
"@code",
"ServerConnector",
"}",
".",
"Subclasses",
"may",
"override",
"this",
"method",
"to",
"customize",
"how",
"this",
"instance",
"should",
"be",
"created",
"."
] | train | https://github.com/canoo/open-dolphin/blob/50166defc3ef2de473d7a7246c32dc04304d80ef/subprojects/server/src/main/groovy/org/opendolphin/server/adapter/DolphinServlet.java#L281-L286 |
alkacon/opencms-core | src/org/opencms/ade/galleries/CmsGalleryService.java | CmsGalleryService.convertNavigationTreeToBean | private CmsSitemapEntryBean convertNavigationTreeToBean(CmsObject cms, NavigationNode node, boolean isRoot) {
CmsSitemapEntryBean bean = null;
try {
bean = prepareSitemapEntry(cms, node.getNavElement(), isRoot, false);
bean.setSearchMatch(node.isMatch());
List<NavigationNode> children = node.getChildren();
List<CmsSitemapEntryBean> childBeans = Lists.newArrayList();
if (children.size() > 0) {
for (NavigationNode child : children) {
childBeans.add(convertNavigationTreeToBean(cms, child, false));
}
} else if (node.isLeaf()) {
childBeans = Lists.newArrayList();
} else {
// no children in filter result, but can still load children by clicking on tree item
childBeans = null;
}
bean.setChildren(childBeans);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
return bean;
} | java | private CmsSitemapEntryBean convertNavigationTreeToBean(CmsObject cms, NavigationNode node, boolean isRoot) {
CmsSitemapEntryBean bean = null;
try {
bean = prepareSitemapEntry(cms, node.getNavElement(), isRoot, false);
bean.setSearchMatch(node.isMatch());
List<NavigationNode> children = node.getChildren();
List<CmsSitemapEntryBean> childBeans = Lists.newArrayList();
if (children.size() > 0) {
for (NavigationNode child : children) {
childBeans.add(convertNavigationTreeToBean(cms, child, false));
}
} else if (node.isLeaf()) {
childBeans = Lists.newArrayList();
} else {
// no children in filter result, but can still load children by clicking on tree item
childBeans = null;
}
bean.setChildren(childBeans);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
return bean;
} | [
"private",
"CmsSitemapEntryBean",
"convertNavigationTreeToBean",
"(",
"CmsObject",
"cms",
",",
"NavigationNode",
"node",
",",
"boolean",
"isRoot",
")",
"{",
"CmsSitemapEntryBean",
"bean",
"=",
"null",
";",
"try",
"{",
"bean",
"=",
"prepareSitemapEntry",
"(",
"cms",
... | Helper method to construct a sitemap entry bean for the sitemap tab filter functionality.<p>
@param cms the CMS context
@param node the root node of the filtered tree
@param isRoot true if this is the root node
@return the sitemap entry bean | [
"Helper",
"method",
"to",
"construct",
"a",
"sitemap",
"entry",
"bean",
"for",
"the",
"sitemap",
"tab",
"filter",
"functionality",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L1940-L1964 |
twilio/twilio-java | src/main/java/com/twilio/rest/api/v2010/account/AvailablePhoneNumberCountryReader.java | AvailablePhoneNumberCountryReader.nextPage | @Override
public Page<AvailablePhoneNumberCountry> nextPage(final Page<AvailablePhoneNumberCountry> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getNextPageUrl(
Domains.API.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | java | @Override
public Page<AvailablePhoneNumberCountry> nextPage(final Page<AvailablePhoneNumberCountry> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getNextPageUrl(
Domains.API.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | [
"@",
"Override",
"public",
"Page",
"<",
"AvailablePhoneNumberCountry",
">",
"nextPage",
"(",
"final",
"Page",
"<",
"AvailablePhoneNumberCountry",
">",
"page",
",",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
... | Retrieve the next page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Next Page | [
"Retrieve",
"the",
"next",
"page",
"from",
"the",
"Twilio",
"API",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/api/v2010/account/AvailablePhoneNumberCountryReader.java#L99-L110 |
Quickhull3d/quickhull3d | src/main/java/com/github/quickhull3d/VertexList.java | VertexList.insertBefore | public void insertBefore(Vertex vtx, Vertex next) {
vtx.prev = next.prev;
if (next.prev == null) {
head = vtx;
} else {
next.prev.next = vtx;
}
vtx.next = next;
next.prev = vtx;
} | java | public void insertBefore(Vertex vtx, Vertex next) {
vtx.prev = next.prev;
if (next.prev == null) {
head = vtx;
} else {
next.prev.next = vtx;
}
vtx.next = next;
next.prev = vtx;
} | [
"public",
"void",
"insertBefore",
"(",
"Vertex",
"vtx",
",",
"Vertex",
"next",
")",
"{",
"vtx",
".",
"prev",
"=",
"next",
".",
"prev",
";",
"if",
"(",
"next",
".",
"prev",
"==",
"null",
")",
"{",
"head",
"=",
"vtx",
";",
"}",
"else",
"{",
"next",... | Inserts a vertex into this list before another specificed vertex. | [
"Inserts",
"a",
"vertex",
"into",
"this",
"list",
"before",
"another",
"specificed",
"vertex",
"."
] | train | https://github.com/Quickhull3d/quickhull3d/blob/3f80953b86c46385e84730e5d2a1745cbfa12703/src/main/java/com/github/quickhull3d/VertexList.java#L113-L122 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java | ComparableExtensions.operator_greaterThan | @Pure /* not guaranteed, since compareTo() is invoked */
@Inline("($1.compareTo($2) > 0)")
public static <C> boolean operator_greaterThan(Comparable<? super C> left, C right) {
return left.compareTo(right) > 0;
} | java | @Pure /* not guaranteed, since compareTo() is invoked */
@Inline("($1.compareTo($2) > 0)")
public static <C> boolean operator_greaterThan(Comparable<? super C> left, C right) {
return left.compareTo(right) > 0;
} | [
"@",
"Pure",
"/* not guaranteed, since compareTo() is invoked */",
"@",
"Inline",
"(",
"\"($1.compareTo($2) > 0)\"",
")",
"public",
"static",
"<",
"C",
">",
"boolean",
"operator_greaterThan",
"(",
"Comparable",
"<",
"?",
"super",
"C",
">",
"left",
",",
"C",
"right",... | The comparison operator <code>greater than</code>.
@param left
a comparable
@param right
the value to compare with
@return <code>left.compareTo(right) > 0</code> | [
"The",
"comparison",
"operator",
"<code",
">",
"greater",
"than<",
"/",
"code",
">",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java#L44-L48 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java | OrganizationResource.getCorporateGroupIdPrefix | @GET
@Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON})
@Path("/{name}" + ServerAPI.GET_CORPORATE_GROUPIDS)
public Response getCorporateGroupIdPrefix(@PathParam("name") final String organizationId){
LOG.info("Got a get corporate groupId prefix request for organization " + organizationId +".");
final ListView view = new ListView("Organization " + organizationId, "Corporate GroupId Prefix");
final List<String> corporateGroupIds = getOrganizationHandler().getCorporateGroupIds(organizationId);
view.addAll(corporateGroupIds);
return Response.ok(view).build();
} | java | @GET
@Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON})
@Path("/{name}" + ServerAPI.GET_CORPORATE_GROUPIDS)
public Response getCorporateGroupIdPrefix(@PathParam("name") final String organizationId){
LOG.info("Got a get corporate groupId prefix request for organization " + organizationId +".");
final ListView view = new ListView("Organization " + organizationId, "Corporate GroupId Prefix");
final List<String> corporateGroupIds = getOrganizationHandler().getCorporateGroupIds(organizationId);
view.addAll(corporateGroupIds);
return Response.ok(view).build();
} | [
"@",
"GET",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"TEXT_HTML",
",",
"MediaType",
".",
"APPLICATION_JSON",
"}",
")",
"@",
"Path",
"(",
"\"/{name}\"",
"+",
"ServerAPI",
".",
"GET_CORPORATE_GROUPIDS",
")",
"public",
"Response",
"getCorporateGroupIdPrefix",
"... | Return the list of corporate GroupId prefix configured for an organization.
@param organizationId String Organization name
@return Response A list of corporate groupId prefix in HTML or JSON | [
"Return",
"the",
"list",
"of",
"corporate",
"GroupId",
"prefix",
"configured",
"for",
"an",
"organization",
"."
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java#L128-L139 |
VoltDB/voltdb | examples/geospatial/client/geospatial/AdBrokerBenchmark.java | AdBrokerBenchmark.connectToOneServerWithRetry | static void connectToOneServerWithRetry(Client client, String server) {
int sleep = 1000;
while (true) {
try {
client.createConnection(server);
break;
}
catch (Exception e) {
System.err.printf("Connection failed - retrying in %d second(s).\n", sleep / 1000);
try { Thread.sleep(sleep); } catch (Exception interruted) {}
if (sleep < 8000) sleep += sleep;
}
}
System.out.printf("Connected to VoltDB node at: %s.\n", server);
} | java | static void connectToOneServerWithRetry(Client client, String server) {
int sleep = 1000;
while (true) {
try {
client.createConnection(server);
break;
}
catch (Exception e) {
System.err.printf("Connection failed - retrying in %d second(s).\n", sleep / 1000);
try { Thread.sleep(sleep); } catch (Exception interruted) {}
if (sleep < 8000) sleep += sleep;
}
}
System.out.printf("Connected to VoltDB node at: %s.\n", server);
} | [
"static",
"void",
"connectToOneServerWithRetry",
"(",
"Client",
"client",
",",
"String",
"server",
")",
"{",
"int",
"sleep",
"=",
"1000",
";",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"client",
".",
"createConnection",
"(",
"server",
")",
";",
"break",
... | Connect to a single server with retry. Limited exponential backoff.
No timeout. This will run until the process is killed if it's not
able to connect.
@param server hostname:port or just hostname (hostname can be ip). | [
"Connect",
"to",
"a",
"single",
"server",
"with",
"retry",
".",
"Limited",
"exponential",
"backoff",
".",
"No",
"timeout",
".",
"This",
"will",
"run",
"until",
"the",
"process",
"is",
"killed",
"if",
"it",
"s",
"not",
"able",
"to",
"connect",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/examples/geospatial/client/geospatial/AdBrokerBenchmark.java#L200-L214 |
lukas-krecan/JsonUnit | json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java | JsonUnitResultMatchers.isEqualTo | public ResultMatcher isEqualTo(final Object expected) {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
Diff diff = createDiff(expected, actual);
diff.failIfDifferent();
}
};
} | java | public ResultMatcher isEqualTo(final Object expected) {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
Diff diff = createDiff(expected, actual);
diff.failIfDifferent();
}
};
} | [
"public",
"ResultMatcher",
"isEqualTo",
"(",
"final",
"Object",
"expected",
")",
"{",
"return",
"new",
"AbstractResultMatcher",
"(",
"path",
",",
"configuration",
")",
"{",
"public",
"void",
"doMatch",
"(",
"Object",
"actual",
")",
"{",
"Diff",
"diff",
"=",
... | Compares JSON for equality. The expected object is converted to JSON
before comparison. Ignores order of sibling nodes and whitespaces.
<p/>
Please note that if you pass a String, it's parsed as JSON which can lead to an
unexpected behavior. If you pass in "1" it is parsed as a JSON containing
integer 1. If you compare it with a string it fails due to a different type.
If you want to pass in real string you have to quote it "\"1\"" or use
{@link #isStringEqualTo(String)}.
<p/>
If the string parameter is not a valid JSON, it is quoted automatically.
@param expected
@return {@code this} object.
@see #isStringEqualTo(String) | [
"Compares",
"JSON",
"for",
"equality",
".",
"The",
"expected",
"object",
"is",
"converted",
"to",
"JSON",
"before",
"comparison",
".",
"Ignores",
"order",
"of",
"sibling",
"nodes",
"and",
"whitespaces",
".",
"<p",
"/",
">",
"Please",
"note",
"that",
"if",
... | train | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L96-L103 |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HelloREEFHttp.java | HelloREEFHttp.runHelloReef | public static LauncherStatus runHelloReef(final Configuration runtimeConf, final int timeOut)
throws BindException, InjectionException {
final Configuration driverConf =
Configurations.merge(HelloREEFHttp.getDriverConfiguration(), getHTTPConfiguration());
return DriverLauncher.getLauncher(runtimeConf).run(driverConf, timeOut);
} | java | public static LauncherStatus runHelloReef(final Configuration runtimeConf, final int timeOut)
throws BindException, InjectionException {
final Configuration driverConf =
Configurations.merge(HelloREEFHttp.getDriverConfiguration(), getHTTPConfiguration());
return DriverLauncher.getLauncher(runtimeConf).run(driverConf, timeOut);
} | [
"public",
"static",
"LauncherStatus",
"runHelloReef",
"(",
"final",
"Configuration",
"runtimeConf",
",",
"final",
"int",
"timeOut",
")",
"throws",
"BindException",
",",
"InjectionException",
"{",
"final",
"Configuration",
"driverConf",
"=",
"Configurations",
".",
"mer... | Run Hello Reef with merged configuration.
@param runtimeConf
@param timeOut
@return
@throws BindException
@throws InjectionException | [
"Run",
"Hello",
"Reef",
"with",
"merged",
"configuration",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HelloREEFHttp.java#L97-L102 |
nominanuda/zen-project | zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java | HtmlUnitRegExpProxy.action | @Override
public Object action(final Context cx, final Scriptable scope,
final Scriptable thisObj, final Object[] args, final int actionType) {
try {
return doAction(cx, scope, thisObj, args, actionType);
} catch (final StackOverflowError e) {
// TODO: We shouldn't have to catch this exception and fall back to
// Rhino's regex support!
// See HtmlUnitRegExpProxyTest.stackOverflow()
return wrapped_.action(cx, scope, thisObj, args, actionType);
}
} | java | @Override
public Object action(final Context cx, final Scriptable scope,
final Scriptable thisObj, final Object[] args, final int actionType) {
try {
return doAction(cx, scope, thisObj, args, actionType);
} catch (final StackOverflowError e) {
// TODO: We shouldn't have to catch this exception and fall back to
// Rhino's regex support!
// See HtmlUnitRegExpProxyTest.stackOverflow()
return wrapped_.action(cx, scope, thisObj, args, actionType);
}
} | [
"@",
"Override",
"public",
"Object",
"action",
"(",
"final",
"Context",
"cx",
",",
"final",
"Scriptable",
"scope",
",",
"final",
"Scriptable",
"thisObj",
",",
"final",
"Object",
"[",
"]",
"args",
",",
"final",
"int",
"actionType",
")",
"{",
"try",
"{",
"... | Use the wrapped proxy except for replacement with string arg where it
uses Java regular expression. {@inheritDoc} | [
"Use",
"the",
"wrapped",
"proxy",
"except",
"for",
"replacement",
"with",
"string",
"arg",
"where",
"it",
"uses",
"Java",
"regular",
"expression",
".",
"{"
] | train | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java#L52-L63 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuStringUtil.java | GosuStringUtil.containsOnly | public static boolean containsOnly(String str, String validChars) {
if (str == null || validChars == null) {
return false;
}
return containsOnly(str, validChars.toCharArray());
} | java | public static boolean containsOnly(String str, String validChars) {
if (str == null || validChars == null) {
return false;
}
return containsOnly(str, validChars.toCharArray());
} | [
"public",
"static",
"boolean",
"containsOnly",
"(",
"String",
"str",
",",
"String",
"validChars",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"validChars",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"containsOnly",
"(",
"str",
","... | <p>Checks if the String contains only certain characters.</p>
<p>A <code>null</code> String will return <code>false</code>.
A <code>null</code> valid character String will return <code>false</code>.
An empty String ("") always returns <code>true</code>.</p>
<pre>
GosuStringUtil.containsOnly(null, *) = false
GosuStringUtil.containsOnly(*, null) = false
GosuStringUtil.containsOnly("", *) = true
GosuStringUtil.containsOnly("ab", "") = false
GosuStringUtil.containsOnly("abab", "abc") = true
GosuStringUtil.containsOnly("ab1", "abc") = false
GosuStringUtil.containsOnly("abz", "abc") = false
</pre>
@param str the String to check, may be null
@param validChars a String of valid chars, may be null
@return true if it only contains valid chars and is non-null
@since 2.0 | [
"<p",
">",
"Checks",
"if",
"the",
"String",
"contains",
"only",
"certain",
"characters",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L1318-L1323 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_summary_GET | public OvhDomainSummary domain_summary_GET(String domain) throws IOException {
String qPath = "/email/domain/{domain}/summary";
StringBuilder sb = path(qPath, domain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDomainSummary.class);
} | java | public OvhDomainSummary domain_summary_GET(String domain) throws IOException {
String qPath = "/email/domain/{domain}/summary";
StringBuilder sb = path(qPath, domain);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhDomainSummary.class);
} | [
"public",
"OvhDomainSummary",
"domain_summary_GET",
"(",
"String",
"domain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/summary\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"domain",
")",
";",
"String",
... | Summary for this domain
REST: GET /email/domain/{domain}/summary
@param domain [required] Name of your domain name | [
"Summary",
"for",
"this",
"domain"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1088-L1093 |
JosePaumard/streams-utils | src/main/java/org/paumard/streams/StreamsUtils.java | StreamsUtils.filteringMaxValues | public static <E extends Comparable<? super E>> Stream<E> filteringMaxValues(Stream<E> stream, int numberOfMaxes) {
return filteringMaxValues(stream, numberOfMaxes, Comparator.naturalOrder());
} | java | public static <E extends Comparable<? super E>> Stream<E> filteringMaxValues(Stream<E> stream, int numberOfMaxes) {
return filteringMaxValues(stream, numberOfMaxes, Comparator.naturalOrder());
} | [
"public",
"static",
"<",
"E",
"extends",
"Comparable",
"<",
"?",
"super",
"E",
">",
">",
"Stream",
"<",
"E",
">",
"filteringMaxValues",
"(",
"Stream",
"<",
"E",
">",
"stream",
",",
"int",
"numberOfMaxes",
")",
"{",
"return",
"filteringMaxValues",
"(",
"s... | <p>Generates a stream composed of the N greatest values of the provided stream, compared using the
natural order. This method calls the <code>filteringMaxValues()</code> with the natural order comparator,
please refer to this javadoc for details. . </p>
<p>A <code>NullPointerException</code> will be thrown if the provided stream. </p>
<p>An <code>IllegalArgumentException</code> is thrown if N is lesser than 1. </p>
@param stream the processed stream
@param numberOfMaxes the number of different max values that should be returned. Note that the total number of
values returned may be larger if there are duplicates in the stream
@param <E> the type of the provided stream
@return the filtered stream | [
"<p",
">",
"Generates",
"a",
"stream",
"composed",
"of",
"the",
"N",
"greatest",
"values",
"of",
"the",
"provided",
"stream",
"compared",
"using",
"the",
"natural",
"order",
".",
"This",
"method",
"calls",
"the",
"<code",
">",
"filteringMaxValues",
"()",
"<"... | train | https://github.com/JosePaumard/streams-utils/blob/56152574af0aca44c5f679761202a8f90984ab73/src/main/java/org/paumard/streams/StreamsUtils.java#L1007-L1010 |
bazaarvoice/emodb | common/astyanax/src/main/java/com/bazaarvoice/emodb/common/cassandra/cqldriver/AdaptiveResultSet.java | AdaptiveResultSet.executeAdaptiveQueryAsync | public static ListenableFuture<ResultSet> executeAdaptiveQueryAsync(Session session, Statement statement, int fetchSize) {
return executeAdaptiveQueryAsync(session, statement, fetchSize, MAX_ADAPTATIONS);
} | java | public static ListenableFuture<ResultSet> executeAdaptiveQueryAsync(Session session, Statement statement, int fetchSize) {
return executeAdaptiveQueryAsync(session, statement, fetchSize, MAX_ADAPTATIONS);
} | [
"public",
"static",
"ListenableFuture",
"<",
"ResultSet",
">",
"executeAdaptiveQueryAsync",
"(",
"Session",
"session",
",",
"Statement",
"statement",
",",
"int",
"fetchSize",
")",
"{",
"return",
"executeAdaptiveQueryAsync",
"(",
"session",
",",
"statement",
",",
"fe... | Executes a query asychronously, dynamically adjusting the fetch size down if necessary. | [
"Executes",
"a",
"query",
"asychronously",
"dynamically",
"adjusting",
"the",
"fetch",
"size",
"down",
"if",
"necessary",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/astyanax/src/main/java/com/bazaarvoice/emodb/common/cassandra/cqldriver/AdaptiveResultSet.java#L51-L53 |
datacleaner/DataCleaner | engine/xml-config/src/main/java/org/datacleaner/configuration/JaxbConfigurationReader.java | JaxbConfigurationReader.createCustomElement | private <E> E createCustomElement(final CustomElementType customElementType, final Class<E> expectedClazz,
final DataCleanerConfiguration configuration, final boolean initialize) {
final InjectionManager injectionManager =
configuration.getEnvironment().getInjectionManagerFactory().getInjectionManager(configuration);
return createCustomElementInternal(customElementType, expectedClazz, injectionManager, initialize);
} | java | private <E> E createCustomElement(final CustomElementType customElementType, final Class<E> expectedClazz,
final DataCleanerConfiguration configuration, final boolean initialize) {
final InjectionManager injectionManager =
configuration.getEnvironment().getInjectionManagerFactory().getInjectionManager(configuration);
return createCustomElementInternal(customElementType, expectedClazz, injectionManager, initialize);
} | [
"private",
"<",
"E",
">",
"E",
"createCustomElement",
"(",
"final",
"CustomElementType",
"customElementType",
",",
"final",
"Class",
"<",
"E",
">",
"expectedClazz",
",",
"final",
"DataCleanerConfiguration",
"configuration",
",",
"final",
"boolean",
"initialize",
")"... | Creates a custom component based on an element which specified just a class name and an optional set of
properties.
@param <E>
@param customElementType the JAXB custom element type
@param expectedClazz an expected class or interface that the component should honor
@param configuration the DataCleaner configuration (may be temporary) in use
@param initialize whether or not to call any initialize methods on the component (reference data should not be
initialized, while eg. custom task runners support this.
@return the custom component | [
"Creates",
"a",
"custom",
"component",
"based",
"on",
"an",
"element",
"which",
"specified",
"just",
"a",
"class",
"name",
"and",
"an",
"optional",
"set",
"of",
"properties",
"."
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/xml-config/src/main/java/org/datacleaner/configuration/JaxbConfigurationReader.java#L1563-L1568 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.restartWebAppsAsync | public Observable<Void> restartWebAppsAsync(String resourceGroupName, String name) {
return restartWebAppsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> restartWebAppsAsync(String resourceGroupName, String name) {
return restartWebAppsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"restartWebAppsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"restartWebAppsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"map",
"(",
"new",
"Func1",
"... | Restart all apps in an App Service plan.
Restart all apps in an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Restart",
"all",
"apps",
"in",
"an",
"App",
"Service",
"plan",
".",
"Restart",
"all",
"apps",
"in",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L2222-L2229 |
raydac/java-comment-preprocessor | jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java | PreprocessorContext.setLocalVariable | @Nonnull
public PreprocessorContext setLocalVariable(@Nonnull final String name, @Nonnull final Value value) {
assertNotNull("Variable name is null", name);
assertNotNull("Value is null", value);
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.isEmpty()) {
throw makeException("Not defined variable name", null);
}
if (mapVariableNameToSpecialVarProcessor.containsKey(normalized) || globalVarTable.containsKey(normalized)) {
throw makeException("Attempting to set either a global variable or a special variable as a local one [" + normalized + ']', null);
}
localVarTable.put(normalized, value);
return this;
} | java | @Nonnull
public PreprocessorContext setLocalVariable(@Nonnull final String name, @Nonnull final Value value) {
assertNotNull("Variable name is null", name);
assertNotNull("Value is null", value);
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.isEmpty()) {
throw makeException("Not defined variable name", null);
}
if (mapVariableNameToSpecialVarProcessor.containsKey(normalized) || globalVarTable.containsKey(normalized)) {
throw makeException("Attempting to set either a global variable or a special variable as a local one [" + normalized + ']', null);
}
localVarTable.put(normalized, value);
return this;
} | [
"@",
"Nonnull",
"public",
"PreprocessorContext",
"setLocalVariable",
"(",
"@",
"Nonnull",
"final",
"String",
"name",
",",
"@",
"Nonnull",
"final",
"Value",
"value",
")",
"{",
"assertNotNull",
"(",
"\"Variable name is null\"",
",",
"name",
")",
";",
"assertNotNull"... | Set a local variable value
@param name the variable name, must not be null, remember that the name will be normalized and will be entirely in lower case
@param value the value for the variable, it must not be null
@return this preprocessor context
@see Value | [
"Set",
"a",
"local",
"variable",
"value"
] | train | https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/context/PreprocessorContext.java#L453-L470 |
alkacon/opencms-core | src/org/opencms/ugc/CmsUgcSession.java | CmsUgcSession.validateContent | public CmsXmlContentErrorHandler validateContent(Map<String, String> contentValues) throws CmsUgcException {
checkNotFinished();
try {
CmsFile file = m_cms.readFile(m_editResource);
CmsXmlContent content = addContentValues(file, contentValues);
return content.validate(m_cms);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage());
}
} | java | public CmsXmlContentErrorHandler validateContent(Map<String, String> contentValues) throws CmsUgcException {
checkNotFinished();
try {
CmsFile file = m_cms.readFile(m_editResource);
CmsXmlContent content = addContentValues(file, contentValues);
return content.validate(m_cms);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage());
}
} | [
"public",
"CmsXmlContentErrorHandler",
"validateContent",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"contentValues",
")",
"throws",
"CmsUgcException",
"{",
"checkNotFinished",
"(",
")",
";",
"try",
"{",
"CmsFile",
"file",
"=",
"m_cms",
".",
"readFile",
"(",... | Validates the content values.<p>
@param contentValues the content values to validate
@return the validation handler
@throws CmsUgcException if reading the content file fails | [
"Validates",
"the",
"content",
"values",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L529-L540 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java | StyleUtil.createFont | public static Font createFont(Workbook workbook, short color, short fontSize, String fontName) {
final Font font = workbook.createFont();
return setFontStyle(font, color, fontSize, fontName);
} | java | public static Font createFont(Workbook workbook, short color, short fontSize, String fontName) {
final Font font = workbook.createFont();
return setFontStyle(font, color, fontSize, fontName);
} | [
"public",
"static",
"Font",
"createFont",
"(",
"Workbook",
"workbook",
",",
"short",
"color",
",",
"short",
"fontSize",
",",
"String",
"fontName",
")",
"{",
"final",
"Font",
"font",
"=",
"workbook",
".",
"createFont",
"(",
")",
";",
"return",
"setFontStyle",... | 创建字体
@param workbook {@link Workbook}
@param color 字体颜色
@param fontSize 字体大小
@param fontName 字体名称,可以为null使用默认字体
@return {@link Font} | [
"创建字体"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/style/StyleUtil.java#L120-L123 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/LastaAction.java | LastaAction.redirectByParam | protected HtmlResponse redirectByParam(Class<?> actionType, Object... params) {
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("params", params);
return redirectWith(actionType, params(params));
} | java | protected HtmlResponse redirectByParam(Class<?> actionType, Object... params) {
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("params", params);
return redirectWith(actionType, params(params));
} | [
"protected",
"HtmlResponse",
"redirectByParam",
"(",
"Class",
"<",
"?",
">",
"actionType",
",",
"Object",
"...",
"params",
")",
"{",
"assertArgumentNotNull",
"(",
"\"actionType\"",
",",
"actionType",
")",
";",
"assertArgumentNotNull",
"(",
"\"params\"",
",",
"para... | Redirect to the action (index method) by the parameters on GET.
<pre>
<span style="color: #3F7E5E">// e.g. /member/edit/?foo=3</span>
return redirectByParam(MemberEditAction.class, "foo", 3);
<span style="color: #3F7E5E">// e.g. /member/edit/?foo=3&bar=qux</span>
return redirectByParam(MemberEditAction.class, "foo", 3, "bar", "qux");
<span style="color: #3F7E5E">// e.g. /member/?foo=3</span>
return redirectByParam(MemberAction.class, "foo", 3);
</pre>
@param actionType The class type of action that it redirects to. (NotNull)
@param params The varying array for the parameters on GET. (NotNull)
@return The HTML response for redirect. (NotNull) | [
"Redirect",
"to",
"the",
"action",
"(",
"index",
"method",
")",
"by",
"the",
"parameters",
"on",
"GET",
".",
"<pre",
">",
"<span",
"style",
"=",
"color",
":",
"#3F7E5E",
">",
"//",
"e",
".",
"g",
".",
"/",
"member",
"/",
"edit",
"/",
"?foo",
"=",
... | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/LastaAction.java#L306-L310 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java | Util.getStringProperty | public static String getStringProperty(Map<String, Object> properties, String key, String defaultVal) {
if (properties == null) {
return defaultVal;
}
Object propertyVal = properties.get(key);
if (propertyVal == null) {
return defaultVal;
}
if (!(propertyVal instanceof String)) {
throw new IllegalArgumentException("Property : " + key + " must be a string");
}
return (String) propertyVal;
} | java | public static String getStringProperty(Map<String, Object> properties, String key, String defaultVal) {
if (properties == null) {
return defaultVal;
}
Object propertyVal = properties.get(key);
if (propertyVal == null) {
return defaultVal;
}
if (!(propertyVal instanceof String)) {
throw new IllegalArgumentException("Property : " + key + " must be a string");
}
return (String) propertyVal;
} | [
"public",
"static",
"String",
"getStringProperty",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"String",
"key",
",",
"String",
"defaultVal",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"{",
"return",
"defaultVal",
";",
"}",
... | Get string type property value from a property map.
<p>
If {@code properties} is null or property value is null, default value is returned
@param properties map of properties
@param key property name
@param defaultVal default value of the property
@return integer value of the property, | [
"Get",
"string",
"type",
"property",
"value",
"from",
"a",
"property",
"map",
".",
"<p",
">",
"If",
"{",
"@code",
"properties",
"}",
"is",
"null",
"or",
"property",
"value",
"is",
"null",
"default",
"value",
"is",
"returned"
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L437-L454 |
padrig64/ValidationFramework | validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableProperty.java | AbstractReadableProperty.notifyListenersIfUninhibited | private void notifyListenersIfUninhibited(R oldValue, R newValue) {
if (inhibited) {
inhibitCount++;
lastInhibitedValue = newValue;
} else {
lastInhibitedValue = newValue; // Just in case, even though not really necessary
lastNonInhibitedValue = newValue;
doNotifyListeners(oldValue, newValue);
}
} | java | private void notifyListenersIfUninhibited(R oldValue, R newValue) {
if (inhibited) {
inhibitCount++;
lastInhibitedValue = newValue;
} else {
lastInhibitedValue = newValue; // Just in case, even though not really necessary
lastNonInhibitedValue = newValue;
doNotifyListeners(oldValue, newValue);
}
} | [
"private",
"void",
"notifyListenersIfUninhibited",
"(",
"R",
"oldValue",
",",
"R",
"newValue",
")",
"{",
"if",
"(",
"inhibited",
")",
"{",
"inhibitCount",
"++",
";",
"lastInhibitedValue",
"=",
"newValue",
";",
"}",
"else",
"{",
"lastInhibitedValue",
"=",
"newV... | Notifies the listeners that the property value has changed, if the property is not inhibited.
@param oldValue Previous value.
@param newValue New value.
@see #maybeNotifyListeners(Object, Object)
@see #doNotifyListeners(Object, Object) | [
"Notifies",
"the",
"listeners",
"that",
"the",
"property",
"value",
"has",
"changed",
"if",
"the",
"property",
"is",
"not",
"inhibited",
"."
] | train | https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableProperty.java#L177-L186 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java | CloudMe.getBlobByName | private CMBlob getBlobByName( CMFolder cmFolder, String baseName )
throws ParseException
{
StringBuilder innerXml = new StringBuilder();
innerXml.append( "<folder id=" ).append( "'" ).append( cmFolder.getId() ).append( "'" ).append( "/>" )
.append( "<query>" )
.append( "\"" ).append( XmlUtils.escape( baseName ) ).append( "\"" )
.append( "</query>" )
.append( "<count>1</count>" );
HttpPost request = buildSoapRequest( "queryFolder", innerXml.toString() );
CResponse response = retryStrategy.invokeRetry( getApiRequestInvoker( request, cmFolder.getCPath() ) );
Document dom = response.asDom();
NodeList elementList = dom.getElementsByTagNameNS( "*", "entry" );
if ( elementList.getLength() == 0 ) {
return null;
}
CMBlob cmBlob = CMBlob.buildCMFile( cmFolder, ( Element ) elementList.item( 0 ) );
return cmBlob;
} | java | private CMBlob getBlobByName( CMFolder cmFolder, String baseName )
throws ParseException
{
StringBuilder innerXml = new StringBuilder();
innerXml.append( "<folder id=" ).append( "'" ).append( cmFolder.getId() ).append( "'" ).append( "/>" )
.append( "<query>" )
.append( "\"" ).append( XmlUtils.escape( baseName ) ).append( "\"" )
.append( "</query>" )
.append( "<count>1</count>" );
HttpPost request = buildSoapRequest( "queryFolder", innerXml.toString() );
CResponse response = retryStrategy.invokeRetry( getApiRequestInvoker( request, cmFolder.getCPath() ) );
Document dom = response.asDom();
NodeList elementList = dom.getElementsByTagNameNS( "*", "entry" );
if ( elementList.getLength() == 0 ) {
return null;
}
CMBlob cmBlob = CMBlob.buildCMFile( cmFolder, ( Element ) elementList.item( 0 ) );
return cmBlob;
} | [
"private",
"CMBlob",
"getBlobByName",
"(",
"CMFolder",
"cmFolder",
",",
"String",
"baseName",
")",
"throws",
"ParseException",
"{",
"StringBuilder",
"innerXml",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"innerXml",
".",
"append",
"(",
"\"<folder id=\"",
")",
"... | Gets a blob according to the parent folder id of the folder.
@param cmFolder parent folder
@param baseName base name of the file to find
@return the CloudMe blob, or null if not found
@throws ParseException | [
"Gets",
"a",
"blob",
"according",
"to",
"the",
"parent",
"folder",
"id",
"of",
"the",
"folder",
"."
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CloudMe.java#L219-L242 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.notEquals | @Throws(IllegalEqualException.class)
public static boolean notEquals(final boolean expected, final boolean check) {
if (expected == check) {
throw new IllegalEqualException(check);
}
return check;
} | java | @Throws(IllegalEqualException.class)
public static boolean notEquals(final boolean expected, final boolean check) {
if (expected == check) {
throw new IllegalEqualException(check);
}
return check;
} | [
"@",
"Throws",
"(",
"IllegalEqualException",
".",
"class",
")",
"public",
"static",
"boolean",
"notEquals",
"(",
"final",
"boolean",
"expected",
",",
"final",
"boolean",
"check",
")",
"{",
"if",
"(",
"expected",
"==",
"check",
")",
"{",
"throw",
"new",
"Il... | Ensures that a passed boolean is not equal to another boolean. The comparison is made using
<code>expected == check</code>.
<p>
We recommend to use the overloaded method {@link Check#notEquals(boolean, boolean, String)} and pass as second
argument the name of the parameter to enhance the exception message.
@param expected
Expected value
@param check
boolean to be checked
@return the passed boolean argument {@code check}
@throws IllegalEqualException
if both argument values are not equal | [
"Ensures",
"that",
"a",
"passed",
"boolean",
"is",
"not",
"equal",
"to",
"another",
"boolean",
".",
"The",
"comparison",
"is",
"made",
"using",
"<code",
">",
"expected",
"==",
"check<",
"/",
"code",
">",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L2247-L2254 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Transaction.java | Transaction.addSignedInput | public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey, SigHash sigHash, boolean anyoneCanPay) {
return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey, sigHash, anyoneCanPay);
} | java | public TransactionInput addSignedInput(TransactionOutput output, ECKey signingKey, SigHash sigHash, boolean anyoneCanPay) {
return addSignedInput(output.getOutPointFor(), output.getScriptPubKey(), signingKey, sigHash, anyoneCanPay);
} | [
"public",
"TransactionInput",
"addSignedInput",
"(",
"TransactionOutput",
"output",
",",
"ECKey",
"signingKey",
",",
"SigHash",
"sigHash",
",",
"boolean",
"anyoneCanPay",
")",
"{",
"return",
"addSignedInput",
"(",
"output",
".",
"getOutPointFor",
"(",
")",
",",
"o... | Adds an input that points to the given output and contains a valid signature for it, calculated using the
signing key. | [
"Adds",
"an",
"input",
"that",
"points",
"to",
"the",
"given",
"output",
"and",
"contains",
"a",
"valid",
"signature",
"for",
"it",
"calculated",
"using",
"the",
"signing",
"key",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1009-L1011 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java | SparseVector.put | public void put(int i, double value) {
if (i < 0 || i >= N) throw new IllegalArgumentException("Illegal index " + i + " should be > 0 and < " + N);
if (value == 0.0) symbolTable.delete(i);
else symbolTable.put(i, value);
} | java | public void put(int i, double value) {
if (i < 0 || i >= N) throw new IllegalArgumentException("Illegal index " + i + " should be > 0 and < " + N);
if (value == 0.0) symbolTable.delete(i);
else symbolTable.put(i, value);
} | [
"public",
"void",
"put",
"(",
"int",
"i",
",",
"double",
"value",
")",
"{",
"if",
"(",
"i",
"<",
"0",
"||",
"i",
">=",
"N",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal index \"",
"+",
"i",
"+",
"\" should be > 0 and < \"",
"+",
"N",
... | Setter method (should it be renamed to set?)
@param i set symbolTable[i]
@param value | [
"Setter",
"method",
"(",
"should",
"it",
"be",
"renamed",
"to",
"set?",
")"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java#L65-L69 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java | ScriptUtil.getScriptFormSource | public static ExecutableScript getScriptFormSource(String language, String source, ExpressionManager expressionManager, ScriptFactory scriptFactory) {
ensureNotEmpty(NotValidException.class, "Script language", language);
ensureNotNull(NotValidException.class, "Script source", source);
if (isDynamicScriptExpression(language, source)) {
Expression sourceExpression = expressionManager.createExpression(source);
return getScriptFromSourceExpression(language, sourceExpression, scriptFactory);
}
else {
return getScriptFromSource(language, source, scriptFactory);
}
} | java | public static ExecutableScript getScriptFormSource(String language, String source, ExpressionManager expressionManager, ScriptFactory scriptFactory) {
ensureNotEmpty(NotValidException.class, "Script language", language);
ensureNotNull(NotValidException.class, "Script source", source);
if (isDynamicScriptExpression(language, source)) {
Expression sourceExpression = expressionManager.createExpression(source);
return getScriptFromSourceExpression(language, sourceExpression, scriptFactory);
}
else {
return getScriptFromSource(language, source, scriptFactory);
}
} | [
"public",
"static",
"ExecutableScript",
"getScriptFormSource",
"(",
"String",
"language",
",",
"String",
"source",
",",
"ExpressionManager",
"expressionManager",
",",
"ScriptFactory",
"scriptFactory",
")",
"{",
"ensureNotEmpty",
"(",
"NotValidException",
".",
"class",
"... | Creates a new {@link ExecutableScript} from a source. It excepts static and dynamic sources.
Dynamic means that the source is an expression which will be evaluated during execution.
@param language the language of the script
@param source the source code of the script or an expression which evaluates to the source code
@param expressionManager the expression manager to use to generate the expressions of dynamic scripts
@param scriptFactory the script factory used to create the script
@return the newly created script
@throws NotValidException if language is null or empty or source is null | [
"Creates",
"a",
"new",
"{",
"@link",
"ExecutableScript",
"}",
"from",
"a",
"source",
".",
"It",
"excepts",
"static",
"and",
"dynamic",
"sources",
".",
"Dynamic",
"means",
"that",
"the",
"source",
"is",
"an",
"expression",
"which",
"will",
"be",
"evaluated",
... | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ScriptUtil.java#L88-L98 |
looly/hutool | hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java | AbsSetting.getInt | public Integer getInt(String key, String group, Integer defaultValue) {
return Convert.toInt(getByGroup(key, group), defaultValue);
} | java | public Integer getInt(String key, String group, Integer defaultValue) {
return Convert.toInt(getByGroup(key, group), defaultValue);
} | [
"public",
"Integer",
"getInt",
"(",
"String",
"key",
",",
"String",
"group",
",",
"Integer",
"defaultValue",
")",
"{",
"return",
"Convert",
".",
"toInt",
"(",
"getByGroup",
"(",
"key",
",",
"group",
")",
",",
"defaultValue",
")",
";",
"}"
] | 获取数字型型属性值
@param key 属性名
@param group 分组名
@param defaultValue 默认值
@return 属性值 | [
"获取数字型型属性值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-setting/src/main/java/cn/hutool/setting/AbsSetting.java#L164-L166 |
innoq/LiQID | ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java | LdapHelper.setUserAsUser | @Override
public boolean setUserAsUser(Node node, String uid, String password) throws Exception {
boolean status = false;
StringBuilder sb = new StringBuilder(userIdentifyer + "=").append(uid).append(",");
sb.append(Configuration.getProperty(instanceName + LdapKeys.ATTR_OU_PEOPLE)).append(",");
sb.append(baseDn);
if (uid == null || uid.isEmpty() || password == null || password.isEmpty()) {
return false;
}
try {
Hashtable<String, String> environment = (Hashtable<String, String>) ctx.getEnvironment().clone();
environment.put(Context.SECURITY_PRINCIPAL, sb.toString());
environment.put(Context.SECURITY_CREDENTIALS, password);
DirContext dirContext = new InitialDirContext(environment);
status = setUserInContext(dirContext, node);
dirContext.close();
} catch (NamingException ex) {
handleNamingException("NamingException " + ex.getLocalizedMessage(), ex);
}
return status;
} | java | @Override
public boolean setUserAsUser(Node node, String uid, String password) throws Exception {
boolean status = false;
StringBuilder sb = new StringBuilder(userIdentifyer + "=").append(uid).append(",");
sb.append(Configuration.getProperty(instanceName + LdapKeys.ATTR_OU_PEOPLE)).append(",");
sb.append(baseDn);
if (uid == null || uid.isEmpty() || password == null || password.isEmpty()) {
return false;
}
try {
Hashtable<String, String> environment = (Hashtable<String, String>) ctx.getEnvironment().clone();
environment.put(Context.SECURITY_PRINCIPAL, sb.toString());
environment.put(Context.SECURITY_CREDENTIALS, password);
DirContext dirContext = new InitialDirContext(environment);
status = setUserInContext(dirContext, node);
dirContext.close();
} catch (NamingException ex) {
handleNamingException("NamingException " + ex.getLocalizedMessage(), ex);
}
return status;
} | [
"@",
"Override",
"public",
"boolean",
"setUserAsUser",
"(",
"Node",
"node",
",",
"String",
"uid",
",",
"String",
"password",
")",
"throws",
"Exception",
"{",
"boolean",
"status",
"=",
"false",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"us... | Writes the modifications on an user object back to the LDAP using a
specific context.
@param node the LDAP Node with User Content.
@param uid the uid of the User that adds the Node.
@param password the password of the User that adds the Node.
@return true if the user was set correct, false otherwise.
@throws Exception if adding a User fails. | [
"Writes",
"the",
"modifications",
"on",
"an",
"user",
"object",
"back",
"to",
"the",
"LDAP",
"using",
"a",
"specific",
"context",
"."
] | train | https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L153-L173 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java | CmsAttributeHandler.insertNewAttributeValue | public void insertNewAttributeValue(CmsEntity value, int index, Panel container) {
// make sure not to add more values than allowed
int maxOccurrence = getEntityType().getAttributeMaxOccurrence(m_attributeName);
CmsEntityAttribute attribute = m_entity.getAttribute(m_attributeName);
boolean mayHaveMore = ((attribute == null) || (attribute.getValueCount() < maxOccurrence));
if (mayHaveMore && value.getTypeName().equals(m_attributeType.getId())) {
m_entity.insertAttributeValue(m_attributeName, value, index);
int valueIndex = index;
CmsAttributeValueView valueView = null;
if ((m_attributeValueViews.size() == 1) && !m_attributeValueViews.get(0).hasValue()) {
valueView = m_attributeValueViews.get(0);
} else {
valueView = new CmsAttributeValueView(
this,
m_widgetService.getAttributeLabel(m_attributeName),
m_widgetService.getAttributeHelp(m_attributeName));
}
CmsRenderer.setAttributeChoice(m_widgetService, valueView, getAttributeType());
m_attributeValueViews.remove(valueView);
m_attributeValueViews.add(index, valueView);
((FlowPanel)container).insert(valueView, index);
insertHandlers(valueIndex);
I_CmsEntityRenderer renderer = m_widgetService.getRendererForAttribute(m_attributeName, getAttributeType());
valueView.setValueEntity(renderer, value);
CmsUndoRedoHandler handler = CmsUndoRedoHandler.getInstance();
if (handler.isIntitalized()) {
handler.addChange(m_entity.getId(), m_attributeName, valueIndex, ChangeType.add);
}
}
} | java | public void insertNewAttributeValue(CmsEntity value, int index, Panel container) {
// make sure not to add more values than allowed
int maxOccurrence = getEntityType().getAttributeMaxOccurrence(m_attributeName);
CmsEntityAttribute attribute = m_entity.getAttribute(m_attributeName);
boolean mayHaveMore = ((attribute == null) || (attribute.getValueCount() < maxOccurrence));
if (mayHaveMore && value.getTypeName().equals(m_attributeType.getId())) {
m_entity.insertAttributeValue(m_attributeName, value, index);
int valueIndex = index;
CmsAttributeValueView valueView = null;
if ((m_attributeValueViews.size() == 1) && !m_attributeValueViews.get(0).hasValue()) {
valueView = m_attributeValueViews.get(0);
} else {
valueView = new CmsAttributeValueView(
this,
m_widgetService.getAttributeLabel(m_attributeName),
m_widgetService.getAttributeHelp(m_attributeName));
}
CmsRenderer.setAttributeChoice(m_widgetService, valueView, getAttributeType());
m_attributeValueViews.remove(valueView);
m_attributeValueViews.add(index, valueView);
((FlowPanel)container).insert(valueView, index);
insertHandlers(valueIndex);
I_CmsEntityRenderer renderer = m_widgetService.getRendererForAttribute(m_attributeName, getAttributeType());
valueView.setValueEntity(renderer, value);
CmsUndoRedoHandler handler = CmsUndoRedoHandler.getInstance();
if (handler.isIntitalized()) {
handler.addChange(m_entity.getId(), m_attributeName, valueIndex, ChangeType.add);
}
}
} | [
"public",
"void",
"insertNewAttributeValue",
"(",
"CmsEntity",
"value",
",",
"int",
"index",
",",
"Panel",
"container",
")",
"{",
"// make sure not to add more values than allowed\r",
"int",
"maxOccurrence",
"=",
"getEntityType",
"(",
")",
".",
"getAttributeMaxOccurrence"... | Adds a new attribute value and adds the required widgets to the editor DOM.<p>
@param value the value entity
@param index the position in which to insert the new value
@param container the widget containing the attribute value views | [
"Adds",
"a",
"new",
"attribute",
"value",
"and",
"adds",
"the",
"required",
"widgets",
"to",
"the",
"editor",
"DOM",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java#L605-L639 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.catchException | public Binder catchException(Class<? extends Throwable> throwable, MethodHandle function) {
return new Binder(this, new Catch(throwable, function));
} | java | public Binder catchException(Class<? extends Throwable> throwable, MethodHandle function) {
return new Binder(this, new Catch(throwable, function));
} | [
"public",
"Binder",
"catchException",
"(",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"throwable",
",",
"MethodHandle",
"function",
")",
"{",
"return",
"new",
"Binder",
"(",
"this",
",",
"new",
"Catch",
"(",
"throwable",
",",
"function",
")",
")",
";"... | Catch the given exception type from the downstream chain and handle it with the
given function.
@param throwable the exception type to catch
@param function the function to use for handling the exception
@return a new Binder | [
"Catch",
"the",
"given",
"exception",
"type",
"from",
"the",
"downstream",
"chain",
"and",
"handle",
"it",
"with",
"the",
"given",
"function",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L1073-L1075 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.setSettings | public JSONObject setSettings(JSONObject settings, RequestOptions requestOptions) throws AlgoliaException {
return setSettings(settings, false, requestOptions);
} | java | public JSONObject setSettings(JSONObject settings, RequestOptions requestOptions) throws AlgoliaException {
return setSettings(settings, false, requestOptions);
} | [
"public",
"JSONObject",
"setSettings",
"(",
"JSONObject",
"settings",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"return",
"setSettings",
"(",
"settings",
",",
"false",
",",
"requestOptions",
")",
";",
"}"
] | Set settings for this index
@param settings the settings for an index
@param requestOptions Options to pass to this request | [
"Set",
"settings",
"for",
"this",
"index"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L940-L942 |
netty/netty | common/src/main/java/io/netty/util/internal/StringUtil.java | StringUtil.indexOfNonWhiteSpace | public static int indexOfNonWhiteSpace(CharSequence seq, int offset) {
for (; offset < seq.length(); ++offset) {
if (!Character.isWhitespace(seq.charAt(offset))) {
return offset;
}
}
return -1;
} | java | public static int indexOfNonWhiteSpace(CharSequence seq, int offset) {
for (; offset < seq.length(); ++offset) {
if (!Character.isWhitespace(seq.charAt(offset))) {
return offset;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOfNonWhiteSpace",
"(",
"CharSequence",
"seq",
",",
"int",
"offset",
")",
"{",
"for",
"(",
";",
"offset",
"<",
"seq",
".",
"length",
"(",
")",
";",
"++",
"offset",
")",
"{",
"if",
"(",
"!",
"Character",
".",
"isWhitespac... | Find the index of the first non-white space character in {@code s} starting at {@code offset}.
@param seq The string to search.
@param offset The offset to start searching at.
@return the index of the first non-white space character or <{@code 0} if none was found. | [
"Find",
"the",
"index",
"of",
"the",
"first",
"non",
"-",
"white",
"space",
"character",
"in",
"{",
"@code",
"s",
"}",
"starting",
"at",
"{",
"@code",
"offset",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L546-L553 |
intellimate/Izou | src/main/java/org/intellimate/izou/system/sound/SoundManager.java | SoundManager.closeCallback | private void closeCallback(AddOnModel addOnModel, IzouSoundLine izouSoundLine) {
debug("removing soundline " + izouSoundLine + " from " + addOnModel);
Predicate<WeakReference<IzouSoundLineBaseClass>> removeFromList =
weakReference -> weakReference.get() != null && weakReference.get().equals(izouSoundLine);
synchronized (permanentUserReadWriteLock) {
if (permanentAddOn != null && permanentAddOn.equals(addOnModel) && permanentLines != null) {
permanentLines.removeIf(removeFromList);
if (permanentLines.isEmpty()) {
permanentLines = null;
permissionWithoutUsage();
}
}
}
List<WeakReference<IzouSoundLineBaseClass>> weakReferences = nonPermanent.get(addOnModel);
if (weakReferences != null) {
weakReferences.removeIf(removeFromList);
synchronized (mutingLock) {
if (mutingManager != null && mutingManager.getMuting().equals(addOnModel)) {
mutingManager = mutingManager.remove(izouSoundLine);
}
}
}
submit(this::tidy);
} | java | private void closeCallback(AddOnModel addOnModel, IzouSoundLine izouSoundLine) {
debug("removing soundline " + izouSoundLine + " from " + addOnModel);
Predicate<WeakReference<IzouSoundLineBaseClass>> removeFromList =
weakReference -> weakReference.get() != null && weakReference.get().equals(izouSoundLine);
synchronized (permanentUserReadWriteLock) {
if (permanentAddOn != null && permanentAddOn.equals(addOnModel) && permanentLines != null) {
permanentLines.removeIf(removeFromList);
if (permanentLines.isEmpty()) {
permanentLines = null;
permissionWithoutUsage();
}
}
}
List<WeakReference<IzouSoundLineBaseClass>> weakReferences = nonPermanent.get(addOnModel);
if (weakReferences != null) {
weakReferences.removeIf(removeFromList);
synchronized (mutingLock) {
if (mutingManager != null && mutingManager.getMuting().equals(addOnModel)) {
mutingManager = mutingManager.remove(izouSoundLine);
}
}
}
submit(this::tidy);
} | [
"private",
"void",
"closeCallback",
"(",
"AddOnModel",
"addOnModel",
",",
"IzouSoundLine",
"izouSoundLine",
")",
"{",
"debug",
"(",
"\"removing soundline \"",
"+",
"izouSoundLine",
"+",
"\" from \"",
"+",
"addOnModel",
")",
";",
"Predicate",
"<",
"WeakReference",
"<... | the close-callback or the AddonModel, removes now redundant references
@param addOnModel the addOnModel where the IzouSoundLine belongs to
@param izouSoundLine the izouSoundLine | [
"the",
"close",
"-",
"callback",
"or",
"the",
"AddonModel",
"removes",
"now",
"redundant",
"references"
] | train | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/system/sound/SoundManager.java#L143-L166 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/GOMention.java | GOMention.setCategories | public void setCategories(int i, String v) {
if (GOMention_Type.featOkTst && ((GOMention_Type)jcasType).casFeat_categories == null)
jcasType.jcas.throwFeatMissing("categories", "de.julielab.jules.types.GOMention");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((GOMention_Type)jcasType).casFeatCode_categories), i);
jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((GOMention_Type)jcasType).casFeatCode_categories), i, v);} | java | public void setCategories(int i, String v) {
if (GOMention_Type.featOkTst && ((GOMention_Type)jcasType).casFeat_categories == null)
jcasType.jcas.throwFeatMissing("categories", "de.julielab.jules.types.GOMention");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((GOMention_Type)jcasType).casFeatCode_categories), i);
jcasType.ll_cas.ll_setStringArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((GOMention_Type)jcasType).casFeatCode_categories), i, v);} | [
"public",
"void",
"setCategories",
"(",
"int",
"i",
",",
"String",
"v",
")",
"{",
"if",
"(",
"GOMention_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"GOMention_Type",
")",
"jcasType",
")",
".",
"casFeat_categories",
"==",
"null",
")",
"jcasType",
".",
"jcas",
... | indexed setter for categories - sets an indexed value - created for the shared task, here we add the group
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"categories",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"created",
"for",
"the",
"shared",
"task",
"here",
"we",
"add",
"the",
"group"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/GOMention.java#L116-L120 |
indeedeng/util | util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java | Quicksortables.sortheap | private static void sortheap(Quicksortable q, int size) {
for (int i = size-1; i >= 1; i--) {
q.swap(0, i);
heapifyDown(q, 0, i);
}
} | java | private static void sortheap(Quicksortable q, int size) {
for (int i = size-1; i >= 1; i--) {
q.swap(0, i);
heapifyDown(q, 0, i);
}
} | [
"private",
"static",
"void",
"sortheap",
"(",
"Quicksortable",
"q",
",",
"int",
"size",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"size",
"-",
"1",
";",
"i",
">=",
"1",
";",
"i",
"--",
")",
"{",
"q",
".",
"swap",
"(",
"0",
",",
"i",
")",
";",
... | sorts the heap stored in q
@param q The quicksortable to heapsort.
@param size The size of the quicksortable. | [
"sorts",
"the",
"heap",
"stored",
"in",
"q"
] | train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L253-L258 |
paypal/SeLion | client/src/main/java/com/paypal/selion/platform/grid/Grid.java | Grid.getRemoteNodeInfo | public static RemoteNodeInformation getRemoteNodeInfo(String hostName, int port, SessionId session) {
logger.entering(new Object[] { hostName, port, session });
RemoteNodeInformation node = null;
String errorMsg = "Failed to acquire remote webdriver node and port info. Root cause: ";
// go ahead and abort if this is a known grid where know we won't be able to extract the proxy info via the hub
// api
if (Config.getBoolConfigProperty(ConfigProperty.SELENIUM_USE_SAUCELAB_GRID)) {
logger.exiting(node);
return node;
}
try {
HttpHost host = new HttpHost(hostName, port);
CloseableHttpClient client = HttpClientBuilder.create().build();
URL sessionURL = new URL("http://" + hostName + ":" + port + "/grid/api/testsession?session=" + session);
BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest("POST", sessionURL.toExternalForm());
CloseableHttpResponse response = client.execute(host, r);
JSONObject object = extractObject(response);
URL myURL = new URL(object.getString("proxyId"));
if ((myURL.getHost() != null) && (myURL.getPort() != -1)) {
node = new RemoteNodeInformation(myURL.getHost(), myURL.getPort());
}
} catch (Exception e) {
logger.log(Level.FINE, errorMsg, e);
// Just log the exception at finer level but dont throw any exceptions
// because this is just value added information.
}
logger.exiting(node);
return node;
} | java | public static RemoteNodeInformation getRemoteNodeInfo(String hostName, int port, SessionId session) {
logger.entering(new Object[] { hostName, port, session });
RemoteNodeInformation node = null;
String errorMsg = "Failed to acquire remote webdriver node and port info. Root cause: ";
// go ahead and abort if this is a known grid where know we won't be able to extract the proxy info via the hub
// api
if (Config.getBoolConfigProperty(ConfigProperty.SELENIUM_USE_SAUCELAB_GRID)) {
logger.exiting(node);
return node;
}
try {
HttpHost host = new HttpHost(hostName, port);
CloseableHttpClient client = HttpClientBuilder.create().build();
URL sessionURL = new URL("http://" + hostName + ":" + port + "/grid/api/testsession?session=" + session);
BasicHttpEntityEnclosingRequest r = new BasicHttpEntityEnclosingRequest("POST", sessionURL.toExternalForm());
CloseableHttpResponse response = client.execute(host, r);
JSONObject object = extractObject(response);
URL myURL = new URL(object.getString("proxyId"));
if ((myURL.getHost() != null) && (myURL.getPort() != -1)) {
node = new RemoteNodeInformation(myURL.getHost(), myURL.getPort());
}
} catch (Exception e) {
logger.log(Level.FINE, errorMsg, e);
// Just log the exception at finer level but dont throw any exceptions
// because this is just value added information.
}
logger.exiting(node);
return node;
} | [
"public",
"static",
"RemoteNodeInformation",
"getRemoteNodeInfo",
"(",
"String",
"hostName",
",",
"int",
"port",
",",
"SessionId",
"session",
")",
"{",
"logger",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"hostName",
",",
"port",
",",
"session",
"... | For a given Session ID against a host on a particular port, this method returns the remote webdriver node and the
port to which the execution was redirected to by the hub.
@param hostName
The name of the hub machine
@param port
The port on which the hub machine is listening to
@param session
An object of type {@link SessionId} which represents the current session for a user.
@return An array of string wherein the first element represents the remote node's name and the second element
represents its port. May return <code>null</code> on error. | [
"For",
"a",
"given",
"Session",
"ID",
"against",
"a",
"host",
"on",
"a",
"particular",
"port",
"this",
"method",
"returns",
"the",
"remote",
"webdriver",
"node",
"and",
"the",
"port",
"to",
"which",
"the",
"execution",
"was",
"redirected",
"to",
"by",
"the... | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/platform/grid/Grid.java#L197-L227 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java | Util.setBackground | public static void setBackground(View v, Drawable d) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
v.setBackgroundDrawable(d);
} else {
v.setBackground(d);
}
} | java | public static void setBackground(View v, Drawable d) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
v.setBackgroundDrawable(d);
} else {
v.setBackground(d);
}
} | [
"public",
"static",
"void",
"setBackground",
"(",
"View",
"v",
",",
"Drawable",
"d",
")",
"{",
"if",
"(",
"android",
".",
"os",
".",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"android",
".",
"os",
".",
"Build",
".",
"VERSION_CODES",
".",
"JELLY_BEA... | helper method to set the background depending on the android version
@param v
@param d | [
"helper",
"method",
"to",
"set",
"the",
"background",
"depending",
"on",
"the",
"android",
"version"
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/Util.java#L361-L367 |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrDocument.java | CmsSolrDocument.addMultiValuedField | public void addMultiValuedField(String fieldName, List<String> values) {
if ((values != null) && (values.size() > 0)) {
for (String value : values) {
m_doc.addField(fieldName, value);
}
}
} | java | public void addMultiValuedField(String fieldName, List<String> values) {
if ((values != null) && (values.size() > 0)) {
for (String value : values) {
m_doc.addField(fieldName, value);
}
}
} | [
"public",
"void",
"addMultiValuedField",
"(",
"String",
"fieldName",
",",
"List",
"<",
"String",
">",
"values",
")",
"{",
"if",
"(",
"(",
"values",
"!=",
"null",
")",
"&&",
"(",
"values",
".",
"size",
"(",
")",
">",
"0",
")",
")",
"{",
"for",
"(",
... | Adds a multi-valued field.<p>
@param fieldName the field name to put the values in
@param values the values to put in the field | [
"Adds",
"a",
"multi",
"-",
"valued",
"field",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrDocument.java#L189-L196 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java | CacheableWorkspaceDataManager.getCachedCleanItemData | protected ItemData getCachedCleanItemData(NodeData parentData, QPathEntry name, ItemType itemType)
throws RepositoryException
{
ItemData data = getCachedItemData(parentData, name, itemType);
if (data != null && !data.isNode() && !(data instanceof NullItemData) && forceLoad((PropertyData)data))
{
cache.remove(data.getIdentifier(), data);
data = null;
}
return data;
} | java | protected ItemData getCachedCleanItemData(NodeData parentData, QPathEntry name, ItemType itemType)
throws RepositoryException
{
ItemData data = getCachedItemData(parentData, name, itemType);
if (data != null && !data.isNode() && !(data instanceof NullItemData) && forceLoad((PropertyData)data))
{
cache.remove(data.getIdentifier(), data);
data = null;
}
return data;
} | [
"protected",
"ItemData",
"getCachedCleanItemData",
"(",
"NodeData",
"parentData",
",",
"QPathEntry",
"name",
",",
"ItemType",
"itemType",
")",
"throws",
"RepositoryException",
"{",
"ItemData",
"data",
"=",
"getCachedItemData",
"(",
"parentData",
",",
"name",
",",
"i... | It is similar to {@link #getCachedItemData(NodeData, QPathEntry, ItemType)} except that if it is a property
it will check if it is complete or not, if not it will remove the entry from
the cache and returns null | [
"It",
"is",
"similar",
"to",
"{"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1295-L1306 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getAttributeInt | @Pure
public static int getAttributeInt(Node document, boolean caseSensitive, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeIntWithDefault(document, caseSensitive, 0, path);
} | java | @Pure
public static int getAttributeInt(Node document, boolean caseSensitive, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeIntWithDefault(document, caseSensitive, 0, path);
} | [
"@",
"Pure",
"public",
"static",
"int",
"getAttributeInt",
"(",
"Node",
"document",
",",
"boolean",
"caseSensitive",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
";... | Replies the integer value that corresponds to the specified attribute's path.
<p>The path is an ordered list of tag's names and ended by the name of
the attribute.
@param document is the XML document to explore.
@param caseSensitive indicates of the {@code path}'s components are case sensitive.
@param path is the list of and ended by the attribute's name.
@return the integer value of the specified attribute or <code>null</code> if
it was node found in the document | [
"Replies",
"the",
"integer",
"value",
"that",
"corresponds",
"to",
"the",
"specified",
"attribute",
"s",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L811-L815 |
hypercube1024/firefly | firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java | ScriptUtils.executeSqlScript | public static void executeSqlScript(Connection connection, EncodedResource resource) throws ScriptException {
executeSqlScript(connection, resource, false, false, DEFAULT_COMMENT_PREFIX, DEFAULT_STATEMENT_SEPARATOR,
DEFAULT_BLOCK_COMMENT_START_DELIMITER, DEFAULT_BLOCK_COMMENT_END_DELIMITER);
} | java | public static void executeSqlScript(Connection connection, EncodedResource resource) throws ScriptException {
executeSqlScript(connection, resource, false, false, DEFAULT_COMMENT_PREFIX, DEFAULT_STATEMENT_SEPARATOR,
DEFAULT_BLOCK_COMMENT_START_DELIMITER, DEFAULT_BLOCK_COMMENT_END_DELIMITER);
} | [
"public",
"static",
"void",
"executeSqlScript",
"(",
"Connection",
"connection",
",",
"EncodedResource",
"resource",
")",
"throws",
"ScriptException",
"{",
"executeSqlScript",
"(",
"connection",
",",
"resource",
",",
"false",
",",
"false",
",",
"DEFAULT_COMMENT_PREFIX... | Execute the given SQL script using default settings for statement
separators, comment delimiters, and exception handling flags.
<p>
Statement separators and comments will be removed before executing
individual statements within the supplied script.
<p>
<strong>Warning</strong>: this method does <em>not</em> release the
provided {@link Connection}.
@param connection the JDBC connection to use to execute the script; already
configured and ready to use
@param resource the resource (potentially associated with a specific encoding)
to load the SQL script from
@throws ScriptException if an error occurred while executing the SQL script
@see #executeSqlScript(Connection, EncodedResource, boolean, boolean,
String, String, String, String)
@see #DEFAULT_STATEMENT_SEPARATOR
@see #DEFAULT_COMMENT_PREFIX
@see #DEFAULT_BLOCK_COMMENT_START_DELIMITER
@see #DEFAULT_BLOCK_COMMENT_END_DELIMITER | [
"Execute",
"the",
"given",
"SQL",
"script",
"using",
"default",
"settings",
"for",
"statement",
"separators",
"comment",
"delimiters",
"and",
"exception",
"handling",
"flags",
".",
"<p",
">",
"Statement",
"separators",
"and",
"comments",
"will",
"be",
"removed",
... | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java#L397-L400 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java | TypeHandlerUtils.convertSqlXml | public static Object convertSqlXml(Connection conn, byte[] value) throws SQLException {
Object result = createSQLXML(conn);
result = convertSqlXml(result, value);
return result;
} | java | public static Object convertSqlXml(Connection conn, byte[] value) throws SQLException {
Object result = createSQLXML(conn);
result = convertSqlXml(result, value);
return result;
} | [
"public",
"static",
"Object",
"convertSqlXml",
"(",
"Connection",
"conn",
",",
"byte",
"[",
"]",
"value",
")",
"throws",
"SQLException",
"{",
"Object",
"result",
"=",
"createSQLXML",
"(",
"conn",
")",
";",
"result",
"=",
"convertSqlXml",
"(",
"result",
",",
... | Transfers data from byte[] into sql.SQLXML
@param conn connection for which sql.SQLXML object would be created
@param value array of bytes
@return sql.SQLXML from array of bytes
@throws SQLException | [
"Transfers",
"data",
"from",
"byte",
"[]",
"into",
"sql",
".",
"SQLXML"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L288-L294 |
Impetus/Kundera | src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java | HBaseSchemaManager.setExternalProperties | private void setExternalProperties(String name, HColumnDescriptor hColumnDescriptor)
{
Properties properties = externalProperties != null ? externalProperties.get(name) : null;
if (properties != null && !properties.isEmpty())
{
for (Object obj : properties.keySet())
{
hColumnDescriptor
.setValue(Bytes.toBytes(obj.toString()), Bytes.toBytes(properties.get(obj).toString()));
}
}
} | java | private void setExternalProperties(String name, HColumnDescriptor hColumnDescriptor)
{
Properties properties = externalProperties != null ? externalProperties.get(name) : null;
if (properties != null && !properties.isEmpty())
{
for (Object obj : properties.keySet())
{
hColumnDescriptor
.setValue(Bytes.toBytes(obj.toString()), Bytes.toBytes(properties.get(obj).toString()));
}
}
} | [
"private",
"void",
"setExternalProperties",
"(",
"String",
"name",
",",
"HColumnDescriptor",
"hColumnDescriptor",
")",
"{",
"Properties",
"properties",
"=",
"externalProperties",
"!=",
"null",
"?",
"externalProperties",
".",
"get",
"(",
"name",
")",
":",
"null",
"... | Sets the external properties.
@param name
the name
@param hColumnDescriptor
the h column descriptor | [
"Sets",
"the",
"external",
"properties",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java#L380-L391 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java | ConstantsSummaryBuilder.buildConstantMembers | public void buildConstantMembers(XMLNode node, Content classConstantTree) {
new ConstantFieldBuilder(currentClass).buildMembersSummary(node, classConstantTree);
} | java | public void buildConstantMembers(XMLNode node, Content classConstantTree) {
new ConstantFieldBuilder(currentClass).buildMembersSummary(node, classConstantTree);
} | [
"public",
"void",
"buildConstantMembers",
"(",
"XMLNode",
"node",
",",
"Content",
"classConstantTree",
")",
"{",
"new",
"ConstantFieldBuilder",
"(",
"currentClass",
")",
".",
"buildMembersSummary",
"(",
"node",
",",
"classConstantTree",
")",
";",
"}"
] | Build the summary of constant members in the class.
@param node the XML element that specifies which components to document
@param classConstantTree the tree to which the constant members table
will be added | [
"Build",
"the",
"summary",
"of",
"constant",
"members",
"in",
"the",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java#L246-L248 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/action/menu/SaveEditingAction.java | SaveEditingAction.onClick | public void onClick(MenuItemClickEvent event) {
FeatureTransaction featureTransaction = mapModel.getFeatureEditor().getFeatureTransaction();
if (featureTransaction != null) {
List<Activity> activities = new ArrayList<Activity>();
activities.add(new ValidationActivity());
activities.add(new CommitActivity());
WorkflowProcessor processor = new SequenceProcessor(new MapModelWorkflowContext());
processor.setDefaultErrorHandler(new WorkflowErrorHandler() {
public void handleError(WorkflowContext context, Throwable throwable) {
SC.warn(I18nProvider.getGlobal().saveEditingAborted() + throwable.getMessage());
}
});
processor.setActivities(activities);
processor.doActivities(mapModel);
// Cleaning up duties: controller and MapWidget (if they're present)
if (controller != null) {
controller.cleanup();
}
if (mapWidget != null) {
mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
}
mapModel.getFeatureEditor().stopEditing();
}
} | java | public void onClick(MenuItemClickEvent event) {
FeatureTransaction featureTransaction = mapModel.getFeatureEditor().getFeatureTransaction();
if (featureTransaction != null) {
List<Activity> activities = new ArrayList<Activity>();
activities.add(new ValidationActivity());
activities.add(new CommitActivity());
WorkflowProcessor processor = new SequenceProcessor(new MapModelWorkflowContext());
processor.setDefaultErrorHandler(new WorkflowErrorHandler() {
public void handleError(WorkflowContext context, Throwable throwable) {
SC.warn(I18nProvider.getGlobal().saveEditingAborted() + throwable.getMessage());
}
});
processor.setActivities(activities);
processor.doActivities(mapModel);
// Cleaning up duties: controller and MapWidget (if they're present)
if (controller != null) {
controller.cleanup();
}
if (mapWidget != null) {
mapWidget.render(featureTransaction, RenderGroup.VECTOR, RenderStatus.DELETE);
}
mapModel.getFeatureEditor().stopEditing();
}
} | [
"public",
"void",
"onClick",
"(",
"MenuItemClickEvent",
"event",
")",
"{",
"FeatureTransaction",
"featureTransaction",
"=",
"mapModel",
".",
"getFeatureEditor",
"(",
")",
".",
"getFeatureTransaction",
"(",
")",
";",
"if",
"(",
"featureTransaction",
"!=",
"null",
"... | Saves editing, and also removes the {@link FeatureTransaction} object from the map.
@param event
The {@link MenuItemClickEvent} from clicking the action. | [
"Saves",
"editing",
"and",
"also",
"removes",
"the",
"{",
"@link",
"FeatureTransaction",
"}",
"object",
"from",
"the",
"map",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/menu/SaveEditingAction.java#L85-L110 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.createOrUpdateAsync | public Observable<DatabaseAccountInner> createOrUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() {
@Override
public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseAccountInner> createOrUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() {
@Override
public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseAccountInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"DatabaseAccountCreateUpdateParameters",
"createUpdateParameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",... | Creates or updates an Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param createUpdateParameters The parameters to provide for the current database account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"an",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L472-L479 |
xcesco/kripton | kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java | XMLSerializer.writeIntegerAttribute | public void writeIntegerAttribute(String prefix, String namespaceURI, String localName, BigInteger value) throws Exception {
this.attribute(namespaceURI, localName, value.toString());
} | java | public void writeIntegerAttribute(String prefix, String namespaceURI, String localName, BigInteger value) throws Exception {
this.attribute(namespaceURI, localName, value.toString());
} | [
"public",
"void",
"writeIntegerAttribute",
"(",
"String",
"prefix",
",",
"String",
"namespaceURI",
",",
"String",
"localName",
",",
"BigInteger",
"value",
")",
"throws",
"Exception",
"{",
"this",
".",
"attribute",
"(",
"namespaceURI",
",",
"localName",
",",
"val... | Write integer attribute.
@param prefix the prefix
@param namespaceURI the namespace URI
@param localName the local name
@param value the value
@throws Exception the exception | [
"Write",
"integer",
"attribute",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java#L1657-L1660 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/model/DefBase.java | DefBase.getBooleanProperty | public boolean getBooleanProperty(String name, boolean defaultValue)
{
return PropertyHelper.toBoolean(_properties.getProperty(name), defaultValue);
} | java | public boolean getBooleanProperty(String name, boolean defaultValue)
{
return PropertyHelper.toBoolean(_properties.getProperty(name), defaultValue);
} | [
"public",
"boolean",
"getBooleanProperty",
"(",
"String",
"name",
",",
"boolean",
"defaultValue",
")",
"{",
"return",
"PropertyHelper",
".",
"toBoolean",
"(",
"_properties",
".",
"getProperty",
"(",
"name",
")",
",",
"defaultValue",
")",
";",
"}"
] | Returns the boolean value of the specified property.
@param name The name of the property
@param defaultValue The value to use if the property is not set or not a boolean
@return The value | [
"Returns",
"the",
"boolean",
"value",
"of",
"the",
"specified",
"property",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/DefBase.java#L112-L115 |
apache/incubator-atlas | client/src/main/java/org/apache/atlas/AtlasClient.java | AtlasClient.listTypes | public List<String> listTypes() throws AtlasServiceException {
final JSONObject jsonObject = callAPIWithQueryParams(API.LIST_TYPES, null);
return extractResults(jsonObject, AtlasClient.RESULTS, new ExtractOperation<String, String>());
} | java | public List<String> listTypes() throws AtlasServiceException {
final JSONObject jsonObject = callAPIWithQueryParams(API.LIST_TYPES, null);
return extractResults(jsonObject, AtlasClient.RESULTS, new ExtractOperation<String, String>());
} | [
"public",
"List",
"<",
"String",
">",
"listTypes",
"(",
")",
"throws",
"AtlasServiceException",
"{",
"final",
"JSONObject",
"jsonObject",
"=",
"callAPIWithQueryParams",
"(",
"API",
".",
"LIST_TYPES",
",",
"null",
")",
";",
"return",
"extractResults",
"(",
"jsonO... | Returns all type names in the system
@return list of type names
@throws AtlasServiceException | [
"Returns",
"all",
"type",
"names",
"in",
"the",
"system"
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/client/src/main/java/org/apache/atlas/AtlasClient.java#L360-L363 |
nominanuda/zen-project | zen-image/src/main/java/com/nominanuda/image/ImageGet.java | ImageGet.handle | public Object handle(Stru _cmd, HttpRequest request) throws Exception {
try {
Check.illegalargument.assertEquals(GET, request.getRequestLine().getMethod());
Obj cmd = _cmd.asObj();
@Nullable String path = cmd.getStr(CMD_PATH);
String nameAndTx = cmd.getStrictStr(CMD_NAME);
String ext = cmd.getStrictStr(CMD_EXT);
int dotPos = nameAndTx.indexOf('.');
String name = dotPos > 0 ? nameAndTx.substring(0, dotPos) : nameAndTx;
String tx = dotPos > 0 ? nameAndTx.substring(dotPos + 1) : null;
if (path != null) name = Uris.URIS.pathJoin(path, name);
Tuple2<String, byte[]> foundImage = imageStore.get(name, ext);
if (foundImage == null) {
return HTTP.createBasicResponse(
SC_NOT_FOUND,
Obj.make("reason", statusToReason.get(SC_NOT_FOUND)).toString(),
CT_APPLICATION_JSON_CS_UTF8);
} else {
ByteArrayEntity res;
byte[] image = foundImage.get1();
if (tx == null && fmtEquals(ext, foundImage.get0())) {
res = new ByteArrayEntity(image);
} else {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Tuple2<BufferedImage, String> biAndFmt = imageSizeFilter.readImageAndFormat(new ByteArrayInputStream(image));
BufferedImage src = biAndFmt.get0();
imageSizeFilter.resize(src, baos, ext, getWidthAndHeight(src.getWidth(), src.getHeight(), tx));
res = new ByteArrayEntity(baos.toByteArray());
}
res.setContentType(fmt2contentType(ext));
return res;
}
} catch (Exception e) {
throw new Http500Exception(e);
}
} | java | public Object handle(Stru _cmd, HttpRequest request) throws Exception {
try {
Check.illegalargument.assertEquals(GET, request.getRequestLine().getMethod());
Obj cmd = _cmd.asObj();
@Nullable String path = cmd.getStr(CMD_PATH);
String nameAndTx = cmd.getStrictStr(CMD_NAME);
String ext = cmd.getStrictStr(CMD_EXT);
int dotPos = nameAndTx.indexOf('.');
String name = dotPos > 0 ? nameAndTx.substring(0, dotPos) : nameAndTx;
String tx = dotPos > 0 ? nameAndTx.substring(dotPos + 1) : null;
if (path != null) name = Uris.URIS.pathJoin(path, name);
Tuple2<String, byte[]> foundImage = imageStore.get(name, ext);
if (foundImage == null) {
return HTTP.createBasicResponse(
SC_NOT_FOUND,
Obj.make("reason", statusToReason.get(SC_NOT_FOUND)).toString(),
CT_APPLICATION_JSON_CS_UTF8);
} else {
ByteArrayEntity res;
byte[] image = foundImage.get1();
if (tx == null && fmtEquals(ext, foundImage.get0())) {
res = new ByteArrayEntity(image);
} else {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Tuple2<BufferedImage, String> biAndFmt = imageSizeFilter.readImageAndFormat(new ByteArrayInputStream(image));
BufferedImage src = biAndFmt.get0();
imageSizeFilter.resize(src, baos, ext, getWidthAndHeight(src.getWidth(), src.getHeight(), tx));
res = new ByteArrayEntity(baos.toByteArray());
}
res.setContentType(fmt2contentType(ext));
return res;
}
} catch (Exception e) {
throw new Http500Exception(e);
}
} | [
"public",
"Object",
"handle",
"(",
"Stru",
"_cmd",
",",
"HttpRequest",
"request",
")",
"throws",
"Exception",
"{",
"try",
"{",
"Check",
".",
"illegalargument",
".",
"assertEquals",
"(",
"GET",
",",
"request",
".",
"getRequestLine",
"(",
")",
".",
"getMethod"... | (path/)name.ext | (path/)name.xH.ext | (path/)name.Wx.ext | (path/)name.WxH.ext | [
"(",
"path",
"/",
")",
"name",
".",
"ext",
"|",
"(",
"path",
"/",
")",
"name",
".",
"xH",
".",
"ext",
"|",
"(",
"path",
"/",
")",
"name",
".",
"Wx",
".",
"ext",
"|",
"(",
"path",
"/",
")",
"name",
".",
"WxH",
".",
"ext"
] | train | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-image/src/main/java/com/nominanuda/image/ImageGet.java#L111-L147 |
lightblue-platform/lightblue-client | core/src/main/java/com/redhat/lightblue/client/Query.java | Query.logical | public static Query logical(LogOp op, Collection<Query> expressions) {
Query q = new Query(true);
for (Query x : expressions) {
((ArrayNode) q.node).add(x.toJson());
}
Query a = new Query(false);
a.add(op.toString(), q.toJson());
return a;
} | java | public static Query logical(LogOp op, Collection<Query> expressions) {
Query q = new Query(true);
for (Query x : expressions) {
((ArrayNode) q.node).add(x.toJson());
}
Query a = new Query(false);
a.add(op.toString(), q.toJson());
return a;
} | [
"public",
"static",
"Query",
"logical",
"(",
"LogOp",
"op",
",",
"Collection",
"<",
"Query",
">",
"expressions",
")",
"{",
"Query",
"q",
"=",
"new",
"Query",
"(",
"true",
")",
";",
"for",
"(",
"Query",
"x",
":",
"expressions",
")",
"{",
"(",
"(",
"... | <pre>
{ $and : [ expressions ] }
{ $or : [ expressions ] }
</pre> | [
"<pre",
">",
"{",
"$and",
":",
"[",
"expressions",
"]",
"}",
"{",
"$or",
":",
"[",
"expressions",
"]",
"}",
"<",
"/",
"pre",
">"
] | train | https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/Query.java#L548-L556 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.resolveQualifiedMethod | Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
Type site, Name name, List<Type> argtypes,
List<Type> typeargtypes) {
return resolveQualifiedMethod(pos, env, site.tsym, site, name, argtypes, typeargtypes);
} | java | Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
Type site, Name name, List<Type> argtypes,
List<Type> typeargtypes) {
return resolveQualifiedMethod(pos, env, site.tsym, site, name, argtypes, typeargtypes);
} | [
"Symbol",
"resolveQualifiedMethod",
"(",
"DiagnosticPosition",
"pos",
",",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Type",
"site",
",",
"Name",
"name",
",",
"List",
"<",
"Type",
">",
"argtypes",
",",
"List",
"<",
"Type",
">",
"typeargtypes",
")",
"{",
... | Resolve a qualified method identifier
@param pos The position to use for error reporting.
@param env The environment current at the method invocation.
@param site The type of the qualifying expression, in which
identifier is searched.
@param name The identifier's name.
@param argtypes The types of the invocation's value arguments.
@param typeargtypes The types of the invocation's type arguments. | [
"Resolve",
"a",
"qualified",
"method",
"identifier"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java#L2610-L2614 |
elki-project/elki | elki-core/src/main/java/de/lmu/ifi/dbs/elki/evaluation/scores/NDCGEvaluation.java | NDCGEvaluation.computeNDCG | public static <I extends ScoreIter> double computeNDCG(Predicate<? super I> predicate, I iter) {
double sum = 0.;
int i = 0, positive = 0, tied = 0, totalpos = 0;
while(iter.valid()) {
// positive or negative match?
do {
if(predicate.test(iter)) {
++positive;
}
++tied;
++i;
iter.advance();
} // Loop while tied:
while(iter.valid() && iter.tiedToPrevious());
// We only support binary labeling, and can ignore negative weight.
if(positive > 0) {
sum += tied == 1 ? 1. / FastMath.log(i + 1) : //
DCGEvaluation.sumInvLog1p(i - tied + 1, i) * positive / (double) tied;
totalpos += positive;
}
positive = 0;
tied = 0;
}
// Optimum value:
double idcg = DCGEvaluation.sumInvLog1p(1, totalpos);
return sum / idcg; // log(2) base would disappear
} | java | public static <I extends ScoreIter> double computeNDCG(Predicate<? super I> predicate, I iter) {
double sum = 0.;
int i = 0, positive = 0, tied = 0, totalpos = 0;
while(iter.valid()) {
// positive or negative match?
do {
if(predicate.test(iter)) {
++positive;
}
++tied;
++i;
iter.advance();
} // Loop while tied:
while(iter.valid() && iter.tiedToPrevious());
// We only support binary labeling, and can ignore negative weight.
if(positive > 0) {
sum += tied == 1 ? 1. / FastMath.log(i + 1) : //
DCGEvaluation.sumInvLog1p(i - tied + 1, i) * positive / (double) tied;
totalpos += positive;
}
positive = 0;
tied = 0;
}
// Optimum value:
double idcg = DCGEvaluation.sumInvLog1p(1, totalpos);
return sum / idcg; // log(2) base would disappear
} | [
"public",
"static",
"<",
"I",
"extends",
"ScoreIter",
">",
"double",
"computeNDCG",
"(",
"Predicate",
"<",
"?",
"super",
"I",
">",
"predicate",
",",
"I",
"iter",
")",
"{",
"double",
"sum",
"=",
"0.",
";",
"int",
"i",
"=",
"0",
",",
"positive",
"=",
... | Compute the DCG given a set of positive IDs and a sorted list of entries,
which may include ties.
@param <I> Iterator type
@param predicate Predicate to test for positive objects
@param iter Iterator over results, with ties.
@return area under curve | [
"Compute",
"the",
"DCG",
"given",
"a",
"set",
"of",
"positive",
"IDs",
"and",
"a",
"sorted",
"list",
"of",
"entries",
"which",
"may",
"include",
"ties",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/evaluation/scores/NDCGEvaluation.java#L80-L106 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.readLines | public static void readLines(RandomAccessFile file, Charset charset, LineHandler lineHandler) {
String line = null;
try {
while ((line = file.readLine()) != null) {
lineHandler.handle(CharsetUtil.convert(line, CharsetUtil.CHARSET_ISO_8859_1, charset));
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static void readLines(RandomAccessFile file, Charset charset, LineHandler lineHandler) {
String line = null;
try {
while ((line = file.readLine()) != null) {
lineHandler.handle(CharsetUtil.convert(line, CharsetUtil.CHARSET_ISO_8859_1, charset));
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"void",
"readLines",
"(",
"RandomAccessFile",
"file",
",",
"Charset",
"charset",
",",
"LineHandler",
"lineHandler",
")",
"{",
"String",
"line",
"=",
"null",
";",
"try",
"{",
"while",
"(",
"(",
"line",
"=",
"file",
".",
"readLine",
"(",
... | 按行处理文件内容
@param file {@link RandomAccessFile}文件
@param charset 编码
@param lineHandler {@link LineHandler}行处理器
@throws IORuntimeException IO异常
@since 4.5.2 | [
"按行处理文件内容"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2428-L2437 |
icode/ameba-utils | src/main/java/ameba/util/ClassUtils.java | ClassUtils.newInstance | public static <T> T newInstance(Class clazz, Object... args) {
if (clazz == null) return null;
Class[] argsClass = getArgsClasses(args);
try {
Constructor<T> constructor = clazz.<T>getConstructor(argsClass);
return constructor.newInstance(args);
} catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
throw new IllegalStateException(e.getMessage(), e);
}
} | java | public static <T> T newInstance(Class clazz, Object... args) {
if (clazz == null) return null;
Class[] argsClass = getArgsClasses(args);
try {
Constructor<T> constructor = clazz.<T>getConstructor(argsClass);
return constructor.newInstance(args);
} catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
throw new IllegalStateException(e.getMessage(), e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Class",
"clazz",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"return",
"null",
";",
"Class",
"[",
"]",
"argsClass",
"=",
"getArgsClasses",
"(",
"args",
")... | <p>newInstance.</p>
@param clazz a {@link java.lang.Class} object.
@param args a {@link java.lang.Object} object.
@param <T> a T object.
@return a T object. | [
"<p",
">",
"newInstance",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/ClassUtils.java#L92-L104 |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/Zhang99CalibrationMatrixFromHomographies.java | Zhang99CalibrationMatrixFromHomographies.setupA | private void setupA( List<DMatrixRMaj> homographies ) {
A.reshape(2*homographies.size(),6, false);
DMatrixRMaj h1 = new DMatrixRMaj(3,1);
DMatrixRMaj h2 = new DMatrixRMaj(3,1);
DMatrixRMaj v12 = new DMatrixRMaj(1,6);
DMatrixRMaj v11 = new DMatrixRMaj(1,6);
DMatrixRMaj v22 = new DMatrixRMaj(1,6);
DMatrixRMaj v11m22 = new DMatrixRMaj(1,6);
for( int i = 0; i < homographies.size(); i++ ) {
DMatrixRMaj H = homographies.get(i);
CommonOps_DDRM.extract(H,0,3,0,1,h1,0,0);
CommonOps_DDRM.extract(H,0,3,1,2,h2,0,0);
// normalize H by the max value to reduce numerical error when computing A
// several numbers are multiplied against each other and could become quite large/small
double max1 = CommonOps_DDRM.elementMaxAbs(h1);
double max2 = CommonOps_DDRM.elementMaxAbs(h2);
double max = Math.max(max1,max2);
CommonOps_DDRM.divide(h1,max);
CommonOps_DDRM.divide(h2,max);
// compute elements of A
computeV(h1, h2, v12);
computeV(h1, h1, v11);
computeV(h2, h2, v22);
CommonOps_DDRM.subtract(v11, v22, v11m22);
CommonOps_DDRM.insert( v12 , A, i*2 , 0);
CommonOps_DDRM.insert( v11m22 , A, i*2+1 , 0);
}
} | java | private void setupA( List<DMatrixRMaj> homographies ) {
A.reshape(2*homographies.size(),6, false);
DMatrixRMaj h1 = new DMatrixRMaj(3,1);
DMatrixRMaj h2 = new DMatrixRMaj(3,1);
DMatrixRMaj v12 = new DMatrixRMaj(1,6);
DMatrixRMaj v11 = new DMatrixRMaj(1,6);
DMatrixRMaj v22 = new DMatrixRMaj(1,6);
DMatrixRMaj v11m22 = new DMatrixRMaj(1,6);
for( int i = 0; i < homographies.size(); i++ ) {
DMatrixRMaj H = homographies.get(i);
CommonOps_DDRM.extract(H,0,3,0,1,h1,0,0);
CommonOps_DDRM.extract(H,0,3,1,2,h2,0,0);
// normalize H by the max value to reduce numerical error when computing A
// several numbers are multiplied against each other and could become quite large/small
double max1 = CommonOps_DDRM.elementMaxAbs(h1);
double max2 = CommonOps_DDRM.elementMaxAbs(h2);
double max = Math.max(max1,max2);
CommonOps_DDRM.divide(h1,max);
CommonOps_DDRM.divide(h2,max);
// compute elements of A
computeV(h1, h2, v12);
computeV(h1, h1, v11);
computeV(h2, h2, v22);
CommonOps_DDRM.subtract(v11, v22, v11m22);
CommonOps_DDRM.insert( v12 , A, i*2 , 0);
CommonOps_DDRM.insert( v11m22 , A, i*2+1 , 0);
}
} | [
"private",
"void",
"setupA",
"(",
"List",
"<",
"DMatrixRMaj",
">",
"homographies",
")",
"{",
"A",
".",
"reshape",
"(",
"2",
"*",
"homographies",
".",
"size",
"(",
")",
",",
"6",
",",
"false",
")",
";",
"DMatrixRMaj",
"h1",
"=",
"new",
"DMatrixRMaj",
... | Sets up the system of equations which are to be solved. This equation is derived from
constraints (3) and (4) in the paper. See section 3.1.
@param homographies set of observed homographies. | [
"Sets",
"up",
"the",
"system",
"of",
"equations",
"which",
"are",
"to",
"be",
"solved",
".",
"This",
"equation",
"is",
"derived",
"from",
"constraints",
"(",
"3",
")",
"and",
"(",
"4",
")",
"in",
"the",
"paper",
".",
"See",
"section",
"3",
".",
"1",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/Zhang99CalibrationMatrixFromHomographies.java#L123-L160 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mime/MimeTypeDeterminator.java | MimeTypeDeterminator.getMimeTypeFromString | @Nonnull
public IMimeType getMimeTypeFromString (@Nullable final String s, @Nonnull final Charset aCharset)
{
return getMimeTypeFromString (s, aCharset, DEFAULT_MIME_TYPE);
} | java | @Nonnull
public IMimeType getMimeTypeFromString (@Nullable final String s, @Nonnull final Charset aCharset)
{
return getMimeTypeFromString (s, aCharset, DEFAULT_MIME_TYPE);
} | [
"@",
"Nonnull",
"public",
"IMimeType",
"getMimeTypeFromString",
"(",
"@",
"Nullable",
"final",
"String",
"s",
",",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"return",
"getMimeTypeFromString",
"(",
"s",
",",
"aCharset",
",",
"DEFAULT_MIME_TYPE",
"... | Try to find the MIME type that matches the passed content string.
@param s
The content string to check. May be <code>null</code>.
@param aCharset
The charset used to convert the string to a byte array. May not be
<code>null</code>.
@return {@link #DEFAULT_MIME_TYPE} if no matching MIME type was found.
Never <code>null</code>. | [
"Try",
"to",
"find",
"the",
"MIME",
"type",
"that",
"matches",
"the",
"passed",
"content",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mime/MimeTypeDeterminator.java#L180-L184 |
brettonw/Bag | src/main/java/com/brettonw/bag/Bag.java | Bag.getString | public String getString (String key, Supplier<String> notFound) {
Object object = getObject (key);
return (object instanceof String) ? (String) object : notFound.get ();
} | java | public String getString (String key, Supplier<String> notFound) {
Object object = getObject (key);
return (object instanceof String) ? (String) object : notFound.get ();
} | [
"public",
"String",
"getString",
"(",
"String",
"key",
",",
"Supplier",
"<",
"String",
">",
"notFound",
")",
"{",
"Object",
"object",
"=",
"getObject",
"(",
"key",
")",
";",
"return",
"(",
"object",
"instanceof",
"String",
")",
"?",
"(",
"String",
")",
... | Retrieve a mapped element and return it as a String.
@param key A string value used to index the element.
@param notFound A function to create a new String if the requested key was not found
@return The element as a string, or notFound if the element is not found. | [
"Retrieve",
"a",
"mapped",
"element",
"and",
"return",
"it",
"as",
"a",
"String",
"."
] | train | https://github.com/brettonw/Bag/blob/25c0ff74893b6c9a2c61bf0f97189ab82e0b2f56/src/main/java/com/brettonw/bag/Bag.java#L86-L89 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java | UtilReflection.hasCompatibleConstructor | private static boolean hasCompatibleConstructor(Class<?>[] paramTypes, Class<?>[] constructorTypes)
{
for (int i = 0; i < paramTypes.length; i++)
{
if (constructorTypes[i].isAssignableFrom(paramTypes[i]))
{
return true;
}
}
return false;
} | java | private static boolean hasCompatibleConstructor(Class<?>[] paramTypes, Class<?>[] constructorTypes)
{
for (int i = 0; i < paramTypes.length; i++)
{
if (constructorTypes[i].isAssignableFrom(paramTypes[i]))
{
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"hasCompatibleConstructor",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"paramTypes",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"constructorTypes",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"paramTypes",
".",
... | Check if there is a compatible constructor for the types.
@param paramTypes The types as input.
@param constructorTypes The constructors to check.
@return <code>true</code> if at least one constructor is compatible, <code>false</code> else. | [
"Check",
"if",
"there",
"is",
"a",
"compatible",
"constructor",
"for",
"the",
"types",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java#L443-L453 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/Member.java | Member.normalizeY | void normalizeY(double yMax, int normMax) {
exploded.forEach(y -> {
int norm = (int) Math.round((y / yMax) * normMax);
normalized.add(norm);
});
} | java | void normalizeY(double yMax, int normMax) {
exploded.forEach(y -> {
int norm = (int) Math.round((y / yMax) * normMax);
normalized.add(norm);
});
} | [
"void",
"normalizeY",
"(",
"double",
"yMax",
",",
"int",
"normMax",
")",
"{",
"exploded",
".",
"forEach",
"(",
"y",
"->",
"{",
"int",
"norm",
"=",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"(",
"y",
"/",
"yMax",
")",
"*",
"normMax",
")",
";",
... | Create the normalized point set.
<p>
@param yMax the overall max value
@param normMax the normalized max | [
"Create",
"the",
"normalized",
"point",
"set",
".",
"<p",
">"
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/Member.java#L326-L331 |
zerodhatech/javakiteconnect | kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java | KiteRequestHandler.createPostRequest | public Request createPostRequest(String url, Map<String, Object> params, String apiKey, String accessToken) {
FormBody.Builder builder = new FormBody.Builder();
for(Map.Entry<String, Object> entry: params.entrySet()){
builder.add(entry.getKey(), entry.getValue().toString());
}
RequestBody requestBody = builder.build();
Request request = new Request.Builder().url(url).post(requestBody).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build();
return request;
} | java | public Request createPostRequest(String url, Map<String, Object> params, String apiKey, String accessToken) {
FormBody.Builder builder = new FormBody.Builder();
for(Map.Entry<String, Object> entry: params.entrySet()){
builder.add(entry.getKey(), entry.getValue().toString());
}
RequestBody requestBody = builder.build();
Request request = new Request.Builder().url(url).post(requestBody).header("User-Agent", USER_AGENT).header("X-Kite-Version", "3").header("Authorization", "token "+apiKey+":"+accessToken).build();
return request;
} | [
"public",
"Request",
"createPostRequest",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
",",
"String",
"apiKey",
",",
"String",
"accessToken",
")",
"{",
"FormBody",
".",
"Builder",
"builder",
"=",
"new",
"FormBody",
".",
"B... | Creates a POST request.
@param url is the endpoint to which request has to be done.
@param apiKey is the api key of the Kite Connect app.
@param accessToken is the access token obtained after successful login process.
@param params is the map of data that has to be sent in the body. | [
"Creates",
"a",
"POST",
"request",
"."
] | train | https://github.com/zerodhatech/javakiteconnect/blob/4a3f15ff2c8a1b3b6ec61799f8bb047e4dfeb92d/kiteconnect/src/com/zerodhatech/kiteconnect/kitehttp/KiteRequestHandler.java#L198-L207 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/internalCssScriptResource/InternalCssScriptResourceRenderer.java | InternalCssScriptResourceRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
InternalCssScriptResource internalCssScriptResource = (InternalCssScriptResource) component;
ResponseWriter rw = context.getResponseWriter();
rw.startElement("link", internalCssScriptResource);
rw.writeAttribute("type", "text/css", null);
rw.writeAttribute("rel", "stylesheet", null);
rw.writeAttribute("href", internalCssScriptResource.getUrl(), null);
rw.endElement("link");
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
InternalCssScriptResource internalCssScriptResource = (InternalCssScriptResource) component;
ResponseWriter rw = context.getResponseWriter();
rw.startElement("link", internalCssScriptResource);
rw.writeAttribute("type", "text/css", null);
rw.writeAttribute("rel", "stylesheet", null);
rw.writeAttribute("href", internalCssScriptResource.getUrl(), null);
rw.endElement("link");
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"InternalCssScriptReso... | This methods generates the HTML code of the current b:internalCssScriptResource.
@param context the FacesContext.
@param component the current b:internalCssScriptResource.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"internalCssScriptResource",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/internalCssScriptResource/InternalCssScriptResourceRenderer.java#L40-L55 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentUrl.java | DocumentUrl.transformDocumentContentUrl | public static MozuUrl transformDocumentContentUrl(String crop, String documentId, String documentListName, Integer height, Integer max, Integer maxHeight, Integer maxWidth, Integer quality, Integer width)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documents/{documentId}/transform?width={width}&height={height}&maxWidth={maxWidth}&maxHeight={maxHeight}&crop={crop}&quality={quality}");
formatter.formatUrl("crop", crop);
formatter.formatUrl("documentId", documentId);
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("height", height);
formatter.formatUrl("max", max);
formatter.formatUrl("maxHeight", maxHeight);
formatter.formatUrl("maxWidth", maxWidth);
formatter.formatUrl("quality", quality);
formatter.formatUrl("width", width);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl transformDocumentContentUrl(String crop, String documentId, String documentListName, Integer height, Integer max, Integer maxHeight, Integer maxWidth, Integer quality, Integer width)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documents/{documentId}/transform?width={width}&height={height}&maxWidth={maxWidth}&maxHeight={maxHeight}&crop={crop}&quality={quality}");
formatter.formatUrl("crop", crop);
formatter.formatUrl("documentId", documentId);
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("height", height);
formatter.formatUrl("max", max);
formatter.formatUrl("maxHeight", maxHeight);
formatter.formatUrl("maxWidth", maxWidth);
formatter.formatUrl("quality", quality);
formatter.formatUrl("width", width);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"transformDocumentContentUrl",
"(",
"String",
"crop",
",",
"String",
"documentId",
",",
"String",
"documentListName",
",",
"Integer",
"height",
",",
"Integer",
"max",
",",
"Integer",
"maxHeight",
",",
"Integer",
"maxWidth",
",",
"Int... | Get Resource Url for TransformDocumentContent
@param crop Crops the image based on the specified coordinates. The reference point for positive coordinates is the top-left corner of the image, and the reference point for negative coordinates is the bottom-right corner of the image.Usage: Example: removes 10 pixels from all edges of the image. leaves the image uncropped.
@param documentId Unique identifier for a document, used by content and document calls. Document IDs are associated with document types, document type lists, sites, and tenants.
@param documentListName Name of content documentListName to delete
@param height Specifies an exact height dimension for the image, in pixels.
@param max Specifies a pixel limitation for the largest side of an image.
@param maxHeight Specifies a pixel limitation for the height of the image, preserving the aspect ratio if the image needs resizing.
@param maxWidth Specifies a pixel limitation for the width of the image, preserving the aspect ratio if the image needs resizing.
@param quality Adjusts the image compression. Accepts values from 0-100, where 100 = highest quality, least compression.
@param width Specifies an exact width dimension for the image, in pixels.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"TransformDocumentContent"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentUrl.java#L43-L56 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java | RandomMatrices_DDRM.symmetricPosDef | public static DMatrixRMaj symmetricPosDef(int width, Random rand) {
// This is not formally proven to work. It just seems to work.
DMatrixRMaj a = new DMatrixRMaj(width,1);
DMatrixRMaj b = new DMatrixRMaj(width,width);
for( int i = 0; i < width; i++ ) {
a.set(i,0,rand.nextDouble());
}
CommonOps_DDRM.multTransB(a,a,b);
for( int i = 0; i < width; i++ ) {
b.add(i,i,1);
}
return b;
} | java | public static DMatrixRMaj symmetricPosDef(int width, Random rand) {
// This is not formally proven to work. It just seems to work.
DMatrixRMaj a = new DMatrixRMaj(width,1);
DMatrixRMaj b = new DMatrixRMaj(width,width);
for( int i = 0; i < width; i++ ) {
a.set(i,0,rand.nextDouble());
}
CommonOps_DDRM.multTransB(a,a,b);
for( int i = 0; i < width; i++ ) {
b.add(i,i,1);
}
return b;
} | [
"public",
"static",
"DMatrixRMaj",
"symmetricPosDef",
"(",
"int",
"width",
",",
"Random",
"rand",
")",
"{",
"// This is not formally proven to work. It just seems to work.",
"DMatrixRMaj",
"a",
"=",
"new",
"DMatrixRMaj",
"(",
"width",
",",
"1",
")",
";",
"DMatrixRMaj... | Creates a random symmetric positive definite matrix.
@param width The width of the square matrix it returns.
@param rand Random number generator used to make the matrix.
@return The random symmetric positive definite matrix. | [
"Creates",
"a",
"random",
"symmetric",
"positive",
"definite",
"matrix",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L439-L455 |
arxanchain/java-common | src/main/java/com/arxanfintech/common/crypto/core/ECKey.java | ECKey.fromPrivateAndPrecalculatedPublic | public static ECKey fromPrivateAndPrecalculatedPublic(byte[] priv, byte[] pub) {
check(priv != null, "Private key must not be null");
check(pub != null, "Public key must not be null");
return new ECKey(new BigInteger(1, priv), CURVE.getCurve().decodePoint(pub));
} | java | public static ECKey fromPrivateAndPrecalculatedPublic(byte[] priv, byte[] pub) {
check(priv != null, "Private key must not be null");
check(pub != null, "Public key must not be null");
return new ECKey(new BigInteger(1, priv), CURVE.getCurve().decodePoint(pub));
} | [
"public",
"static",
"ECKey",
"fromPrivateAndPrecalculatedPublic",
"(",
"byte",
"[",
"]",
"priv",
",",
"byte",
"[",
"]",
"pub",
")",
"{",
"check",
"(",
"priv",
"!=",
"null",
",",
"\"Private key must not be null\"",
")",
";",
"check",
"(",
"pub",
"!=",
"null",... | Creates an ECKey that simply trusts the caller to ensure that point is really
the result of multiplying the generator point by the private key. This is
used to speed things up when you know you have the right values already. The
compression state of the point will be preserved.
@param priv
-
@param pub
-
@return - | [
"Creates",
"an",
"ECKey",
"that",
"simply",
"trusts",
"the",
"caller",
"to",
"ensure",
"that",
"point",
"is",
"really",
"the",
"result",
"of",
"multiplying",
"the",
"generator",
"point",
"by",
"the",
"private",
"key",
".",
"This",
"is",
"used",
"to",
"spee... | train | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L357-L361 |
threerings/nenya | core/src/main/java/com/threerings/miso/client/SceneBlock.java | SceneBlock.updateFringe | public void updateFringe (int tx, int ty)
{
int tidx = index(tx, ty);
if (_base[tidx] != null) {
_fringe[tidx] = computeFringeTile(tx, ty);
}
} | java | public void updateFringe (int tx, int ty)
{
int tidx = index(tx, ty);
if (_base[tidx] != null) {
_fringe[tidx] = computeFringeTile(tx, ty);
}
} | [
"public",
"void",
"updateFringe",
"(",
"int",
"tx",
",",
"int",
"ty",
")",
"{",
"int",
"tidx",
"=",
"index",
"(",
"tx",
",",
"ty",
")",
";",
"if",
"(",
"_base",
"[",
"tidx",
"]",
"!=",
"null",
")",
"{",
"_fringe",
"[",
"tidx",
"]",
"=",
"comput... | Instructs this block to recompute its fringe at the specified
location. | [
"Instructs",
"this",
"block",
"to",
"recompute",
"its",
"fringe",
"at",
"the",
"specified",
"location",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneBlock.java#L346-L352 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java | ExtendedSwidProcessor.setSerialNumber | public ExtendedSwidProcessor setSerialNumber(final String serialNumber) {
swidTag.setSerialNumber(new Token(serialNumber, idGenerator.nextId()));
return this;
} | java | public ExtendedSwidProcessor setSerialNumber(final String serialNumber) {
swidTag.setSerialNumber(new Token(serialNumber, idGenerator.nextId()));
return this;
} | [
"public",
"ExtendedSwidProcessor",
"setSerialNumber",
"(",
"final",
"String",
"serialNumber",
")",
"{",
"swidTag",
".",
"setSerialNumber",
"(",
"new",
"Token",
"(",
"serialNumber",
",",
"idGenerator",
".",
"nextId",
"(",
")",
")",
")",
";",
"return",
"this",
"... | Defines product serialNumber (tag: serial_number).
@param serialNumber
product serialNumber
@return a reference to this object. | [
"Defines",
"product",
"serialNumber",
"(",
"tag",
":",
"serial_number",
")",
"."
] | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java#L188-L191 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java | CommerceWarehousePersistenceImpl.findByG_C_P | @Override
public List<CommerceWarehouse> findByG_C_P(long groupId,
long commerceCountryId, boolean primary, int start, int end) {
return findByG_C_P(groupId, commerceCountryId, primary, start, end, null);
} | java | @Override
public List<CommerceWarehouse> findByG_C_P(long groupId,
long commerceCountryId, boolean primary, int start, int end) {
return findByG_C_P(groupId, commerceCountryId, primary, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceWarehouse",
">",
"findByG_C_P",
"(",
"long",
"groupId",
",",
"long",
"commerceCountryId",
",",
"boolean",
"primary",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByG_C_P",
"(",
"groupId",
"... | Returns a range of all the commerce warehouses where groupId = ? and commerceCountryId = ? and primary = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceWarehouseModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param commerceCountryId the commerce country ID
@param primary the primary
@param start the lower bound of the range of commerce warehouses
@param end the upper bound of the range of commerce warehouses (not inclusive)
@return the range of matching commerce warehouses | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"warehouses",
"where",
"groupId",
"=",
"?",
";",
"and",
"commerceCountryId",
"=",
"?",
";",
"and",
"primary",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java#L3490-L3494 |
google/closure-compiler | src/com/google/javascript/jscomp/Es6RewriteDestructuring.java | Es6RewriteDestructuring.wrapAssignmentInCallToArrow | private void wrapAssignmentInCallToArrow(NodeTraversal t, Node assignment) {
String tempVarName = getTempVariableName();
Node tempVarModel = astFactory.createName(tempVarName, assignment.getJSType());
Node rhs = assignment.getLastChild().detach();
// let temp0 = rhs;
Node newAssignment = IR.let(tempVarModel.cloneNode(), rhs);
NodeUtil.addFeatureToScript(t.getCurrentScript(), Feature.LET_DECLARATIONS);
// [x, y] = temp0;
Node replacementExpr =
astFactory.createAssign(assignment.getFirstChild().detach(), tempVarModel.cloneNode());
Node exprResult = IR.exprResult(replacementExpr);
// return temp0;
Node returnNode = IR.returnNode(tempVarModel.cloneNode());
// Create a function to hold these assignments:
Node block = IR.block(newAssignment, exprResult, returnNode);
Node arrowFn = astFactory.createZeroArgFunction(/* name= */ "", block, assignment.getJSType());
arrowFn.setIsArrowFunction(true);
// Create a call to the function, and replace the pattern with the call.
Node call = astFactory.createCall(arrowFn);
NodeUtil.addFeatureToScript(t.getCurrentScript(), Feature.ARROW_FUNCTIONS);
call.useSourceInfoIfMissingFromForTree(assignment);
call.putBooleanProp(Node.FREE_CALL, true);
assignment.getParent().replaceChild(assignment, call);
NodeUtil.markNewScopesChanged(call, compiler);
replacePattern(
t,
replacementExpr.getFirstChild(),
replacementExpr.getLastChild(),
replacementExpr,
exprResult);
} | java | private void wrapAssignmentInCallToArrow(NodeTraversal t, Node assignment) {
String tempVarName = getTempVariableName();
Node tempVarModel = astFactory.createName(tempVarName, assignment.getJSType());
Node rhs = assignment.getLastChild().detach();
// let temp0 = rhs;
Node newAssignment = IR.let(tempVarModel.cloneNode(), rhs);
NodeUtil.addFeatureToScript(t.getCurrentScript(), Feature.LET_DECLARATIONS);
// [x, y] = temp0;
Node replacementExpr =
astFactory.createAssign(assignment.getFirstChild().detach(), tempVarModel.cloneNode());
Node exprResult = IR.exprResult(replacementExpr);
// return temp0;
Node returnNode = IR.returnNode(tempVarModel.cloneNode());
// Create a function to hold these assignments:
Node block = IR.block(newAssignment, exprResult, returnNode);
Node arrowFn = astFactory.createZeroArgFunction(/* name= */ "", block, assignment.getJSType());
arrowFn.setIsArrowFunction(true);
// Create a call to the function, and replace the pattern with the call.
Node call = astFactory.createCall(arrowFn);
NodeUtil.addFeatureToScript(t.getCurrentScript(), Feature.ARROW_FUNCTIONS);
call.useSourceInfoIfMissingFromForTree(assignment);
call.putBooleanProp(Node.FREE_CALL, true);
assignment.getParent().replaceChild(assignment, call);
NodeUtil.markNewScopesChanged(call, compiler);
replacePattern(
t,
replacementExpr.getFirstChild(),
replacementExpr.getLastChild(),
replacementExpr,
exprResult);
} | [
"private",
"void",
"wrapAssignmentInCallToArrow",
"(",
"NodeTraversal",
"t",
",",
"Node",
"assignment",
")",
"{",
"String",
"tempVarName",
"=",
"getTempVariableName",
"(",
")",
";",
"Node",
"tempVarModel",
"=",
"astFactory",
".",
"createName",
"(",
"tempVarName",
... | Convert the assignment '[x, y] = rhs' that is used as an expression and not an expr result to:
(() => let temp0 = rhs; var temp1 = $jscomp.makeIterator(temp0); var x = temp0.next().value;
var y = temp0.next().value; return temp0; }) And the assignment '{x: a, y: b} = rhs' used as an
expression and not an expr result to: (() => let temp0 = rhs; var temp1 = temp0; var a =
temp0.x; var b = temp0.y; return temp0; }) | [
"Convert",
"the",
"assignment",
"[",
"x",
"y",
"]",
"=",
"rhs",
"that",
"is",
"used",
"as",
"an",
"expression",
"and",
"not",
"an",
"expr",
"result",
"to",
":",
"((",
")",
"=",
">",
"let",
"temp0",
"=",
"rhs",
";",
"var",
"temp1",
"=",
"$jscomp",
... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteDestructuring.java#L681-L713 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java | HawkbitCommonUtil.createDSLazyQueryContainer | public static LazyQueryContainer createDSLazyQueryContainer(
final BeanQueryFactory<? extends AbstractBeanQuery<?>> queryFactory) {
queryFactory.setQueryConfiguration(Collections.emptyMap());
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, "tagIdName"), queryFactory);
} | java | public static LazyQueryContainer createDSLazyQueryContainer(
final BeanQueryFactory<? extends AbstractBeanQuery<?>> queryFactory) {
queryFactory.setQueryConfiguration(Collections.emptyMap());
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, "tagIdName"), queryFactory);
} | [
"public",
"static",
"LazyQueryContainer",
"createDSLazyQueryContainer",
"(",
"final",
"BeanQueryFactory",
"<",
"?",
"extends",
"AbstractBeanQuery",
"<",
"?",
">",
">",
"queryFactory",
")",
"{",
"queryFactory",
".",
"setQueryConfiguration",
"(",
"Collections",
".",
"em... | Create lazy query container for DS type.
@param queryFactory
@return LazyQueryContainer | [
"Create",
"lazy",
"query",
"container",
"for",
"DS",
"type",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/HawkbitCommonUtil.java#L343-L347 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java | UriUtils.encodeAuthority | public static String encodeAuthority(String authority, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(authority, encoding, HierarchicalUriComponents.Type.AUTHORITY);
} | java | public static String encodeAuthority(String authority, String encoding) throws UnsupportedEncodingException {
return HierarchicalUriComponents.encodeUriComponent(authority, encoding, HierarchicalUriComponents.Type.AUTHORITY);
} | [
"public",
"static",
"String",
"encodeAuthority",
"(",
"String",
"authority",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"HierarchicalUriComponents",
".",
"encodeUriComponent",
"(",
"authority",
",",
"encoding",
",",
"Hierarc... | Encodes the given URI authority with the given encoding.
@param authority the authority to be encoded
@param encoding the character encoding to encode to
@return the encoded authority
@throws UnsupportedEncodingException when the given encoding parameter is not supported | [
"Encodes",
"the",
"given",
"URI",
"authority",
"with",
"the",
"given",
"encoding",
"."
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/web/util/UriUtils.java#L230-L232 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java | Watch.affectsTarget | private boolean affectsTarget(List<Integer> targetIds, int currentId) {
return targetIds == null || targetIds.isEmpty() || targetIds.contains(currentId);
} | java | private boolean affectsTarget(List<Integer> targetIds, int currentId) {
return targetIds == null || targetIds.isEmpty() || targetIds.contains(currentId);
} | [
"private",
"boolean",
"affectsTarget",
"(",
"List",
"<",
"Integer",
">",
"targetIds",
",",
"int",
"currentId",
")",
"{",
"return",
"targetIds",
"==",
"null",
"||",
"targetIds",
".",
"isEmpty",
"(",
")",
"||",
"targetIds",
".",
"contains",
"(",
"currentId",
... | Checks if the current target id is included in the list of target ids. Returns true if no
targetIds are provided. | [
"Checks",
"if",
"the",
"current",
"target",
"id",
"is",
"included",
"in",
"the",
"list",
"of",
"target",
"ids",
".",
"Returns",
"true",
"if",
"no",
"targetIds",
"are",
"provided",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L432-L434 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleEntries.java | ModuleEntries.fetchOneSnapshot | public CMASnapshot fetchOneSnapshot(CMAEntry entry, String snapshotId) {
assertNotNull(entry, "entry");
assertNotNull(snapshotId, "snapshotId");
final String entryId = getResourceIdOrThrow(entry, "entry");
final String spaceId = getSpaceIdOrThrow(entry, "entry");
final String environmentId = entry.getEnvironmentId();
return service.fetchOneSnapshot(spaceId, environmentId, entryId, snapshotId).blockingFirst();
} | java | public CMASnapshot fetchOneSnapshot(CMAEntry entry, String snapshotId) {
assertNotNull(entry, "entry");
assertNotNull(snapshotId, "snapshotId");
final String entryId = getResourceIdOrThrow(entry, "entry");
final String spaceId = getSpaceIdOrThrow(entry, "entry");
final String environmentId = entry.getEnvironmentId();
return service.fetchOneSnapshot(spaceId, environmentId, entryId, snapshotId).blockingFirst();
} | [
"public",
"CMASnapshot",
"fetchOneSnapshot",
"(",
"CMAEntry",
"entry",
",",
"String",
"snapshotId",
")",
"{",
"assertNotNull",
"(",
"entry",
",",
"\"entry\"",
")",
";",
"assertNotNull",
"(",
"snapshotId",
",",
"\"snapshotId\"",
")",
";",
"final",
"String",
"entr... | Fetch a specific snapshot of an entry.
@param entry the entry whose snapshot to be returned.
@param snapshotId the snapshot to be returned.
@return an array of snapshots.
@throws IllegalArgumentException if entry is null.
@throws IllegalArgumentException if entry's id is null.
@throws IllegalArgumentException if entry's space id is null.
@throws IllegalArgumentException if snapshotId is null. | [
"Fetch",
"a",
"specific",
"snapshot",
"of",
"an",
"entry",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleEntries.java#L387-L396 |
ironjacamar/ironjacamar | common/src/main/java/org/ironjacamar/common/metadata/common/StringUtils.java | StringUtils.restoreExpression | public static String restoreExpression(Map<String, String> m, String key, String subkey, String v)
{
String k = key;
if (subkey != null)
{
if (!isIncorrectExpression(subkey) && subkey.startsWith("${"))
{
subkey = subkey.substring(2, subkey.length() - 1);
if (subkey.indexOf(":") != -1)
subkey = subkey.substring(0, subkey.indexOf(":"));
}
k += "|" + subkey;
}
return substituteValueInExpression(m.get(k), v);
} | java | public static String restoreExpression(Map<String, String> m, String key, String subkey, String v)
{
String k = key;
if (subkey != null)
{
if (!isIncorrectExpression(subkey) && subkey.startsWith("${"))
{
subkey = subkey.substring(2, subkey.length() - 1);
if (subkey.indexOf(":") != -1)
subkey = subkey.substring(0, subkey.indexOf(":"));
}
k += "|" + subkey;
}
return substituteValueInExpression(m.get(k), v);
} | [
"public",
"static",
"String",
"restoreExpression",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"m",
",",
"String",
"key",
",",
"String",
"subkey",
",",
"String",
"v",
")",
"{",
"String",
"k",
"=",
"key",
";",
"if",
"(",
"subkey",
"!=",
"null",
")"... | Restores expression with substituted default value
@param m a Map with expressions
@param key of the Map
@param subkey of the Map
@param v value for substitution
@return restored expression string | [
"Restores",
"expression",
"with",
"substituted",
"default",
"value"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/StringUtils.java#L46-L65 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositorySpaceAlert.java | LogRepositorySpaceAlert.setRepositoryInfo | public synchronized void setRepositoryInfo(LogRepositoryManager manager, File repositoryLocation, long repositorySpaceNeeded) throws IllegalArgumentException {
if (manager == null) throw new IllegalArgumentException("Null manager passed to LogRepositorySpaceAlert.setRepositoryInfo") ;
if (repositoryLocation == null) throw new IllegalArgumentException("Null repositoryLocation passed to LogRepositorySpaceAlert.setRepositoryInfo") ;
/* Don't do logging here since it would cause infinite loop with *=all trace spec.
if (logger.isLoggable(Level.FINER))
logger.logp(Level.FINER, className, "setRepositoryInfo", "Args: manager: "+manager+" loc: "+
repositoryLocation.getPath()+" rSpc: "+repositorySpaceNeeded) ;
*/
RepositoryInfo curRI = repositoryInfo.get(manager);
if (curRI == null) {
File fsRoot = calculateFsRoot(repositoryLocation);
FileSystemInfo fs = fsInfo.get(fsRoot);
if (fs == null) {
fs = new FileSystemInfo();
fsInfo.put(fsRoot, fs);
}
curRI = new RepositoryInfo(fs);
repositoryInfo.put(manager, curRI);
}
curRI.setRespositorySpaceNeeded(repositorySpaceNeeded);
} | java | public synchronized void setRepositoryInfo(LogRepositoryManager manager, File repositoryLocation, long repositorySpaceNeeded) throws IllegalArgumentException {
if (manager == null) throw new IllegalArgumentException("Null manager passed to LogRepositorySpaceAlert.setRepositoryInfo") ;
if (repositoryLocation == null) throw new IllegalArgumentException("Null repositoryLocation passed to LogRepositorySpaceAlert.setRepositoryInfo") ;
/* Don't do logging here since it would cause infinite loop with *=all trace spec.
if (logger.isLoggable(Level.FINER))
logger.logp(Level.FINER, className, "setRepositoryInfo", "Args: manager: "+manager+" loc: "+
repositoryLocation.getPath()+" rSpc: "+repositorySpaceNeeded) ;
*/
RepositoryInfo curRI = repositoryInfo.get(manager);
if (curRI == null) {
File fsRoot = calculateFsRoot(repositoryLocation);
FileSystemInfo fs = fsInfo.get(fsRoot);
if (fs == null) {
fs = new FileSystemInfo();
fsInfo.put(fsRoot, fs);
}
curRI = new RepositoryInfo(fs);
repositoryInfo.put(manager, curRI);
}
curRI.setRespositorySpaceNeeded(repositorySpaceNeeded);
} | [
"public",
"synchronized",
"void",
"setRepositoryInfo",
"(",
"LogRepositoryManager",
"manager",
",",
"File",
"repositoryLocation",
",",
"long",
"repositorySpaceNeeded",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"manager",
"==",
"null",
")",
"throw",
"n... | Set a repository into the space alert for checking. In HPEL, the LogManager for log and the LogManager for
Trace should set themselves as repositories to watch. This is done on the opening of each file. Thus, if
a destination is moved, a file is rolled, or a server is started, the info will be updated
@param repositoryType Unique identifier of this repository (in HPEL, it is log/trace/text). Since managers will
reSet with each file they create or any time they change locations .. if the same type drives set again, the row
in the arrayList is updated
@param repositoryLocation location where this repository will log
@param repositorySpaceNeeded Current amount of space needed. This is determined by the caller. For our purposes,
if the repository is using space, then it is the maxSpace - currently used space. If it is going by time, then
it is based on a fixed value which is a constant in this class. | [
"Set",
"a",
"repository",
"into",
"the",
"space",
"alert",
"for",
"checking",
".",
"In",
"HPEL",
"the",
"LogManager",
"for",
"log",
"and",
"the",
"LogManager",
"for",
"Trace",
"should",
"set",
"themselves",
"as",
"repositories",
"to",
"watch",
".",
"This",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRepositorySpaceAlert.java#L144-L164 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/RandomAccessFile.java | RandomAccessFile.readFully | public final void readFully(byte[] dst, int offset, int byteCount) throws IOException {
Arrays.checkOffsetAndCount(dst.length, offset, byteCount);
while (byteCount > 0) {
int result = read(dst, offset, byteCount);
if (result < 0) {
throw new EOFException();
}
offset += result;
byteCount -= result;
}
} | java | public final void readFully(byte[] dst, int offset, int byteCount) throws IOException {
Arrays.checkOffsetAndCount(dst.length, offset, byteCount);
while (byteCount > 0) {
int result = read(dst, offset, byteCount);
if (result < 0) {
throw new EOFException();
}
offset += result;
byteCount -= result;
}
} | [
"public",
"final",
"void",
"readFully",
"(",
"byte",
"[",
"]",
"dst",
",",
"int",
"offset",
",",
"int",
"byteCount",
")",
"throws",
"IOException",
"{",
"Arrays",
".",
"checkOffsetAndCount",
"(",
"dst",
".",
"length",
",",
"offset",
",",
"byteCount",
")",
... | Reads {@code byteCount} bytes from this stream and stores them in the byte
array {@code dst} starting at {@code offset}. If {@code byteCount} is zero, then this
method returns without reading any bytes. Otherwise, this method blocks until
{@code byteCount} bytes have been read. If insufficient bytes are available,
{@code EOFException} is thrown. If an I/O error occurs, {@code IOException} is
thrown. When an exception is thrown, some bytes may have been consumed from the stream
and written into the array.
@param dst
the byte array into which the data is read.
@param offset
the offset in {@code dst} at which to store the bytes.
@param byteCount
the number of bytes to read.
@throws EOFException
if the end of the source stream is reached before enough
bytes have been read.
@throws IndexOutOfBoundsException
if {@code offset < 0} or {@code byteCount < 0}, or
{@code offset + byteCount > dst.length}.
@throws IOException
if a problem occurs while reading from this stream.
@throws NullPointerException
if {@code dst} is null. | [
"Reads",
"{",
"@code",
"byteCount",
"}",
"bytes",
"from",
"this",
"stream",
"and",
"stores",
"them",
"in",
"the",
"byte",
"array",
"{",
"@code",
"dst",
"}",
"starting",
"at",
"{",
"@code",
"offset",
"}",
".",
"If",
"{",
"@code",
"byteCount",
"}",
"is",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/RandomAccessFile.java#L421-L431 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_account_accountName_filter_name_changePriority_POST | public OvhTaskFilter domain_account_accountName_filter_name_changePriority_POST(String domain, String accountName, String name, Long priority) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/changePriority";
StringBuilder sb = path(qPath, domain, accountName, name);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "priority", priority);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskFilter.class);
} | java | public OvhTaskFilter domain_account_accountName_filter_name_changePriority_POST(String domain, String accountName, String name, Long priority) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/changePriority";
StringBuilder sb = path(qPath, domain, accountName, name);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "priority", priority);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskFilter.class);
} | [
"public",
"OvhTaskFilter",
"domain_account_accountName_filter_name_changePriority_POST",
"(",
"String",
"domain",
",",
"String",
"accountName",
",",
"String",
"name",
",",
"Long",
"priority",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{dom... | Change filter priority
REST: POST /email/domain/{domain}/account/{accountName}/filter/{name}/changePriority
@param priority [required] New priority
@param domain [required] Name of your domain name
@param accountName [required] Name of account
@param name [required] Filter name | [
"Change",
"filter",
"priority"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L650-L657 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.deleteImpl | private void deleteImpl(final int startIndex, final int endIndex, final int len) {
System.arraycopy(buffer, endIndex, buffer, startIndex, size - endIndex);
size -= len;
} | java | private void deleteImpl(final int startIndex, final int endIndex, final int len) {
System.arraycopy(buffer, endIndex, buffer, startIndex, size - endIndex);
size -= len;
} | [
"private",
"void",
"deleteImpl",
"(",
"final",
"int",
"startIndex",
",",
"final",
"int",
"endIndex",
",",
"final",
"int",
"len",
")",
"{",
"System",
".",
"arraycopy",
"(",
"buffer",
",",
"endIndex",
",",
"buffer",
",",
"startIndex",
",",
"size",
"-",
"en... | Internal method to delete a range without validation.
@param startIndex the start index, must be valid
@param endIndex the end index (exclusive), must be valid
@param len the length, must be valid
@throws IndexOutOfBoundsException if any index is invalid | [
"Internal",
"method",
"to",
"delete",
"a",
"range",
"without",
"validation",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1789-L1792 |
GerdHolz/TOVAL | src/de/invation/code/toval/types/DynamicMatrix.java | DynamicMatrix.getValue | public T getValue(E row, E col) {
if(!rowKeys.containsKey(row))
return null;
if(!colKeys.containsKey(col))
return null;
try{
get(rowKeys.get(row)).get(colKeys.get(col));
} catch(IndexOutOfBoundsException e){
return null;
}
return get(rowKeys.get(row)).get(colKeys.get(col));
} | java | public T getValue(E row, E col) {
if(!rowKeys.containsKey(row))
return null;
if(!colKeys.containsKey(col))
return null;
try{
get(rowKeys.get(row)).get(colKeys.get(col));
} catch(IndexOutOfBoundsException e){
return null;
}
return get(rowKeys.get(row)).get(colKeys.get(col));
} | [
"public",
"T",
"getValue",
"(",
"E",
"row",
",",
"E",
"col",
")",
"{",
"if",
"(",
"!",
"rowKeys",
".",
"containsKey",
"(",
"row",
")",
")",
"return",
"null",
";",
"if",
"(",
"!",
"colKeys",
".",
"containsKey",
"(",
"col",
")",
")",
"return",
"nul... | Returns the matrix entry specified by the given row and col keys (Matrix[row,col]).
@param row Row-value of indexing type
@param col Col-value of indexing type
@return Value at matrix position [row,col] | [
"Returns",
"the",
"matrix",
"entry",
"specified",
"by",
"the",
"given",
"row",
"and",
"col",
"keys",
"(",
"Matrix",
"[",
"row",
"col",
"]",
")",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/DynamicMatrix.java#L63-L74 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/filter/misc/AverageDownSampleOps.java | AverageDownSampleOps.downSampleSize | public static int downSampleSize( int length , int squareWidth ) {
int ret = length/squareWidth;
if( length%squareWidth != 0 )
ret++;
return ret;
} | java | public static int downSampleSize( int length , int squareWidth ) {
int ret = length/squareWidth;
if( length%squareWidth != 0 )
ret++;
return ret;
} | [
"public",
"static",
"int",
"downSampleSize",
"(",
"int",
"length",
",",
"int",
"squareWidth",
")",
"{",
"int",
"ret",
"=",
"length",
"/",
"squareWidth",
";",
"if",
"(",
"length",
"%",
"squareWidth",
"!=",
"0",
")",
"ret",
"++",
";",
"return",
"ret",
";... | Computes the length of a down sampled image based on the original length and the square width
@param length Length of side in input image
@param squareWidth Width of region used to down sample images
@return Length of side in down sampled image | [
"Computes",
"the",
"length",
"of",
"a",
"down",
"sampled",
"image",
"based",
"on",
"the",
"original",
"length",
"and",
"the",
"square",
"width"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/misc/AverageDownSampleOps.java#L48-L54 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java | StyleSet.setFont | public StyleSet setFont(Font font, boolean ignoreHead) {
if(false == ignoreHead) {
this.headCellStyle.setFont(font);
}
this.cellStyle.setFont(font);
this.cellStyleForNumber.setFont(font);
this.cellStyleForDate.setFont(font);
return this;
} | java | public StyleSet setFont(Font font, boolean ignoreHead) {
if(false == ignoreHead) {
this.headCellStyle.setFont(font);
}
this.cellStyle.setFont(font);
this.cellStyleForNumber.setFont(font);
this.cellStyleForDate.setFont(font);
return this;
} | [
"public",
"StyleSet",
"setFont",
"(",
"Font",
"font",
",",
"boolean",
"ignoreHead",
")",
"{",
"if",
"(",
"false",
"==",
"ignoreHead",
")",
"{",
"this",
".",
"headCellStyle",
".",
"setFont",
"(",
"font",
")",
";",
"}",
"this",
".",
"cellStyle",
".",
"se... | 设置全局字体
@param font 字体,可以通过{@link StyleUtil#createFont(Workbook, short, short, String)}创建
@param ignoreHead 是否跳过头部样式
@return this
@since 4.1.0 | [
"设置全局字体"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java#L162-L170 |
wigforss/Ka-Commons-Reflection | src/main/java/org/kasource/commons/reflection/util/MethodUtils.java | MethodUtils.verifyMethodSignature | public static void verifyMethodSignature(Method method, Class<?> returnType, Class<?>... parameters) {
if(method == null) {
throw new IllegalArgumentException("Method is null");
}
if (!method.getReturnType().equals(returnType)) {
throw new IllegalArgumentException("Method " + method + " return type " + method.getReturnType()
+ " does not match: " + returnType);
}
Class<?>[] actualParameters = method.getParameterTypes();
if (actualParameters.length != parameters.length) {
throw new IllegalArgumentException("Method " + method + " number of parameters " + actualParameters.length
+ " does not match: " + parameters.length);
}
if (!Arrays.equals(actualParameters,parameters)) {
throw new IllegalArgumentException("Method " + method + " types of parameters "
+ Arrays.toString(actualParameters) + " does not match: " + Arrays.toString(parameters));
}
} | java | public static void verifyMethodSignature(Method method, Class<?> returnType, Class<?>... parameters) {
if(method == null) {
throw new IllegalArgumentException("Method is null");
}
if (!method.getReturnType().equals(returnType)) {
throw new IllegalArgumentException("Method " + method + " return type " + method.getReturnType()
+ " does not match: " + returnType);
}
Class<?>[] actualParameters = method.getParameterTypes();
if (actualParameters.length != parameters.length) {
throw new IllegalArgumentException("Method " + method + " number of parameters " + actualParameters.length
+ " does not match: " + parameters.length);
}
if (!Arrays.equals(actualParameters,parameters)) {
throw new IllegalArgumentException("Method " + method + " types of parameters "
+ Arrays.toString(actualParameters) + " does not match: " + Arrays.toString(parameters));
}
} | [
"public",
"static",
"void",
"verifyMethodSignature",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"returnType",
",",
"Class",
"<",
"?",
">",
"...",
"parameters",
")",
"{",
"if",
"(",
"method",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgu... | Verify that the supplied method's signature matches return type and
parameters types
@param method
Method to inspect
@param returnType
Return type to match
@param parameters
Parameter types to match
@throws IllegalArgumentException
if method fails to match return type or parameters types | [
"Verify",
"that",
"the",
"supplied",
"method",
"s",
"signature",
"matches",
"return",
"type",
"and",
"parameters",
"types"
] | train | https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/MethodUtils.java#L188-L205 |
siom79/japicmp | japicmp/src/main/java/japicmp/model/JApiSuperclass.java | JApiSuperclass.getJApiClass | public Optional<JApiClass> getJApiClass() {
if (oldSuperclassOptional.isPresent() && newSuperclassOptional.isPresent()) {
CtClass oldSuperclass = oldSuperclassOptional.get();
CtClass newSuperclass = newSuperclassOptional.get();
String oldSuperclassName = oldSuperclass.getName();
String newSuperclassName = newSuperclass.getName();
if (oldSuperclassName.equals(newSuperclassName)) {
JApiClassType classType = new JApiClassType(Optional.of(ClassHelper.getType(oldSuperclass)), Optional.of(ClassHelper.getType(newSuperclass)), JApiChangeStatus.UNCHANGED);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, oldSuperclassName, Optional.of(oldSuperclass), Optional.of(newSuperclass), JApiChangeStatus.UNCHANGED, classType);
return Optional.of(jApiClass);
} else {
return Optional.absent();
}
} else if (oldSuperclassOptional.isPresent()) {
CtClass oldSuperclass = oldSuperclassOptional.get();
String oldSuperclassName = oldSuperclass.getName();
JApiClassType classType = new JApiClassType(Optional.of(ClassHelper.getType(oldSuperclass)), Optional.<JApiClassType.ClassType>absent(), JApiChangeStatus.REMOVED);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, oldSuperclassName, Optional.of(oldSuperclass), Optional.<CtClass>absent(), JApiChangeStatus.REMOVED, classType);
return Optional.of(jApiClass);
} else if (newSuperclassOptional.isPresent()) {
CtClass newSuperclass = newSuperclassOptional.get();
String newSuperclassName = newSuperclass.getName();
JApiClassType classType = new JApiClassType(Optional.<JApiClassType.ClassType>absent(), Optional.of(ClassHelper.getType(newSuperclass)), JApiChangeStatus.NEW);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, newSuperclassName, Optional.<CtClass>absent(), Optional.of(newSuperclass), JApiChangeStatus.NEW, classType);
return Optional.of(jApiClass);
}
return Optional.absent();
} | java | public Optional<JApiClass> getJApiClass() {
if (oldSuperclassOptional.isPresent() && newSuperclassOptional.isPresent()) {
CtClass oldSuperclass = oldSuperclassOptional.get();
CtClass newSuperclass = newSuperclassOptional.get();
String oldSuperclassName = oldSuperclass.getName();
String newSuperclassName = newSuperclass.getName();
if (oldSuperclassName.equals(newSuperclassName)) {
JApiClassType classType = new JApiClassType(Optional.of(ClassHelper.getType(oldSuperclass)), Optional.of(ClassHelper.getType(newSuperclass)), JApiChangeStatus.UNCHANGED);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, oldSuperclassName, Optional.of(oldSuperclass), Optional.of(newSuperclass), JApiChangeStatus.UNCHANGED, classType);
return Optional.of(jApiClass);
} else {
return Optional.absent();
}
} else if (oldSuperclassOptional.isPresent()) {
CtClass oldSuperclass = oldSuperclassOptional.get();
String oldSuperclassName = oldSuperclass.getName();
JApiClassType classType = new JApiClassType(Optional.of(ClassHelper.getType(oldSuperclass)), Optional.<JApiClassType.ClassType>absent(), JApiChangeStatus.REMOVED);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, oldSuperclassName, Optional.of(oldSuperclass), Optional.<CtClass>absent(), JApiChangeStatus.REMOVED, classType);
return Optional.of(jApiClass);
} else if (newSuperclassOptional.isPresent()) {
CtClass newSuperclass = newSuperclassOptional.get();
String newSuperclassName = newSuperclass.getName();
JApiClassType classType = new JApiClassType(Optional.<JApiClassType.ClassType>absent(), Optional.of(ClassHelper.getType(newSuperclass)), JApiChangeStatus.NEW);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, newSuperclassName, Optional.<CtClass>absent(), Optional.of(newSuperclass), JApiChangeStatus.NEW, classType);
return Optional.of(jApiClass);
}
return Optional.absent();
} | [
"public",
"Optional",
"<",
"JApiClass",
">",
"getJApiClass",
"(",
")",
"{",
"if",
"(",
"oldSuperclassOptional",
".",
"isPresent",
"(",
")",
"&&",
"newSuperclassOptional",
".",
"isPresent",
"(",
")",
")",
"{",
"CtClass",
"oldSuperclass",
"=",
"oldSuperclassOption... | Returns the {@link japicmp.model.JApiClass} representation of this superclass.
The return value is Optional.absent() in case the superclass for the old and new version is absent.
@return the {@link japicmp.model.JApiClass} representation of this superclass as {@link com.google.common.base.Optional} | [
"Returns",
"the",
"{",
"@link",
"japicmp",
".",
"model",
".",
"JApiClass",
"}",
"representation",
"of",
"this",
"superclass",
".",
"The",
"return",
"value",
"is",
"Optional",
".",
"absent",
"()",
"in",
"case",
"the",
"superclass",
"for",
"the",
"old",
"and... | train | https://github.com/siom79/japicmp/blob/f008ea588eec721c45f568bf1db5074fbcbcfced/japicmp/src/main/java/japicmp/model/JApiSuperclass.java#L39-L66 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java | MPD9AbstractReader.getDefaultOnNull | public Double getDefaultOnNull(Double value, Double defaultValue)
{
return (value == null ? defaultValue : value);
} | java | public Double getDefaultOnNull(Double value, Double defaultValue)
{
return (value == null ? defaultValue : value);
} | [
"public",
"Double",
"getDefaultOnNull",
"(",
"Double",
"value",
",",
"Double",
"defaultValue",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"defaultValue",
":",
"value",
")",
";",
"}"
] | Returns a default value if a null value is found.
@param value value under test
@param defaultValue default if value is null
@return value | [
"Returns",
"a",
"default",
"value",
"if",
"a",
"null",
"value",
"is",
"found",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L1295-L1298 |
openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.deleteVNFCInstance | @Help(help = "remove VNFCInstance. Aka SCALE IN")
public void deleteVNFCInstance(final String idNsr, final String idVnfr) throws SDKException {
String url = idNsr + "/vnfrecords/" + idVnfr + "/vdunits/vnfcinstances";
requestDelete(url);
} | java | @Help(help = "remove VNFCInstance. Aka SCALE IN")
public void deleteVNFCInstance(final String idNsr, final String idVnfr) throws SDKException {
String url = idNsr + "/vnfrecords/" + idVnfr + "/vdunits/vnfcinstances";
requestDelete(url);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"remove VNFCInstance. Aka SCALE IN\"",
")",
"public",
"void",
"deleteVNFCInstance",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfr",
")",
"throws",
"SDKException",
"{",
"String",
"url",
"=",
"idNsr",
"+",
"\"/vn... | Delete a VNFCInstance from a VirtualNetworkFunctionRecord. This operation is also called
scaling in. This method does not require you to specify the VirtualDeploymentUnit from which a
VNFCInstance shall be deleted.
@param idNsr the ID of the NetworkServiceRecord from which a VNFCInstance shall be deleted
@param idVnfr the ID of the VirtualNetworkFunctionRecord from which a VNFCInstance shall be
deleted
@throws SDKException if the request fails | [
"Delete",
"a",
"VNFCInstance",
"from",
"a",
"VirtualNetworkFunctionRecord",
".",
"This",
"operation",
"is",
"also",
"called",
"scaling",
"in",
".",
"This",
"method",
"does",
"not",
"require",
"you",
"to",
"specify",
"the",
"VirtualDeploymentUnit",
"from",
"which",... | train | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L343-L347 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getSAMLAssertionVerifying | public SAMLEndpointResponse getSAMLAssertionVerifying(String appId, String devideId, String stateToken, String otpToken, String urlEndpoint, Boolean doNotNotify) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
String target;
if (urlEndpoint != null && !urlEndpoint.isEmpty()) {
target = urlEndpoint;
} else {
URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_SAML_VERIFY_FACTOR));
target = url.toString();
}
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(target)
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
Map<String, Object> params = new HashMap<String, Object>();
params.put("app_id", appId);
params.put("device_id", devideId);
params.put("state_token", stateToken);
params.put("do_not_notify", doNotNotify);
if (otpToken != null && !otpToken.isEmpty()) {
params.put("otp_token", otpToken);
}
String body = JSONUtils.buildJSON(params);
bearerRequest.setBody(body);
SAMLEndpointResponse samlEndpointResponse = null;
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() == 200) {
samlEndpointResponse = new SAMLEndpointResponse(oAuthResponse.getType(), oAuthResponse.getMessage());
if (oAuthResponse.getType().equals("success")) {
if (oAuthResponse.getMessage().equals("Success")) {
samlEndpointResponse.setSAMLResponse((String)oAuthResponse.getStringFromData());
}
}
} else {
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
}
return samlEndpointResponse;
} | java | public SAMLEndpointResponse getSAMLAssertionVerifying(String appId, String devideId, String stateToken, String otpToken, String urlEndpoint, Boolean doNotNotify) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
cleanError();
prepareToken();
String target;
if (urlEndpoint != null && !urlEndpoint.isEmpty()) {
target = urlEndpoint;
} else {
URIBuilder url = new URIBuilder(settings.getURL(Constants.GET_SAML_VERIFY_FACTOR));
target = url.toString();
}
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(target)
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
Map<String, Object> params = new HashMap<String, Object>();
params.put("app_id", appId);
params.put("device_id", devideId);
params.put("state_token", stateToken);
params.put("do_not_notify", doNotNotify);
if (otpToken != null && !otpToken.isEmpty()) {
params.put("otp_token", otpToken);
}
String body = JSONUtils.buildJSON(params);
bearerRequest.setBody(body);
SAMLEndpointResponse samlEndpointResponse = null;
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() == 200) {
samlEndpointResponse = new SAMLEndpointResponse(oAuthResponse.getType(), oAuthResponse.getMessage());
if (oAuthResponse.getType().equals("success")) {
if (oAuthResponse.getMessage().equals("Success")) {
samlEndpointResponse.setSAMLResponse((String)oAuthResponse.getStringFromData());
}
}
} else {
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
}
return samlEndpointResponse;
} | [
"public",
"SAMLEndpointResponse",
"getSAMLAssertionVerifying",
"(",
"String",
"appId",
",",
"String",
"devideId",
",",
"String",
"stateToken",
",",
"String",
"otpToken",
",",
"String",
"urlEndpoint",
",",
"Boolean",
"doNotNotify",
")",
"throws",
"OAuthSystemException",
... | Verifies a one-time password (OTP) value provided for a second factor when multi-factor authentication (MFA) is required for SAML authentication.
@param appId
App ID of the app for which you want to generate a SAML token
@param devideId
Provide the MFA device_id you are submitting for verification.
@param stateToken
Provide the state_token associated with the MFA device_id you are submitting for verification.
@param otpToken
Provide the OTP value for the MFA factor you are submitting for verification.
@param urlEndpoint
Specify an url where return the response.
@param doNotNotify
When verifying MFA via Protect Push, set this to true to stop additional push notifications being sent to the OneLogin Protect device
@return SAMLEndpointResponse
@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 URIBuilder constructor
@see com.onelogin.sdk.model.SAMLEndpointResponse
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/saml-assertions/verify-factor">Verify Factor documentation</a> | [
"Verifies",
"a",
"one",
"-",
"time",
"password",
"(",
"OTP",
")",
"value",
"provided",
"for",
"a",
"second",
"factor",
"when",
"multi",
"-",
"factor",
"authentication",
"(",
"MFA",
")",
"is",
"required",
"for",
"SAML",
"authentication",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2482-L2528 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/ajax/editable/tabs/AjaxAddableTabbedPanel.java | AjaxAddableTabbedPanel.newCloseTitle | protected Component newCloseTitle(final String titleId, final IModel<?> titleModel,
final int index)
{
return new Label(titleId, titleModel);
} | java | protected Component newCloseTitle(final String titleId, final IModel<?> titleModel,
final int index)
{
return new Label(titleId, titleModel);
} | [
"protected",
"Component",
"newCloseTitle",
"(",
"final",
"String",
"titleId",
",",
"final",
"IModel",
"<",
"?",
">",
"titleModel",
",",
"final",
"int",
"index",
")",
"{",
"return",
"new",
"Label",
"(",
"titleId",
",",
"titleModel",
")",
";",
"}"
] | Factory method for tab titles. Returned component can be anything that can attach to span
tags such as a fragment, panel, or a label
@param titleId
id of title component
@param titleModel
model containing tab title
@param index
index of tab
@return title component | [
"Factory",
"method",
"for",
"tab",
"titles",
".",
"Returned",
"component",
"can",
"be",
"anything",
"that",
"can",
"attach",
"to",
"span",
"tags",
"such",
"as",
"a",
"fragment",
"panel",
"or",
"a",
"label"
] | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/ajax/editable/tabs/AjaxAddableTabbedPanel.java#L423-L427 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/locale/LocaleHelper.java | LocaleHelper.getLocaleDisplayName | @Nonnull
public static String getLocaleDisplayName (@Nullable final Locale aLocale, @Nonnull final Locale aContentLocale)
{
ValueEnforcer.notNull (aContentLocale, "ContentLocale");
if (aLocale == null || aLocale.equals (LOCALE_INDEPENDENT))
return ELocaleName.ID_LANGUAGE_INDEPENDENT.getDisplayText (aContentLocale);
if (aLocale.equals (LOCALE_ALL))
return ELocaleName.ID_LANGUAGE_ALL.getDisplayText (aContentLocale);
return aLocale.getDisplayName (aContentLocale);
} | java | @Nonnull
public static String getLocaleDisplayName (@Nullable final Locale aLocale, @Nonnull final Locale aContentLocale)
{
ValueEnforcer.notNull (aContentLocale, "ContentLocale");
if (aLocale == null || aLocale.equals (LOCALE_INDEPENDENT))
return ELocaleName.ID_LANGUAGE_INDEPENDENT.getDisplayText (aContentLocale);
if (aLocale.equals (LOCALE_ALL))
return ELocaleName.ID_LANGUAGE_ALL.getDisplayText (aContentLocale);
return aLocale.getDisplayName (aContentLocale);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getLocaleDisplayName",
"(",
"@",
"Nullable",
"final",
"Locale",
"aLocale",
",",
"@",
"Nonnull",
"final",
"Locale",
"aContentLocale",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aContentLocale",
",",
"\"ContentLoc... | Get the display name of the passed language in the currently selected UI
language.
@param aLocale
The locale from which the display name is required. May be
<code>null</code>.
@param aContentLocale
The locale in which the name of the locale is required. If aLocale
is "de" and display locale is "de" the result would be "Deutsch"
whereas if display locale is "en" the result would be "German".
@return the display name of the language or a fixed text if the passed
Locale is <code>null</code>, "all" or "independent"
@see #LOCALE_ALL
@see #LOCALE_INDEPENDENT | [
"Get",
"the",
"display",
"name",
"of",
"the",
"passed",
"language",
"in",
"the",
"currently",
"selected",
"UI",
"language",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleHelper.java#L146-L156 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/DSSPParser.java | DSSPParser.parseFile | public static List<SecStrucState> parseFile(String dsspPath,
Structure structure, boolean assign)
throws IOException, StructureException {
File file = new File(dsspPath);
Reader read = new FileReader(file);
BufferedReader reader = new BufferedReader(read);
return generalParse(reader, structure, assign);
} | java | public static List<SecStrucState> parseFile(String dsspPath,
Structure structure, boolean assign)
throws IOException, StructureException {
File file = new File(dsspPath);
Reader read = new FileReader(file);
BufferedReader reader = new BufferedReader(read);
return generalParse(reader, structure, assign);
} | [
"public",
"static",
"List",
"<",
"SecStrucState",
">",
"parseFile",
"(",
"String",
"dsspPath",
",",
"Structure",
"structure",
",",
"boolean",
"assign",
")",
"throws",
"IOException",
",",
"StructureException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"dssp... | Parse a DSSP output file and return the secondary structure
annotation as a List of {@link SecStrucState} objects.
@param dsspPath path to the DSSP file to parse
@param structure Structure object associated to the dssp
@param assign assigns the SS to the structure if true
@return a List of SS annotation objects
@throws StructureException
@throws IOException | [
"Parse",
"a",
"DSSP",
"output",
"file",
"and",
"return",
"the",
"secondary",
"structure",
"annotation",
"as",
"a",
"List",
"of",
"{",
"@link",
"SecStrucState",
"}",
"objects",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/DSSPParser.java#L92-L100 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Spies.java | Spies.spy1st | public static <T1, T2, T3> TriConsumer<T1, T2, T3> spy1st(TriConsumer<T1, T2, T3> consumer, Box<T1> param1) {
return spy(consumer, param1, Box.<T2>empty(), Box.<T3>empty());
} | java | public static <T1, T2, T3> TriConsumer<T1, T2, T3> spy1st(TriConsumer<T1, T2, T3> consumer, Box<T1> param1) {
return spy(consumer, param1, Box.<T2>empty(), Box.<T3>empty());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"spy1st",
"(",
"TriConsumer",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"consumer",
",",
"Box",
"<",
"T1",
">",
"param1",
")",
"{",
"retu... | Proxies a ternary consumer spying for first parameter.
@param <T1> the consumer first parameter type
@param <T2> the consumer second parameter type
@param <T3> the consumer third parameter type
@param consumer the consumer that will be spied
@param param1 a box that will be containing the first spied parameter
@return the proxied consumer | [
"Proxies",
"a",
"ternary",
"consumer",
"spying",
"for",
"first",
"parameter",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L321-L323 |
js-lib-com/dom | src/main/java/js/dom/w3c/ElementImpl.java | ElementImpl.getRichText | private static void getRichText(Node node, StringBuilder builder) {
Node n = node.getFirstChild();
while (n != null) {
if (n.getNodeType() == Node.TEXT_NODE) {
builder.append(n.getNodeValue());
} else if (n.getNodeType() == Node.ELEMENT_NODE) {
builder.append('<');
builder.append(n.getNodeName());
builder.append('>');
getRichText(n, builder);
builder.append('<');
builder.append('/');
builder.append(n.getNodeName());
builder.append('>');
}
n = n.getNextSibling();
}
} | java | private static void getRichText(Node node, StringBuilder builder) {
Node n = node.getFirstChild();
while (n != null) {
if (n.getNodeType() == Node.TEXT_NODE) {
builder.append(n.getNodeValue());
} else if (n.getNodeType() == Node.ELEMENT_NODE) {
builder.append('<');
builder.append(n.getNodeName());
builder.append('>');
getRichText(n, builder);
builder.append('<');
builder.append('/');
builder.append(n.getNodeName());
builder.append('>');
}
n = n.getNextSibling();
}
} | [
"private",
"static",
"void",
"getRichText",
"(",
"Node",
"node",
",",
"StringBuilder",
"builder",
")",
"{",
"Node",
"n",
"=",
"node",
".",
"getFirstChild",
"(",
")",
";",
"while",
"(",
"n",
"!=",
"null",
")",
"{",
"if",
"(",
"n",
".",
"getNodeType",
... | Extract rich text content from given node. It is not expected that rich text HTML formatting tags to have attributes and
this builder just ignore them. Also ignores all other node types beside text and elements.
@param node source node,
@param builder rich text target builder. | [
"Extract",
"rich",
"text",
"content",
"from",
"given",
"node",
".",
"It",
"is",
"not",
"expected",
"that",
"rich",
"text",
"HTML",
"formatting",
"tags",
"to",
"have",
"attributes",
"and",
"this",
"builder",
"just",
"ignore",
"them",
".",
"Also",
"ignores",
... | train | https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/ElementImpl.java#L613-L630 |
codegist/crest | core/src/main/java/org/codegist/crest/CRestBuilder.java | CRestBuilder.bindSerializer | public CRestBuilder bindSerializer(Class<? extends Serializer> serializer, Class<?>... classes){
return bindSerializer(serializer, classes, Collections.<String, Object>emptyMap());
} | java | public CRestBuilder bindSerializer(Class<? extends Serializer> serializer, Class<?>... classes){
return bindSerializer(serializer, classes, Collections.<String, Object>emptyMap());
} | [
"public",
"CRestBuilder",
"bindSerializer",
"(",
"Class",
"<",
"?",
"extends",
"Serializer",
">",
"serializer",
",",
"Class",
"<",
"?",
">",
"...",
"classes",
")",
"{",
"return",
"bindSerializer",
"(",
"serializer",
",",
"classes",
",",
"Collections",
".",
"... | <p>Binds a serializer to a list of interface method's parameter types</p>
<p>By default, <b>CRest</b> handle the following types:</p>
<ul>
<li>java.util.Date</li>
<li>java.lang.Boolean</li>
<li>java.io.File</li>
<li>java.io.InputStream</li>
<li>java.io.Reader</li>
</ul>
<p>Meaning any interface method parameter type can be by default one of these types and be serialized properly.</p>
@param serializer Serializer class to use to serialize the given interface method's parameter types
@param classes Interface method's parameter types to bind the serializer to
@return current builder
@see CRestConfig#getDateFormat()
@see CRestConfig#getBooleanTrue()
@see CRestConfig#getBooleanFalse() | [
"<p",
">",
"Binds",
"a",
"serializer",
"to",
"a",
"list",
"of",
"interface",
"method",
"s",
"parameter",
"types<",
"/",
"p",
">",
"<p",
">",
"By",
"default",
"<b",
">",
"CRest<",
"/",
"b",
">",
"handle",
"the",
"following",
"types",
":",
"<",
"/",
... | train | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L588-L590 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.