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 |
|---|---|---|---|---|---|---|---|---|---|---|
raphw/byte-buddy | byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/PostCompilationAction.java | PostCompilationAction.of | public static Action<AbstractCompile> of(Project project) {
return new PostCompilationAction(project, project.getExtensions().create("byteBuddy", ByteBuddyExtension.class, project));
} | java | public static Action<AbstractCompile> of(Project project) {
return new PostCompilationAction(project, project.getExtensions().create("byteBuddy", ByteBuddyExtension.class, project));
} | [
"public",
"static",
"Action",
"<",
"AbstractCompile",
">",
"of",
"(",
"Project",
"project",
")",
"{",
"return",
"new",
"PostCompilationAction",
"(",
"project",
",",
"project",
".",
"getExtensions",
"(",
")",
".",
"create",
"(",
"\"byteBuddy\"",
",",
"ByteBuddy... | Creates a post compilation action.
@param project The project to apply the action upon.
@return An appropriate action. | [
"Creates",
"a",
"post",
"compilation",
"action",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-gradle-plugin/src/main/java/net/bytebuddy/build/gradle/PostCompilationAction.java#L54-L56 |
legsem/legstar.avro | legstar.avro.cob2avro/src/main/java/com/legstar/avro/cob2avro/io/AbstractZosDatumReader.java | AbstractZosDatumReader.readFully | public int readFully(byte b[], int off, int len) throws IOException {
IOUtils.readFully(inStream, b, off, len);
return len;
} | java | public int readFully(byte b[], int off, int len) throws IOException {
IOUtils.readFully(inStream, b, off, len);
return len;
} | [
"public",
"int",
"readFully",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"IOUtils",
".",
"readFully",
"(",
"inStream",
",",
"b",
",",
"off",
",",
"len",
")",
";",
"return",
"len",
";",
"}"
] | Read a number of bytes from the input stream, blocking until all
requested bytes are read or end of file is reached.
@param b the buffer to bill
@param off offset in buffer where to start filling
@param len how many bytes we should read
@return the total number of bytes read
@throws IOException if end of file reached without getting all requested
bytes | [
"Read",
"a",
"number",
"of",
"bytes",
"from",
"the",
"input",
"stream",
"blocking",
"until",
"all",
"requested",
"bytes",
"are",
"read",
"or",
"end",
"of",
"file",
"is",
"reached",
"."
] | train | https://github.com/legsem/legstar.avro/blob/bad5e0bf41700951eee1ad6a5d6d0c47b3da8f0b/legstar.avro.cob2avro/src/main/java/com/legstar/avro/cob2avro/io/AbstractZosDatumReader.java#L255-L258 |
synchronoss/cpo-api | cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java | CassandraCpoAdapter.retrieveBeans | @Override
public <C> List<C> retrieveBeans(String name, C criteria) throws CpoException {
return processSelectGroup(name, criteria, criteria, null, null, null, false);
} | java | @Override
public <C> List<C> retrieveBeans(String name, C criteria) throws CpoException {
return processSelectGroup(name, criteria, criteria, null, null, null, false);
} | [
"@",
"Override",
"public",
"<",
"C",
">",
"List",
"<",
"C",
">",
"retrieveBeans",
"(",
"String",
"name",
",",
"C",
"criteria",
")",
"throws",
"CpoException",
"{",
"return",
"processSelectGroup",
"(",
"name",
",",
"criteria",
",",
"criteria",
",",
"null",
... | Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.
@param name The filter name which tells the datasource which beans should be returned. The name also signifies what
data in the bean will be populated.
@param criteria This is an bean that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown.
This bean is used to specify the arguments used to retrieve the collection of beans.
@return A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the
same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
@throws CpoException Thrown if there are errors accessing the datasource | [
"Retrieves",
"the",
"bean",
"from",
"the",
"datasource",
".",
"The",
"assumption",
"is",
"that",
"the",
"bean",
"exists",
"in",
"the",
"datasource",
"."
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L1450-L1453 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/topic/TopicsMessagesBroadcaster.java | TopicsMessagesBroadcaster.checkAndSendMtcToSession | int checkAndSendMtcToSession(Session session, JsTopicMessageController msgControl, MessageToClient mtc, Object payload) throws SessionException {
if (session != null) {
if (session.isOpen()) {
try {
if (null != msgControl) {
checkMessageTopic(userContextFactory.getUserContext(session.getId()), mtc.getId(), payload, msgControl);
}
mtc.setType(MessageType.MESSAGE);
session.getAsyncRemote().sendObject(mtc);
return 1;
} catch (NotRecipientException ex) {
logger.debug("{} is exclude to receive a message in {}", ex.getMessage(), mtc.getId());
}
} else {
throw new SessionException("CLOSED", null, session);
}
}
return 0;
} | java | int checkAndSendMtcToSession(Session session, JsTopicMessageController msgControl, MessageToClient mtc, Object payload) throws SessionException {
if (session != null) {
if (session.isOpen()) {
try {
if (null != msgControl) {
checkMessageTopic(userContextFactory.getUserContext(session.getId()), mtc.getId(), payload, msgControl);
}
mtc.setType(MessageType.MESSAGE);
session.getAsyncRemote().sendObject(mtc);
return 1;
} catch (NotRecipientException ex) {
logger.debug("{} is exclude to receive a message in {}", ex.getMessage(), mtc.getId());
}
} else {
throw new SessionException("CLOSED", null, session);
}
}
return 0;
} | [
"int",
"checkAndSendMtcToSession",
"(",
"Session",
"session",
",",
"JsTopicMessageController",
"msgControl",
",",
"MessageToClient",
"mtc",
",",
"Object",
"payload",
")",
"throws",
"SessionException",
"{",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
"if",
"(",
... | Send Message to session, check right before
@param session
@param msgControl
@param mtc
@param payload
@return
@throws SessionException | [
"Send",
"Message",
"to",
"session",
"check",
"right",
"before"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicsMessagesBroadcaster.java#L114-L132 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/operator/LookupJoinOperator.java | LookupJoinOperator.joinCurrentPosition | private boolean joinCurrentPosition(LookupSource lookupSource, DriverYieldSignal yieldSignal)
{
// while we have a position on lookup side to join against...
while (joinPosition >= 0) {
if (lookupSource.isJoinPositionEligible(joinPosition, probe.getPosition(), probe.getPage())) {
currentProbePositionProducedRow = true;
pageBuilder.appendRow(probe, lookupSource, joinPosition);
joinSourcePositions++;
}
// get next position on lookup side for this probe row
joinPosition = lookupSource.getNextJoinPosition(joinPosition, probe.getPosition(), probe.getPage());
if (yieldSignal.isSet() || tryBuildPage()) {
return false;
}
}
return true;
} | java | private boolean joinCurrentPosition(LookupSource lookupSource, DriverYieldSignal yieldSignal)
{
// while we have a position on lookup side to join against...
while (joinPosition >= 0) {
if (lookupSource.isJoinPositionEligible(joinPosition, probe.getPosition(), probe.getPage())) {
currentProbePositionProducedRow = true;
pageBuilder.appendRow(probe, lookupSource, joinPosition);
joinSourcePositions++;
}
// get next position on lookup side for this probe row
joinPosition = lookupSource.getNextJoinPosition(joinPosition, probe.getPosition(), probe.getPage());
if (yieldSignal.isSet() || tryBuildPage()) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"joinCurrentPosition",
"(",
"LookupSource",
"lookupSource",
",",
"DriverYieldSignal",
"yieldSignal",
")",
"{",
"// while we have a position on lookup side to join against...",
"while",
"(",
"joinPosition",
">=",
"0",
")",
"{",
"if",
"(",
"lookupSource"... | Produce rows matching join condition for the current probe position. If this method was called previously
for the current probe position, calling this again will produce rows that wasn't been produced in previous
invocations.
@return true if all eligible rows have been produced; false otherwise | [
"Produce",
"rows",
"matching",
"join",
"condition",
"for",
"the",
"current",
"probe",
"position",
".",
"If",
"this",
"method",
"was",
"called",
"previously",
"for",
"the",
"current",
"probe",
"position",
"calling",
"this",
"again",
"will",
"produce",
"rows",
"... | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/LookupJoinOperator.java#L533-L552 |
alkacon/opencms-core | src/org/opencms/ui/apps/user/CmsAvailableRoleOrPrincipalTable.java | CmsAvailableRoleOrPrincipalTable.filterTable | public void filterTable(String search) {
m_container.removeAllContainerFilters();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_dialog.getFurtherColumnId())) {
m_container.addContainerFilter(new Or(new SimpleStringFilter(PROP_NAME, search, true, false)));
} else {
m_container.addContainerFilter(
new Or(
new SimpleStringFilter(PROP_NAME, search, true, false),
new SimpleStringFilter(m_dialog.getFurtherColumnId(), search, true, false)));
}
}
if ((getValue() != null) & !((Set<String>)getValue()).isEmpty()) {
setCurrentPageFirstItemId(((Set<String>)getValue()).iterator().next());
}
} | java | public void filterTable(String search) {
m_container.removeAllContainerFilters();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(search)) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_dialog.getFurtherColumnId())) {
m_container.addContainerFilter(new Or(new SimpleStringFilter(PROP_NAME, search, true, false)));
} else {
m_container.addContainerFilter(
new Or(
new SimpleStringFilter(PROP_NAME, search, true, false),
new SimpleStringFilter(m_dialog.getFurtherColumnId(), search, true, false)));
}
}
if ((getValue() != null) & !((Set<String>)getValue()).isEmpty()) {
setCurrentPageFirstItemId(((Set<String>)getValue()).iterator().next());
}
} | [
"public",
"void",
"filterTable",
"(",
"String",
"search",
")",
"{",
"m_container",
".",
"removeAllContainerFilters",
"(",
")",
";",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmptyOrWhitespaceOnly",
"(",
"search",
")",
")",
"{",
"if",
"(",
"CmsStringUtil",
".",
"i... | Filters the table according to given search string.<p>
@param search string to be looked for. | [
"Filters",
"the",
"table",
"according",
"to",
"given",
"search",
"string",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/user/CmsAvailableRoleOrPrincipalTable.java#L213-L230 |
BellaDati/belladati-sdk-api | src/main/java/com/belladati/sdk/dataset/data/OverwritePolicy.java | OverwritePolicy.byDateFrom | public static OverwritePolicy byDateFrom(String attribute, Calendar start) {
return new DateRangeOverwritePolicy(attribute, start, null);
} | java | public static OverwritePolicy byDateFrom(String attribute, Calendar start) {
return new DateRangeOverwritePolicy(attribute, start, null);
} | [
"public",
"static",
"OverwritePolicy",
"byDateFrom",
"(",
"String",
"attribute",
",",
"Calendar",
"start",
")",
"{",
"return",
"new",
"DateRangeOverwritePolicy",
"(",
"attribute",
",",
"start",
",",
"null",
")",
";",
"}"
] | Returns an {@link OverwritePolicy} that deletes records with a date on or
after the given date in the specified column.
<p>
Records with an empty date value in existing data are also deleted.
@param attribute date attribute to compare
@param start first day (inclusive) from which to delete data
@return {@link OverwritePolicy} object | [
"Returns",
"an",
"{",
"@link",
"OverwritePolicy",
"}",
"that",
"deletes",
"records",
"with",
"a",
"date",
"on",
"or",
"after",
"the",
"given",
"date",
"in",
"the",
"specified",
"column",
".",
"<p",
">",
"Records",
"with",
"an",
"empty",
"date",
"value",
... | train | https://github.com/BellaDati/belladati-sdk-api/blob/ec45a42048d8255838ad0200aa6784a8e8a121c1/src/main/java/com/belladati/sdk/dataset/data/OverwritePolicy.java#L125-L127 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/converter/filter/AvroFieldsPickConverter.java | AvroFieldsPickConverter.convertSchema | @Override
public Schema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException {
LOG.info("Converting schema " + inputSchema);
String fieldsStr = workUnit.getProp(ConfigurationKeys.CONVERTER_AVRO_FIELD_PICK_FIELDS);
Preconditions.checkNotNull(fieldsStr, ConfigurationKeys.CONVERTER_AVRO_FIELD_PICK_FIELDS
+ " is required for converter " + this.getClass().getSimpleName());
LOG.info("Converting schema to selected fields: " + fieldsStr);
try {
return createSchema(inputSchema, fieldsStr);
} catch (Exception e) {
throw new SchemaConversionException(e);
}
} | java | @Override
public Schema convertSchema(Schema inputSchema, WorkUnitState workUnit) throws SchemaConversionException {
LOG.info("Converting schema " + inputSchema);
String fieldsStr = workUnit.getProp(ConfigurationKeys.CONVERTER_AVRO_FIELD_PICK_FIELDS);
Preconditions.checkNotNull(fieldsStr, ConfigurationKeys.CONVERTER_AVRO_FIELD_PICK_FIELDS
+ " is required for converter " + this.getClass().getSimpleName());
LOG.info("Converting schema to selected fields: " + fieldsStr);
try {
return createSchema(inputSchema, fieldsStr);
} catch (Exception e) {
throw new SchemaConversionException(e);
}
} | [
"@",
"Override",
"public",
"Schema",
"convertSchema",
"(",
"Schema",
"inputSchema",
",",
"WorkUnitState",
"workUnit",
")",
"throws",
"SchemaConversionException",
"{",
"LOG",
".",
"info",
"(",
"\"Converting schema \"",
"+",
"inputSchema",
")",
";",
"String",
"fieldsS... | Convert the schema to contain only specified field. This will reuse AvroSchemaFieldRemover by listing fields not specified and remove it
from the schema
1. Retrieve list of fields from property
2. Traverse schema and get list of fields to be removed
3. While traversing also confirm specified fields from property also exist
4. Convert schema by using AvroSchemaFieldRemover
Each Avro Record type increments depth and from input depth is represented by '.'. Avro schema is always expected to start with Record type
and first record type is depth 0 and won't be represented by '.'. As it's always expected to start with Record type, it's not necessary to disambiguate.
After first record type, if it reaches another record type, the prefix of the field name will be
"[Record name].".
Example:
{
"namespace": "example.avro",
"type": "record",
"name": "user",
"fields": [
{
"name": "name",
"type": "string"
},
{
"name": "favorite_number",
"type": [
"int",
"null"
]
},
{
"type": "record",
"name": "address",
"fields": [
{
"name": "city",
"type": "string"
}
]
}
]
}
If user wants to only choose name and city, the input parameter should be "name,address.city". Note that it is not user.name as first record is depth zero.
{@inheritDoc}
@see org.apache.gobblin.converter.AvroToAvroConverterBase#convertSchema(org.apache.avro.Schema, org.apache.gobblin.configuration.WorkUnitState) | [
"Convert",
"the",
"schema",
"to",
"contain",
"only",
"specified",
"field",
".",
"This",
"will",
"reuse",
"AvroSchemaFieldRemover",
"by",
"listing",
"fields",
"not",
"specified",
"and",
"remove",
"it",
"from",
"the",
"schema",
"1",
".",
"Retrieve",
"list",
"of"... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/filter/AvroFieldsPickConverter.java#L101-L114 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/bot/sharding/DefaultShardManagerBuilder.java | DefaultShardManagerBuilder.setRateLimitPool | public DefaultShardManagerBuilder setRateLimitPool(ScheduledExecutorService pool, boolean automaticShutdown)
{
return setRateLimitPoolProvider(pool == null ? null : new ThreadPoolProviderImpl<>(pool, automaticShutdown));
} | java | public DefaultShardManagerBuilder setRateLimitPool(ScheduledExecutorService pool, boolean automaticShutdown)
{
return setRateLimitPoolProvider(pool == null ? null : new ThreadPoolProviderImpl<>(pool, automaticShutdown));
} | [
"public",
"DefaultShardManagerBuilder",
"setRateLimitPool",
"(",
"ScheduledExecutorService",
"pool",
",",
"boolean",
"automaticShutdown",
")",
"{",
"return",
"setRateLimitPoolProvider",
"(",
"pool",
"==",
"null",
"?",
"null",
":",
"new",
"ThreadPoolProviderImpl",
"<>",
... | Sets the {@link ScheduledExecutorService ScheduledExecutorService} that should be used in
the JDA rate-limit handler. Changing this can drastically change the JDA behavior for RestAction execution
and should be handled carefully. <b>Only change this pool if you know what you're doing.</b>
<br>This will override the rate-limit pool provider set from {@link #setRateLimitPoolProvider(ThreadPoolProvider)}.
@param pool
The thread-pool to use for rate-limit handling
@param automaticShutdown
Whether {@link net.dv8tion.jda.core.JDA#shutdown()} should automatically shutdown this pool
@return The DefaultShardManagerBuilder instance. Useful for chaining. | [
"Sets",
"the",
"{",
"@link",
"ScheduledExecutorService",
"ScheduledExecutorService",
"}",
"that",
"should",
"be",
"used",
"in",
"the",
"JDA",
"rate",
"-",
"limit",
"handler",
".",
"Changing",
"this",
"can",
"drastically",
"change",
"the",
"JDA",
"behavior",
"for... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/bot/sharding/DefaultShardManagerBuilder.java#L733-L736 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java | HtmlTableRendererBase.renderColgroupsFacet | protected void renderColgroupsFacet(FacesContext facesContext, ResponseWriter writer, UIComponent component)
throws IOException
{
UIComponent colgroupsFacet = component.getFacet("colgroups");
if (colgroupsFacet == null)
{
// no facet to be rendered
return;
}
// render the facet
//RendererUtils.renderChild(facesContext, colgroupsFacet);
colgroupsFacet.encodeAll(facesContext);
} | java | protected void renderColgroupsFacet(FacesContext facesContext, ResponseWriter writer, UIComponent component)
throws IOException
{
UIComponent colgroupsFacet = component.getFacet("colgroups");
if (colgroupsFacet == null)
{
// no facet to be rendered
return;
}
// render the facet
//RendererUtils.renderChild(facesContext, colgroupsFacet);
colgroupsFacet.encodeAll(facesContext);
} | [
"protected",
"void",
"renderColgroupsFacet",
"(",
"FacesContext",
"facesContext",
",",
"ResponseWriter",
"writer",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"UIComponent",
"colgroupsFacet",
"=",
"component",
".",
"getFacet",
"(",
"\"colgroups\"... | Renders the colgroups facet.
@param facesContext the <code>FacesContext</code>.
@param writer the <code>ResponseWriter</code>.
@param component the parent <code>UIComponent</code> containing the facets.
@throws IOException if an exception occurs.
@since 2.0 | [
"Renders",
"the",
"colgroups",
"facet",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java#L234-L246 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/model/Policy.java | Policy.hasPolicy | public boolean hasPolicy(String sec, String ptype, List<String> rule) {
for (List<String> r : model.get(sec).get(ptype).policy) {
if (Util.arrayEquals(rule, r)) {
return true;
}
}
return false;
} | java | public boolean hasPolicy(String sec, String ptype, List<String> rule) {
for (List<String> r : model.get(sec).get(ptype).policy) {
if (Util.arrayEquals(rule, r)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"hasPolicy",
"(",
"String",
"sec",
",",
"String",
"ptype",
",",
"List",
"<",
"String",
">",
"rule",
")",
"{",
"for",
"(",
"List",
"<",
"String",
">",
"r",
":",
"model",
".",
"get",
"(",
"sec",
")",
".",
"get",
"(",
"ptype",
"... | hasPolicy determines whether a model has the specified policy rule.
@param sec the section, "p" or "g".
@param ptype the policy type, "p", "p2", .. or "g", "g2", ..
@param rule the policy rule.
@return whether the rule exists. | [
"hasPolicy",
"determines",
"whether",
"a",
"model",
"has",
"the",
"specified",
"policy",
"rule",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/model/Policy.java#L129-L137 |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java | Validate.stateNotNull | public static void stateNotNull(final Object obj, final String message) throws IllegalStateException {
if (obj == null) {
throw new IllegalStateException(message);
}
} | java | public static void stateNotNull(final Object obj, final String message) throws IllegalStateException {
if (obj == null) {
throw new IllegalStateException(message);
}
} | [
"public",
"static",
"void",
"stateNotNull",
"(",
"final",
"Object",
"obj",
",",
"final",
"String",
"message",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"message",
")",
... | Checks that obj is not null, throws exception if it is.
@param obj
The object to check
@param message
The exception message
@throws IllegalStateException
Thrown if obj is null | [
"Checks",
"that",
"obj",
"is",
"not",
"null",
"throws",
"exception",
"if",
"it",
"is",
"."
] | train | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java#L120-L124 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.adjustLinks | public void adjustLinks(List<String> sourceFiles, String targetParentFolder) throws CmsException {
CmsObject cms = OpenCms.initCmsObject(this);
cms.getRequestContext().setSiteRoot("");
List<String> rootSourceFiles = new ArrayList<String>();
for (String sourceFile : sourceFiles) {
rootSourceFiles.add(addSiteRoot(sourceFile));
}
String rootTargetParentFolder = addSiteRoot(targetParentFolder);
CmsLinkRewriter rewriter = new CmsLinkRewriter(cms, rootSourceFiles, rootTargetParentFolder);
rewriter.rewriteLinks();
} | java | public void adjustLinks(List<String> sourceFiles, String targetParentFolder) throws CmsException {
CmsObject cms = OpenCms.initCmsObject(this);
cms.getRequestContext().setSiteRoot("");
List<String> rootSourceFiles = new ArrayList<String>();
for (String sourceFile : sourceFiles) {
rootSourceFiles.add(addSiteRoot(sourceFile));
}
String rootTargetParentFolder = addSiteRoot(targetParentFolder);
CmsLinkRewriter rewriter = new CmsLinkRewriter(cms, rootSourceFiles, rootTargetParentFolder);
rewriter.rewriteLinks();
} | [
"public",
"void",
"adjustLinks",
"(",
"List",
"<",
"String",
">",
"sourceFiles",
",",
"String",
"targetParentFolder",
")",
"throws",
"CmsException",
"{",
"CmsObject",
"cms",
"=",
"OpenCms",
".",
"initCmsObject",
"(",
"this",
")",
";",
"cms",
".",
"getRequestCo... | This method works just like {@link CmsObject#adjustLinks(String, String)}, but you can specify multiple source
files, and the target folder is interpreted as the folder into which the source files have been copied.<p>
@param sourceFiles the list of source files
@param targetParentFolder the folder into which the source files have been copied
@throws CmsException if something goes wrong | [
"This",
"method",
"works",
"just",
"like",
"{",
"@link",
"CmsObject#adjustLinks",
"(",
"String",
"String",
")",
"}",
"but",
"you",
"can",
"specify",
"multiple",
"source",
"files",
"and",
"the",
"target",
"folder",
"is",
"interpreted",
"as",
"the",
"folder",
... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L188-L200 |
softindex/datakernel | core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java | ByteBuf.wrapForReading | @NotNull
@Contract("_ -> new")
public static ByteBuf wrapForReading(@NotNull byte[] bytes) {
return wrap(bytes, 0, bytes.length);
} | java | @NotNull
@Contract("_ -> new")
public static ByteBuf wrapForReading(@NotNull byte[] bytes) {
return wrap(bytes, 0, bytes.length);
} | [
"@",
"NotNull",
"@",
"Contract",
"(",
"\"_ -> new\"",
")",
"public",
"static",
"ByteBuf",
"wrapForReading",
"(",
"@",
"NotNull",
"byte",
"[",
"]",
"bytes",
")",
"{",
"return",
"wrap",
"(",
"bytes",
",",
"0",
",",
"bytes",
".",
"length",
")",
";",
"}"
] | Wraps provided byte array into {@code ByteBuf} with {@link #tail} equal to length of provided array.
@param bytes byte array to be wrapped into {@code ByteBuf}
@return {@code ByteBuf} over underlying byte array that is ready for reading | [
"Wraps",
"provided",
"byte",
"array",
"into",
"{",
"@code",
"ByteBuf",
"}",
"with",
"{",
"@link",
"#tail",
"}",
"equal",
"to",
"length",
"of",
"provided",
"array",
"."
] | train | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java#L170-L174 |
michael-rapp/AndroidMaterialDialog | library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java | DialogRootView.applyDialogPaddingTop | private boolean applyDialogPaddingTop(@NonNull final Area area, @NonNull final View view) {
if (area != Area.HEADER && area != Area.CONTENT && area != Area.BUTTON_BAR &&
view.getVisibility() == View.VISIBLE) {
view.setPadding(view.getPaddingLeft(), dialogPadding[1], view.getPaddingRight(),
view.getPaddingBottom());
return true;
}
return false;
} | java | private boolean applyDialogPaddingTop(@NonNull final Area area, @NonNull final View view) {
if (area != Area.HEADER && area != Area.CONTENT && area != Area.BUTTON_BAR &&
view.getVisibility() == View.VISIBLE) {
view.setPadding(view.getPaddingLeft(), dialogPadding[1], view.getPaddingRight(),
view.getPaddingBottom());
return true;
}
return false;
} | [
"private",
"boolean",
"applyDialogPaddingTop",
"(",
"@",
"NonNull",
"final",
"Area",
"area",
",",
"@",
"NonNull",
"final",
"View",
"view",
")",
"{",
"if",
"(",
"area",
"!=",
"Area",
".",
"HEADER",
"&&",
"area",
"!=",
"Area",
".",
"CONTENT",
"&&",
"area",... | Applies the dialog's top padding to the view of a specific area.
@param area
The area, the view, the padding should be applied to, corresponds to, as an instance
of the class {@link Area}. The area may not be null
@param view
The view, the padding should be applied to, as an instance of the class {@link View}.
The view may not be null | [
"Applies",
"the",
"dialog",
"s",
"top",
"padding",
"to",
"the",
"view",
"of",
"a",
"specific",
"area",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java#L682-L691 |
google/flatbuffers | java/com/google/flatbuffers/Table.java | Table.sortTables | protected void sortTables(int[] offsets, final ByteBuffer bb) {
Integer[] off = new Integer[offsets.length];
for (int i = 0; i < offsets.length; i++) off[i] = offsets[i];
java.util.Arrays.sort(off, new java.util.Comparator<Integer>() {
public int compare(Integer o1, Integer o2) {
return keysCompare(o1, o2, bb);
}
});
for (int i = 0; i < offsets.length; i++) offsets[i] = off[i];
} | java | protected void sortTables(int[] offsets, final ByteBuffer bb) {
Integer[] off = new Integer[offsets.length];
for (int i = 0; i < offsets.length; i++) off[i] = offsets[i];
java.util.Arrays.sort(off, new java.util.Comparator<Integer>() {
public int compare(Integer o1, Integer o2) {
return keysCompare(o1, o2, bb);
}
});
for (int i = 0; i < offsets.length; i++) offsets[i] = off[i];
} | [
"protected",
"void",
"sortTables",
"(",
"int",
"[",
"]",
"offsets",
",",
"final",
"ByteBuffer",
"bb",
")",
"{",
"Integer",
"[",
"]",
"off",
"=",
"new",
"Integer",
"[",
"offsets",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | Sort tables by the key.
@param offsets An 'int' indexes of the tables into the bb.
@param bb A {@code ByteBuffer} to get the tables. | [
"Sort",
"tables",
"by",
"the",
"key",
"."
] | train | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Table.java#L204-L213 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/extensions/AliasedCumulativesFiltering.java | AliasedCumulativesFiltering.toAbsoluteFreeResources | private static void toAbsoluteFreeResources(TIntIntHashMap changes, int[] sortedMoments) {
for (int i = 1; i < sortedMoments.length; i++) {
int t = sortedMoments[i];
int lastT = sortedMoments[i - 1];
int lastFree = changes.get(lastT);
changes.put(t, changes.get(t) + lastFree);
}
} | java | private static void toAbsoluteFreeResources(TIntIntHashMap changes, int[] sortedMoments) {
for (int i = 1; i < sortedMoments.length; i++) {
int t = sortedMoments[i];
int lastT = sortedMoments[i - 1];
int lastFree = changes.get(lastT);
changes.put(t, changes.get(t) + lastFree);
}
} | [
"private",
"static",
"void",
"toAbsoluteFreeResources",
"(",
"TIntIntHashMap",
"changes",
",",
"int",
"[",
"]",
"sortedMoments",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"sortedMoments",
".",
"length",
";",
"i",
"++",
")",
"{",
"int",
... | Translation for a relatives resources changes to an absolute free resources.
@param changes the map that indicates the free CPU variation
@param sortedMoments the different moments sorted in ascending order | [
"Translation",
"for",
"a",
"relatives",
"resources",
"changes",
"to",
"an",
"absolute",
"free",
"resources",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/AliasedCumulativesFiltering.java#L176-L184 |
Impetus/Kundera | src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/CouchbaseClient.java | CouchbaseClient.executeQuery | public List executeQuery(Statement stmt, EntityMetadata em)
{
N1qlQuery query = N1qlQuery.simple(stmt, N1qlParams.build().consistency(ScanConsistency.REQUEST_PLUS));
N1qlQueryResult list = bucket.query(query);
LOGGER.debug("Executed query : " + query.toString() + " on the " + bucket.name() + " Bucket");
validateQueryResults(stmt.toString(), list);
List records = new ArrayList<>();
for (N1qlQueryRow row : list)
{
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
.getMetamodel(em.getPersistenceUnit());
EntityType entityType = metaModel.entity(em.getEntityClazz());
JsonObject jsonObj = row.value().containsKey(em.getSchema()) ? row.value().getObject(em.getSchema())
: row.value();
records.add(handler.getEntityFromDocument(em.getEntityClazz(), jsonObj, entityType));
}
return records;
} | java | public List executeQuery(Statement stmt, EntityMetadata em)
{
N1qlQuery query = N1qlQuery.simple(stmt, N1qlParams.build().consistency(ScanConsistency.REQUEST_PLUS));
N1qlQueryResult list = bucket.query(query);
LOGGER.debug("Executed query : " + query.toString() + " on the " + bucket.name() + " Bucket");
validateQueryResults(stmt.toString(), list);
List records = new ArrayList<>();
for (N1qlQueryRow row : list)
{
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
.getMetamodel(em.getPersistenceUnit());
EntityType entityType = metaModel.entity(em.getEntityClazz());
JsonObject jsonObj = row.value().containsKey(em.getSchema()) ? row.value().getObject(em.getSchema())
: row.value();
records.add(handler.getEntityFromDocument(em.getEntityClazz(), jsonObj, entityType));
}
return records;
} | [
"public",
"List",
"executeQuery",
"(",
"Statement",
"stmt",
",",
"EntityMetadata",
"em",
")",
"{",
"N1qlQuery",
"query",
"=",
"N1qlQuery",
".",
"simple",
"(",
"stmt",
",",
"N1qlParams",
".",
"build",
"(",
")",
".",
"consistency",
"(",
"ScanConsistency",
".",... | Execute query.
@param stmt
the statement
@param em
the entity manager
@return the list | [
"Execute",
"query",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchbase/src/main/java/com/impetus/client/couchbase/CouchbaseClient.java#L324-L346 |
marklogic/java-client-api | marklogic-client-api/src/main/java/com/marklogic/client/admin/ExtensionLibraryDescriptor.java | ExtensionLibraryDescriptor.addPermission | public void addPermission(String roleName, String capability) {
Permission permission = new Permission();
permission.setRoleName(roleName);
permission.setCapability(capability);
this.permissions.add(permission);
} | java | public void addPermission(String roleName, String capability) {
Permission permission = new Permission();
permission.setRoleName(roleName);
permission.setCapability(capability);
this.permissions.add(permission);
} | [
"public",
"void",
"addPermission",
"(",
"String",
"roleName",
",",
"String",
"capability",
")",
"{",
"Permission",
"permission",
"=",
"new",
"Permission",
"(",
")",
";",
"permission",
".",
"setRoleName",
"(",
"roleName",
")",
";",
"permission",
".",
"setCapabi... | adds a permission to this module
@param roleName the role name to which the permission applies
@param capability the capability of the permission. | [
"adds",
"a",
"permission",
"to",
"this",
"module"
] | train | https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/admin/ExtensionLibraryDescriptor.java#L105-L110 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/opengl/renderer/VAOGLRenderer.java | VAOGLRenderer.isSplittable | private boolean isSplittable(int count, int type) {
switch (type) {
case GL11.GL_QUADS:
return count % 4 == 0;
case GL11.GL_TRIANGLES:
return count % 3 == 0;
case GL11.GL_LINE:
return count % 2 == 0;
}
return false;
} | java | private boolean isSplittable(int count, int type) {
switch (type) {
case GL11.GL_QUADS:
return count % 4 == 0;
case GL11.GL_TRIANGLES:
return count % 3 == 0;
case GL11.GL_LINE:
return count % 2 == 0;
}
return false;
} | [
"private",
"boolean",
"isSplittable",
"(",
"int",
"count",
",",
"int",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"GL11",
".",
"GL_QUADS",
":",
"return",
"count",
"%",
"4",
"==",
"0",
";",
"case",
"GL11",
".",
"GL_TRIANGLES",
":",
"re... | Check if the geometry being created can be split at the current index
@param count The current index
@param type The type of geometry being built
@return True if the geometry can be split at the current index | [
"Check",
"if",
"the",
"geometry",
"being",
"created",
"can",
"be",
"split",
"at",
"the",
"current",
"index"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/renderer/VAOGLRenderer.java#L238-L249 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java | PackageManagerUtils.getProviderPackageInfo | public static PackageInfo getProviderPackageInfo(Context context, String targetPackage) throws NameNotFoundException {
PackageManager manager = context.getPackageManager();
return manager.getPackageInfo(targetPackage, PackageManager.GET_PROVIDERS);
} | java | public static PackageInfo getProviderPackageInfo(Context context, String targetPackage) throws NameNotFoundException {
PackageManager manager = context.getPackageManager();
return manager.getPackageInfo(targetPackage, PackageManager.GET_PROVIDERS);
} | [
"public",
"static",
"PackageInfo",
"getProviderPackageInfo",
"(",
"Context",
"context",
",",
"String",
"targetPackage",
")",
"throws",
"NameNotFoundException",
"{",
"PackageManager",
"manager",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"return",
"manage... | Get the {@link android.content.pm.PackageInfo} that contains all content provider declaration for the context.
@param context the context.
@param targetPackage the target package name.
@return the {@link android.content.pm.PackageInfo}.
@throws NameNotFoundException if no package found. | [
"Get",
"the",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java#L198-L201 |
lestard/assertj-javafx | src/main/java/eu/lestard/assertj/javafx/api/FloatPropertyAssert.java | FloatPropertyAssert.hasValue | public FloatPropertyAssert hasValue(Double expectedValue, Offset offset){
new ObservableNumberValueAssertions(actual).hasValue(expectedValue, offset);
return this;
} | java | public FloatPropertyAssert hasValue(Double expectedValue, Offset offset){
new ObservableNumberValueAssertions(actual).hasValue(expectedValue, offset);
return this;
} | [
"public",
"FloatPropertyAssert",
"hasValue",
"(",
"Double",
"expectedValue",
",",
"Offset",
"offset",
")",
"{",
"new",
"ObservableNumberValueAssertions",
"(",
"actual",
")",
".",
"hasValue",
"(",
"expectedValue",
",",
"offset",
")",
";",
"return",
"this",
";",
"... | Verifies that the actual observable number has a value that is close to the given one by less then the given offset.
@param expectedValue the given value to compare the actual observables value to.
@param offset the given positive offset.
@return {@code this} assertion object.
@throws java.lang.NullPointerException if the given offset is <code>null</code>.
@throws java.lang.AssertionError if the actual observables value is not equal to the expected one. | [
"Verifies",
"that",
"the",
"actual",
"observable",
"number",
"has",
"a",
"value",
"that",
"is",
"close",
"to",
"the",
"given",
"one",
"by",
"less",
"then",
"the",
"given",
"offset",
"."
] | train | https://github.com/lestard/assertj-javafx/blob/f6b4d22e542a5501c7c1c2fae8700b0f69b956c1/src/main/java/eu/lestard/assertj/javafx/api/FloatPropertyAssert.java#L48-L52 |
podio/podio-java | src/main/java/com/podio/space/SpaceAPI.java | SpaceAPI.addSpaceMembers | public void addSpaceMembers(int spaceId, SpaceMemberAdd spaceMemberAdd) {
getResourceFactory()
.getApiResource("/space/" + spaceId + "/member/")
.entity(spaceMemberAdd, MediaType.APPLICATION_JSON_TYPE)
.post();
} | java | public void addSpaceMembers(int spaceId, SpaceMemberAdd spaceMemberAdd) {
getResourceFactory()
.getApiResource("/space/" + spaceId + "/member/")
.entity(spaceMemberAdd, MediaType.APPLICATION_JSON_TYPE)
.post();
} | [
"public",
"void",
"addSpaceMembers",
"(",
"int",
"spaceId",
",",
"SpaceMemberAdd",
"spaceMemberAdd",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/space/\"",
"+",
"spaceId",
"+",
"\"/member/\"",
")",
".",
"entity",
"(",
"spaceMemberAdd"... | Adds a list of users (either through user_id or email) to the space.
@param spaceId
The id of the space
@param spaceMemberAdd
Information about the user(s) to add | [
"Adds",
"a",
"list",
"of",
"users",
"(",
"either",
"through",
"user_id",
"or",
"email",
")",
"to",
"the",
"space",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/space/SpaceAPI.java#L78-L83 |
jqno/equalsverifier | src/main/java/nl/jqno/equalsverifier/internal/reflection/ConditionalInstantiator.java | ConditionalInstantiator.callFactory | @SuppressFBWarnings(value = "DP_DO_INSIDE_DO_PRIVILEGED", justification = "EV is run only from within unit tests")
@SuppressWarnings("unchecked")
public <T> T callFactory(String factoryTypeName, String factoryMethod, Class<?>[] paramTypes, Object[] paramValues) {
try {
Class<T> type = resolve();
if (type == null) {
return null;
}
Class<?> factoryType = Class.forName(factoryTypeName);
Method factory = factoryType.getMethod(factoryMethod, paramTypes);
factory.setAccessible(true);
return (T)factory.invoke(null, paramValues);
}
catch (Exception e) {
return handleException(e);
}
} | java | @SuppressFBWarnings(value = "DP_DO_INSIDE_DO_PRIVILEGED", justification = "EV is run only from within unit tests")
@SuppressWarnings("unchecked")
public <T> T callFactory(String factoryTypeName, String factoryMethod, Class<?>[] paramTypes, Object[] paramValues) {
try {
Class<T> type = resolve();
if (type == null) {
return null;
}
Class<?> factoryType = Class.forName(factoryTypeName);
Method factory = factoryType.getMethod(factoryMethod, paramTypes);
factory.setAccessible(true);
return (T)factory.invoke(null, paramValues);
}
catch (Exception e) {
return handleException(e);
}
} | [
"@",
"SuppressFBWarnings",
"(",
"value",
"=",
"\"DP_DO_INSIDE_DO_PRIVILEGED\"",
",",
"justification",
"=",
"\"EV is run only from within unit tests\"",
")",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"callFactory",
"(",
"String",
... | Attempts to call a static factory method on a type.
@param <T>
The return type of the factory method.
@param factoryTypeName
The type that contains the factory method.
@param factoryMethod
The name of the factory method.
@param paramTypes
The types of the parameters of the specific overload of the
factory method we want to call.
@param paramValues
The values that we want to pass into the factory method.
@return An instance of the type given by the factory method with the
given parameter values, or null of the type does not exist.
@throws ReflectionException
If the call to the factory method fails. | [
"Attempts",
"to",
"call",
"a",
"static",
"factory",
"method",
"on",
"a",
"type",
"."
] | train | https://github.com/jqno/equalsverifier/blob/25d73c9cb801c8b20b257d1d1283ac6e0585ef1d/src/main/java/nl/jqno/equalsverifier/internal/reflection/ConditionalInstantiator.java#L125-L141 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.hasAnnotation | public static boolean hasAnnotation(final MethodNode methodNode, final Class<? extends Annotation> annotationClass) {
return !methodNode.getAnnotations(new ClassNode(annotationClass)).isEmpty();
} | java | public static boolean hasAnnotation(final MethodNode methodNode, final Class<? extends Annotation> annotationClass) {
return !methodNode.getAnnotations(new ClassNode(annotationClass)).isEmpty();
} | [
"public",
"static",
"boolean",
"hasAnnotation",
"(",
"final",
"MethodNode",
"methodNode",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"return",
"!",
"methodNode",
".",
"getAnnotations",
"(",
"new",
"ClassNode",
"("... | Returns true if MethodNode is marked with annotationClass
@param methodNode A MethodNode to inspect
@param annotationClass an annotation to look for
@return true if classNode is marked with annotationClass, otherwise false | [
"Returns",
"true",
"if",
"MethodNode",
"is",
"marked",
"with",
"annotationClass"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L955-L957 |
canoo/dolphin-platform | platform/dolphin-platform-core/src/main/java/com/canoo/dp/impl/platform/core/commons/lang/TypeUtils.java | TypeUtils.getTypeArguments | private static Map<TypeVariable<?>, Type> getTypeArguments(Class<?> cls, final Class<?> toClass,
final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
// make sure they're assignable
if (!isAssignable(cls, toClass)) {
return null;
}
// can't work with primitives
if (cls.isPrimitive()) {
// both classes are primitives?
if (toClass.isPrimitive()) {
// dealing with widening here. No type arguments to be
// harvested with these two types.
return new HashMap<>();
}
// work with wrapper the wrapper class instead of the primitive
cls = ReflectionHelper.getWrapperClass(cls).orElse(cls);
}
// create a copy of the incoming map, or an empty one if it's null
final HashMap<TypeVariable<?>, Type> typeVarAssigns = subtypeVarAssigns == null ? new HashMap<TypeVariable<?>, Type>()
: new HashMap<>(subtypeVarAssigns);
// has target class been reached?
if (toClass.equals(cls)) {
return typeVarAssigns;
}
// walk the inheritance hierarchy until the target class is reached
return getTypeArguments(getClosestParentType(cls, toClass), toClass, typeVarAssigns);
} | java | private static Map<TypeVariable<?>, Type> getTypeArguments(Class<?> cls, final Class<?> toClass,
final Map<TypeVariable<?>, Type> subtypeVarAssigns) {
// make sure they're assignable
if (!isAssignable(cls, toClass)) {
return null;
}
// can't work with primitives
if (cls.isPrimitive()) {
// both classes are primitives?
if (toClass.isPrimitive()) {
// dealing with widening here. No type arguments to be
// harvested with these two types.
return new HashMap<>();
}
// work with wrapper the wrapper class instead of the primitive
cls = ReflectionHelper.getWrapperClass(cls).orElse(cls);
}
// create a copy of the incoming map, or an empty one if it's null
final HashMap<TypeVariable<?>, Type> typeVarAssigns = subtypeVarAssigns == null ? new HashMap<TypeVariable<?>, Type>()
: new HashMap<>(subtypeVarAssigns);
// has target class been reached?
if (toClass.equals(cls)) {
return typeVarAssigns;
}
// walk the inheritance hierarchy until the target class is reached
return getTypeArguments(getClosestParentType(cls, toClass), toClass, typeVarAssigns);
} | [
"private",
"static",
"Map",
"<",
"TypeVariable",
"<",
"?",
">",
",",
"Type",
">",
"getTypeArguments",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"final",
"Class",
"<",
"?",
">",
"toClass",
",",
"final",
"Map",
"<",
"TypeVariable",
"<",
"?",
">",
",",
... | <p>Return a map of the type arguments of a class in the context of {@code toClass}.</p>
@param cls the class in question
@param toClass the context class
@param subtypeVarAssigns a map with type variables
@return the {@code Map} with type arguments | [
"<p",
">",
"Return",
"a",
"map",
"of",
"the",
"type",
"arguments",
"of",
"a",
"class",
"in",
"the",
"context",
"of",
"{",
"@code",
"toClass",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-core/src/main/java/com/canoo/dp/impl/platform/core/commons/lang/TypeUtils.java#L794-L825 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/partitionrefinement/PaigeTarjan.java | PaigeTarjan.createBlock | public Block createBlock() {
Block b = new Block(-1, -1, numBlocks++, blocklistHead);
blocklistHead = b;
return b;
} | java | public Block createBlock() {
Block b = new Block(-1, -1, numBlocks++, blocklistHead);
blocklistHead = b;
return b;
} | [
"public",
"Block",
"createBlock",
"(",
")",
"{",
"Block",
"b",
"=",
"new",
"Block",
"(",
"-",
"1",
",",
"-",
"1",
",",
"numBlocks",
"++",
",",
"blocklistHead",
")",
";",
"blocklistHead",
"=",
"b",
";",
"return",
"b",
";",
"}"
] | Creates a new block. The {@link Block#low} and {@link Block#high} fields will be initialized to {@code -1}.
@return a newly created block. | [
"Creates",
"a",
"new",
"block",
".",
"The",
"{",
"@link",
"Block#low",
"}",
"and",
"{",
"@link",
"Block#high",
"}",
"fields",
"will",
"be",
"initialized",
"to",
"{",
"@code",
"-",
"1",
"}",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/partitionrefinement/PaigeTarjan.java#L350-L354 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/StringUtils.java | StringUtils.prependIfMissingIgnoreCase | public static String prependIfMissingIgnoreCase(final String str, final CharSequence prefix, final CharSequence... prefixes) {
return prependIfMissing(str, prefix, true, prefixes);
} | java | public static String prependIfMissingIgnoreCase(final String str, final CharSequence prefix, final CharSequence... prefixes) {
return prependIfMissing(str, prefix, true, prefixes);
} | [
"public",
"static",
"String",
"prependIfMissingIgnoreCase",
"(",
"final",
"String",
"str",
",",
"final",
"CharSequence",
"prefix",
",",
"final",
"CharSequence",
"...",
"prefixes",
")",
"{",
"return",
"prependIfMissing",
"(",
"str",
",",
"prefix",
",",
"true",
",... | Prepends the prefix to the start of the string if the string does not
already start, case insensitive, with any of the prefixes.
<pre>
StringUtils.prependIfMissingIgnoreCase(null, null) = null
StringUtils.prependIfMissingIgnoreCase("abc", null) = "abc"
StringUtils.prependIfMissingIgnoreCase("", "xyz") = "xyz"
StringUtils.prependIfMissingIgnoreCase("abc", "xyz") = "xyzabc"
StringUtils.prependIfMissingIgnoreCase("xyzabc", "xyz") = "xyzabc"
StringUtils.prependIfMissingIgnoreCase("XYZabc", "xyz") = "XYZabc"
</pre>
<p>With additional prefixes,</p>
<pre>
StringUtils.prependIfMissingIgnoreCase(null, null, null) = null
StringUtils.prependIfMissingIgnoreCase("abc", null, null) = "abc"
StringUtils.prependIfMissingIgnoreCase("", "xyz", null) = "xyz"
StringUtils.prependIfMissingIgnoreCase("abc", "xyz", new CharSequence[]{null}) = "xyzabc"
StringUtils.prependIfMissingIgnoreCase("abc", "xyz", "") = "abc"
StringUtils.prependIfMissingIgnoreCase("abc", "xyz", "mno") = "xyzabc"
StringUtils.prependIfMissingIgnoreCase("xyzabc", "xyz", "mno") = "xyzabc"
StringUtils.prependIfMissingIgnoreCase("mnoabc", "xyz", "mno") = "mnoabc"
StringUtils.prependIfMissingIgnoreCase("XYZabc", "xyz", "mno") = "XYZabc"
StringUtils.prependIfMissingIgnoreCase("MNOabc", "xyz", "mno") = "MNOabc"
</pre>
@param str The string.
@param prefix The prefix to prepend to the start of the string.
@param prefixes Additional prefixes that are valid (optional).
@return A new String if prefix was prepended, the same string otherwise.
@since 3.2 | [
"Prepends",
"the",
"prefix",
"to",
"the",
"start",
"of",
"the",
"string",
"if",
"the",
"string",
"does",
"not",
"already",
"start",
"case",
"insensitive",
"with",
"any",
"of",
"the",
"prefixes",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L8953-L8955 |
dmfs/xmlobjects | src/org/dmfs/xmlobjects/pull/XmlObjectPull.java | XmlObjectPull.moveToNext | public <T> boolean moveToNext(ElementDescriptor<T> type, XmlPath path) throws XmlPullParserException, XmlObjectPullParserException, IOException
{
pullInternal(type, null, path, true, false);
return !isEndOfDocument();
} | java | public <T> boolean moveToNext(ElementDescriptor<T> type, XmlPath path) throws XmlPullParserException, XmlObjectPullParserException, IOException
{
pullInternal(type, null, path, true, false);
return !isEndOfDocument();
} | [
"public",
"<",
"T",
">",
"boolean",
"moveToNext",
"(",
"ElementDescriptor",
"<",
"T",
">",
"type",
",",
"XmlPath",
"path",
")",
"throws",
"XmlPullParserException",
",",
"XmlObjectPullParserException",
",",
"IOException",
"{",
"pullInternal",
"(",
"type",
",",
"n... | Moves forward to the start of the next element that matches the given type and path.
@return <code>true</code> if there is such an element, false otherwise.
@throws XmlPullParserException
@throws XmlObjectPullParserException
@throws IOException | [
"Moves",
"forward",
"to",
"the",
"start",
"of",
"the",
"next",
"element",
"that",
"matches",
"the",
"given",
"type",
"and",
"path",
"."
] | train | https://github.com/dmfs/xmlobjects/blob/b68ddd0ce994d804fc2ec6da1096bf0d883b37f9/src/org/dmfs/xmlobjects/pull/XmlObjectPull.java#L82-L86 |
apache/incubator-gobblin | gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanJobHelper.java | AzkabanJobHelper.deleteAzkabanJob | public static void deleteAzkabanJob(String sessionId, AzkabanProjectConfig azkabanProjectConfig)
throws IOException {
log.info("Deleting Azkaban project for: " + azkabanProjectConfig.getAzkabanProjectName());
// Delete project
AzkabanAjaxAPIClient.deleteAzkabanProject(sessionId, azkabanProjectConfig);
} | java | public static void deleteAzkabanJob(String sessionId, AzkabanProjectConfig azkabanProjectConfig)
throws IOException {
log.info("Deleting Azkaban project for: " + azkabanProjectConfig.getAzkabanProjectName());
// Delete project
AzkabanAjaxAPIClient.deleteAzkabanProject(sessionId, azkabanProjectConfig);
} | [
"public",
"static",
"void",
"deleteAzkabanJob",
"(",
"String",
"sessionId",
",",
"AzkabanProjectConfig",
"azkabanProjectConfig",
")",
"throws",
"IOException",
"{",
"log",
".",
"info",
"(",
"\"Deleting Azkaban project for: \"",
"+",
"azkabanProjectConfig",
".",
"getAzkaban... | *
Delete project on Azkaban based on Azkaban config.
@param sessionId Session Id.
@param azkabanProjectConfig Azkaban Project Config.
@throws IOException | [
"*",
"Delete",
"project",
"on",
"Azkaban",
"based",
"on",
"Azkaban",
"config",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanJobHelper.java#L129-L135 |
grpc/grpc-java | api/src/main/java/io/grpc/ServerInterceptors.java | ServerInterceptors.interceptForward | public static ServerServiceDefinition interceptForward(
ServerServiceDefinition serviceDef,
List<? extends ServerInterceptor> interceptors) {
List<? extends ServerInterceptor> copy = new ArrayList<>(interceptors);
Collections.reverse(copy);
return intercept(serviceDef, copy);
} | java | public static ServerServiceDefinition interceptForward(
ServerServiceDefinition serviceDef,
List<? extends ServerInterceptor> interceptors) {
List<? extends ServerInterceptor> copy = new ArrayList<>(interceptors);
Collections.reverse(copy);
return intercept(serviceDef, copy);
} | [
"public",
"static",
"ServerServiceDefinition",
"interceptForward",
"(",
"ServerServiceDefinition",
"serviceDef",
",",
"List",
"<",
"?",
"extends",
"ServerInterceptor",
">",
"interceptors",
")",
"{",
"List",
"<",
"?",
"extends",
"ServerInterceptor",
">",
"copy",
"=",
... | Create a new {@code ServerServiceDefinition} whose {@link ServerCallHandler}s will call
{@code interceptors} before calling the pre-existing {@code ServerCallHandler}. The first
interceptor will have its {@link ServerInterceptor#interceptCall} called first.
@param serviceDef the service definition for which to intercept all its methods.
@param interceptors list of interceptors to apply to the service.
@return a wrapped version of {@code serviceDef} with the interceptors applied. | [
"Create",
"a",
"new",
"{",
"@code",
"ServerServiceDefinition",
"}",
"whose",
"{",
"@link",
"ServerCallHandler",
"}",
"s",
"will",
"call",
"{",
"@code",
"interceptors",
"}",
"before",
"calling",
"the",
"pre",
"-",
"existing",
"{",
"@code",
"ServerCallHandler",
... | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/ServerInterceptors.java#L62-L68 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISDBFactory.java | H2GISDBFactory.createSpatialDataBase | public static Connection createSpatialDataBase(String dbName, boolean initSpatial )throws SQLException, ClassNotFoundException {
return createSpatialDataBase(dbName, initSpatial, H2_PARAMETERS);
} | java | public static Connection createSpatialDataBase(String dbName, boolean initSpatial )throws SQLException, ClassNotFoundException {
return createSpatialDataBase(dbName, initSpatial, H2_PARAMETERS);
} | [
"public",
"static",
"Connection",
"createSpatialDataBase",
"(",
"String",
"dbName",
",",
"boolean",
"initSpatial",
")",
"throws",
"SQLException",
",",
"ClassNotFoundException",
"{",
"return",
"createSpatialDataBase",
"(",
"dbName",
",",
"initSpatial",
",",
"H2_PARAMETER... | Create a spatial database and register all H2GIS functions
@param dbName filename
@param initSpatial If true add spatial features to the database
@return Connection
@throws java.sql.SQLException
@throws java.lang.ClassNotFoundException | [
"Create",
"a",
"spatial",
"database",
"and",
"register",
"all",
"H2GIS",
"functions"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/factory/H2GISDBFactory.java#L175-L177 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getWvWMatchOverview | public void getWvWMatchOverview(int worldID, Callback<WvWMatchOverview> callback) throws NullPointerException {
gw2API.getWvWMatchOverviewUsingWorld(Integer.toString(worldID)).enqueue(callback);
} | java | public void getWvWMatchOverview(int worldID, Callback<WvWMatchOverview> callback) throws NullPointerException {
gw2API.getWvWMatchOverviewUsingWorld(Integer.toString(worldID)).enqueue(callback);
} | [
"public",
"void",
"getWvWMatchOverview",
"(",
"int",
"worldID",
",",
"Callback",
"<",
"WvWMatchOverview",
">",
"callback",
")",
"throws",
"NullPointerException",
"{",
"gw2API",
".",
"getWvWMatchOverviewUsingWorld",
"(",
"Integer",
".",
"toString",
"(",
"worldID",
")... | For more info on WvW matches API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/matches">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param worldID {@link World#id}
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see WvWMatchOverview WvW match overview info | [
"For",
"more",
"info",
"on",
"WvW",
"matches",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"wvw",
"/",
"matches",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2638-L2640 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java | JobsInner.listOutputFilesAsync | public Observable<Page<FileInner>> listOutputFilesAsync(final String resourceGroupName, final String workspaceName, final String experimentName, final String jobName, final JobsListOutputFilesOptions jobsListOutputFilesOptions) {
return listOutputFilesWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobName, jobsListOutputFilesOptions)
.map(new Func1<ServiceResponse<Page<FileInner>>, Page<FileInner>>() {
@Override
public Page<FileInner> call(ServiceResponse<Page<FileInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<FileInner>> listOutputFilesAsync(final String resourceGroupName, final String workspaceName, final String experimentName, final String jobName, final JobsListOutputFilesOptions jobsListOutputFilesOptions) {
return listOutputFilesWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobName, jobsListOutputFilesOptions)
.map(new Func1<ServiceResponse<Page<FileInner>>, Page<FileInner>>() {
@Override
public Page<FileInner> call(ServiceResponse<Page<FileInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"FileInner",
">",
">",
"listOutputFilesAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"workspaceName",
",",
"final",
"String",
"experimentName",
",",
"final",
"String",
"jobName",
",",
"final"... | List all directories and files inside the given directory of the Job's output directory (if the output directory is on Azure File Share or Azure Storage Container).
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param jobsListOutputFilesOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<FileInner> object | [
"List",
"all",
"directories",
"and",
"files",
"inside",
"the",
"given",
"directory",
"of",
"the",
"Job",
"s",
"output",
"directory",
"(",
"if",
"the",
"output",
"directory",
"is",
"on",
"Azure",
"File",
"Share",
"or",
"Azure",
"Storage",
"Container",
")",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java#L930-L938 |
Netflix/Nicobar | nicobar-core/src/main/java/com/netflix/nicobar/core/utils/ClassPathUtils.java | ClassPathUtils.scanClassPathWithExcludes | public static Set<String> scanClassPathWithExcludes(final String classPath, final Set<String> excludeJarSet, final Set<String> excludePrefixes) {
final Set<String> pathSet = new HashSet<String>();
// Defer to JDKPaths to do the actual classpath scanning.
__JDKPaths.processClassPathItem(classPath, excludeJarSet, pathSet);
return filterPathSet(pathSet, excludePrefixes, Collections.<String>emptySet());
} | java | public static Set<String> scanClassPathWithExcludes(final String classPath, final Set<String> excludeJarSet, final Set<String> excludePrefixes) {
final Set<String> pathSet = new HashSet<String>();
// Defer to JDKPaths to do the actual classpath scanning.
__JDKPaths.processClassPathItem(classPath, excludeJarSet, pathSet);
return filterPathSet(pathSet, excludePrefixes, Collections.<String>emptySet());
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"scanClassPathWithExcludes",
"(",
"final",
"String",
"classPath",
",",
"final",
"Set",
"<",
"String",
">",
"excludeJarSet",
",",
"final",
"Set",
"<",
"String",
">",
"excludePrefixes",
")",
"{",
"final",
"Set",
"... | Scan the classpath string provided, and collect a set of package paths found in jars and classes on the path,
excluding any that match a set of exclude prefixes.
@param classPath the classpath string
@param excludeJarSet a set of jars to exclude from scanning
@param excludePrefixes a set of path prefixes that determine what is excluded
@return the results of the scan, as a set of package paths (separated by '/'). | [
"Scan",
"the",
"classpath",
"string",
"provided",
"and",
"collect",
"a",
"set",
"of",
"package",
"paths",
"found",
"in",
"jars",
"and",
"classes",
"on",
"the",
"path",
"excluding",
"any",
"that",
"match",
"a",
"set",
"of",
"exclude",
"prefixes",
"."
] | train | https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/utils/ClassPathUtils.java#L216-L222 |
reactor/reactor-netty | src/main/java/reactor/netty/ByteBufFlux.java | ByteBufFlux.fromPath | public static ByteBufFlux fromPath(Path path, int maxChunkSize) {
return fromPath(path, maxChunkSize, ByteBufAllocator.DEFAULT);
} | java | public static ByteBufFlux fromPath(Path path, int maxChunkSize) {
return fromPath(path, maxChunkSize, ByteBufAllocator.DEFAULT);
} | [
"public",
"static",
"ByteBufFlux",
"fromPath",
"(",
"Path",
"path",
",",
"int",
"maxChunkSize",
")",
"{",
"return",
"fromPath",
"(",
"path",
",",
"maxChunkSize",
",",
"ByteBufAllocator",
".",
"DEFAULT",
")",
";",
"}"
] | Open a {@link java.nio.channels.FileChannel} from a path and stream
{@link ByteBuf} chunks with a given maximum size into the returned {@link ByteBufFlux}
@param path the path to the resource to stream
@param maxChunkSize the maximum per-item ByteBuf size
@return a {@link ByteBufFlux} | [
"Open",
"a",
"{",
"@link",
"java",
".",
"nio",
".",
"channels",
".",
"FileChannel",
"}",
"from",
"a",
"path",
"and",
"stream",
"{",
"@link",
"ByteBuf",
"}",
"chunks",
"with",
"a",
"given",
"maximum",
"size",
"into",
"the",
"returned",
"{",
"@link",
"By... | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/ByteBufFlux.java#L119-L121 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectExactCardinalityImpl_CustomFieldSerializer.java | OWLObjectExactCardinalityImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectExactCardinalityImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectExactCardinalityImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLObjectExactCardinalityImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectExactCardinalityImpl_CustomFieldSerializer.java#L73-L76 |
eurekaclinical/protempa | protempa-framework/src/main/java/org/protempa/JBossRuleCreator.java | JBossRuleCreator.visit | @Override
public void visit(SequentialTemporalPatternDefinition def) throws ProtempaException {
LOGGER.log(Level.FINER, "Creating rule for {0}", def);
try {
TemporalExtendedPropositionDefinition lhs = def.getFirstTemporalExtendedPropositionDefinition();
if (lhs != null) {
Rule rule = new Rule("SEQ_TP_" + def.getId());
Pattern sourceP = new Pattern(2, TEMP_PROP_OT);
GetMatchesPredicateExpression matchesPredicateExpression = new GetMatchesPredicateExpression(lhs, this.cache);
sourceP.addConstraint(new PredicateConstraint(
matchesPredicateExpression));
SubsequentTemporalExtendedPropositionDefinition[] relatedTemporalExtendedPropositionDefinitions = def.getSubsequentTemporalExtendedPropositionDefinitions();
for (int i = 0; i < relatedTemporalExtendedPropositionDefinitions.length; i++) {
SubsequentTemporalExtendedPropositionDefinition rtepd
= relatedTemporalExtendedPropositionDefinitions[i];
GetMatchesPredicateExpression matchesPredicateExpression1 = new GetMatchesPredicateExpression(
rtepd.getRelatedTemporalExtendedPropositionDefinition(), this.cache);
Constraint c = new PredicateConstraint(
matchesPredicateExpression1);
sourceP.addConstraint(c);
}
Pattern resultP = new Pattern(1, 1, ARRAY_LIST_OT, "result");
resultP.setSource(new Collect(sourceP, new Pattern(1, 1,
ARRAY_LIST_OT, "result")));
resultP.addConstraint(new PredicateConstraint(
new CollectionSizeExpression(1)));
rule.addPattern(resultP);
rule.setConsequence(new SequentialTemporalPatternConsequence(def,
this.derivationsBuilder));
rule.setSalience(MINUS_TWO_SALIENCE);
this.ruleToAbstractionDefinition.put(rule, def);
rules.add(rule);
ABSTRACTION_COMBINER.toRules(def, rules, this.derivationsBuilder);
}
} catch (InvalidRuleException e) {
throw new AssertionError(e.getClass().getName() + ": "
+ e.getMessage());
}
} | java | @Override
public void visit(SequentialTemporalPatternDefinition def) throws ProtempaException {
LOGGER.log(Level.FINER, "Creating rule for {0}", def);
try {
TemporalExtendedPropositionDefinition lhs = def.getFirstTemporalExtendedPropositionDefinition();
if (lhs != null) {
Rule rule = new Rule("SEQ_TP_" + def.getId());
Pattern sourceP = new Pattern(2, TEMP_PROP_OT);
GetMatchesPredicateExpression matchesPredicateExpression = new GetMatchesPredicateExpression(lhs, this.cache);
sourceP.addConstraint(new PredicateConstraint(
matchesPredicateExpression));
SubsequentTemporalExtendedPropositionDefinition[] relatedTemporalExtendedPropositionDefinitions = def.getSubsequentTemporalExtendedPropositionDefinitions();
for (int i = 0; i < relatedTemporalExtendedPropositionDefinitions.length; i++) {
SubsequentTemporalExtendedPropositionDefinition rtepd
= relatedTemporalExtendedPropositionDefinitions[i];
GetMatchesPredicateExpression matchesPredicateExpression1 = new GetMatchesPredicateExpression(
rtepd.getRelatedTemporalExtendedPropositionDefinition(), this.cache);
Constraint c = new PredicateConstraint(
matchesPredicateExpression1);
sourceP.addConstraint(c);
}
Pattern resultP = new Pattern(1, 1, ARRAY_LIST_OT, "result");
resultP.setSource(new Collect(sourceP, new Pattern(1, 1,
ARRAY_LIST_OT, "result")));
resultP.addConstraint(new PredicateConstraint(
new CollectionSizeExpression(1)));
rule.addPattern(resultP);
rule.setConsequence(new SequentialTemporalPatternConsequence(def,
this.derivationsBuilder));
rule.setSalience(MINUS_TWO_SALIENCE);
this.ruleToAbstractionDefinition.put(rule, def);
rules.add(rule);
ABSTRACTION_COMBINER.toRules(def, rules, this.derivationsBuilder);
}
} catch (InvalidRuleException e) {
throw new AssertionError(e.getClass().getName() + ": "
+ e.getMessage());
}
} | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"SequentialTemporalPatternDefinition",
"def",
")",
"throws",
"ProtempaException",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"FINER",
",",
"\"Creating rule for {0}\"",
",",
"def",
")",
";",
"try",
"{",
"Tempora... | Translates a sequential temporal pattern definition into rules.
@param def a {@link PairDefinition}. Cannot be <code>null</code>.
@throws KnowledgeSourceReadException if an error occurs accessing the
knowledge source during rule creation. | [
"Translates",
"a",
"sequential",
"temporal",
"pattern",
"definition",
"into",
"rules",
"."
] | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/JBossRuleCreator.java#L351-L390 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.getView | public View getView(Object tag){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "getView("+tag+")");
}
return getView(tag, 0);
} | java | public View getView(Object tag){
if(config.commandLogging){
Log.d(config.commandLoggingTag, "getView("+tag+")");
}
return getView(tag, 0);
} | [
"public",
"View",
"getView",
"(",
"Object",
"tag",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
"\"getView(\"",
"+",
"tag",
"+",
"\")\"",
")",
";",
"}",
"return",
"getVie... | Returns a View matching the specified tag.
@param tag the tag of the {@link View} to return
@return a {@link View} matching the specified id | [
"Returns",
"a",
"View",
"matching",
"the",
"specified",
"tag",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L3073-L3079 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranDtdResolver.java | AspectranDtdResolver.resolveEntity | @Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
if (validating) {
try {
InputSource source = null;
if (publicId != null) {
String path = doctypeMap.get(publicId.toUpperCase());
source = getInputSource(path);
}
if (source == null && systemId != null) {
String path = doctypeMap.get(systemId.toUpperCase());
source = getInputSource(path);
}
return source;
} catch (Exception e) {
throw new SAXException(e.toString());
}
} else {
return new InputSource(new StringReader(""));
}
} | java | @Override
public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
if (validating) {
try {
InputSource source = null;
if (publicId != null) {
String path = doctypeMap.get(publicId.toUpperCase());
source = getInputSource(path);
}
if (source == null && systemId != null) {
String path = doctypeMap.get(systemId.toUpperCase());
source = getInputSource(path);
}
return source;
} catch (Exception e) {
throw new SAXException(e.toString());
}
} else {
return new InputSource(new StringReader(""));
}
} | [
"@",
"Override",
"public",
"InputSource",
"resolveEntity",
"(",
"String",
"publicId",
",",
"String",
"systemId",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"validating",
")",
"{",
"try",
"{",
"InputSource",
"source",
"=",
"null",
";",
"if",
"(",
"publicI... | Converts a public DTD into a local one.
@param publicId unused but required by EntityResolver interface
@param systemId the DTD that is being requested
@return the InputSource for the DTD
@throws SAXException if anything goes wrong | [
"Converts",
"a",
"public",
"DTD",
"into",
"a",
"local",
"one",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/parser/xml/AspectranDtdResolver.java#L61-L81 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Signature.java | Signature.insertArgs | public Signature insertArgs(int index, String[] names, Class<?>... types) {
assert names.length == types.length : "names and types must be of the same length";
String[] newArgNames = new String[argNames.length + names.length];
System.arraycopy(names, 0, newArgNames, index, names.length);
if (index != 0) System.arraycopy(argNames, 0, newArgNames, 0, index);
if (argNames.length - index != 0)
System.arraycopy(argNames, index, newArgNames, index + names.length, argNames.length - index);
MethodType newMethodType = methodType.insertParameterTypes(index, types);
return new Signature(newMethodType, newArgNames);
} | java | public Signature insertArgs(int index, String[] names, Class<?>... types) {
assert names.length == types.length : "names and types must be of the same length";
String[] newArgNames = new String[argNames.length + names.length];
System.arraycopy(names, 0, newArgNames, index, names.length);
if (index != 0) System.arraycopy(argNames, 0, newArgNames, 0, index);
if (argNames.length - index != 0)
System.arraycopy(argNames, index, newArgNames, index + names.length, argNames.length - index);
MethodType newMethodType = methodType.insertParameterTypes(index, types);
return new Signature(newMethodType, newArgNames);
} | [
"public",
"Signature",
"insertArgs",
"(",
"int",
"index",
",",
"String",
"[",
"]",
"names",
",",
"Class",
"<",
"?",
">",
"...",
"types",
")",
"{",
"assert",
"names",
".",
"length",
"==",
"types",
".",
"length",
":",
"\"names and types must be of the same len... | Insert arguments (names + types) into the signature.
@param index the index at which to insert
@param names the names of the new arguments
@param types the types of the new arguments
@return a new signature with the added arguments | [
"Insert",
"arguments",
"(",
"names",
"+",
"types",
")",
"into",
"the",
"signature",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L275-L287 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/BlockHeartbeatReporter.java | BlockHeartbeatReporter.generateReport | public BlockHeartbeatReport generateReport() {
synchronized (mLock) {
BlockHeartbeatReport report
= new BlockHeartbeatReport(mAddedBlocks, mRemovedBlocks, mLostStorage);
// Clear added and removed blocks
mAddedBlocks.clear();
mRemovedBlocks.clear();
mLostStorage.clear();
return report;
}
} | java | public BlockHeartbeatReport generateReport() {
synchronized (mLock) {
BlockHeartbeatReport report
= new BlockHeartbeatReport(mAddedBlocks, mRemovedBlocks, mLostStorage);
// Clear added and removed blocks
mAddedBlocks.clear();
mRemovedBlocks.clear();
mLostStorage.clear();
return report;
}
} | [
"public",
"BlockHeartbeatReport",
"generateReport",
"(",
")",
"{",
"synchronized",
"(",
"mLock",
")",
"{",
"BlockHeartbeatReport",
"report",
"=",
"new",
"BlockHeartbeatReport",
"(",
"mAddedBlocks",
",",
"mRemovedBlocks",
",",
"mLostStorage",
")",
";",
"// Clear added ... | Generates the report of the block store delta in the last heartbeat period. Calling this method
marks the end of a period and the start of a new heartbeat period.
@return the block store delta report for the last heartbeat period | [
"Generates",
"the",
"report",
"of",
"the",
"block",
"store",
"delta",
"in",
"the",
"last",
"heartbeat",
"period",
".",
"Calling",
"this",
"method",
"marks",
"the",
"end",
"of",
"a",
"period",
"and",
"the",
"start",
"of",
"a",
"new",
"heartbeat",
"period",
... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/BlockHeartbeatReporter.java#L63-L73 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java | Layout.measureChild | public synchronized Widget measureChild(final int dataIndex, boolean calculateOffset) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "measureChild dataIndex = %d", dataIndex);
Widget widget = mContainer.get(dataIndex);
if (widget != null) {
synchronized (mMeasuredChildren) {
mMeasuredChildren.add(dataIndex);
}
}
return widget;
} | java | public synchronized Widget measureChild(final int dataIndex, boolean calculateOffset) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "measureChild dataIndex = %d", dataIndex);
Widget widget = mContainer.get(dataIndex);
if (widget != null) {
synchronized (mMeasuredChildren) {
mMeasuredChildren.add(dataIndex);
}
}
return widget;
} | [
"public",
"synchronized",
"Widget",
"measureChild",
"(",
"final",
"int",
"dataIndex",
",",
"boolean",
"calculateOffset",
")",
"{",
"Log",
".",
"d",
"(",
"Log",
".",
"SUBSYSTEM",
".",
"LAYOUT",
",",
"TAG",
",",
"\"measureChild dataIndex = %d\"",
",",
"dataIndex",... | Calculate the child size along the axis and measure the offset inside the
layout container
@param dataIndex of child in Container
@return true item fits the container, false - otherwise | [
"Calculate",
"the",
"child",
"size",
"along",
"the",
"axis",
"and",
"measure",
"the",
"offset",
"inside",
"the",
"layout",
"container"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/Layout.java#L247-L257 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.getTaggedImageCountAsync | public Observable<Integer> getTaggedImageCountAsync(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter) {
return getTaggedImageCountWithServiceResponseAsync(projectId, getTaggedImageCountOptionalParameter).map(new Func1<ServiceResponse<Integer>, Integer>() {
@Override
public Integer call(ServiceResponse<Integer> response) {
return response.body();
}
});
} | java | public Observable<Integer> getTaggedImageCountAsync(UUID projectId, GetTaggedImageCountOptionalParameter getTaggedImageCountOptionalParameter) {
return getTaggedImageCountWithServiceResponseAsync(projectId, getTaggedImageCountOptionalParameter).map(new Func1<ServiceResponse<Integer>, Integer>() {
@Override
public Integer call(ServiceResponse<Integer> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Integer",
">",
"getTaggedImageCountAsync",
"(",
"UUID",
"projectId",
",",
"GetTaggedImageCountOptionalParameter",
"getTaggedImageCountOptionalParameter",
")",
"{",
"return",
"getTaggedImageCountWithServiceResponseAsync",
"(",
"projectId",
",",
"get... | Gets the number of images tagged with the provided {tagIds}.
The filtering is on an and/or relationship. For example, if the provided tag ids are for the "Dog" and
"Cat" tags, then only images tagged with Dog and/or Cat will be returned.
@param projectId The project id
@param getTaggedImageCountOptionalParameter 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 Integer object | [
"Gets",
"the",
"number",
"of",
"images",
"tagged",
"with",
"the",
"provided",
"{",
"tagIds",
"}",
".",
"The",
"filtering",
"is",
"on",
"an",
"and",
"/",
"or",
"relationship",
".",
"For",
"example",
"if",
"the",
"provided",
"tag",
"ids",
"are",
"for",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L4643-L4650 |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/SpyPath.java | SpyPath.lookup | public PathImpl lookup(String userPath, Map<String,Object> newAttributes)
{
return new SpyPath(super.lookup(userPath, newAttributes));
} | java | public PathImpl lookup(String userPath, Map<String,Object> newAttributes)
{
return new SpyPath(super.lookup(userPath, newAttributes));
} | [
"public",
"PathImpl",
"lookup",
"(",
"String",
"userPath",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"newAttributes",
")",
"{",
"return",
"new",
"SpyPath",
"(",
"super",
".",
"lookup",
"(",
"userPath",
",",
"newAttributes",
")",
")",
";",
"}"
] | Returns a new path relative to the current one.
<p>Path only handles scheme:xxx. Subclasses of Path will specialize
the xxx.
@param userPath relative or absolute path, essentially any url.
@param newAttributes attributes for the new path.
@return the new path or null if the scheme doesn't exist | [
"Returns",
"a",
"new",
"path",
"relative",
"to",
"the",
"current",
"one",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/SpyPath.java#L64-L67 |
vdmeer/skb-java-base | src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java | Message5WH_Builder.setWhere | public Message5WH_Builder setWhere(Object where, int line, int column){
this.whereLocation = where;
this.whereLine = line;
this.whereColumn = column;
return this;
} | java | public Message5WH_Builder setWhere(Object where, int line, int column){
this.whereLocation = where;
this.whereLine = line;
this.whereColumn = column;
return this;
} | [
"public",
"Message5WH_Builder",
"setWhere",
"(",
"Object",
"where",
",",
"int",
"line",
",",
"int",
"column",
")",
"{",
"this",
".",
"whereLocation",
"=",
"where",
";",
"this",
".",
"whereLine",
"=",
"line",
";",
"this",
".",
"whereColumn",
"=",
"column",
... | Sets the Where? part of the message.
Nothing will be set if the first parameter is null.
@param where location for Where?
@param line line for Where?, ignored if <1;
@param column column for Where?, ignored if <1
@return self to allow chaining | [
"Sets",
"the",
"Where?",
"part",
"of",
"the",
"message",
".",
"Nothing",
"will",
"be",
"set",
"if",
"the",
"first",
"parameter",
"is",
"null",
"."
] | train | https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/message/Message5WH_Builder.java#L160-L165 |
alibaba/vlayout | vlayout/src/main/java/com/alibaba/android/vlayout/layout/BaseLayoutHelper.java | BaseLayoutHelper.handleStateOnResult | protected void handleStateOnResult(LayoutChunkResult result, View[] views) {
if (views == null) return;
for (int i = 0; i < views.length; i++) {
View view = views[i];
if (view == null) {
continue;
}
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams();
// Consume the available space if the view is not removed OR changed
if (params.isItemRemoved() || params.isItemChanged()) {
result.mIgnoreConsumed = true;
}
// used when search a focusable view
result.mFocusable = result.mFocusable || view.isFocusable();
if (result.mFocusable && result.mIgnoreConsumed) {
break;
}
}
} | java | protected void handleStateOnResult(LayoutChunkResult result, View[] views) {
if (views == null) return;
for (int i = 0; i < views.length; i++) {
View view = views[i];
if (view == null) {
continue;
}
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams();
// Consume the available space if the view is not removed OR changed
if (params.isItemRemoved() || params.isItemChanged()) {
result.mIgnoreConsumed = true;
}
// used when search a focusable view
result.mFocusable = result.mFocusable || view.isFocusable();
if (result.mFocusable && result.mIgnoreConsumed) {
break;
}
}
} | [
"protected",
"void",
"handleStateOnResult",
"(",
"LayoutChunkResult",
"result",
",",
"View",
"[",
"]",
"views",
")",
"{",
"if",
"(",
"views",
"==",
"null",
")",
"return",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"views",
".",
"length",
"... | Helper methods to handle focus states for views
@param result
@param views | [
"Helper",
"methods",
"to",
"handle",
"focus",
"states",
"for",
"views"
] | train | https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/layout/BaseLayoutHelper.java#L513-L535 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/ColumnText.java | ColumnText.getWidth | public static float getWidth(Phrase phrase, int runDirection, int arabicOptions) {
ColumnText ct = new ColumnText(null);
ct.addText(phrase);
ct.addWaitingPhrase();
PdfLine line = ct.bidiLine.processLine(0, 20000, Element.ALIGN_LEFT, runDirection, arabicOptions);
if (line == null)
return 0;
else
return 20000 - line.widthLeft();
} | java | public static float getWidth(Phrase phrase, int runDirection, int arabicOptions) {
ColumnText ct = new ColumnText(null);
ct.addText(phrase);
ct.addWaitingPhrase();
PdfLine line = ct.bidiLine.processLine(0, 20000, Element.ALIGN_LEFT, runDirection, arabicOptions);
if (line == null)
return 0;
else
return 20000 - line.widthLeft();
} | [
"public",
"static",
"float",
"getWidth",
"(",
"Phrase",
"phrase",
",",
"int",
"runDirection",
",",
"int",
"arabicOptions",
")",
"{",
"ColumnText",
"ct",
"=",
"new",
"ColumnText",
"(",
"null",
")",
";",
"ct",
".",
"addText",
"(",
"phrase",
")",
";",
"ct",... | Gets the width that the line will occupy after writing.
Only the width of the first line is returned.
@param phrase the <CODE>Phrase</CODE> containing the line
@param runDirection the run direction
@param arabicOptions the options for the arabic shaping
@return the width of the line | [
"Gets",
"the",
"width",
"that",
"the",
"line",
"will",
"occupy",
"after",
"writing",
".",
"Only",
"the",
"width",
"of",
"the",
"first",
"line",
"is",
"returned",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/ColumnText.java#L1042-L1051 |
alkacon/opencms-core | src/org/opencms/xml/types/CmsXmlHtmlValue.java | CmsXmlHtmlValue.createStringValue | private String createStringValue(CmsObject cms, I_CmsXmlDocument document) {
Element data = m_element.element(CmsXmlPage.NODE_CONTENT);
if (data == null) {
String content = m_element.getText();
m_element.clearContent();
int index = m_element.getParent().elements(m_element.getQName()).indexOf(m_element);
m_element.addAttribute(CmsXmlPage.ATTRIBUTE_NAME, getName() + index);
m_element.addElement(CmsXmlPage.NODE_LINKS);
m_element.addElement(CmsXmlPage.NODE_CONTENT).addCDATA(content);
data = m_element.element(CmsXmlPage.NODE_CONTENT);
}
Attribute enabled = m_element.attribute(CmsXmlPage.ATTRIBUTE_ENABLED);
String content = "";
if ((enabled == null) || Boolean.valueOf(enabled.getText()).booleanValue()) {
content = data.getText();
CmsLinkTable linkTable = getLinkTable();
if (!linkTable.isEmpty()) {
// link processing: replace macros with links
CmsLinkProcessor linkProcessor = document.getLinkProcessor(cms, linkTable);
try {
content = linkProcessor.processLinks(content);
} catch (ParserException e) {
// should better not happen
LOG.error(Messages.get().getBundle().key(Messages.ERR_XMLCONTENT_LINK_PROCESS_FAILED_0), e);
}
}
}
return content;
} | java | private String createStringValue(CmsObject cms, I_CmsXmlDocument document) {
Element data = m_element.element(CmsXmlPage.NODE_CONTENT);
if (data == null) {
String content = m_element.getText();
m_element.clearContent();
int index = m_element.getParent().elements(m_element.getQName()).indexOf(m_element);
m_element.addAttribute(CmsXmlPage.ATTRIBUTE_NAME, getName() + index);
m_element.addElement(CmsXmlPage.NODE_LINKS);
m_element.addElement(CmsXmlPage.NODE_CONTENT).addCDATA(content);
data = m_element.element(CmsXmlPage.NODE_CONTENT);
}
Attribute enabled = m_element.attribute(CmsXmlPage.ATTRIBUTE_ENABLED);
String content = "";
if ((enabled == null) || Boolean.valueOf(enabled.getText()).booleanValue()) {
content = data.getText();
CmsLinkTable linkTable = getLinkTable();
if (!linkTable.isEmpty()) {
// link processing: replace macros with links
CmsLinkProcessor linkProcessor = document.getLinkProcessor(cms, linkTable);
try {
content = linkProcessor.processLinks(content);
} catch (ParserException e) {
// should better not happen
LOG.error(Messages.get().getBundle().key(Messages.ERR_XMLCONTENT_LINK_PROCESS_FAILED_0), e);
}
}
}
return content;
} | [
"private",
"String",
"createStringValue",
"(",
"CmsObject",
"cms",
",",
"I_CmsXmlDocument",
"document",
")",
"{",
"Element",
"data",
"=",
"m_element",
".",
"element",
"(",
"CmsXmlPage",
".",
"NODE_CONTENT",
")",
";",
"if",
"(",
"data",
"==",
"null",
")",
"{"... | Creates the String value for this HTML value element.<p>
@param cms an initialized instance of a CmsObject
@param document the XML document this value belongs to
@return the String value for this HTML value element | [
"Creates",
"the",
"String",
"value",
"for",
"this",
"HTML",
"value",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/types/CmsXmlHtmlValue.java#L334-L367 |
livetribe/livetribe-slp | core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java | StandardDirectoryAgentServer.handleUDPSrvTypeRqst | protected void handleUDPSrvTypeRqst(SrvTypeRqst srvTypeRqst, InetSocketAddress localAddress, InetSocketAddress remoteAddress)
{
// Match scopes, RFC 2608, 11.1
if (!scopes.weakMatch(srvTypeRqst.getScopes()))
{
udpSrvTypeRply.perform(localAddress, remoteAddress, srvTypeRqst, SLPError.SCOPE_NOT_SUPPORTED);
return;
}
List<ServiceType> serviceTypes = matchServiceTypes(srvTypeRqst);
if (logger.isLoggable(Level.FINE))
logger.fine("DirectoryAgent " + this + " returning service types " + serviceTypes);
udpSrvTypeRply.perform(localAddress, remoteAddress, srvTypeRqst, serviceTypes);
} | java | protected void handleUDPSrvTypeRqst(SrvTypeRqst srvTypeRqst, InetSocketAddress localAddress, InetSocketAddress remoteAddress)
{
// Match scopes, RFC 2608, 11.1
if (!scopes.weakMatch(srvTypeRqst.getScopes()))
{
udpSrvTypeRply.perform(localAddress, remoteAddress, srvTypeRqst, SLPError.SCOPE_NOT_SUPPORTED);
return;
}
List<ServiceType> serviceTypes = matchServiceTypes(srvTypeRqst);
if (logger.isLoggable(Level.FINE))
logger.fine("DirectoryAgent " + this + " returning service types " + serviceTypes);
udpSrvTypeRply.perform(localAddress, remoteAddress, srvTypeRqst, serviceTypes);
} | [
"protected",
"void",
"handleUDPSrvTypeRqst",
"(",
"SrvTypeRqst",
"srvTypeRqst",
",",
"InetSocketAddress",
"localAddress",
",",
"InetSocketAddress",
"remoteAddress",
")",
"{",
"// Match scopes, RFC 2608, 11.1",
"if",
"(",
"!",
"scopes",
".",
"weakMatch",
"(",
"srvTypeRqst"... | Handles a unicast UDP SrvTypeRqst message arrived to this directory agent.
<br />
This directory agent will reply with an SrvTypeRply containing the service types.
@param srvTypeRqst the SrvTypeRqst message to handle
@param localAddress the socket address the message arrived to
@param remoteAddress the socket address the message was sent from | [
"Handles",
"a",
"unicast",
"UDP",
"SrvTypeRqst",
"message",
"arrived",
"to",
"this",
"directory",
"agent",
".",
"<br",
"/",
">",
"This",
"directory",
"agent",
"will",
"reply",
"with",
"an",
"SrvTypeRply",
"containing",
"the",
"service",
"types",
"."
] | train | https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java#L697-L711 |
RestComm/sip-servlets | sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java | FacebookRestClient.photos_createAlbum | public T photos_createAlbum(String name, String description, String location)
throws FacebookException, IOException {
assert (null != name && !"".equals(name));
ArrayList<Pair<String, CharSequence>> params =
new ArrayList<Pair<String, CharSequence>>(FacebookMethod.PHOTOS_CREATE_ALBUM.numParams());
params.add(new Pair<String, CharSequence>("name", name));
if (null != description)
params.add(new Pair<String, CharSequence>("description", description));
if (null != location)
params.add(new Pair<String, CharSequence>("location", location));
return this.callMethod(FacebookMethod.PHOTOS_CREATE_ALBUM, params);
} | java | public T photos_createAlbum(String name, String description, String location)
throws FacebookException, IOException {
assert (null != name && !"".equals(name));
ArrayList<Pair<String, CharSequence>> params =
new ArrayList<Pair<String, CharSequence>>(FacebookMethod.PHOTOS_CREATE_ALBUM.numParams());
params.add(new Pair<String, CharSequence>("name", name));
if (null != description)
params.add(new Pair<String, CharSequence>("description", description));
if (null != location)
params.add(new Pair<String, CharSequence>("location", location));
return this.callMethod(FacebookMethod.PHOTOS_CREATE_ALBUM, params);
} | [
"public",
"T",
"photos_createAlbum",
"(",
"String",
"name",
",",
"String",
"description",
",",
"String",
"location",
")",
"throws",
"FacebookException",
",",
"IOException",
"{",
"assert",
"(",
"null",
"!=",
"name",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"nam... | Creates an album.
@param name The album name.
@param location The album location (optional).
@param description The album description (optional).
@return an array of photo objects. | [
"Creates",
"an",
"album",
"."
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1727-L1738 |
drallgood/jpasskit | jpasskit/src/main/java/de/brendamour/jpasskit/util/CertUtils.java | CertUtils.extractCertificateWithKey | public static ImmutablePair<PrivateKey, X509Certificate> extractCertificateWithKey(KeyStore keyStore, char [] keyStorePassword) {
Assert.notNull(keyStore, "KeyStore is mandatory");
Assert.notNull(keyStorePassword, "Password for key store is mandatory");
try {
Enumeration<String> aliases = keyStore.aliases();
while (aliases.hasMoreElements()) {
String aliasName = aliases.nextElement();
Key key = keyStore.getKey(aliasName, keyStorePassword);
if (key instanceof PrivateKey) {
PrivateKey privateKey = (PrivateKey) key;
Object cert = keyStore.getCertificate(aliasName);
if (cert instanceof X509Certificate) {
X509Certificate certificate = (X509Certificate) cert;
return ImmutablePair.of(privateKey, certificate);
}
}
}
throw new IllegalStateException("No valid key-certificate pair in the key store");
} catch (KeyStoreException | UnrecoverableKeyException | NoSuchAlgorithmException ex) {
throw new IllegalStateException("Failed to extract a valid key-certificate pair from key store", ex);
}
} | java | public static ImmutablePair<PrivateKey, X509Certificate> extractCertificateWithKey(KeyStore keyStore, char [] keyStorePassword) {
Assert.notNull(keyStore, "KeyStore is mandatory");
Assert.notNull(keyStorePassword, "Password for key store is mandatory");
try {
Enumeration<String> aliases = keyStore.aliases();
while (aliases.hasMoreElements()) {
String aliasName = aliases.nextElement();
Key key = keyStore.getKey(aliasName, keyStorePassword);
if (key instanceof PrivateKey) {
PrivateKey privateKey = (PrivateKey) key;
Object cert = keyStore.getCertificate(aliasName);
if (cert instanceof X509Certificate) {
X509Certificate certificate = (X509Certificate) cert;
return ImmutablePair.of(privateKey, certificate);
}
}
}
throw new IllegalStateException("No valid key-certificate pair in the key store");
} catch (KeyStoreException | UnrecoverableKeyException | NoSuchAlgorithmException ex) {
throw new IllegalStateException("Failed to extract a valid key-certificate pair from key store", ex);
}
} | [
"public",
"static",
"ImmutablePair",
"<",
"PrivateKey",
",",
"X509Certificate",
">",
"extractCertificateWithKey",
"(",
"KeyStore",
"keyStore",
",",
"char",
"[",
"]",
"keyStorePassword",
")",
"{",
"Assert",
".",
"notNull",
"(",
"keyStore",
",",
"\"KeyStore is mandato... | Extract a pair of key and certificate from an already loaded {@link KeyStore}.
@param keyStore {@link KeyStore} instance.
@param keyStorePassword password to access the key store.
@return pair of valid {@link PrivateKey} and {@link X509Certificate} loaded from {@code keyStore}
@throws IllegalStateException
If {@link X509Certificate} loading failed. | [
"Extract",
"a",
"pair",
"of",
"key",
"and",
"certificate",
"from",
"an",
"already",
"loaded",
"{",
"@link",
"KeyStore",
"}",
"."
] | train | https://github.com/drallgood/jpasskit/blob/63bfa8abbdb85c2d7596c60eed41ed8e374cbd01/jpasskit/src/main/java/de/brendamour/jpasskit/util/CertUtils.java#L140-L162 |
BlueBrain/bluima | modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java | diff_match_patch.patch_deepCopy | public LinkedList<Patch> patch_deepCopy(LinkedList<Patch> patches) {
LinkedList<Patch> patchesCopy = new LinkedList<Patch>();
for (Patch aPatch : patches) {
Patch patchCopy = new Patch();
for (Diff aDiff : aPatch.diffs) {
Diff diffCopy = new Diff(aDiff.operation, aDiff.text);
patchCopy.diffs.add(diffCopy);
}
patchCopy.start1 = aPatch.start1;
patchCopy.start2 = aPatch.start2;
patchCopy.length1 = aPatch.length1;
patchCopy.length2 = aPatch.length2;
patchesCopy.add(patchCopy);
}
return patchesCopy;
} | java | public LinkedList<Patch> patch_deepCopy(LinkedList<Patch> patches) {
LinkedList<Patch> patchesCopy = new LinkedList<Patch>();
for (Patch aPatch : patches) {
Patch patchCopy = new Patch();
for (Diff aDiff : aPatch.diffs) {
Diff diffCopy = new Diff(aDiff.operation, aDiff.text);
patchCopy.diffs.add(diffCopy);
}
patchCopy.start1 = aPatch.start1;
patchCopy.start2 = aPatch.start2;
patchCopy.length1 = aPatch.length1;
patchCopy.length2 = aPatch.length2;
patchesCopy.add(patchCopy);
}
return patchesCopy;
} | [
"public",
"LinkedList",
"<",
"Patch",
">",
"patch_deepCopy",
"(",
"LinkedList",
"<",
"Patch",
">",
"patches",
")",
"{",
"LinkedList",
"<",
"Patch",
">",
"patchesCopy",
"=",
"new",
"LinkedList",
"<",
"Patch",
">",
"(",
")",
";",
"for",
"(",
"Patch",
"aPat... | Given an array of patches, return another array that is identical.
@param patches
Array of Patch objects.
@return Array of Patch objects. | [
"Given",
"an",
"array",
"of",
"patches",
"return",
"another",
"array",
"that",
"is",
"identical",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java#L2082-L2097 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/list/Interval.java | Interval.fromToBy | public static Interval fromToBy(int from, int to, int stepBy)
{
if (stepBy == 0)
{
throw new IllegalArgumentException("Cannot use a step by of 0");
}
if (from > to && stepBy > 0 || from < to && stepBy < 0)
{
throw new IllegalArgumentException("Step by is incorrect for the range");
}
return new Interval(from, to, stepBy);
} | java | public static Interval fromToBy(int from, int to, int stepBy)
{
if (stepBy == 0)
{
throw new IllegalArgumentException("Cannot use a step by of 0");
}
if (from > to && stepBy > 0 || from < to && stepBy < 0)
{
throw new IllegalArgumentException("Step by is incorrect for the range");
}
return new Interval(from, to, stepBy);
} | [
"public",
"static",
"Interval",
"fromToBy",
"(",
"int",
"from",
",",
"int",
"to",
",",
"int",
"stepBy",
")",
"{",
"if",
"(",
"stepBy",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot use a step by of 0\"",
")",
";",
"}",
"if... | Returns an Interval for the range of integers inclusively between from and to with the specified
stepBy value. | [
"Returns",
"an",
"Interval",
"for",
"the",
"range",
"of",
"integers",
"inclusively",
"between",
"from",
"and",
"to",
"with",
"the",
"specified",
"stepBy",
"value",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L280-L291 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/AwardEmojiApi.java | AwardEmojiApi.deleteIssueAwardEmoji | public void deleteIssueAwardEmoji(Object projectIdOrPath, Integer issueIid, Integer awardId) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null,
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "award_emoji", awardId);
} | java | public void deleteIssueAwardEmoji(Object projectIdOrPath, Integer issueIid, Integer awardId) throws GitLabApiException {
delete(Response.Status.NO_CONTENT, null,
"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "award_emoji", awardId);
} | [
"public",
"void",
"deleteIssueAwardEmoji",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"issueIid",
",",
"Integer",
"awardId",
")",
"throws",
"GitLabApiException",
"{",
"delete",
"(",
"Response",
".",
"Status",
".",
"NO_CONTENT",
",",
"null",
",",
"\"projects... | Delete an award emoji from the specified issue.
<pre><code>GitLab Endpoint: DELETE /projects/:id/issues/:issue_iid/award_emoji/:award_id</code></pre>
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param issueIid the issue IID to delete the award emoji from
@param awardId the ID of the award emoji to delete
@throws GitLabApiException if any exception occurs | [
"Delete",
"an",
"award",
"emoji",
"from",
"the",
"specified",
"issue",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/AwardEmojiApi.java#L239-L242 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableArray.java | MutableArray.insertArray | @NonNull
@Override
public MutableArray insertArray(int index, Array value) {
return insertValue(index, value);
} | java | @NonNull
@Override
public MutableArray insertArray(int index, Array value) {
return insertValue(index, value);
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableArray",
"insertArray",
"(",
"int",
"index",
",",
"Array",
"value",
")",
"{",
"return",
"insertValue",
"(",
"index",
",",
"value",
")",
";",
"}"
] | Inserts an Array object at the given index.
@param index the index. This value must not exceed the bounds of the array.
@param value the Array object
@return The self object | [
"Inserts",
"an",
"Array",
"object",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableArray.java#L540-L544 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/XMLValidator.java | XMLValidator.validateWithDtd | public void validateWithDtd(String filename, String dtdPath, String docType) throws IOException {
try (InputStream xmlStream = this.getClass().getResourceAsStream(filename)) {
if (xmlStream == null) {
throw new IOException("Not found in classpath: " + filename);
}
try {
String xml = StringTools.readStream(xmlStream, "utf-8");
validateInternal(xml, dtdPath, docType);
} catch (Exception e) {
throw new IOException("Cannot load or parse '" + filename + "'", e);
}
}
} | java | public void validateWithDtd(String filename, String dtdPath, String docType) throws IOException {
try (InputStream xmlStream = this.getClass().getResourceAsStream(filename)) {
if (xmlStream == null) {
throw new IOException("Not found in classpath: " + filename);
}
try {
String xml = StringTools.readStream(xmlStream, "utf-8");
validateInternal(xml, dtdPath, docType);
} catch (Exception e) {
throw new IOException("Cannot load or parse '" + filename + "'", e);
}
}
} | [
"public",
"void",
"validateWithDtd",
"(",
"String",
"filename",
",",
"String",
"dtdPath",
",",
"String",
"docType",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"xmlStream",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"... | Validate XML file in classpath with the given DTD. Throws exception on error. | [
"Validate",
"XML",
"file",
"in",
"classpath",
"with",
"the",
"given",
"DTD",
".",
"Throws",
"exception",
"on",
"error",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/XMLValidator.java#L93-L105 |
hmsonline/dropwizard-spring | src/main/java/com/hmsonline/dropwizard/spring/SpringService.java | SpringService.loadWebConfigs | private void loadWebConfigs(Environment environment, SpringConfiguration config, ApplicationContext appCtx) throws ClassNotFoundException {
// Load filters.
loadFilters(config.getFilters(), environment);
// Load servlet listener.
environment.servlets().addServletListeners(new RestContextLoaderListener((XmlRestWebApplicationContext) appCtx));
// Load servlets.
loadServlets(config.getServlets(), environment);
} | java | private void loadWebConfigs(Environment environment, SpringConfiguration config, ApplicationContext appCtx) throws ClassNotFoundException {
// Load filters.
loadFilters(config.getFilters(), environment);
// Load servlet listener.
environment.servlets().addServletListeners(new RestContextLoaderListener((XmlRestWebApplicationContext) appCtx));
// Load servlets.
loadServlets(config.getServlets(), environment);
} | [
"private",
"void",
"loadWebConfigs",
"(",
"Environment",
"environment",
",",
"SpringConfiguration",
"config",
",",
"ApplicationContext",
"appCtx",
")",
"throws",
"ClassNotFoundException",
"{",
"// Load filters.",
"loadFilters",
"(",
"config",
".",
"getFilters",
"(",
")"... | Load filter, servlets or listeners for WebApplicationContext. | [
"Load",
"filter",
"servlets",
"or",
"listeners",
"for",
"WebApplicationContext",
"."
] | train | https://github.com/hmsonline/dropwizard-spring/blob/b0b3ac7b1da3e411cdcc236d352a8b89762fbec1/src/main/java/com/hmsonline/dropwizard/spring/SpringService.java#L81-L90 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipAssert.java | SipAssert.assertRequestReceived | public static void assertRequestReceived(String msg, String method, MessageListener obj) {
assertNotNull("Null assert object passed in", obj);
assertTrue(msg, requestReceived(method, obj));
} | java | public static void assertRequestReceived(String msg, String method, MessageListener obj) {
assertNotNull("Null assert object passed in", obj);
assertTrue(msg, requestReceived(method, obj));
} | [
"public",
"static",
"void",
"assertRequestReceived",
"(",
"String",
"msg",
",",
"String",
"method",
",",
"MessageListener",
"obj",
")",
"{",
"assertNotNull",
"(",
"\"Null assert object passed in\"",
",",
"obj",
")",
";",
"assertTrue",
"(",
"msg",
",",
"requestRece... | Asserts that the given message listener object received a request with the indicated request
method. Assertion failure output includes the given message text.
@param msg message text to output if the assertion fails.
@param method The request method to check for (eg, SipRequest.INVITE)
@param obj The MessageListener object (ie, SipCall, Subscription, etc.). | [
"Asserts",
"that",
"the",
"given",
"message",
"listener",
"object",
"received",
"a",
"request",
"with",
"the",
"indicated",
"request",
"method",
".",
"Assertion",
"failure",
"output",
"includes",
"the",
"given",
"message",
"text",
"."
] | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L442-L445 |
j256/simplejmx | src/main/java/com/j256/simplejmx/client/JmxClient.java | JmxClient.getAttributesInfo | public MBeanAttributeInfo[] getAttributesInfo(ObjectName name) throws JMException {
checkClientConnected();
try {
return mbeanConn.getMBeanInfo(name).getAttributes();
} catch (Exception e) {
throw createJmException("Problems getting bean information from " + name, e);
}
} | java | public MBeanAttributeInfo[] getAttributesInfo(ObjectName name) throws JMException {
checkClientConnected();
try {
return mbeanConn.getMBeanInfo(name).getAttributes();
} catch (Exception e) {
throw createJmException("Problems getting bean information from " + name, e);
}
} | [
"public",
"MBeanAttributeInfo",
"[",
"]",
"getAttributesInfo",
"(",
"ObjectName",
"name",
")",
"throws",
"JMException",
"{",
"checkClientConnected",
"(",
")",
";",
"try",
"{",
"return",
"mbeanConn",
".",
"getMBeanInfo",
"(",
"name",
")",
".",
"getAttributes",
"(... | Return an array of the attributes associated with the bean name. | [
"Return",
"an",
"array",
"of",
"the",
"attributes",
"associated",
"with",
"the",
"bean",
"name",
"."
] | train | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L247-L254 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Short> getAt(short[] array, Collection indices) {
return primitiveArrayGet(array, indices);
} | java | @SuppressWarnings("unchecked")
public static List<Short> getAt(short[] array, Collection indices) {
return primitiveArrayGet(array, indices);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Short",
">",
"getAt",
"(",
"short",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"}"
... | Support the subscript operator with a collection for a short array
@param array a short array
@param indices a collection of indices for the items to retrieve
@return list of the shorts at the given indices
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"short",
"array"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13964-L13967 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/ContentMatcher.java | ContentMatcher.getInstance | public static ContentMatcher getInstance(InputStream xmlInputStream) {
ContentMatcher cm = new ContentMatcher();
// Load the pattern definitions from an XML file
try {
cm.loadXMLPatternDefinitions(xmlInputStream);
} catch (JDOMException | IOException ex) {
throw new IllegalArgumentException("Failed to initialize the ContentMatcher object using that stream", ex);
}
return cm;
} | java | public static ContentMatcher getInstance(InputStream xmlInputStream) {
ContentMatcher cm = new ContentMatcher();
// Load the pattern definitions from an XML file
try {
cm.loadXMLPatternDefinitions(xmlInputStream);
} catch (JDOMException | IOException ex) {
throw new IllegalArgumentException("Failed to initialize the ContentMatcher object using that stream", ex);
}
return cm;
} | [
"public",
"static",
"ContentMatcher",
"getInstance",
"(",
"InputStream",
"xmlInputStream",
")",
"{",
"ContentMatcher",
"cm",
"=",
"new",
"ContentMatcher",
"(",
")",
";",
"// Load the pattern definitions from an XML file\r",
"try",
"{",
"cm",
".",
"loadXMLPatternDefinition... | Direct method for a complete ContentMatcher instance creation.
@param xmlInputStream the stream of the XML file that need to be used for initialization
@return a ContentMatcher instance | [
"Direct",
"method",
"for",
"a",
"complete",
"ContentMatcher",
"instance",
"creation",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/ContentMatcher.java#L75-L87 |
morfologik/morfologik-stemming | morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java | CFSA2Serializer.computeLabelsIndex | private void computeLabelsIndex(final FSA fsa) {
// Compute labels count.
final int[] countByValue = new int[256];
fsa.visitAllStates(new StateVisitor() {
public boolean accept(int state) {
for (int arc = fsa.getFirstArc(state); arc != 0; arc = fsa.getNextArc(arc))
countByValue[fsa.getArcLabel(arc) & 0xff]++;
return true;
}
});
// Order by descending frequency of counts and increasing label value.
Comparator<IntIntHolder> comparator = new Comparator<IntIntHolder>() {
public int compare(IntIntHolder o1, IntIntHolder o2) {
int countDiff = o2.b - o1.b;
if (countDiff == 0) {
countDiff = o1.a - o2.a;
}
return countDiff;
}
};
TreeSet<IntIntHolder> labelAndCount = new TreeSet<IntIntHolder>(comparator);
for (int label = 0; label < countByValue.length; label++) {
if (countByValue[label] > 0) {
labelAndCount.add(new IntIntHolder(label, countByValue[label]));
}
}
labelsIndex = new byte[1 + Math.min(labelAndCount.size(), CFSA2.LABEL_INDEX_SIZE)];
labelsInvIndex = new int[256];
for (int i = labelsIndex.length - 1; i > 0 && !labelAndCount.isEmpty(); i--) {
IntIntHolder p = labelAndCount.first();
labelAndCount.remove(p);
labelsInvIndex[p.a] = i;
labelsIndex[i] = (byte) p.a;
}
} | java | private void computeLabelsIndex(final FSA fsa) {
// Compute labels count.
final int[] countByValue = new int[256];
fsa.visitAllStates(new StateVisitor() {
public boolean accept(int state) {
for (int arc = fsa.getFirstArc(state); arc != 0; arc = fsa.getNextArc(arc))
countByValue[fsa.getArcLabel(arc) & 0xff]++;
return true;
}
});
// Order by descending frequency of counts and increasing label value.
Comparator<IntIntHolder> comparator = new Comparator<IntIntHolder>() {
public int compare(IntIntHolder o1, IntIntHolder o2) {
int countDiff = o2.b - o1.b;
if (countDiff == 0) {
countDiff = o1.a - o2.a;
}
return countDiff;
}
};
TreeSet<IntIntHolder> labelAndCount = new TreeSet<IntIntHolder>(comparator);
for (int label = 0; label < countByValue.length; label++) {
if (countByValue[label] > 0) {
labelAndCount.add(new IntIntHolder(label, countByValue[label]));
}
}
labelsIndex = new byte[1 + Math.min(labelAndCount.size(), CFSA2.LABEL_INDEX_SIZE)];
labelsInvIndex = new int[256];
for (int i = labelsIndex.length - 1; i > 0 && !labelAndCount.isEmpty(); i--) {
IntIntHolder p = labelAndCount.first();
labelAndCount.remove(p);
labelsInvIndex[p.a] = i;
labelsIndex[i] = (byte) p.a;
}
} | [
"private",
"void",
"computeLabelsIndex",
"(",
"final",
"FSA",
"fsa",
")",
"{",
"// Compute labels count.\r",
"final",
"int",
"[",
"]",
"countByValue",
"=",
"new",
"int",
"[",
"256",
"]",
";",
"fsa",
".",
"visitAllStates",
"(",
"new",
"StateVisitor",
"(",
")"... | Compute a set of labels to be integrated with the flags field. | [
"Compute",
"a",
"set",
"of",
"labels",
"to",
"be",
"integrated",
"with",
"the",
"flags",
"field",
"."
] | train | https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/CFSA2Serializer.java#L158-L196 |
openbase/jul | exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java | StackTracePrinter.printAllStackTrackes | @Deprecated
public static void printAllStackTrackes(final String filter, final Logger logger, final LogLevel logLevel) {
printAllStackTraces(filter, logger, logLevel);
} | java | @Deprecated
public static void printAllStackTrackes(final String filter, final Logger logger, final LogLevel logLevel) {
printAllStackTraces(filter, logger, logLevel);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"printAllStackTrackes",
"(",
"final",
"String",
"filter",
",",
"final",
"Logger",
"logger",
",",
"final",
"LogLevel",
"logLevel",
")",
"{",
"printAllStackTraces",
"(",
"filter",
",",
"logger",
",",
"logLevel",
")",
... | Marked as deprecated because of the erroneous name. Call printAllStackTraces instead.
@param filter only thread where the name of the thread contains this given {@code filter} key are printed. If the filter is null, no filtering will be performed.
@param logger the logger used for printing.
@param logLevel the level to print. | [
"Marked",
"as",
"deprecated",
"because",
"of",
"the",
"erroneous",
"name",
".",
"Call",
"printAllStackTraces",
"instead",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/StackTracePrinter.java#L128-L131 |
shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.removeLeft | public static String removeLeft(final String value, final String prefix, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(prefix, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseSensitive) {
return value.startsWith(prefix) ? value.substring(prefix.length()) : value;
}
return value.toLowerCase().startsWith(prefix.toLowerCase()) ? value.substring(prefix.length()) : value;
} | java | public static String removeLeft(final String value, final String prefix, final boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
validate(prefix, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (caseSensitive) {
return value.startsWith(prefix) ? value.substring(prefix.length()) : value;
}
return value.toLowerCase().startsWith(prefix.toLowerCase()) ? value.substring(prefix.length()) : value;
} | [
"public",
"static",
"String",
"removeLeft",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"prefix",
",",
"final",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
... | Returns a new String with the prefix removed, if present.
@param value The input String
@param prefix String to remove on left
@param caseSensitive ensure case sensitivity
@return The String without prefix | [
"Returns",
"a",
"new",
"String",
"with",
"the",
"prefix",
"removed",
"if",
"present",
"."
] | train | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L737-L744 |
apache/incubator-gobblin | gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanJobHelper.java | AzkabanJobHelper.getProjectId | public static String getProjectId(String sessionId, AzkabanProjectConfig azkabanProjectConfig)
throws IOException {
log.info("Getting project Id for project: " + azkabanProjectConfig.getAzkabanProjectName());
String projectId = AzkabanAjaxAPIClient.getProjectId(sessionId, azkabanProjectConfig);
log.info("Project id: " + projectId);
return projectId;
} | java | public static String getProjectId(String sessionId, AzkabanProjectConfig azkabanProjectConfig)
throws IOException {
log.info("Getting project Id for project: " + azkabanProjectConfig.getAzkabanProjectName());
String projectId = AzkabanAjaxAPIClient.getProjectId(sessionId, azkabanProjectConfig);
log.info("Project id: " + projectId);
return projectId;
} | [
"public",
"static",
"String",
"getProjectId",
"(",
"String",
"sessionId",
",",
"AzkabanProjectConfig",
"azkabanProjectConfig",
")",
"throws",
"IOException",
"{",
"log",
".",
"info",
"(",
"\"Getting project Id for project: \"",
"+",
"azkabanProjectConfig",
".",
"getAzkaban... | *
Get Project Id by an Azkaban Project Name.
@param sessionId Session Id.
@param azkabanProjectConfig Azkaban Project Config that contains project Name.
@return Project Id.
@throws IOException | [
"*",
"Get",
"Project",
"Id",
"by",
"an",
"Azkaban",
"Project",
"Name",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanJobHelper.java#L91-L98 |
gallandarakhneorg/afc | core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java | MeasureUnitUtil.fromSeconds | @Pure
public static double fromSeconds(double value, TimeUnit outputUnit) {
switch (outputUnit) {
case DAYS:
return value / 86400.;
case HOURS:
return value / 3600.;
case MINUTES:
return value / 60.;
case SECONDS:
break;
case MILLISECONDS:
return unit2milli(value);
case MICROSECONDS:
return unit2micro(value);
case NANOSECONDS:
return unit2nano(value);
default:
throw new IllegalArgumentException();
}
return value;
} | java | @Pure
public static double fromSeconds(double value, TimeUnit outputUnit) {
switch (outputUnit) {
case DAYS:
return value / 86400.;
case HOURS:
return value / 3600.;
case MINUTES:
return value / 60.;
case SECONDS:
break;
case MILLISECONDS:
return unit2milli(value);
case MICROSECONDS:
return unit2micro(value);
case NANOSECONDS:
return unit2nano(value);
default:
throw new IllegalArgumentException();
}
return value;
} | [
"@",
"Pure",
"public",
"static",
"double",
"fromSeconds",
"(",
"double",
"value",
",",
"TimeUnit",
"outputUnit",
")",
"{",
"switch",
"(",
"outputUnit",
")",
"{",
"case",
"DAYS",
":",
"return",
"value",
"/",
"86400.",
";",
"case",
"HOURS",
":",
"return",
... | Convert the given value expressed in seconds to the given unit.
@param value is the value to convert
@param outputUnit is the unit of result.
@return the result of the convertion. | [
"Convert",
"the",
"given",
"value",
"expressed",
"in",
"seconds",
"to",
"the",
"given",
"unit",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java#L510-L531 |
mnlipp/jgrapes | org.jgrapes.core/src/org/jgrapes/core/internal/ComponentTree.java | ComponentTree.fire | @SuppressWarnings("PMD.UseVarargs")
public void fire(Event<?> event, Channel[] channels) {
eventPipeline.add(event, channels);
} | java | @SuppressWarnings("PMD.UseVarargs")
public void fire(Event<?> event, Channel[] channels) {
eventPipeline.add(event, channels);
} | [
"@",
"SuppressWarnings",
"(",
"\"PMD.UseVarargs\"",
")",
"public",
"void",
"fire",
"(",
"Event",
"<",
"?",
">",
"event",
",",
"Channel",
"[",
"]",
"channels",
")",
"{",
"eventPipeline",
".",
"add",
"(",
"event",
",",
"channels",
")",
";",
"}"
] | Forward to the thread's event manager.
@param event the event
@param channels the channels | [
"Forward",
"to",
"the",
"thread",
"s",
"event",
"manager",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.core/src/org/jgrapes/core/internal/ComponentTree.java#L158-L161 |
diirt/util | src/main/java/org/epics/util/array/ListMath.java | ListMath.rescale | public static ListDouble rescale(final ListNumber data, final double factor, final double offset) {
if (factor == 1.0)
return add(data, offset);
return new ListDouble() {
@Override
public double getDouble(int index) {
return factor * data.getDouble(index) + offset;
}
@Override
public int size() {
return data.size();
}
};
} | java | public static ListDouble rescale(final ListNumber data, final double factor, final double offset) {
if (factor == 1.0)
return add(data, offset);
return new ListDouble() {
@Override
public double getDouble(int index) {
return factor * data.getDouble(index) + offset;
}
@Override
public int size() {
return data.size();
}
};
} | [
"public",
"static",
"ListDouble",
"rescale",
"(",
"final",
"ListNumber",
"data",
",",
"final",
"double",
"factor",
",",
"final",
"double",
"offset",
")",
"{",
"if",
"(",
"factor",
"==",
"1.0",
")",
"return",
"add",
"(",
"data",
",",
"offset",
")",
";",
... | Performs a linear transformation on the data.
@param data A list of numbers
@param factor The multiplicative constant
@param offset The additive constant
@return result[x] = data[x] * factor + offset | [
"Performs",
"a",
"linear",
"transformation",
"on",
"the",
"data",
"."
] | train | https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/array/ListMath.java#L100-L115 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java | StyleCache.setIcon | public boolean setIcon(MarkerOptions markerOptions, IconRow icon) {
return StyleUtils.setIcon(markerOptions, icon, density, iconCache);
} | java | public boolean setIcon(MarkerOptions markerOptions, IconRow icon) {
return StyleUtils.setIcon(markerOptions, icon, density, iconCache);
} | [
"public",
"boolean",
"setIcon",
"(",
"MarkerOptions",
"markerOptions",
",",
"IconRow",
"icon",
")",
"{",
"return",
"StyleUtils",
".",
"setIcon",
"(",
"markerOptions",
",",
"icon",
",",
"density",
",",
"iconCache",
")",
";",
"}"
] | Set the icon into the marker options
@param markerOptions marker options
@param icon icon row
@return true if icon was set into the marker options | [
"Set",
"the",
"icon",
"into",
"the",
"marker",
"options"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java#L177-L179 |
TheHortonMachine/hortonmachine | hmachine/src/main/java/org/hortonmachine/hmachine/modules/hydrogeomorphology/riversections/RiverSectionsFromDtmExtractor.java | RiverSectionsFromDtmExtractor.getNetworkPoint | private RiverPoint getNetworkPoint( LineString riverLine, RandomIter elevIter, GridGeometry2D gridGeometry,
double progressiveDistance, Double ks, Coordinate leftPoint, Coordinate rightPoint ) throws TransformException {
List<ProfilePoint> sectionPoints = CoverageUtilities.doProfile(elevIter, gridGeometry, rightPoint, leftPoint);
List<Coordinate> coordinate3dList = new ArrayList<Coordinate>();
for( ProfilePoint sectionPoint : sectionPoints ) {
Coordinate position = sectionPoint.getPosition();
position.z = sectionPoint.getElevation();
coordinate3dList.add(position);
}
LineString sectionLine3d = gf.createLineString(coordinate3dList.toArray(new Coordinate[0]));
Geometry crossPoint = sectionLine3d.intersection(riverLine);
Coordinate coordinate = crossPoint.getCoordinate();
if (coordinate == null) {
return null;
}
int[] colRow = CoverageUtilities.colRowFromCoordinate(coordinate, gridGeometry, null);
double elev = elevIter.getSampleDouble(colRow[0], colRow[1], 0);
coordinate.z = elev;
RiverPoint netPoint = new RiverPoint(coordinate, progressiveDistance, sectionLine3d, ks);
return netPoint;
} | java | private RiverPoint getNetworkPoint( LineString riverLine, RandomIter elevIter, GridGeometry2D gridGeometry,
double progressiveDistance, Double ks, Coordinate leftPoint, Coordinate rightPoint ) throws TransformException {
List<ProfilePoint> sectionPoints = CoverageUtilities.doProfile(elevIter, gridGeometry, rightPoint, leftPoint);
List<Coordinate> coordinate3dList = new ArrayList<Coordinate>();
for( ProfilePoint sectionPoint : sectionPoints ) {
Coordinate position = sectionPoint.getPosition();
position.z = sectionPoint.getElevation();
coordinate3dList.add(position);
}
LineString sectionLine3d = gf.createLineString(coordinate3dList.toArray(new Coordinate[0]));
Geometry crossPoint = sectionLine3d.intersection(riverLine);
Coordinate coordinate = crossPoint.getCoordinate();
if (coordinate == null) {
return null;
}
int[] colRow = CoverageUtilities.colRowFromCoordinate(coordinate, gridGeometry, null);
double elev = elevIter.getSampleDouble(colRow[0], colRow[1], 0);
coordinate.z = elev;
RiverPoint netPoint = new RiverPoint(coordinate, progressiveDistance, sectionLine3d, ks);
return netPoint;
} | [
"private",
"RiverPoint",
"getNetworkPoint",
"(",
"LineString",
"riverLine",
",",
"RandomIter",
"elevIter",
",",
"GridGeometry2D",
"gridGeometry",
",",
"double",
"progressiveDistance",
",",
"Double",
"ks",
",",
"Coordinate",
"leftPoint",
",",
"Coordinate",
"rightPoint",
... | Extract a {@link RiverPoint}.
@param riverLine the geometry of the main river.
@param elevIter the elevation raster.
@param gridGeometry the raster geometry.
@param progressiveDistance the progressive distance along the main river.
@param ks the KS for the section.
@param leftPoint the left point of the section.
@param rightPoint the right point of the section.
@return the created {@link RiverPoint}.
@throws TransformException | [
"Extract",
"a",
"{",
"@link",
"RiverPoint",
"}",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/hydrogeomorphology/riversections/RiverSectionsFromDtmExtractor.java#L254-L274 |
airbnb/lottie-android | lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java | LottieCompositionFactory.fromJsonInputStreamSync | @WorkerThread
public static LottieResult<LottieComposition> fromJsonInputStreamSync(InputStream stream, @Nullable String cacheKey) {
return fromJsonInputStreamSync(stream, cacheKey, true);
} | java | @WorkerThread
public static LottieResult<LottieComposition> fromJsonInputStreamSync(InputStream stream, @Nullable String cacheKey) {
return fromJsonInputStreamSync(stream, cacheKey, true);
} | [
"@",
"WorkerThread",
"public",
"static",
"LottieResult",
"<",
"LottieComposition",
">",
"fromJsonInputStreamSync",
"(",
"InputStream",
"stream",
",",
"@",
"Nullable",
"String",
"cacheKey",
")",
"{",
"return",
"fromJsonInputStreamSync",
"(",
"stream",
",",
"cacheKey",
... | Return a LottieComposition for the given InputStream to json. | [
"Return",
"a",
"LottieComposition",
"for",
"the",
"given",
"InputStream",
"to",
"json",
"."
] | train | https://github.com/airbnb/lottie-android/blob/126dabdc9f586c87822f85fe1128cdad439d30fa/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java#L168-L171 |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/SystemUtil.java | SystemUtil.formatBytesHumanReadable | public static String formatBytesHumanReadable(long _bytes, boolean _use1000BytesPerMb) {
int unit = _use1000BytesPerMb ? 1000 : 1024;
if (_bytes < unit) {
return _bytes + " B";
}
int exp = (int) (Math.log(_bytes) / Math.log(unit));
String pre = (_use1000BytesPerMb ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (_use1000BytesPerMb ? "" : "i");
return String.format("%.1f %sB", _bytes / Math.pow(unit, exp), pre);
} | java | public static String formatBytesHumanReadable(long _bytes, boolean _use1000BytesPerMb) {
int unit = _use1000BytesPerMb ? 1000 : 1024;
if (_bytes < unit) {
return _bytes + " B";
}
int exp = (int) (Math.log(_bytes) / Math.log(unit));
String pre = (_use1000BytesPerMb ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (_use1000BytesPerMb ? "" : "i");
return String.format("%.1f %sB", _bytes / Math.pow(unit, exp), pre);
} | [
"public",
"static",
"String",
"formatBytesHumanReadable",
"(",
"long",
"_bytes",
",",
"boolean",
"_use1000BytesPerMb",
")",
"{",
"int",
"unit",
"=",
"_use1000BytesPerMb",
"?",
"1000",
":",
"1024",
";",
"if",
"(",
"_bytes",
"<",
"unit",
")",
"{",
"return",
"_... | Formats a file size given in byte to something human readable.
@param _bytes size in bytes
@param _use1000BytesPerMb use 1000 bytes per MByte instead of 1024
@return String | [
"Formats",
"a",
"file",
"size",
"given",
"in",
"byte",
"to",
"something",
"human",
"readable",
"."
] | train | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/SystemUtil.java#L329-L337 |
kaazing/gateway | transport/spi/src/main/java/org/kaazing/gateway/transport/AbstractBridgeAcceptor.java | AbstractBridgeAcceptor.bind | @Override
public /*final*/ void bind(ResourceAddress address, IoHandler handler, BridgeSessionInitializer<? extends IoFuture> initializer) {
// bind only address with matching scheme
URI location = address.getResource();
String schemeName = location.getScheme();
if (!canBind(schemeName)) {
throw new IllegalArgumentException(format("Unexpected scheme \"%s\" for URI: %s", schemeName, location));
}
if (!started.get()) {
synchronized (started) {
if (!started.get()) {
init();
started.set(true);
}
}
}
boolean bindAlternate;
do {
bindAlternate = address.getOption(BIND_ALTERNATE);
//
// add binding, expecting no clashing (according to BINDINGS_COMPARATOR)
//
Binding newBinding = new Binding(address, handler, initializer);
Binding oldBinding = bindings.addBinding(newBinding);
//System.out.println(getClass().getSimpleName()+"@"+hashCode()+" binding: "+address.getExternalURI()+" -- "+address.getOption(NEXT_PROTOCOL));
if (oldBinding != null) {
throw new RuntimeException("Unable to bind address " + address
+ " because it collides with an already bound address " + oldBinding.bindAddress());
}
bindInternal(address, handler, initializer);
address = address.getOption(ALTERNATE);
} while (address != null && bindAlternate);
} | java | @Override
public /*final*/ void bind(ResourceAddress address, IoHandler handler, BridgeSessionInitializer<? extends IoFuture> initializer) {
// bind only address with matching scheme
URI location = address.getResource();
String schemeName = location.getScheme();
if (!canBind(schemeName)) {
throw new IllegalArgumentException(format("Unexpected scheme \"%s\" for URI: %s", schemeName, location));
}
if (!started.get()) {
synchronized (started) {
if (!started.get()) {
init();
started.set(true);
}
}
}
boolean bindAlternate;
do {
bindAlternate = address.getOption(BIND_ALTERNATE);
//
// add binding, expecting no clashing (according to BINDINGS_COMPARATOR)
//
Binding newBinding = new Binding(address, handler, initializer);
Binding oldBinding = bindings.addBinding(newBinding);
//System.out.println(getClass().getSimpleName()+"@"+hashCode()+" binding: "+address.getExternalURI()+" -- "+address.getOption(NEXT_PROTOCOL));
if (oldBinding != null) {
throw new RuntimeException("Unable to bind address " + address
+ " because it collides with an already bound address " + oldBinding.bindAddress());
}
bindInternal(address, handler, initializer);
address = address.getOption(ALTERNATE);
} while (address != null && bindAlternate);
} | [
"@",
"Override",
"public",
"/*final*/",
"void",
"bind",
"(",
"ResourceAddress",
"address",
",",
"IoHandler",
"handler",
",",
"BridgeSessionInitializer",
"<",
"?",
"extends",
"IoFuture",
">",
"initializer",
")",
"{",
"// bind only address with matching scheme",
"URI",
... | note: relax final for WebSocket balancer initializer (temporary) | [
"note",
":",
"relax",
"final",
"for",
"WebSocket",
"balancer",
"initializer",
"(",
"temporary",
")"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/AbstractBridgeAcceptor.java#L94-L133 |
jayantk/jklol | src/com/jayantkrish/jklol/models/AbstractFactorGraphBuilder.java | AbstractFactorGraphBuilder.addConstantFactor | public void addConstantFactor(String factorName, PlateFactor factor) {
constantFactors.add(factor);
constantFactorNames.add(factorName);
} | java | public void addConstantFactor(String factorName, PlateFactor factor) {
constantFactors.add(factor);
constantFactorNames.add(factorName);
} | [
"public",
"void",
"addConstantFactor",
"(",
"String",
"factorName",
",",
"PlateFactor",
"factor",
")",
"{",
"constantFactors",
".",
"add",
"(",
"factor",
")",
";",
"constantFactorNames",
".",
"add",
"(",
"factorName",
")",
";",
"}"
] | Adds an unparameterized, dynamically-instantiated factor to the
model under construction.
@param factor | [
"Adds",
"an",
"unparameterized",
"dynamically",
"-",
"instantiated",
"factor",
"to",
"the",
"model",
"under",
"construction",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/AbstractFactorGraphBuilder.java#L95-L98 |
morimekta/utils | diff-util/src/main/java/net/morimekta/diff/DiffBase.java | DiffBase.toDelta | public String toDelta() {
StringBuilder text = new StringBuilder();
for (Change aDiff : getChangeList()) {
switch (aDiff.operation) {
case INSERT:
try {
text.append("+").append(URLEncoder.encode(aDiff.text, "UTF-8")
.replace('+', ' ')).append("\t");
} catch (UnsupportedEncodingException e) {
// Not likely on modern system.
throw new Error("This system does not support UTF-8.", e);
}
break;
case DELETE:
text.append("-").append(aDiff.text.length()).append("\t");
break;
case EQUAL:
text.append("=").append(aDiff.text.length()).append("\t");
break;
}
}
String delta = text.toString();
if (delta.length() != 0) {
// Strip off trailing tab character.
delta = delta.substring(0, delta.length() - 1);
delta = Strings.unescapeForEncodeUriCompatability(delta);
}
return delta;
} | java | public String toDelta() {
StringBuilder text = new StringBuilder();
for (Change aDiff : getChangeList()) {
switch (aDiff.operation) {
case INSERT:
try {
text.append("+").append(URLEncoder.encode(aDiff.text, "UTF-8")
.replace('+', ' ')).append("\t");
} catch (UnsupportedEncodingException e) {
// Not likely on modern system.
throw new Error("This system does not support UTF-8.", e);
}
break;
case DELETE:
text.append("-").append(aDiff.text.length()).append("\t");
break;
case EQUAL:
text.append("=").append(aDiff.text.length()).append("\t");
break;
}
}
String delta = text.toString();
if (delta.length() != 0) {
// Strip off trailing tab character.
delta = delta.substring(0, delta.length() - 1);
delta = Strings.unescapeForEncodeUriCompatability(delta);
}
return delta;
} | [
"public",
"String",
"toDelta",
"(",
")",
"{",
"StringBuilder",
"text",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Change",
"aDiff",
":",
"getChangeList",
"(",
")",
")",
"{",
"switch",
"(",
"aDiff",
".",
"operation",
")",
"{",
"case",
"INS... | Crush the diff into an encoded string which describes the operations
required to transform text1 into text2.
E.g. "=3\t-2\t+ing" -> Keep 3 chars, delete 2 chars, insert 'ing'.
Operations are tab-separated. Inserted text is escaped using %xx notation.
@return Delta text. | [
"Crush",
"the",
"diff",
"into",
"an",
"encoded",
"string",
"which",
"describes",
"the",
"operations",
"required",
"to",
"transform",
"text1",
"into",
"text2",
".",
"E",
".",
"g",
".",
"=",
"3",
"\\",
"t",
"-",
"2",
"\\",
"t",
"+",
"ing",
"-",
">",
... | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/diff-util/src/main/java/net/morimekta/diff/DiffBase.java#L181-L209 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsStaticExportManager.java | CmsStaticExportManager.readResource | protected CmsStaticExportData readResource(CmsObject cms, String uri) throws CmsException {
CmsResource resource = null;
boolean isDetailPage = false;
try {
resource = cms.readResource(uri);
} catch (CmsVfsResourceNotFoundException e) {
String urlName = CmsResource.getName(uri).replaceAll("/$", "");
CmsUUID id = cms.readIdForUrlName(urlName);
if (id == null) {
throw e;
}
resource = cms.readResource(id);
isDetailPage = true;
//String parent = CmsResource.getParentFolder(uri);
//resource = cms.readDefaultFile(parent);
}
CmsStaticExportData result = new CmsStaticExportData(uri, null, resource, null);
result.setIsDetailPage(isDetailPage);
return result;
} | java | protected CmsStaticExportData readResource(CmsObject cms, String uri) throws CmsException {
CmsResource resource = null;
boolean isDetailPage = false;
try {
resource = cms.readResource(uri);
} catch (CmsVfsResourceNotFoundException e) {
String urlName = CmsResource.getName(uri).replaceAll("/$", "");
CmsUUID id = cms.readIdForUrlName(urlName);
if (id == null) {
throw e;
}
resource = cms.readResource(id);
isDetailPage = true;
//String parent = CmsResource.getParentFolder(uri);
//resource = cms.readDefaultFile(parent);
}
CmsStaticExportData result = new CmsStaticExportData(uri, null, resource, null);
result.setIsDetailPage(isDetailPage);
return result;
} | [
"protected",
"CmsStaticExportData",
"readResource",
"(",
"CmsObject",
"cms",
",",
"String",
"uri",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"null",
";",
"boolean",
"isDetailPage",
"=",
"false",
";",
"try",
"{",
"resource",
"=",
"cms",
... | Reads the resource with the given URI.<p>
@param cms the current CMS context
@param uri the URI to check
@return the resource export data
@throws CmsException if soemthing goes wrong | [
"Reads",
"the",
"resource",
"with",
"the",
"given",
"URI",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L2785-L2808 |
belaban/JGroups | src/org/jgroups/protocols/pbcast/ClientGmsImpl.java | ClientGmsImpl.installView | private boolean installView(View new_view, Digest digest) {
if(!new_view.containsMember(gms.local_addr)) {
log.error("%s: I'm not member of %s, will not install view", gms.local_addr, new_view);
return false;
}
gms.installView(new_view, digest);
if(gms.impl == null || gms.impl instanceof ClientGmsImpl) // installView() should have set the role (impl)
gms.becomeParticipant();
gms.getUpProtocol().up(new Event(Event.BECOME_SERVER));
gms.getDownProtocol().down(new Event(Event.BECOME_SERVER));
return true;
} | java | private boolean installView(View new_view, Digest digest) {
if(!new_view.containsMember(gms.local_addr)) {
log.error("%s: I'm not member of %s, will not install view", gms.local_addr, new_view);
return false;
}
gms.installView(new_view, digest);
if(gms.impl == null || gms.impl instanceof ClientGmsImpl) // installView() should have set the role (impl)
gms.becomeParticipant();
gms.getUpProtocol().up(new Event(Event.BECOME_SERVER));
gms.getDownProtocol().down(new Event(Event.BECOME_SERVER));
return true;
} | [
"private",
"boolean",
"installView",
"(",
"View",
"new_view",
",",
"Digest",
"digest",
")",
"{",
"if",
"(",
"!",
"new_view",
".",
"containsMember",
"(",
"gms",
".",
"local_addr",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"%s: I'm not member of %s, will not in... | Called by join(). Installs the view returned by calling Coord.handleJoin() and becomes coordinator. | [
"Called",
"by",
"join",
"()",
".",
"Installs",
"the",
"view",
"returned",
"by",
"calling",
"Coord",
".",
"handleJoin",
"()",
"and",
"becomes",
"coordinator",
"."
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ClientGmsImpl.java#L206-L217 |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/ExpressionValidator.java | ExpressionValidator.resolveBooleanExpression | boolean resolveBooleanExpression(String expression, Entity entity) {
return resolveBooleanExpressions(singletonList(expression), entity).get(0);
} | java | boolean resolveBooleanExpression(String expression, Entity entity) {
return resolveBooleanExpressions(singletonList(expression), entity).get(0);
} | [
"boolean",
"resolveBooleanExpression",
"(",
"String",
"expression",
",",
"Entity",
"entity",
")",
"{",
"return",
"resolveBooleanExpressions",
"(",
"singletonList",
"(",
"expression",
")",
",",
"entity",
")",
".",
"get",
"(",
"0",
")",
";",
"}"
] | Resolves a boolean expression (validation or visible expression)
@param expression JavaScript expression
@param entity entity used during expression evaluation
@return <code>true</code> or <code>false</code>
@throws MolgenisDataException if the script resolves to null or to a non boolean | [
"Resolves",
"a",
"boolean",
"expression",
"(",
"validation",
"or",
"visible",
"expression",
")"
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/ExpressionValidator.java#L37-L39 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Orderer.java | Orderer.sendTransaction | Ab.BroadcastResponse sendTransaction(Common.Envelope transaction) throws Exception {
if (shutdown) {
throw new TransactionException(format("Orderer %s was shutdown.", name));
}
logger.debug(format("Orderer.sendTransaction %s", toString()));
OrdererClient localOrdererClient = getOrdererClient();
try {
return localOrdererClient.sendTransaction(transaction);
} catch (Throwable t) {
removeOrdererClient(true);
throw t;
}
} | java | Ab.BroadcastResponse sendTransaction(Common.Envelope transaction) throws Exception {
if (shutdown) {
throw new TransactionException(format("Orderer %s was shutdown.", name));
}
logger.debug(format("Orderer.sendTransaction %s", toString()));
OrdererClient localOrdererClient = getOrdererClient();
try {
return localOrdererClient.sendTransaction(transaction);
} catch (Throwable t) {
removeOrdererClient(true);
throw t;
}
} | [
"Ab",
".",
"BroadcastResponse",
"sendTransaction",
"(",
"Common",
".",
"Envelope",
"transaction",
")",
"throws",
"Exception",
"{",
"if",
"(",
"shutdown",
")",
"{",
"throw",
"new",
"TransactionException",
"(",
"format",
"(",
"\"Orderer %s was shutdown.\"",
",",
"na... | Send transaction to Order
@param transaction transaction to be sent | [
"Send",
"transaction",
"to",
"Order"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Orderer.java#L151-L168 |
liferay/com-liferay-commerce | commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java | CommerceCurrencyPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommerceCurrency commerceCurrency : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceCurrency);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommerceCurrency commerceCurrency : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceCurrency);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CommerceCurrency",
"commerceCurrency",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"Quer... | Removes all the commerce currencies where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"commerce",
"currencies",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L1403-L1409 |
meltmedia/cadmium | cli/src/main/java/com/meltmedia/cadmium/cli/ValidateCommand.java | ValidateCommand.addCurrentDirFiles | private void addCurrentDirFiles(List<File> theFiles, List<File> theDirs, File currentDir) {
File dirs[] = currentDir.listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return file.isDirectory() && !file.getName().startsWith(".") && !file.getName().equals("META-INF");
}
});
File htmlFiles[] = currentDir.listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return !file.isDirectory() && file.isFile() && file.canRead() && !file.getName().startsWith(".") && (file.getName().endsWith(".html") || file.getName().endsWith(".htm"));
}
});
if(dirs != null && dirs.length > 0) {
theDirs.addAll(Arrays.asList(dirs));
}
if(htmlFiles != null && htmlFiles.length > 0) {
theFiles.addAll(Arrays.asList(htmlFiles));
}
} | java | private void addCurrentDirFiles(List<File> theFiles, List<File> theDirs, File currentDir) {
File dirs[] = currentDir.listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return file.isDirectory() && !file.getName().startsWith(".") && !file.getName().equals("META-INF");
}
});
File htmlFiles[] = currentDir.listFiles(new FileFilter() {
@Override
public boolean accept(File file) {
return !file.isDirectory() && file.isFile() && file.canRead() && !file.getName().startsWith(".") && (file.getName().endsWith(".html") || file.getName().endsWith(".htm"));
}
});
if(dirs != null && dirs.length > 0) {
theDirs.addAll(Arrays.asList(dirs));
}
if(htmlFiles != null && htmlFiles.length > 0) {
theFiles.addAll(Arrays.asList(htmlFiles));
}
} | [
"private",
"void",
"addCurrentDirFiles",
"(",
"List",
"<",
"File",
">",
"theFiles",
",",
"List",
"<",
"File",
">",
"theDirs",
",",
"File",
"currentDir",
")",
"{",
"File",
"dirs",
"[",
"]",
"=",
"currentDir",
".",
"listFiles",
"(",
"new",
"FileFilter",
"(... | Adds all html files to the list passed in.
@param theFiles The list to populate with the current directory's html files.
@param theDirs The list to populate with the current directory's child directories.
@param currentDir The current directory. | [
"Adds",
"all",
"html",
"files",
"to",
"the",
"list",
"passed",
"in",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/ValidateCommand.java#L116-L141 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/MaxSATSolver.java | MaxSATSolver.addSoftFormula | public void addSoftFormula(final Formula formula, int weight) {
if (this.result != UNDEF)
throw new IllegalStateException("The MaxSAT solver does currently not support an incremental interface. Reset the solver.");
if (weight < 1)
throw new IllegalArgumentException("The weight of a formula must be > 0");
this.addCNF(formula.cnf(), weight);
} | java | public void addSoftFormula(final Formula formula, int weight) {
if (this.result != UNDEF)
throw new IllegalStateException("The MaxSAT solver does currently not support an incremental interface. Reset the solver.");
if (weight < 1)
throw new IllegalArgumentException("The weight of a formula must be > 0");
this.addCNF(formula.cnf(), weight);
} | [
"public",
"void",
"addSoftFormula",
"(",
"final",
"Formula",
"formula",
",",
"int",
"weight",
")",
"{",
"if",
"(",
"this",
".",
"result",
"!=",
"UNDEF",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"The MaxSAT solver does currently not support an incremental i... | Adds a new soft formula to the solver.
@param formula the formula
@param weight the weight
@throws IllegalStateException if a formula is added to a solver which is already solved.
@throws IllegalArgumentException if the weight is <1 | [
"Adds",
"a",
"new",
"soft",
"formula",
"to",
"the",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MaxSATSolver.java#L234-L240 |
javagl/ND | nd-arrays/src/main/java/de/javagl/nd/arrays/Utils.java | Utils.checkForEqualDimensions | public static void checkForEqualDimensions(ArrayND a0, ArrayND a1)
{
if (a0.getSize().getSize() != a1.getSize().getSize())
{
throw new IllegalArgumentException(
"Arrays have different dimensions: "+a0.getSize().getSize()+
" and "+a1.getSize().getSize());
}
} | java | public static void checkForEqualDimensions(ArrayND a0, ArrayND a1)
{
if (a0.getSize().getSize() != a1.getSize().getSize())
{
throw new IllegalArgumentException(
"Arrays have different dimensions: "+a0.getSize().getSize()+
" and "+a1.getSize().getSize());
}
} | [
"public",
"static",
"void",
"checkForEqualDimensions",
"(",
"ArrayND",
"a0",
",",
"ArrayND",
"a1",
")",
"{",
"if",
"(",
"a0",
".",
"getSize",
"(",
")",
".",
"getSize",
"(",
")",
"!=",
"a1",
".",
"getSize",
"(",
")",
".",
"getSize",
"(",
")",
")",
"... | Checks whether given given {@link ArrayND}s have equal dimensions,
and throws an <code>IllegalArgumentException</code> if not.
@param a0 The first array
@param a1 The second array
@throws NullPointerException If any argument is <code>null</code>
@throws IllegalArgumentException If the given arrays
do not have equal dimensions | [
"Checks",
"whether",
"given",
"given",
"{",
"@link",
"ArrayND",
"}",
"s",
"have",
"equal",
"dimensions",
"and",
"throws",
"an",
"<code",
">",
"IllegalArgumentException<",
"/",
"code",
">",
"if",
"not",
"."
] | train | https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-arrays/src/main/java/de/javagl/nd/arrays/Utils.java#L49-L57 |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/iter/Generators.java | Generators.byHourGenerator | static Generator byHourGenerator(int[] hours, final DateValue dtStart) {
final TimeValue dtStartTime = TimeUtils.timeOf(dtStart);
final int[] uhours = (hours.length == 0) ? new int[] { dtStartTime.hour() } : Util.uniquify(hours);
if (uhours.length == 1) {
final int hour = uhours[0];
return new SingleValueGenerator() {
int year;
int month;
int day;
@Override
boolean generate(DTBuilder builder) {
if (year != builder.year || month != builder.month || day != builder.day) {
year = builder.year;
month = builder.month;
day = builder.day;
builder.hour = hour;
return true;
}
return false;
}
@Override
int getValue() {
return hour;
}
@Override
public String toString() {
return "byHourGenerator:" + hour;
}
};
}
return new Generator() {
int i;
int year = dtStart.year();
int month = dtStart.month();
int day = dtStart.day();
{
int hour = dtStartTime.hour();
while (i < uhours.length && uhours[i] < hour) {
++i;
}
}
@Override
boolean generate(DTBuilder builder) {
if (year != builder.year || month != builder.month || day != builder.day) {
i = 0;
year = builder.year;
month = builder.month;
day = builder.day;
}
if (i >= uhours.length) {
return false;
}
builder.hour = uhours[i++];
return true;
}
@Override
public String toString() {
return "byHourGenerator:" + Arrays.toString(uhours);
}
};
} | java | static Generator byHourGenerator(int[] hours, final DateValue dtStart) {
final TimeValue dtStartTime = TimeUtils.timeOf(dtStart);
final int[] uhours = (hours.length == 0) ? new int[] { dtStartTime.hour() } : Util.uniquify(hours);
if (uhours.length == 1) {
final int hour = uhours[0];
return new SingleValueGenerator() {
int year;
int month;
int day;
@Override
boolean generate(DTBuilder builder) {
if (year != builder.year || month != builder.month || day != builder.day) {
year = builder.year;
month = builder.month;
day = builder.day;
builder.hour = hour;
return true;
}
return false;
}
@Override
int getValue() {
return hour;
}
@Override
public String toString() {
return "byHourGenerator:" + hour;
}
};
}
return new Generator() {
int i;
int year = dtStart.year();
int month = dtStart.month();
int day = dtStart.day();
{
int hour = dtStartTime.hour();
while (i < uhours.length && uhours[i] < hour) {
++i;
}
}
@Override
boolean generate(DTBuilder builder) {
if (year != builder.year || month != builder.month || day != builder.day) {
i = 0;
year = builder.year;
month = builder.month;
day = builder.day;
}
if (i >= uhours.length) {
return false;
}
builder.hour = uhours[i++];
return true;
}
@Override
public String toString() {
return "byHourGenerator:" + Arrays.toString(uhours);
}
};
} | [
"static",
"Generator",
"byHourGenerator",
"(",
"int",
"[",
"]",
"hours",
",",
"final",
"DateValue",
"dtStart",
")",
"{",
"final",
"TimeValue",
"dtStartTime",
"=",
"TimeUtils",
".",
"timeOf",
"(",
"dtStart",
")",
";",
"final",
"int",
"[",
"]",
"uhours",
"="... | Constructs a generator that yields the specified hours in increasing
order for each day.
@param hours the hour values (each value must be in range [0,23])
@param dtStart the start date
@return the generator | [
"Constructs",
"a",
"generator",
"that",
"yields",
"the",
"specified",
"hours",
"in",
"increasing",
"order",
"for",
"each",
"day",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/Generators.java#L470-L538 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java | RenameFileExtensions.changeFilenameSuffix | public static boolean changeFilenameSuffix(final File file, final String newSuffix)
throws FileNotRenamedException, FileDoesNotExistException, IOException,
FileIsADirectoryException
{
return changeFilenameSuffix(file, newSuffix, false);
} | java | public static boolean changeFilenameSuffix(final File file, final String newSuffix)
throws FileNotRenamedException, FileDoesNotExistException, IOException,
FileIsADirectoryException
{
return changeFilenameSuffix(file, newSuffix, false);
} | [
"public",
"static",
"boolean",
"changeFilenameSuffix",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"newSuffix",
")",
"throws",
"FileNotRenamedException",
",",
"FileDoesNotExistException",
",",
"IOException",
",",
"FileIsADirectoryException",
"{",
"return",
"ch... | Changes the suffix from the Filename. Example: test.dat to test.xxx
@param file
The file to change.
@param newSuffix
The new suffix. You must start with a dot. For instance: .xxx
@return true if the file was renamed.
@throws FileNotRenamedException
If the file could not renamed.
@throws FileDoesNotExistException
If the file does not exist.
@throws IOException
Signals that an I/O exception has occurred.
@throws FileIsADirectoryException
the file is A directory exception | [
"Changes",
"the",
"suffix",
"from",
"the",
"Filename",
".",
"Example",
":",
"test",
".",
"dat",
"to",
"test",
".",
"xxx"
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L192-L197 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/MessageHeader.java | MessageHeader.setIfNotSet | public synchronized void setIfNotSet(String k, String v) {
if (findValue(k) == null) {
add(k, v);
}
} | java | public synchronized void setIfNotSet(String k, String v) {
if (findValue(k) == null) {
add(k, v);
}
} | [
"public",
"synchronized",
"void",
"setIfNotSet",
"(",
"String",
"k",
",",
"String",
"v",
")",
"{",
"if",
"(",
"findValue",
"(",
"k",
")",
"==",
"null",
")",
"{",
"add",
"(",
"k",
",",
"v",
")",
";",
"}",
"}"
] | Set's the value of a key only if there is no
key with that value already. | [
"Set",
"s",
"the",
"value",
"of",
"a",
"key",
"only",
"if",
"there",
"is",
"no",
"key",
"with",
"that",
"value",
"already",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/MessageHeader.java#L403-L407 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Project.java | Project.createRequest | public Request createRequest(String name, Map<String, Object> attributes) {
return getInstance().create().request(name, this, attributes);
} | java | public Request createRequest(String name, Map<String, Object> attributes) {
return getInstance().create().request(name, this, attributes);
} | [
"public",
"Request",
"createRequest",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"return",
"getInstance",
"(",
")",
".",
"create",
"(",
")",
".",
"request",
"(",
"name",
",",
"this",
",",
"attributes",
... | Create a new Request in this Project.
@param name The initial name of the Request.
@param attributes additional attributes for the Request.
@return A new Request. | [
"Create",
"a",
"new",
"Request",
"in",
"this",
"Project",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Project.java#L293-L295 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/FrameScreen.java | FrameScreen.doCommand | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if (strCommand.equalsIgnoreCase(ThinMenuConstants.CLOSE))
{
this.free();
return true;
}
return super.doCommand(strCommand, sourceSField, iCommandOptions);
} | java | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if (strCommand.equalsIgnoreCase(ThinMenuConstants.CLOSE))
{
this.free();
return true;
}
return super.doCommand(strCommand, sourceSField, iCommandOptions);
} | [
"public",
"boolean",
"doCommand",
"(",
"String",
"strCommand",
",",
"ScreenField",
"sourceSField",
",",
"int",
"iCommandOptions",
")",
"{",
"if",
"(",
"strCommand",
".",
"equalsIgnoreCase",
"(",
"ThinMenuConstants",
".",
"CLOSE",
")",
")",
"{",
"this",
".",
"f... | Process the command.
Step 1 - Process the command if possible and return true if processed.
Step 2 - If I can't process, pass to all children (with me as the source).
Step 3 - If children didn't process, pass to parent (with me as the source).
Note: Never pass to a parent or child the matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param iCommandOptions If this command creates a new screen, create in a new window?
@param true if success. | [
"Process",
"the",
"command",
".",
"Step",
"1",
"-",
"Process",
"the",
"command",
"if",
"possible",
"and",
"return",
"true",
"if",
"processed",
".",
"Step",
"2",
"-",
"If",
"I",
"can",
"t",
"process",
"pass",
"to",
"all",
"children",
"(",
"with",
"me",
... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/FrameScreen.java#L90-L98 |
alkacon/opencms-core | src/org/opencms/main/OpenCmsUrlServletFilter.java | OpenCmsUrlServletFilter.createRegex | static String createRegex(String contextPath, String[] defaultExcludePrefixes, String additionalExcludePrefixes) {
StringBuffer regex = new StringBuffer();
regex.append(contextPath);
regex.append('(');
regex.append(defaultExcludePrefixes[0]);
for (int i = 1; i < defaultExcludePrefixes.length; i++) {
regex.append('|').append(defaultExcludePrefixes[i]);
}
if (!((null == additionalExcludePrefixes) || additionalExcludePrefixes.isEmpty())) {
regex.append('|').append(additionalExcludePrefixes);
}
regex.append(')');
regex.append(".*");
return regex.toString();
} | java | static String createRegex(String contextPath, String[] defaultExcludePrefixes, String additionalExcludePrefixes) {
StringBuffer regex = new StringBuffer();
regex.append(contextPath);
regex.append('(');
regex.append(defaultExcludePrefixes[0]);
for (int i = 1; i < defaultExcludePrefixes.length; i++) {
regex.append('|').append(defaultExcludePrefixes[i]);
}
if (!((null == additionalExcludePrefixes) || additionalExcludePrefixes.isEmpty())) {
regex.append('|').append(additionalExcludePrefixes);
}
regex.append(')');
regex.append(".*");
return regex.toString();
} | [
"static",
"String",
"createRegex",
"(",
"String",
"contextPath",
",",
"String",
"[",
"]",
"defaultExcludePrefixes",
",",
"String",
"additionalExcludePrefixes",
")",
"{",
"StringBuffer",
"regex",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"regex",
".",
"append",
... | Creates a regex that matches all URIs starting with one of the <code>defaultExcludePrefixes</code>
or one of the <code>additionalExcludePrefixes</code>.
@param contextPath The context path that every URI starts with.
@param defaultExcludePrefixes the default exclude prefixes.
@param additionalExcludePrefixes a pipe separated list of URI prefixes for which the URLs
should not be adjusted - additionally to the default exclude prefixes
@return a regex that matches all URIs starting with one of the <code>defaultExcludePrefixes</code>
or one of the <code>additionalExcludePrefixes</code>. | [
"Creates",
"a",
"regex",
"that",
"matches",
"all",
"URIs",
"starting",
"with",
"one",
"of",
"the",
"<code",
">",
"defaultExcludePrefixes<",
"/",
"code",
">",
"or",
"one",
"of",
"the",
"<code",
">",
"additionalExcludePrefixes<",
"/",
"code",
">",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsUrlServletFilter.java#L86-L101 |
Netflix/spectator | spectator-api/src/main/java/com/netflix/spectator/api/histogram/BucketCounter.java | BucketCounter.get | public static BucketCounter get(Registry registry, Id id, LongFunction<String> f) {
return new BucketCounter(registry, id, f);
} | java | public static BucketCounter get(Registry registry, Id id, LongFunction<String> f) {
return new BucketCounter(registry, id, f);
} | [
"public",
"static",
"BucketCounter",
"get",
"(",
"Registry",
"registry",
",",
"Id",
"id",
",",
"LongFunction",
"<",
"String",
">",
"f",
")",
"{",
"return",
"new",
"BucketCounter",
"(",
"registry",
",",
"id",
",",
"f",
")",
";",
"}"
] | Creates a distribution summary object that manages a set of counters based on the bucket
function supplied. Calling record will increment the appropriate counter.
@param registry
Registry to use.
@param id
Identifier for the metric being registered.
@param f
Function to map values to buckets. See {@link BucketFunctions} for more information.
@return
Distribution summary that manages sub-counters based on the bucket function. | [
"Creates",
"a",
"distribution",
"summary",
"object",
"that",
"manages",
"a",
"set",
"of",
"counters",
"based",
"on",
"the",
"bucket",
"function",
"supplied",
".",
"Calling",
"record",
"will",
"increment",
"the",
"appropriate",
"counter",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/histogram/BucketCounter.java#L43-L45 |
hgoebl/DavidWebb | src/main/java/com/goebl/david/Request.java | Request.params | public Request params(Map<String, Object> valueByName) {
if (params == null) {
params = new LinkedHashMap<String, Object>();
}
params.putAll(valueByName);
return this;
} | java | public Request params(Map<String, Object> valueByName) {
if (params == null) {
params = new LinkedHashMap<String, Object>();
}
params.putAll(valueByName);
return this;
} | [
"public",
"Request",
"params",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"valueByName",
")",
"{",
"if",
"(",
"params",
"==",
"null",
")",
"{",
"params",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"}",
"params"... | Set (or overwrite) many parameters via a map.
<br>
@param valueByName a Map of name-value pairs,<br>
the name of the parameter (it's better to use only contain ASCII characters)<br>
the value of the parameter; <code>null</code> will be converted to empty string, for all other
objects to <code>toString()</code> method converts it to String
@return <code>this</code> for method chaining (fluent API) | [
"Set",
"(",
"or",
"overwrite",
")",
"many",
"parameters",
"via",
"a",
"map",
".",
"<br",
">"
] | train | https://github.com/hgoebl/DavidWebb/blob/4f1532fbc3d817886d38de24eacc02b44b910b42/src/main/java/com/goebl/david/Request.java#L143-L149 |
apache/incubator-atlas | repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java | GraphBackedSearchIndexer.instanceIsActive | @Override
public void instanceIsActive() throws AtlasException {
LOG.info("Reacting to active: initializing index");
try {
initialize();
} catch (RepositoryException | IndexException e) {
throw new AtlasException("Error in reacting to active on initialization", e);
}
} | java | @Override
public void instanceIsActive() throws AtlasException {
LOG.info("Reacting to active: initializing index");
try {
initialize();
} catch (RepositoryException | IndexException e) {
throw new AtlasException("Error in reacting to active on initialization", e);
}
} | [
"@",
"Override",
"public",
"void",
"instanceIsActive",
"(",
")",
"throws",
"AtlasException",
"{",
"LOG",
".",
"info",
"(",
"\"Reacting to active: initializing index\"",
")",
";",
"try",
"{",
"initialize",
"(",
")",
";",
"}",
"catch",
"(",
"RepositoryException",
... | Initialize global indices for Titan graph on server activation.
Since the indices are shared state, we need to do this only from an active instance. | [
"Initialize",
"global",
"indices",
"for",
"Titan",
"graph",
"on",
"server",
"activation",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/GraphBackedSearchIndexer.java#L637-L645 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Reductions.java | Reductions.maximum | public static <E, C extends Comparator<E>> E maximum(Iterator<E> iterator, C comparator, E init) {
return Reductions.reduce(iterator, BinaryOperator.maxBy(comparator), init);
} | java | public static <E, C extends Comparator<E>> E maximum(Iterator<E> iterator, C comparator, E init) {
return Reductions.reduce(iterator, BinaryOperator.maxBy(comparator), init);
} | [
"public",
"static",
"<",
"E",
",",
"C",
"extends",
"Comparator",
"<",
"E",
">",
">",
"E",
"maximum",
"(",
"Iterator",
"<",
"E",
">",
"iterator",
",",
"C",
"comparator",
",",
"E",
"init",
")",
"{",
"return",
"Reductions",
".",
"reduce",
"(",
"iterator... | Returns the max element contained in the iterator
@param <E> the iterator element type parameter
@param <C> the comparator type parameter
@param iterator the iterator to be consumed
@param comparator the comparator to be used to evaluate the max element
@param init the initial value to be used
@return the max element contained in the iterator | [
"Returns",
"the",
"max",
"element",
"contained",
"in",
"the",
"iterator"
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Reductions.java#L213-L215 |
wildfly/wildfly-core | host-controller/src/main/java/org/jboss/as/host/controller/Main.java | Main.checkValueIsNotAnArg | private static String checkValueIsNotAnArg(String argument, String value) {
if (value.startsWith("-")) {
STDERR.println(HostControllerLogger.ROOT_LOGGER.argumentHasNoValue(argument, usageNote()));
return null;
}
return value;
} | java | private static String checkValueIsNotAnArg(String argument, String value) {
if (value.startsWith("-")) {
STDERR.println(HostControllerLogger.ROOT_LOGGER.argumentHasNoValue(argument, usageNote()));
return null;
}
return value;
} | [
"private",
"static",
"String",
"checkValueIsNotAnArg",
"(",
"String",
"argument",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
".",
"startsWith",
"(",
"\"-\"",
")",
")",
"{",
"STDERR",
".",
"println",
"(",
"HostControllerLogger",
".",
"ROOT_LOGGER",
... | Validates that param {@code value} does not begin with the character {@code -}. For use in cases where
the legal value for an argument would not begin with that character. Usage is to detect missing argument
values, where the command line includes another argument instead of the value for the last argument.
@param argument the last argument, whose value should be {@code value}
@param value the next item in the command line arguments, which should be the value for {@code argument}
@return {@code value} if it is valid, or {@code null} if it is not | [
"Validates",
"that",
"param",
"{",
"@code",
"value",
"}",
"does",
"not",
"begin",
"with",
"the",
"character",
"{",
"@code",
"-",
"}",
".",
"For",
"use",
"in",
"cases",
"where",
"the",
"legal",
"value",
"for",
"an",
"argument",
"would",
"not",
"begin",
... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/Main.java#L501-L507 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java | ReflectUtil.newInstance | @SuppressWarnings("unchecked")
public static <T> T newInstance(String clazz) throws UtilException {
try {
return (T) Class.forName(clazz).newInstance();
} catch (Exception e) {
throw new UtilException(e, "Instance class [{}] error!", clazz);
}
} | java | @SuppressWarnings("unchecked")
public static <T> T newInstance(String clazz) throws UtilException {
try {
return (T) Class.forName(clazz).newInstance();
} catch (Exception e) {
throw new UtilException(e, "Instance class [{}] error!", clazz);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"String",
"clazz",
")",
"throws",
"UtilException",
"{",
"try",
"{",
"return",
"(",
"T",
")",
"Class",
".",
"forName",
"(",
"clazz",
")",
".",
... | 实例化对象
@param <T> 对象类型
@param clazz 类名
@return 对象
@throws UtilException 包装各类异常 | [
"实例化对象"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L651-L658 |
MorphiaOrg/morphia | morphia/src/main/java/dev/morphia/Morphia.java | Morphia.toDBObject | public DBObject toDBObject(final Object entity) {
try {
return mapper.toDBObject(entity);
} catch (Exception e) {
throw new MappingException("Could not map entity to DBObject", e);
}
} | java | public DBObject toDBObject(final Object entity) {
try {
return mapper.toDBObject(entity);
} catch (Exception e) {
throw new MappingException("Could not map entity to DBObject", e);
}
} | [
"public",
"DBObject",
"toDBObject",
"(",
"final",
"Object",
"entity",
")",
"{",
"try",
"{",
"return",
"mapper",
".",
"toDBObject",
"(",
"entity",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"MappingException",
"(",
"\"Could not... | Converts an entity to a DBObject. This method is primarily an internal method. Reliance on this method may break your application
in
future releases.
@param entity the entity to convert
@return the DBObject | [
"Converts",
"an",
"entity",
"to",
"a",
"DBObject",
".",
"This",
"method",
"is",
"primarily",
"an",
"internal",
"method",
".",
"Reliance",
"on",
"this",
"method",
"may",
"break",
"your",
"application",
"in",
"future",
"releases",
"."
] | train | https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/Morphia.java#L284-L290 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java | MetatypeUtils.parseStringArray | @SuppressWarnings("unchecked")
@FFDCIgnore(Exception.class)
public static String[] parseStringArray(Object configAlias, String propertyKey, Object obj, String[] defaultValue) {
final String[] emptyArray = new String[0];
if (obj != null) {
try {
if (obj instanceof String[]) {
return (String[]) obj;
} else if (obj instanceof String) {
String commaList = (String) obj;
// split the string, consuming/removing whitespace
return commaList.split("\\s*,\\s*");
} else if (obj instanceof Collection) {
return ((Collection<String>) obj).toArray(emptyArray);
}
} catch (Exception e) {
Tr.warning(tc, "invalidStringArray", configAlias, propertyKey, obj);
throw new IllegalArgumentException("String array value could not be parsed: key=" + propertyKey + ", value=" + obj, e);
}
// unknown type
Tr.warning(tc, "invalidStringArray", configAlias, propertyKey, obj);
throw new IllegalArgumentException("String array value could not be parsed: key=" + propertyKey + ", value=" + obj);
}
return defaultValue;
} | java | @SuppressWarnings("unchecked")
@FFDCIgnore(Exception.class)
public static String[] parseStringArray(Object configAlias, String propertyKey, Object obj, String[] defaultValue) {
final String[] emptyArray = new String[0];
if (obj != null) {
try {
if (obj instanceof String[]) {
return (String[]) obj;
} else if (obj instanceof String) {
String commaList = (String) obj;
// split the string, consuming/removing whitespace
return commaList.split("\\s*,\\s*");
} else if (obj instanceof Collection) {
return ((Collection<String>) obj).toArray(emptyArray);
}
} catch (Exception e) {
Tr.warning(tc, "invalidStringArray", configAlias, propertyKey, obj);
throw new IllegalArgumentException("String array value could not be parsed: key=" + propertyKey + ", value=" + obj, e);
}
// unknown type
Tr.warning(tc, "invalidStringArray", configAlias, propertyKey, obj);
throw new IllegalArgumentException("String array value could not be parsed: key=" + propertyKey + ", value=" + obj);
}
return defaultValue;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"FFDCIgnore",
"(",
"Exception",
".",
"class",
")",
"public",
"static",
"String",
"[",
"]",
"parseStringArray",
"(",
"Object",
"configAlias",
",",
"String",
"propertyKey",
",",
"Object",
"obj",
",",
"Stri... | Parse a string array from the provided config value: returns
an array of strings generated from either a comma-separated single
string value, or a metatype generated string array.
<p>
If an exception occurs converting the object parameter:
A translated warning message will be issued using the provided propertyKey and object
as parameters. FFDC for the exception is suppressed: Callers should handle the thrown
IllegalArgumentException as appropriate.
@param configAlias
Name of config (pid or alias) associated with a registered service
or DS component.
@param propertyKey
The key used to retrieve the property value from the map.
Used in the warning message if the value is badly formed.
@param obj
The object retrieved from the configuration property map/dictionary.
@param defaultValue
The default value that should be applied if the object is null.
@return An array of strings parsed from the obj parameter, or default value if obj is null
@throws IllegalArgumentException If value is not a String or String array, or if an error
occurs while converting/casting the object to the return parameter type. | [
"Parse",
"a",
"string",
"array",
"from",
"the",
"provided",
"config",
"value",
":",
"returns",
"an",
"array",
"of",
"strings",
"generated",
"from",
"either",
"a",
"comma",
"-",
"separated",
"single",
"string",
"value",
"or",
"a",
"metatype",
"generated",
"st... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java#L160-L187 |
Impetus/Kundera | examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/ExecutorService.java | ExecutorService.findByNativeQuery | @SuppressWarnings("unchecked")
static void findByNativeQuery(final EntityManager em, final String query)
{
Query q = em.createNativeQuery(query, Tweets.class);
Map<String, Client> clients = (Map<String, Client>) em.getDelegate();
ThriftClient client = (ThriftClient) clients.get("twissandra");
client.setCqlVersion(CassandraConstants.CQL_VERSION_3_0);
logger.info("[On Find Tweets by CQL3]");
List<Tweets> tweets = q.getResultList();
System.out.println("#######################START##########################################");
logger.info("\t\t User's total tweets:" + tweets.size());
onPrintTweets(tweets);
logger.info("\n");
// logger.info("First tweet:" users.get(0).getTweets().);
System.out.println("#######################END############################################");
logger.info("\n");
} | java | @SuppressWarnings("unchecked")
static void findByNativeQuery(final EntityManager em, final String query)
{
Query q = em.createNativeQuery(query, Tweets.class);
Map<String, Client> clients = (Map<String, Client>) em.getDelegate();
ThriftClient client = (ThriftClient) clients.get("twissandra");
client.setCqlVersion(CassandraConstants.CQL_VERSION_3_0);
logger.info("[On Find Tweets by CQL3]");
List<Tweets> tweets = q.getResultList();
System.out.println("#######################START##########################################");
logger.info("\t\t User's total tweets:" + tweets.size());
onPrintTweets(tweets);
logger.info("\n");
// logger.info("First tweet:" users.get(0).getTweets().);
System.out.println("#######################END############################################");
logger.info("\n");
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"void",
"findByNativeQuery",
"(",
"final",
"EntityManager",
"em",
",",
"final",
"String",
"query",
")",
"{",
"Query",
"q",
"=",
"em",
".",
"createNativeQuery",
"(",
"query",
",",
"Tweets",
".",
"c... | On find by native CQL3 query.
@param em entity manager instance.
@param query native cql3 query. | [
"On",
"find",
"by",
"native",
"CQL3",
"query",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/ExecutorService.java#L149-L169 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/AbstractDependenceMeasure.java | AbstractDependenceMeasure.size | protected static <A, B> int size(NumberArrayAdapter<?, A> adapter1, A data1, NumberArrayAdapter<?, B> adapter2, B data2) {
final int len = adapter1.size(data1);
if(len != adapter2.size(data2)) {
throw new IllegalArgumentException("Array sizes do not match!");
}
if(len == 0) {
throw new IllegalArgumentException("Empty array!");
}
return len;
} | java | protected static <A, B> int size(NumberArrayAdapter<?, A> adapter1, A data1, NumberArrayAdapter<?, B> adapter2, B data2) {
final int len = adapter1.size(data1);
if(len != adapter2.size(data2)) {
throw new IllegalArgumentException("Array sizes do not match!");
}
if(len == 0) {
throw new IllegalArgumentException("Empty array!");
}
return len;
} | [
"protected",
"static",
"<",
"A",
",",
"B",
">",
"int",
"size",
"(",
"NumberArrayAdapter",
"<",
"?",
",",
"A",
">",
"adapter1",
",",
"A",
"data1",
",",
"NumberArrayAdapter",
"<",
"?",
",",
"B",
">",
"adapter2",
",",
"B",
"data2",
")",
"{",
"final",
... | Validate the length of the two data sets (must be the same, and non-zero)
@param adapter1 First data adapter
@param data1 First data set
@param adapter2 Second data adapter
@param data2 Second data set
@param <A> First array type
@param <B> Second array type | [
"Validate",
"the",
"length",
"of",
"the",
"two",
"data",
"sets",
"(",
"must",
"be",
"the",
"same",
"and",
"non",
"-",
"zero",
")"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/AbstractDependenceMeasure.java#L185-L194 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.