repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
BlueBrain/bluima | modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java | diff_match_patch.diff_linesToChars | protected LinesToCharsResult diff_linesToChars(String text1, String text2) {
List<String> lineArray = new ArrayList<String>();
Map<String, Integer> lineHash = new HashMap<String, Integer>();
// e.g. linearray[4] == "Hello\n"
// e.g. linehash.get("Hello\n") == 4
// "\x00" is a valid character, but various debuggers don't like it.
// So we'll insert a junk entry to avoid generating a null character.
lineArray.add("");
String chars1 = diff_linesToCharsMunge(text1, lineArray, lineHash);
String chars2 = diff_linesToCharsMunge(text2, lineArray, lineHash);
return new LinesToCharsResult(chars1, chars2, lineArray);
} | java | protected LinesToCharsResult diff_linesToChars(String text1, String text2) {
List<String> lineArray = new ArrayList<String>();
Map<String, Integer> lineHash = new HashMap<String, Integer>();
// e.g. linearray[4] == "Hello\n"
// e.g. linehash.get("Hello\n") == 4
// "\x00" is a valid character, but various debuggers don't like it.
// So we'll insert a junk entry to avoid generating a null character.
lineArray.add("");
String chars1 = diff_linesToCharsMunge(text1, lineArray, lineHash);
String chars2 = diff_linesToCharsMunge(text2, lineArray, lineHash);
return new LinesToCharsResult(chars1, chars2, lineArray);
} | [
"protected",
"LinesToCharsResult",
"diff_linesToChars",
"(",
"String",
"text1",
",",
"String",
"text2",
")",
"{",
"List",
"<",
"String",
">",
"lineArray",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Integer",
">"... | Split two texts into a list of strings. Reduce the texts to a string of
hashes where each Unicode character represents one line.
@param text1
First string.
@param text2
Second string.
@return An object containing the encoded text1, the encoded text2 and the
List of unique strings. The zeroth element of the List of unique
strings is intentionally blank. | [
"Split",
"two",
"texts",
"into",
"a",
"list",
"of",
"strings",
".",
"Reduce",
"the",
"texts",
"to",
"a",
"string",
"of",
"hashes",
"where",
"each",
"Unicode",
"character",
"represents",
"one",
"line",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_pdf/src/main/java/ch/epfl/bbp/uima/pdf/grobid/diff_match_patch.java#L551-L564 |
davetcc/tcMenu | tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java | MenuTree.removeMenuItem | public void removeMenuItem(SubMenuItem parent, MenuItem item) {
SubMenuItem subMenu = (parent != null) ? parent : ROOT;
synchronized (subMenuItems) {
ArrayList<MenuItem> subMenuChildren = subMenuItems.get(subMenu);
if (subMenuChildren == null) {
throw new UnsupportedOperationException("Menu element not found");
}
subMenuChildren.remove(item);
if (item.hasChildren()) {
subMenuItems.remove(item);
}
}
menuStates.remove(item.getId());
} | java | public void removeMenuItem(SubMenuItem parent, MenuItem item) {
SubMenuItem subMenu = (parent != null) ? parent : ROOT;
synchronized (subMenuItems) {
ArrayList<MenuItem> subMenuChildren = subMenuItems.get(subMenu);
if (subMenuChildren == null) {
throw new UnsupportedOperationException("Menu element not found");
}
subMenuChildren.remove(item);
if (item.hasChildren()) {
subMenuItems.remove(item);
}
}
menuStates.remove(item.getId());
} | [
"public",
"void",
"removeMenuItem",
"(",
"SubMenuItem",
"parent",
",",
"MenuItem",
"item",
")",
"{",
"SubMenuItem",
"subMenu",
"=",
"(",
"parent",
"!=",
"null",
")",
"?",
"parent",
":",
"ROOT",
";",
"synchronized",
"(",
"subMenuItems",
")",
"{",
"ArrayList",... | Remove the menu item for the provided menu item in the provided sub menu.
@param parent the submenu to search
@param item the item to remove (Search By ID) | [
"Remove",
"the",
"menu",
"item",
"for",
"the",
"provided",
"menu",
"item",
"in",
"the",
"provided",
"sub",
"menu",
"."
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L210-L225 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/core/JsonNullableValidator.java | JsonNullableValidator.ensureCollection | public void ensureCollection(StructuredType entityType) throws ODataException {
List<String> missingCollectionPropertyName = new ArrayList<>();
entityType.getStructuralProperties().stream()
.filter(property -> (property.isCollection())
&& !(property instanceof NavigationProperty) && !property.isNullable()).forEach(property -> {
LOG.debug("Validating non-nullable collection property : {}", property.getName());
if (!fields.containsKey(property.getName())) {
missingCollectionPropertyName.add(property.getName());
}
});
if (missingCollectionPropertyName.size() != 0) {
StringJoiner joiner = new StringJoiner(",");
missingCollectionPropertyName.forEach(joiner::add);
throw new ODataUnmarshallingException("The request does not specify the non-nullable collections: '"
+ joiner.toString() + ".");
}
} | java | public void ensureCollection(StructuredType entityType) throws ODataException {
List<String> missingCollectionPropertyName = new ArrayList<>();
entityType.getStructuralProperties().stream()
.filter(property -> (property.isCollection())
&& !(property instanceof NavigationProperty) && !property.isNullable()).forEach(property -> {
LOG.debug("Validating non-nullable collection property : {}", property.getName());
if (!fields.containsKey(property.getName())) {
missingCollectionPropertyName.add(property.getName());
}
});
if (missingCollectionPropertyName.size() != 0) {
StringJoiner joiner = new StringJoiner(",");
missingCollectionPropertyName.forEach(joiner::add);
throw new ODataUnmarshallingException("The request does not specify the non-nullable collections: '"
+ joiner.toString() + ".");
}
} | [
"public",
"void",
"ensureCollection",
"(",
"StructuredType",
"entityType",
")",
"throws",
"ODataException",
"{",
"List",
"<",
"String",
">",
"missingCollectionPropertyName",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"entityType",
".",
"getStructuralProperties",
... | Ensure that non nullable collection are present.
@param entityType entityType
@throws ODataException If unable to ensure collection is present | [
"Ensure",
"that",
"non",
"nullable",
"collection",
"are",
"present",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/core/JsonNullableValidator.java#L52-L70 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/timeseries/util/TimeSeriesWritableUtils.java | TimeSeriesWritableUtils.convertWritablesSequence | public static Pair<INDArray, INDArray> convertWritablesSequence(List<List<List<Writable>>> timeSeriesRecord) {
return convertWritablesSequence(timeSeriesRecord,getDetails(timeSeriesRecord));
} | java | public static Pair<INDArray, INDArray> convertWritablesSequence(List<List<List<Writable>>> timeSeriesRecord) {
return convertWritablesSequence(timeSeriesRecord,getDetails(timeSeriesRecord));
} | [
"public",
"static",
"Pair",
"<",
"INDArray",
",",
"INDArray",
">",
"convertWritablesSequence",
"(",
"List",
"<",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
">",
"timeSeriesRecord",
")",
"{",
"return",
"convertWritablesSequence",
"(",
"timeSeriesRecord",
","... | Convert the writables
to a sequence (3d) data set,
and also return the
mask array (if necessary)
@param timeSeriesRecord the input time series | [
"Convert",
"the",
"writables",
"to",
"a",
"sequence",
"(",
"3d",
")",
"data",
"set",
"and",
"also",
"return",
"the",
"mask",
"array",
"(",
"if",
"necessary",
")",
"@param",
"timeSeriesRecord",
"the",
"input",
"time",
"series"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/timeseries/util/TimeSeriesWritableUtils.java#L92-L94 |
aws/aws-sdk-java | aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/CreateBackupPlanRequest.java | CreateBackupPlanRequest.withBackupPlanTags | public CreateBackupPlanRequest withBackupPlanTags(java.util.Map<String, String> backupPlanTags) {
setBackupPlanTags(backupPlanTags);
return this;
} | java | public CreateBackupPlanRequest withBackupPlanTags(java.util.Map<String, String> backupPlanTags) {
setBackupPlanTags(backupPlanTags);
return this;
} | [
"public",
"CreateBackupPlanRequest",
"withBackupPlanTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"backupPlanTags",
")",
"{",
"setBackupPlanTags",
"(",
"backupPlanTags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
To help organize your resources, you can assign your own metadata to the resources that you create. Each tag is a
key-value pair. The specified tags are assigned to all backups created with this plan.
</p>
@param backupPlanTags
To help organize your resources, you can assign your own metadata to the resources that you create. Each
tag is a key-value pair. The specified tags are assigned to all backups created with this plan.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"To",
"help",
"organize",
"your",
"resources",
"you",
"can",
"assign",
"your",
"own",
"metadata",
"to",
"the",
"resources",
"that",
"you",
"create",
".",
"Each",
"tag",
"is",
"a",
"key",
"-",
"value",
"pair",
".",
"The",
"specified",
"tags",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-backup/src/main/java/com/amazonaws/services/backup/model/CreateBackupPlanRequest.java#L138-L141 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java | RoaringBitmap.andNot | @Deprecated
public static RoaringBitmap andNot(final RoaringBitmap x1, final RoaringBitmap x2,
final int rangeStart, final int rangeEnd) {
return andNot(x1, x2, (long) rangeStart, (long) rangeEnd);
} | java | @Deprecated
public static RoaringBitmap andNot(final RoaringBitmap x1, final RoaringBitmap x2,
final int rangeStart, final int rangeEnd) {
return andNot(x1, x2, (long) rangeStart, (long) rangeEnd);
} | [
"@",
"Deprecated",
"public",
"static",
"RoaringBitmap",
"andNot",
"(",
"final",
"RoaringBitmap",
"x1",
",",
"final",
"RoaringBitmap",
"x2",
",",
"final",
"int",
"rangeStart",
",",
"final",
"int",
"rangeEnd",
")",
"{",
"return",
"andNot",
"(",
"x1",
",",
"x2"... | Bitwise ANDNOT (difference) operation for the given range, rangeStart (inclusive) and rangeEnd
(exclusive). The provided bitmaps are *not* modified. This operation is thread-safe as long as
the provided bitmaps remain unchanged.
@param x1 first bitmap
@param x2 other bitmap
@param rangeStart starting point of the range (inclusive)
@param rangeEnd end point of the range (exclusive)
@return result of the operation
@deprecated use the version where longs specify the range. Negative values for range
endpoints are not allowed. | [
"Bitwise",
"ANDNOT",
"(",
"difference",
")",
"operation",
"for",
"the",
"given",
"range",
"rangeStart",
"(",
"inclusive",
")",
"and",
"rangeEnd",
"(",
"exclusive",
")",
".",
"The",
"provided",
"bitmaps",
"are",
"*",
"not",
"*",
"modified",
".",
"This",
"op... | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java#L1294-L1298 |
eurekaclinical/aiw-i2b2-etl | src/main/java/edu/emory/cci/aiw/i2b2etl/dest/I2b2QueryResultsHandler.java | I2b2QueryResultsHandler.start | @Override
public void start(PropositionDefinitionCache propDefs) throws QueryResultsHandlerProcessingException {
Logger logger = I2b2ETLUtil.logger();
try {
this.conceptDimensionHandler = new ConceptDimensionHandler(dataConnectionSpec);
this.modifierDimensionHandler = new ModifierDimensionHandler(dataConnectionSpec);
this.cache = new KnowledgeSourceCacheFactory().getInstance(this.knowledgeSource, propDefs, true);
this.metadata = new MetadataFactory().getInstance(propDefs, this.qrhId, this.cache, collectUserPropositionDefinitions(), this.conceptsSection.getFolderSpecs(), settings, this.data, this.metadataConnectionSpec);
this.providerDimensionFactory = new ProviderDimensionFactory(this.metadata, this.settings, this.dataConnectionSpec);
this.patientDimensionFactory = new PatientDimensionFactory(this.metadata, this.settings, this.data, this.dataConnectionSpec);
this.visitDimensionFactory = new VisitDimensionFactory(this.metadata, this.settings, this.data, this.dataConnectionSpec);
DataRemoverFactory f = new DataRemoverFactory();
if (this.query.getQueryMode() == QueryMode.REPLACE) {
f.getInstance(this.dataRemoveMethod).doRemoveData();
}
f.getInstance(this.metaRemoveMethod).doRemoveMetadata();
this.factHandlers = new ArrayList<>();
addPropositionFactHandlers();
executePreHook();
// disable indexes on observation_fact to speed up inserts
disableObservationFactIndexes();
// create i2b2 temporary tables using stored procedures
truncateTempTables();
this.dataSchemaConnection = openDataDatabaseConnection();
this.dataSchemaName = this.dataSchemaConnection.getSchema();
if (this.settings.getManageCTotalNum()) {
try (Connection conn = openMetadataDatabaseConnection()) {
conn.setAutoCommit(true);
try (CallableStatement mappingCall = conn.prepareCall("{ call ECMETA.EC_CLEAR_C_TOTALNUM() }")) {
logger.log(Level.INFO, "Clearing C_TOTALNUM for query {0}", this.query.getName());
mappingCall.execute();
}
}
}
logger.log(Level.INFO, "Populating observation facts table for query {0}", this.query.getName());
} catch (KnowledgeSourceReadException | SQLException | OntologyBuildException ex) {
throw new QueryResultsHandlerProcessingException("Error during i2b2 load", ex);
}
} | java | @Override
public void start(PropositionDefinitionCache propDefs) throws QueryResultsHandlerProcessingException {
Logger logger = I2b2ETLUtil.logger();
try {
this.conceptDimensionHandler = new ConceptDimensionHandler(dataConnectionSpec);
this.modifierDimensionHandler = new ModifierDimensionHandler(dataConnectionSpec);
this.cache = new KnowledgeSourceCacheFactory().getInstance(this.knowledgeSource, propDefs, true);
this.metadata = new MetadataFactory().getInstance(propDefs, this.qrhId, this.cache, collectUserPropositionDefinitions(), this.conceptsSection.getFolderSpecs(), settings, this.data, this.metadataConnectionSpec);
this.providerDimensionFactory = new ProviderDimensionFactory(this.metadata, this.settings, this.dataConnectionSpec);
this.patientDimensionFactory = new PatientDimensionFactory(this.metadata, this.settings, this.data, this.dataConnectionSpec);
this.visitDimensionFactory = new VisitDimensionFactory(this.metadata, this.settings, this.data, this.dataConnectionSpec);
DataRemoverFactory f = new DataRemoverFactory();
if (this.query.getQueryMode() == QueryMode.REPLACE) {
f.getInstance(this.dataRemoveMethod).doRemoveData();
}
f.getInstance(this.metaRemoveMethod).doRemoveMetadata();
this.factHandlers = new ArrayList<>();
addPropositionFactHandlers();
executePreHook();
// disable indexes on observation_fact to speed up inserts
disableObservationFactIndexes();
// create i2b2 temporary tables using stored procedures
truncateTempTables();
this.dataSchemaConnection = openDataDatabaseConnection();
this.dataSchemaName = this.dataSchemaConnection.getSchema();
if (this.settings.getManageCTotalNum()) {
try (Connection conn = openMetadataDatabaseConnection()) {
conn.setAutoCommit(true);
try (CallableStatement mappingCall = conn.prepareCall("{ call ECMETA.EC_CLEAR_C_TOTALNUM() }")) {
logger.log(Level.INFO, "Clearing C_TOTALNUM for query {0}", this.query.getName());
mappingCall.execute();
}
}
}
logger.log(Level.INFO, "Populating observation facts table for query {0}", this.query.getName());
} catch (KnowledgeSourceReadException | SQLException | OntologyBuildException ex) {
throw new QueryResultsHandlerProcessingException("Error during i2b2 load", ex);
}
} | [
"@",
"Override",
"public",
"void",
"start",
"(",
"PropositionDefinitionCache",
"propDefs",
")",
"throws",
"QueryResultsHandlerProcessingException",
"{",
"Logger",
"logger",
"=",
"I2b2ETLUtil",
".",
"logger",
"(",
")",
";",
"try",
"{",
"this",
".",
"conceptDimensionH... | Builds most of the concept tree, truncates the data tables, opens a
connection to the i2b2 project database, and does some other prep. This
method is called before the first call to
{@link #handleQueryResult(String, java.util.List, java.util.Map, java.util.Map, java.util.Map)}.
@throws QueryResultsHandlerProcessingException | [
"Builds",
"most",
"of",
"the",
"concept",
"tree",
"truncates",
"the",
"data",
"tables",
"opens",
"a",
"connection",
"to",
"the",
"i2b2",
"project",
"database",
"and",
"does",
"some",
"other",
"prep",
".",
"This",
"method",
"is",
"called",
"before",
"the",
... | train | https://github.com/eurekaclinical/aiw-i2b2-etl/blob/3eed6bda7755919cb9466d2930723a0f4748341a/src/main/java/edu/emory/cci/aiw/i2b2etl/dest/I2b2QueryResultsHandler.java#L314-L354 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java | RemoteJTProxy.initializeClientUnprotected | void initializeClientUnprotected(String host, int port, String sessionId)
throws IOException {
if (client != null) {
return;
}
LOG.info("Creating JT client to " + host + ":" + port);
long connectTimeout = RemoteJTProxy.getRemotJTTimeout(conf);
int rpcTimeout = RemoteJTProxy.getRemoteJTRPCTimeout(conf);
remoteJTAddr = new InetSocketAddress(host, port);
client = RPC.waitForProtocolProxy(
JobSubmissionProtocol.class,
JobSubmissionProtocol.versionID,
remoteJTAddr,
conf,
connectTimeout,
rpcTimeout
).getProxy();
remoteJTStatus = RemoteJTStatus.SUCCESS;
remoteJTHost = host;
remoteJTPort = port;
remoteSessionId = sessionId;
if (remoteJTState != null) {
remoteJTState.setSessionId(sessionId);
}
} | java | void initializeClientUnprotected(String host, int port, String sessionId)
throws IOException {
if (client != null) {
return;
}
LOG.info("Creating JT client to " + host + ":" + port);
long connectTimeout = RemoteJTProxy.getRemotJTTimeout(conf);
int rpcTimeout = RemoteJTProxy.getRemoteJTRPCTimeout(conf);
remoteJTAddr = new InetSocketAddress(host, port);
client = RPC.waitForProtocolProxy(
JobSubmissionProtocol.class,
JobSubmissionProtocol.versionID,
remoteJTAddr,
conf,
connectTimeout,
rpcTimeout
).getProxy();
remoteJTStatus = RemoteJTStatus.SUCCESS;
remoteJTHost = host;
remoteJTPort = port;
remoteSessionId = sessionId;
if (remoteJTState != null) {
remoteJTState.setSessionId(sessionId);
}
} | [
"void",
"initializeClientUnprotected",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"sessionId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"client",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"LOG",
".",
"info",
"(",
"\"Creating JT client t... | Create the RPC client to the remote corona job tracker.
@param host The host running the remote corona job tracker.
@param port The port of the remote corona job tracker.
@param sessionId The session for the remote corona job tracker.
@throws IOException | [
"Create",
"the",
"RPC",
"client",
"to",
"the",
"remote",
"corona",
"job",
"tracker",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/RemoteJTProxy.java#L297-L322 |
fabric8io/kubernetes-client | kubernetes-client/src/main/java/io/fabric8/kubernetes/client/Config.java | Config.autoConfigure | public static Config autoConfigure(String context) {
Config config = new Config();
return autoConfigure(config, context);
} | java | public static Config autoConfigure(String context) {
Config config = new Config();
return autoConfigure(config, context);
} | [
"public",
"static",
"Config",
"autoConfigure",
"(",
"String",
"context",
")",
"{",
"Config",
"config",
"=",
"new",
"Config",
"(",
")",
";",
"return",
"autoConfigure",
"(",
"config",
",",
"context",
")",
";",
"}"
] | Does auto detection with some opinionated defaults.
@param context if null will use current-context
@return Config object | [
"Does",
"auto",
"detection",
"with",
"some",
"opinionated",
"defaults",
"."
] | train | https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/Config.java#L209-L212 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.checkRole | public void checkRole(CmsDbContext dbc, CmsRole role) throws CmsRoleViolationException {
if (!hasRole(dbc, dbc.currentUser(), role)) {
if (role.getOuFqn() != null) {
throw role.createRoleViolationExceptionForOrgUnit(dbc.getRequestContext(), role.getOuFqn());
} else {
throw role.createRoleViolationException(dbc.getRequestContext());
}
}
} | java | public void checkRole(CmsDbContext dbc, CmsRole role) throws CmsRoleViolationException {
if (!hasRole(dbc, dbc.currentUser(), role)) {
if (role.getOuFqn() != null) {
throw role.createRoleViolationExceptionForOrgUnit(dbc.getRequestContext(), role.getOuFqn());
} else {
throw role.createRoleViolationException(dbc.getRequestContext());
}
}
} | [
"public",
"void",
"checkRole",
"(",
"CmsDbContext",
"dbc",
",",
"CmsRole",
"role",
")",
"throws",
"CmsRoleViolationException",
"{",
"if",
"(",
"!",
"hasRole",
"(",
"dbc",
",",
"dbc",
".",
"currentUser",
"(",
")",
",",
"role",
")",
")",
"{",
"if",
"(",
... | Checks if the user of the current database context has permissions to impersonate the given role
in the given organizational unit.<p>
If the organizational unit is <code>null</code>, this method will check if the
given user has the given role for at least one organizational unit.<p>
@param dbc the current OpenCms users database context
@param role the role to check
@throws CmsRoleViolationException if the user does not have the required role permissions
@see org.opencms.security.CmsRoleManager#checkRole(CmsObject, CmsRole) | [
"Checks",
"if",
"the",
"user",
"of",
"the",
"current",
"database",
"context",
"has",
"permissions",
"to",
"impersonate",
"the",
"given",
"role",
"in",
"the",
"given",
"organizational",
"unit",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L562-L571 |
arturmkrtchyan/iban4j | src/main/java/org/iban4j/Iban.java | Iban.valueOf | public static Iban valueOf(final String iban, final IbanFormat format) throws IbanFormatException,
InvalidCheckDigitException, UnsupportedCountryException {
switch (format) {
case Default:
final String ibanWithoutSpaces = iban.replace(" ", "");
final Iban ibanObj = valueOf(ibanWithoutSpaces);
if(ibanObj.toFormattedString().equals(iban)) {
return ibanObj;
}
throw new IbanFormatException(IBAN_FORMATTING,
String.format("Iban must be formatted using 4 characters and space combination. " +
"Instead of [%s]", iban));
default:
return valueOf(iban);
}
} | java | public static Iban valueOf(final String iban, final IbanFormat format) throws IbanFormatException,
InvalidCheckDigitException, UnsupportedCountryException {
switch (format) {
case Default:
final String ibanWithoutSpaces = iban.replace(" ", "");
final Iban ibanObj = valueOf(ibanWithoutSpaces);
if(ibanObj.toFormattedString().equals(iban)) {
return ibanObj;
}
throw new IbanFormatException(IBAN_FORMATTING,
String.format("Iban must be formatted using 4 characters and space combination. " +
"Instead of [%s]", iban));
default:
return valueOf(iban);
}
} | [
"public",
"static",
"Iban",
"valueOf",
"(",
"final",
"String",
"iban",
",",
"final",
"IbanFormat",
"format",
")",
"throws",
"IbanFormatException",
",",
"InvalidCheckDigitException",
",",
"UnsupportedCountryException",
"{",
"switch",
"(",
"format",
")",
"{",
"case",
... | Returns an Iban object holding the value of the specified String.
@param iban the String to be parsed.
@param format the format of the Iban.
@return an Iban object holding the value represented by the string argument.
@throws IbanFormatException if the String doesn't contain parsable Iban
InvalidCheckDigitException if Iban has invalid check digit
UnsupportedCountryException if Iban's Country is not supported. | [
"Returns",
"an",
"Iban",
"object",
"holding",
"the",
"value",
"of",
"the",
"specified",
"String",
"."
] | train | https://github.com/arturmkrtchyan/iban4j/blob/9889e8873c4ba5c34fc61d17594af935d2ca28a3/src/main/java/org/iban4j/Iban.java#L165-L180 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/io/IOUtils.java | IOUtils.writeObjectToTempFileNoExceptions | public static File writeObjectToTempFileNoExceptions(Object o, String filename) {
try {
return writeObjectToTempFile(o, filename);
} catch (Exception e) {
System.err.println("Error writing object to file " + filename);
e.printStackTrace();
return null;
}
} | java | public static File writeObjectToTempFileNoExceptions(Object o, String filename) {
try {
return writeObjectToTempFile(o, filename);
} catch (Exception e) {
System.err.println("Error writing object to file " + filename);
e.printStackTrace();
return null;
}
} | [
"public",
"static",
"File",
"writeObjectToTempFileNoExceptions",
"(",
"Object",
"o",
",",
"String",
"filename",
")",
"{",
"try",
"{",
"return",
"writeObjectToTempFile",
"(",
"o",
",",
"filename",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"Syst... | Write object to a temp file and ignore exceptions.
@param o
object to be written to file
@param filename
name of the temp file
@return File containing the object | [
"Write",
"object",
"to",
"a",
"temp",
"file",
"and",
"ignore",
"exceptions",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L144-L152 |
redkale/redkale | src/org/redkale/net/http/HttpResponse.java | HttpResponse.finishMapJson | public void finishMapJson(final JsonConvert convert, final Object... objs) {
this.contentType = this.jsonContentType;
if (this.recycleListener != null) this.output = objs;
finish(convert.convertMapTo(getBodyBufferSupplier(), objs));
} | java | public void finishMapJson(final JsonConvert convert, final Object... objs) {
this.contentType = this.jsonContentType;
if (this.recycleListener != null) this.output = objs;
finish(convert.convertMapTo(getBodyBufferSupplier(), objs));
} | [
"public",
"void",
"finishMapJson",
"(",
"final",
"JsonConvert",
"convert",
",",
"final",
"Object",
"...",
"objs",
")",
"{",
"this",
".",
"contentType",
"=",
"this",
".",
"jsonContentType",
";",
"if",
"(",
"this",
".",
"recycleListener",
"!=",
"null",
")",
... | 将对象数组用Map的形式以JSON格式输出 <br>
例如: finishMap("a",2,"b",3) 输出结果为 {"a":2,"b":3}
@param convert 指定的JsonConvert
@param objs 输出对象 | [
"将对象数组用Map的形式以JSON格式输出",
"<br",
">",
"例如",
":",
"finishMap",
"(",
"a",
"2",
"b",
"3",
")",
"输出结果为",
"{",
"a",
":",
"2",
"b",
":",
"3",
"}"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpResponse.java#L334-L338 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbmonbindings.java | lbmonbindings.count_filtered | public static long count_filtered(nitro_service service, lbmonbindings obj, String filter) throws Exception{
options option = new options();
option.set_count(true);
option.set_filter(filter);
option.set_args(nitro_util.object_to_string_withoutquotes(obj));
lbmonbindings[] response = (lbmonbindings[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, lbmonbindings obj, String filter) throws Exception{
options option = new options();
option.set_count(true);
option.set_filter(filter);
option.set_args(nitro_util.object_to_string_withoutquotes(obj));
lbmonbindings[] response = (lbmonbindings[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"lbmonbindings",
"obj",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"options",
"option",
"=",
"new",
"options",
"(",
")",
";",
"option",
".",
"set_count",
"(",
... | Use this API to count filtered the set of lbmonbindings resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"filtered",
"the",
"set",
"of",
"lbmonbindings",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbmonbindings.java#L181-L191 |
JOML-CI/JOML | src/org/joml/Matrix3d.java | Matrix3d.rotateTowards | public Matrix3d rotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ) {
return rotateTowards(dirX, dirY, dirZ, upX, upY, upZ, this);
} | java | public Matrix3d rotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ) {
return rotateTowards(dirX, dirY, dirZ, upX, upY, upZ, this);
} | [
"public",
"Matrix3d",
"rotateTowards",
"(",
"double",
"dirX",
",",
"double",
"dirY",
",",
"double",
"dirZ",
",",
"double",
"upX",
",",
"double",
"upY",
",",
"double",
"upZ",
")",
"{",
"return",
"rotateTowards",
"(",
"dirX",
",",
"dirY",
",",
"dirZ",
",",... | Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local <code>+Z</code> axis with <code>direction</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookat matrix,
then the new matrix will be <code>M * L</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * L * v</code>,
the lookat transformation will be applied first!
<p>
In order to set the matrix to a rotation transformation without post-multiplying it,
use {@link #rotationTowards(double, double, double, double, double, double) rotationTowards()}.
<p>
This method is equivalent to calling: <code>mul(new Matrix3d().lookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert())</code>
@see #rotateTowards(Vector3dc, Vector3dc)
@see #rotationTowards(double, double, double, double, double, double)
@param dirX
the x-coordinate of the direction to rotate towards
@param dirY
the y-coordinate of the direction to rotate towards
@param dirZ
the z-coordinate of the direction to rotate towards
@param upX
the x-coordinate of the up vector
@param upY
the y-coordinate of the up vector
@param upZ
the z-coordinate of the up vector
@return this | [
"Apply",
"a",
"model",
"transformation",
"to",
"this",
"matrix",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"that",
"aligns",
"the",
"local",
"<code",
">",
"+",
"Z<",
"/",
"code",
">",
"axis",
"with",
"<code",
">",
"direction<",
"/",
"co... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3d.java#L4452-L4454 |
aws/aws-sdk-java | aws-java-sdk-costexplorer/src/main/java/com/amazonaws/services/costexplorer/model/ResultByTime.java | ResultByTime.withTotal | public ResultByTime withTotal(java.util.Map<String, MetricValue> total) {
setTotal(total);
return this;
} | java | public ResultByTime withTotal(java.util.Map<String, MetricValue> total) {
setTotal(total);
return this;
} | [
"public",
"ResultByTime",
"withTotal",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"MetricValue",
">",
"total",
")",
"{",
"setTotal",
"(",
"total",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The total amount of cost or usage accrued during the time period.
</p>
@param total
The total amount of cost or usage accrued during the time period.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"total",
"amount",
"of",
"cost",
"or",
"usage",
"accrued",
"during",
"the",
"time",
"period",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-costexplorer/src/main/java/com/amazonaws/services/costexplorer/model/ResultByTime.java#L131-L134 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java | AlertResources.deleteNotificationsById | @DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("/{alertId}/notifications/{notificationId}")
@Description(
"Deletes a notification having the given ID if it is associated with the given alert ID. Associated triggers are not deleted from the alert."
)
public Response deleteNotificationsById(@Context HttpServletRequest req,
@PathParam("alertId") BigInteger alertId,
@PathParam("notificationId") BigInteger notificationId) {
if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (notificationId == null || notificationId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Notification Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
Alert alert = alertService.findAlertByPrimaryKey(alertId);
if (alert == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
}
validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req));
List<Notification> listNotification = new ArrayList<Notification>(alert.getNotifications());
Iterator<Notification> it = listNotification.iterator();
while (it.hasNext()) {
Notification notification = it.next();
if (notification.getId().equals(notificationId)) {
it.remove();
alert.setNotifications(listNotification);
alert.setModifiedBy(getRemoteUser(req));
alertService.updateAlert(alert);
return Response.status(Status.OK).build();
}
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} | java | @DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("/{alertId}/notifications/{notificationId}")
@Description(
"Deletes a notification having the given ID if it is associated with the given alert ID. Associated triggers are not deleted from the alert."
)
public Response deleteNotificationsById(@Context HttpServletRequest req,
@PathParam("alertId") BigInteger alertId,
@PathParam("notificationId") BigInteger notificationId) {
if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (notificationId == null || notificationId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Notification Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
Alert alert = alertService.findAlertByPrimaryKey(alertId);
if (alert == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
}
validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req));
List<Notification> listNotification = new ArrayList<Notification>(alert.getNotifications());
Iterator<Notification> it = listNotification.iterator();
while (it.hasNext()) {
Notification notification = it.next();
if (notification.getId().equals(notificationId)) {
it.remove();
alert.setNotifications(listNotification);
alert.setModifiedBy(getRemoteUser(req));
alertService.updateAlert(alert);
return Response.status(Status.OK).build();
}
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} | [
"@",
"DELETE",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/{alertId}/notifications/{notificationId}\"",
")",
"@",
"Description",
"(",
"\"Deletes a notification having the given ID if it is associated with the given alert ID. Associated tr... | Deletes the notification.
@param req The HttpServlet request object. Cannot be null.
@param alertId The alert Id. Cannot be null and must be a positive non-zero number.
@param notificationId The notification id. Cannot be null and must be a positive non-zero number.
@return Updated alert object.
@throws WebApplicationException The exception with 404 status will be thrown if an alert does not exist. | [
"Deletes",
"the",
"notification",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AlertResources.java#L1043-L1081 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Document.java | Document.setRelations | public void setRelations(int i, Relation v) {
if (Document_Type.featOkTst && ((Document_Type)jcasType).casFeat_relations == null)
jcasType.jcas.throwFeatMissing("relations", "de.julielab.jules.types.ace.Document");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_relations), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_relations), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setRelations(int i, Relation v) {
if (Document_Type.featOkTst && ((Document_Type)jcasType).casFeat_relations == null)
jcasType.jcas.throwFeatMissing("relations", "de.julielab.jules.types.ace.Document");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_relations), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_relations), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setRelations",
"(",
"int",
"i",
",",
"Relation",
"v",
")",
"{",
"if",
"(",
"Document_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Document_Type",
")",
"jcasType",
")",
".",
"casFeat_relations",
"==",
"null",
")",
"jcasType",
".",
"jcas",
... | indexed setter for relations - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"relations",
"-",
"sets",
"an",
"indexed",
"value",
"-"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Document.java#L270-L274 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/DynamicFactory.java | DynamicFactory.ofClass | public <T extends ICDKObject> T ofClass(Class<T> intf, Object... objects) {
try {
if (!intf.isInterface()) throw new IllegalArgumentException("expected interface, got " + intf.getClass());
Creator<T> constructor = get(new ObjectBasedKey(intf, objects));
return constructor.create(objects);
} catch (InstantiationException e) {
throw new IllegalArgumentException("unable to instantiate chem object: ", e);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("constructor is not accessible: ", e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException("invocation target exception: ", e);
}
} | java | public <T extends ICDKObject> T ofClass(Class<T> intf, Object... objects) {
try {
if (!intf.isInterface()) throw new IllegalArgumentException("expected interface, got " + intf.getClass());
Creator<T> constructor = get(new ObjectBasedKey(intf, objects));
return constructor.create(objects);
} catch (InstantiationException e) {
throw new IllegalArgumentException("unable to instantiate chem object: ", e);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("constructor is not accessible: ", e);
} catch (InvocationTargetException e) {
throw new IllegalArgumentException("invocation target exception: ", e);
}
} | [
"public",
"<",
"T",
"extends",
"ICDKObject",
">",
"T",
"ofClass",
"(",
"Class",
"<",
"T",
">",
"intf",
",",
"Object",
"...",
"objects",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"intf",
".",
"isInterface",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentE... | Construct an implementation using a constructor whose parameters match
that of the provided objects.
@param intf the interface to construct an instance of
@param <T> the type of the class
@return an implementation of provided interface
@throws IllegalArgumentException thrown if the implementation can not be
constructed
@throws IllegalArgumentException thrown if the provided class is not an
interface | [
"Construct",
"an",
"implementation",
"using",
"a",
"constructor",
"whose",
"parameters",
"match",
"that",
"of",
"the",
"provided",
"objects",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/DynamicFactory.java#L512-L529 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.localSeo_emailAvailability_GET | public OvhEmailAvailability localSeo_emailAvailability_GET(String email) throws IOException {
String qPath = "/hosting/web/localSeo/emailAvailability";
StringBuilder sb = path(qPath);
query(sb, "email", email);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhEmailAvailability.class);
} | java | public OvhEmailAvailability localSeo_emailAvailability_GET(String email) throws IOException {
String qPath = "/hosting/web/localSeo/emailAvailability";
StringBuilder sb = path(qPath);
query(sb, "email", email);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhEmailAvailability.class);
} | [
"public",
"OvhEmailAvailability",
"localSeo_emailAvailability_GET",
"(",
"String",
"email",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/localSeo/emailAvailability\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
")",
";",
"query"... | Check email availability for a local SEO order
REST: GET /hosting/web/localSeo/emailAvailability
@param email [required] The email address to check | [
"Check",
"email",
"availability",
"for",
"a",
"local",
"SEO",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2264-L2270 |
maestrano/maestrano-java | src/main/java/com/maestrano/Maestrano.java | Maestrano.autoConfigure | public static Map<String, Preset> autoConfigure() throws MnoConfigurationException {
String host = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_HOST", "https://developer.maestrano.com");
String apiPath = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_API_PATH", "/api/config/v1");
String apiKey = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_ENV_KEY");
String apiSecret = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_ENV_SECRET");
return autoConfigure(host, apiPath, apiKey, apiSecret);
} | java | public static Map<String, Preset> autoConfigure() throws MnoConfigurationException {
String host = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_HOST", "https://developer.maestrano.com");
String apiPath = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_API_PATH", "/api/config/v1");
String apiKey = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_ENV_KEY");
String apiSecret = MnoPropertiesHelper.readEnvironment("MNO_DEVPL_ENV_SECRET");
return autoConfigure(host, apiPath, apiKey, apiSecret);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Preset",
">",
"autoConfigure",
"(",
")",
"throws",
"MnoConfigurationException",
"{",
"String",
"host",
"=",
"MnoPropertiesHelper",
".",
"readEnvironment",
"(",
"\"MNO_DEVPL_HOST\"",
",",
"\"https://developer.maestrano.com\... | Method to fetch configuration from the dev-platform, using environment variable.
The following variable must be set in the environment.
<ul>
<li>MNO_DEVPL_ENV_NAME</li>
<li>MNO_DEVPL_ENV_KEY</li>
<li>MNO_DEVPL_ENV_SECRET</li>
</ul>
@throws MnoConfigurationException | [
"Method",
"to",
"fetch",
"configuration",
"from",
"the",
"dev",
"-",
"platform",
"using",
"environment",
"variable",
"."
] | train | https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/Maestrano.java#L93-L99 |
phax/ph-web | ph-web/src/main/java/com/helger/web/fileupload/parse/DiskFileItem.java | DiskFileItem.getTempFile | @Nonnull
protected File getTempFile ()
{
if (m_aTempFile == null)
{
// If you manage to get more than 100 million of ids, you'll
// start getting ids longer than 8 characters.
final String sUniqueID = StringHelper.getLeadingZero (s_aTempFileCounter.getAndIncrement (), 8);
final String sTempFileName = "upload_" + UID + "_" + sUniqueID + ".tmp";
m_aTempFile = new File (m_aTempDir, sTempFileName);
}
return m_aTempFile;
} | java | @Nonnull
protected File getTempFile ()
{
if (m_aTempFile == null)
{
// If you manage to get more than 100 million of ids, you'll
// start getting ids longer than 8 characters.
final String sUniqueID = StringHelper.getLeadingZero (s_aTempFileCounter.getAndIncrement (), 8);
final String sTempFileName = "upload_" + UID + "_" + sUniqueID + ".tmp";
m_aTempFile = new File (m_aTempDir, sTempFileName);
}
return m_aTempFile;
} | [
"@",
"Nonnull",
"protected",
"File",
"getTempFile",
"(",
")",
"{",
"if",
"(",
"m_aTempFile",
"==",
"null",
")",
"{",
"// If you manage to get more than 100 million of ids, you'll",
"// start getting ids longer than 8 characters.",
"final",
"String",
"sUniqueID",
"=",
"Strin... | Creates and returns a {@link File} representing a uniquely named temporary
file in the configured repository path. The lifetime of the file is tied to
the lifetime of the <code>FileItem</code> instance; the file will be
deleted when the instance is garbage collected.
@return The {@link File} to be used for temporary storage. | [
"Creates",
"and",
"returns",
"a",
"{",
"@link",
"File",
"}",
"representing",
"a",
"uniquely",
"named",
"temporary",
"file",
"in",
"the",
"configured",
"repository",
"path",
".",
"The",
"lifetime",
"of",
"the",
"file",
"is",
"tied",
"to",
"the",
"lifetime",
... | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-web/src/main/java/com/helger/web/fileupload/parse/DiskFileItem.java#L303-L315 |
TheHortonMachine/hortonmachine | apps/src/main/java/org/hortonmachine/style/JFontChooser.java | JFontChooser.showDialog | public Font showDialog(Component component, String title) {
FontTracker ok = new FontTracker(this);
JDialog dialog = createDialog(component, title, true, ok, null);
dialog.addWindowListener(new FontChooserDialog.Closer());
dialog.addComponentListener(new FontChooserDialog.DisposeOnClose());
dialog.setVisible(true); // blocks until user brings dialog down...
return ok.getFont();
} | java | public Font showDialog(Component component, String title) {
FontTracker ok = new FontTracker(this);
JDialog dialog = createDialog(component, title, true, ok, null);
dialog.addWindowListener(new FontChooserDialog.Closer());
dialog.addComponentListener(new FontChooserDialog.DisposeOnClose());
dialog.setVisible(true); // blocks until user brings dialog down...
return ok.getFont();
} | [
"public",
"Font",
"showDialog",
"(",
"Component",
"component",
",",
"String",
"title",
")",
"{",
"FontTracker",
"ok",
"=",
"new",
"FontTracker",
"(",
"this",
")",
";",
"JDialog",
"dialog",
"=",
"createDialog",
"(",
"component",
",",
"title",
",",
"true",
"... | Shows a modal font-chooser dialog and blocks until the
dialog is hidden. If the user presses the "OK" button, then
this method hides/disposes the dialog and returns the selected color.
If the user presses the "Cancel" button or closes the dialog without
pressing "OK", then this method hides/disposes the dialog and returns
<code>null</code>.
@param component the parent <code>Component</code> for the dialog
@param title the String containing the dialog's title
@return the selected font or <code>null</code> if the user opted out
@exception HeadlessException if GraphicsEnvironment.isHeadless()
returns true.
@see java.awt.GraphicsEnvironment#isHeadless | [
"Shows",
"a",
"modal",
"font",
"-",
"chooser",
"dialog",
"and",
"blocks",
"until",
"the",
"dialog",
"is",
"hidden",
".",
"If",
"the",
"user",
"presses",
"the",
"OK",
"button",
"then",
"this",
"method",
"hides",
"/",
"disposes",
"the",
"dialog",
"and",
"r... | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/style/JFontChooser.java#L143-L153 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java | Serializer.readById | @SuppressWarnings("unchecked")
private <T> T readById(int id, BufferInput<?> buffer) {
Class<T> type = (Class<T>) registry.type(id);
if (type == null)
throw new SerializationException("cannot deserialize: unknown type");
TypeSerializer<T> serializer = getSerializer(type);
if (serializer == null)
throw new SerializationException("cannot deserialize: unknown type");
return serializer.read(type, buffer, this);
} | java | @SuppressWarnings("unchecked")
private <T> T readById(int id, BufferInput<?> buffer) {
Class<T> type = (Class<T>) registry.type(id);
if (type == null)
throw new SerializationException("cannot deserialize: unknown type");
TypeSerializer<T> serializer = getSerializer(type);
if (serializer == null)
throw new SerializationException("cannot deserialize: unknown type");
return serializer.read(type, buffer, this);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"readById",
"(",
"int",
"id",
",",
"BufferInput",
"<",
"?",
">",
"buffer",
")",
"{",
"Class",
"<",
"T",
">",
"type",
"=",
"(",
"Class",
"<",
"T",
">",
")",
"registry... | Reads a serializable object.
@param id The serializable type ID.
@param buffer The buffer from which to read the object.
@param <T> The object type.
@return The read object. | [
"Reads",
"a",
"serializable",
"object",
"."
] | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java#L1030-L1041 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Parameters.java | Parameters.setFloat | @NonNull
public Parameters setFloat(@NonNull String name, float value) {
return setValue(name, value);
} | java | @NonNull
public Parameters setFloat(@NonNull String name, float value) {
return setValue(name, value);
} | [
"@",
"NonNull",
"public",
"Parameters",
"setFloat",
"(",
"@",
"NonNull",
"String",
"name",
",",
"float",
"value",
")",
"{",
"return",
"setValue",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Set a float value to the query parameter referenced by the given name. A query parameter
is defined by using the Expression's parameter(String name) function.
@param name The parameter name.
@param value The float value.
@return The self object. | [
"Set",
"a",
"float",
"value",
"to",
"the",
"query",
"parameter",
"referenced",
"by",
"the",
"given",
"name",
".",
"A",
"query",
"parameter",
"is",
"defined",
"by",
"using",
"the",
"Expression",
"s",
"parameter",
"(",
"String",
"name",
")",
"function",
"."
... | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L131-L134 |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._whereLucene | @SuppressWarnings("ConstantConditions")
public void _whereLucene(String fieldName, String whereClause, boolean exact) {
fieldName = ensureValidFieldName(fieldName, false);
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
negateIfNeeded(tokens, fieldName);
WhereToken.WhereOptions options = exact ? new WhereToken.WhereOptions(exact) : null;
WhereToken whereToken = WhereToken.create(WhereOperator.LUCENE, fieldName, addQueryParameter(whereClause), options);
tokens.add(whereToken);
} | java | @SuppressWarnings("ConstantConditions")
public void _whereLucene(String fieldName, String whereClause, boolean exact) {
fieldName = ensureValidFieldName(fieldName, false);
List<QueryToken> tokens = getCurrentWhereTokens();
appendOperatorIfNeeded(tokens);
negateIfNeeded(tokens, fieldName);
WhereToken.WhereOptions options = exact ? new WhereToken.WhereOptions(exact) : null;
WhereToken whereToken = WhereToken.create(WhereOperator.LUCENE, fieldName, addQueryParameter(whereClause), options);
tokens.add(whereToken);
} | [
"@",
"SuppressWarnings",
"(",
"\"ConstantConditions\"",
")",
"public",
"void",
"_whereLucene",
"(",
"String",
"fieldName",
",",
"String",
"whereClause",
",",
"boolean",
"exact",
")",
"{",
"fieldName",
"=",
"ensureValidFieldName",
"(",
"fieldName",
",",
"false",
")... | Filter the results from the index using the specified where clause.
@param fieldName Field name
@param whereClause Where clause
@param exact Use exact matcher | [
"Filter",
"the",
"results",
"from",
"the",
"index",
"using",
"the",
"specified",
"where",
"clause",
"."
] | train | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L413-L424 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java | ManagementClient.getSubscriptionRuntimeInfo | public SubscriptionRuntimeInfo getSubscriptionRuntimeInfo(String topicPath, String subscriptionName) throws ServiceBusException, InterruptedException {
return Utils.completeFuture(this.asyncClient.getSubscriptionRuntimeInfoAsync(topicPath, subscriptionName));
} | java | public SubscriptionRuntimeInfo getSubscriptionRuntimeInfo(String topicPath, String subscriptionName) throws ServiceBusException, InterruptedException {
return Utils.completeFuture(this.asyncClient.getSubscriptionRuntimeInfoAsync(topicPath, subscriptionName));
} | [
"public",
"SubscriptionRuntimeInfo",
"getSubscriptionRuntimeInfo",
"(",
"String",
"topicPath",
",",
"String",
"subscriptionName",
")",
"throws",
"ServiceBusException",
",",
"InterruptedException",
"{",
"return",
"Utils",
".",
"completeFuture",
"(",
"this",
".",
"asyncClie... | Retrieves the runtime information of a subscription in a given topic
@param topicPath - The path of the topic relative to service bus namespace.
@param subscriptionName - The name of the subscription
@return - SubscriptionRuntimeInfo containing the runtime information about the subscription.
@throws IllegalArgumentException - Thrown if path is null, empty, or not in right format or length.
@throws TimeoutException - The operation times out. The timeout period is initiated through ClientSettings.operationTimeout
@throws MessagingEntityNotFoundException - Entity with this name doesn't exist.
@throws AuthorizationFailedException - No sufficient permission to perform this operation. Please check ClientSettings.tokenProvider has correct details.
@throws ServerBusyException - The server is busy. You should wait before you retry the operation.
@throws ServiceBusException - An internal error or an unexpected exception occurred.
@throws InterruptedException if the current thread was interrupted | [
"Retrieves",
"the",
"runtime",
"information",
"of",
"a",
"subscription",
"in",
"a",
"given",
"topic"
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java#L132-L134 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java | JobScheduler.scheduleJobImmediately | public Future<?> scheduleJobImmediately(Properties jobProps, JobListener jobListener, JobLauncher jobLauncher) {
Callable<Void> callable = new Callable<Void>() {
@Override
public Void call() throws JobException {
try {
runJob(jobProps, jobListener, jobLauncher);
} catch (JobException je) {
LOG.error("Failed to run job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), je);
throw je;
}
return null;
}
};
final Future<?> future = this.jobExecutor.submit(callable);
return new Future() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (!cancelRequested) {
return false;
}
boolean result = true;
try {
jobLauncher.cancelJob(jobListener);
} catch (JobException e) {
LOG.error("Failed to cancel job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
result = false;
}
if (mayInterruptIfRunning) {
result &= future.cancel(true);
}
return result;
}
@Override
public boolean isCancelled() {
return future.isCancelled();
}
@Override
public boolean isDone() {
return future.isDone();
}
@Override
public Object get() throws InterruptedException, ExecutionException {
return future.get();
}
@Override
public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return future.get(timeout, unit);
}
};
} | java | public Future<?> scheduleJobImmediately(Properties jobProps, JobListener jobListener, JobLauncher jobLauncher) {
Callable<Void> callable = new Callable<Void>() {
@Override
public Void call() throws JobException {
try {
runJob(jobProps, jobListener, jobLauncher);
} catch (JobException je) {
LOG.error("Failed to run job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), je);
throw je;
}
return null;
}
};
final Future<?> future = this.jobExecutor.submit(callable);
return new Future() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (!cancelRequested) {
return false;
}
boolean result = true;
try {
jobLauncher.cancelJob(jobListener);
} catch (JobException e) {
LOG.error("Failed to cancel job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
result = false;
}
if (mayInterruptIfRunning) {
result &= future.cancel(true);
}
return result;
}
@Override
public boolean isCancelled() {
return future.isCancelled();
}
@Override
public boolean isDone() {
return future.isDone();
}
@Override
public Object get() throws InterruptedException, ExecutionException {
return future.get();
}
@Override
public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return future.get(timeout, unit);
}
};
} | [
"public",
"Future",
"<",
"?",
">",
"scheduleJobImmediately",
"(",
"Properties",
"jobProps",
",",
"JobListener",
"jobListener",
",",
"JobLauncher",
"jobLauncher",
")",
"{",
"Callable",
"<",
"Void",
">",
"callable",
"=",
"new",
"Callable",
"<",
"Void",
">",
"(",... | Schedule a job immediately.
<p>
This method calls the Quartz scheduler to scheduler the job.
</p>
@param jobProps Job configuration properties
@param jobListener {@link JobListener} used for callback,
can be <em>null</em> if no callback is needed.
@throws JobException when there is anything wrong
with scheduling the job | [
"Schedule",
"a",
"job",
"immediately",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java#L258-L312 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.ortho2DLH | public Matrix4x3f ortho2DLH(float left, float right, float bottom, float top, Matrix4x3f dest) {
// calculate right matrix elements
float rm00 = 2.0f / (right - left);
float rm11 = 2.0f / (top - bottom);
float rm30 = -(right + left) / (right - left);
float rm31 = -(top + bottom) / (top - bottom);
// perform optimized multiplication
// compute the last column first, because other columns do not depend on it
dest.m30 = m00 * rm30 + m10 * rm31 + m30;
dest.m31 = m01 * rm30 + m11 * rm31 + m31;
dest.m32 = m02 * rm30 + m12 * rm31 + m32;
dest.m00 = m00 * rm00;
dest.m01 = m01 * rm00;
dest.m02 = m02 * rm00;
dest.m10 = m10 * rm11;
dest.m11 = m11 * rm11;
dest.m12 = m12 * rm11;
dest.m20 = m20;
dest.m21 = m21;
dest.m22 = m22;
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION | PROPERTY_ORTHONORMAL);
return dest;
} | java | public Matrix4x3f ortho2DLH(float left, float right, float bottom, float top, Matrix4x3f dest) {
// calculate right matrix elements
float rm00 = 2.0f / (right - left);
float rm11 = 2.0f / (top - bottom);
float rm30 = -(right + left) / (right - left);
float rm31 = -(top + bottom) / (top - bottom);
// perform optimized multiplication
// compute the last column first, because other columns do not depend on it
dest.m30 = m00 * rm30 + m10 * rm31 + m30;
dest.m31 = m01 * rm30 + m11 * rm31 + m31;
dest.m32 = m02 * rm30 + m12 * rm31 + m32;
dest.m00 = m00 * rm00;
dest.m01 = m01 * rm00;
dest.m02 = m02 * rm00;
dest.m10 = m10 * rm11;
dest.m11 = m11 * rm11;
dest.m12 = m12 * rm11;
dest.m20 = m20;
dest.m21 = m21;
dest.m22 = m22;
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION | PROPERTY_ORTHONORMAL);
return dest;
} | [
"public",
"Matrix4x3f",
"ortho2DLH",
"(",
"float",
"left",
",",
"float",
"right",
",",
"float",
"bottom",
",",
"float",
"top",
",",
"Matrix4x3f",
"dest",
")",
"{",
"// calculate right matrix elements",
"float",
"rm00",
"=",
"2.0f",
"/",
"(",
"right",
"-",
"l... | Apply an orthographic projection transformation for a left-handed coordinate system to this matrix and store the result in <code>dest</code>.
<p>
This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float, Matrix4x3f) orthoLH()} with
<code>zNear=-1</code> and <code>zFar=+1</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix,
then the new matrix will be <code>M * O</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the
orthographic projection transformation will be applied first!
<p>
In order to set the matrix to an orthographic projection without post-multiplying it,
use {@link #setOrtho2DLH(float, float, float, float) setOrthoLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #orthoLH(float, float, float, float, float, float, Matrix4x3f)
@see #setOrtho2DLH(float, float, float, float)
@param left
the distance from the center to the left frustum edge
@param right
the distance from the center to the right frustum edge
@param bottom
the distance from the center to the bottom frustum edge
@param top
the distance from the center to the top frustum edge
@param dest
will hold the result
@return dest | [
"Apply",
"an",
"orthographic",
"projection",
"transformation",
"for",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"to",
"this",
"matrix",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
".",
"<p",
">",
"This",
"metho... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L5774-L5798 |
tiesebarrell/process-assertions | process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/MessageLogger.java | MessageLogger.logError | public final void logError(final Logger logger, final String messageKey, final Object... objects) {
logger.error(getMessage(messageKey, objects));
} | java | public final void logError(final Logger logger, final String messageKey, final Object... objects) {
logger.error(getMessage(messageKey, objects));
} | [
"public",
"final",
"void",
"logError",
"(",
"final",
"Logger",
"logger",
",",
"final",
"String",
"messageKey",
",",
"final",
"Object",
"...",
"objects",
")",
"{",
"logger",
".",
"error",
"(",
"getMessage",
"(",
"messageKey",
",",
"objects",
")",
")",
";",
... | Logs a message by the provided key to the provided {@link Logger} at error level after substituting the parameters in the message by the provided objects.
@param logger the logger to log to
@param messageKey the key of the message in the bundle
@param objects the substitution parameters | [
"Logs",
"a",
"message",
"by",
"the",
"provided",
"key",
"to",
"the",
"provided",
"{"
] | train | https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/MessageLogger.java#L68-L70 |
structurizr/java | structurizr-core/src/com/structurizr/view/ViewSet.java | ViewSet.createDeploymentView | public DeploymentView createDeploymentView(SoftwareSystem softwareSystem, String key, String description) {
assertThatTheSoftwareSystemIsNotNull(softwareSystem);
assertThatTheViewKeyIsSpecifiedAndUnique(key);
DeploymentView view = new DeploymentView(softwareSystem, key, description);
view.setViewSet(this);
deploymentViews.add(view);
return view;
} | java | public DeploymentView createDeploymentView(SoftwareSystem softwareSystem, String key, String description) {
assertThatTheSoftwareSystemIsNotNull(softwareSystem);
assertThatTheViewKeyIsSpecifiedAndUnique(key);
DeploymentView view = new DeploymentView(softwareSystem, key, description);
view.setViewSet(this);
deploymentViews.add(view);
return view;
} | [
"public",
"DeploymentView",
"createDeploymentView",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"String",
"key",
",",
"String",
"description",
")",
"{",
"assertThatTheSoftwareSystemIsNotNull",
"(",
"softwareSystem",
")",
";",
"assertThatTheViewKeyIsSpecifiedAndUnique",
"(",... | Creates a deployment view, where the scope of the view is the specified software system.
@param softwareSystem the SoftwareSystem object representing the scope of the view
@param key the key for the deployment view (must be unique)
@param description a description of the view
@return a DeploymentView object
@throws IllegalArgumentException if the software system is null or the key is not unique | [
"Creates",
"a",
"deployment",
"view",
"where",
"the",
"scope",
"of",
"the",
"view",
"is",
"the",
"specified",
"software",
"system",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L215-L223 |
alkacon/opencms-core | src/org/opencms/ui/contextmenu/CmsContextMenu.java | CmsContextMenu.addItem | public ContextMenuItem addItem(String caption, Resource icon) {
ContextMenuItem item = addItem(caption);
item.setIcon(icon);
return item;
} | java | public ContextMenuItem addItem(String caption, Resource icon) {
ContextMenuItem item = addItem(caption);
item.setIcon(icon);
return item;
} | [
"public",
"ContextMenuItem",
"addItem",
"(",
"String",
"caption",
",",
"Resource",
"icon",
")",
"{",
"ContextMenuItem",
"item",
"=",
"addItem",
"(",
"caption",
")",
";",
"item",
".",
"setIcon",
"(",
"icon",
")",
";",
"return",
"item",
";",
"}"
] | Adds new item to context menu root with given caption and icon.<p>
@param caption the caption
@param icon the icon
@return reference to newly added item | [
"Adds",
"new",
"item",
"to",
"context",
"menu",
"root",
"with",
"given",
"caption",
"and",
"icon",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/contextmenu/CmsContextMenu.java#L1041-L1046 |
sarxos/win-registry | src/main/java/com/github/sarxos/winreg/WindowsRegistry.java | WindowsRegistry.readStringSubKeys | public List<String> readStringSubKeys(HKey hk, String key) throws RegistryException {
return readStringSubKeys(hk, key, null);
} | java | public List<String> readStringSubKeys(HKey hk, String key) throws RegistryException {
return readStringSubKeys(hk, key, null);
} | [
"public",
"List",
"<",
"String",
">",
"readStringSubKeys",
"(",
"HKey",
"hk",
",",
"String",
"key",
")",
"throws",
"RegistryException",
"{",
"return",
"readStringSubKeys",
"(",
"hk",
",",
"key",
",",
"null",
")",
";",
"}"
] | Read the value name(s) from a given key
@param hk the HKEY
@param key the key
@return the value name(s)
@throws RegistryException when something is not right | [
"Read",
"the",
"value",
"name",
"(",
"s",
")",
"from",
"a",
"given",
"key"
] | train | https://github.com/sarxos/win-registry/blob/5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437/src/main/java/com/github/sarxos/winreg/WindowsRegistry.java#L104-L106 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java | DateFunctions.dateDiffStr | public static Expression dateDiffStr(String expression1, String expression2, DatePart part) {
return dateDiffStr(x(expression1), x(expression2), part);
} | java | public static Expression dateDiffStr(String expression1, String expression2, DatePart part) {
return dateDiffStr(x(expression1), x(expression2), part);
} | [
"public",
"static",
"Expression",
"dateDiffStr",
"(",
"String",
"expression1",
",",
"String",
"expression2",
",",
"DatePart",
"part",
")",
"{",
"return",
"dateDiffStr",
"(",
"x",
"(",
"expression1",
")",
",",
"x",
"(",
"expression2",
")",
",",
"part",
")",
... | Returned expression results in Performs Date arithmetic.
Returns the elapsed time between two date strings in a supported format, as an integer whose unit is part. | [
"Returned",
"expression",
"results",
"in",
"Performs",
"Date",
"arithmetic",
".",
"Returns",
"the",
"elapsed",
"time",
"between",
"two",
"date",
"strings",
"in",
"a",
"supported",
"format",
"as",
"an",
"integer",
"whose",
"unit",
"is",
"part",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L132-L134 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.removeAll | @SafeVarargs
public static <T> T[] removeAll(final T[] a, final Object... elements) {
if (N.isNullOrEmpty(a)) {
return a;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final Set<Object> set = N.asSet(elements);
final List<T> result = new ArrayList<>();
for (T e : a) {
if (!set.contains(e)) {
result.add(e);
}
}
return result.toArray((T[]) N.newArray(a.getClass().getComponentType(), result.size()));
} | java | @SafeVarargs
public static <T> T[] removeAll(final T[] a, final Object... elements) {
if (N.isNullOrEmpty(a)) {
return a;
} else if (N.isNullOrEmpty(elements)) {
return a.clone();
} else if (elements.length == 1) {
return removeAllOccurrences(a, elements[0]);
}
final Set<Object> set = N.asSet(elements);
final List<T> result = new ArrayList<>();
for (T e : a) {
if (!set.contains(e)) {
result.add(e);
}
}
return result.toArray((T[]) N.newArray(a.getClass().getComponentType(), result.size()));
} | [
"@",
"SafeVarargs",
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"removeAll",
"(",
"final",
"T",
"[",
"]",
"a",
",",
"final",
"Object",
"...",
"elements",
")",
"{",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"a",
")",
")",
"{",
"return",
"a"... | Returns a new array with removes all the occurrences of specified elements from <code>a</code>
@param a
@param elements
@return
@see Collection#removeAll(Collection) | [
"Returns",
"a",
"new",
"array",
"with",
"removes",
"all",
"the",
"occurrences",
"of",
"specified",
"elements",
"from",
"<code",
">",
"a<",
"/",
"code",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L23535-L23555 |
Bearded-Hen/Android-Bootstrap | AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/ColorUtils.java | ColorUtils.resolveColor | @SuppressWarnings("deprecation")
public static @ColorInt int resolveColor(@ColorRes int color, Context context) {
if (Build.VERSION.SDK_INT >= 23) {
return context.getResources().getColor(color, context.getTheme());
}
else {
return context.getResources().getColor(color);
}
} | java | @SuppressWarnings("deprecation")
public static @ColorInt int resolveColor(@ColorRes int color, Context context) {
if (Build.VERSION.SDK_INT >= 23) {
return context.getResources().getColor(color, context.getTheme());
}
else {
return context.getResources().getColor(color);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"@",
"ColorInt",
"int",
"resolveColor",
"(",
"@",
"ColorRes",
"int",
"color",
",",
"Context",
"context",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"23",
")"... | Resolves a color resource.
@param color the color resource
@param context the current context
@return a color int | [
"Resolves",
"a",
"color",
"resource",
"."
] | train | https://github.com/Bearded-Hen/Android-Bootstrap/blob/b3d62cc1847e26d420c53c92665a4fe1e6ee7ecf/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/utils/ColorUtils.java#L26-L34 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.getFirstParentConstructor | public static Constructor<?> getFirstParentConstructor(Class<?> klass) {
try {
return getOriginalUnmockedType(klass).getSuperclass().getDeclaredConstructors()[0];
} catch (Exception e) {
throw new ConstructorNotFoundException("Failed to lookup constructor.", e);
}
} | java | public static Constructor<?> getFirstParentConstructor(Class<?> klass) {
try {
return getOriginalUnmockedType(klass).getSuperclass().getDeclaredConstructors()[0];
} catch (Exception e) {
throw new ConstructorNotFoundException("Failed to lookup constructor.", e);
}
} | [
"public",
"static",
"Constructor",
"<",
"?",
">",
"getFirstParentConstructor",
"(",
"Class",
"<",
"?",
">",
"klass",
")",
"{",
"try",
"{",
"return",
"getOriginalUnmockedType",
"(",
"klass",
")",
".",
"getSuperclass",
"(",
")",
".",
"getDeclaredConstructors",
"... | Get the first parent constructor defined in a super class of
{@code klass}.
@param klass The class where the constructor is located. {@code null}
).
@return A . | [
"Get",
"the",
"first",
"parent",
"constructor",
"defined",
"in",
"a",
"super",
"class",
"of",
"{",
"@code",
"klass",
"}",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1563-L1569 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/dialog/SARLArgumentsTab.java | SARLArgumentsTab.createSREArgsBlock | protected void createSREArgsBlock(Composite parent, Font font) {
// Create the block for the SRE
final Group group = new Group(parent, SWT.NONE);
group.setFont(font);
final GridLayout layout = new GridLayout();
group.setLayout(layout);
group.setLayoutData(new GridData(GridData.FILL_BOTH));
// Move the SRE argument block before the JVM argument block
group.moveAbove(this.fVMArgumentsBlock.getControl());
group.setText(Messages.SARLArgumentsTab_1);
createSREArgsText(group, font);
createSREArgsVariableButton(group);
} | java | protected void createSREArgsBlock(Composite parent, Font font) {
// Create the block for the SRE
final Group group = new Group(parent, SWT.NONE);
group.setFont(font);
final GridLayout layout = new GridLayout();
group.setLayout(layout);
group.setLayoutData(new GridData(GridData.FILL_BOTH));
// Move the SRE argument block before the JVM argument block
group.moveAbove(this.fVMArgumentsBlock.getControl());
group.setText(Messages.SARLArgumentsTab_1);
createSREArgsText(group, font);
createSREArgsVariableButton(group);
} | [
"protected",
"void",
"createSREArgsBlock",
"(",
"Composite",
"parent",
",",
"Font",
"font",
")",
"{",
"// Create the block for the SRE",
"final",
"Group",
"group",
"=",
"new",
"Group",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"group",
".",
"setFont",
... | Create the block for the SRE arguments.
@param parent the parent composite.
@param font the font for the block. | [
"Create",
"the",
"block",
"for",
"the",
"SRE",
"arguments",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/dialog/SARLArgumentsTab.java#L103-L117 |
finmath/finmath-lib | src/main/java6/net/finmath/montecarlo/interestrate/products/BermudanSwaption.java | BermudanSwaption.getConditionalExpectationEstimator | public ConditionalExpectationEstimatorInterface getConditionalExpectationEstimator(double fixingDate, LIBORModelMonteCarloSimulationInterface model) throws CalculationException {
MonteCarloConditionalExpectationRegression condExpEstimator = new MonteCarloConditionalExpectationRegression(
getRegressionBasisFunctions(fixingDate, model)
);
return condExpEstimator;
} | java | public ConditionalExpectationEstimatorInterface getConditionalExpectationEstimator(double fixingDate, LIBORModelMonteCarloSimulationInterface model) throws CalculationException {
MonteCarloConditionalExpectationRegression condExpEstimator = new MonteCarloConditionalExpectationRegression(
getRegressionBasisFunctions(fixingDate, model)
);
return condExpEstimator;
} | [
"public",
"ConditionalExpectationEstimatorInterface",
"getConditionalExpectationEstimator",
"(",
"double",
"fixingDate",
",",
"LIBORModelMonteCarloSimulationInterface",
"model",
")",
"throws",
"CalculationException",
"{",
"MonteCarloConditionalExpectationRegression",
"condExpEstimator",
... | Return the conditional expectation estimator suitable for this product.
@param fixingDate The condition time.
@param model The model
@return The conditional expectation estimator suitable for this product
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. | [
"Return",
"the",
"conditional",
"expectation",
"estimator",
"suitable",
"for",
"this",
"product",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/products/BermudanSwaption.java#L160-L165 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java | AbstractIndexWriter.addMemberDesc | protected void addMemberDesc(Element member, Content contentTree) {
TypeElement containing = utils.getEnclosingTypeElement(member);
String classdesc = utils.getTypeElementName(containing, true) + " ";
if (utils.isField(member)) {
Content resource = contents.getContent(utils.isStatic(member)
? "doclet.Static_variable_in"
: "doclet.Variable_in", classdesc);
contentTree.addContent(resource);
} else if (utils.isConstructor(member)) {
contentTree.addContent(
contents.getContent("doclet.Constructor_for", classdesc));
} else if (utils.isMethod(member)) {
Content resource = contents.getContent(utils.isStatic(member)
? "doclet.Static_method_in"
: "doclet.Method_in", classdesc);
contentTree.addContent(resource);
}
addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
false, contentTree);
} | java | protected void addMemberDesc(Element member, Content contentTree) {
TypeElement containing = utils.getEnclosingTypeElement(member);
String classdesc = utils.getTypeElementName(containing, true) + " ";
if (utils.isField(member)) {
Content resource = contents.getContent(utils.isStatic(member)
? "doclet.Static_variable_in"
: "doclet.Variable_in", classdesc);
contentTree.addContent(resource);
} else if (utils.isConstructor(member)) {
contentTree.addContent(
contents.getContent("doclet.Constructor_for", classdesc));
} else if (utils.isMethod(member)) {
Content resource = contents.getContent(utils.isStatic(member)
? "doclet.Static_method_in"
: "doclet.Method_in", classdesc);
contentTree.addContent(resource);
}
addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
false, contentTree);
} | [
"protected",
"void",
"addMemberDesc",
"(",
"Element",
"member",
",",
"Content",
"contentTree",
")",
"{",
"TypeElement",
"containing",
"=",
"utils",
".",
"getEnclosingTypeElement",
"(",
"member",
")",
";",
"String",
"classdesc",
"=",
"utils",
".",
"getTypeElementNa... | Add description about the Static Variable/Method/Constructor for a
member.
@param member MemberDoc for the member within the Class Kind
@param contentTree the content tree to which the member description will be added | [
"Add",
"description",
"about",
"the",
"Static",
"Variable",
"/",
"Method",
"/",
"Constructor",
"for",
"a",
"member",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java#L395-L414 |
google/closure-compiler | src/com/google/javascript/rhino/JSDocInfoBuilder.java | JSDocInfoBuilder.recordParameter | public boolean recordParameter(String parameterName, JSTypeExpression type) {
if (!hasAnySingletonTypeTags()
&& currentInfo.declareParam(type, parameterName)) {
populated = true;
return true;
} else {
return false;
}
} | java | public boolean recordParameter(String parameterName, JSTypeExpression type) {
if (!hasAnySingletonTypeTags()
&& currentInfo.declareParam(type, parameterName)) {
populated = true;
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"recordParameter",
"(",
"String",
"parameterName",
",",
"JSTypeExpression",
"type",
")",
"{",
"if",
"(",
"!",
"hasAnySingletonTypeTags",
"(",
")",
"&&",
"currentInfo",
".",
"declareParam",
"(",
"type",
",",
"parameterName",
")",
")",
"{",
... | Records a typed parameter.
@return {@code true} if the typed parameter was recorded and
{@code false} if a parameter with the same name was already defined | [
"Records",
"a",
"typed",
"parameter",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfoBuilder.java#L325-L333 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Graph.java | ST_Graph.createGraph | public static boolean createGraph(Connection connection,
String tableName,
String spatialFieldName) throws SQLException {
// The default tolerance is zero.
return createGraph(connection, tableName, spatialFieldName, 0.0);
} | java | public static boolean createGraph(Connection connection,
String tableName,
String spatialFieldName) throws SQLException {
// The default tolerance is zero.
return createGraph(connection, tableName, spatialFieldName, 0.0);
} | [
"public",
"static",
"boolean",
"createGraph",
"(",
"Connection",
"connection",
",",
"String",
"tableName",
",",
"String",
"spatialFieldName",
")",
"throws",
"SQLException",
"{",
"// The default tolerance is zero.",
"return",
"createGraph",
"(",
"connection",
",",
"table... | Create the nodes and edges tables from the input table containing
LINESTRINGs in the given column.
<p/>
If the input table has name 'input', then the output tables are named
'input_nodes' and 'input_edges'.
@param connection Connection
@param tableName Input table
@param spatialFieldName Name of column containing LINESTRINGs
@return true if both output tables were created
@throws SQLException | [
"Create",
"the",
"nodes",
"and",
"edges",
"tables",
"from",
"the",
"input",
"table",
"containing",
"LINESTRINGs",
"in",
"the",
"given",
"column",
".",
"<p",
"/",
">",
"If",
"the",
"input",
"table",
"has",
"name",
"input",
"then",
"the",
"output",
"tables",... | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Graph.java#L123-L128 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.createWorldToPixel | public static WorldToCameraToPixel createWorldToPixel(CameraPinholeBrown intrinsic , Se3_F64 worldToCamera )
{
WorldToCameraToPixel alg = new WorldToCameraToPixel();
alg.configure(intrinsic,worldToCamera);
return alg;
} | java | public static WorldToCameraToPixel createWorldToPixel(CameraPinholeBrown intrinsic , Se3_F64 worldToCamera )
{
WorldToCameraToPixel alg = new WorldToCameraToPixel();
alg.configure(intrinsic,worldToCamera);
return alg;
} | [
"public",
"static",
"WorldToCameraToPixel",
"createWorldToPixel",
"(",
"CameraPinholeBrown",
"intrinsic",
",",
"Se3_F64",
"worldToCamera",
")",
"{",
"WorldToCameraToPixel",
"alg",
"=",
"new",
"WorldToCameraToPixel",
"(",
")",
";",
"alg",
".",
"configure",
"(",
"intrin... | Creates a transform from world coordinates into pixel coordinates. can handle lens distortion | [
"Creates",
"a",
"transform",
"from",
"world",
"coordinates",
"into",
"pixel",
"coordinates",
".",
"can",
"handle",
"lens",
"distortion"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L687-L692 |
jamesagnew/hapi-fhir | hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Remove_First.java | Remove_First.apply | @Override
public Object apply(Object value, Object... params) {
String original = super.asString(value);
Object needle = super.get(0, params);
if (needle == null) {
throw new RuntimeException("invalid pattern: " + needle);
}
return original.replaceFirst(Pattern.quote(String.valueOf(needle)), "");
} | java | @Override
public Object apply(Object value, Object... params) {
String original = super.asString(value);
Object needle = super.get(0, params);
if (needle == null) {
throw new RuntimeException("invalid pattern: " + needle);
}
return original.replaceFirst(Pattern.quote(String.valueOf(needle)), "");
} | [
"@",
"Override",
"public",
"Object",
"apply",
"(",
"Object",
"value",
",",
"Object",
"...",
"params",
")",
"{",
"String",
"original",
"=",
"super",
".",
"asString",
"(",
"value",
")",
";",
"Object",
"needle",
"=",
"super",
".",
"get",
"(",
"0",
",",
... | /*
remove_first(input, string)
remove the first occurrences of a substring | [
"/",
"*",
"remove_first",
"(",
"input",
"string",
")"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Remove_First.java#L12-L24 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java | ManagementEnforcer.removeFilteredNamedGroupingPolicy | public boolean removeFilteredNamedGroupingPolicy(String ptype, int fieldIndex, String... fieldValues) {
boolean ruleRemoved = removeFilteredPolicy("g", ptype, fieldIndex, fieldValues);
if (autoBuildRoleLinks) {
buildRoleLinks();
}
return ruleRemoved;
} | java | public boolean removeFilteredNamedGroupingPolicy(String ptype, int fieldIndex, String... fieldValues) {
boolean ruleRemoved = removeFilteredPolicy("g", ptype, fieldIndex, fieldValues);
if (autoBuildRoleLinks) {
buildRoleLinks();
}
return ruleRemoved;
} | [
"public",
"boolean",
"removeFilteredNamedGroupingPolicy",
"(",
"String",
"ptype",
",",
"int",
"fieldIndex",
",",
"String",
"...",
"fieldValues",
")",
"{",
"boolean",
"ruleRemoved",
"=",
"removeFilteredPolicy",
"(",
"\"g\"",
",",
"ptype",
",",
"fieldIndex",
",",
"f... | removeFilteredNamedGroupingPolicy removes a role inheritance rule from the current named policy, field filters can be specified.
@param ptype the policy type, can be "g", "g2", "g3", ..
@param fieldIndex the policy rule's start index to be matched.
@param fieldValues the field values to be matched, value ""
means not to match this field.
@return succeeds or not. | [
"removeFilteredNamedGroupingPolicy",
"removes",
"a",
"role",
"inheritance",
"rule",
"from",
"the",
"current",
"named",
"policy",
"field",
"filters",
"can",
"be",
"specified",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java#L538-L545 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.DoubleArray | public JBBPDslBuilder DoubleArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.DOUBLE_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder DoubleArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.DOUBLE_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"DoubleArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"DOUBLE_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
... | Add named double array field which size calculated trough expression.
@param name name of the field, can be null for anonymous
@param sizeExpression expression to be used to calculate array size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"double",
"array",
"field",
"which",
"size",
"calculated",
"trough",
"expression",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1356-L1361 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.isNumber | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })
public static int isNumber(@Nonnull final String value, @Nullable final String name) {
Check.notNull(value, "value");
return Check.isNumber(value, name, Integer.class).intValue();
} | java | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })
public static int isNumber(@Nonnull final String value, @Nullable final String name) {
Check.notNull(value, "value");
return Check.isNumber(value, name, Integer.class).intValue();
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"{",
"IllegalNullArgumentException",
".",
"class",
",",
"IllegalNumberArgumentException",
".",
"class",
"}",
")",
"public",
"static",
"int",
"isNumber",
"(",
"@",
"Nonnull",
"final",
"String",
"value",
",",
"@",
"Null... | Ensures that a string argument is a number according to {@code Integer.parseInt}
@param value
value which must be a number
@param name
name of object reference (in source code)
@return the given string argument converted to an int
@throws IllegalNumberArgumentException
if the given argument {@code value} is no number | [
"Ensures",
"that",
"a",
"string",
"argument",
"is",
"a",
"number",
"according",
"to",
"{",
"@code",
"Integer",
".",
"parseInt",
"}"
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1267-L1272 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java | SecurityCenterClient.groupFindings | public final GroupFindingsPagedResponse groupFindings(SourceName parent, String groupBy) {
GroupFindingsRequest request =
GroupFindingsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setGroupBy(groupBy)
.build();
return groupFindings(request);
} | java | public final GroupFindingsPagedResponse groupFindings(SourceName parent, String groupBy) {
GroupFindingsRequest request =
GroupFindingsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setGroupBy(groupBy)
.build();
return groupFindings(request);
} | [
"public",
"final",
"GroupFindingsPagedResponse",
"groupFindings",
"(",
"SourceName",
"parent",
",",
"String",
"groupBy",
")",
"{",
"GroupFindingsRequest",
"request",
"=",
"GroupFindingsRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
"==",
"nu... | Filters an organization or source's findings and groups them by their specified properties.
<p>To group across all sources provide a `-` as the source id. Example:
/v1/organizations/123/sources/-/findings
<p>Sample code:
<pre><code>
try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) {
SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]");
String groupBy = "";
for (GroupResult element : securityCenterClient.groupFindings(parent, groupBy).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent Name of the source to groupBy. Its format is
"organizations/[organization_id]/sources/[source_id]". To groupBy across all sources
provide a source_id of `-`. For example: organizations/123/sources/-
@param groupBy Expression that defines what assets fields to use for grouping (including
`state_change`). The string value should follow SQL syntax: comma separated list of fields.
For example: "parent,resource_name".
<p>The following fields are supported:
<p>* resource_name * category * state * parent
<p>The following fields are supported when compare_duration is set:
<p>* state_change
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Filters",
"an",
"organization",
"or",
"source",
"s",
"findings",
"and",
"groups",
"them",
"by",
"their",
"specified",
"properties",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java#L813-L820 |
LearnLib/learnlib | commons/counterexamples/src/main/java/de/learnlib/counterexamples/GlobalSuffixFinders.java | GlobalSuffixFinders.findLinear | public static <I, D> List<Word<I>> findLinear(Query<I, D> ceQuery,
AccessSequenceTransformer<I> asTransformer,
SuffixOutput<I, D> hypOutput,
MembershipOracle<I, D> oracle,
boolean allSuffixes) {
int idx = LocalSuffixFinders.findLinear(ceQuery, asTransformer, hypOutput, oracle);
return suffixesForLocalOutput(ceQuery, idx, allSuffixes);
} | java | public static <I, D> List<Word<I>> findLinear(Query<I, D> ceQuery,
AccessSequenceTransformer<I> asTransformer,
SuffixOutput<I, D> hypOutput,
MembershipOracle<I, D> oracle,
boolean allSuffixes) {
int idx = LocalSuffixFinders.findLinear(ceQuery, asTransformer, hypOutput, oracle);
return suffixesForLocalOutput(ceQuery, idx, allSuffixes);
} | [
"public",
"static",
"<",
"I",
",",
"D",
">",
"List",
"<",
"Word",
"<",
"I",
">",
">",
"findLinear",
"(",
"Query",
"<",
"I",
",",
"D",
">",
"ceQuery",
",",
"AccessSequenceTransformer",
"<",
"I",
">",
"asTransformer",
",",
"SuffixOutput",
"<",
"I",
","... | Returns the suffix (plus all of its suffixes, if {@code allSuffixes} is true) found by the access sequence
transformation in ascending linear order.
@param ceQuery
the counterexample query
@param asTransformer
the access sequence transformer
@param hypOutput
interface to the hypothesis output
@param oracle
interface to the SUL output
@param allSuffixes
whether or not to include all suffixes of the found suffix
@return the distinguishing suffixes
@see LocalSuffixFinders#findLinear(Query, AccessSequenceTransformer, SuffixOutput, MembershipOracle) | [
"Returns",
"the",
"suffix",
"(",
"plus",
"all",
"of",
"its",
"suffixes",
"if",
"{",
"@code",
"allSuffixes",
"}",
"is",
"true",
")",
"found",
"by",
"the",
"access",
"sequence",
"transformation",
"in",
"ascending",
"linear",
"order",
"."
] | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/commons/counterexamples/src/main/java/de/learnlib/counterexamples/GlobalSuffixFinders.java#L276-L283 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_DELETE | public void billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_DELETE(String billingAccount, String serviceName, Long menuId, Long entryId) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, menuId, entryId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_DELETE(String billingAccount, String serviceName, Long menuId, Long entryId) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, menuId, entryId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"billingAccount_ovhPabx_serviceName_menu_menuId_entry_entryId_DELETE",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"menuId",
",",
"Long",
"entryId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/... | Delete the given menu entry
REST: DELETE /telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}/entry/{entryId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param menuId [required]
@param entryId [required] | [
"Delete",
"the",
"given",
"menu",
"entry"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7524-L7528 |
ykrasik/jaci | jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java | CliDirectory.autoCompleteCommand | public AutoComplete autoCompleteCommand(String prefix) {
final Trie<CliValueType> possibilities = childCommands.subTrie(prefix).mapValues(CliValueType.COMMAND.<CliCommand>getMapper());
return new AutoComplete(prefix, possibilities);
} | java | public AutoComplete autoCompleteCommand(String prefix) {
final Trie<CliValueType> possibilities = childCommands.subTrie(prefix).mapValues(CliValueType.COMMAND.<CliCommand>getMapper());
return new AutoComplete(prefix, possibilities);
} | [
"public",
"AutoComplete",
"autoCompleteCommand",
"(",
"String",
"prefix",
")",
"{",
"final",
"Trie",
"<",
"CliValueType",
">",
"possibilities",
"=",
"childCommands",
".",
"subTrie",
"(",
"prefix",
")",
".",
"mapValues",
"(",
"CliValueType",
".",
"COMMAND",
".",
... | Auto complete the given prefix with child command possibilities.
@param prefix Prefix to offer auto complete for.
@return Auto complete for the child {@link CliCommand}s that starts with the given prefix. Case insensitive. | [
"Auto",
"complete",
"the",
"given",
"prefix",
"with",
"child",
"command",
"possibilities",
"."
] | train | https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/directory/CliDirectory.java#L133-L136 |
banq/jdonframework | JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelSaveAction.java | ModelSaveAction.makeModel | protected Object makeModel(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, ModelHandler modelHandler)
throws Exception {
Object model = null;
try {
String formName = actionMapping.getName();
if (formName == null)
throw new Exception("no define the FormName in struts_config.xml");
ModelMapping modelMapping = modelHandler.getModelMapping();
String keyName = modelMapping.getKeyName();
String keyValue = request.getParameter(keyName);
if (keyValue == null) {
Debug.logError("[JdonFramework]Need a model's key field : <html:hidden property=MODEL KEY /> in jsp's form! ", module);
}
modelManager.removeCache(keyValue);
Debug.logVerbose("[JdonFramework] no model cache, keyName is " + keyName, module);
model = modelManager.getModelObject(formName);
} catch (Exception e) {
Debug.logError("[JdonFramework] makeModel error: " + e);
throw new Exception(e);
}
return model;
} | java | protected Object makeModel(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, ModelHandler modelHandler)
throws Exception {
Object model = null;
try {
String formName = actionMapping.getName();
if (formName == null)
throw new Exception("no define the FormName in struts_config.xml");
ModelMapping modelMapping = modelHandler.getModelMapping();
String keyName = modelMapping.getKeyName();
String keyValue = request.getParameter(keyName);
if (keyValue == null) {
Debug.logError("[JdonFramework]Need a model's key field : <html:hidden property=MODEL KEY /> in jsp's form! ", module);
}
modelManager.removeCache(keyValue);
Debug.logVerbose("[JdonFramework] no model cache, keyName is " + keyName, module);
model = modelManager.getModelObject(formName);
} catch (Exception e) {
Debug.logError("[JdonFramework] makeModel error: " + e);
throw new Exception(e);
}
return model;
} | [
"protected",
"Object",
"makeModel",
"(",
"ActionMapping",
"actionMapping",
",",
"ActionForm",
"actionForm",
",",
"HttpServletRequest",
"request",
",",
"ModelHandler",
"modelHandler",
")",
"throws",
"Exception",
"{",
"Object",
"model",
"=",
"null",
";",
"try",
"{",
... | create a Model from the jdonframework.xml
@param actionMapping
@param actionForm
@param request
@return Model
@throws java.lang.Exception | [
"create",
"a",
"Model",
"from",
"the",
"jdonframework",
".",
"xml"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/strutsutil/ModelSaveAction.java#L142-L166 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/io/ByteIOUtils.java | ByteIOUtils.writeShort | public static void writeShort(byte[] buf, int pos, short v) {
checkBoundary(buf, pos, 2);
buf[pos++] = (byte) (0xff & (v >> 8));
buf[pos] = (byte) (0xff & v);
} | java | public static void writeShort(byte[] buf, int pos, short v) {
checkBoundary(buf, pos, 2);
buf[pos++] = (byte) (0xff & (v >> 8));
buf[pos] = (byte) (0xff & v);
} | [
"public",
"static",
"void",
"writeShort",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"pos",
",",
"short",
"v",
")",
"{",
"checkBoundary",
"(",
"buf",
",",
"pos",
",",
"2",
")",
";",
"buf",
"[",
"pos",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"0xff... | Writes a specific short value (2 bytes) to the output byte buffer at the given offset.
@param buf output byte buffer
@param pos offset into the byte buffer to write
@param v short value to write | [
"Writes",
"a",
"specific",
"short",
"value",
"(",
"2",
"bytes",
")",
"to",
"the",
"output",
"byte",
"buffer",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/io/ByteIOUtils.java#L144-L148 |
alkacon/opencms-core | src/org/opencms/db/CmsSubscriptionManager.java | CmsSubscriptionManager.markResourceAsVisitedBy | public void markResourceAsVisitedBy(CmsObject cms, String resourcePath, CmsUser user) throws CmsException {
CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL);
markResourceAsVisitedBy(cms, resource, user);
} | java | public void markResourceAsVisitedBy(CmsObject cms, String resourcePath, CmsUser user) throws CmsException {
CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL);
markResourceAsVisitedBy(cms, resource, user);
} | [
"public",
"void",
"markResourceAsVisitedBy",
"(",
"CmsObject",
"cms",
",",
"String",
"resourcePath",
",",
"CmsUser",
"user",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"cms",
".",
"readResource",
"(",
"resourcePath",
",",
"CmsResourceFilter"... | Mark the given resource as visited by the user.<p>
@param cms the current users context
@param resourcePath the name of the resource to mark as visited
@param user the user that visited the resource
@throws CmsException if something goes wrong | [
"Mark",
"the",
"given",
"resource",
"as",
"visited",
"by",
"the",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSubscriptionManager.java#L188-L192 |
google/closure-templates | java/src/com/google/template/soy/types/SoyTypeRegistry.java | SoyTypeRegistry.getOrCreateLegacyObjectMapType | public LegacyObjectMapType getOrCreateLegacyObjectMapType(SoyType keyType, SoyType valueType) {
return legacyObjectMapTypes.intern(LegacyObjectMapType.of(keyType, valueType));
} | java | public LegacyObjectMapType getOrCreateLegacyObjectMapType(SoyType keyType, SoyType valueType) {
return legacyObjectMapTypes.intern(LegacyObjectMapType.of(keyType, valueType));
} | [
"public",
"LegacyObjectMapType",
"getOrCreateLegacyObjectMapType",
"(",
"SoyType",
"keyType",
",",
"SoyType",
"valueType",
")",
"{",
"return",
"legacyObjectMapTypes",
".",
"intern",
"(",
"LegacyObjectMapType",
".",
"of",
"(",
"keyType",
",",
"valueType",
")",
")",
"... | Factory function which creates a legacy object map type, given a key and value type. This folds
map types with identical key/value types together, so asking for the same key/value type twice
will return a pointer to the same type object.
@param keyType The key type of the map.
@param valueType The value type of the map.
@return The map type. | [
"Factory",
"function",
"which",
"creates",
"a",
"legacy",
"object",
"map",
"type",
"given",
"a",
"key",
"and",
"value",
"type",
".",
"This",
"folds",
"map",
"types",
"with",
"identical",
"key",
"/",
"value",
"types",
"together",
"so",
"asking",
"for",
"the... | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/types/SoyTypeRegistry.java#L246-L248 |
landawn/AbacusUtil | src/com/landawn/abacus/util/DateUtil.java | DateUtil.parseJUDate | public static java.util.Date parseJUDate(final String date, final String format, final TimeZone timeZone) {
if (N.isNullOrEmpty(date) || (date.length() == 4 && "null".equalsIgnoreCase(date))) {
return null;
}
return createJUDate(parse(date, format, timeZone));
} | java | public static java.util.Date parseJUDate(final String date, final String format, final TimeZone timeZone) {
if (N.isNullOrEmpty(date) || (date.length() == 4 && "null".equalsIgnoreCase(date))) {
return null;
}
return createJUDate(parse(date, format, timeZone));
} | [
"public",
"static",
"java",
".",
"util",
".",
"Date",
"parseJUDate",
"(",
"final",
"String",
"date",
",",
"final",
"String",
"format",
",",
"final",
"TimeZone",
"timeZone",
")",
"{",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"date",
")",
"||",
"(",
"d... | Converts the specified <code>date</code> with the specified {@code format} to a new instance of java.util.Date.
<code>null</code> is returned if the specified <code>date</code> is null or empty.
@param date
@param format
@throws IllegalArgumentException
if the date given can't be parsed with specified format. | [
"Converts",
"the",
"specified",
"<code",
">",
"date<",
"/",
"code",
">",
"with",
"the",
"specified",
"{",
"@code",
"format",
"}",
"to",
"a",
"new",
"instance",
"of",
"java",
".",
"util",
".",
"Date",
".",
"<code",
">",
"null<",
"/",
"code",
">",
"is"... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L383-L389 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java | NodeSet.addNode | public void addNode(Node n)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
this.addElement(n);
} | java | public void addNode(Node n)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
this.addElement(n);
} | [
"public",
"void",
"addNode",
"(",
"Node",
"n",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER_NODESET_NOT_MUTABLE",
",",
"null",
")",
")",
";",... | Add a node to the NodeSet. Not all types of NodeSets support this
operation
@param n Node to be added
@throws RuntimeException thrown if this NodeSet is not of
a mutable type. | [
"Add",
"a",
"node",
"to",
"the",
"NodeSet",
".",
"Not",
"all",
"types",
"of",
"NodeSets",
"support",
"this",
"operation"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L379-L386 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java | ShanksAgentBayesianReasoningCapability.getNode | public static int getNode(Network bn, String nodeName)
throws ShanksException {
int node = bn.getNode(nodeName);
return node;
} | java | public static int getNode(Network bn, String nodeName)
throws ShanksException {
int node = bn.getNode(nodeName);
return node;
} | [
"public",
"static",
"int",
"getNode",
"(",
"Network",
"bn",
",",
"String",
"nodeName",
")",
"throws",
"ShanksException",
"{",
"int",
"node",
"=",
"bn",
".",
"getNode",
"(",
"nodeName",
")",
";",
"return",
"node",
";",
"}"
] | Return the complete node
@param bn
@param nodeName
@return the ProbabilisticNode object
@throws UnknownNodeException | [
"Return",
"the",
"complete",
"node"
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java#L384-L388 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/BaseAsset.java | BaseAsset.createConversation | public Conversation createConversation(Member author, String content) {
Conversation conversation = getInstance().create().conversation(author, content);
Iterator<Expression> iterator = conversation.getContainedExpressions().iterator();
iterator.next().getMentions().add(this);
conversation.save();
return conversation;
} | java | public Conversation createConversation(Member author, String content) {
Conversation conversation = getInstance().create().conversation(author, content);
Iterator<Expression> iterator = conversation.getContainedExpressions().iterator();
iterator.next().getMentions().add(this);
conversation.save();
return conversation;
} | [
"public",
"Conversation",
"createConversation",
"(",
"Member",
"author",
",",
"String",
"content",
")",
"{",
"Conversation",
"conversation",
"=",
"getInstance",
"(",
")",
".",
"create",
"(",
")",
".",
"conversation",
"(",
"author",
",",
"content",
")",
";",
... | Creates conversation with an expression which mentioned this asset.
@param author Author of conversation expression.
@param content Content of conversation expression.
@return Created conversation | [
"Creates",
"conversation",
"with",
"an",
"expression",
"which",
"mentioned",
"this",
"asset",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/BaseAsset.java#L304-L310 |
JavaMoney/jsr354-api | src/main/java/javax/money/convert/ProviderContextBuilder.java | ProviderContextBuilder.of | public static ProviderContextBuilder of(String provider, RateType rateType, RateType... rateTypes) {
return new ProviderContextBuilder(provider, rateType, rateTypes);
} | java | public static ProviderContextBuilder of(String provider, RateType rateType, RateType... rateTypes) {
return new ProviderContextBuilder(provider, rateType, rateTypes);
} | [
"public",
"static",
"ProviderContextBuilder",
"of",
"(",
"String",
"provider",
",",
"RateType",
"rateType",
",",
"RateType",
"...",
"rateTypes",
")",
"{",
"return",
"new",
"ProviderContextBuilder",
"(",
"provider",
",",
"rateType",
",",
"rateTypes",
")",
";",
"}... | Create a new ProviderContextBuilder instance.
@param provider the provider name, not {@code null}.
@param rateType the required {@link RateType}, not null
@param rateTypes the rate types, not null and not empty.
@return a new {@link javax.money.convert.ProviderContextBuilder} instance, never null. | [
"Create",
"a",
"new",
"ProviderContextBuilder",
"instance",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/convert/ProviderContextBuilder.java#L133-L135 |
apache/incubator-shardingsphere | sharding-spring/sharding-jdbc-spring/sharding-jdbc-spring-boot-starter/src/main/java/org/apache/shardingsphere/shardingjdbc/spring/boot/util/PropertyUtil.java | PropertyUtil.handle | @SuppressWarnings("unchecked")
public static <T> T handle(final Environment environment, final String prefix, final Class<T> targetClass) {
switch (springBootVersion) {
case 1:
return (T) v1(environment, prefix);
default:
return (T) v2(environment, prefix, targetClass);
}
} | java | @SuppressWarnings("unchecked")
public static <T> T handle(final Environment environment, final String prefix, final Class<T> targetClass) {
switch (springBootVersion) {
case 1:
return (T) v1(environment, prefix);
default:
return (T) v2(environment, prefix, targetClass);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"handle",
"(",
"final",
"Environment",
"environment",
",",
"final",
"String",
"prefix",
",",
"final",
"Class",
"<",
"T",
">",
"targetClass",
")",
"{",
"switch",
"("... | Spring Boot 1.x is compatible with Spring Boot 2.x by Using Java Reflect.
@param environment : the environment context
@param prefix : the prefix part of property key
@param targetClass : the target class type of result
@param <T> : refer to @param targetClass
@return T | [
"Spring",
"Boot",
"1",
".",
"x",
"is",
"compatible",
"with",
"Spring",
"Boot",
"2",
".",
"x",
"by",
"Using",
"Java",
"Reflect",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-spring/sharding-jdbc-spring/sharding-jdbc-spring-boot-starter/src/main/java/org/apache/shardingsphere/shardingjdbc/spring/boot/util/PropertyUtil.java#L55-L63 |
wcm-io-caravan/caravan-commons | performance/src/main/java/io/wcm/caravan/common/performance/PerformanceMetrics.java | PerformanceMetrics.createNext | public PerformanceMetrics createNext(String nextAction, String nextDescriptor) {
return createNext(nextAction, nextDescriptor, null);
} | java | public PerformanceMetrics createNext(String nextAction, String nextDescriptor) {
return createNext(nextAction, nextDescriptor, null);
} | [
"public",
"PerformanceMetrics",
"createNext",
"(",
"String",
"nextAction",
",",
"String",
"nextDescriptor",
")",
"{",
"return",
"createNext",
"(",
"nextAction",
",",
"nextDescriptor",
",",
"null",
")",
";",
"}"
] | Creates new instance of performance metrics. Stores the key and correlation id of the parent metrics instance.
Assigns next level.
@param nextAction a short name of measured operation, typically a first prefix of descriptor
@param nextDescriptor a full description of measured operation
@return PerformanceMetrics a new instance of performance metrics with stored key and correlationId from the parent
metrics and assigned next level | [
"Creates",
"new",
"instance",
"of",
"performance",
"metrics",
".",
"Stores",
"the",
"key",
"and",
"correlation",
"id",
"of",
"the",
"parent",
"metrics",
"instance",
".",
"Assigns",
"next",
"level",
"."
] | train | https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/performance/src/main/java/io/wcm/caravan/common/performance/PerformanceMetrics.java#L83-L85 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/BaseTransport.java | BaseTransport.addParam | public void addParam(String strParam, Object obj)
{
String strValue = this.objectToString(obj);
this.addParam(strParam, strValue);
} | java | public void addParam(String strParam, Object obj)
{
String strValue = this.objectToString(obj);
this.addParam(strParam, strValue);
} | [
"public",
"void",
"addParam",
"(",
"String",
"strParam",
",",
"Object",
"obj",
")",
"{",
"String",
"strValue",
"=",
"this",
".",
"objectToString",
"(",
"obj",
")",
";",
"this",
".",
"addParam",
"(",
"strParam",
",",
"strValue",
")",
";",
"}"
] | Add this method param to the param list.
@param strParam The param name.
@param strValue The param value. | [
"Add",
"this",
"method",
"param",
"to",
"the",
"param",
"list",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/transport/BaseTransport.java#L110-L114 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixRedundantInterface | @Fix(io.sarl.lang.validation.IssueCodes.REDUNDANT_INTERFACE_IMPLEMENTATION)
public void fixRedundantInterface(final Issue issue, IssueResolutionAcceptor acceptor) {
ImplementedTypeRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.REDUNDANT_INTERFACE_IMPLEMENTATION)
public void fixRedundantInterface(final Issue issue, IssueResolutionAcceptor acceptor) {
ImplementedTypeRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"REDUNDANT_INTERFACE_IMPLEMENTATION",
")",
"public",
"void",
"fixRedundantInterface",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
"{",
... | Quick fix for "Redundant interface implementation".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Redundant",
"interface",
"implementation",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L729-L732 |
PawelAdamski/HttpClientMock | src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java | HttpClientMockBuilder.withHeader | public HttpClientMockBuilder withHeader(String header, String value) {
return withHeader(header, equalTo(value));
} | java | public HttpClientMockBuilder withHeader(String header, String value) {
return withHeader(header, equalTo(value));
} | [
"public",
"HttpClientMockBuilder",
"withHeader",
"(",
"String",
"header",
",",
"String",
"value",
")",
"{",
"return",
"withHeader",
"(",
"header",
",",
"equalTo",
"(",
"value",
")",
")",
";",
"}"
] | Adds header condition. Header must be equal to provided value.
@param header header name
@param value expected value
@return condition builder | [
"Adds",
"header",
"condition",
".",
"Header",
"must",
"be",
"equal",
"to",
"provided",
"value",
"."
] | train | https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java#L31-L33 |
vatbub/common | core/src/main/java/com/github/vatbub/common/core/StringCommon.java | StringCommon.getRequiredSpaces | private static String getRequiredSpaces(String reference, String message) {
StringBuilder res = new StringBuilder();
int requiredSpaces = reference.length() - message.length() - 4;
for (int i = 0; i < requiredSpaces; i++) {
res.append(" ");
}
return res.toString();
} | java | private static String getRequiredSpaces(String reference, String message) {
StringBuilder res = new StringBuilder();
int requiredSpaces = reference.length() - message.length() - 4;
for (int i = 0; i < requiredSpaces; i++) {
res.append(" ");
}
return res.toString();
} | [
"private",
"static",
"String",
"getRequiredSpaces",
"(",
"String",
"reference",
",",
"String",
"message",
")",
"{",
"StringBuilder",
"res",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"requiredSpaces",
"=",
"reference",
".",
"length",
"(",
")",
"-",
"... | Formats a message to be printed on the console
@param message The line to be formatted
@return The formatted version of {@code message} | [
"Formats",
"a",
"message",
"to",
"be",
"printed",
"on",
"the",
"console"
] | train | https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/core/src/main/java/com/github/vatbub/common/core/StringCommon.java#L90-L99 |
kiegroup/droolsjbpm-integration | kie-camel/src/main/java/org/kie/camel/embedded/component/FastCloner.java | FastCloner.shallowClone | public <T> T shallowClone(final T o) {
if (o == null) {
return null;
}
if (!this.cloningEnabled) {
return o;
}
try {
return cloneInternal(o, null);
} catch (final IllegalAccessException e) {
throw new RuntimeException("error during cloning of " + o, e);
}
} | java | public <T> T shallowClone(final T o) {
if (o == null) {
return null;
}
if (!this.cloningEnabled) {
return o;
}
try {
return cloneInternal(o, null);
} catch (final IllegalAccessException e) {
throw new RuntimeException("error during cloning of " + o, e);
}
} | [
"public",
"<",
"T",
">",
"T",
"shallowClone",
"(",
"final",
"T",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"this",
".",
"cloningEnabled",
")",
"{",
"return",
"o",
";",
"}",
"try",
"{",
... | shallow clones "o". This means that if c=shallowClone(o) then c!=o. Any change to c won't affect o.
@param <T>
the type of o
@param o
the object to be shallow-cloned
@return a shallow clone of "o" | [
"shallow",
"clones",
"o",
".",
"This",
"means",
"that",
"if",
"c",
"=",
"shallowClone",
"(",
"o",
")",
"then",
"c!",
"=",
"o",
".",
"Any",
"change",
"to",
"c",
"won",
"t",
"affect",
"o",
"."
] | train | https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-camel/src/main/java/org/kie/camel/embedded/component/FastCloner.java#L266-L278 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/parse/dep/ProjectiveDependencyParser.java | ProjectiveDependencyParser.insideOutsideSingleRoot | public static DepIoChart insideOutsideSingleRoot(double[] fracRoot, double[][] fracChild) {
final boolean singleRoot = true;
return insideOutside(fracRoot, fracChild, singleRoot);
} | java | public static DepIoChart insideOutsideSingleRoot(double[] fracRoot, double[][] fracChild) {
final boolean singleRoot = true;
return insideOutside(fracRoot, fracChild, singleRoot);
} | [
"public",
"static",
"DepIoChart",
"insideOutsideSingleRoot",
"(",
"double",
"[",
"]",
"fracRoot",
",",
"double",
"[",
"]",
"[",
"]",
"fracChild",
")",
"{",
"final",
"boolean",
"singleRoot",
"=",
"true",
";",
"return",
"insideOutside",
"(",
"fracRoot",
",",
"... | Runs the inside-outside algorithm for dependency parsing.
@param fracRoot Input: The edge weights from the wall to each child.
@param fracChild Input: The edge weights from parent to child.
@return The parse chart. | [
"Runs",
"the",
"inside",
"-",
"outside",
"algorithm",
"for",
"dependency",
"parsing",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/dep/ProjectiveDependencyParser.java#L113-L116 |
b3log/latke | latke-core/src/main/java/org/json/JSONObject.java | JSONObject.putOnce | public JSONObject putOnce(String key, Object value) throws JSONException {
if (key != null && value != null) {
if (this.opt(key) != null) {
throw new JSONException("Duplicate key \"" + key + "\"");
}
return this.put(key, value);
}
return this;
} | java | public JSONObject putOnce(String key, Object value) throws JSONException {
if (key != null && value != null) {
if (this.opt(key) != null) {
throw new JSONException("Duplicate key \"" + key + "\"");
}
return this.put(key, value);
}
return this;
} | [
"public",
"JSONObject",
"putOnce",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"key",
"!=",
"null",
"&&",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"opt",
"(",
"key",
")",
"!=",
"null",... | Put a key/value pair in the JSONObject, but only if the key and the value
are both non-null, and only if there is not already a member with that
name.
@param key
key to insert into
@param value
value to insert
@return this.
@throws JSONException
if the key is a duplicate | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"JSONObject",
"but",
"only",
"if",
"the",
"key",
"and",
"the",
"value",
"are",
"both",
"non",
"-",
"null",
"and",
"only",
"if",
"there",
"is",
"not",
"already",
"a",
"member",
"with",
"that",
"nam... | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1811-L1819 |
javagl/ND | nd-arrays/src/main/java/de/javagl/nd/arrays/j/LongArraysND.java | LongArraysND.wrap | public static LongArrayND wrap(LongTuple t, IntTuple size)
{
Objects.requireNonNull(t, "The tuple is null");
Objects.requireNonNull(size, "The size is null");
int totalSize = IntTupleFunctions.reduce(size, 1, (a, b) -> a * b);
if (t.getSize() != totalSize)
{
throw new IllegalArgumentException(
"The tuple has a size of " + t.getSize() + ", the expected " +
"array size is " + size + " (total: " + totalSize + ")");
}
return new TupleLongArrayND(t, size);
} | java | public static LongArrayND wrap(LongTuple t, IntTuple size)
{
Objects.requireNonNull(t, "The tuple is null");
Objects.requireNonNull(size, "The size is null");
int totalSize = IntTupleFunctions.reduce(size, 1, (a, b) -> a * b);
if (t.getSize() != totalSize)
{
throw new IllegalArgumentException(
"The tuple has a size of " + t.getSize() + ", the expected " +
"array size is " + size + " (total: " + totalSize + ")");
}
return new TupleLongArrayND(t, size);
} | [
"public",
"static",
"LongArrayND",
"wrap",
"(",
"LongTuple",
"t",
",",
"IntTuple",
"size",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"t",
",",
"\"The tuple is null\"",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"size",
",",
"\"The size is null\"",
... | Creates a <i>view</i> on the given tuple as a {@link LongArrayND}.
Changes in the given tuple will be visible in the returned array.
@param t The tuple
@param size The size of the array
@return The view on the tuple
@throws NullPointerException If any argument is <code>null</code>
@throws IllegalArgumentException If the
{@link LongTuple#getSize() size} of the tuple does not match the
given array size (that is, the product of all elements of the given
tuple). | [
"Creates",
"a",
"<i",
">",
"view<",
"/",
"i",
">",
"on",
"the",
"given",
"tuple",
"as",
"a",
"{",
"@link",
"LongArrayND",
"}",
".",
"Changes",
"in",
"the",
"given",
"tuple",
"will",
"be",
"visible",
"in",
"the",
"returned",
"array",
"."
] | train | https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-arrays/src/main/java/de/javagl/nd/arrays/j/LongArraysND.java#L112-L124 |
nextreports/nextreports-server | src/ro/nextreports/server/util/StringUtil.java | StringUtil.getLastCharacters | public static String getLastCharacters(String s, int last) {
int index = s.length() - last + 1;
if (index < 0) {
index = 0;
}
String result = "";
if (index > 0) {
result = " ... ";
}
result = result + s.substring(index);
return result;
} | java | public static String getLastCharacters(String s, int last) {
int index = s.length() - last + 1;
if (index < 0) {
index = 0;
}
String result = "";
if (index > 0) {
result = " ... ";
}
result = result + s.substring(index);
return result;
} | [
"public",
"static",
"String",
"getLastCharacters",
"(",
"String",
"s",
",",
"int",
"last",
")",
"{",
"int",
"index",
"=",
"s",
".",
"length",
"(",
")",
"-",
"last",
"+",
"1",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"index",
"=",
"0",
";",
... | Get last characters from a string : if fewer characters, the string will start with ...
@param s string
@param last last characters
@return a string with last characters | [
"Get",
"last",
"characters",
"from",
"a",
"string",
":",
"if",
"fewer",
"characters",
"the",
"string",
"will",
"start",
"with",
"..."
] | train | https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/util/StringUtil.java#L72-L83 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/expressions/Expressions.java | Expressions.isEqual | public static IsEqual isEqual(ComparableExpression<Number> left, Number constant) {
return new IsEqual(left, constant(constant));
} | java | public static IsEqual isEqual(ComparableExpression<Number> left, Number constant) {
return new IsEqual(left, constant(constant));
} | [
"public",
"static",
"IsEqual",
"isEqual",
"(",
"ComparableExpression",
"<",
"Number",
">",
"left",
",",
"Number",
"constant",
")",
"{",
"return",
"new",
"IsEqual",
"(",
"left",
",",
"constant",
"(",
"constant",
")",
")",
";",
"}"
] | Creates an IsEqual expression from the given expression and constant.
@param left The left expression.
@param constant The constant to compare to.
@return A new IsEqual binary expression. | [
"Creates",
"an",
"IsEqual",
"expression",
"from",
"the",
"given",
"expression",
"and",
"constant",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L148-L150 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java | ScreenField.setSFieldToProperty | public int setSFieldToProperty(String strSuffix, boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = Constant.NORMAL_RETURN;
if (this.isInputField())
{
String strFieldName = this.getSFieldParam(strSuffix);
String strParamValue = this.getSFieldProperty(strFieldName);
if (strParamValue != null)
iErrorCode = this.setSFieldValue(strParamValue, bDisplayOption, iMoveMode);
}
return iErrorCode;
} | java | public int setSFieldToProperty(String strSuffix, boolean bDisplayOption, int iMoveMode)
{
int iErrorCode = Constant.NORMAL_RETURN;
if (this.isInputField())
{
String strFieldName = this.getSFieldParam(strSuffix);
String strParamValue = this.getSFieldProperty(strFieldName);
if (strParamValue != null)
iErrorCode = this.setSFieldValue(strParamValue, bDisplayOption, iMoveMode);
}
return iErrorCode;
} | [
"public",
"int",
"setSFieldToProperty",
"(",
"String",
"strSuffix",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"int",
"iErrorCode",
"=",
"Constant",
".",
"NORMAL_RETURN",
";",
"if",
"(",
"this",
".",
"isInputField",
"(",
")",
")",
"... | Move the HTML input to the screen record fields.
@param strSuffix Only move fields with the suffix.
@return true if one was moved.
@exception DBException File exception. | [
"Move",
"the",
"HTML",
"input",
"to",
"the",
"screen",
"record",
"fields",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L608-L620 |
aws/aws-sdk-java | aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/ReEncryptRequest.java | ReEncryptRequest.withDestinationEncryptionContext | public ReEncryptRequest withDestinationEncryptionContext(java.util.Map<String, String> destinationEncryptionContext) {
setDestinationEncryptionContext(destinationEncryptionContext);
return this;
} | java | public ReEncryptRequest withDestinationEncryptionContext(java.util.Map<String, String> destinationEncryptionContext) {
setDestinationEncryptionContext(destinationEncryptionContext);
return this;
} | [
"public",
"ReEncryptRequest",
"withDestinationEncryptionContext",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"destinationEncryptionContext",
")",
"{",
"setDestinationEncryptionContext",
"(",
"destinationEncryptionContext",
")",
";",
"return",... | <p>
Encryption context to use when the data is reencrypted.
</p>
@param destinationEncryptionContext
Encryption context to use when the data is reencrypted.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Encryption",
"context",
"to",
"use",
"when",
"the",
"data",
"is",
"reencrypted",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kms/src/main/java/com/amazonaws/services/kms/model/ReEncryptRequest.java#L509-L512 |
overturetool/overture | ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java | CharOperation.endsWith | public static final boolean endsWith(char[] array, char[] toBeFound)
{
int i = toBeFound.length;
int j = array.length - i;
if (j < 0)
{
return false;
}
while (--i >= 0)
{
if (toBeFound[i] != array[i + j])
{
return false;
}
}
return true;
} | java | public static final boolean endsWith(char[] array, char[] toBeFound)
{
int i = toBeFound.length;
int j = array.length - i;
if (j < 0)
{
return false;
}
while (--i >= 0)
{
if (toBeFound[i] != array[i + j])
{
return false;
}
}
return true;
} | [
"public",
"static",
"final",
"boolean",
"endsWith",
"(",
"char",
"[",
"]",
"array",
",",
"char",
"[",
"]",
"toBeFound",
")",
"{",
"int",
"i",
"=",
"toBeFound",
".",
"length",
";",
"int",
"j",
"=",
"array",
".",
"length",
"-",
"i",
";",
"if",
"(",
... | Return true if array ends with the sequence of characters contained in toBeFound, otherwise false. <br>
<br>
For example:
<ol>
<li>
<pre>
array = { 'a', 'b', 'c', 'd' }
toBeFound = { 'b', 'c' }
result => false
</pre>
</li>
<li>
<pre>
array = { 'a', 'b', 'c' }
toBeFound = { 'b', 'c' }
result => true
</pre>
</li>
</ol>
@param array
the array to check
@param toBeFound
the array to find
@return true if array ends with the sequence of characters contained in toBeFound, otherwise false.
@throws NullPointerException
if array is null or toBeFound is null | [
"Return",
"true",
"if",
"array",
"ends",
"with",
"the",
"sequence",
"of",
"characters",
"contained",
"in",
"toBeFound",
"otherwise",
"false",
".",
"<br",
">",
"<br",
">",
"For",
"example",
":",
"<ol",
">",
"<li",
">"
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java#L1352-L1369 |
Berico-Technologies/CLAVIN | src/main/java/com/bericotech/clavin/GeoParserFactory.java | GeoParserFactory.getDefault | public static GeoParser getDefault(String pathToLuceneIndex, int maxHitDepth, int maxContentWindow) throws ClavinException {
return getDefault(pathToLuceneIndex, maxHitDepth, maxContentWindow, false);
} | java | public static GeoParser getDefault(String pathToLuceneIndex, int maxHitDepth, int maxContentWindow) throws ClavinException {
return getDefault(pathToLuceneIndex, maxHitDepth, maxContentWindow, false);
} | [
"public",
"static",
"GeoParser",
"getDefault",
"(",
"String",
"pathToLuceneIndex",
",",
"int",
"maxHitDepth",
",",
"int",
"maxContentWindow",
")",
"throws",
"ClavinException",
"{",
"return",
"getDefault",
"(",
"pathToLuceneIndex",
",",
"maxHitDepth",
",",
"maxContentW... | Get a GeoParser with defined values for maxHitDepth and
maxContentWindow.
@param pathToLuceneIndex Path to the local Lucene index.
@param maxHitDepth Number of candidate matches to consider
@param maxContentWindow How much context to consider when resolving
@return GeoParser
@throws ClavinException If the index cannot be created. | [
"Get",
"a",
"GeoParser",
"with",
"defined",
"values",
"for",
"maxHitDepth",
"and",
"maxContentWindow",
"."
] | train | https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/GeoParserFactory.java#L79-L81 |
JDBDT/jdbdt | src/main/java/org/jdbdt/DBSetup.java | DBSetup.doInsert | private static void doInsert(CallInfo callInfo, Table table, DataSet data) {
StringBuilder sql = new StringBuilder("INSERT INTO ");
List<String> tableColumns = table.getColumns();
int columnCount = tableColumns.size();
int[] paramIdx = new int[columnCount];
int param = 0;
Iterator<String> itr = tableColumns.iterator();
String col = itr.next();
paramIdx[param] = ++param;
sql.append(table.getName())
.append('(')
.append(col);
while (itr.hasNext()) {
paramIdx[param] = ++param;
col = itr.next();
sql.append(',')
.append(col);
}
sql.append(") VALUES (?");
for (int i=1; i < columnCount; i++) {
sql.append(",?");
}
sql.append(')');
dataSetOperation(callInfo, table, data, sql.toString(), paramIdx);
} | java | private static void doInsert(CallInfo callInfo, Table table, DataSet data) {
StringBuilder sql = new StringBuilder("INSERT INTO ");
List<String> tableColumns = table.getColumns();
int columnCount = tableColumns.size();
int[] paramIdx = new int[columnCount];
int param = 0;
Iterator<String> itr = tableColumns.iterator();
String col = itr.next();
paramIdx[param] = ++param;
sql.append(table.getName())
.append('(')
.append(col);
while (itr.hasNext()) {
paramIdx[param] = ++param;
col = itr.next();
sql.append(',')
.append(col);
}
sql.append(") VALUES (?");
for (int i=1; i < columnCount; i++) {
sql.append(",?");
}
sql.append(')');
dataSetOperation(callInfo, table, data, sql.toString(), paramIdx);
} | [
"private",
"static",
"void",
"doInsert",
"(",
"CallInfo",
"callInfo",
",",
"Table",
"table",
",",
"DataSet",
"data",
")",
"{",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
"\"INSERT INTO \"",
")",
";",
"List",
"<",
"String",
">",
"tableColumns",
... | Utility method to perform actual data insertion.
@param callInfo Call Info.
@param table Table.
@param data Data set. | [
"Utility",
"method",
"to",
"perform",
"actual",
"data",
"insertion",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DBSetup.java#L106-L133 |
Bernardo-MG/maven-site-fixer | src/main/java/com/bernardomg/velocity/tool/SiteTool.java | SiteTool.transformIcons | public final void transformIcons(final Element root) {
final Map<String, String> replacements; // Texts to replace and
// replacements
checkNotNull(root, "Received a null pointer as root element");
replacements = new HashMap<>();
replacements.put("img[src$=images/add.gif]",
"<span><span class=\"fa fa-plus\" aria-hidden=\"true\"></span><span class=\"sr-only\">Addition</span></span>");
replacements.put("img[src$=images/remove.gif]",
"<span><span class=\"fa fa-minus\" aria-hidden=\"true\"></span><span class=\"sr-only\">Remove</span></span>");
replacements.put("img[src$=images/fix.gif]",
"<span><span class=\"fa fa-wrench\" aria-hidden=\"true\"></span><span class=\"sr-only\">Fix</span></span>");
replacements.put("img[src$=images/update.gif]",
"<span><span class=\"fa fa-refresh\" aria-hidden=\"true\"></span><span class=\"sr-only\">Refresh</span></span>");
replacements.put("img[src$=images/icon_help_sml.gif]",
"<span><span class=\"fa fa-question\" aria-hidden=\"true\"></span><span class=\"sr-only\">Question</span></span>");
replacements.put("img[src$=images/icon_success_sml.gif]",
"<span><span class=\"navbar-icon fa fa-check\" aria-hidden=\"true\" title=\"Passed\" aria-label=\"Passed\"></span><span class=\"sr-only\">Passed</span></span>");
replacements.put("img[src$=images/icon_warning_sml.gif]",
"<span><span class=\"fa fa-exclamation\" aria-hidden=\"true\"></span><span class=\"sr-only\">Warning</span>");
replacements.put("img[src$=images/icon_error_sml.gif]",
"<span><span class=\"navbar-icon fa fa-close\" aria-hidden=\"true\" title=\"Failed\" aria-label=\"Failed\"></span><span class=\"sr-only\">Failed</span></span>");
replacements.put("img[src$=images/icon_info_sml.gif]",
"<span><span class=\"fa fa-info\" aria-hidden=\"true\"></span><span class=\"sr-only\">Info</span></span>");
replaceAll(root, replacements);
} | java | public final void transformIcons(final Element root) {
final Map<String, String> replacements; // Texts to replace and
// replacements
checkNotNull(root, "Received a null pointer as root element");
replacements = new HashMap<>();
replacements.put("img[src$=images/add.gif]",
"<span><span class=\"fa fa-plus\" aria-hidden=\"true\"></span><span class=\"sr-only\">Addition</span></span>");
replacements.put("img[src$=images/remove.gif]",
"<span><span class=\"fa fa-minus\" aria-hidden=\"true\"></span><span class=\"sr-only\">Remove</span></span>");
replacements.put("img[src$=images/fix.gif]",
"<span><span class=\"fa fa-wrench\" aria-hidden=\"true\"></span><span class=\"sr-only\">Fix</span></span>");
replacements.put("img[src$=images/update.gif]",
"<span><span class=\"fa fa-refresh\" aria-hidden=\"true\"></span><span class=\"sr-only\">Refresh</span></span>");
replacements.put("img[src$=images/icon_help_sml.gif]",
"<span><span class=\"fa fa-question\" aria-hidden=\"true\"></span><span class=\"sr-only\">Question</span></span>");
replacements.put("img[src$=images/icon_success_sml.gif]",
"<span><span class=\"navbar-icon fa fa-check\" aria-hidden=\"true\" title=\"Passed\" aria-label=\"Passed\"></span><span class=\"sr-only\">Passed</span></span>");
replacements.put("img[src$=images/icon_warning_sml.gif]",
"<span><span class=\"fa fa-exclamation\" aria-hidden=\"true\"></span><span class=\"sr-only\">Warning</span>");
replacements.put("img[src$=images/icon_error_sml.gif]",
"<span><span class=\"navbar-icon fa fa-close\" aria-hidden=\"true\" title=\"Failed\" aria-label=\"Failed\"></span><span class=\"sr-only\">Failed</span></span>");
replacements.put("img[src$=images/icon_info_sml.gif]",
"<span><span class=\"fa fa-info\" aria-hidden=\"true\"></span><span class=\"sr-only\">Info</span></span>");
replaceAll(root, replacements);
} | [
"public",
"final",
"void",
"transformIcons",
"(",
"final",
"Element",
"root",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"replacements",
";",
"// Texts to replace and",
"// replacements",
"checkNotNull",
"(",
"root",
",",
"\"Received a null pointer... | Transforms the default icons used by the Maven Site to Font Awesome
icons.
@param root
root element with the page | [
"Transforms",
"the",
"default",
"icons",
"used",
"by",
"the",
"Maven",
"Site",
"to",
"Font",
"Awesome",
"icons",
"."
] | train | https://github.com/Bernardo-MG/maven-site-fixer/blob/e064472faa7edb0fca11647a22d90ad72089baa3/src/main/java/com/bernardomg/velocity/tool/SiteTool.java#L252-L279 |
alibaba/jstorm | jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/DirLock.java | DirLock.tryLock | public static DirLock tryLock(FileSystem fs, Path dir) throws IOException {
Path lockFile = getDirLockFile(dir);
try {
FSDataOutputStream ostream = HdfsUtils.tryCreateFile(fs, lockFile);
if (ostream!=null) {
LOG.debug("Thread ({}) Acquired lock on dir {}", threadInfo(), dir);
ostream.close();
return new DirLock(fs, lockFile);
} else {
LOG.debug("Thread ({}) cannot lock dir {} as its already locked.", threadInfo(), dir);
return null;
}
} catch (IOException e) {
LOG.error("Error when acquiring lock on dir " + dir, e);
throw e;
}
} | java | public static DirLock tryLock(FileSystem fs, Path dir) throws IOException {
Path lockFile = getDirLockFile(dir);
try {
FSDataOutputStream ostream = HdfsUtils.tryCreateFile(fs, lockFile);
if (ostream!=null) {
LOG.debug("Thread ({}) Acquired lock on dir {}", threadInfo(), dir);
ostream.close();
return new DirLock(fs, lockFile);
} else {
LOG.debug("Thread ({}) cannot lock dir {} as its already locked.", threadInfo(), dir);
return null;
}
} catch (IOException e) {
LOG.error("Error when acquiring lock on dir " + dir, e);
throw e;
}
} | [
"public",
"static",
"DirLock",
"tryLock",
"(",
"FileSystem",
"fs",
",",
"Path",
"dir",
")",
"throws",
"IOException",
"{",
"Path",
"lockFile",
"=",
"getDirLockFile",
"(",
"dir",
")",
";",
"try",
"{",
"FSDataOutputStream",
"ostream",
"=",
"HdfsUtils",
".",
"tr... | Get a lock on file if not already locked
@param fs
@param dir the dir on which to get a lock
@return The lock object if it the lock was acquired. Returns null if the dir is already locked.
@throws IOException if there were errors | [
"Get",
"a",
"lock",
"on",
"file",
"if",
"not",
"already",
"locked"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/DirLock.java#L55-L72 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/ClientNotificationArea.java | ClientNotificationArea.updateClientNotificationListener | public void updateClientNotificationListener(RESTRequest request, String objectNameStr, NotificationFilter[] filters, JSONConverter converter) {
NotificationTargetInformation nti = toNotificationTargetInformation(request, objectNameStr);
ClientNotificationListener listener = listeners.get(nti);
if (listener == null) {
throw ErrorHelper.createRESTHandlerJsonException(new RuntimeException("There are no listeners registered for " + nti), converter, APIConstants.STATUS_BAD_REQUEST);
}
//Make the update
listener.addClientNotification(filters);
} | java | public void updateClientNotificationListener(RESTRequest request, String objectNameStr, NotificationFilter[] filters, JSONConverter converter) {
NotificationTargetInformation nti = toNotificationTargetInformation(request, objectNameStr);
ClientNotificationListener listener = listeners.get(nti);
if (listener == null) {
throw ErrorHelper.createRESTHandlerJsonException(new RuntimeException("There are no listeners registered for " + nti), converter, APIConstants.STATUS_BAD_REQUEST);
}
//Make the update
listener.addClientNotification(filters);
} | [
"public",
"void",
"updateClientNotificationListener",
"(",
"RESTRequest",
"request",
",",
"String",
"objectNameStr",
",",
"NotificationFilter",
"[",
"]",
"filters",
",",
"JSONConverter",
"converter",
")",
"{",
"NotificationTargetInformation",
"nti",
"=",
"toNotificationTa... | Update the listener for the given object name with the provided filters | [
"Update",
"the",
"listener",
"for",
"the",
"given",
"object",
"name",
"with",
"the",
"provided",
"filters"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/ClientNotificationArea.java#L265-L276 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java | ReviewsImpl.addVideoTranscriptAsync | public Observable<Void> addVideoTranscriptAsync(String teamName, String reviewId, byte[] vTTfile) {
return addVideoTranscriptWithServiceResponseAsync(teamName, reviewId, vTTfile).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> addVideoTranscriptAsync(String teamName, String reviewId, byte[] vTTfile) {
return addVideoTranscriptWithServiceResponseAsync(teamName, reviewId, vTTfile).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"addVideoTranscriptAsync",
"(",
"String",
"teamName",
",",
"String",
"reviewId",
",",
"byte",
"[",
"]",
"vTTfile",
")",
"{",
"return",
"addVideoTranscriptWithServiceResponseAsync",
"(",
"teamName",
",",
"reviewId",
",",
"v... | This API adds a transcript file (text version of all the words spoken in a video) to a video review. The file should be a valid WebVTT format.
@param teamName Your team name.
@param reviewId Id of the review.
@param vTTfile Transcript file of the video.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"This",
"API",
"adds",
"a",
"transcript",
"file",
"(",
"text",
"version",
"of",
"all",
"the",
"words",
"spoken",
"in",
"a",
"video",
")",
"to",
"a",
"video",
"review",
".",
"The",
"file",
"should",
"be",
"a",
"valid",
"WebVTT",
"format",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L1819-L1826 |
aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/MutableByte.java | MutableByte.fromExternal | public static MutableByte fromExternal(final Supplier<Byte> s, final Consumer<Byte> c) {
return new MutableByte() {
@Override
public byte getAsByte() {
return s.get();
}
@Override
public Byte get() {
return getAsByte();
}
@Override
public MutableByte set(final byte value) {
c.accept(value);
return this;
}
};
} | java | public static MutableByte fromExternal(final Supplier<Byte> s, final Consumer<Byte> c) {
return new MutableByte() {
@Override
public byte getAsByte() {
return s.get();
}
@Override
public Byte get() {
return getAsByte();
}
@Override
public MutableByte set(final byte value) {
c.accept(value);
return this;
}
};
} | [
"public",
"static",
"MutableByte",
"fromExternal",
"(",
"final",
"Supplier",
"<",
"Byte",
">",
"s",
",",
"final",
"Consumer",
"<",
"Byte",
">",
"c",
")",
"{",
"return",
"new",
"MutableByte",
"(",
")",
"{",
"@",
"Override",
"public",
"byte",
"getAsByte",
... | Construct a MutableByte that gets and sets an external value using the provided Supplier and Consumer
e.g.
<pre>
{@code
MutableByte mutable = MutableByte.fromExternal(()->!this.value,val->!this.value);
}
</pre>
@param s Supplier of an external value
@param c Consumer that sets an external value
@return MutableByte that gets / sets an external (mutable) value | [
"Construct",
"a",
"MutableByte",
"that",
"gets",
"and",
"sets",
"an",
"external",
"value",
"using",
"the",
"provided",
"Supplier",
"and",
"Consumer"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableByte.java#L81-L99 |
RestComm/sip-servlets | sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionKey.java | SipSessionKey.setToTag | public void setToTag(String toTag, boolean recomputeSessionId) {
this.toTag = toTag;
if(toTag != null && recomputeSessionId) {
// Issue 2365 : to tag needed for getApplicationSession().getSipSession(<sessionId>) to return forked session and not the parent one
computeToString();
}
} | java | public void setToTag(String toTag, boolean recomputeSessionId) {
this.toTag = toTag;
if(toTag != null && recomputeSessionId) {
// Issue 2365 : to tag needed for getApplicationSession().getSipSession(<sessionId>) to return forked session and not the parent one
computeToString();
}
} | [
"public",
"void",
"setToTag",
"(",
"String",
"toTag",
",",
"boolean",
"recomputeSessionId",
")",
"{",
"this",
".",
"toTag",
"=",
"toTag",
";",
"if",
"(",
"toTag",
"!=",
"null",
"&&",
"recomputeSessionId",
")",
"{",
"// Issue 2365 : to tag needed for getApplication... | Sets the to tag on the key when we receive a response.
We recompute the session id only for derived session otherwise the id will change
when the a request is received or sent and the response is sent back or received which should not happen
See TCK test SipSessionListenerTest.testSessionDestroyed001
@param toTag the toTag to set
@param recomputeSessionId check if the sessionid need to be recomputed | [
"Sets",
"the",
"to",
"tag",
"on",
"the",
"key",
"when",
"we",
"receive",
"a",
"response",
".",
"We",
"recompute",
"the",
"session",
"id",
"only",
"for",
"derived",
"session",
"otherwise",
"the",
"id",
"will",
"change",
"when",
"the",
"a",
"request",
"is"... | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionKey.java#L163-L169 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java | DownloadChemCompProvider.writeID | private void writeID(String contents, String currentID) throws IOException{
String localName = getLocalFileName(currentID);
try ( PrintWriter pw = new PrintWriter(new GZIPOutputStream(new FileOutputStream(localName))) ) {
pw.print(contents);
pw.flush();
}
} | java | private void writeID(String contents, String currentID) throws IOException{
String localName = getLocalFileName(currentID);
try ( PrintWriter pw = new PrintWriter(new GZIPOutputStream(new FileOutputStream(localName))) ) {
pw.print(contents);
pw.flush();
}
} | [
"private",
"void",
"writeID",
"(",
"String",
"contents",
",",
"String",
"currentID",
")",
"throws",
"IOException",
"{",
"String",
"localName",
"=",
"getLocalFileName",
"(",
"currentID",
")",
";",
"try",
"(",
"PrintWriter",
"pw",
"=",
"new",
"PrintWriter",
"(",... | Output chemical contents to a file
@param contents File contents
@param currentID Chemical ID, used to determine the filename
@throws IOException | [
"Output",
"chemical",
"contents",
"to",
"a",
"file"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java#L227-L236 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/input/EscapeSequenceCharacterPattern.java | EscapeSequenceCharacterPattern.getKeyStroke | protected KeyStroke getKeyStroke(KeyType key, int mods) {
boolean bShift = false, bCtrl = false, bAlt = false;
if (key == null) { return null; } // alternative: key = KeyType.Unknown;
if (mods >= 0) { // only use when non-negative!
bShift = (mods & SHIFT) != 0;
bAlt = (mods & ALT) != 0;
bCtrl = (mods & CTRL) != 0;
}
return new KeyStroke( key , bCtrl, bAlt, bShift);
} | java | protected KeyStroke getKeyStroke(KeyType key, int mods) {
boolean bShift = false, bCtrl = false, bAlt = false;
if (key == null) { return null; } // alternative: key = KeyType.Unknown;
if (mods >= 0) { // only use when non-negative!
bShift = (mods & SHIFT) != 0;
bAlt = (mods & ALT) != 0;
bCtrl = (mods & CTRL) != 0;
}
return new KeyStroke( key , bCtrl, bAlt, bShift);
} | [
"protected",
"KeyStroke",
"getKeyStroke",
"(",
"KeyType",
"key",
",",
"int",
"mods",
")",
"{",
"boolean",
"bShift",
"=",
"false",
",",
"bCtrl",
"=",
"false",
",",
"bAlt",
"=",
"false",
";",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"return",
"null",
... | combines a KeyType and modifiers into a KeyStroke.
Subclasses can override this for customization purposes.
@param key the KeyType as determined by parsing the sequence.
It will be null, if the pattern looked like a key sequence but wasn't
identified.
@param mods the bitmask of the modifer keys pressed along with the key.
@return either null (to report mis-match), or a valid KeyStroke. | [
"combines",
"a",
"KeyType",
"and",
"modifiers",
"into",
"a",
"KeyStroke",
".",
"Subclasses",
"can",
"override",
"this",
"for",
"customization",
"purposes",
"."
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/input/EscapeSequenceCharacterPattern.java#L140-L149 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPInputHandler.java | PtoPInputHandler.checkTargetAbleToAcceptOrExceptionMessage | private int checkTargetAbleToAcceptOrExceptionMessage(JsDestinationAddress targetDestinationAddr)
throws SITemporaryDestinationNotFoundException, SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkTargetAbleToAcceptOrExceptionMessage", targetDestinationAddr);
int blockingReason = DestinationHandler.OUTPUT_HANDLER_NOT_FOUND;
// If the original routingDestination address in the message was blank we simply return
// 'not found'.
if (targetDestinationAddr != null)
{
// Lookup the routing (target) destination. This may throw a SIMPNotPossibleInCurrentConfigurationException.
DestinationHandler targetDestination =
_messageProcessor.getDestinationManager().getDestination(targetDestinationAddr, false);
SIBUuid8 targetDestinationMEUuid = targetDestinationAddr.getME();
// Can the routing destination accept a message
blockingReason = targetDestination.checkCanAcceptMessage(targetDestinationMEUuid, null);
// If the target is full (or put-disabled, etc) then we want to go on & see if we can
// put to the exception destination of the target destination
if (blockingReason != DestinationHandler.OUTPUT_HANDLER_FOUND)
{
int linkBlockingReason = checkCanExceptionMessage(targetDestination);
// If we can exception the message then reset the blockingReason return code
if (linkBlockingReason == DestinationHandler.OUTPUT_HANDLER_FOUND)
blockingReason = DestinationHandler.OUTPUT_HANDLER_FOUND;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkTargetAbleToAcceptOrExceptionMessage", Integer.valueOf(blockingReason));
return blockingReason;
} | java | private int checkTargetAbleToAcceptOrExceptionMessage(JsDestinationAddress targetDestinationAddr)
throws SITemporaryDestinationNotFoundException, SIResourceException, SINotPossibleInCurrentConfigurationException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "checkTargetAbleToAcceptOrExceptionMessage", targetDestinationAddr);
int blockingReason = DestinationHandler.OUTPUT_HANDLER_NOT_FOUND;
// If the original routingDestination address in the message was blank we simply return
// 'not found'.
if (targetDestinationAddr != null)
{
// Lookup the routing (target) destination. This may throw a SIMPNotPossibleInCurrentConfigurationException.
DestinationHandler targetDestination =
_messageProcessor.getDestinationManager().getDestination(targetDestinationAddr, false);
SIBUuid8 targetDestinationMEUuid = targetDestinationAddr.getME();
// Can the routing destination accept a message
blockingReason = targetDestination.checkCanAcceptMessage(targetDestinationMEUuid, null);
// If the target is full (or put-disabled, etc) then we want to go on & see if we can
// put to the exception destination of the target destination
if (blockingReason != DestinationHandler.OUTPUT_HANDLER_FOUND)
{
int linkBlockingReason = checkCanExceptionMessage(targetDestination);
// If we can exception the message then reset the blockingReason return code
if (linkBlockingReason == DestinationHandler.OUTPUT_HANDLER_FOUND)
blockingReason = DestinationHandler.OUTPUT_HANDLER_FOUND;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkTargetAbleToAcceptOrExceptionMessage", Integer.valueOf(blockingReason));
return blockingReason;
} | [
"private",
"int",
"checkTargetAbleToAcceptOrExceptionMessage",
"(",
"JsDestinationAddress",
"targetDestinationAddr",
")",
"throws",
"SITemporaryDestinationNotFoundException",
",",
"SIResourceException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"if",
"(",
"TraceCompon... | See if a target destination or, if necessary, its exception destination, can
handle any more messages.
@return reason code signifying whether the destination can accept messages or the reason for
not being able to do so.
@throws SINotPossibleInCurrentConfigurationException
@throws SIResourceException
@throws SITemporaryDestinationNotFoundException | [
"See",
"if",
"a",
"target",
"destination",
"or",
"if",
"necessary",
"its",
"exception",
"destination",
"can",
"handle",
"any",
"more",
"messages",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPInputHandler.java#L3324-L3360 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updatePatternAnyEntityRole | public OperationStatus updatePatternAnyEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId, UpdatePatternAnyEntityRoleOptionalParameter updatePatternAnyEntityRoleOptionalParameter) {
return updatePatternAnyEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updatePatternAnyEntityRoleOptionalParameter).toBlocking().single().body();
} | java | public OperationStatus updatePatternAnyEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId, UpdatePatternAnyEntityRoleOptionalParameter updatePatternAnyEntityRoleOptionalParameter) {
return updatePatternAnyEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updatePatternAnyEntityRoleOptionalParameter).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updatePatternAnyEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
",",
"UpdatePatternAnyEntityRoleOptionalParameter",
"updatePatternAnyEntityRoleOptionalParameter",
")",
"{",
"return",
... | Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role ID.
@param updatePatternAnyEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Update",
"an",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L12857-L12859 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/network/BranchRemoteInterface.java | BranchRemoteInterface.make_restful_post | public final ServerResponse make_restful_post(JSONObject body, String url, String tag, String branchKey) {
long reqStartTime = System.currentTimeMillis();
body = body != null ? body : new JSONObject();
if (!addCommonParams(body, branchKey)) {
return new ServerResponse(tag, BranchError.ERR_BRANCH_KEY_INVALID);
}
PrefHelper.Debug("posting to " + url);
PrefHelper.Debug("Post value = " + body.toString());
try {
BranchResponse response = doRestfulPost(url, body);
return processEntityForJSON(response.responseData, response.responseCode, tag);
} catch (BranchRemoteException branchError) {
if (branchError.branchErrorCode == BranchError.ERR_BRANCH_REQ_TIMED_OUT) {
return new ServerResponse(tag, BranchError.ERR_BRANCH_REQ_TIMED_OUT);
} else { // All other errors are considered as connectivity error
return new ServerResponse(tag, BranchError.ERR_BRANCH_NO_CONNECTIVITY);
}
} finally {
if (Branch.getInstance() != null) {
int brttVal = (int) (System.currentTimeMillis() - reqStartTime);
Branch.getInstance().addExtraInstrumentationData(tag + "-" + Defines.Jsonkey.Branch_Round_Trip_Time.getKey(), String.valueOf(brttVal));
}
}
} | java | public final ServerResponse make_restful_post(JSONObject body, String url, String tag, String branchKey) {
long reqStartTime = System.currentTimeMillis();
body = body != null ? body : new JSONObject();
if (!addCommonParams(body, branchKey)) {
return new ServerResponse(tag, BranchError.ERR_BRANCH_KEY_INVALID);
}
PrefHelper.Debug("posting to " + url);
PrefHelper.Debug("Post value = " + body.toString());
try {
BranchResponse response = doRestfulPost(url, body);
return processEntityForJSON(response.responseData, response.responseCode, tag);
} catch (BranchRemoteException branchError) {
if (branchError.branchErrorCode == BranchError.ERR_BRANCH_REQ_TIMED_OUT) {
return new ServerResponse(tag, BranchError.ERR_BRANCH_REQ_TIMED_OUT);
} else { // All other errors are considered as connectivity error
return new ServerResponse(tag, BranchError.ERR_BRANCH_NO_CONNECTIVITY);
}
} finally {
if (Branch.getInstance() != null) {
int brttVal = (int) (System.currentTimeMillis() - reqStartTime);
Branch.getInstance().addExtraInstrumentationData(tag + "-" + Defines.Jsonkey.Branch_Round_Trip_Time.getKey(), String.valueOf(brttVal));
}
}
} | [
"public",
"final",
"ServerResponse",
"make_restful_post",
"(",
"JSONObject",
"body",
",",
"String",
"url",
",",
"String",
"tag",
",",
"String",
"branchKey",
")",
"{",
"long",
"reqStartTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"body",
"=",
... | Method for handling the RESTful POST operations to Branch Servers. Internally calls abstract method {@link #doRestfulPost(String, JSONObject)}
@param url The url end point
@param body {@link JSONObject with parameters to the POST call}
@param tag {@link String} Tag for identifying the request for analytical or debugging purpose
@param branchKey {@link String} Branch key
@return {@link ServerResponse} object representing the result of RESTful POST to Branch Server | [
"Method",
"for",
"handling",
"the",
"RESTful",
"POST",
"operations",
"to",
"Branch",
"Servers",
".",
"Internally",
"calls",
"abstract",
"method",
"{",
"@link",
"#doRestfulPost",
"(",
"String",
"JSONObject",
")",
"}"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/network/BranchRemoteInterface.java#L125-L150 |
prometheus/jmx_exporter | jmx_prometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java | JavaAgent.parseConfig | public static Config parseConfig(String args, String ifc) {
Pattern pattern = Pattern.compile(
"^(?:((?:[\\w.]+)|(?:\\[.+])):)?" + // host name, or ipv4, or ipv6 address in brackets
"(\\d{1,5}):" + // port
"(.+)"); // config file
Matcher matcher = pattern.matcher(args);
if (!matcher.matches()) {
throw new IllegalArgumentException("Malformed arguments - " + args);
}
String givenHost = matcher.group(1);
String givenPort = matcher.group(2);
String givenConfigFile = matcher.group(3);
int port = Integer.parseInt(givenPort);
InetSocketAddress socket;
if (givenHost != null && !givenHost.isEmpty()) {
socket = new InetSocketAddress(givenHost, port);
}
else {
socket = new InetSocketAddress(ifc, port);
givenHost = ifc;
}
return new Config(givenHost, port, givenConfigFile, socket);
} | java | public static Config parseConfig(String args, String ifc) {
Pattern pattern = Pattern.compile(
"^(?:((?:[\\w.]+)|(?:\\[.+])):)?" + // host name, or ipv4, or ipv6 address in brackets
"(\\d{1,5}):" + // port
"(.+)"); // config file
Matcher matcher = pattern.matcher(args);
if (!matcher.matches()) {
throw new IllegalArgumentException("Malformed arguments - " + args);
}
String givenHost = matcher.group(1);
String givenPort = matcher.group(2);
String givenConfigFile = matcher.group(3);
int port = Integer.parseInt(givenPort);
InetSocketAddress socket;
if (givenHost != null && !givenHost.isEmpty()) {
socket = new InetSocketAddress(givenHost, port);
}
else {
socket = new InetSocketAddress(ifc, port);
givenHost = ifc;
}
return new Config(givenHost, port, givenConfigFile, socket);
} | [
"public",
"static",
"Config",
"parseConfig",
"(",
"String",
"args",
",",
"String",
"ifc",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"\"^(?:((?:[\\\\w.]+)|(?:\\\\[.+])):)?\"",
"+",
"// host name, or ipv4, or ipv6 address in brackets",
"\"(\\\\d{1... | Parse the Java Agent configuration. The arguments are typically specified to the JVM as a javaagent as
{@code -javaagent:/path/to/agent.jar=<CONFIG>}. This method parses the {@code <CONFIG>} portion.
@param args provided agent args
@param ifc default bind interface
@return configuration to use for our application | [
"Parse",
"the",
"Java",
"Agent",
"configuration",
".",
"The",
"arguments",
"are",
"typically",
"specified",
"to",
"the",
"JVM",
"as",
"a",
"javaagent",
"as",
"{"
] | train | https://github.com/prometheus/jmx_exporter/blob/6a8d92c580b93d62a1a9183cbb7cb1a3b19a8473/jmx_prometheus_javaagent/src/main/java/io/prometheus/jmx/JavaAgent.java#L46-L73 |
google/closure-compiler | src/com/google/javascript/jscomp/ReplaceMessages.java | ReplaceMessages.getNewValueNode | private Node getNewValueNode(JsMessage message, Node origValueNode)
throws MalformedException {
switch (origValueNode.getToken()) {
case FUNCTION:
// The message is a function. Modify the function node.
updateFunctionNode(message, origValueNode);
return origValueNode;
case STRING:
// The message is a simple string. Modify the string node.
String newString = message.toString();
if (!origValueNode.getString().equals(newString)) {
origValueNode.setString(newString);
compiler.reportChangeToEnclosingScope(origValueNode);
}
return origValueNode;
case ADD:
// The message is a simple string. Create a string node.
return IR.string(message.toString());
case CALL:
// The message is a function call. Replace it with a string expression.
return replaceCallNode(message, origValueNode);
default:
throw new MalformedException(
"Expected FUNCTION, STRING, or ADD node; found: " + origValueNode.getToken(),
origValueNode);
}
} | java | private Node getNewValueNode(JsMessage message, Node origValueNode)
throws MalformedException {
switch (origValueNode.getToken()) {
case FUNCTION:
// The message is a function. Modify the function node.
updateFunctionNode(message, origValueNode);
return origValueNode;
case STRING:
// The message is a simple string. Modify the string node.
String newString = message.toString();
if (!origValueNode.getString().equals(newString)) {
origValueNode.setString(newString);
compiler.reportChangeToEnclosingScope(origValueNode);
}
return origValueNode;
case ADD:
// The message is a simple string. Create a string node.
return IR.string(message.toString());
case CALL:
// The message is a function call. Replace it with a string expression.
return replaceCallNode(message, origValueNode);
default:
throw new MalformedException(
"Expected FUNCTION, STRING, or ADD node; found: " + origValueNode.getToken(),
origValueNode);
}
} | [
"private",
"Node",
"getNewValueNode",
"(",
"JsMessage",
"message",
",",
"Node",
"origValueNode",
")",
"throws",
"MalformedException",
"{",
"switch",
"(",
"origValueNode",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"FUNCTION",
":",
"// The message is a function. Mo... | Constructs a node representing a message's value, or, if possible, just
modifies {@code origValueNode} so that it accurately represents the
message's value.
@param message a message
@param origValueNode the message's original value node
@return a Node that can replace {@code origValueNode}
@throws MalformedException if the passed node's subtree structure is
not as expected | [
"Constructs",
"a",
"node",
"representing",
"a",
"message",
"s",
"value",
"or",
"if",
"possible",
"just",
"modifies",
"{",
"@code",
"origValueNode",
"}",
"so",
"that",
"it",
"accurately",
"represents",
"the",
"message",
"s",
"value",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/ReplaceMessages.java#L119-L145 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java | JournalCreator.modifyDatastreamByValue | public Date modifyDatastreamByValue(Context context,
String pid,
String datastreamID,
String[] altIDs,
String dsLabel,
String mimeType,
String formatURI,
InputStream dsContent,
String checksumType,
String checksum,
String logMessage,
Date lastModifiedDate) throws ServerException {
try {
CreatorJournalEntry cje =
new CreatorJournalEntry(METHOD_MODIFY_DATASTREAM_BY_VALUE,
context);
cje.addArgument(ARGUMENT_NAME_PID, pid);
cje.addArgument(ARGUMENT_NAME_DS_ID, datastreamID);
cje.addArgument(ARGUMENT_NAME_ALT_IDS, altIDs);
cje.addArgument(ARGUMENT_NAME_DS_LABEL, dsLabel);
cje.addArgument(ARGUMENT_NAME_MIME_TYPE, mimeType);
cje.addArgument(ARGUMENT_NAME_FORMAT_URI, formatURI);
cje.addArgument(ARGUMENT_NAME_DS_CONTENT, dsContent);
cje.addArgument(ARGUMENT_NAME_CHECKSUM_TYPE, checksumType);
cje.addArgument(ARGUMENT_NAME_CHECKSUM, checksum);
cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
cje.addArgument(ARGUMENT_NAME_LAST_MODIFIED_DATE, lastModifiedDate);
return (Date) cje.invokeAndClose(delegate, writer);
} catch (JournalException e) {
throw new GeneralException("Problem creating the Journal", e);
}
} | java | public Date modifyDatastreamByValue(Context context,
String pid,
String datastreamID,
String[] altIDs,
String dsLabel,
String mimeType,
String formatURI,
InputStream dsContent,
String checksumType,
String checksum,
String logMessage,
Date lastModifiedDate) throws ServerException {
try {
CreatorJournalEntry cje =
new CreatorJournalEntry(METHOD_MODIFY_DATASTREAM_BY_VALUE,
context);
cje.addArgument(ARGUMENT_NAME_PID, pid);
cje.addArgument(ARGUMENT_NAME_DS_ID, datastreamID);
cje.addArgument(ARGUMENT_NAME_ALT_IDS, altIDs);
cje.addArgument(ARGUMENT_NAME_DS_LABEL, dsLabel);
cje.addArgument(ARGUMENT_NAME_MIME_TYPE, mimeType);
cje.addArgument(ARGUMENT_NAME_FORMAT_URI, formatURI);
cje.addArgument(ARGUMENT_NAME_DS_CONTENT, dsContent);
cje.addArgument(ARGUMENT_NAME_CHECKSUM_TYPE, checksumType);
cje.addArgument(ARGUMENT_NAME_CHECKSUM, checksum);
cje.addArgument(ARGUMENT_NAME_LOG_MESSAGE, logMessage);
cje.addArgument(ARGUMENT_NAME_LAST_MODIFIED_DATE, lastModifiedDate);
return (Date) cje.invokeAndClose(delegate, writer);
} catch (JournalException e) {
throw new GeneralException("Problem creating the Journal", e);
}
} | [
"public",
"Date",
"modifyDatastreamByValue",
"(",
"Context",
"context",
",",
"String",
"pid",
",",
"String",
"datastreamID",
",",
"String",
"[",
"]",
"altIDs",
",",
"String",
"dsLabel",
",",
"String",
"mimeType",
",",
"String",
"formatURI",
",",
"InputStream",
... | Create a journal entry, add the arguments, and invoke the method. | [
"Create",
"a",
"journal",
"entry",
"add",
"the",
"arguments",
"and",
"invoke",
"the",
"method",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java#L204-L235 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/autodiff/VTensor.java | VTensor.getFast | public double getFast(int i0, int i1, int i2) {
int c = offset;
c += strides[0] * i0;
c += strides[1] * i1;
c += strides[2] * i2;
return values.get(c);
} | java | public double getFast(int i0, int i1, int i2) {
int c = offset;
c += strides[0] * i0;
c += strides[1] * i1;
c += strides[2] * i2;
return values.get(c);
} | [
"public",
"double",
"getFast",
"(",
"int",
"i0",
",",
"int",
"i1",
",",
"int",
"i2",
")",
"{",
"int",
"c",
"=",
"offset",
";",
"c",
"+=",
"strides",
"[",
"0",
"]",
"*",
"i0",
";",
"c",
"+=",
"strides",
"[",
"1",
"]",
"*",
"i1",
";",
"c",
"+... | Gets the value of the entry corresponding to the given indices.
@param indices The indices of the multi-dimensional array.
@return The current value. | [
"Gets",
"the",
"value",
"of",
"the",
"entry",
"corresponding",
"to",
"the",
"given",
"indices",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/autodiff/VTensor.java#L91-L97 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Block.java | Block.createNextBlock | Block createNextBlock(@Nullable final Address to, final long version,
@Nullable TransactionOutPoint prevOut, final long time,
final byte[] pubKey, final Coin coinbaseValue,
final int height) {
Block b = new Block(params, version);
b.setDifficultyTarget(difficultyTarget);
b.addCoinbaseTransaction(pubKey, coinbaseValue, height);
if (to != null) {
// Add a transaction paying 50 coins to the "to" address.
Transaction t = new Transaction(params);
t.addOutput(new TransactionOutput(params, t, FIFTY_COINS, to));
// The input does not really need to be a valid signature, as long as it has the right general form.
TransactionInput input;
if (prevOut == null) {
input = new TransactionInput(params, t, Script.createInputScript(EMPTY_BYTES, EMPTY_BYTES));
// Importantly the outpoint hash cannot be zero as that's how we detect a coinbase transaction in isolation
// but it must be unique to avoid 'different' transactions looking the same.
byte[] counter = new byte[32];
counter[0] = (byte) txCounter;
counter[1] = (byte) (txCounter++ >> 8);
input.getOutpoint().setHash(Sha256Hash.wrap(counter));
} else {
input = new TransactionInput(params, t, Script.createInputScript(EMPTY_BYTES, EMPTY_BYTES), prevOut);
}
t.addInput(input);
b.addTransaction(t);
}
b.setPrevBlockHash(getHash());
// Don't let timestamp go backwards
if (getTimeSeconds() >= time)
b.setTime(getTimeSeconds() + 1);
else
b.setTime(time);
b.solve();
try {
b.verifyHeader();
} catch (VerificationException e) {
throw new RuntimeException(e); // Cannot happen.
}
if (b.getVersion() != version) {
throw new RuntimeException();
}
return b;
} | java | Block createNextBlock(@Nullable final Address to, final long version,
@Nullable TransactionOutPoint prevOut, final long time,
final byte[] pubKey, final Coin coinbaseValue,
final int height) {
Block b = new Block(params, version);
b.setDifficultyTarget(difficultyTarget);
b.addCoinbaseTransaction(pubKey, coinbaseValue, height);
if (to != null) {
// Add a transaction paying 50 coins to the "to" address.
Transaction t = new Transaction(params);
t.addOutput(new TransactionOutput(params, t, FIFTY_COINS, to));
// The input does not really need to be a valid signature, as long as it has the right general form.
TransactionInput input;
if (prevOut == null) {
input = new TransactionInput(params, t, Script.createInputScript(EMPTY_BYTES, EMPTY_BYTES));
// Importantly the outpoint hash cannot be zero as that's how we detect a coinbase transaction in isolation
// but it must be unique to avoid 'different' transactions looking the same.
byte[] counter = new byte[32];
counter[0] = (byte) txCounter;
counter[1] = (byte) (txCounter++ >> 8);
input.getOutpoint().setHash(Sha256Hash.wrap(counter));
} else {
input = new TransactionInput(params, t, Script.createInputScript(EMPTY_BYTES, EMPTY_BYTES), prevOut);
}
t.addInput(input);
b.addTransaction(t);
}
b.setPrevBlockHash(getHash());
// Don't let timestamp go backwards
if (getTimeSeconds() >= time)
b.setTime(getTimeSeconds() + 1);
else
b.setTime(time);
b.solve();
try {
b.verifyHeader();
} catch (VerificationException e) {
throw new RuntimeException(e); // Cannot happen.
}
if (b.getVersion() != version) {
throw new RuntimeException();
}
return b;
} | [
"Block",
"createNextBlock",
"(",
"@",
"Nullable",
"final",
"Address",
"to",
",",
"final",
"long",
"version",
",",
"@",
"Nullable",
"TransactionOutPoint",
"prevOut",
",",
"final",
"long",
"time",
",",
"final",
"byte",
"[",
"]",
"pubKey",
",",
"final",
"Coin",... | Returns a solved block that builds on top of this one. This exists for unit tests.
In this variant you can specify a public key (pubkey) for use in generating coinbase blocks.
@param height block height, if known, or -1 otherwise. | [
"Returns",
"a",
"solved",
"block",
"that",
"builds",
"on",
"top",
"of",
"this",
"one",
".",
"This",
"exists",
"for",
"unit",
"tests",
".",
"In",
"this",
"variant",
"you",
"can",
"specify",
"a",
"public",
"key",
"(",
"pubkey",
")",
"for",
"use",
"in",
... | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Block.java#L956-L1001 |
Waikato/moa | moa/src/main/java/moa/classifiers/lazy/SAMkNN.java | SAMkNN.getCMVotes | private double [] getCMVotes(double distancesSTM[], Instances stm, double distancesLTM[], Instances ltm){
double[] distancesCM = new double[distancesSTM.length + distancesLTM.length];
System.arraycopy(distancesSTM, 0, distancesCM, 0, distancesSTM.length);
System.arraycopy(distancesLTM, 0, distancesCM, distancesSTM.length, distancesLTM.length);
int nnIndicesCM[] = nArgMin(Math.min(distancesCM.length, this.kOption.getValue()), distancesCM);
return getDistanceWeightedVotesCM(distancesCM, nnIndicesCM, stm, ltm);
} | java | private double [] getCMVotes(double distancesSTM[], Instances stm, double distancesLTM[], Instances ltm){
double[] distancesCM = new double[distancesSTM.length + distancesLTM.length];
System.arraycopy(distancesSTM, 0, distancesCM, 0, distancesSTM.length);
System.arraycopy(distancesLTM, 0, distancesCM, distancesSTM.length, distancesLTM.length);
int nnIndicesCM[] = nArgMin(Math.min(distancesCM.length, this.kOption.getValue()), distancesCM);
return getDistanceWeightedVotesCM(distancesCM, nnIndicesCM, stm, ltm);
} | [
"private",
"double",
"[",
"]",
"getCMVotes",
"(",
"double",
"distancesSTM",
"[",
"]",
",",
"Instances",
"stm",
",",
"double",
"distancesLTM",
"[",
"]",
",",
"Instances",
"ltm",
")",
"{",
"double",
"[",
"]",
"distancesCM",
"=",
"new",
"double",
"[",
"dist... | Returns the distance weighted votes for the combined memory (CM). | [
"Returns",
"the",
"distance",
"weighted",
"votes",
"for",
"the",
"combined",
"memory",
"(",
"CM",
")",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/SAMkNN.java#L397-L403 |
Commonjava/webdav-handler | common/src/main/java/net/sf/webdav/util/XMLWriter.java | XMLWriter.writeProperty | public void writeProperty(String name, String value) {
writeElement(name, OPENING);
_buffer.append(value);
writeElement(name, CLOSING);
} | java | public void writeProperty(String name, String value) {
writeElement(name, OPENING);
_buffer.append(value);
writeElement(name, CLOSING);
} | [
"public",
"void",
"writeProperty",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"writeElement",
"(",
"name",
",",
"OPENING",
")",
";",
"_buffer",
".",
"append",
"(",
"value",
")",
";",
"writeElement",
"(",
"name",
",",
"CLOSING",
")",
";",
... | Write property to the XML.
@param name
Property name
@param value
Property value | [
"Write",
"property",
"to",
"the",
"XML",
"."
] | train | https://github.com/Commonjava/webdav-handler/blob/39bb7032fc75c1b67d3f2440dd1c234ead96cb9d/common/src/main/java/net/sf/webdav/util/XMLWriter.java#L106-L110 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java | VersionsImpl.importMethodAsync | public Observable<String> importMethodAsync(UUID appId, LuisApp luisApp, ImportMethodVersionsOptionalParameter importMethodOptionalParameter) {
return importMethodWithServiceResponseAsync(appId, luisApp, importMethodOptionalParameter).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | java | public Observable<String> importMethodAsync(UUID appId, LuisApp luisApp, ImportMethodVersionsOptionalParameter importMethodOptionalParameter) {
return importMethodWithServiceResponseAsync(appId, luisApp, importMethodOptionalParameter).map(new Func1<ServiceResponse<String>, String>() {
@Override
public String call(ServiceResponse<String> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"String",
">",
"importMethodAsync",
"(",
"UUID",
"appId",
",",
"LuisApp",
"luisApp",
",",
"ImportMethodVersionsOptionalParameter",
"importMethodOptionalParameter",
")",
"{",
"return",
"importMethodWithServiceResponseAsync",
"(",
"appId",
",",
... | Imports a new version into a LUIS application.
@param appId The application ID.
@param luisApp A LUIS application structure.
@param importMethodOptionalParameter 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 String object | [
"Imports",
"a",
"new",
"version",
"into",
"a",
"LUIS",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java#L901-L908 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java | BoxApiMetadata.getDeleteMetadataTemplateRequest | @Deprecated
public BoxRequestsMetadata.DeleteFileMetadata getDeleteMetadataTemplateRequest(String id, String template) {
return getDeleteFileMetadataTemplateRequest(id, template);
} | java | @Deprecated
public BoxRequestsMetadata.DeleteFileMetadata getDeleteMetadataTemplateRequest(String id, String template) {
return getDeleteFileMetadataTemplateRequest(id, template);
} | [
"@",
"Deprecated",
"public",
"BoxRequestsMetadata",
".",
"DeleteFileMetadata",
"getDeleteMetadataTemplateRequest",
"(",
"String",
"id",
",",
"String",
"template",
")",
"{",
"return",
"getDeleteFileMetadataTemplateRequest",
"(",
"id",
",",
"template",
")",
";",
"}"
] | Gets a request that deletes the metadata for a specific template on a file
Deprecated: use getDeleteFileMetadataTemplateRequest or getDeleteFolderMetadataTemplateRequest instead.
@param id id of the file to retrieve metadata for
@param template metadata template to use
@return request to delete metadata on a file | [
"Gets",
"a",
"request",
"that",
"deletes",
"the",
"metadata",
"for",
"a",
"specific",
"template",
"on",
"a",
"file",
"Deprecated",
":",
"use",
"getDeleteFileMetadataTemplateRequest",
"or",
"getDeleteFolderMetadataTemplateRequest",
"instead",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java#L253-L256 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/SQSMessageConsumerPrefetch.java | SQSMessageConsumerPrefetch.processReceivedMessages | protected void processReceivedMessages(List<Message> messages) {
List<String> nackMessages = new ArrayList<String>();
List<MessageManager> messageManagers = new ArrayList<MessageManager>();
for (Message message : messages) {
try {
javax.jms.Message jmsMessage = convertToJMSMessage(message);
messageManagers.add(new MessageManager(this, jmsMessage));
} catch (JMSException e) {
nackMessages.add(message.getReceiptHandle());
}
}
synchronized (stateLock) {
if (messageListener != null) {
sqsSessionRunnable.scheduleCallBacks(messageListener, messageManagers);
} else {
messageQueue.addAll(messageManagers);
}
messagesPrefetched += messageManagers.size();
notifyStateChange();
}
// Nack any messages that cannot be serialized to JMSMessage.
try {
negativeAcknowledger.action(queueUrl, nackMessages);
} catch (JMSException e) {
LOG.warn("Caught exception while nacking received messages", e);
}
} | java | protected void processReceivedMessages(List<Message> messages) {
List<String> nackMessages = new ArrayList<String>();
List<MessageManager> messageManagers = new ArrayList<MessageManager>();
for (Message message : messages) {
try {
javax.jms.Message jmsMessage = convertToJMSMessage(message);
messageManagers.add(new MessageManager(this, jmsMessage));
} catch (JMSException e) {
nackMessages.add(message.getReceiptHandle());
}
}
synchronized (stateLock) {
if (messageListener != null) {
sqsSessionRunnable.scheduleCallBacks(messageListener, messageManagers);
} else {
messageQueue.addAll(messageManagers);
}
messagesPrefetched += messageManagers.size();
notifyStateChange();
}
// Nack any messages that cannot be serialized to JMSMessage.
try {
negativeAcknowledger.action(queueUrl, nackMessages);
} catch (JMSException e) {
LOG.warn("Caught exception while nacking received messages", e);
}
} | [
"protected",
"void",
"processReceivedMessages",
"(",
"List",
"<",
"Message",
">",
"messages",
")",
"{",
"List",
"<",
"String",
">",
"nackMessages",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"List",
"<",
"MessageManager",
">",
"messageManage... | Converts the received message to JMS message, and pushes to messages to
either callback scheduler for asynchronous message delivery or to
internal buffers for synchronous message delivery. Messages that was not
converted to JMS message will be immediately negative acknowledged. | [
"Converts",
"the",
"received",
"message",
"to",
"JMS",
"message",
"and",
"pushes",
"to",
"messages",
"to",
"either",
"callback",
"scheduler",
"for",
"asynchronous",
"message",
"delivery",
"or",
"to",
"internal",
"buffers",
"for",
"synchronous",
"message",
"deliver... | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/SQSMessageConsumerPrefetch.java#L283-L312 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/results/WrapperImages.java | WrapperImages.updateArtworkType | private void updateArtworkType(List<Artwork> artworkList, ArtworkType type) {
for (Artwork artwork : artworkList) {
artwork.setArtworkType(type);
}
} | java | private void updateArtworkType(List<Artwork> artworkList, ArtworkType type) {
for (Artwork artwork : artworkList) {
artwork.setArtworkType(type);
}
} | [
"private",
"void",
"updateArtworkType",
"(",
"List",
"<",
"Artwork",
">",
"artworkList",
",",
"ArtworkType",
"type",
")",
"{",
"for",
"(",
"Artwork",
"artwork",
":",
"artworkList",
")",
"{",
"artwork",
".",
"setArtworkType",
"(",
"type",
")",
";",
"}",
"}"... | Update the artwork type for the artwork list
@param artworkList
@param type | [
"Update",
"the",
"artwork",
"type",
"for",
"the",
"artwork",
"list"
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/results/WrapperImages.java#L124-L128 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/util/sys/System.java | System.runCommand | public static void runCommand(String[] cmdArray, File logFile, File dir) {
Process proc = System.runProcess(cmdArray, logFile, dir);
if (proc.exitValue() != 0) {
throw new RuntimeException("Command failed with exit code " + proc.exitValue() + ": "
+ System.cmdToString(cmdArray) + "\n" + QFiles.tail(logFile));
}
} | java | public static void runCommand(String[] cmdArray, File logFile, File dir) {
Process proc = System.runProcess(cmdArray, logFile, dir);
if (proc.exitValue() != 0) {
throw new RuntimeException("Command failed with exit code " + proc.exitValue() + ": "
+ System.cmdToString(cmdArray) + "\n" + QFiles.tail(logFile));
}
} | [
"public",
"static",
"void",
"runCommand",
"(",
"String",
"[",
"]",
"cmdArray",
",",
"File",
"logFile",
",",
"File",
"dir",
")",
"{",
"Process",
"proc",
"=",
"System",
".",
"runProcess",
"(",
"cmdArray",
",",
"logFile",
",",
"dir",
")",
";",
"if",
"(",
... | Checks the exit code and throws an Exception if the process failed. | [
"Checks",
"the",
"exit",
"code",
"and",
"throws",
"an",
"Exception",
"if",
"the",
"process",
"failed",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/util/sys/System.java#L20-L26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.