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 |
|---|---|---|---|---|---|---|---|---|---|---|
opendigitaleducation/web-utils | src/main/java/org/vertx/java/core/http/RouteMatcher.java | RouteMatcher.headWithRegEx | public RouteMatcher headWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, headBindings);
return this;
} | java | public RouteMatcher headWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, headBindings);
return this;
} | [
"public",
"RouteMatcher",
"headWithRegEx",
"(",
"String",
"regex",
",",
"Handler",
"<",
"HttpServerRequest",
">",
"handler",
")",
"{",
"addRegEx",
"(",
"regex",
",",
"handler",
",",
"headBindings",
")",
";",
"return",
"this",
";",
"}"
] | Specify a handler that will be called for a matching HTTP HEAD
@param regex A regular expression
@param handler The handler to call | [
"Specify",
"a",
"handler",
"that",
"will",
"be",
"called",
"for",
"a",
"matching",
"HTTP",
"HEAD"
] | train | https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L259-L262 |
opengeospatial/teamengine | teamengine-spi/src/main/java/com/occamlab/te/spi/util/HtmlReport.java | HtmlReport.earlHtmlReport | public static File earlHtmlReport( String outputDir )
throws FileNotFoundException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath();
String earlXsl = cl.getResource( "com/occamlab/te/earl_html_report.xsl" ).toString();
File htmlOutput = new File( outputDir, "result" );
htmlOutput.mkdir();
LOGR.fine( "HTML output is written to directory " + htmlOutput );
File earlResult = new File( outputDir, "earl-results.rdf" );
try {
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer( new StreamSource( earlXsl ) );
transformer.setParameter( "outputDir", htmlOutput );
File indexHtml = new File( htmlOutput, "index.html" );
indexHtml.createNewFile();
FileOutputStream outputStream = new FileOutputStream( indexHtml );
transformer.transform( new StreamSource( earlResult ), new StreamResult( outputStream ) );
// Foritfy Mod: Close the outputStream releasing its resources
outputStream.close();
FileUtils.copyDirectory( new File( resourceDir ), htmlOutput );
} catch ( Exception e ) {
LOGR.log( Level.SEVERE, "Transformation of EARL to HTML failed.", e );
throw new RuntimeException( e );
}
if ( !htmlOutput.exists() ) {
throw new FileNotFoundException( "HTML results not found at " + htmlOutput.getAbsolutePath() );
}
return htmlOutput;
} | java | public static File earlHtmlReport( String outputDir )
throws FileNotFoundException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
String resourceDir = cl.getResource( "com/occamlab/te/earl/lib" ).getPath();
String earlXsl = cl.getResource( "com/occamlab/te/earl_html_report.xsl" ).toString();
File htmlOutput = new File( outputDir, "result" );
htmlOutput.mkdir();
LOGR.fine( "HTML output is written to directory " + htmlOutput );
File earlResult = new File( outputDir, "earl-results.rdf" );
try {
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer( new StreamSource( earlXsl ) );
transformer.setParameter( "outputDir", htmlOutput );
File indexHtml = new File( htmlOutput, "index.html" );
indexHtml.createNewFile();
FileOutputStream outputStream = new FileOutputStream( indexHtml );
transformer.transform( new StreamSource( earlResult ), new StreamResult( outputStream ) );
// Foritfy Mod: Close the outputStream releasing its resources
outputStream.close();
FileUtils.copyDirectory( new File( resourceDir ), htmlOutput );
} catch ( Exception e ) {
LOGR.log( Level.SEVERE, "Transformation of EARL to HTML failed.", e );
throw new RuntimeException( e );
}
if ( !htmlOutput.exists() ) {
throw new FileNotFoundException( "HTML results not found at " + htmlOutput.getAbsolutePath() );
}
return htmlOutput;
} | [
"public",
"static",
"File",
"earlHtmlReport",
"(",
"String",
"outputDir",
")",
"throws",
"FileNotFoundException",
"{",
"ClassLoader",
"cl",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"String",
"resourceDir",
"=",
... | Convert EARL result into HTML report.
@param outputDir
Location of the test result.
@return
Return the output file.
@throws FileNotFoundException
Throws exception if file is not available. | [
"Convert",
"EARL",
"result",
"into",
"HTML",
"report",
"."
] | train | https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-spi/src/main/java/com/occamlab/te/spi/util/HtmlReport.java#L77-L108 |
ironjacamar/ironjacamar | deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java | AbstractResourceAdapterDeployer.createResourceAdapter | protected void
createResourceAdapter(DeploymentBuilder builder,
String raClz,
Collection<org.ironjacamar.common.api.metadata.spec.ConfigProperty> configProperties,
Map<String, String> overrides,
TransactionSupportEnum transactionSupport,
String productName, String productVersion,
InboundResourceAdapter ira, CloneableBootstrapContext bootstrapContext)
throws DeployException
{
try
{
Class<?> clz = Class.forName(raClz, true, builder.getClassLoader());
javax.resource.spi.ResourceAdapter resourceAdapter =
(javax.resource.spi.ResourceAdapter)clz.newInstance();
validationObj.add(new ValidateClass(Key.RESOURCE_ADAPTER, clz, configProperties));
Collection<org.ironjacamar.core.api.deploymentrepository.ConfigProperty> dcps =
injectConfigProperties(resourceAdapter, configProperties, overrides, builder.getClassLoader());
org.ironjacamar.core.spi.statistics.StatisticsPlugin statisticsPlugin = null;
if (resourceAdapter instanceof org.ironjacamar.core.spi.statistics.Statistics)
statisticsPlugin = ((org.ironjacamar.core.spi.statistics.Statistics)resourceAdapter).getStatistics();
TransactionIntegration ti = null;
if (isXA(transactionSupport))
{
ti = transactionIntegration;
}
bootstrapContext.setResourceAdapter(resourceAdapter);
builder.resourceAdapter(new ResourceAdapterImpl(resourceAdapter, bootstrapContext, dcps,
statisticsPlugin, productName, productVersion,
createInboundMapping(ira, builder.getClassLoader()),
is16(builder.getMetadata()), beanValidation,
builder.getActivation().getBeanValidationGroups(),
ti));
}
catch (Throwable t)
{
throw new DeployException(bundle.unableToCreateResourceAdapter(raClz), t);
}
} | java | protected void
createResourceAdapter(DeploymentBuilder builder,
String raClz,
Collection<org.ironjacamar.common.api.metadata.spec.ConfigProperty> configProperties,
Map<String, String> overrides,
TransactionSupportEnum transactionSupport,
String productName, String productVersion,
InboundResourceAdapter ira, CloneableBootstrapContext bootstrapContext)
throws DeployException
{
try
{
Class<?> clz = Class.forName(raClz, true, builder.getClassLoader());
javax.resource.spi.ResourceAdapter resourceAdapter =
(javax.resource.spi.ResourceAdapter)clz.newInstance();
validationObj.add(new ValidateClass(Key.RESOURCE_ADAPTER, clz, configProperties));
Collection<org.ironjacamar.core.api.deploymentrepository.ConfigProperty> dcps =
injectConfigProperties(resourceAdapter, configProperties, overrides, builder.getClassLoader());
org.ironjacamar.core.spi.statistics.StatisticsPlugin statisticsPlugin = null;
if (resourceAdapter instanceof org.ironjacamar.core.spi.statistics.Statistics)
statisticsPlugin = ((org.ironjacamar.core.spi.statistics.Statistics)resourceAdapter).getStatistics();
TransactionIntegration ti = null;
if (isXA(transactionSupport))
{
ti = transactionIntegration;
}
bootstrapContext.setResourceAdapter(resourceAdapter);
builder.resourceAdapter(new ResourceAdapterImpl(resourceAdapter, bootstrapContext, dcps,
statisticsPlugin, productName, productVersion,
createInboundMapping(ira, builder.getClassLoader()),
is16(builder.getMetadata()), beanValidation,
builder.getActivation().getBeanValidationGroups(),
ti));
}
catch (Throwable t)
{
throw new DeployException(bundle.unableToCreateResourceAdapter(raClz), t);
}
} | [
"protected",
"void",
"createResourceAdapter",
"(",
"DeploymentBuilder",
"builder",
",",
"String",
"raClz",
",",
"Collection",
"<",
"org",
".",
"ironjacamar",
".",
"common",
".",
"api",
".",
"metadata",
".",
"spec",
".",
"ConfigProperty",
">",
"configProperties",
... | Create resource adapter instance
@param builder The deployment builder
@param raClz The resource adapter class
@param configProperties The config properties
@param overrides The config properties overrides
@param transactionSupport The transaction support level
@param productName The product name
@param productVersion The product version
@param ira The inbound resource adapter definition
@param bootstrapContext the bootstrapContext to use
@throws DeployException Thrown if the resource adapter cant be created | [
"Create",
"resource",
"adapter",
"instance"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java#L446-L488 |
fernandospr/java-wns | src/main/java/ar/com/fernandospr/wns/WnsService.java | WnsService.pushToast | public WnsNotificationResponse pushToast(String channelUri, WnsToast toast) throws WnsException {
return this.pushToast(channelUri, null, toast);
} | java | public WnsNotificationResponse pushToast(String channelUri, WnsToast toast) throws WnsException {
return this.pushToast(channelUri, null, toast);
} | [
"public",
"WnsNotificationResponse",
"pushToast",
"(",
"String",
"channelUri",
",",
"WnsToast",
"toast",
")",
"throws",
"WnsException",
"{",
"return",
"this",
".",
"pushToast",
"(",
"channelUri",
",",
"null",
",",
"toast",
")",
";",
"}"
] | Pushes a toast to channelUri
@param channelUri
@param toast which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsToastBuilder}
@return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a>
@throws WnsException when authentication fails | [
"Pushes",
"a",
"toast",
"to",
"channelUri"
] | train | https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L122-L124 |
ben-manes/caffeine | simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/LruWindowTinyLfuPolicy.java | LruWindowTinyLfuPolicy.policies | public static Set<Policy> policies(Config config) {
LruWindowTinyLfuSettings settings = new LruWindowTinyLfuSettings(config);
return settings.percentMain().stream()
.map(percentMain -> new LruWindowTinyLfuPolicy(percentMain, settings))
.collect(toSet());
} | java | public static Set<Policy> policies(Config config) {
LruWindowTinyLfuSettings settings = new LruWindowTinyLfuSettings(config);
return settings.percentMain().stream()
.map(percentMain -> new LruWindowTinyLfuPolicy(percentMain, settings))
.collect(toSet());
} | [
"public",
"static",
"Set",
"<",
"Policy",
">",
"policies",
"(",
"Config",
"config",
")",
"{",
"LruWindowTinyLfuSettings",
"settings",
"=",
"new",
"LruWindowTinyLfuSettings",
"(",
"config",
")",
";",
"return",
"settings",
".",
"percentMain",
"(",
")",
".",
"str... | Returns all variations of this policy based on the configuration parameters. | [
"Returns",
"all",
"variations",
"of",
"this",
"policy",
"based",
"on",
"the",
"configuration",
"parameters",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/LruWindowTinyLfuPolicy.java#L66-L71 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/ScrollBarButtonPainter.java | ScrollBarButtonPainter.paintBackgroundApart | private void paintBackgroundApart(Graphics2D g, int width, int height) {
Shape s = shapeGenerator.createScrollButtonApart(0, 0, width, height);
dropShadow.fill(g, s);
fillScrollBarButtonInteriorColors(g, s, isIncrease, buttonsTogether);
} | java | private void paintBackgroundApart(Graphics2D g, int width, int height) {
Shape s = shapeGenerator.createScrollButtonApart(0, 0, width, height);
dropShadow.fill(g, s);
fillScrollBarButtonInteriorColors(g, s, isIncrease, buttonsTogether);
} | [
"private",
"void",
"paintBackgroundApart",
"(",
"Graphics2D",
"g",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Shape",
"s",
"=",
"shapeGenerator",
".",
"createScrollButtonApart",
"(",
"0",
",",
"0",
",",
"width",
",",
"height",
")",
";",
"dropSha... | DOCUMENT ME!
@param g DOCUMENT ME!
@param width DOCUMENT ME!
@param height DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ScrollBarButtonPainter.java#L255-L260 |
h2oai/h2o-3 | h2o-core/src/main/java/water/util/FrameUtils.java | FrameUtils.parseFrame | public static Frame parseFrame(Key okey, URI ...uris) throws IOException {
return parseFrame(okey, null, uris);
} | java | public static Frame parseFrame(Key okey, URI ...uris) throws IOException {
return parseFrame(okey, null, uris);
} | [
"public",
"static",
"Frame",
"parseFrame",
"(",
"Key",
"okey",
",",
"URI",
"...",
"uris",
")",
"throws",
"IOException",
"{",
"return",
"parseFrame",
"(",
"okey",
",",
"null",
",",
"uris",
")",
";",
"}"
] | Parse given set of URIs and produce a frame's key representing output.
@param okey key for ouput frame. Can be null
@param uris array of URI (file://, hdfs://, s3n://, s3a://, s3://, http://, https:// ...) to parse
@return a frame which is saved into DKV under okey
@throws IOException in case of parse error. | [
"Parse",
"given",
"set",
"of",
"URIs",
"and",
"produce",
"a",
"frame",
"s",
"key",
"representing",
"output",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/FrameUtils.java#L53-L55 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/net/MediaType.java | MediaType.withCharset | public MediaType withCharset(Charset charset) {
checkNotNull(charset);
return withParameter(CHARSET_ATTRIBUTE, charset.name());
} | java | public MediaType withCharset(Charset charset) {
checkNotNull(charset);
return withParameter(CHARSET_ATTRIBUTE, charset.name());
} | [
"public",
"MediaType",
"withCharset",
"(",
"Charset",
"charset",
")",
"{",
"checkNotNull",
"(",
"charset",
")",
";",
"return",
"withParameter",
"(",
"CHARSET_ATTRIBUTE",
",",
"charset",
".",
"name",
"(",
")",
")",
";",
"}"
] | Returns a new instance with the same type and subtype as this instance, with the
{@code charset} parameter set to the {@link Charset#name name} of the given charset. Only one
{@code charset} parameter will be present on the new instance regardless of the number set on
this one.
<p>If a charset must be specified that is not supported on this JVM (and thus is not
representable as a {@link Charset} instance, use {@link #withParameter}. | [
"Returns",
"a",
"new",
"instance",
"with",
"the",
"same",
"type",
"and",
"subtype",
"as",
"this",
"instance",
"with",
"the",
"{",
"@code",
"charset",
"}",
"parameter",
"set",
"to",
"the",
"{",
"@link",
"Charset#name",
"name",
"}",
"of",
"the",
"given",
"... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/net/MediaType.java#L634-L637 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java | AlignmentTools.applyAlignment | public static <T> Map<T,T> applyAlignment(Map<T, T> alignmentMap, int k) {
return applyAlignment(alignmentMap, new IdentityMap<T>(), k);
} | java | public static <T> Map<T,T> applyAlignment(Map<T, T> alignmentMap, int k) {
return applyAlignment(alignmentMap, new IdentityMap<T>(), k);
} | [
"public",
"static",
"<",
"T",
">",
"Map",
"<",
"T",
",",
"T",
">",
"applyAlignment",
"(",
"Map",
"<",
"T",
",",
"T",
">",
"alignmentMap",
",",
"int",
"k",
")",
"{",
"return",
"applyAlignment",
"(",
"alignmentMap",
",",
"new",
"IdentityMap",
"<",
"T",... | Applies an alignment k times. Eg if alignmentMap defines function f(x),
this returns a function f^k(x)=f(f(...f(x)...)).
@param <T>
@param alignmentMap The input function, as a map (see {@link AlignmentTools#alignmentAsMap(AFPChain)})
@param k The number of times to apply the alignment
@return A new alignment. If the input function is not automorphic
(one-to-one), then some inputs may map to null, indicating that the
function is undefined for that input. | [
"Applies",
"an",
"alignment",
"k",
"times",
".",
"Eg",
"if",
"alignmentMap",
"defines",
"function",
"f",
"(",
"x",
")",
"this",
"returns",
"a",
"function",
"f^k",
"(",
"x",
")",
"=",
"f",
"(",
"f",
"(",
"...",
"f",
"(",
"x",
")",
"...",
"))",
"."... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java#L191-L193 |
foundation-runtime/service-directory | 2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/WebSocketSerializer.java | WebSocketSerializer.serializeProtocol | private static String serializeProtocol(ProtocolHeader header, Protocol protocol) throws JsonGenerationException, JsonMappingException, IOException{
ProtocolPair p = new ProtocolPair();
p.setProtocolHeader(header);
if(protocol == null){
p.setType(null);
} else {
p.setType(protocol.getClass());
}
p.setProtocol(toJsonStr(protocol));
return toJsonStr(p);
} | java | private static String serializeProtocol(ProtocolHeader header, Protocol protocol) throws JsonGenerationException, JsonMappingException, IOException{
ProtocolPair p = new ProtocolPair();
p.setProtocolHeader(header);
if(protocol == null){
p.setType(null);
} else {
p.setType(protocol.getClass());
}
p.setProtocol(toJsonStr(protocol));
return toJsonStr(p);
} | [
"private",
"static",
"String",
"serializeProtocol",
"(",
"ProtocolHeader",
"header",
",",
"Protocol",
"protocol",
")",
"throws",
"JsonGenerationException",
",",
"JsonMappingException",
",",
"IOException",
"{",
"ProtocolPair",
"p",
"=",
"new",
"ProtocolPair",
"(",
")",... | Serialize the Protocol to JSON String.
@param header
the ProtocolHeader.
@param protocol
the Protocol.
@return
the JSON String.
@throws JsonGenerationException
@throws JsonMappingException
@throws IOException | [
"Serialize",
"the",
"Protocol",
"to",
"JSON",
"String",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/WebSocketSerializer.java#L198-L208 |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/Configuration.java | Configuration.getBoolean | public boolean getBoolean(String key, boolean defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
return convertToBoolean(o);
} | java | public boolean getBoolean(String key, boolean defaultValue) {
Object o = getRawValue(key);
if (o == null) {
return defaultValue;
}
return convertToBoolean(o);
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"Object",
"o",
"=",
"getRawValue",
"(",
"key",
")",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"return",
"convertToBo... | Returns the value associated with the given key as a boolean.
@param key
the key pointing to the associated value
@param defaultValue
the default value which is returned in case there is no value associated with the given key
@return the (default) value associated with the given key | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"as",
"a",
"boolean",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L352-L359 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java | PyExpressionGenerator._generate | @SuppressWarnings("static-method")
protected XExpression _generate(SarlBreakExpression breakStatement, IAppendable it, IExtraLanguageGeneratorContext context) {
if (context.getExpectedExpressionType() == null) {
it.append("break"); //$NON-NLS-1$
} else {
it.append("return ").append(toDefaultValue(context.getExpectedExpressionType().toJavaCompliantTypeReference())); //$NON-NLS-1$
}
return breakStatement;
} | java | @SuppressWarnings("static-method")
protected XExpression _generate(SarlBreakExpression breakStatement, IAppendable it, IExtraLanguageGeneratorContext context) {
if (context.getExpectedExpressionType() == null) {
it.append("break"); //$NON-NLS-1$
} else {
it.append("return ").append(toDefaultValue(context.getExpectedExpressionType().toJavaCompliantTypeReference())); //$NON-NLS-1$
}
return breakStatement;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"XExpression",
"_generate",
"(",
"SarlBreakExpression",
"breakStatement",
",",
"IAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"if",
"(",
"context",
".",
"getExpectedEx... | Generate the given object.
@param breakStatement the break statement.
@param it the target for the generated content.
@param context the context.
@return the statement. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L365-L373 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/FunctionPattern.java | FunctionPattern.execute | public XObject execute(XPathContext xctxt, int context)
throws javax.xml.transform.TransformerException
{
DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
XNumber score = SCORE_NONE;
if (null != nl)
{
int n;
while (DTM.NULL != (n = nl.nextNode()))
{
score = (n == context) ? SCORE_OTHER : SCORE_NONE;
if (score == SCORE_OTHER)
{
context = n;
break;
}
}
// nl.detach();
}
nl.detach();
return score;
} | java | public XObject execute(XPathContext xctxt, int context)
throws javax.xml.transform.TransformerException
{
DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
XNumber score = SCORE_NONE;
if (null != nl)
{
int n;
while (DTM.NULL != (n = nl.nextNode()))
{
score = (n == context) ? SCORE_OTHER : SCORE_NONE;
if (score == SCORE_OTHER)
{
context = n;
break;
}
}
// nl.detach();
}
nl.detach();
return score;
} | [
"public",
"XObject",
"execute",
"(",
"XPathContext",
"xctxt",
",",
"int",
"context",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"DTMIterator",
"nl",
"=",
"m_functionExpr",
".",
"asIterator",
"(",
"xctxt",
",",
"cont... | Test a node to see if it matches the given node test.
@param xctxt XPath runtime context.
@return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST},
{@link org.apache.xpath.patterns.NodeTest#SCORE_NONE},
{@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD},
{@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or
{@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}.
@throws javax.xml.transform.TransformerException | [
"Test",
"a",
"node",
"to",
"see",
"if",
"it",
"matches",
"the",
"given",
"node",
"test",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/FunctionPattern.java#L102-L130 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java | StyleCache.setFeatureStyle | public boolean setFeatureStyle(PolylineOptions polylineOptions, FeatureStyle featureStyle) {
return StyleUtils.setFeatureStyle(polylineOptions, featureStyle, density);
} | java | public boolean setFeatureStyle(PolylineOptions polylineOptions, FeatureStyle featureStyle) {
return StyleUtils.setFeatureStyle(polylineOptions, featureStyle, density);
} | [
"public",
"boolean",
"setFeatureStyle",
"(",
"PolylineOptions",
"polylineOptions",
",",
"FeatureStyle",
"featureStyle",
")",
"{",
"return",
"StyleUtils",
".",
"setFeatureStyle",
"(",
"polylineOptions",
",",
"featureStyle",
",",
"density",
")",
";",
"}"
] | Set the feature style into the polyline options
@param polylineOptions polyline options
@param featureStyle feature style
@return true if style was set into the polyline options | [
"Set",
"the",
"feature",
"style",
"into",
"the",
"polyline",
"options"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java#L250-L252 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java | CPOptionCategoryPersistenceImpl.removeByUUID_G | @Override
public CPOptionCategory removeByUUID_G(String uuid, long groupId)
throws NoSuchCPOptionCategoryException {
CPOptionCategory cpOptionCategory = findByUUID_G(uuid, groupId);
return remove(cpOptionCategory);
} | java | @Override
public CPOptionCategory removeByUUID_G(String uuid, long groupId)
throws NoSuchCPOptionCategoryException {
CPOptionCategory cpOptionCategory = findByUUID_G(uuid, groupId);
return remove(cpOptionCategory);
} | [
"@",
"Override",
"public",
"CPOptionCategory",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchCPOptionCategoryException",
"{",
"CPOptionCategory",
"cpOptionCategory",
"=",
"findByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
... | Removes the cp option category where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the cp option category that was removed | [
"Removes",
"the",
"cp",
"option",
"category",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionCategoryPersistenceImpl.java#L813-L819 |
jmeter-maven-plugin/jmeter-maven-plugin | src/main/java/com/lazerycode/jmeter/properties/PropertiesFile.java | PropertiesFile.addAndOverwriteProperties | public void addAndOverwriteProperties(Map<String, String> additionalProperties) {
additionalProperties.values().removeAll(Collections.singleton(null));
for (Map.Entry<String, String> additionalPropertiesMap : additionalProperties.entrySet()) {
if (!additionalPropertiesMap.getValue().trim().isEmpty()) {
properties.setProperty(additionalPropertiesMap.getKey(), additionalPropertiesMap.getValue());
warnUserOfPossibleErrors(additionalPropertiesMap.getKey(), properties);
}
}
} | java | public void addAndOverwriteProperties(Map<String, String> additionalProperties) {
additionalProperties.values().removeAll(Collections.singleton(null));
for (Map.Entry<String, String> additionalPropertiesMap : additionalProperties.entrySet()) {
if (!additionalPropertiesMap.getValue().trim().isEmpty()) {
properties.setProperty(additionalPropertiesMap.getKey(), additionalPropertiesMap.getValue());
warnUserOfPossibleErrors(additionalPropertiesMap.getKey(), properties);
}
}
} | [
"public",
"void",
"addAndOverwriteProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"additionalProperties",
")",
"{",
"additionalProperties",
".",
"values",
"(",
")",
".",
"removeAll",
"(",
"Collections",
".",
"singleton",
"(",
"null",
")",
")",
";",... | Merge a Map of properties into our Properties object
The additions will overwrite any existing properties
@param additionalProperties Map to merge into our Properties object | [
"Merge",
"a",
"Map",
"of",
"properties",
"into",
"our",
"Properties",
"object",
"The",
"additions",
"will",
"overwrite",
"any",
"existing",
"properties"
] | train | https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/properties/PropertiesFile.java#L99-L107 |
alkacon/opencms-core | src/org/opencms/security/CmsPrincipal.java | CmsPrincipal.readPrefixedPrincipal | public static I_CmsPrincipal readPrefixedPrincipal(CmsObject cms, String name) throws CmsException {
if (CmsGroup.hasPrefix(name)) {
// this principal is a group
return cms.readGroup(CmsGroup.removePrefix(name));
} else if (CmsUser.hasPrefix(name)) {
// this principal is a user
return cms.readUser(CmsUser.removePrefix(name));
}
// invalid principal name was given
throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_INVALID_PRINCIPAL_1, name));
} | java | public static I_CmsPrincipal readPrefixedPrincipal(CmsObject cms, String name) throws CmsException {
if (CmsGroup.hasPrefix(name)) {
// this principal is a group
return cms.readGroup(CmsGroup.removePrefix(name));
} else if (CmsUser.hasPrefix(name)) {
// this principal is a user
return cms.readUser(CmsUser.removePrefix(name));
}
// invalid principal name was given
throw new CmsDbEntryNotFoundException(Messages.get().container(Messages.ERR_INVALID_PRINCIPAL_1, name));
} | [
"public",
"static",
"I_CmsPrincipal",
"readPrefixedPrincipal",
"(",
"CmsObject",
"cms",
",",
"String",
"name",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"CmsGroup",
".",
"hasPrefix",
"(",
"name",
")",
")",
"{",
"// this principal is a group",
"return",
"cms",... | Utility function to read a prefixed principal from the OpenCms database using the
provided OpenCms user context.<p>
The principal must be either prefixed with <code>{@link I_CmsPrincipal#PRINCIPAL_GROUP}.</code> or
<code>{@link I_CmsPrincipal#PRINCIPAL_USER}.</code>.<p>
@param cms the OpenCms user context to use when reading the principal
@param name the prefixed principal name
@return the principal read from the OpenCms database
@throws CmsException in case the principal could not be read | [
"Utility",
"function",
"to",
"read",
"a",
"prefixed",
"principal",
"from",
"the",
"OpenCms",
"database",
"using",
"the",
"provided",
"OpenCms",
"user",
"context",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsPrincipal.java#L224-L235 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/json/JsonArray.java | JsonArray.set | public JsonArray set(int index, int value) {
values.set(index, Json.value(value));
return this;
} | java | public JsonArray set(int index, int value) {
values.set(index, Json.value(value));
return this;
} | [
"public",
"JsonArray",
"set",
"(",
"int",
"index",
",",
"int",
"value",
")",
"{",
"values",
".",
"set",
"(",
"index",
",",
"Json",
".",
"value",
"(",
"value",
")",
")",
";",
"return",
"this",
";",
"}"
] | Replaces the element at the specified position in this array with the JSON representation of
the specified <code>int</code> value.
@param index
the index of the array element to replace
@param value
the value to be stored at the specified array position
@return the array itself, to enable method chaining
@throws IndexOutOfBoundsException
if the index is out of range, i.e. <code>index < 0</code> or
<code>index >= size</code> | [
"Replaces",
"the",
"element",
"at",
"the",
"specified",
"position",
"in",
"this",
"array",
"with",
"the",
"JSON",
"representation",
"of",
"the",
"specified",
"<code",
">",
"int<",
"/",
"code",
">",
"value",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/JsonArray.java#L259-L262 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/internal/DatabaseURIHelper.java | DatabaseURIHelper.changesUri | public URI changesUri(Map<String, Object> query) {
//lets find the since parameter
if(query.containsKey("since")){
Object since = query.get("since");
if(!(since instanceof String)){
//json encode the seq number since it isn't a string
Gson gson = new Gson();
query.put("since",gson.toJson(since));
}
}
return this.path("_changes").query(query).build();
} | java | public URI changesUri(Map<String, Object> query) {
//lets find the since parameter
if(query.containsKey("since")){
Object since = query.get("since");
if(!(since instanceof String)){
//json encode the seq number since it isn't a string
Gson gson = new Gson();
query.put("since",gson.toJson(since));
}
}
return this.path("_changes").query(query).build();
} | [
"public",
"URI",
"changesUri",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"query",
")",
"{",
"//lets find the since parameter",
"if",
"(",
"query",
".",
"containsKey",
"(",
"\"since\"",
")",
")",
"{",
"Object",
"since",
"=",
"query",
".",
"get",
"(",
... | Returns URI for {@code _changes} endpoint using passed
{@code query}. | [
"Returns",
"URI",
"for",
"{"
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/DatabaseURIHelper.java#L73-L85 |
alkacon/opencms-core | src/org/opencms/report/CmsClassicJavascriptReportUpdateFormatter.java | CmsClassicJavascriptReportUpdateFormatter.formatException | private String formatException(Throwable throwable) {
StringBuffer buf = new StringBuffer();
buf.append("aT('");
buf.append(Messages.get().getBundle(m_locale).key(Messages.RPT_EXCEPTION_0));
String exception = CmsEncoder.escapeXml(CmsException.getStackTraceAsString(throwable));
StringBuffer excBuffer = new StringBuffer(exception.length() + 50);
StringTokenizer tok = new StringTokenizer(exception, "\r\n");
while (tok.hasMoreTokens()) {
excBuffer.append(tok.nextToken());
excBuffer.append(CmsHtmlReport.LINEBREAK);
}
buf.append(CmsStringUtil.escapeJavaScript(excBuffer.toString()));
buf.append("'); ");
return buf.toString();
} | java | private String formatException(Throwable throwable) {
StringBuffer buf = new StringBuffer();
buf.append("aT('");
buf.append(Messages.get().getBundle(m_locale).key(Messages.RPT_EXCEPTION_0));
String exception = CmsEncoder.escapeXml(CmsException.getStackTraceAsString(throwable));
StringBuffer excBuffer = new StringBuffer(exception.length() + 50);
StringTokenizer tok = new StringTokenizer(exception, "\r\n");
while (tok.hasMoreTokens()) {
excBuffer.append(tok.nextToken());
excBuffer.append(CmsHtmlReport.LINEBREAK);
}
buf.append(CmsStringUtil.escapeJavaScript(excBuffer.toString()));
buf.append("'); ");
return buf.toString();
} | [
"private",
"String",
"formatException",
"(",
"Throwable",
"throwable",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"aT('\"",
")",
";",
"buf",
".",
"append",
"(",
"Messages",
".",
"get",
"(",
")... | Generates the formatted output for an exception.<P>
@param throwable the exception
@return the formatted output | [
"Generates",
"the",
"formatted",
"output",
"for",
"an",
"exception",
".",
"<P",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/report/CmsClassicJavascriptReportUpdateFormatter.java#L84-L99 |
wildfly/wildfly-core | jmx/src/main/java/org/jboss/as/jmx/model/ObjectNameAddressUtil.java | ObjectNameAddressUtil.toPathAddress | static PathAddress toPathAddress(String domain, ImmutableManagementResourceRegistration registry, ObjectName name) {
if (!name.getDomain().equals(domain)) {
return PathAddress.EMPTY_ADDRESS;
}
if (name.equals(ModelControllerMBeanHelper.createRootObjectName(domain))) {
return PathAddress.EMPTY_ADDRESS;
}
final Hashtable<String, String> properties = name.getKeyPropertyList();
return searchPathAddress(PathAddress.EMPTY_ADDRESS, registry, properties);
} | java | static PathAddress toPathAddress(String domain, ImmutableManagementResourceRegistration registry, ObjectName name) {
if (!name.getDomain().equals(domain)) {
return PathAddress.EMPTY_ADDRESS;
}
if (name.equals(ModelControllerMBeanHelper.createRootObjectName(domain))) {
return PathAddress.EMPTY_ADDRESS;
}
final Hashtable<String, String> properties = name.getKeyPropertyList();
return searchPathAddress(PathAddress.EMPTY_ADDRESS, registry, properties);
} | [
"static",
"PathAddress",
"toPathAddress",
"(",
"String",
"domain",
",",
"ImmutableManagementResourceRegistration",
"registry",
",",
"ObjectName",
"name",
")",
"{",
"if",
"(",
"!",
"name",
".",
"getDomain",
"(",
")",
".",
"equals",
"(",
"domain",
")",
")",
"{",... | Straight conversion from an ObjectName to a PathAddress.
There may not necessarily be a Resource at this path address (if that correspond to a pattern) but it must
match a model in the registry.
@param domain the name of the caller's JMX domain
@param registry the root resource for the management model
@param name the ObjectName to convert
@return the PathAddress, or {@code null} if no address matches the object name | [
"Straight",
"conversion",
"from",
"an",
"ObjectName",
"to",
"a",
"PathAddress",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/jmx/src/main/java/org/jboss/as/jmx/model/ObjectNameAddressUtil.java#L238-L247 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/Beta.java | Beta.Log | public static double Log(double a, double b) {
return Gamma.Log(a) + Gamma.Log(b) - Gamma.Log(a + b);
} | java | public static double Log(double a, double b) {
return Gamma.Log(a) + Gamma.Log(b) - Gamma.Log(a + b);
} | [
"public",
"static",
"double",
"Log",
"(",
"double",
"a",
",",
"double",
"b",
")",
"{",
"return",
"Gamma",
".",
"Log",
"(",
"a",
")",
"+",
"Gamma",
".",
"Log",
"(",
"b",
")",
"-",
"Gamma",
".",
"Log",
"(",
"a",
"+",
"b",
")",
";",
"}"
] | Natural logarithm of the Beta function.
@param a Value.
@param b Value.
@return Result. | [
"Natural",
"logarithm",
"of",
"the",
"Beta",
"function",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/Beta.java#L60-L62 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/FileUpload.java | FileUpload.setAttribute | public void setAttribute(String name, String value, String facet)
throws JspException
{
if (name != null) {
if (name.equals(TYPE)) {
String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name});
registerTagError(s, null);
}
else if (name.equals(READONLY)) {
_state.readonly = Boolean.valueOf(value).booleanValue();
return;
}
}
super.setAttribute(name, value, facet);
} | java | public void setAttribute(String name, String value, String facet)
throws JspException
{
if (name != null) {
if (name.equals(TYPE)) {
String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name});
registerTagError(s, null);
}
else if (name.equals(READONLY)) {
_state.readonly = Boolean.valueOf(value).booleanValue();
return;
}
}
super.setAttribute(name, value, facet);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"name",
",",
"String",
"value",
",",
"String",
"facet",
")",
"throws",
"JspException",
"{",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"TYPE",
")",
")",
"{",
"Str... | Base support for the attribute tag. This is overridden to prevent setting the <code>type</code>
attribute.
@param name The name of the attribute. This value may not be null or the empty string.
@param value The value of the attribute. This may contain an expression.
@param facet The name of a facet to which the attribute will be applied. This is optional.
@throws JspException A JspException may be thrown if there is an error setting the attribute. | [
"Base",
"support",
"for",
"the",
"attribute",
"tag",
".",
"This",
"is",
"overridden",
"to",
"prevent",
"setting",
"the",
"<code",
">",
"type<",
"/",
"code",
">",
"attribute",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/FileUpload.java#L133-L147 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/geometry/GeometryUtil.java | GeometryUtil.get3DCentreOfMass | public static Point3d get3DCentreOfMass(IAtomContainer ac) {
double xsum = 0.0;
double ysum = 0.0;
double zsum = 0.0;
double totalmass = 0.0;
Isotopes isotopes;
try {
isotopes = Isotopes.getInstance();
} catch (IOException e) {
throw new RuntimeException("Could not initialize Isotopes");
}
for (IAtom a : ac.atoms()) {
Double mass = a.getExactMass();
// some sanity checking
if (a.getPoint3d() == null) return null;
if (mass == null)
mass = isotopes.getNaturalMass(a);
totalmass += mass;
xsum += mass * a.getPoint3d().x;
ysum += mass * a.getPoint3d().y;
zsum += mass * a.getPoint3d().z;
}
return new Point3d(xsum / totalmass, ysum / totalmass, zsum / totalmass);
} | java | public static Point3d get3DCentreOfMass(IAtomContainer ac) {
double xsum = 0.0;
double ysum = 0.0;
double zsum = 0.0;
double totalmass = 0.0;
Isotopes isotopes;
try {
isotopes = Isotopes.getInstance();
} catch (IOException e) {
throw new RuntimeException("Could not initialize Isotopes");
}
for (IAtom a : ac.atoms()) {
Double mass = a.getExactMass();
// some sanity checking
if (a.getPoint3d() == null) return null;
if (mass == null)
mass = isotopes.getNaturalMass(a);
totalmass += mass;
xsum += mass * a.getPoint3d().x;
ysum += mass * a.getPoint3d().y;
zsum += mass * a.getPoint3d().z;
}
return new Point3d(xsum / totalmass, ysum / totalmass, zsum / totalmass);
} | [
"public",
"static",
"Point3d",
"get3DCentreOfMass",
"(",
"IAtomContainer",
"ac",
")",
"{",
"double",
"xsum",
"=",
"0.0",
";",
"double",
"ysum",
"=",
"0.0",
";",
"double",
"zsum",
"=",
"0.0",
";",
"double",
"totalmass",
"=",
"0.0",
";",
"Isotopes",
"isotope... | Calculates the center of mass for the <code>Atom</code>s in the AtomContainer.
@param ac AtomContainer for which the center of mass is calculated
@return The center of mass of the molecule, or <code>NULL</code> if the molecule
does not have 3D coordinates or if any of the atoms do not have a valid atomic mass
@cdk.keyword center of mass
@cdk.dictref blue-obelisk:calculate3DCenterOfMass | [
"Calculates",
"the",
"center",
"of",
"mass",
"for",
"the",
"<code",
">",
"Atom<",
"/",
"code",
">",
"s",
"in",
"the",
"AtomContainer",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/geometry/GeometryUtil.java#L540-L567 |
google/closure-compiler | src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java | JsDocInfoParser.parseAndRecordTypeNameNode | private Node parseAndRecordTypeNameNode(JsDocToken token, int lineno,
int startCharno, boolean matchingLC) {
return parseAndRecordTypeNode(token, lineno, startCharno, matchingLC, true);
} | java | private Node parseAndRecordTypeNameNode(JsDocToken token, int lineno,
int startCharno, boolean matchingLC) {
return parseAndRecordTypeNode(token, lineno, startCharno, matchingLC, true);
} | [
"private",
"Node",
"parseAndRecordTypeNameNode",
"(",
"JsDocToken",
"token",
",",
"int",
"lineno",
",",
"int",
"startCharno",
",",
"boolean",
"matchingLC",
")",
"{",
"return",
"parseAndRecordTypeNode",
"(",
"token",
",",
"lineno",
",",
"startCharno",
",",
"matchin... | Looks for a type expression at the current token and if found,
returns it. Note that this method consumes input.
@param token The current token.
@param lineno The line of the type expression.
@param startCharno The starting character position of the type expression.
@param matchingLC Whether the type expression starts with a "{".
@return The type expression found or null if none. | [
"Looks",
"for",
"a",
"type",
"expression",
"at",
"the",
"current",
"token",
"and",
"if",
"found",
"returns",
"it",
".",
"Note",
"that",
"this",
"method",
"consumes",
"input",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/JsDocInfoParser.java#L1541-L1544 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java | VarOptItemsSketch.swapValues | private void swapValues(final int src, final int dst) {
final T item = data_.get(src);
data_.set(src, data_.get(dst));
data_.set(dst, item);
final Double wt = weights_.get(src);
weights_.set(src, weights_.get(dst));
weights_.set(dst, wt);
if (marks_ != null) {
final Boolean mark = marks_.get(src);
marks_.set(src, marks_.get(dst));
marks_.set(dst, mark);
}
} | java | private void swapValues(final int src, final int dst) {
final T item = data_.get(src);
data_.set(src, data_.get(dst));
data_.set(dst, item);
final Double wt = weights_.get(src);
weights_.set(src, weights_.get(dst));
weights_.set(dst, wt);
if (marks_ != null) {
final Boolean mark = marks_.get(src);
marks_.set(src, marks_.get(dst));
marks_.set(dst, mark);
}
} | [
"private",
"void",
"swapValues",
"(",
"final",
"int",
"src",
",",
"final",
"int",
"dst",
")",
"{",
"final",
"T",
"item",
"=",
"data_",
".",
"get",
"(",
"src",
")",
";",
"data_",
".",
"set",
"(",
"src",
",",
"data_",
".",
"get",
"(",
"dst",
")",
... | /* swap values of data_, weights_, and marks between src and dst indices | [
"/",
"*",
"swap",
"values",
"of",
"data_",
"weights_",
"and",
"marks",
"between",
"src",
"and",
"dst",
"indices"
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/VarOptItemsSketch.java#L1222-L1236 |
onepf/OpenIAB | library/src/main/java/org/onepf/oms/SkuManager.java | SkuManager.getStoreSku | @NotNull
public String getStoreSku(@NotNull String appstoreName, @NotNull String sku) {
if (TextUtils.isEmpty(appstoreName)) {
throw SkuMappingException.newInstance(SkuMappingException.REASON_STORE_NAME);
}
if (TextUtils.isEmpty(sku)) {
throw SkuMappingException.newInstance(SkuMappingException.REASON_SKU);
}
Map<String, String> storeSku = sku2storeSkuMappings.get(appstoreName);
if (storeSku != null && storeSku.containsKey(sku)) {
final String s = storeSku.get(sku);
Logger.d("getStoreSku() using mapping for sku: ", sku, " -> ", s);
return s;
}
return sku;
} | java | @NotNull
public String getStoreSku(@NotNull String appstoreName, @NotNull String sku) {
if (TextUtils.isEmpty(appstoreName)) {
throw SkuMappingException.newInstance(SkuMappingException.REASON_STORE_NAME);
}
if (TextUtils.isEmpty(sku)) {
throw SkuMappingException.newInstance(SkuMappingException.REASON_SKU);
}
Map<String, String> storeSku = sku2storeSkuMappings.get(appstoreName);
if (storeSku != null && storeSku.containsKey(sku)) {
final String s = storeSku.get(sku);
Logger.d("getStoreSku() using mapping for sku: ", sku, " -> ", s);
return s;
}
return sku;
} | [
"@",
"NotNull",
"public",
"String",
"getStoreSku",
"(",
"@",
"NotNull",
"String",
"appstoreName",
",",
"@",
"NotNull",
"String",
"sku",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"appstoreName",
")",
")",
"{",
"throw",
"SkuMappingException",
".",... | Returns a store-specific SKU by the base internal SKU.
@param appstoreName The name of an app store.
@param sku The internal SKU.
@return store-specific SKU by a base internal one.
@throws java.lang.IllegalArgumentException When appstoreName or sku param is empty or null value.
@see #mapSku(String, String, String) | [
"Returns",
"a",
"store",
"-",
"specific",
"SKU",
"by",
"the",
"base",
"internal",
"SKU",
"."
] | train | https://github.com/onepf/OpenIAB/blob/90552d53c5303b322940d96a0c4b7cb797d78760/library/src/main/java/org/onepf/oms/SkuManager.java#L160-L176 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java | TrajectoryEnvelope.setFootprint | public void setFootprint(double w, double l, double dw, double dl) {
this.initFootprint(w, l, dw, dl);
} | java | public void setFootprint(double w, double l, double dw, double dl) {
this.initFootprint(w, l, dw, dl);
} | [
"public",
"void",
"setFootprint",
"(",
"double",
"w",
",",
"double",
"l",
",",
"double",
"dw",
",",
"double",
"dl",
")",
"{",
"this",
".",
"initFootprint",
"(",
"w",
",",
"l",
",",
"dw",
",",
"dl",
")",
";",
"}"
] | Set the footprint of this {@link TrajectoryEnvelope}, which is used for computing the spatial envelope.
@param w The width of the robot's footprint (dimension along the perpendicular to the driving direction).
@param l The length of the robot's footprint (dimension along the driving direction).
@param dw Lateral displacement of the reference point of the robot (along the perpendicular to the driving direction).
@param dl Forward displacement of the reference point of the robot (along the driving direction). | [
"Set",
"the",
"footprint",
"of",
"this",
"{"
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java#L183-L185 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/utilities/SQLUtility.java | SQLUtility.getLongString | public static String getLongString(ResultSet rs, int pos)
throws SQLException {
return instance.i_getLongString(rs, pos);
} | java | public static String getLongString(ResultSet rs, int pos)
throws SQLException {
return instance.i_getLongString(rs, pos);
} | [
"public",
"static",
"String",
"getLongString",
"(",
"ResultSet",
"rs",
",",
"int",
"pos",
")",
"throws",
"SQLException",
"{",
"return",
"instance",
".",
"i_getLongString",
"(",
"rs",
",",
"pos",
")",
";",
"}"
] | Get a long string, which could be a TEXT or CLOB type. (CLOBs require
special handling -- this method normalizes the reading of them) | [
"Get",
"a",
"long",
"string",
"which",
"could",
"be",
"a",
"TEXT",
"or",
"CLOB",
"type",
".",
"(",
"CLOBs",
"require",
"special",
"handling",
"--",
"this",
"method",
"normalizes",
"the",
"reading",
"of",
"them",
")"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/utilities/SQLUtility.java#L140-L143 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.countCodePoint | public static int countCodePoint(String string, CodePointPredicate predicate)
{
int count = 0;
int size = string.length();
for (int i = 0; i < size; )
{
int codePoint = string.codePointAt(i);
if (predicate.accept(codePoint))
{
count++;
}
i += Character.charCount(codePoint);
}
return count;
} | java | public static int countCodePoint(String string, CodePointPredicate predicate)
{
int count = 0;
int size = string.length();
for (int i = 0; i < size; )
{
int codePoint = string.codePointAt(i);
if (predicate.accept(codePoint))
{
count++;
}
i += Character.charCount(codePoint);
}
return count;
} | [
"public",
"static",
"int",
"countCodePoint",
"(",
"String",
"string",
",",
"CodePointPredicate",
"predicate",
")",
"{",
"int",
"count",
"=",
"0",
";",
"int",
"size",
"=",
"string",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | Count the number of elements that return true for the specified {@code predicate}.
@since 7.0 | [
"Count",
"the",
"number",
"of",
"elements",
"that",
"return",
"true",
"for",
"the",
"specified",
"{",
"@code",
"predicate",
"}",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L541-L555 |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/reflection/MyReflectionUtils.java | MyReflectionUtils.buildInstanceForMap | public static <T> T buildInstanceForMap(Class<T> clazz, Map<String, Object> values)
throws InstantiationException, IllegalAccessException, IntrospectionException,
IllegalArgumentException, InvocationTargetException {
return buildInstanceForMap(clazz, values, new MyDefaultReflectionDifferenceHandler());
} | java | public static <T> T buildInstanceForMap(Class<T> clazz, Map<String, Object> values)
throws InstantiationException, IllegalAccessException, IntrospectionException,
IllegalArgumentException, InvocationTargetException {
return buildInstanceForMap(clazz, values, new MyDefaultReflectionDifferenceHandler());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"buildInstanceForMap",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
",",
"IntrospectionException",
... | Builds a instance of the class for a map containing the values, without specifying the handler for differences
@param clazz The class to build instance
@param values The values map
@return The instance
@throws InstantiationException Error instantiating
@throws IllegalAccessException Access error
@throws IntrospectionException Introspection error
@throws IllegalArgumentException Argument invalid
@throws InvocationTargetException Invalid target | [
"Builds",
"a",
"instance",
"of",
"the",
"class",
"for",
"a",
"map",
"containing",
"the",
"values",
"without",
"specifying",
"the",
"handler",
"for",
"differences"
] | train | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/reflection/MyReflectionUtils.java#L48-L52 |
jbundle/jbundle | model/base/src/main/java/org/jbundle/model/util/Util.java | Util.getImageFilename | public static String getImageFilename(String strFilename, String strSubDirectory)
{
if ((strFilename == null) || (strFilename.length() == 0))
return null; // A null will tell a JButton not to load an image
if (strFilename.indexOf('.') == -1)
strFilename += ".gif";
strFilename = Util.getFullFilename(strFilename, strSubDirectory, Constant.IMAGE_LOCATION, true);
return strFilename;
} | java | public static String getImageFilename(String strFilename, String strSubDirectory)
{
if ((strFilename == null) || (strFilename.length() == 0))
return null; // A null will tell a JButton not to load an image
if (strFilename.indexOf('.') == -1)
strFilename += ".gif";
strFilename = Util.getFullFilename(strFilename, strSubDirectory, Constant.IMAGE_LOCATION, true);
return strFilename;
} | [
"public",
"static",
"String",
"getImageFilename",
"(",
"String",
"strFilename",
",",
"String",
"strSubDirectory",
")",
"{",
"if",
"(",
"(",
"strFilename",
"==",
"null",
")",
"||",
"(",
"strFilename",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"return",
... | Get this image's full filename.
@param filename The filename of this image (if no path, assumes images/buttons; if not ext assumes .gif).
@param strSubDirectory The sub-directory.
@return The full (relative) filename for this image. | [
"Get",
"this",
"image",
"s",
"full",
"filename",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L573-L581 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java | ChunkAnnotationUtils.getAnnotatedChunk | public static Annotation getAnnotatedChunk(List<CoreLabel> tokens, int tokenStartIndex, int tokenEndIndex, int totalTokenOffset)
{
Annotation chunk = new Annotation("");
annotateChunk(chunk, tokens, tokenStartIndex, tokenEndIndex, totalTokenOffset);
return chunk;
} | java | public static Annotation getAnnotatedChunk(List<CoreLabel> tokens, int tokenStartIndex, int tokenEndIndex, int totalTokenOffset)
{
Annotation chunk = new Annotation("");
annotateChunk(chunk, tokens, tokenStartIndex, tokenEndIndex, totalTokenOffset);
return chunk;
} | [
"public",
"static",
"Annotation",
"getAnnotatedChunk",
"(",
"List",
"<",
"CoreLabel",
">",
"tokens",
",",
"int",
"tokenStartIndex",
",",
"int",
"tokenEndIndex",
",",
"int",
"totalTokenOffset",
")",
"{",
"Annotation",
"chunk",
"=",
"new",
"Annotation",
"(",
"\"\"... | Create a new chunk Annotation with basic chunk information
CharacterOffsetBeginAnnotation - set to CharacterOffsetBeginAnnotation of first token in chunk
CharacterOffsetEndAnnotation - set to CharacterOffsetEndAnnotation of last token in chunk
TokensAnnotation - List of tokens in this chunk
TokenBeginAnnotation - Index of first token in chunk (index in original list of tokens)
tokenStartIndex + totalTokenOffset
TokenEndAnnotation - Index of last token in chunk (index in original list of tokens)
tokenEndIndex + totalTokenOffset
@param tokens - List of tokens to look for chunks
@param tokenStartIndex - Index (relative to current list of tokens) at which this chunk starts
@param tokenEndIndex - Index (relative to current list of tokens) at which this chunk ends (not inclusive)
@param totalTokenOffset - Index of tokens to offset by
@return Annotation representing new chunk | [
"Create",
"a",
"new",
"chunk",
"Annotation",
"with",
"basic",
"chunk",
"information",
"CharacterOffsetBeginAnnotation",
"-",
"set",
"to",
"CharacterOffsetBeginAnnotation",
"of",
"first",
"token",
"in",
"chunk",
"CharacterOffsetEndAnnotation",
"-",
"set",
"to",
"Characte... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java#L614-L619 |
Pi4J/pi4j | pi4j-core/src/main/java/com/pi4j/jni/Serial.java | Serial.write | public synchronized static void write(int fd, Charset charset, CharBuffer ... data) throws IllegalStateException, IOException {
for(CharBuffer single : data) {
write(fd, charset.encode(single));
}
} | java | public synchronized static void write(int fd, Charset charset, CharBuffer ... data) throws IllegalStateException, IOException {
for(CharBuffer single : data) {
write(fd, charset.encode(single));
}
} | [
"public",
"synchronized",
"static",
"void",
"write",
"(",
"int",
"fd",
",",
"Charset",
"charset",
",",
"CharBuffer",
"...",
"data",
")",
"throws",
"IllegalStateException",
",",
"IOException",
"{",
"for",
"(",
"CharBuffer",
"single",
":",
"data",
")",
"{",
"w... | <p>Sends one or more CharBuffers to the serial port/device identified by the given file descriptor.</p>
@param fd
The file descriptor of the serial port/device.
@param charset
The character set to use for encoding/decoding bytes to/from text characters
@param data
One or more CharBuffers (or an array) of data to be transmitted. (variable-length-argument) | [
"<p",
">",
"Sends",
"one",
"or",
"more",
"CharBuffers",
"to",
"the",
"serial",
"port",
"/",
"device",
"identified",
"by",
"the",
"given",
"file",
"descriptor",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/jni/Serial.java#L826-L830 |
cubedtear/aritzh | aritzh-gameEngine/src/main/java/io/github/aritzhack/aritzh/awt/util/SpriteUtil.java | SpriteUtil.addBorder | public static Sprite addBorder(Sprite original, int color, int size) {
int[] newPix = Arrays.copyOf(original.getPixels(), original.getPixels().length);
for (int x = 0; x < original.getWidth(); x++) {
for (int y = 0; y < original.getHeight(); y++) {
if (x < size || x >= original.getWidth() - size || y < size || y >= original.getHeight() - size) {
newPix[x + y * original.getWidth()] = color;
}
}
}
return new Sprite(original.getWidth(), original.getHeight(), newPix);
} | java | public static Sprite addBorder(Sprite original, int color, int size) {
int[] newPix = Arrays.copyOf(original.getPixels(), original.getPixels().length);
for (int x = 0; x < original.getWidth(); x++) {
for (int y = 0; y < original.getHeight(); y++) {
if (x < size || x >= original.getWidth() - size || y < size || y >= original.getHeight() - size) {
newPix[x + y * original.getWidth()] = color;
}
}
}
return new Sprite(original.getWidth(), original.getHeight(), newPix);
} | [
"public",
"static",
"Sprite",
"addBorder",
"(",
"Sprite",
"original",
",",
"int",
"color",
",",
"int",
"size",
")",
"{",
"int",
"[",
"]",
"newPix",
"=",
"Arrays",
".",
"copyOf",
"(",
"original",
".",
"getPixels",
"(",
")",
",",
"original",
".",
"getPix... | Adds a border to a Sprite (the border is added inside, so part of the sprite will be covered)
@param original The sprite to which the border will be added
@param color The color of the border (in ARGB format: 0xAARRGGBB)
@param size The sice of the border, in pixels
@return The sprite with the border | [
"Adds",
"a",
"border",
"to",
"a",
"Sprite",
"(",
"the",
"border",
"is",
"added",
"inside",
"so",
"part",
"of",
"the",
"sprite",
"will",
"be",
"covered",
")"
] | train | https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-gameEngine/src/main/java/io/github/aritzhack/aritzh/awt/util/SpriteUtil.java#L391-L401 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.createTransferMessageSenderFromEntityPath | public static IMessageSender createTransferMessageSenderFromEntityPath(MessagingFactory messagingFactory, String entityPath, String viaEntityPath) throws InterruptedException, ServiceBusException
{
return Utils.completeFuture(createTransferMessageSenderFromEntityPathAsync(messagingFactory, entityPath, viaEntityPath));
} | java | public static IMessageSender createTransferMessageSenderFromEntityPath(MessagingFactory messagingFactory, String entityPath, String viaEntityPath) throws InterruptedException, ServiceBusException
{
return Utils.completeFuture(createTransferMessageSenderFromEntityPathAsync(messagingFactory, entityPath, viaEntityPath));
} | [
"public",
"static",
"IMessageSender",
"createTransferMessageSenderFromEntityPath",
"(",
"MessagingFactory",
"messagingFactory",
",",
"String",
"entityPath",
",",
"String",
"viaEntityPath",
")",
"throws",
"InterruptedException",
",",
"ServiceBusException",
"{",
"return",
"Util... | Creates a transfer message sender. This sender sends message to destination entity via another entity.
This is mainly to be used when sending messages in a transaction.
When messages need to be sent across entities in a single transaction, this can be used to ensure
all the messages land initially in the same entity/partition for local transactions, and then
let service bus handle transferring the message to the actual destination.
@param messagingFactory messaging factory (which represents a connection) on which sender needs to be created.
@param entityPath path of the final destination of the message.
@param viaEntityPath The initial destination of the message.
@return IMessageSender instance
@throws InterruptedException if the current thread was interrupted while waiting
@throws ServiceBusException if the sender cannot be created | [
"Creates",
"a",
"transfer",
"message",
"sender",
".",
"This",
"sender",
"sends",
"message",
"to",
"destination",
"entity",
"via",
"another",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L116-L119 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.getWebElement | public WebElement getWebElement(By by, int index){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "getWebElement("+by+", "+index+")");
}
int match = index + 1;
WebElement webElement = waiter.waitForWebElement(by, match, Timeout.getSmallTimeout(), true);
if(webElement == null) {
if(match > 1){
Assert.fail(match + " WebElements with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' are not found!");
}
else {
Assert.fail("WebElement with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' is not found!");
}
}
return webElement;
} | java | public WebElement getWebElement(By by, int index){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "getWebElement("+by+", "+index+")");
}
int match = index + 1;
WebElement webElement = waiter.waitForWebElement(by, match, Timeout.getSmallTimeout(), true);
if(webElement == null) {
if(match > 1){
Assert.fail(match + " WebElements with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' are not found!");
}
else {
Assert.fail("WebElement with " + webUtils.splitNameByUpperCase(by.getClass().getSimpleName()) + ": '" + by.getValue() + "' is not found!");
}
}
return webElement;
} | [
"public",
"WebElement",
"getWebElement",
"(",
"By",
"by",
",",
"int",
"index",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
"\"getWebElement(\"",
"+",
"by",
"+",
"\", \"",
... | Returns a WebElement matching the specified By object and index.
@param by the By object. Examples are: {@code By.id("id")} and {@code By.name("name")}
@param index the index of the {@link WebElement}. {@code 0} if only one is available
@return a {@link WebElement} matching the specified index | [
"Returns",
"a",
"WebElement",
"matching",
"the",
"specified",
"By",
"object",
"and",
"index",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L3174-L3191 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/SecurityRulesInner.java | SecurityRulesInner.createOrUpdateAsync | public Observable<SecurityRuleInner> createOrUpdateAsync(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, SecurityRuleInner securityRuleParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters).map(new Func1<ServiceResponse<SecurityRuleInner>, SecurityRuleInner>() {
@Override
public SecurityRuleInner call(ServiceResponse<SecurityRuleInner> response) {
return response.body();
}
});
} | java | public Observable<SecurityRuleInner> createOrUpdateAsync(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, SecurityRuleInner securityRuleParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters).map(new Func1<ServiceResponse<SecurityRuleInner>, SecurityRuleInner>() {
@Override
public SecurityRuleInner call(ServiceResponse<SecurityRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SecurityRuleInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkSecurityGroupName",
",",
"String",
"securityRuleName",
",",
"SecurityRuleInner",
"securityRuleParameters",
")",
"{",
"return",
"createOrU... | Creates or updates a security rule in the specified network security group.
@param resourceGroupName The name of the resource group.
@param networkSecurityGroupName The name of the network security group.
@param securityRuleName The name of the security rule.
@param securityRuleParameters Parameters supplied to the create or update network security rule operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"security",
"rule",
"in",
"the",
"specified",
"network",
"security",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/SecurityRulesInner.java#L391-L398 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java | IPAddress.toCanonicalHostName | public HostName toCanonicalHostName() {
HostName host = canonicalHost;
if(host == null) {
if(isMultiple()) {
throw new IncompatibleAddressException(this, "ipaddress.error.unavailable.numeric");
}
InetAddress inetAddress = toInetAddress();
String hostStr = inetAddress.getCanonicalHostName();//note: this does not return ipv6 addresses enclosed in brackets []
if(hostStr.equals(inetAddress.getHostAddress())) {
//we got back the address, so the host is me
host = new HostName(hostStr, new ParsedHost(hostStr, getProvider()));
host.resolvedAddress = this;
} else {
//the reverse lookup succeeded in finding a host string
//we might not be the default resolved address for the host, so we don't set that field
host = new HostName(hostStr);
}
}
return host;
} | java | public HostName toCanonicalHostName() {
HostName host = canonicalHost;
if(host == null) {
if(isMultiple()) {
throw new IncompatibleAddressException(this, "ipaddress.error.unavailable.numeric");
}
InetAddress inetAddress = toInetAddress();
String hostStr = inetAddress.getCanonicalHostName();//note: this does not return ipv6 addresses enclosed in brackets []
if(hostStr.equals(inetAddress.getHostAddress())) {
//we got back the address, so the host is me
host = new HostName(hostStr, new ParsedHost(hostStr, getProvider()));
host.resolvedAddress = this;
} else {
//the reverse lookup succeeded in finding a host string
//we might not be the default resolved address for the host, so we don't set that field
host = new HostName(hostStr);
}
}
return host;
} | [
"public",
"HostName",
"toCanonicalHostName",
"(",
")",
"{",
"HostName",
"host",
"=",
"canonicalHost",
";",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"if",
"(",
"isMultiple",
"(",
")",
")",
"{",
"throw",
"new",
"IncompatibleAddressException",
"(",
"this",
... | Does a reverse name lookup to get the canonical host name.
Note that the canonical host name may differ on different systems, as it aligns with {@link InetAddress#getCanonicalHostName()}
In particular, on some systems the loopback address has canonical host localhost and on others the canonical host is the same loopback address. | [
"Does",
"a",
"reverse",
"name",
"lookup",
"to",
"get",
"the",
"canonical",
"host",
"name",
".",
"Note",
"that",
"the",
"canonical",
"host",
"name",
"may",
"differ",
"on",
"different",
"systems",
"as",
"it",
"aligns",
"with",
"{"
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java#L195-L214 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SoapClientActionBuilder.java | SoapClientActionBuilder.receive | public SoapClientResponseActionBuilder receive() {
SoapClientResponseActionBuilder soapClientResponseActionBuilder;
if (soapClient != null) {
soapClientResponseActionBuilder = new SoapClientResponseActionBuilder(action, soapClient);
} else {
soapClientResponseActionBuilder = new SoapClientResponseActionBuilder(action, soapClientUri);
}
soapClientResponseActionBuilder.withApplicationContext(applicationContext);
return soapClientResponseActionBuilder;
} | java | public SoapClientResponseActionBuilder receive() {
SoapClientResponseActionBuilder soapClientResponseActionBuilder;
if (soapClient != null) {
soapClientResponseActionBuilder = new SoapClientResponseActionBuilder(action, soapClient);
} else {
soapClientResponseActionBuilder = new SoapClientResponseActionBuilder(action, soapClientUri);
}
soapClientResponseActionBuilder.withApplicationContext(applicationContext);
return soapClientResponseActionBuilder;
} | [
"public",
"SoapClientResponseActionBuilder",
"receive",
"(",
")",
"{",
"SoapClientResponseActionBuilder",
"soapClientResponseActionBuilder",
";",
"if",
"(",
"soapClient",
"!=",
"null",
")",
"{",
"soapClientResponseActionBuilder",
"=",
"new",
"SoapClientResponseActionBuilder",
... | Generic response builder for expecting response messages on client.
@return | [
"Generic",
"response",
"builder",
"for",
"expecting",
"response",
"messages",
"on",
"client",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SoapClientActionBuilder.java#L59-L70 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Segment3ifx.java | Segment3ifx.x2Property | @Pure
public IntegerProperty x2Property() {
if (this.p2.x == null) {
this.p2.x = new SimpleIntegerProperty(this, MathFXAttributeNames.X2);
}
return this.p2.x;
} | java | @Pure
public IntegerProperty x2Property() {
if (this.p2.x == null) {
this.p2.x = new SimpleIntegerProperty(this, MathFXAttributeNames.X2);
}
return this.p2.x;
} | [
"@",
"Pure",
"public",
"IntegerProperty",
"x2Property",
"(",
")",
"{",
"if",
"(",
"this",
".",
"p2",
".",
"x",
"==",
"null",
")",
"{",
"this",
".",
"p2",
".",
"x",
"=",
"new",
"SimpleIntegerProperty",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"X2"... | Replies the property that is the x coordinate of the second segment point.
@return the x2 property. | [
"Replies",
"the",
"property",
"that",
"is",
"the",
"x",
"coordinate",
"of",
"the",
"second",
"segment",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Segment3ifx.java#L258-L264 |
roboconf/roboconf-platform | core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java | RabbitMqUtils.declareApplicationExchanges | public static void declareApplicationExchanges( String domain, String applicationName, Channel channel )
throws IOException {
// "topic" is a keyword for RabbitMQ.
if( applicationName != null ) {
String exch = buildExchangeNameForAgent( domain, applicationName );
channel.exchangeDeclare( exch, "topic" );
}
} | java | public static void declareApplicationExchanges( String domain, String applicationName, Channel channel )
throws IOException {
// "topic" is a keyword for RabbitMQ.
if( applicationName != null ) {
String exch = buildExchangeNameForAgent( domain, applicationName );
channel.exchangeDeclare( exch, "topic" );
}
} | [
"public",
"static",
"void",
"declareApplicationExchanges",
"(",
"String",
"domain",
",",
"String",
"applicationName",
",",
"Channel",
"channel",
")",
"throws",
"IOException",
"{",
"// \"topic\" is a keyword for RabbitMQ.",
"if",
"(",
"applicationName",
"!=",
"null",
")"... | Declares the required exchanges for an application (only for agents).
@param domain the domain name
@param applicationName the application name
@param channel the RabbitMQ channel
@throws IOException if an error occurs | [
"Declares",
"the",
"required",
"exchanges",
"for",
"an",
"application",
"(",
"only",
"for",
"agents",
")",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/utils/RabbitMqUtils.java#L181-L189 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java | FileUtil.saveToFile | public static String saveToFile(String baseName, String extension, byte[] content) {
String result;
File output = determineFilename(baseName, extension);
FileOutputStream target = null;
try {
target = new FileOutputStream(output);
target.write(content);
result = output.getAbsolutePath();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
if (target != null) {
try {
target.close();
} catch (IOException ex) {
// what to to?
}
}
}
return result;
} | java | public static String saveToFile(String baseName, String extension, byte[] content) {
String result;
File output = determineFilename(baseName, extension);
FileOutputStream target = null;
try {
target = new FileOutputStream(output);
target.write(content);
result = output.getAbsolutePath();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
if (target != null) {
try {
target.close();
} catch (IOException ex) {
// what to to?
}
}
}
return result;
} | [
"public",
"static",
"String",
"saveToFile",
"(",
"String",
"baseName",
",",
"String",
"extension",
",",
"byte",
"[",
"]",
"content",
")",
"{",
"String",
"result",
";",
"File",
"output",
"=",
"determineFilename",
"(",
"baseName",
",",
"extension",
")",
";",
... | Saves byte[] to new file.
@param baseName name for file created (without extension),
if a file already exists with the supplied name an
'_index' will be added.
@param extension extension for file.
@param content data to store in file.
@return absolute path of created file. | [
"Saves",
"byte",
"[]",
"to",
"new",
"file",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L223-L243 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java | PDTFormatter.getForPattern | @Nonnull
public static DateTimeFormatter getForPattern (@Nonnull final String sPattern, @Nullable final Locale aDisplayLocale)
{
final DateTimeFormatter aDTF = DateTimeFormatterCache.getDateTimeFormatterStrict (sPattern);
return getWithLocale (aDTF, aDisplayLocale);
} | java | @Nonnull
public static DateTimeFormatter getForPattern (@Nonnull final String sPattern, @Nullable final Locale aDisplayLocale)
{
final DateTimeFormatter aDTF = DateTimeFormatterCache.getDateTimeFormatterStrict (sPattern);
return getWithLocale (aDTF, aDisplayLocale);
} | [
"@",
"Nonnull",
"public",
"static",
"DateTimeFormatter",
"getForPattern",
"(",
"@",
"Nonnull",
"final",
"String",
"sPattern",
",",
"@",
"Nullable",
"final",
"Locale",
"aDisplayLocale",
")",
"{",
"final",
"DateTimeFormatter",
"aDTF",
"=",
"DateTimeFormatterCache",
".... | Get the STRICT {@link DateTimeFormatter} for the given pattern and locale,
using our default chronology.
@param sPattern
The pattern to be parsed
@param aDisplayLocale
The locale to be used. May be <code>null</code>.
@return The formatter object.
@throws IllegalArgumentException
If the pattern is illegal | [
"Get",
"the",
"STRICT",
"{",
"@link",
"DateTimeFormatter",
"}",
"for",
"the",
"given",
"pattern",
"and",
"locale",
"using",
"our",
"default",
"chronology",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/datetime/PDTFormatter.java#L333-L338 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.debtAccount_debt_debtId_pay_POST | public OvhOrder debtAccount_debt_debtId_pay_POST(Long debtId) throws IOException {
String qPath = "/me/debtAccount/debt/{debtId}/pay";
StringBuilder sb = path(qPath, debtId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder debtAccount_debt_debtId_pay_POST(Long debtId) throws IOException {
String qPath = "/me/debtAccount/debt/{debtId}/pay";
StringBuilder sb = path(qPath, debtId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"debtAccount_debt_debtId_pay_POST",
"(",
"Long",
"debtId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/debtAccount/debt/{debtId}/pay\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"debtId",
")",
";",
"Stri... | Create an order in order to pay this order's debt
REST: POST /me/debtAccount/debt/{debtId}/pay
@param debtId [required] | [
"Create",
"an",
"order",
"in",
"order",
"to",
"pay",
"this",
"order",
"s",
"debt"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2689-L2694 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_redirection_id_GET | public OvhRedirectionGlobal domain_redirection_id_GET(String domain, String id) throws IOException {
String qPath = "/email/domain/{domain}/redirection/{id}";
StringBuilder sb = path(qPath, domain, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRedirectionGlobal.class);
} | java | public OvhRedirectionGlobal domain_redirection_id_GET(String domain, String id) throws IOException {
String qPath = "/email/domain/{domain}/redirection/{id}";
StringBuilder sb = path(qPath, domain, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRedirectionGlobal.class);
} | [
"public",
"OvhRedirectionGlobal",
"domain_redirection_id_GET",
"(",
"String",
"domain",
",",
"String",
"id",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/redirection/{id}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
... | Get this object properties
REST: GET /email/domain/{domain}/redirection/{id}
@param domain [required] Name of your domain name
@param id [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1024-L1029 |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getMillisDifference | public static long getMillisDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
return diffTime;
} | java | public static long getMillisDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
return diffTime;
} | [
"public",
"static",
"long",
"getMillisDifference",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"long",
"startTime",
"=",
"startDate",
".",
"getTime",
"(",
")",
";",
"long",
"endTime",
"=",
"endDate",
".",
"getTime",
"(",
")",
";",
"long",
... | Gets the millis difference.
@param startDate the start date
@param endDate the end date
@return the millis difference | [
"Gets",
"the",
"millis",
"difference",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L472-L477 |
eclipse/hawkbit | hawkbit-http-security/src/main/java/org/eclipse/hawkbit/security/AbstractHttpControllerAuthenticationFilter.java | AbstractHttpControllerAuthenticationFilter.createTenantSecruityTokenVariables | protected DmfTenantSecurityToken createTenantSecruityTokenVariables(final HttpServletRequest request) {
final String requestURI = request.getRequestURI();
if (pathExtractor.match(request.getContextPath() + CONTROLLER_REQUEST_ANT_PATTERN, requestURI)) {
LOG.debug("retrieving principal from URI request {}", requestURI);
final Map<String, String> extractUriTemplateVariables = pathExtractor
.extractUriTemplateVariables(request.getContextPath() + CONTROLLER_REQUEST_ANT_PATTERN, requestURI);
final String controllerId = extractUriTemplateVariables.get(CONTROLLER_ID_PLACE_HOLDER);
final String tenant = extractUriTemplateVariables.get(TENANT_PLACE_HOLDER);
if (LOG.isTraceEnabled()) {
LOG.trace("Parsed tenant {} and controllerId {} from path request {}", tenant, controllerId,
requestURI);
}
return createTenantSecruityTokenVariables(request, tenant, controllerId);
} else if (pathExtractor.match(request.getContextPath() + CONTROLLER_DL_REQUEST_ANT_PATTERN, requestURI)) {
LOG.debug("retrieving path variables from URI request {}", requestURI);
final Map<String, String> extractUriTemplateVariables = pathExtractor.extractUriTemplateVariables(
request.getContextPath() + CONTROLLER_DL_REQUEST_ANT_PATTERN, requestURI);
final String tenant = extractUriTemplateVariables.get(TENANT_PLACE_HOLDER);
if (LOG.isTraceEnabled()) {
LOG.trace("Parsed tenant {} from path request {}", tenant, requestURI);
}
return createTenantSecruityTokenVariables(request, tenant, "anonymous");
} else {
if (LOG.isTraceEnabled()) {
LOG.trace("request {} does not match the path pattern {}, request gets ignored", requestURI,
CONTROLLER_REQUEST_ANT_PATTERN);
}
return null;
}
} | java | protected DmfTenantSecurityToken createTenantSecruityTokenVariables(final HttpServletRequest request) {
final String requestURI = request.getRequestURI();
if (pathExtractor.match(request.getContextPath() + CONTROLLER_REQUEST_ANT_PATTERN, requestURI)) {
LOG.debug("retrieving principal from URI request {}", requestURI);
final Map<String, String> extractUriTemplateVariables = pathExtractor
.extractUriTemplateVariables(request.getContextPath() + CONTROLLER_REQUEST_ANT_PATTERN, requestURI);
final String controllerId = extractUriTemplateVariables.get(CONTROLLER_ID_PLACE_HOLDER);
final String tenant = extractUriTemplateVariables.get(TENANT_PLACE_HOLDER);
if (LOG.isTraceEnabled()) {
LOG.trace("Parsed tenant {} and controllerId {} from path request {}", tenant, controllerId,
requestURI);
}
return createTenantSecruityTokenVariables(request, tenant, controllerId);
} else if (pathExtractor.match(request.getContextPath() + CONTROLLER_DL_REQUEST_ANT_PATTERN, requestURI)) {
LOG.debug("retrieving path variables from URI request {}", requestURI);
final Map<String, String> extractUriTemplateVariables = pathExtractor.extractUriTemplateVariables(
request.getContextPath() + CONTROLLER_DL_REQUEST_ANT_PATTERN, requestURI);
final String tenant = extractUriTemplateVariables.get(TENANT_PLACE_HOLDER);
if (LOG.isTraceEnabled()) {
LOG.trace("Parsed tenant {} from path request {}", tenant, requestURI);
}
return createTenantSecruityTokenVariables(request, tenant, "anonymous");
} else {
if (LOG.isTraceEnabled()) {
LOG.trace("request {} does not match the path pattern {}, request gets ignored", requestURI,
CONTROLLER_REQUEST_ANT_PATTERN);
}
return null;
}
} | [
"protected",
"DmfTenantSecurityToken",
"createTenantSecruityTokenVariables",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"final",
"String",
"requestURI",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",
"if",
"(",
"pathExtractor",
".",
"match",
"(",
... | Extracts tenant and controllerId from the request URI as path variables.
@param request
the Http request to extract the path variables.
@return the extracted {@link PathVariables} or {@code null} if the
request does not match the pattern and no variables could be
extracted | [
"Extracts",
"tenant",
"and",
"controllerId",
"from",
"the",
"request",
"URI",
"as",
"path",
"variables",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-http-security/src/main/java/org/eclipse/hawkbit/security/AbstractHttpControllerAuthenticationFilter.java#L134-L164 |
eduarddrenth/ReportjFreeChartSupport | src/main/java/com/vectorprint/report/itext/style/stylers/Chart.java | Chart.createImage | @Override
protected Image createImage(PdfContentByte canvas, Dataset data, float opacity) throws VectorPrintException, BadElementException {
ChartBuilder cb = new ChartBuilder(getType(),
data, getTitle(), getTitle(), getValLabel(), isVertical(), isLegend(), getValue(THEMEBUILDER, ChartThemeBuilder.class), getSettings());
Image img = ItextChartHelper.getChartImage(cb.getChart(), canvas, getWidth(), getHeight(), opacity);
applySettings(img);
return img;
} | java | @Override
protected Image createImage(PdfContentByte canvas, Dataset data, float opacity) throws VectorPrintException, BadElementException {
ChartBuilder cb = new ChartBuilder(getType(),
data, getTitle(), getTitle(), getValLabel(), isVertical(), isLegend(), getValue(THEMEBUILDER, ChartThemeBuilder.class), getSettings());
Image img = ItextChartHelper.getChartImage(cb.getChart(), canvas, getWidth(), getHeight(), opacity);
applySettings(img);
return img;
} | [
"@",
"Override",
"protected",
"Image",
"createImage",
"(",
"PdfContentByte",
"canvas",
",",
"Dataset",
"data",
",",
"float",
"opacity",
")",
"throws",
"VectorPrintException",
",",
"BadElementException",
"{",
"ChartBuilder",
"cb",
"=",
"new",
"ChartBuilder",
"(",
"... | calls {@link ChartBuilder#ChartBuilder(com.vectorprint.report.jfree.ChartBuilder.CHARTTYPE, org.jfree.data.general.Dataset, java.lang.String, java.lang.String, java.lang.String, com.vectorprint.report.jfree.ChartThemeBuilder, com.vectorprint.configuration.EnhancedMap)}, {@link ChartBuilder#getChart()
} and {@link ItextChartHelper#getChartImage(org.jfree.chart.JFreeChart, com.itextpdf.text.pdf.PdfContentByte, float, float, float)
} to create an Image of a chart.
@param canvas
@param data
@param opacity the value of opacity
@throws VectorPrintException
@throws BadElementException
@return the com.itextpdf.text.Image | [
"calls",
"{",
"@link",
"ChartBuilder#ChartBuilder",
"(",
"com",
".",
"vectorprint",
".",
"report",
".",
"jfree",
".",
"ChartBuilder",
".",
"CHARTTYPE",
"org",
".",
"jfree",
".",
"data",
".",
"general",
".",
"Dataset",
"java",
".",
"lang",
".",
"String",
"j... | train | https://github.com/eduarddrenth/ReportjFreeChartSupport/blob/bd9790190a0149706d31066bbd9c09f8e015c9a5/src/main/java/com/vectorprint/report/itext/style/stylers/Chart.java#L110-L117 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionRelPersistenceImpl.java | CPDefinitionOptionRelPersistenceImpl.findByGroupId | @Override
public List<CPDefinitionOptionRel> findByGroupId(long groupId, int start,
int end) {
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CPDefinitionOptionRel> findByGroupId(long groupId, int start,
int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionOptionRel",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"... | Returns a range of all the cp definition option rels where groupId = ?.
<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 CPDefinitionOptionRelModelImpl}. 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 start the lower bound of the range of cp definition option rels
@param end the upper bound of the range of cp definition option rels (not inclusive)
@return the range of matching cp definition option rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definition",
"option",
"rels",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionRelPersistenceImpl.java#L1541-L1545 |
amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.groupingBy | @SuppressWarnings("unchecked")
public <K, D, M extends Map<K, D>> M groupingBy(Function<? super T, ? extends K> classifier,
Supplier<M> mapFactory, Collector<? super T, ?, D> downstream) {
if (isParallel() && downstream.characteristics().contains(Characteristics.UNORDERED)
&& mapFactory.get() instanceof ConcurrentMap)
return (M) rawCollect(Collectors.groupingByConcurrent(classifier,
(Supplier<ConcurrentMap<K, D>>) mapFactory, downstream));
return rawCollect(Collectors.groupingBy(classifier, mapFactory, downstream));
} | java | @SuppressWarnings("unchecked")
public <K, D, M extends Map<K, D>> M groupingBy(Function<? super T, ? extends K> classifier,
Supplier<M> mapFactory, Collector<? super T, ?, D> downstream) {
if (isParallel() && downstream.characteristics().contains(Characteristics.UNORDERED)
&& mapFactory.get() instanceof ConcurrentMap)
return (M) rawCollect(Collectors.groupingByConcurrent(classifier,
(Supplier<ConcurrentMap<K, D>>) mapFactory, downstream));
return rawCollect(Collectors.groupingBy(classifier, mapFactory, downstream));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"K",
",",
"D",
",",
"M",
"extends",
"Map",
"<",
"K",
",",
"D",
">",
">",
"M",
"groupingBy",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
"classifier",
","... | Returns a {@code Map} whose keys are the values resulting from applying
the classification function to the input elements, and whose
corresponding values are the result of reduction of the input elements
which map to the associated key under the classification function.
<p>
The {@code Map} will be created using the provided factory function.
<p>
This is a <a href="package-summary.html#StreamOps">terminal</a>
operation.
@param <K> the type of the keys
@param <D> the result type of the downstream reduction
@param <M> the type of the resulting {@code Map}
@param classifier the classifier function mapping input elements to keys
@param mapFactory a function which, when called, produces a new empty
{@code Map} of the desired type
@param downstream a {@code Collector} implementing the downstream
reduction
@return a {@code Map} containing the results of the group-by operation
@see #groupingBy(Function)
@see Collectors#groupingBy(Function, Supplier, Collector)
@see Collectors#groupingByConcurrent(Function, Supplier, Collector) | [
"Returns",
"a",
"{",
"@code",
"Map",
"}",
"whose",
"keys",
"are",
"the",
"values",
"resulting",
"from",
"applying",
"the",
"classification",
"function",
"to",
"the",
"input",
"elements",
"and",
"whose",
"corresponding",
"values",
"are",
"the",
"result",
"of",
... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L566-L574 |
Red5/red5-client | src/main/java/org/red5/client/net/rtmp/BaseRTMPClientHandler.java | BaseRTMPClientHandler.getSharedObject | @Override
public IClientSharedObject getSharedObject(String name, boolean persistent) {
log.debug("getSharedObject name: {} persistent {}", new Object[] { name, persistent });
ClientSharedObject result = sharedObjects.get(name);
if (result != null) {
if (result.isPersistent() != persistent) {
throw new RuntimeException("Already connected to a shared object with this name, but with different persistence.");
}
return result;
}
result = new ClientSharedObject(name, persistent);
sharedObjects.put(name, result);
return result;
} | java | @Override
public IClientSharedObject getSharedObject(String name, boolean persistent) {
log.debug("getSharedObject name: {} persistent {}", new Object[] { name, persistent });
ClientSharedObject result = sharedObjects.get(name);
if (result != null) {
if (result.isPersistent() != persistent) {
throw new RuntimeException("Already connected to a shared object with this name, but with different persistence.");
}
return result;
}
result = new ClientSharedObject(name, persistent);
sharedObjects.put(name, result);
return result;
} | [
"@",
"Override",
"public",
"IClientSharedObject",
"getSharedObject",
"(",
"String",
"name",
",",
"boolean",
"persistent",
")",
"{",
"log",
".",
"debug",
"(",
"\"getSharedObject name: {} persistent {}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"name",
",",
"persisten... | Connect to client shared object.
@param name
Client shared object name
@param persistent
SO persistence flag
@return Client shared object instance | [
"Connect",
"to",
"client",
"shared",
"object",
"."
] | train | https://github.com/Red5/red5-client/blob/f894495b60e59d7cfba647abd9b934237cac9d45/src/main/java/org/red5/client/net/rtmp/BaseRTMPClientHandler.java#L333-L346 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/chrono/Chronology.java | Chronology.dateYearDay | public ChronoLocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
} | java | public ChronoLocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
} | [
"public",
"ChronoLocalDate",
"dateYearDay",
"(",
"Era",
"era",
",",
"int",
"yearOfEra",
",",
"int",
"dayOfYear",
")",
"{",
"return",
"dateYearDay",
"(",
"prolepticYear",
"(",
"era",
",",
"yearOfEra",
")",
",",
"dayOfYear",
")",
";",
"}"
] | Obtains a local date in this chronology from the era, year-of-era and
day-of-year fields.
@param era the era of the correct type for the chronology, not null
@param yearOfEra the chronology year-of-era
@param dayOfYear the chronology day-of-year
@return the local date in this chronology, not null
@throws DateTimeException if unable to create the date
@throws ClassCastException if the {@code era} is not of the correct type for the chronology | [
"Obtains",
"a",
"local",
"date",
"in",
"this",
"chronology",
"from",
"the",
"era",
"year",
"-",
"of",
"-",
"era",
"and",
"day",
"-",
"of",
"-",
"year",
"fields",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/Chronology.java#L468-L470 |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/common/Preconditions.java | Preconditions.checkArgNotNull | public static <T> T checkArgNotNull(T reference, String parameterName) {
if (reference == null) {
throw new NullPointerException(format("Argument '%s' must not be null", parameterName));
}
return reference;
} | java | public static <T> T checkArgNotNull(T reference, String parameterName) {
if (reference == null) {
throw new NullPointerException(format("Argument '%s' must not be null", parameterName));
}
return reference;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkArgNotNull",
"(",
"T",
"reference",
",",
"String",
"parameterName",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"format",
"(",
"\"Argument '%s' must not be... | Ensures that an object reference passed as a parameter to the calling
method is not null.
@param reference an object reference
@param parameterName the parameter name
@return the non-null reference that was validated
@throws NullPointerException if {@code reference} is null | [
"Ensures",
"that",
"an",
"object",
"reference",
"passed",
"as",
"a",
"parameter",
"to",
"the",
"calling",
"method",
"is",
"not",
"null",
"."
] | train | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Preconditions.java#L206-L211 |
cfg4j/cfg4j | cfg4j-core/src/main/java/org/cfg4j/source/system/EnvironmentVariablesConfigurationSource.java | EnvironmentVariablesConfigurationSource.convertToPropertiesKey | private static String convertToPropertiesKey(String environmentVariableKey, String environmentContext) {
return environmentVariableKey.substring(environmentContext.length()).replace(ENV_DELIMITER, PROPERTIES_DELIMITER);
} | java | private static String convertToPropertiesKey(String environmentVariableKey, String environmentContext) {
return environmentVariableKey.substring(environmentContext.length()).replace(ENV_DELIMITER, PROPERTIES_DELIMITER);
} | [
"private",
"static",
"String",
"convertToPropertiesKey",
"(",
"String",
"environmentVariableKey",
",",
"String",
"environmentContext",
")",
"{",
"return",
"environmentVariableKey",
".",
"substring",
"(",
"environmentContext",
".",
"length",
"(",
")",
")",
".",
"replac... | Convert the Environment Variable Name to the expected Properties Key formatting
@param environmentVariableKey The Env Variable Name, possibly prefixed with the {@link Environment} which
in this context serves as a way to namespace variables
@param environmentContext The Environment context in format: ENVIRONMENTNAME_
@return A {@link String} with the environment prefix removed and all underscores converted to periods | [
"Convert",
"the",
"Environment",
"Variable",
"Name",
"to",
"the",
"expected",
"Properties",
"Key",
"formatting"
] | train | https://github.com/cfg4j/cfg4j/blob/47d4f63e5fc820c62631e557adc34a29d8ab396d/cfg4j-core/src/main/java/org/cfg4j/source/system/EnvironmentVariablesConfigurationSource.java#L81-L83 |
h2oai/h2o-3 | h2o-core/src/main/java/water/util/FrameUtils.java | FrameUtils.parseFrame | public static Frame parseFrame(Key okey, File ...files) throws IOException {
if (files == null || files.length == 0) {
throw new IllegalArgumentException("List of files is empty!");
}
for (File f : files) {
if (!f.exists())
throw new FileNotFoundException("File not found " + f);
}
// Create output key if it is not given
if(okey == null) okey = Key.make(files[0].getName());
Key[] inKeys = new Key[files.length];
for (int i=0; i<files.length; i++) inKeys[i] = NFSFileVec.make(files[i])._key;
return ParseDataset.parse(okey, inKeys);
} | java | public static Frame parseFrame(Key okey, File ...files) throws IOException {
if (files == null || files.length == 0) {
throw new IllegalArgumentException("List of files is empty!");
}
for (File f : files) {
if (!f.exists())
throw new FileNotFoundException("File not found " + f);
}
// Create output key if it is not given
if(okey == null) okey = Key.make(files[0].getName());
Key[] inKeys = new Key[files.length];
for (int i=0; i<files.length; i++) inKeys[i] = NFSFileVec.make(files[i])._key;
return ParseDataset.parse(okey, inKeys);
} | [
"public",
"static",
"Frame",
"parseFrame",
"(",
"Key",
"okey",
",",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"if",
"(",
"files",
"==",
"null",
"||",
"files",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Parse given file(s) into the form of single frame represented by the given key.
@param okey destination key for parsed frame
@param files files to parse
@return a new frame | [
"Parse",
"given",
"file",
"(",
"s",
")",
"into",
"the",
"form",
"of",
"single",
"frame",
"represented",
"by",
"the",
"given",
"key",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/FrameUtils.java#L31-L44 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/Script.java | Script.getSigOpCount | public static int getSigOpCount(byte[] program) throws ScriptException {
Script script = new Script();
try {
script.parse(program);
} catch (ScriptException e) {
// Ignore errors and count up to the parse-able length
}
return getSigOpCount(script.chunks, false);
} | java | public static int getSigOpCount(byte[] program) throws ScriptException {
Script script = new Script();
try {
script.parse(program);
} catch (ScriptException e) {
// Ignore errors and count up to the parse-able length
}
return getSigOpCount(script.chunks, false);
} | [
"public",
"static",
"int",
"getSigOpCount",
"(",
"byte",
"[",
"]",
"program",
")",
"throws",
"ScriptException",
"{",
"Script",
"script",
"=",
"new",
"Script",
"(",
")",
";",
"try",
"{",
"script",
".",
"parse",
"(",
"program",
")",
";",
"}",
"catch",
"(... | Gets the count of regular SigOps in the script program (counting multisig ops as 20) | [
"Gets",
"the",
"count",
"of",
"regular",
"SigOps",
"in",
"the",
"script",
"program",
"(",
"counting",
"multisig",
"ops",
"as",
"20",
")"
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L560-L568 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.moduleList_id_GET | public OvhModuleList moduleList_id_GET(Long id) throws IOException {
String qPath = "/hosting/web/moduleList/{id}";
StringBuilder sb = path(qPath, id);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhModuleList.class);
} | java | public OvhModuleList moduleList_id_GET(Long id) throws IOException {
String qPath = "/hosting/web/moduleList/{id}";
StringBuilder sb = path(qPath, id);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhModuleList.class);
} | [
"public",
"OvhModuleList",
"moduleList_id_GET",
"(",
"Long",
"id",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/moduleList/{id}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"id",
")",
";",
"String",
"resp",
"=",
... | Get this object properties
REST: GET /hosting/web/moduleList/{id}
@param id [required] The ID of the module | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2322-L2327 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationBinary.java | EvaluationBinary.fBeta | public double fBeta(double beta, int outputNum) {
assertIndex(outputNum);
double precision = precision(outputNum);
double recall = recall(outputNum);
return EvaluationUtils.fBeta(beta, precision, recall);
} | java | public double fBeta(double beta, int outputNum) {
assertIndex(outputNum);
double precision = precision(outputNum);
double recall = recall(outputNum);
return EvaluationUtils.fBeta(beta, precision, recall);
} | [
"public",
"double",
"fBeta",
"(",
"double",
"beta",
",",
"int",
"outputNum",
")",
"{",
"assertIndex",
"(",
"outputNum",
")",
";",
"double",
"precision",
"=",
"precision",
"(",
"outputNum",
")",
";",
"double",
"recall",
"=",
"recall",
"(",
"outputNum",
")",... | Calculate the F-beta value for the given output
@param beta Beta value to use
@param outputNum Output number
@return F-beta for the given output | [
"Calculate",
"the",
"F",
"-",
"beta",
"value",
"for",
"the",
"given",
"output"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationBinary.java#L414-L419 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java | ListManagementImagesImpl.addImageUrlInputAsync | public Observable<Image> addImageUrlInputAsync(String listId, String contentType, BodyModelModel imageUrl, AddImageUrlInputOptionalParameter addImageUrlInputOptionalParameter) {
return addImageUrlInputWithServiceResponseAsync(listId, contentType, imageUrl, addImageUrlInputOptionalParameter).map(new Func1<ServiceResponse<Image>, Image>() {
@Override
public Image call(ServiceResponse<Image> response) {
return response.body();
}
});
} | java | public Observable<Image> addImageUrlInputAsync(String listId, String contentType, BodyModelModel imageUrl, AddImageUrlInputOptionalParameter addImageUrlInputOptionalParameter) {
return addImageUrlInputWithServiceResponseAsync(listId, contentType, imageUrl, addImageUrlInputOptionalParameter).map(new Func1<ServiceResponse<Image>, Image>() {
@Override
public Image call(ServiceResponse<Image> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Image",
">",
"addImageUrlInputAsync",
"(",
"String",
"listId",
",",
"String",
"contentType",
",",
"BodyModelModel",
"imageUrl",
",",
"AddImageUrlInputOptionalParameter",
"addImageUrlInputOptionalParameter",
")",
"{",
"return",
"addImageUrlInput... | Add an image to the list with list Id equal to list Id passed.
@param listId List Id of the image list.
@param contentType The content type.
@param imageUrl The image url.
@param addImageUrlInputOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Image object | [
"Add",
"an",
"image",
"to",
"the",
"list",
"with",
"list",
"Id",
"equal",
"to",
"list",
"Id",
"passed",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java#L534-L541 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/SignatureSpi.java | SignatureSpi.engineSign | protected int engineSign(byte[] outbuf, int offset, int len)
throws SignatureException {
byte[] sig = engineSign();
if (len < sig.length) {
throw new SignatureException
("partial signatures not returned");
}
if (outbuf.length - offset < sig.length) {
throw new SignatureException
("insufficient space in the output buffer to store the "
+ "signature");
}
System.arraycopy(sig, 0, outbuf, offset, sig.length);
return sig.length;
} | java | protected int engineSign(byte[] outbuf, int offset, int len)
throws SignatureException {
byte[] sig = engineSign();
if (len < sig.length) {
throw new SignatureException
("partial signatures not returned");
}
if (outbuf.length - offset < sig.length) {
throw new SignatureException
("insufficient space in the output buffer to store the "
+ "signature");
}
System.arraycopy(sig, 0, outbuf, offset, sig.length);
return sig.length;
} | [
"protected",
"int",
"engineSign",
"(",
"byte",
"[",
"]",
"outbuf",
",",
"int",
"offset",
",",
"int",
"len",
")",
"throws",
"SignatureException",
"{",
"byte",
"[",
"]",
"sig",
"=",
"engineSign",
"(",
")",
";",
"if",
"(",
"len",
"<",
"sig",
".",
"lengt... | Finishes this signature operation and stores the resulting signature
bytes in the provided buffer {@code outbuf}, starting at
{@code offset}.
The format of the signature depends on the underlying
signature scheme.
<p>The signature implementation is reset to its initial state
(the state it was in after a call to one of the
{@code engineInitSign} methods)
and can be reused to generate further signatures with the same private
key.
This method should be abstract, but we leave it concrete for
binary compatibility. Knowledgeable providers should override this
method.
@param outbuf buffer for the signature result.
@param offset offset into {@code outbuf} where the signature is
stored.
@param len number of bytes within {@code outbuf} allotted for the
signature.
Both this default implementation and the SUN provider do not
return partial digests. If the value of this parameter is less
than the actual signature length, this method will throw a
SignatureException.
This parameter is ignored if its value is greater than or equal to
the actual signature length.
@return the number of bytes placed into {@code outbuf}
@exception SignatureException if the engine is not
initialized properly, if this signature algorithm is unable to
process the input data provided, or if {@code len} is less
than the actual signature length.
@since 1.2 | [
"Finishes",
"this",
"signature",
"operation",
"and",
"stores",
"the",
"resulting",
"signature",
"bytes",
"in",
"the",
"provided",
"buffer",
"{",
"@code",
"outbuf",
"}",
"starting",
"at",
"{",
"@code",
"offset",
"}",
".",
"The",
"format",
"of",
"the",
"signat... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/SignatureSpi.java#L225-L239 |
square/dagger | core/src/main/java/dagger/internal/Linker.java | Linker.requestBinding | public Binding<?> requestBinding(String key, Object requiredBy, ClassLoader classLoader,
boolean mustHaveInjections, boolean library) {
assertLockHeld();
Binding<?> binding = null;
for (Linker linker = this; linker != null; linker = linker.base) {
binding = linker.bindings.get(key);
if (binding != null) {
if (linker != this && !binding.isLinked()) throw new AssertionError();
break;
}
}
if (binding == null) {
// We can't satisfy this binding. Make sure it'll work next time!
Binding<?> deferredBinding =
new DeferredBinding(key, classLoader, requiredBy, mustHaveInjections);
deferredBinding.setLibrary(library);
deferredBinding.setDependedOn(true);
toLink.add(deferredBinding);
attachSuccess = false;
return null;
}
if (!binding.isLinked()) {
toLink.add(binding); // This binding was never linked; link it now!
}
binding.setLibrary(library);
binding.setDependedOn(true);
return binding;
} | java | public Binding<?> requestBinding(String key, Object requiredBy, ClassLoader classLoader,
boolean mustHaveInjections, boolean library) {
assertLockHeld();
Binding<?> binding = null;
for (Linker linker = this; linker != null; linker = linker.base) {
binding = linker.bindings.get(key);
if (binding != null) {
if (linker != this && !binding.isLinked()) throw new AssertionError();
break;
}
}
if (binding == null) {
// We can't satisfy this binding. Make sure it'll work next time!
Binding<?> deferredBinding =
new DeferredBinding(key, classLoader, requiredBy, mustHaveInjections);
deferredBinding.setLibrary(library);
deferredBinding.setDependedOn(true);
toLink.add(deferredBinding);
attachSuccess = false;
return null;
}
if (!binding.isLinked()) {
toLink.add(binding); // This binding was never linked; link it now!
}
binding.setLibrary(library);
binding.setDependedOn(true);
return binding;
} | [
"public",
"Binding",
"<",
"?",
">",
"requestBinding",
"(",
"String",
"key",
",",
"Object",
"requiredBy",
",",
"ClassLoader",
"classLoader",
",",
"boolean",
"mustHaveInjections",
",",
"boolean",
"library",
")",
"{",
"assertLockHeld",
"(",
")",
";",
"Binding",
"... | Returns the binding if it exists immediately. Otherwise this returns
null. If the returned binding didn't exist or was unlinked, it will be
enqueued to be linked.
@param mustHaveInjections true if the the referenced key requires either an
{@code @Inject} annotation is produced by a {@code @Provides} method.
This isn't necessary for Module.injects types because frameworks need
to inject arbitrary classes like JUnit test cases and Android
activities. It also isn't necessary for supertypes. | [
"Returns",
"the",
"binding",
"if",
"it",
"exists",
"immediately",
".",
"Otherwise",
"this",
"returns",
"null",
".",
"If",
"the",
"returned",
"binding",
"didn",
"t",
"exist",
"or",
"was",
"unlinked",
"it",
"will",
"be",
"enqueued",
"to",
"be",
"linked",
"."... | train | https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/core/src/main/java/dagger/internal/Linker.java#L272-L303 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/process/support/RuntimeProcessExecutor.java | RuntimeProcessExecutor.doExecute | protected Process doExecute(String[] commandLine, File directory, Environment environment) throws IOException {
return Runtime.getRuntime().exec(commandLine, environment.toAssociativeArray(), directory);
} | java | protected Process doExecute(String[] commandLine, File directory, Environment environment) throws IOException {
return Runtime.getRuntime().exec(commandLine, environment.toAssociativeArray(), directory);
} | [
"protected",
"Process",
"doExecute",
"(",
"String",
"[",
"]",
"commandLine",
",",
"File",
"directory",
",",
"Environment",
"environment",
")",
"throws",
"IOException",
"{",
"return",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"exec",
"(",
"commandLine",
",",... | Executes the {@code commandLine} with the Java {@link Runtime} class in the given {@link File directory}
with the provided {@link Environment} configuration.
@param commandLine array of {@link String} values constituting the program and its runtime arguments.
@param directory {@link File directory} in which the program will run.
@param environment {@link Environment} configuration to set when the program runs.
@return a {@link Process} object representing the running program.
@throws IOException if the {@link Process} cannot be started.
@see java.lang.Runtime#exec(String, String[], File)
@see java.lang.Process | [
"Executes",
"the",
"{",
"@code",
"commandLine",
"}",
"with",
"the",
"Java",
"{",
"@link",
"Runtime",
"}",
"class",
"in",
"the",
"given",
"{",
"@link",
"File",
"directory",
"}",
"with",
"the",
"provided",
"{",
"@link",
"Environment",
"}",
"configuration",
"... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/process/support/RuntimeProcessExecutor.java#L123-L125 |
nemerosa/ontrack | ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/BranchController.java | BranchController.createTemplateInstance | @RequestMapping(value = "branches/{branchId}/template", method = RequestMethod.PUT)
public Branch createTemplateInstance(@PathVariable ID branchId, @RequestBody @Valid BranchTemplateInstanceSingleRequest request) {
return branchTemplateService.createTemplateInstance(branchId, request);
} | java | @RequestMapping(value = "branches/{branchId}/template", method = RequestMethod.PUT)
public Branch createTemplateInstance(@PathVariable ID branchId, @RequestBody @Valid BranchTemplateInstanceSingleRequest request) {
return branchTemplateService.createTemplateInstance(branchId, request);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"branches/{branchId}/template\"",
",",
"method",
"=",
"RequestMethod",
".",
"PUT",
")",
"public",
"Branch",
"createTemplateInstance",
"(",
"@",
"PathVariable",
"ID",
"branchId",
",",
"@",
"RequestBody",
"@",
"Valid",
"Br... | Creates a branch template instance for one name.
<p>
<ul>
<li>If the target branch does not exist, creates it.</li>
<li>If the target branch exists:
<ul>
<li>If it is linked to the same definition, updates it.</li>
<li>If it is linked to another definition, this is an error.</li>
<li>If it is a normal branch, this is an error.</li>
</ul>
</li>
</ul>
@param branchId ID of the branch template definition
@param request Name to use when creating the branch
@return Created or updated branch | [
"Creates",
"a",
"branch",
"template",
"instance",
"for",
"one",
"name",
".",
"<p",
">",
"<ul",
">",
"<li",
">",
"If",
"the",
"target",
"branch",
"does",
"not",
"exist",
"creates",
"it",
".",
"<",
"/",
"li",
">",
"<li",
">",
"If",
"the",
"target",
"... | train | https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/BranchController.java#L407-L410 |
grpc/grpc-java | netty/src/main/java/io/grpc/netty/NettyClientHandler.java | NettyClientHandler.sendPingFrame | private void sendPingFrame(ChannelHandlerContext ctx, SendPingCommand msg,
ChannelPromise promise) {
// Don't check lifecycleManager.getShutdownStatus() since we want to allow pings after shutdown
// but before termination. After termination, messages will no longer arrive because the
// pipeline clears all handlers on channel close.
PingCallback callback = msg.callback();
Executor executor = msg.executor();
// we only allow one outstanding ping at a time, so just add the callback to
// any outstanding operation
if (ping != null) {
promise.setSuccess();
ping.addCallback(callback, executor);
return;
}
// Use a new promise to prevent calling the callback twice on write failure: here and in
// NettyClientTransport.ping(). It may appear strange, but it will behave the same as if
// ping != null above.
promise.setSuccess();
promise = ctx().newPromise();
// set outstanding operation
long data = USER_PING_PAYLOAD;
Stopwatch stopwatch = stopwatchFactory.get();
stopwatch.start();
ping = new Http2Ping(data, stopwatch);
ping.addCallback(callback, executor);
// and then write the ping
encoder().writePing(ctx, false, USER_PING_PAYLOAD, promise);
ctx.flush();
final Http2Ping finalPing = ping;
promise.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
transportTracer.reportKeepAliveSent();
} else {
Throwable cause = future.cause();
if (cause instanceof ClosedChannelException) {
cause = lifecycleManager.getShutdownThrowable();
if (cause == null) {
cause = Status.UNKNOWN.withDescription("Ping failed but for unknown reason.")
.withCause(future.cause()).asException();
}
}
finalPing.failed(cause);
if (ping == finalPing) {
ping = null;
}
}
}
});
} | java | private void sendPingFrame(ChannelHandlerContext ctx, SendPingCommand msg,
ChannelPromise promise) {
// Don't check lifecycleManager.getShutdownStatus() since we want to allow pings after shutdown
// but before termination. After termination, messages will no longer arrive because the
// pipeline clears all handlers on channel close.
PingCallback callback = msg.callback();
Executor executor = msg.executor();
// we only allow one outstanding ping at a time, so just add the callback to
// any outstanding operation
if (ping != null) {
promise.setSuccess();
ping.addCallback(callback, executor);
return;
}
// Use a new promise to prevent calling the callback twice on write failure: here and in
// NettyClientTransport.ping(). It may appear strange, but it will behave the same as if
// ping != null above.
promise.setSuccess();
promise = ctx().newPromise();
// set outstanding operation
long data = USER_PING_PAYLOAD;
Stopwatch stopwatch = stopwatchFactory.get();
stopwatch.start();
ping = new Http2Ping(data, stopwatch);
ping.addCallback(callback, executor);
// and then write the ping
encoder().writePing(ctx, false, USER_PING_PAYLOAD, promise);
ctx.flush();
final Http2Ping finalPing = ping;
promise.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if (future.isSuccess()) {
transportTracer.reportKeepAliveSent();
} else {
Throwable cause = future.cause();
if (cause instanceof ClosedChannelException) {
cause = lifecycleManager.getShutdownThrowable();
if (cause == null) {
cause = Status.UNKNOWN.withDescription("Ping failed but for unknown reason.")
.withCause(future.cause()).asException();
}
}
finalPing.failed(cause);
if (ping == finalPing) {
ping = null;
}
}
}
});
} | [
"private",
"void",
"sendPingFrame",
"(",
"ChannelHandlerContext",
"ctx",
",",
"SendPingCommand",
"msg",
",",
"ChannelPromise",
"promise",
")",
"{",
"// Don't check lifecycleManager.getShutdownStatus() since we want to allow pings after shutdown",
"// but before termination. After termi... | Sends a PING frame. If a ping operation is already outstanding, the callback in the message is
registered to be called when the existing operation completes, and no new frame is sent. | [
"Sends",
"a",
"PING",
"frame",
".",
"If",
"a",
"ping",
"operation",
"is",
"already",
"outstanding",
"the",
"callback",
"in",
"the",
"message",
"is",
"registered",
"to",
"be",
"called",
"when",
"the",
"existing",
"operation",
"completes",
"and",
"no",
"new",
... | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyClientHandler.java#L623-L675 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.createPublishJob | public void createPublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsException {
getProjectDriver(dbc).createPublishJob(dbc, publishJob);
} | java | public void createPublishJob(CmsDbContext dbc, CmsPublishJobInfoBean publishJob) throws CmsException {
getProjectDriver(dbc).createPublishJob(dbc, publishJob);
} | [
"public",
"void",
"createPublishJob",
"(",
"CmsDbContext",
"dbc",
",",
"CmsPublishJobInfoBean",
"publishJob",
")",
"throws",
"CmsException",
"{",
"getProjectDriver",
"(",
"dbc",
")",
".",
"createPublishJob",
"(",
"dbc",
",",
"publishJob",
")",
";",
"}"
] | Creates a new publish job.<p>
@param dbc the current database context
@param publishJob the publish job to create
@throws CmsException if something goes wrong | [
"Creates",
"a",
"new",
"publish",
"job",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L1588-L1591 |
JodaOrg/joda-money | src/main/java/org/joda/money/BigMoney.java | BigMoney.multiplyRetainScale | public BigMoney multiplyRetainScale(double valueToMultiplyBy, RoundingMode roundingMode) {
return multiplyRetainScale(BigDecimal.valueOf(valueToMultiplyBy), roundingMode);
} | java | public BigMoney multiplyRetainScale(double valueToMultiplyBy, RoundingMode roundingMode) {
return multiplyRetainScale(BigDecimal.valueOf(valueToMultiplyBy), roundingMode);
} | [
"public",
"BigMoney",
"multiplyRetainScale",
"(",
"double",
"valueToMultiplyBy",
",",
"RoundingMode",
"roundingMode",
")",
"{",
"return",
"multiplyRetainScale",
"(",
"BigDecimal",
".",
"valueOf",
"(",
"valueToMultiplyBy",
")",
",",
"roundingMode",
")",
";",
"}"
] | Returns a copy of this monetary value multiplied by the specified value
using the specified rounding mode to adjust the scale of the result.
<p>
This multiplies this money by the specified value, retaining the scale of this money.
This will frequently lose precision, hence the need for a rounding mode.
For example, 'USD 1.13' multiplied by '2.5' and rounding down gives 'USD 2.82'.
<p>
The amount is converted via {@link BigDecimal#valueOf(double)} which yields
the most expected answer for most programming scenarios.
Any {@code double} literal in code will be converted to
exactly the same BigDecimal with the same scale.
For example, the literal '1.45d' will be converted to '1.45'.
<p>
This instance is immutable and unaffected by this method.
@param valueToMultiplyBy the scalar value to multiply by, not null
@param roundingMode the rounding mode to use to bring the decimal places back in line, not null
@return the new multiplied instance, never null
@throws ArithmeticException if the rounding fails | [
"Returns",
"a",
"copy",
"of",
"this",
"monetary",
"value",
"multiplied",
"by",
"the",
"specified",
"value",
"using",
"the",
"specified",
"rounding",
"mode",
"to",
"adjust",
"the",
"scale",
"of",
"the",
"result",
".",
"<p",
">",
"This",
"multiplies",
"this",
... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/BigMoney.java#L1351-L1353 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java | DefaultElementProducer.loadTiff | @Override
public void loadTiff(URL tiff, ImageProcessor imageProcessor, int... pages) throws VectorPrintException {
try {
if (log.isLoggable(Level.FINE)) {
log.fine(String.format("loading tiff from %s", String.valueOf(tiff)));
}
if ("file".equals(tiff.getProtocol())) {
loadTiff(new File(tiff.getFile()), imageProcessor, pages);
} else {
loadTiff(tiff.openStream(), imageProcessor, pages);
}
} catch (IOException ex) {
throw new VectorPrintException(String.format("unable to load image %s", tiff.toString()), ex);
}
} | java | @Override
public void loadTiff(URL tiff, ImageProcessor imageProcessor, int... pages) throws VectorPrintException {
try {
if (log.isLoggable(Level.FINE)) {
log.fine(String.format("loading tiff from %s", String.valueOf(tiff)));
}
if ("file".equals(tiff.getProtocol())) {
loadTiff(new File(tiff.getFile()), imageProcessor, pages);
} else {
loadTiff(tiff.openStream(), imageProcessor, pages);
}
} catch (IOException ex) {
throw new VectorPrintException(String.format("unable to load image %s", tiff.toString()), ex);
}
} | [
"@",
"Override",
"public",
"void",
"loadTiff",
"(",
"URL",
"tiff",
",",
"ImageProcessor",
"imageProcessor",
",",
"int",
"...",
"pages",
")",
"throws",
"VectorPrintException",
"{",
"try",
"{",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
... | Calls {@link loadTiff(InputStream, ImageProcessor, int... ) }
@param tiff
@param imageProcessor
@param pages
@throws VectorPrintException | [
"Calls",
"{",
"@link",
"loadTiff",
"(",
"InputStream",
"ImageProcessor",
"int",
"...",
")",
"}"
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L715-L729 |
spring-cloud/spring-cloud-aws | spring-cloud-aws-context/src/main/java/org/springframework/cloud/aws/cache/memcached/SimpleSpringMemcached.java | SimpleSpringMemcached.putIfAbsent | @Override
public ValueWrapper putIfAbsent(Object key, Object value) {
Assert.notNull(key, "key parameter is mandatory");
Assert.isAssignable(String.class, key.getClass());
ValueWrapper valueWrapper = get(key);
if (valueWrapper == null) {
try {
this.memcachedClientIF.add((String) key, this.expiration, value).get();
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
catch (ExecutionException e) {
throw new IllegalArgumentException("Error writing key" + key, e);
}
return null;
}
else {
return valueWrapper;
}
} | java | @Override
public ValueWrapper putIfAbsent(Object key, Object value) {
Assert.notNull(key, "key parameter is mandatory");
Assert.isAssignable(String.class, key.getClass());
ValueWrapper valueWrapper = get(key);
if (valueWrapper == null) {
try {
this.memcachedClientIF.add((String) key, this.expiration, value).get();
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
catch (ExecutionException e) {
throw new IllegalArgumentException("Error writing key" + key, e);
}
return null;
}
else {
return valueWrapper;
}
} | [
"@",
"Override",
"public",
"ValueWrapper",
"putIfAbsent",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"Assert",
".",
"notNull",
"(",
"key",
",",
"\"key parameter is mandatory\"",
")",
";",
"Assert",
".",
"isAssignable",
"(",
"String",
".",
"class",... | <b>IMPORTANT:</b> This operation is not atomic as the underlying implementation
(memcached) does not provide a way to do it. | [
"<b",
">",
"IMPORTANT",
":",
"<",
"/",
"b",
">",
"This",
"operation",
"is",
"not",
"atomic",
"as",
"the",
"underlying",
"implementation",
"(",
"memcached",
")",
"does",
"not",
"provide",
"a",
"way",
"to",
"do",
"it",
"."
] | train | https://github.com/spring-cloud/spring-cloud-aws/blob/26f7ca6c29ac66922f64b37c2bc5ce6f842462ee/spring-cloud-aws-context/src/main/java/org/springframework/cloud/aws/cache/memcached/SimpleSpringMemcached.java#L115-L136 |
podio/podio-java | src/main/java/com/podio/file/FileAPI.java | FileAPI.downloadFile | public void downloadFile(int fileId, java.io.File target, FileSize size)
throws IOException {
WebResource builder = getResourceFactory()
.getFileResource("/" + fileId);
if (size != null) {
builder = builder.path("/" + size.name().toLowerCase());
}
byte[] data = builder.get(byte[].class);
FileUtils.writeByteArrayToFile(target, data);
} | java | public void downloadFile(int fileId, java.io.File target, FileSize size)
throws IOException {
WebResource builder = getResourceFactory()
.getFileResource("/" + fileId);
if (size != null) {
builder = builder.path("/" + size.name().toLowerCase());
}
byte[] data = builder.get(byte[].class);
FileUtils.writeByteArrayToFile(target, data);
} | [
"public",
"void",
"downloadFile",
"(",
"int",
"fileId",
",",
"java",
".",
"io",
".",
"File",
"target",
",",
"FileSize",
"size",
")",
"throws",
"IOException",
"{",
"WebResource",
"builder",
"=",
"getResourceFactory",
"(",
")",
".",
"getFileResource",
"(",
"\"... | Downloads the file and saves it to given file
@param fileId
The id of the file to download
@param target
The target file to save the contents to
@throws IOException
If there was an error reading or writing the file | [
"Downloads",
"the",
"file",
"and",
"saves",
"it",
"to",
"given",
"file"
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/file/FileAPI.java#L40-L49 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java | Util.getBooleanProperty | public static Boolean getBooleanProperty(Map<String, Object> properties, String key, boolean defaultVal) {
if (properties == null) {
return defaultVal;
}
Object propertyVal = properties.get(key);
if (propertyVal == null) {
return defaultVal;
}
if (!(propertyVal instanceof Boolean)) {
throw new IllegalArgumentException("Property : " + key + " must be a boolean");
}
return (Boolean) propertyVal;
} | java | public static Boolean getBooleanProperty(Map<String, Object> properties, String key, boolean defaultVal) {
if (properties == null) {
return defaultVal;
}
Object propertyVal = properties.get(key);
if (propertyVal == null) {
return defaultVal;
}
if (!(propertyVal instanceof Boolean)) {
throw new IllegalArgumentException("Property : " + key + " must be a boolean");
}
return (Boolean) propertyVal;
} | [
"public",
"static",
"Boolean",
"getBooleanProperty",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"String",
"key",
",",
"boolean",
"defaultVal",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"{",
"return",
"defaultVal",
";",
"}... | Get boolean 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",
"boolean",
"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#L467-L484 |
UrielCh/ovh-java-sdk | ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java | ApiOvhConnectivity.eligibility_search_meetings_POST | public OvhAsyncTask<OvhMeetings> eligibility_search_meetings_POST(String eligibilityReference, String productCode) throws IOException {
String qPath = "/connectivity/eligibility/search/meetings";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "eligibilityReference", eligibilityReference);
addBody(o, "productCode", productCode);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, t6);
} | java | public OvhAsyncTask<OvhMeetings> eligibility_search_meetings_POST(String eligibilityReference, String productCode) throws IOException {
String qPath = "/connectivity/eligibility/search/meetings";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "eligibilityReference", eligibilityReference);
addBody(o, "productCode", productCode);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, t6);
} | [
"public",
"OvhAsyncTask",
"<",
"OvhMeetings",
">",
"eligibility_search_meetings_POST",
"(",
"String",
"eligibilityReference",
",",
"String",
"productCode",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/connectivity/eligibility/search/meetings\"",
";",
"Stri... | Search for available line creation meeting time slots, for copper only
REST: POST /connectivity/eligibility/search/meetings
@param productCode [required] Choosen offer product code
@param eligibilityReference [required] Eligibility test reference | [
"Search",
"for",
"available",
"line",
"creation",
"meeting",
"time",
"slots",
"for",
"copper",
"only"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java#L121-L129 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java | MutateInBuilder.arrayAppendAll | public <T> MutateInBuilder arrayAppendAll(String path, T... values) {
asyncBuilder.arrayAppendAll(path, values);
return this;
} | java | public <T> MutateInBuilder arrayAppendAll(String path, T... values) {
asyncBuilder.arrayAppendAll(path, values);
return this;
} | [
"public",
"<",
"T",
">",
"MutateInBuilder",
"arrayAppendAll",
"(",
"String",
"path",
",",
"T",
"...",
"values",
")",
"{",
"asyncBuilder",
".",
"arrayAppendAll",
"(",
"path",
",",
"values",
")",
";",
"return",
"this",
";",
"}"
] | Append multiple values at once in an existing array, pushing all values to the back/end of the array.
This is provided as a convenience alternative to {@link #arrayAppendAll(String, Collection, boolean)}.
Note that parent nodes are not created when using this method (ie. createPath = false).
Each item in the collection is inserted as an individual element of the array, but a bit of overhead
is saved compared to individual {@link #arrayAppend(String, Object, boolean)} by grouping mutations in
a single packet.
For example given an array [ A, B, C ], appending the values X and Y yields [ A, B, C, X, Y ]
and not [ A, B, C, [ X, Y ] ].
@param path the path of the array.
@param values the values to individually insert at the back of the array.
@param <T> the type of data in the collection (must be JSON serializable).
@see #arrayAppendAll(String, Collection, boolean) if you need to create missing intermediary nodes. | [
"Append",
"multiple",
"values",
"at",
"once",
"in",
"an",
"existing",
"array",
"pushing",
"all",
"values",
"to",
"the",
"back",
"/",
"end",
"of",
"the",
"array",
".",
"This",
"is",
"provided",
"as",
"a",
"convenience",
"alternative",
"to",
"{",
"@link",
... | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java#L899-L902 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java | CertificateOperations.createCertificate | public void createCertificate(CertificateAddParameter certificate, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateAddOptions options = new CertificateAddOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().certificates().add(certificate, options);
} | java | public void createCertificate(CertificateAddParameter certificate, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
CertificateAddOptions options = new CertificateAddOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().certificates().add(certificate, options);
} | [
"public",
"void",
"createCertificate",
"(",
"CertificateAddParameter",
"certificate",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"CertificateAddOptions",
"options",
"=",
"new",
"C... | Adds a certificate to the Batch account.
@param certificate The certificate to be added.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Adds",
"a",
"certificate",
"to",
"the",
"Batch",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/CertificateOperations.java#L147-L153 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/image/VisualizeImageData.java | VisualizeImageData.colorizeSign | public static BufferedImage colorizeSign(ImageGray src, BufferedImage dst, double normalize) {
dst = checkInputs(src, dst);
if (normalize <= 0) {
normalize = GImageStatistics.maxAbs(src);
}
if (normalize == 0) {
// sets the output to black
ConvertBufferedImage.convertTo(src,dst,true);
return dst;
}
if (src.getClass().isAssignableFrom(GrayF32.class)) {
return colorizeSign((GrayF32) src, dst, (float) normalize);
} else {
return colorizeSign((GrayI) src, dst, (int) normalize);
}
} | java | public static BufferedImage colorizeSign(ImageGray src, BufferedImage dst, double normalize) {
dst = checkInputs(src, dst);
if (normalize <= 0) {
normalize = GImageStatistics.maxAbs(src);
}
if (normalize == 0) {
// sets the output to black
ConvertBufferedImage.convertTo(src,dst,true);
return dst;
}
if (src.getClass().isAssignableFrom(GrayF32.class)) {
return colorizeSign((GrayF32) src, dst, (float) normalize);
} else {
return colorizeSign((GrayI) src, dst, (int) normalize);
}
} | [
"public",
"static",
"BufferedImage",
"colorizeSign",
"(",
"ImageGray",
"src",
",",
"BufferedImage",
"dst",
",",
"double",
"normalize",
")",
"{",
"dst",
"=",
"checkInputs",
"(",
"src",
",",
"dst",
")",
";",
"if",
"(",
"normalize",
"<=",
"0",
")",
"{",
"no... | <p>
Renders a colored image where the color indicates the sign and intensity its magnitude. The input is divided
by normalize to render it in the appropriate scale.
</p>
@param src Input single band image.
@param dst Where the image is rendered into. If null a new BufferedImage will be created and return.
@param normalize Used to normalize the input image. If ≤ 0 then the max value will be used
@return Rendered image. | [
"<p",
">",
"Renders",
"a",
"colored",
"image",
"where",
"the",
"color",
"indicates",
"the",
"sign",
"and",
"intensity",
"its",
"magnitude",
".",
"The",
"input",
"is",
"divided",
"by",
"normalize",
"to",
"render",
"it",
"in",
"the",
"appropriate",
"scale",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/image/VisualizeImageData.java#L88-L106 |
GoogleCloudPlatform/appengine-mapreduce | java/src/main/java/com/google/appengine/tools/mapreduce/impl/BigQueryDataMarshallerByType.java | BigQueryDataMarshallerByType.assertFieldValue | private void assertFieldValue(Field field, Object fieldValue) {
if (fieldValue == null && isFieldRequired(field)) {
throw new IllegalArgumentException("Non-nullable field " + field.getName()
+ ". This field is either annotated as REQUIRED or is a primitive type.");
}
} | java | private void assertFieldValue(Field field, Object fieldValue) {
if (fieldValue == null && isFieldRequired(field)) {
throw new IllegalArgumentException("Non-nullable field " + field.getName()
+ ". This field is either annotated as REQUIRED or is a primitive type.");
}
} | [
"private",
"void",
"assertFieldValue",
"(",
"Field",
"field",
",",
"Object",
"fieldValue",
")",
"{",
"if",
"(",
"fieldValue",
"==",
"null",
"&&",
"isFieldRequired",
"(",
"field",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Non-nullable fie... | Asserts that a field annotated as {@link BigQueryFieldMode#REPEATED} is not left null. | [
"Asserts",
"that",
"a",
"field",
"annotated",
"as",
"{"
] | train | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/impl/BigQueryDataMarshallerByType.java#L84-L89 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/database/CursorUtils.java | CursorUtils.getType | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static int getType(Cursor cursor, String columnName) {
if (cursor == null) {
return Cursor.FIELD_TYPE_NULL;
}
return cursor.getType(cursor.getColumnIndex(columnName));
} | java | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static int getType(Cursor cursor, String columnName) {
if (cursor == null) {
return Cursor.FIELD_TYPE_NULL;
}
return cursor.getType(cursor.getColumnIndex(columnName));
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB",
")",
"public",
"static",
"int",
"getType",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"Cursor",
".",
"FIEL... | Checks the type of the column.
@see android.database.Cursor#getType(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the type of the column. | [
"Checks",
"the",
"type",
"of",
"the",
"column",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L176-L183 |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/Vertigo.java | Vertigo.deployNetwork | public Vertigo deployNetwork(String cluster, final String name, final Handler<AsyncResult<ActiveNetwork>> doneHandler) {
getCluster(cluster, new Handler<AsyncResult<Cluster>>() {
@Override
public void handle(AsyncResult<Cluster> result) {
if (result.failed()) {
new DefaultFutureResult<ActiveNetwork>(result.cause()).setHandler(doneHandler);
} else {
result.result().deployNetwork(name, doneHandler);
}
}
});
return this;
} | java | public Vertigo deployNetwork(String cluster, final String name, final Handler<AsyncResult<ActiveNetwork>> doneHandler) {
getCluster(cluster, new Handler<AsyncResult<Cluster>>() {
@Override
public void handle(AsyncResult<Cluster> result) {
if (result.failed()) {
new DefaultFutureResult<ActiveNetwork>(result.cause()).setHandler(doneHandler);
} else {
result.result().deployNetwork(name, doneHandler);
}
}
});
return this;
} | [
"public",
"Vertigo",
"deployNetwork",
"(",
"String",
"cluster",
",",
"final",
"String",
"name",
",",
"final",
"Handler",
"<",
"AsyncResult",
"<",
"ActiveNetwork",
">",
">",
"doneHandler",
")",
"{",
"getCluster",
"(",
"cluster",
",",
"new",
"Handler",
"<",
"A... | Deploys a bare network to a specific cluster.<p>
The network will be deployed with no components and no connections. You
can add components and connections to the network with an {@link ActiveNetwork}
instance.
@param cluster The cluster to which to deploy the network.
@param name The name of the network to deploy.
@param doneHandler An asynchronous handler to be called once the network has
completed deployment. The handler will be called with an {@link ActiveNetwork}
instance which can be used to add or remove components and connections from
the network.
@return The Vertigo instance. | [
"Deploys",
"a",
"bare",
"network",
"to",
"a",
"specific",
"cluster",
".",
"<p",
">"
] | train | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/Vertigo.java#L474-L486 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java | DocumentSubscriptions.getSubscriptionWorker | public <T> SubscriptionWorker<T> getSubscriptionWorker(Class<T> clazz, String subscriptionName, String database) {
return getSubscriptionWorker(clazz, new SubscriptionWorkerOptions(subscriptionName), database);
} | java | public <T> SubscriptionWorker<T> getSubscriptionWorker(Class<T> clazz, String subscriptionName, String database) {
return getSubscriptionWorker(clazz, new SubscriptionWorkerOptions(subscriptionName), database);
} | [
"public",
"<",
"T",
">",
"SubscriptionWorker",
"<",
"T",
">",
"getSubscriptionWorker",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"subscriptionName",
",",
"String",
"database",
")",
"{",
"return",
"getSubscriptionWorker",
"(",
"clazz",
",",
"new",
... | It opens a subscription and starts pulling documents since a last processed document for that subscription.
The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client
needs to acknowledge that batch has been processed. The acknowledgment is sent after all documents are processed by subscription's handlers.
There can be only a single client that is connected to a subscription.
@param clazz Entity class
@param subscriptionName The name of subscription
@param database Target database
@param <T> Entity class
@return Subscription object that allows to add/remove subscription handlers. | [
"It",
"opens",
"a",
"subscription",
"and",
"starts",
"pulling",
"documents",
"since",
"a",
"last",
"processed",
"document",
"for",
"that",
"subscription",
".",
"The",
"connection",
"options",
"determine",
"client",
"and",
"server",
"cooperation",
"rules",
"like",
... | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L266-L268 |
rythmengine/rythmengine | src/main/java/org/rythmengine/template/TemplateBase.java | TemplateBase.__invokeTag | protected void __invokeTag(int line, String name, ITag.__ParameterList params) {
__engine.invokeTemplate(line, name, this, params, null, null);
} | java | protected void __invokeTag(int line, String name, ITag.__ParameterList params) {
__engine.invokeTemplate(line, name, this, params, null, null);
} | [
"protected",
"void",
"__invokeTag",
"(",
"int",
"line",
",",
"String",
"name",
",",
"ITag",
".",
"__ParameterList",
"params",
")",
"{",
"__engine",
".",
"invokeTemplate",
"(",
"line",
",",
"name",
",",
"this",
",",
"params",
",",
"null",
",",
"null",
")"... | Invoke a tag. Usually should not used directly in user template
@param line
@param name
@param params | [
"Invoke",
"a",
"tag",
".",
"Usually",
"should",
"not",
"used",
"directly",
"in",
"user",
"template"
] | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/template/TemplateBase.java#L177-L179 |
cketti/ckChangeLog | ckChangeLog/src/main/java/de/cketti/library/changelog/ChangeLog.java | ChangeLog.getChangeLogComparator | protected Comparator<ReleaseItem> getChangeLogComparator() {
return new Comparator<ReleaseItem>() {
@Override
public int compare(ReleaseItem lhs, ReleaseItem rhs) {
if (lhs.versionCode < rhs.versionCode) {
return 1;
} else if (lhs.versionCode > rhs.versionCode) {
return -1;
} else {
return 0;
}
}
};
} | java | protected Comparator<ReleaseItem> getChangeLogComparator() {
return new Comparator<ReleaseItem>() {
@Override
public int compare(ReleaseItem lhs, ReleaseItem rhs) {
if (lhs.versionCode < rhs.versionCode) {
return 1;
} else if (lhs.versionCode > rhs.versionCode) {
return -1;
} else {
return 0;
}
}
};
} | [
"protected",
"Comparator",
"<",
"ReleaseItem",
">",
"getChangeLogComparator",
"(",
")",
"{",
"return",
"new",
"Comparator",
"<",
"ReleaseItem",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"ReleaseItem",
"lhs",
",",
"ReleaseItem",
"rhs... | Returns a {@link Comparator} that specifies the sort order of the {@link ReleaseItem}s.
<p>
The default implementation returns the items in reverse order (latest version first).
</p> | [
"Returns",
"a",
"{",
"@link",
"Comparator",
"}",
"that",
"specifies",
"the",
"sort",
"order",
"of",
"the",
"{",
"@link",
"ReleaseItem",
"}",
"s",
"."
] | train | https://github.com/cketti/ckChangeLog/blob/e9a81ad3e043357e80922aa7c149241af73223d3/ckChangeLog/src/main/java/de/cketti/library/changelog/ChangeLog.java#L560-L573 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Project.java | Project.addRepository | public void addRepository(Repository repo) throws GreenPepperServerException
{
if (findRepositoryByName(repo.getName()) != null)
{
throw new GreenPepperServerException( GreenPepperServerErrorKey.REPOSITORY_ALREADY_EXISTS, "Repository already exists");
}
repo.setProject(this);
repositories.add(repo);
} | java | public void addRepository(Repository repo) throws GreenPepperServerException
{
if (findRepositoryByName(repo.getName()) != null)
{
throw new GreenPepperServerException( GreenPepperServerErrorKey.REPOSITORY_ALREADY_EXISTS, "Repository already exists");
}
repo.setProject(this);
repositories.add(repo);
} | [
"public",
"void",
"addRepository",
"(",
"Repository",
"repo",
")",
"throws",
"GreenPepperServerException",
"{",
"if",
"(",
"findRepositoryByName",
"(",
"repo",
".",
"getName",
"(",
")",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"GreenPepperServerException",
"... | <p>addRepository.</p>
@param repo a {@link com.greenpepper.server.domain.Repository} object.
@throws com.greenpepper.server.GreenPepperServerException if any. | [
"<p",
">",
"addRepository",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Project.java#L121-L130 |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTA/JTAResourceBase.java | JTAResourceBase.processXAException | protected void processXAException(String operation, XAException xae)
{
if (tc.isEventEnabled())
{
Tr.event(tc, "XAResource {0} threw an XAException during {1}. The error code provided was {2}.", new Object[] {
_resource,
operation,
XAReturnCodeHelper.convertXACode(xae.errorCode) } );
}
FFDCFilter.processException(
xae,
this.getClass().getName() + "." + operation,
"307",
this);
if (tc.isDebugEnabled())
{
Tr.debug(tc, "Exception", xae);
Tr.debug(tc, "XID", _xid);
}
} | java | protected void processXAException(String operation, XAException xae)
{
if (tc.isEventEnabled())
{
Tr.event(tc, "XAResource {0} threw an XAException during {1}. The error code provided was {2}.", new Object[] {
_resource,
operation,
XAReturnCodeHelper.convertXACode(xae.errorCode) } );
}
FFDCFilter.processException(
xae,
this.getClass().getName() + "." + operation,
"307",
this);
if (tc.isDebugEnabled())
{
Tr.debug(tc, "Exception", xae);
Tr.debug(tc, "XID", _xid);
}
} | [
"protected",
"void",
"processXAException",
"(",
"String",
"operation",
",",
"XAException",
"xae",
")",
"{",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"XAResource {0} threw an XAException during {1}. The erro... | Trace information about an XAException that was thrown by an
<code>XAResource</code>. This method will not rethrow the exception
but will simply trace it.
@param operation the method name that caught the exception
@param xae the <code>XAException</code> that was thrown | [
"Trace",
"information",
"about",
"an",
"XAException",
"that",
"was",
"thrown",
"by",
"an",
"<code",
">",
"XAResource<",
"/",
"code",
">",
".",
"This",
"method",
"will",
"not",
"rethrow",
"the",
"exception",
"but",
"will",
"simply",
"trace",
"it",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/ws/Transaction/JTA/JTAResourceBase.java#L309-L330 |
threerings/nenya | core/src/main/java/com/threerings/resource/FileResourceBundle.java | FileResourceBundle.setCacheDir | public static void setCacheDir (File tmpdir)
{
String rando = Long.toHexString((long)(Math.random() * Long.MAX_VALUE));
_tmpdir = new File(tmpdir, "narcache_" + rando);
if (!_tmpdir.exists()) {
if (_tmpdir.mkdirs()) {
log.debug("Created narya temp cache directory '" + _tmpdir + "'.");
} else {
log.warning("Failed to create temp cache directory '" + _tmpdir + "'.");
}
}
// add a hook to blow away the temp directory when we exit
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run () {
log.info("Clearing narya temp cache '" + _tmpdir + "'.");
FileUtil.recursiveDelete(_tmpdir);
}
});
} | java | public static void setCacheDir (File tmpdir)
{
String rando = Long.toHexString((long)(Math.random() * Long.MAX_VALUE));
_tmpdir = new File(tmpdir, "narcache_" + rando);
if (!_tmpdir.exists()) {
if (_tmpdir.mkdirs()) {
log.debug("Created narya temp cache directory '" + _tmpdir + "'.");
} else {
log.warning("Failed to create temp cache directory '" + _tmpdir + "'.");
}
}
// add a hook to blow away the temp directory when we exit
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run () {
log.info("Clearing narya temp cache '" + _tmpdir + "'.");
FileUtil.recursiveDelete(_tmpdir);
}
});
} | [
"public",
"static",
"void",
"setCacheDir",
"(",
"File",
"tmpdir",
")",
"{",
"String",
"rando",
"=",
"Long",
".",
"toHexString",
"(",
"(",
"long",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"Long",
".",
"MAX_VALUE",
")",
")",
";",
"_tmpdir",
"=",... | Specifies the directory in which our temporary resource files should be stored. | [
"Specifies",
"the",
"directory",
"in",
"which",
"our",
"temporary",
"resource",
"files",
"should",
"be",
"stored",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/FileResourceBundle.java#L353-L373 |
aerospike/aerospike-helper | java/src/main/java/com/aerospike/helper/Utils.java | Utils.printInfo | public static void printInfo(String title, String infoString) {
if (infoString == null) {
System.out.println("Null info string");
return;
}
String[] outerParts = infoString.split(";");
System.out.println(title);
for (String s : outerParts) {
String[] innerParts = s.split(":");
for (String parts : innerParts) {
System.out.println("\t" + parts);
}
System.out.println();
}
} | java | public static void printInfo(String title, String infoString) {
if (infoString == null) {
System.out.println("Null info string");
return;
}
String[] outerParts = infoString.split(";");
System.out.println(title);
for (String s : outerParts) {
String[] innerParts = s.split(":");
for (String parts : innerParts) {
System.out.println("\t" + parts);
}
System.out.println();
}
} | [
"public",
"static",
"void",
"printInfo",
"(",
"String",
"title",
",",
"String",
"infoString",
")",
"{",
"if",
"(",
"infoString",
"==",
"null",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Null info string\"",
")",
";",
"return",
";",
"}",
"Str... | Prints an "Info" message with a title to System.out
@param title Title to be printed
@param infoString Info string from cluster | [
"Prints",
"an",
"Info",
"message",
"with",
"a",
"title",
"to",
"System",
".",
"out"
] | train | https://github.com/aerospike/aerospike-helper/blob/eeb4a1464bc8d9c6716c014d250c8166b5caa82d/java/src/main/java/com/aerospike/helper/Utils.java#L36-L51 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/VMPlacementUtils.java | VMPlacementUtils.canStay | public static boolean canStay(ReconfigurationProblem rp, VM vm) {
Mapping m = rp.getSourceModel().getMapping();
if (m.isRunning(vm)) {
int curPos = rp.getNode(m.getVMLocation(vm));
return rp.getVMAction(vm).getDSlice().getHoster().contains(curPos);
}
return false;
} | java | public static boolean canStay(ReconfigurationProblem rp, VM vm) {
Mapping m = rp.getSourceModel().getMapping();
if (m.isRunning(vm)) {
int curPos = rp.getNode(m.getVMLocation(vm));
return rp.getVMAction(vm).getDSlice().getHoster().contains(curPos);
}
return false;
} | [
"public",
"static",
"boolean",
"canStay",
"(",
"ReconfigurationProblem",
"rp",
",",
"VM",
"vm",
")",
"{",
"Mapping",
"m",
"=",
"rp",
".",
"getSourceModel",
"(",
")",
".",
"getMapping",
"(",
")",
";",
"if",
"(",
"m",
".",
"isRunning",
"(",
"vm",
")",
... | Check if a VM can stay on its current node.
@param rp the reconfiguration problem.
@param vm the VM
@return {@code true} iff the VM can stay | [
"Check",
"if",
"a",
"VM",
"can",
"stay",
"on",
"its",
"current",
"node",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/VMPlacementUtils.java#L63-L70 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.put | public JsonObject put(final String name, final Object value) {
if (this == value) {
throw new IllegalArgumentException("Cannot put self");
} else if (value == JsonValue.NULL) {
putNull(name);
} else if (checkType(value)) {
content.put(name, value);
} else {
throw new IllegalArgumentException("Unsupported type for JsonObject: " + value.getClass());
}
return this;
} | java | public JsonObject put(final String name, final Object value) {
if (this == value) {
throw new IllegalArgumentException("Cannot put self");
} else if (value == JsonValue.NULL) {
putNull(name);
} else if (checkType(value)) {
content.put(name, value);
} else {
throw new IllegalArgumentException("Unsupported type for JsonObject: " + value.getClass());
}
return this;
} | [
"public",
"JsonObject",
"put",
"(",
"final",
"String",
"name",
",",
"final",
"Object",
"value",
")",
"{",
"if",
"(",
"this",
"==",
"value",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot put self\"",
")",
";",
"}",
"else",
"if",
"(",
... | Stores a {@link Object} value identified by the field name.
Note that the value is checked and a {@link IllegalArgumentException} is thrown if not supported.
@param name the name of the JSON field.
@param value the value of the JSON field.
@return the {@link JsonObject}. | [
"Stores",
"a",
"{",
"@link",
"Object",
"}",
"value",
"identified",
"by",
"the",
"field",
"name",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L203-L214 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.toIntBiFunction | public static <T, U> ToIntBiFunction<T, U> toIntBiFunction(CheckedToIntBiFunction<T, U> function, Consumer<Throwable> handler) {
return (t, u) -> {
try {
return function.applyAsInt(t, u);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static <T, U> ToIntBiFunction<T, U> toIntBiFunction(CheckedToIntBiFunction<T, U> function, Consumer<Throwable> handler) {
return (t, u) -> {
try {
return function.applyAsInt(t, u);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"<",
"T",
",",
"U",
">",
"ToIntBiFunction",
"<",
"T",
",",
"U",
">",
"toIntBiFunction",
"(",
"CheckedToIntBiFunction",
"<",
"T",
",",
"U",
">",
"function",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"(",
... | Wrap a {@link CheckedToIntBiFunction} in a {@link ToIntBiFunction} with a custom handler for checked exceptions. | [
"Wrap",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L374-L385 |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspContentAccessBean.java | CmsJspContentAccessBean.getPrintStructure | public String getPrintStructure() {
if (getRawContent().hasLocale(m_requestedLocale)) {
List<I_CmsXmlContentValue> values = new ArrayList<I_CmsXmlContentValue>(
getRawContent().getValues(m_requestedLocale));
Collections.sort(values, new Comparator<I_CmsXmlContentValue>() {
public int compare(I_CmsXmlContentValue arg0, I_CmsXmlContentValue arg1) {
return arg0.getPath().compareTo(arg1.getPath());
}
});
StringBuffer buffer = new StringBuffer("<ul>\n");
for (I_CmsXmlContentValue value : values) {
buffer.append("<li>").append(value.getPath()).append("</li>\n");
}
buffer.append("</ul>");
return buffer.toString();
} else {
return "";
}
} | java | public String getPrintStructure() {
if (getRawContent().hasLocale(m_requestedLocale)) {
List<I_CmsXmlContentValue> values = new ArrayList<I_CmsXmlContentValue>(
getRawContent().getValues(m_requestedLocale));
Collections.sort(values, new Comparator<I_CmsXmlContentValue>() {
public int compare(I_CmsXmlContentValue arg0, I_CmsXmlContentValue arg1) {
return arg0.getPath().compareTo(arg1.getPath());
}
});
StringBuffer buffer = new StringBuffer("<ul>\n");
for (I_CmsXmlContentValue value : values) {
buffer.append("<li>").append(value.getPath()).append("</li>\n");
}
buffer.append("</ul>");
return buffer.toString();
} else {
return "";
}
} | [
"public",
"String",
"getPrintStructure",
"(",
")",
"{",
"if",
"(",
"getRawContent",
"(",
")",
".",
"hasLocale",
"(",
"m_requestedLocale",
")",
")",
"{",
"List",
"<",
"I_CmsXmlContentValue",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"I_CmsXmlContentValue",
"... | Prints the XPaths of the available content values into an HTML ul list.<p>
@return the HTML list of XPaths | [
"Prints",
"the",
"XPaths",
"of",
"the",
"available",
"content",
"values",
"into",
"an",
"HTML",
"ul",
"list",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspContentAccessBean.java#L970-L992 |
kohsuke/com4j | tlbimp/src/main/java/com4j/tlbimp/MethodBinder.java | MethodBinder.getReturnParam | private int getReturnParam() {
// look for [retval] attribute
for (int i = 0; i < params.length; i++) {
if (params[i].isRetval()) {
return i;
}
}
// sometimes a COM method has only one [out] param.
// treat that as the return value.
// this is seen frequently in MSHTML (see IHTMLChangeLog, for example)
int outIdx = -1;
for (int i = 0; i < params.length; i++) {
if (params[i].isOut() && !params[i].isIn()) {
if (outIdx == -1) {
outIdx = i;
} else {
return -1; // more than one out. no return value
}
}
}
return outIdx;
} | java | private int getReturnParam() {
// look for [retval] attribute
for (int i = 0; i < params.length; i++) {
if (params[i].isRetval()) {
return i;
}
}
// sometimes a COM method has only one [out] param.
// treat that as the return value.
// this is seen frequently in MSHTML (see IHTMLChangeLog, for example)
int outIdx = -1;
for (int i = 0; i < params.length; i++) {
if (params[i].isOut() && !params[i].isIn()) {
if (outIdx == -1) {
outIdx = i;
} else {
return -1; // more than one out. no return value
}
}
}
return outIdx;
} | [
"private",
"int",
"getReturnParam",
"(",
")",
"{",
"// look for [retval] attribute",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"params",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"params",
"[",
"i",
"]",
".",
"isRetval",
"(",
")",
... | Returns the index of the return value parameter, or -1 if none. | [
"Returns",
"the",
"index",
"of",
"the",
"return",
"value",
"parameter",
"or",
"-",
"1",
"if",
"none",
"."
] | train | https://github.com/kohsuke/com4j/blob/1e690b805fb0e4e9ef61560e20a56335aecb0b24/tlbimp/src/main/java/com4j/tlbimp/MethodBinder.java#L83-L105 |
bmelnychuk/AndroidTreeView | library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java | TwoDScrollView.scrollTo | public void scrollTo(int x, int y) {
// we rely on the fact the View.scrollBy calls scrollTo.
if (getChildCount() > 0) {
View child = getChildAt(0);
x = clamp(x, getWidth() - getPaddingRight() - getPaddingLeft(), child.getWidth());
y = clamp(y, getHeight() - getPaddingBottom() - getPaddingTop(), child.getHeight());
if (x != getScrollX() || y != getScrollY()) {
super.scrollTo(x, y);
}
}
} | java | public void scrollTo(int x, int y) {
// we rely on the fact the View.scrollBy calls scrollTo.
if (getChildCount() > 0) {
View child = getChildAt(0);
x = clamp(x, getWidth() - getPaddingRight() - getPaddingLeft(), child.getWidth());
y = clamp(y, getHeight() - getPaddingBottom() - getPaddingTop(), child.getHeight());
if (x != getScrollX() || y != getScrollY()) {
super.scrollTo(x, y);
}
}
} | [
"public",
"void",
"scrollTo",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"// we rely on the fact the View.scrollBy calls scrollTo.",
"if",
"(",
"getChildCount",
"(",
")",
">",
"0",
")",
"{",
"View",
"child",
"=",
"getChildAt",
"(",
"0",
")",
";",
"x",
"="... | {@inheritDoc}
<p/>
<p>This version also clamps the scrolling to the bounds of our child. | [
"{"
] | train | https://github.com/bmelnychuk/AndroidTreeView/blob/d051ce75f5c9bd5206481808f6133b51f581c8f1/library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java#L1069-L1079 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-data/deeplearning4j-datavec-iterators/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetIterator.java | RecordReaderDataSetIterator.loadFromMetaData | public DataSet loadFromMetaData(List<RecordMetaData> list) throws IOException {
if (underlying == null) {
Record r = recordReader.loadFromMetaData(list.get(0));
initializeUnderlying(r);
}
//Convert back to composable:
List<RecordMetaData> l = new ArrayList<>(list.size());
for (RecordMetaData m : list) {
l.add(new RecordMetaDataComposableMap(Collections.singletonMap(READER_KEY, m)));
}
MultiDataSet m = underlying.loadFromMetaData(l);
return mdsToDataSet(m);
} | java | public DataSet loadFromMetaData(List<RecordMetaData> list) throws IOException {
if (underlying == null) {
Record r = recordReader.loadFromMetaData(list.get(0));
initializeUnderlying(r);
}
//Convert back to composable:
List<RecordMetaData> l = new ArrayList<>(list.size());
for (RecordMetaData m : list) {
l.add(new RecordMetaDataComposableMap(Collections.singletonMap(READER_KEY, m)));
}
MultiDataSet m = underlying.loadFromMetaData(l);
return mdsToDataSet(m);
} | [
"public",
"DataSet",
"loadFromMetaData",
"(",
"List",
"<",
"RecordMetaData",
">",
"list",
")",
"throws",
"IOException",
"{",
"if",
"(",
"underlying",
"==",
"null",
")",
"{",
"Record",
"r",
"=",
"recordReader",
".",
"loadFromMetaData",
"(",
"list",
".",
"get"... | Load a multiple examples to a DataSet, using the provided RecordMetaData instances.
@param list List of RecordMetaData instances to load from. Should have been produced by the record reader provided
to the RecordReaderDataSetIterator constructor
@return DataSet with the specified examples
@throws IOException If an error occurs during loading of the data | [
"Load",
"a",
"multiple",
"examples",
"to",
"a",
"DataSet",
"using",
"the",
"provided",
"RecordMetaData",
"instances",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-datavec-iterators/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetIterator.java#L480-L494 |
hawkular/hawkular-commons | hawkular-bus/hawkular-bus-rest-client/src/main/java/org/hawkular/bus/restclient/RestClient.java | RestClient.postTopicMessage | public HttpResponse postTopicMessage(String topicName, String jsonPayload, Map<String, String> headers)
throws RestClientException {
return postMessage(Type.TOPIC, topicName, jsonPayload, headers);
} | java | public HttpResponse postTopicMessage(String topicName, String jsonPayload, Map<String, String> headers)
throws RestClientException {
return postMessage(Type.TOPIC, topicName, jsonPayload, headers);
} | [
"public",
"HttpResponse",
"postTopicMessage",
"(",
"String",
"topicName",
",",
"String",
"jsonPayload",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"throws",
"RestClientException",
"{",
"return",
"postMessage",
"(",
"Type",
".",
"TOPIC",
",",
... | Sends a message to the REST endpoint in order to put a message on the given topic.
@param topicName name of the topic
@param jsonPayload the actual message (as a JSON string) to put on the bus
@param headers any headers to send with the message (can be null or empty)
@return the response
@throws RestClientException if the response was not a 200 status code | [
"Sends",
"a",
"message",
"to",
"the",
"REST",
"endpoint",
"in",
"order",
"to",
"put",
"a",
"message",
"on",
"the",
"given",
"topic",
"."
] | train | https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-rest-client/src/main/java/org/hawkular/bus/restclient/RestClient.java#L129-L132 |
UrielCh/ovh-java-sdk | ovh-java-sdk-clusterhadoop/src/main/java/net/minidev/ovh/api/ApiOvhClusterhadoop.java | ApiOvhClusterhadoop.serviceName_nodeConsumptions_GET | public ArrayList<OvhNodeConsumption> serviceName_nodeConsumptions_GET(String serviceName) throws IOException {
String qPath = "/cluster/hadoop/{serviceName}/nodeConsumptions";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | java | public ArrayList<OvhNodeConsumption> serviceName_nodeConsumptions_GET(String serviceName) throws IOException {
String qPath = "/cluster/hadoop/{serviceName}/nodeConsumptions";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | [
"public",
"ArrayList",
"<",
"OvhNodeConsumption",
">",
"serviceName_nodeConsumptions_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cluster/hadoop/{serviceName}/nodeConsumptions\"",
";",
"StringBuilder",
"sb",
"=",
"path",... | Get the current node consumptions that you will billed for on the next bill
REST: GET /cluster/hadoop/{serviceName}/nodeConsumptions
@param serviceName [required] The internal name of your cluster | [
"Get",
"the",
"current",
"node",
"consumptions",
"that",
"you",
"will",
"billed",
"for",
"on",
"the",
"next",
"bill"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-clusterhadoop/src/main/java/net/minidev/ovh/api/ApiOvhClusterhadoop.java#L478-L483 |
JOML-CI/JOML | src/org/joml/Matrix4x3d.java | Matrix4x3d.setOrthoSymmetric | public Matrix4x3d setOrthoSymmetric(double width, double height, double zNear, double zFar) {
return setOrthoSymmetric(width, height, zNear, zFar, false);
} | java | public Matrix4x3d setOrthoSymmetric(double width, double height, double zNear, double zFar) {
return setOrthoSymmetric(width, height, zNear, zFar, false);
} | [
"public",
"Matrix4x3d",
"setOrthoSymmetric",
"(",
"double",
"width",
",",
"double",
"height",
",",
"double",
"zNear",
",",
"double",
"zFar",
")",
"{",
"return",
"setOrthoSymmetric",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
",",
"false",
")",
... | Set this matrix to be a symmetric orthographic projection transformation for a right-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code>.
<p>
This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double) setOrtho()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
In order to apply the symmetric orthographic projection to an already existing transformation,
use {@link #orthoSymmetric(double, double, double, double) orthoSymmetric()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #orthoSymmetric(double, double, double, double)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L7432-L7434 |
talenguyen/PrettySharedPreferences | prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java | PrettySharedPreferences.getLongEditor | protected LongEditor getLongEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new LongEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof LongEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (LongEditor) typeEditor;
} | java | protected LongEditor getLongEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new LongEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof LongEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (LongEditor) typeEditor;
} | [
"protected",
"LongEditor",
"getLongEditor",
"(",
"String",
"key",
")",
"{",
"TypeEditor",
"typeEditor",
"=",
"TYPE_EDITOR_MAP",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"typeEditor",
"==",
"null",
")",
"{",
"typeEditor",
"=",
"new",
"LongEditor",
"(",
... | Call to get a {@link com.tale.prettysharedpreferences.LongEditor} object for the specific
key. <code>NOTE:</code> There is a unique {@link com.tale.prettysharedpreferences.TypeEditor}
object for a unique key.
@param key The name of the preference.
@return {@link com.tale.prettysharedpreferences.LongEditor} object to be store or retrieve
a {@link java.lang.Long} value. | [
"Call",
"to",
"get",
"a",
"{"
] | train | https://github.com/talenguyen/PrettySharedPreferences/blob/b97edf86c8fa65be2165f2cd790545c78c971c22/prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java#L91-L100 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ThriftUtils.java | ThriftUtils.fromBytes | public static <T extends TBase<?, ?>> T fromBytes(byte[] data, Class<T> clazz)
throws TException {
if (data == null) {
return null;
}
ByteArrayInputStream bais = new ByteArrayInputStream(data);
try {
TTransport transport = new TIOStreamTransport(bais, null);
TProtocol iProtocol = protocolFactory.getProtocol(transport);
T record = clazz.newInstance();
record.read(iProtocol);
// bais.close();
return record;
} catch (InstantiationException | IllegalAccessException e) {
throw new TException(e);
}
} | java | public static <T extends TBase<?, ?>> T fromBytes(byte[] data, Class<T> clazz)
throws TException {
if (data == null) {
return null;
}
ByteArrayInputStream bais = new ByteArrayInputStream(data);
try {
TTransport transport = new TIOStreamTransport(bais, null);
TProtocol iProtocol = protocolFactory.getProtocol(transport);
T record = clazz.newInstance();
record.read(iProtocol);
// bais.close();
return record;
} catch (InstantiationException | IllegalAccessException e) {
throw new TException(e);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"TBase",
"<",
"?",
",",
"?",
">",
">",
"T",
"fromBytes",
"(",
"byte",
"[",
"]",
"data",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"TException",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
... | Deserializes a thrift object from byte array.
@param data
@param clazz
@return
@throws TException | [
"Deserializes",
"a",
"thrift",
"object",
"from",
"byte",
"array",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/ThriftUtils.java#L65-L81 |
aws/aws-sdk-java | aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/CreateFunctionRequest.java | CreateFunctionRequest.withTags | public CreateFunctionRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public CreateFunctionRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateFunctionRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/tagging.html">tags</a> to apply to the function.
</p>
@param tags
A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/tagging.html">tags</a> to apply to the
function.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"list",
"of",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"lambda",
"/",
"latest",
"/",
"dg",
"/",
"tagging",
".",
"html",
">",
"tags<",
"/",
"a",
">",
"to",
"apply",
"to",
"the",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/CreateFunctionRequest.java#L1020-L1023 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Database.java | Database.listIndices | @Deprecated
public List<Index> listIndices() {
InputStream response = null;
try {
URI uri = new DatabaseURIHelper(db.getDBUri()).path("_index").build();
response = client.couchDbClient.get(uri);
return getResponseList(response, client.getGson(), DeserializationTypes.INDICES);
} finally {
close(response);
}
} | java | @Deprecated
public List<Index> listIndices() {
InputStream response = null;
try {
URI uri = new DatabaseURIHelper(db.getDBUri()).path("_index").build();
response = client.couchDbClient.get(uri);
return getResponseList(response, client.getGson(), DeserializationTypes.INDICES);
} finally {
close(response);
}
} | [
"@",
"Deprecated",
"public",
"List",
"<",
"Index",
">",
"listIndices",
"(",
")",
"{",
"InputStream",
"response",
"=",
"null",
";",
"try",
"{",
"URI",
"uri",
"=",
"new",
"DatabaseURIHelper",
"(",
"db",
".",
"getDBUri",
"(",
")",
")",
".",
"path",
"(",
... | List all indices
<P>Example usage:</P>
<pre>
{@code
List <Index> indices = db.listIndices();
}
</pre>
@return List of Index objects
@see Database#listIndexes() | [
"List",
"all",
"indices",
"<P",
">",
"Example",
"usage",
":",
"<",
"/",
"P",
">",
"<pre",
">",
"{",
"@code",
"List",
"<Index",
">",
"indices",
"=",
"db",
".",
"listIndices",
"()",
";",
"}",
"<",
"/",
"pre",
">"
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Database.java#L565-L575 |
osmdroid/osmdroid | OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/data/IISTrackerBase.java | IISTrackerBase.getLocation | private GeoPoint getLocation() {
//sample data
//{"timestamp": 1483742439, "iss_position": {"latitude": "-50.8416", "longitude": "-41.2701"}, "message": "success"}
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting();
GeoPoint pt = null;
if (isConnected) {
try {
JSONObject jsonObject = json.makeHttpRequest(url_select);
JSONObject iss_position = (JSONObject) jsonObject.get("iss_position");
double lat = iss_position.getDouble("latitude");
double lon = iss_position.getDouble("longitude");
//valid the data
if (lat <= 90d && lat >= -90d && lon >= -180d && lon <= 180d) {
pt = new GeoPoint(lat, lon);
} else
Log.e(TAG, "invalid lat,lon received");
} catch (Throwable e) {
Log.e(TAG, "error fetching json", e);
}
}
return pt;
} | java | private GeoPoint getLocation() {
//sample data
//{"timestamp": 1483742439, "iss_position": {"latitude": "-50.8416", "longitude": "-41.2701"}, "message": "success"}
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting();
GeoPoint pt = null;
if (isConnected) {
try {
JSONObject jsonObject = json.makeHttpRequest(url_select);
JSONObject iss_position = (JSONObject) jsonObject.get("iss_position");
double lat = iss_position.getDouble("latitude");
double lon = iss_position.getDouble("longitude");
//valid the data
if (lat <= 90d && lat >= -90d && lon >= -180d && lon <= 180d) {
pt = new GeoPoint(lat, lon);
} else
Log.e(TAG, "invalid lat,lon received");
} catch (Throwable e) {
Log.e(TAG, "error fetching json", e);
}
}
return pt;
} | [
"private",
"GeoPoint",
"getLocation",
"(",
")",
"{",
"//sample data",
"//{\"timestamp\": 1483742439, \"iss_position\": {\"latitude\": \"-50.8416\", \"longitude\": \"-41.2701\"}, \"message\": \"success\"}",
"NetworkInfo",
"activeNetwork",
"=",
"cm",
".",
"getActiveNetworkInfo",
"(",
")"... | HTTP callout to get a JSON document that represents the IIS's current location
@return | [
"HTTP",
"callout",
"to",
"get",
"a",
"JSON",
"document",
"that",
"represents",
"the",
"IIS",
"s",
"current",
"location"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/data/IISTrackerBase.java#L169-L194 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.