repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.appendSelectionCriteria | private void appendSelectionCriteria(TableAlias alias, PathInfo pathInfo, SelectionCriteria c, StringBuffer buf)
{
appendColName(alias, pathInfo, c.isTranslateAttribute(), buf);
buf.append(c.getClause());
appendParameter(c.getValue(), buf);
} | java | private void appendSelectionCriteria(TableAlias alias, PathInfo pathInfo, SelectionCriteria c, StringBuffer buf)
{
appendColName(alias, pathInfo, c.isTranslateAttribute(), buf);
buf.append(c.getClause());
appendParameter(c.getValue(), buf);
} | [
"private",
"void",
"appendSelectionCriteria",
"(",
"TableAlias",
"alias",
",",
"PathInfo",
"pathInfo",
",",
"SelectionCriteria",
"c",
",",
"StringBuffer",
"buf",
")",
"{",
"appendColName",
"(",
"alias",
",",
"pathInfo",
",",
"c",
".",
"isTranslateAttribute",
"(",
... | Answer the SQL-Clause for a SelectionCriteria
@param c
@param buf | [
"Answer",
"the",
"SQL",
"-",
"Clause",
"for",
"a",
"SelectionCriteria"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L820-L825 |
dbracewell/hermes | hermes-core/src/main/java/com/davidbracewell/hermes/Pipeline.java | Pipeline.process | @SneakyThrows
public Corpus process(@NonNull Corpus documents) {
timer.start();
Broker.Builder<Document> builder = Broker.<Document>builder()
.addProducer(new IterableProducer<>(documents))
.bufferSize(queueSize);
Corpus corpus = documents;
if (returnCorpus && corpus.getDataSetType() == DatasetType.OffHeap) {
Resource tempFile = Resources.temporaryDirectory();
tempFile.deleteOnExit();
try (MultiFileWriter writer = new MultiFileWriter(tempFile, "part-", Config.get("files.partition")
.asIntegerValue(numberOfThreads))) {
builder.addConsumer(new AnnotateConsumer(annotationTypes, onComplete, documentsProcessed, wordsProcessed, writer),
numberOfThreads)
.build()
.run();
}
corpus = Corpus.builder().offHeap().source(CorpusFormats.JSON_OPL, tempFile).build();
} else {
builder.addConsumer(new AnnotateConsumer(annotationTypes, onComplete, documentsProcessed,wordsProcessed, null),
numberOfThreads)
.build()
.run();
}
timer.stop();
totalTime += timer.elapsed(TimeUnit.NANOSECONDS);
timer.reset();
return corpus;
} | java | @SneakyThrows
public Corpus process(@NonNull Corpus documents) {
timer.start();
Broker.Builder<Document> builder = Broker.<Document>builder()
.addProducer(new IterableProducer<>(documents))
.bufferSize(queueSize);
Corpus corpus = documents;
if (returnCorpus && corpus.getDataSetType() == DatasetType.OffHeap) {
Resource tempFile = Resources.temporaryDirectory();
tempFile.deleteOnExit();
try (MultiFileWriter writer = new MultiFileWriter(tempFile, "part-", Config.get("files.partition")
.asIntegerValue(numberOfThreads))) {
builder.addConsumer(new AnnotateConsumer(annotationTypes, onComplete, documentsProcessed, wordsProcessed, writer),
numberOfThreads)
.build()
.run();
}
corpus = Corpus.builder().offHeap().source(CorpusFormats.JSON_OPL, tempFile).build();
} else {
builder.addConsumer(new AnnotateConsumer(annotationTypes, onComplete, documentsProcessed,wordsProcessed, null),
numberOfThreads)
.build()
.run();
}
timer.stop();
totalTime += timer.elapsed(TimeUnit.NANOSECONDS);
timer.reset();
return corpus;
} | [
"@",
"SneakyThrows",
"public",
"Corpus",
"process",
"(",
"@",
"NonNull",
"Corpus",
"documents",
")",
"{",
"timer",
".",
"start",
"(",
")",
";",
"Broker",
".",
"Builder",
"<",
"Document",
">",
"builder",
"=",
"Broker",
".",
"<",
"Document",
">",
"builder"... | Annotates documents with the annotation types defined in the pipeline.
@param documents the source of documents to be annotated | [
"Annotates",
"documents",
"with",
"the",
"annotation",
"types",
"defined",
"in",
"the",
"pipeline",
"."
] | train | https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/Pipeline.java#L197-L229 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsVfsDriver.java | CmsVfsDriver.internalReadResourceState | protected CmsResourceState internalReadResourceState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource)
throws CmsDbSqlException {
CmsResourceState state = CmsResource.STATE_KEEP;
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
try {
conn = m_sqlManager.getConnection(dbc);
stmt = m_sqlManager.getPreparedStatement(conn, projectId, "C_READ_RESOURCE_STATE");
stmt.setString(1, resource.getResourceId().toString());
res = stmt.executeQuery();
if (res.next()) {
state = CmsResourceState.valueOf(res.getInt(m_sqlManager.readQuery("C_RESOURCES_STATE")));
while (res.next()) {
// do nothing only move through all rows because of mssql odbc driver
}
}
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, res);
}
return state;
} | java | protected CmsResourceState internalReadResourceState(CmsDbContext dbc, CmsUUID projectId, CmsResource resource)
throws CmsDbSqlException {
CmsResourceState state = CmsResource.STATE_KEEP;
Connection conn = null;
PreparedStatement stmt = null;
ResultSet res = null;
try {
conn = m_sqlManager.getConnection(dbc);
stmt = m_sqlManager.getPreparedStatement(conn, projectId, "C_READ_RESOURCE_STATE");
stmt.setString(1, resource.getResourceId().toString());
res = stmt.executeQuery();
if (res.next()) {
state = CmsResourceState.valueOf(res.getInt(m_sqlManager.readQuery("C_RESOURCES_STATE")));
while (res.next()) {
// do nothing only move through all rows because of mssql odbc driver
}
}
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, res);
}
return state;
} | [
"protected",
"CmsResourceState",
"internalReadResourceState",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUUID",
"projectId",
",",
"CmsResource",
"resource",
")",
"throws",
"CmsDbSqlException",
"{",
"CmsResourceState",
"state",
"=",
"CmsResource",
".",
"STATE_KEEP",
";",
"Conn... | Returns the resource state of the given resource.<p>
@param dbc the database context
@param projectId the id of the project
@param resource the resource to read the resource state for
@return the resource state of the given resource
@throws CmsDbSqlException if something goes wrong | [
"Returns",
"the",
"resource",
"state",
"of",
"the",
"given",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsVfsDriver.java#L3909-L3936 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/repository/core/executor/ExecutorAnalyzer.java | ExecutorAnalyzer.analyzeExecutor | public static RepositoryExecutor analyzeExecutor(
final ResultDescriptor descriptor,
final Set<RepositoryExecutor> executors,
final RepositoryExecutor defaultExecutor,
final DbType connectionHint,
final boolean customConverterUsed) {
final RepositoryExecutor executorByType = selectByType(descriptor.entityType, executors);
// storing recognized entity type relation to connection specific object (very helpful hint)
descriptor.entityDbType = executorByType == null ? DbType.UNKNOWN : executorByType.getType();
final RepositoryExecutor executor;
if (connectionHint != null) {
// connection hint in priority
executor = find(connectionHint, executors);
check(executor != null, "Executor not found for type set in annotation %s", connectionHint);
if (!customConverterUsed) {
// catch silly errors
validateHint(executorByType, connectionHint);
}
} else {
// automatic detection
executor = executorByType == null ? defaultExecutor : executorByType;
}
return executor;
} | java | public static RepositoryExecutor analyzeExecutor(
final ResultDescriptor descriptor,
final Set<RepositoryExecutor> executors,
final RepositoryExecutor defaultExecutor,
final DbType connectionHint,
final boolean customConverterUsed) {
final RepositoryExecutor executorByType = selectByType(descriptor.entityType, executors);
// storing recognized entity type relation to connection specific object (very helpful hint)
descriptor.entityDbType = executorByType == null ? DbType.UNKNOWN : executorByType.getType();
final RepositoryExecutor executor;
if (connectionHint != null) {
// connection hint in priority
executor = find(connectionHint, executors);
check(executor != null, "Executor not found for type set in annotation %s", connectionHint);
if (!customConverterUsed) {
// catch silly errors
validateHint(executorByType, connectionHint);
}
} else {
// automatic detection
executor = executorByType == null ? defaultExecutor : executorByType;
}
return executor;
} | [
"public",
"static",
"RepositoryExecutor",
"analyzeExecutor",
"(",
"final",
"ResultDescriptor",
"descriptor",
",",
"final",
"Set",
"<",
"RepositoryExecutor",
">",
"executors",
",",
"final",
"RepositoryExecutor",
"defaultExecutor",
",",
"final",
"DbType",
"connectionHint",
... | Selects appropriate executor for repository method. Custom converters most likely will cause
method return type different from raw object, returned from connection. So in such case
detection of connection from return type is impossible.
<p>
If custom converter registered: always use connection hint if available. Note that result
converter could also change connection hint.
<p>
If no custom converter register then if connection hint contradict with result type
analysis throw an error.
@param descriptor result definition
@param executors available executors
@param defaultExecutor default executor to use
@param connectionHint expected connection type hint
@param customConverterUsed true when custom converter registered
@return selected executor instance | [
"Selects",
"appropriate",
"executor",
"for",
"repository",
"method",
".",
"Custom",
"converters",
"most",
"likely",
"will",
"cause",
"method",
"return",
"type",
"different",
"from",
"raw",
"object",
"returned",
"from",
"connection",
".",
"So",
"in",
"such",
"cas... | train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/core/executor/ExecutorAnalyzer.java#L39-L63 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.write | public static void write(HttpServletResponse response, InputStream in, int bufferSize) {
ServletOutputStream out = null;
try {
out = response.getOutputStream();
IoUtil.copy(in, out, bufferSize);
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(out);
IoUtil.close(in);
}
} | java | public static void write(HttpServletResponse response, InputStream in, int bufferSize) {
ServletOutputStream out = null;
try {
out = response.getOutputStream();
IoUtil.copy(in, out, bufferSize);
} catch (IOException e) {
throw new UtilException(e);
} finally {
IoUtil.close(out);
IoUtil.close(in);
}
} | [
"public",
"static",
"void",
"write",
"(",
"HttpServletResponse",
"response",
",",
"InputStream",
"in",
",",
"int",
"bufferSize",
")",
"{",
"ServletOutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"response",
".",
"getOutputStream",
"(",
")",
"... | 返回数据给客户端
@param response 响应对象{@link HttpServletResponse}
@param in 需要返回客户端的内容
@param bufferSize 缓存大小 | [
"返回数据给客户端"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L558-L569 |
threerings/nenya | core/src/main/java/com/threerings/media/FrameManager.java | FrameManager.getRoot | public static Component getRoot (Component comp, Rectangle rect)
{
for (Component c = comp; c != null; c = c.getParent()) {
if (!c.isVisible() || !c.isDisplayable()) {
return null;
}
if (c instanceof Window || c instanceof Applet) {
return c;
}
rect.x += c.getX();
rect.y += c.getY();
}
return null;
} | java | public static Component getRoot (Component comp, Rectangle rect)
{
for (Component c = comp; c != null; c = c.getParent()) {
if (!c.isVisible() || !c.isDisplayable()) {
return null;
}
if (c instanceof Window || c instanceof Applet) {
return c;
}
rect.x += c.getX();
rect.y += c.getY();
}
return null;
} | [
"public",
"static",
"Component",
"getRoot",
"(",
"Component",
"comp",
",",
"Rectangle",
"rect",
")",
"{",
"for",
"(",
"Component",
"c",
"=",
"comp",
";",
"c",
"!=",
"null",
";",
"c",
"=",
"c",
".",
"getParent",
"(",
")",
")",
"{",
"if",
"(",
"!",
... | Returns the root component for the supplied component or null if it is not part of a rooted
hierarchy or if any parent along the way is found to be hidden or without a peer. Along the
way, it adjusts the supplied component-relative rectangle to be relative to the returned
root component. | [
"Returns",
"the",
"root",
"component",
"for",
"the",
"supplied",
"component",
"or",
"null",
"if",
"it",
"is",
"not",
"part",
"of",
"a",
"rooted",
"hierarchy",
"or",
"if",
"any",
"parent",
"along",
"the",
"way",
"is",
"found",
"to",
"be",
"hidden",
"or",
... | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L343-L356 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFactoryDataImpl.java | ChannelFactoryDataImpl.setProperty | synchronized void setProperty(Object key, Object value) throws ChannelFactoryPropertyIgnoredException {
if (null == key) {
throw new ChannelFactoryPropertyIgnoredException("Ignored channel factory property key of null");
}
if (myProperties == null) {
this.myProperties = new HashMap<Object, Object>();
}
this.myProperties.put(key, value);
if (cf != null) {
cf.updateProperties(myProperties);
}
} | java | synchronized void setProperty(Object key, Object value) throws ChannelFactoryPropertyIgnoredException {
if (null == key) {
throw new ChannelFactoryPropertyIgnoredException("Ignored channel factory property key of null");
}
if (myProperties == null) {
this.myProperties = new HashMap<Object, Object>();
}
this.myProperties.put(key, value);
if (cf != null) {
cf.updateProperties(myProperties);
}
} | [
"synchronized",
"void",
"setProperty",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"throws",
"ChannelFactoryPropertyIgnoredException",
"{",
"if",
"(",
"null",
"==",
"key",
")",
"{",
"throw",
"new",
"ChannelFactoryPropertyIgnoredException",
"(",
"\"Ignored chann... | Iternally set a property associated with this object
@param key
@param value
@throws ChannelFactoryPropertyIgnoredException | [
"Iternally",
"set",
"a",
"property",
"associated",
"with",
"this",
"object"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFactoryDataImpl.java#L119-L130 |
paymill/paymill-java | src/main/java/com/paymill/services/TransactionService.java | TransactionService.createWithPreauthorization | public Transaction createWithPreauthorization( Preauthorization preauthorization, Integer amount, String currency ) {
return this.createWithPreauthorization( preauthorization.getId(), amount, currency, null );
} | java | public Transaction createWithPreauthorization( Preauthorization preauthorization, Integer amount, String currency ) {
return this.createWithPreauthorization( preauthorization.getId(), amount, currency, null );
} | [
"public",
"Transaction",
"createWithPreauthorization",
"(",
"Preauthorization",
"preauthorization",
",",
"Integer",
"amount",
",",
"String",
"currency",
")",
"{",
"return",
"this",
".",
"createWithPreauthorization",
"(",
"preauthorization",
".",
"getId",
"(",
")",
","... | Executes a {@link Transaction} with {@link Preauthorization} for the given amount in the given currency.
@param preauthorization
A {@link Preauthorization}, which has reserved some money from the client’s credit card.
@param amount
Amount (in cents) which will be charged.
@param currency
ISO 4217 formatted currency code.
@return {@link Transaction} object indicating whether a the call was successful or not. | [
"Executes",
"a",
"{"
] | train | https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/TransactionService.java#L339-L341 |
scireum/parsii | src/main/java/parsii/tokenizer/Token.java | Token.createAndFill | public static Token createAndFill(TokenType type, Char ch) {
Token result = new Token();
result.type = type;
result.line = ch.getLine();
result.pos = ch.getPos();
result.contents = ch.getStringValue();
result.trigger = ch.getStringValue();
result.source = ch.toString();
return result;
} | java | public static Token createAndFill(TokenType type, Char ch) {
Token result = new Token();
result.type = type;
result.line = ch.getLine();
result.pos = ch.getPos();
result.contents = ch.getStringValue();
result.trigger = ch.getStringValue();
result.source = ch.toString();
return result;
} | [
"public",
"static",
"Token",
"createAndFill",
"(",
"TokenType",
"type",
",",
"Char",
"ch",
")",
"{",
"Token",
"result",
"=",
"new",
"Token",
"(",
")",
";",
"result",
".",
"type",
"=",
"type",
";",
"result",
".",
"line",
"=",
"ch",
".",
"getLine",
"("... | Creates a new token with the given type, using the Char a initial trigger and content.
@param type the type if this token. The supplied Char will be used as initial part of the trigger to further
specify the token
@param ch first character of the content and trigger of this token. Also specifies the position of the token.
@return a new token which is initialized with the given Char | [
"Creates",
"a",
"new",
"token",
"with",
"the",
"given",
"type",
"using",
"the",
"Char",
"a",
"initial",
"trigger",
"and",
"content",
"."
] | train | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Token.java#L86-L95 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java | JdbcRepository.getRandomly | private void getRandomly(final int fetchSize, final StringBuilder sql) {
sql.append(JdbcFactory.getInstance().getRandomlySql(getName(), fetchSize));
} | java | private void getRandomly(final int fetchSize, final StringBuilder sql) {
sql.append(JdbcFactory.getInstance().getRandomlySql(getName(), fetchSize));
} | [
"private",
"void",
"getRandomly",
"(",
"final",
"int",
"fetchSize",
",",
"final",
"StringBuilder",
"sql",
")",
"{",
"sql",
".",
"append",
"(",
"JdbcFactory",
".",
"getInstance",
"(",
")",
".",
"getRandomlySql",
"(",
"getName",
"(",
")",
",",
"fetchSize",
"... | getRandomly.
@param fetchSize fetchSize
@param sql sql | [
"getRandomly",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L671-L673 |
ujmp/universal-java-matrix-package | ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java | Ginv.swapRows | public static void swapRows(Matrix matrix, long row1, long row2) {
double temp = 0;
long cols = matrix.getColumnCount();
for (long col = 0; col < cols; col++) {
temp = matrix.getAsDouble(row1, col);
matrix.setAsDouble(matrix.getAsDouble(row2, col), row1, col);
matrix.setAsDouble(temp, row2, col);
}
} | java | public static void swapRows(Matrix matrix, long row1, long row2) {
double temp = 0;
long cols = matrix.getColumnCount();
for (long col = 0; col < cols; col++) {
temp = matrix.getAsDouble(row1, col);
matrix.setAsDouble(matrix.getAsDouble(row2, col), row1, col);
matrix.setAsDouble(temp, row2, col);
}
} | [
"public",
"static",
"void",
"swapRows",
"(",
"Matrix",
"matrix",
",",
"long",
"row1",
",",
"long",
"row2",
")",
"{",
"double",
"temp",
"=",
"0",
";",
"long",
"cols",
"=",
"matrix",
".",
"getColumnCount",
"(",
")",
";",
"for",
"(",
"long",
"col",
"=",... | Swap components in the two rows.
@param matrix
the matrix to modify
@param row1
the first row
@param row2
the second row | [
"Swap",
"components",
"in",
"the",
"two",
"rows",
"."
] | train | https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java#L206-L214 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.setColumnFamilyProperties | private void setColumnFamilyProperties(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
if ((cfDef != null && cfProperties != null) || (builder != null && cfProperties != null))
{
if (builder != null)
{
builder.append(CQLTranslator.WITH_CLAUSE);
}
onSetKeyValidation(cfDef, cfProperties, builder);
onSetCompactionStrategy(cfDef, cfProperties, builder);
onSetComparatorType(cfDef, cfProperties, builder);
onSetSubComparator(cfDef, cfProperties, builder);
// onSetReplicateOnWrite(cfDef, cfProperties, builder);
onSetCompactionThreshold(cfDef, cfProperties, builder);
onSetComment(cfDef, cfProperties, builder);
onSetTableId(cfDef, cfProperties, builder);
onSetGcGrace(cfDef, cfProperties, builder);
onSetCaching(cfDef, cfProperties, builder);
onSetBloomFilter(cfDef, cfProperties, builder);
onSetRepairChance(cfDef, cfProperties, builder);
onSetReadRepairChance(cfDef, cfProperties, builder);
// Strip last AND clause.
if (builder != null && StringUtils.contains(builder.toString(), CQLTranslator.AND_CLAUSE))
{
builder.delete(builder.lastIndexOf(CQLTranslator.AND_CLAUSE), builder.length());
// builder.deleteCharAt(builder.length() - 2);
}
// Strip last WITH clause.
if (builder != null && StringUtils.contains(builder.toString(), CQLTranslator.WITH_CLAUSE))
{
builder.delete(builder.lastIndexOf(CQLTranslator.WITH_CLAUSE), builder.length());
// builder.deleteCharAt(builder.length() - 2);
}
}
} | java | private void setColumnFamilyProperties(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
if ((cfDef != null && cfProperties != null) || (builder != null && cfProperties != null))
{
if (builder != null)
{
builder.append(CQLTranslator.WITH_CLAUSE);
}
onSetKeyValidation(cfDef, cfProperties, builder);
onSetCompactionStrategy(cfDef, cfProperties, builder);
onSetComparatorType(cfDef, cfProperties, builder);
onSetSubComparator(cfDef, cfProperties, builder);
// onSetReplicateOnWrite(cfDef, cfProperties, builder);
onSetCompactionThreshold(cfDef, cfProperties, builder);
onSetComment(cfDef, cfProperties, builder);
onSetTableId(cfDef, cfProperties, builder);
onSetGcGrace(cfDef, cfProperties, builder);
onSetCaching(cfDef, cfProperties, builder);
onSetBloomFilter(cfDef, cfProperties, builder);
onSetRepairChance(cfDef, cfProperties, builder);
onSetReadRepairChance(cfDef, cfProperties, builder);
// Strip last AND clause.
if (builder != null && StringUtils.contains(builder.toString(), CQLTranslator.AND_CLAUSE))
{
builder.delete(builder.lastIndexOf(CQLTranslator.AND_CLAUSE), builder.length());
// builder.deleteCharAt(builder.length() - 2);
}
// Strip last WITH clause.
if (builder != null && StringUtils.contains(builder.toString(), CQLTranslator.WITH_CLAUSE))
{
builder.delete(builder.lastIndexOf(CQLTranslator.WITH_CLAUSE), builder.length());
// builder.deleteCharAt(builder.length() - 2);
}
}
} | [
"private",
"void",
"setColumnFamilyProperties",
"(",
"CfDef",
"cfDef",
",",
"Properties",
"cfProperties",
",",
"StringBuilder",
"builder",
")",
"{",
"if",
"(",
"(",
"cfDef",
"!=",
"null",
"&&",
"cfProperties",
"!=",
"null",
")",
"||",
"(",
"builder",
"!=",
"... | Sets the column family properties.
@param cfDef
the cf def
@param cfProperties
the c f properties
@param builder
the builder | [
"Sets",
"the",
"column",
"family",
"properties",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2306-L2354 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java | MessageEventManager.sendDisplayedNotification | public void sendDisplayedNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
messageEvent.setDisplayed(true);
messageEvent.setStanzaId(packetID);
msg.addExtension(messageEvent);
// Send the packet
connection().sendStanza(msg);
} | java | public void sendDisplayedNotification(Jid to, String packetID) throws NotConnectedException, InterruptedException {
// Create the message to send
Message msg = new Message(to);
// Create a MessageEvent Package and add it to the message
MessageEvent messageEvent = new MessageEvent();
messageEvent.setDisplayed(true);
messageEvent.setStanzaId(packetID);
msg.addExtension(messageEvent);
// Send the packet
connection().sendStanza(msg);
} | [
"public",
"void",
"sendDisplayedNotification",
"(",
"Jid",
"to",
",",
"String",
"packetID",
")",
"throws",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// Create the message to send",
"Message",
"msg",
"=",
"new",
"Message",
"(",
"to",
")",
";",
"// C... | Sends the notification that the message was displayed to the sender of the original message.
@param to the recipient of the notification.
@param packetID the id of the message to send.
@throws NotConnectedException
@throws InterruptedException | [
"Sends",
"the",
"notification",
"that",
"the",
"message",
"was",
"displayed",
"to",
"the",
"sender",
"of",
"the",
"original",
"message",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java#L235-L245 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java | ChatRoomClient.removeChatRoomMembers | public ResponseWrapper removeChatRoomMembers(long roomId, Members members)
throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(roomId > 0, "room id is invalid");
Preconditions.checkArgument(members != null, "members should not be empty");
return _httpClient.sendDelete(_baseUrl + mChatRoomPath + "/" + roomId + "/members", members.toString());
} | java | public ResponseWrapper removeChatRoomMembers(long roomId, Members members)
throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(roomId > 0, "room id is invalid");
Preconditions.checkArgument(members != null, "members should not be empty");
return _httpClient.sendDelete(_baseUrl + mChatRoomPath + "/" + roomId + "/members", members.toString());
} | [
"public",
"ResponseWrapper",
"removeChatRoomMembers",
"(",
"long",
"roomId",
",",
"Members",
"members",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"roomId",
">",
"0",
",",
"\"room id is invalid\"... | remove members from chat room
@param roomId chat room id
@param members {@link Members}
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"remove",
"members",
"from",
"chat",
"room"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/chatroom/ChatRoomClient.java#L246-L251 |
michael-rapp/AndroidMaterialDialog | example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java | PreferenceFragment.createNeutralButtonListener | private OnClickListener createNeutralButtonListener() {
return new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getActivity(), R.string.neutral_button_toast, Toast.LENGTH_SHORT)
.show();
}
};
} | java | private OnClickListener createNeutralButtonListener() {
return new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getActivity(), R.string.neutral_button_toast, Toast.LENGTH_SHORT)
.show();
}
};
} | [
"private",
"OnClickListener",
"createNeutralButtonListener",
"(",
")",
"{",
"return",
"new",
"OnClickListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onClick",
"(",
"DialogInterface",
"dialog",
",",
"int",
"which",
")",
"{",
"Toast",
".",
"makeText"... | Creates and returns a listener, which allows to show a toast, when the neutral button of a
dialog has been clicked.
@return The listener, which has been created, as an instance of the class {@link
OnClickListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"show",
"a",
"toast",
"when",
"the",
"neutral",
"button",
"of",
"a",
"dialog",
"has",
"been",
"clicked",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java#L772-L782 |
windup/windup | utils/src/main/java/org/jboss/windup/util/furnace/FurnaceClasspathScanner.java | FurnaceClasspathScanner.handleArchiveByFile | private void handleArchiveByFile(Predicate<String> filter, File archive, List<String> discoveredFiles)
{
try
{
try (ZipFile zip = new ZipFile(archive))
{
Enumeration<? extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements())
{
ZipEntry entry = entries.nextElement();
String name = entry.getName();
if (filter.accept(name))
discoveredFiles.add(name);
}
}
}
catch (IOException e)
{
throw new RuntimeException("Error handling file " + archive, e);
}
} | java | private void handleArchiveByFile(Predicate<String> filter, File archive, List<String> discoveredFiles)
{
try
{
try (ZipFile zip = new ZipFile(archive))
{
Enumeration<? extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements())
{
ZipEntry entry = entries.nextElement();
String name = entry.getName();
if (filter.accept(name))
discoveredFiles.add(name);
}
}
}
catch (IOException e)
{
throw new RuntimeException("Error handling file " + archive, e);
}
} | [
"private",
"void",
"handleArchiveByFile",
"(",
"Predicate",
"<",
"String",
">",
"filter",
",",
"File",
"archive",
",",
"List",
"<",
"String",
">",
"discoveredFiles",
")",
"{",
"try",
"{",
"try",
"(",
"ZipFile",
"zip",
"=",
"new",
"ZipFile",
"(",
"archive",... | Scans given archive for files passing given filter, adds the results into given list. | [
"Scans",
"given",
"archive",
"for",
"files",
"passing",
"given",
"filter",
"adds",
"the",
"results",
"into",
"given",
"list",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/utils/src/main/java/org/jboss/windup/util/furnace/FurnaceClasspathScanner.java#L146-L167 |
cdk/cdk | tool/sdg/src/main/java/org/openscience/cdk/layout/IdentityTemplateLibrary.java | IdentityTemplateLibrary.loadFromResource | static IdentityTemplateLibrary loadFromResource(String resource) {
InputStream in = IdentityTemplateLibrary.class.getResourceAsStream(resource);
try {
return load(in);
} catch (IOException e) {
throw new IllegalArgumentException("Could not load template library from resource " + resource, e);
} finally {
try {
if (in != null) in.close();
} catch (IOException e) {
// ignored
}
}
} | java | static IdentityTemplateLibrary loadFromResource(String resource) {
InputStream in = IdentityTemplateLibrary.class.getResourceAsStream(resource);
try {
return load(in);
} catch (IOException e) {
throw new IllegalArgumentException("Could not load template library from resource " + resource, e);
} finally {
try {
if (in != null) in.close();
} catch (IOException e) {
// ignored
}
}
} | [
"static",
"IdentityTemplateLibrary",
"loadFromResource",
"(",
"String",
"resource",
")",
"{",
"InputStream",
"in",
"=",
"IdentityTemplateLibrary",
".",
"class",
".",
"getResourceAsStream",
"(",
"resource",
")",
";",
"try",
"{",
"return",
"load",
"(",
"in",
")",
... | Load a template library from a resource on the class path.
@return loaded template library
@throws java.lang.IllegalArgumentException resource not found or could not be loaded | [
"Load",
"a",
"template",
"library",
"from",
"a",
"resource",
"on",
"the",
"class",
"path",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/IdentityTemplateLibrary.java#L403-L416 |
hawkular/hawkular-apm | client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java | FragmentBuilder.popNode | public Node popNode(Class<? extends Node> cls, String uri) {
synchronized (nodeStack) {
// Check if fragment is in suppression mode
if (suppress) {
if (!suppressedNodeStack.isEmpty()) {
// Check if node is on the suppressed stack
Node suppressed = popNode(suppressedNodeStack, cls, uri);
if (suppressed != null) {
// Popped node from suppressed stack
return suppressed;
}
} else {
// If suppression parent popped, then cancel the suppress mode
suppress = false;
}
}
return popNode(nodeStack, cls, uri);
}
} | java | public Node popNode(Class<? extends Node> cls, String uri) {
synchronized (nodeStack) {
// Check if fragment is in suppression mode
if (suppress) {
if (!suppressedNodeStack.isEmpty()) {
// Check if node is on the suppressed stack
Node suppressed = popNode(suppressedNodeStack, cls, uri);
if (suppressed != null) {
// Popped node from suppressed stack
return suppressed;
}
} else {
// If suppression parent popped, then cancel the suppress mode
suppress = false;
}
}
return popNode(nodeStack, cls, uri);
}
} | [
"public",
"Node",
"popNode",
"(",
"Class",
"<",
"?",
"extends",
"Node",
">",
"cls",
",",
"String",
"uri",
")",
"{",
"synchronized",
"(",
"nodeStack",
")",
"{",
"// Check if fragment is in suppression mode",
"if",
"(",
"suppress",
")",
"{",
"if",
"(",
"!",
... | This method pops the latest node from the trace
fragment hierarchy.
@param cls The type of node to pop
@param uri The optional uri to match
@return The node | [
"This",
"method",
"pops",
"the",
"latest",
"node",
"from",
"the",
"trace",
"fragment",
"hierarchy",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java#L282-L303 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getSAMLAssertionVerifying | public SAMLEndpointResponse getSAMLAssertionVerifying(String appId, String devideId, String stateToken, String otpToken, String urlEndpoint) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getSAMLAssertionVerifying(appId, devideId, stateToken, otpToken, urlEndpoint, false);
} | java | public SAMLEndpointResponse getSAMLAssertionVerifying(String appId, String devideId, String stateToken, String otpToken, String urlEndpoint) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getSAMLAssertionVerifying(appId, devideId, stateToken, otpToken, urlEndpoint, false);
} | [
"public",
"SAMLEndpointResponse",
"getSAMLAssertionVerifying",
"(",
"String",
"appId",
",",
"String",
"devideId",
",",
"String",
"stateToken",
",",
"String",
"otpToken",
",",
"String",
"urlEndpoint",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
"... | Verifies a one-time password (OTP) value provided for a second factor when multi-factor authentication (MFA) is required for SAML authentication.
@param appId
App ID of the app for which you want to generate a SAML token
@param devideId
Provide the MFA device_id you are submitting for verification.
@param stateToken
Provide the state_token associated with the MFA device_id you are submitting for verification.
@param otpToken
Provide the OTP value for the MFA factor you are submitting for verification.
@param urlEndpoint
Specify an url where return the response.
@return SAMLEndpointResponse
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
@see com.onelogin.sdk.model.SAMLEndpointResponse
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/saml-assertions/verify-factor">Verify Factor documentation</a> | [
"Verifies",
"a",
"one",
"-",
"time",
"password",
"(",
"OTP",
")",
"value",
"provided",
"for",
"a",
"second",
"factor",
"when",
"multi",
"-",
"factor",
"authentication",
"(",
"MFA",
")",
"is",
"required",
"for",
"SAML",
"authentication",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2553-L2555 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/writer/FsDataWriter.java | FsDataWriter.commit | @Override
public void commit()
throws IOException {
this.closer.close();
setStagingFileGroup();
if (!this.fs.exists(this.stagingFile)) {
throw new IOException(String.format("File %s does not exist", this.stagingFile));
}
FileStatus stagingFileStatus = this.fs.getFileStatus(this.stagingFile);
// Double check permission of staging file
if (!stagingFileStatus.getPermission().equals(this.filePermission)) {
this.fs.setPermission(this.stagingFile, this.filePermission);
}
this.bytesWritten = Optional.of(Long.valueOf(stagingFileStatus.getLen()));
LOG.info(String.format("Moving data from %s to %s", this.stagingFile, this.outputFile));
// For the same reason as deleting the staging file if it already exists, overwrite
// the output file if it already exists to prevent task retry from being blocked.
HadoopUtils.renamePath(this.fileContext, this.stagingFile, this.outputFile, true);
// The staging file is moved to the output path in commit, so rename to add record count after that
if (this.shouldIncludeRecordCountInFileName) {
String filePathWithRecordCount = addRecordCountToFileName();
this.properties.appendToSetProp(this.allOutputFilesPropName, filePathWithRecordCount);
} else {
this.properties.appendToSetProp(this.allOutputFilesPropName, getOutputFilePath());
}
FsWriterMetrics metrics = new FsWriterMetrics(
this.id,
new PartitionIdentifier(this.partitionKey, this.branchId),
ImmutableSet.of(new FsWriterMetrics.FileInfo(this.outputFile.getName(), recordsWritten()))
);
this.properties.setProp(FS_WRITER_METRICS_KEY, metrics.toJson());
} | java | @Override
public void commit()
throws IOException {
this.closer.close();
setStagingFileGroup();
if (!this.fs.exists(this.stagingFile)) {
throw new IOException(String.format("File %s does not exist", this.stagingFile));
}
FileStatus stagingFileStatus = this.fs.getFileStatus(this.stagingFile);
// Double check permission of staging file
if (!stagingFileStatus.getPermission().equals(this.filePermission)) {
this.fs.setPermission(this.stagingFile, this.filePermission);
}
this.bytesWritten = Optional.of(Long.valueOf(stagingFileStatus.getLen()));
LOG.info(String.format("Moving data from %s to %s", this.stagingFile, this.outputFile));
// For the same reason as deleting the staging file if it already exists, overwrite
// the output file if it already exists to prevent task retry from being blocked.
HadoopUtils.renamePath(this.fileContext, this.stagingFile, this.outputFile, true);
// The staging file is moved to the output path in commit, so rename to add record count after that
if (this.shouldIncludeRecordCountInFileName) {
String filePathWithRecordCount = addRecordCountToFileName();
this.properties.appendToSetProp(this.allOutputFilesPropName, filePathWithRecordCount);
} else {
this.properties.appendToSetProp(this.allOutputFilesPropName, getOutputFilePath());
}
FsWriterMetrics metrics = new FsWriterMetrics(
this.id,
new PartitionIdentifier(this.partitionKey, this.branchId),
ImmutableSet.of(new FsWriterMetrics.FileInfo(this.outputFile.getName(), recordsWritten()))
);
this.properties.setProp(FS_WRITER_METRICS_KEY, metrics.toJson());
} | [
"@",
"Override",
"public",
"void",
"commit",
"(",
")",
"throws",
"IOException",
"{",
"this",
".",
"closer",
".",
"close",
"(",
")",
";",
"setStagingFileGroup",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"fs",
".",
"exists",
"(",
"this",
".",
"stagin... | {@inheritDoc}.
<p>
This default implementation simply renames the staging file to the output file. If the output file
already exists, it will delete it first before doing the renaming.
</p>
@throws IOException if any file operation fails | [
"{",
"@inheritDoc",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/writer/FsDataWriter.java#L240-L279 |
camunda/camunda-bpm-platform | engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java | BusinessProcess.startTask | public Task startTask(String taskId, boolean beginConversation) {
if(beginConversation) {
Conversation conversation = conversationInstance.get();
if(conversation.isTransient()) {
conversation.begin();
}
}
return startTask(taskId);
} | java | public Task startTask(String taskId, boolean beginConversation) {
if(beginConversation) {
Conversation conversation = conversationInstance.get();
if(conversation.isTransient()) {
conversation.begin();
}
}
return startTask(taskId);
} | [
"public",
"Task",
"startTask",
"(",
"String",
"taskId",
",",
"boolean",
"beginConversation",
")",
"{",
"if",
"(",
"beginConversation",
")",
"{",
"Conversation",
"conversation",
"=",
"conversationInstance",
".",
"get",
"(",
")",
";",
"if",
"(",
"conversation",
... | @see #startTask(String)
this method allows to start a conversation if no conversation is active | [
"@see",
"#startTask",
"(",
"String",
")"
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine-cdi/src/main/java/org/camunda/bpm/engine/cdi/BusinessProcess.java#L312-L320 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/autodiff/Toposort.java | Toposort.checkIsFullCut | public static <T> void checkIsFullCut(Set<T> inputSet, T root, Deps<T> deps) {
// Check that the input set defines a full cut through the graph with outMod as root.
HashSet<T> visited = new HashSet<T>();
// Mark the inputSet as visited. If it is a valid leaf set, then leaves will be empty upon
// completion of the DFS.
visited.addAll(inputSet);
HashSet<T> leaves = dfs(root, visited, deps);
if (leaves.size() != 0) {
throw new IllegalStateException("Input set is not a valid leaf set for the given output module. Extra leaves: " + leaves);
}
} | java | public static <T> void checkIsFullCut(Set<T> inputSet, T root, Deps<T> deps) {
// Check that the input set defines a full cut through the graph with outMod as root.
HashSet<T> visited = new HashSet<T>();
// Mark the inputSet as visited. If it is a valid leaf set, then leaves will be empty upon
// completion of the DFS.
visited.addAll(inputSet);
HashSet<T> leaves = dfs(root, visited, deps);
if (leaves.size() != 0) {
throw new IllegalStateException("Input set is not a valid leaf set for the given output module. Extra leaves: " + leaves);
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"checkIsFullCut",
"(",
"Set",
"<",
"T",
">",
"inputSet",
",",
"T",
"root",
",",
"Deps",
"<",
"T",
">",
"deps",
")",
"{",
"// Check that the input set defines a full cut through the graph with outMod as root.",
"HashSet",
... | Checks that the given inputSet defines a full cut through the graph rooted at the given root. | [
"Checks",
"that",
"the",
"given",
"inputSet",
"defines",
"a",
"full",
"cut",
"through",
"the",
"graph",
"rooted",
"at",
"the",
"given",
"root",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/autodiff/Toposort.java#L128-L138 |
geomajas/geomajas-project-client-gwt | plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/MapImpl.java | MapImpl.setMapController | public void setMapController(MapController mapController) {
if (mapController != null) {
mapController.setMap(this);
mapWidget.setController(new JsController(mapWidget, mapController));
} else {
mapWidget.setController(null);
}
} | java | public void setMapController(MapController mapController) {
if (mapController != null) {
mapController.setMap(this);
mapWidget.setController(new JsController(mapWidget, mapController));
} else {
mapWidget.setController(null);
}
} | [
"public",
"void",
"setMapController",
"(",
"MapController",
"mapController",
")",
"{",
"if",
"(",
"mapController",
"!=",
"null",
")",
"{",
"mapController",
".",
"setMap",
"(",
"this",
")",
";",
"mapWidget",
".",
"setController",
"(",
"new",
"JsController",
"("... | Apply a new {@link MapController} on the map. This controller will handle all mouse-events that are global for
the map. Only one controller can be set at any given time. When a controller is active on the map, using this
method, any fall-back controller is automatically disabled.
@param mapController
The new {@link MapController} object. If null is passed, then the active controller is again disabled.
At that time the fall-back controller is again activated. | [
"Apply",
"a",
"new",
"{",
"@link",
"MapController",
"}",
"on",
"the",
"map",
".",
"This",
"controller",
"will",
"handle",
"all",
"mouse",
"-",
"events",
"that",
"are",
"global",
"for",
"the",
"map",
".",
"Only",
"one",
"controller",
"can",
"be",
"set",
... | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/MapImpl.java#L133-L140 |
finmath/finmath-lib | src/main/java6/net/finmath/montecarlo/interestrate/HullWhiteModelWithConstantCoeff.java | HullWhiteModelWithConstantCoeff.getShortRateConditionalVariance | public double getShortRateConditionalVariance(double time, double maturity) {
return volatility*volatility * (1 - Math.exp(-2*meanReversion*(maturity-time))) / (2*meanReversion);
} | java | public double getShortRateConditionalVariance(double time, double maturity) {
return volatility*volatility * (1 - Math.exp(-2*meanReversion*(maturity-time))) / (2*meanReversion);
} | [
"public",
"double",
"getShortRateConditionalVariance",
"(",
"double",
"time",
",",
"double",
"maturity",
")",
"{",
"return",
"volatility",
"*",
"volatility",
"*",
"(",
"1",
"-",
"Math",
".",
"exp",
"(",
"-",
"2",
"*",
"meanReversion",
"*",
"(",
"maturity",
... | Calculates the variance \( \mathop{Var}(r(t) \vert r(s) ) \), that is
\(
\int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot a \cdot (t-\tau)) \ \mathrm{d}\tau
\) where \( a \) is the meanReversion and \( \sigma \) is the short rate instantaneous volatility.
@param time The parameter s in \( \int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot a \cdot (t-\tau)) \ \mathrm{d}\tau \)
@param maturity The parameter t in \( \int_{s}^{t} \sigma^{2}(\tau) \exp(-2 \cdot a \cdot (t-\tau)) \ \mathrm{d}\tau \)
@return The integrated square volatility. | [
"Calculates",
"the",
"variance",
"\\",
"(",
"\\",
"mathop",
"{",
"Var",
"}",
"(",
"r",
"(",
"t",
")",
"\\",
"vert",
"r",
"(",
"s",
")",
")",
"\\",
")",
"that",
"is",
"\\",
"(",
"\\",
"int_",
"{",
"s",
"}",
"^",
"{",
"t",
"}",
"\\",
"sigma^"... | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/HullWhiteModelWithConstantCoeff.java#L344-L347 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/PageSection.java | PageSection.simpleHeader | public static Header simpleHeader(final String text, final TextStyle ts) {
return new SimplePageSectionBuilder().text(Text.styledContent(text, ts)).buildHeader();
} | java | public static Header simpleHeader(final String text, final TextStyle ts) {
return new SimplePageSectionBuilder().text(Text.styledContent(text, ts)).buildHeader();
} | [
"public",
"static",
"Header",
"simpleHeader",
"(",
"final",
"String",
"text",
",",
"final",
"TextStyle",
"ts",
")",
"{",
"return",
"new",
"SimplePageSectionBuilder",
"(",
")",
".",
"text",
"(",
"Text",
".",
"styledContent",
"(",
"text",
",",
"ts",
")",
")"... | Create a simple header, with a styled text
@param text the text
@param ts the style
@return the header | [
"Create",
"a",
"simple",
"header",
"with",
"a",
"styled",
"text"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/PageSection.java#L116-L118 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableService.java | AppBndAuthorizationTableService.updateMissingGroupAccessId | private String updateMissingGroupAccessId(AuthzTableContainer maps, Group group, String groupNameFromRole) {
String accessIdFromRole;
accessIdFromRole = getMissingAccessId(group);
if (accessIdFromRole != null) {
maps.groupToAccessIdMap.put(groupNameFromRole, accessIdFromRole);
} else {
// Unable to compute the accessId, store an invalid access ID indicate this
// and avoid future attempts
maps.groupToAccessIdMap.put(groupNameFromRole, INVALID_ACCESS_ID);
}
return accessIdFromRole;
} | java | private String updateMissingGroupAccessId(AuthzTableContainer maps, Group group, String groupNameFromRole) {
String accessIdFromRole;
accessIdFromRole = getMissingAccessId(group);
if (accessIdFromRole != null) {
maps.groupToAccessIdMap.put(groupNameFromRole, accessIdFromRole);
} else {
// Unable to compute the accessId, store an invalid access ID indicate this
// and avoid future attempts
maps.groupToAccessIdMap.put(groupNameFromRole, INVALID_ACCESS_ID);
}
return accessIdFromRole;
} | [
"private",
"String",
"updateMissingGroupAccessId",
"(",
"AuthzTableContainer",
"maps",
",",
"Group",
"group",
",",
"String",
"groupNameFromRole",
")",
"{",
"String",
"accessIdFromRole",
";",
"accessIdFromRole",
"=",
"getMissingAccessId",
"(",
"group",
")",
";",
"if",
... | Update the map for the specified group name. If the accessID is
successfully computed, the map will be updated with the accessID.
If the accessID can not be computed due to the user not being found,
INVALID_ACCESS_ID will be stored.
@param maps
@param group
@param groupNameFromRole
@return | [
"Update",
"the",
"map",
"for",
"the",
"specified",
"group",
"name",
".",
"If",
"the",
"accessID",
"is",
"successfully",
"computed",
"the",
"map",
"will",
"be",
"updated",
"with",
"the",
"accessID",
".",
"If",
"the",
"accessID",
"can",
"not",
"be",
"compute... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableService.java#L408-L419 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.appendColName | protected boolean appendColName(TableAlias aTableAlias, PathInfo aPathInfo, boolean translate, StringBuffer buf)
{
String prefix = aPathInfo.prefix;
String suffix = aPathInfo.suffix;
String colName = getColName(aTableAlias, aPathInfo, translate);
if (prefix != null) // rebuild function contains (
{
buf.append(prefix);
}
buf.append(colName);
if (suffix != null) // rebuild function
{
buf.append(suffix);
}
return true;
} | java | protected boolean appendColName(TableAlias aTableAlias, PathInfo aPathInfo, boolean translate, StringBuffer buf)
{
String prefix = aPathInfo.prefix;
String suffix = aPathInfo.suffix;
String colName = getColName(aTableAlias, aPathInfo, translate);
if (prefix != null) // rebuild function contains (
{
buf.append(prefix);
}
buf.append(colName);
if (suffix != null) // rebuild function
{
buf.append(suffix);
}
return true;
} | [
"protected",
"boolean",
"appendColName",
"(",
"TableAlias",
"aTableAlias",
",",
"PathInfo",
"aPathInfo",
",",
"boolean",
"translate",
",",
"StringBuffer",
"buf",
")",
"{",
"String",
"prefix",
"=",
"aPathInfo",
".",
"prefix",
";",
"String",
"suffix",
"=",
"aPathI... | Add the Column to the StringBuffer <br>
@param aTableAlias
@param aPathInfo
@param translate flag to indicate translation of pathInfo
@param buf
@return true if appended | [
"Add",
"the",
"Column",
"to",
"the",
"StringBuffer",
"<br",
">"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L314-L333 |
windup/windup | reporting/api/src/main/java/org/jboss/windup/reporting/service/ReportService.java | ReportService.setUniqueFilename | public void setUniqueFilename(ReportModel model, String baseFilename, String extension)
{
model.setReportFilename(this.getUniqueFilename(baseFilename, extension, true, null));
} | java | public void setUniqueFilename(ReportModel model, String baseFilename, String extension)
{
model.setReportFilename(this.getUniqueFilename(baseFilename, extension, true, null));
} | [
"public",
"void",
"setUniqueFilename",
"(",
"ReportModel",
"model",
",",
"String",
"baseFilename",
",",
"String",
"extension",
")",
"{",
"model",
".",
"setReportFilename",
"(",
"this",
".",
"getUniqueFilename",
"(",
"baseFilename",
",",
"extension",
",",
"true",
... | Gets a unique filename (that has not been used before in the output folder) for this report and sets it on the report model. | [
"Gets",
"a",
"unique",
"filename",
"(",
"that",
"has",
"not",
"been",
"used",
"before",
"in",
"the",
"output",
"folder",
")",
"for",
"this",
"report",
"and",
"sets",
"it",
"on",
"the",
"report",
"model",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/service/ReportService.java#L96-L99 |
looly/hutool | hutool-aop/src/main/java/cn/hutool/aop/ProxyUtil.java | ProxyUtil.newProxyInstance | public static <T> T newProxyInstance(InvocationHandler invocationHandler, Class<?>... interfaces) {
return newProxyInstance(ClassUtil.getClassLoader(), invocationHandler, interfaces);
} | java | public static <T> T newProxyInstance(InvocationHandler invocationHandler, Class<?>... interfaces) {
return newProxyInstance(ClassUtil.getClassLoader(), invocationHandler, interfaces);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newProxyInstance",
"(",
"InvocationHandler",
"invocationHandler",
",",
"Class",
"<",
"?",
">",
"...",
"interfaces",
")",
"{",
"return",
"newProxyInstance",
"(",
"ClassUtil",
".",
"getClassLoader",
"(",
")",
",",
"invoca... | 创建动态代理对象
@param <T> 被代理对象类型
@param invocationHandler {@link InvocationHandler} ,被代理类通过实现此接口提供动态代理功能
@param interfaces 代理类中需要实现的被代理类的接口方法
@return 代理类 | [
"创建动态代理对象"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-aop/src/main/java/cn/hutool/aop/ProxyUtil.java#L70-L72 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaMemsetAsync | public static int cudaMemsetAsync(Pointer devPtr, int value, long count, cudaStream_t stream)
{
return checkResult(cudaMemsetAsyncNative(devPtr, value, count, stream));
} | java | public static int cudaMemsetAsync(Pointer devPtr, int value, long count, cudaStream_t stream)
{
return checkResult(cudaMemsetAsyncNative(devPtr, value, count, stream));
} | [
"public",
"static",
"int",
"cudaMemsetAsync",
"(",
"Pointer",
"devPtr",
",",
"int",
"value",
",",
"long",
"count",
",",
"cudaStream_t",
"stream",
")",
"{",
"return",
"checkResult",
"(",
"cudaMemsetAsyncNative",
"(",
"devPtr",
",",
"value",
",",
"count",
",",
... | Initializes or sets device memory to a value.
<pre>
cudaError_t cudaMemsetAsync (
void* devPtr,
int value,
size_t count,
cudaStream_t stream = 0 )
</pre>
<div>
<p>Initializes or sets device memory to a
value. Fills the first <tt>count</tt> bytes of the memory area
pointed to by <tt>devPtr</tt> with the constant byte value <tt>value</tt>.
</p>
<p>cudaMemsetAsync() is asynchronous with
respect to the host, so the call may return before the memset is
complete. The operation can optionally
be associated to a stream by passing a
non-zero <tt>stream</tt> argument. If <tt>stream</tt> is non-zero,
the operation may overlap with operations in other streams.
</p>
<div>
<span>Note:</span>
<ul>
<li>
<p>Note that this function may
also return error codes from previous, asynchronous launches.
</p>
</li>
</ul>
</div>
</p>
</div>
@param devPtr Pointer to device memory
@param value Value to set for each byte of specified memory
@param count Size in bytes to set
@param stream Stream identifier
@return cudaSuccess, cudaErrorInvalidValue,
cudaErrorInvalidDevicePointer
@see JCuda#cudaMemset
@see JCuda#cudaMemset2D
@see JCuda#cudaMemset3D
@see JCuda#cudaMemset2DAsync
@see JCuda#cudaMemset3DAsync | [
"Initializes",
"or",
"sets",
"device",
"memory",
"to",
"a",
"value",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L2916-L2919 |
KyoriPowered/lunar | src/main/java/net/kyori/lunar/graph/MoreGraphs.java | MoreGraphs.orderedTopologicalSort | public static <T extends Comparable<? super T>> @NonNull List<T> orderedTopologicalSort(final @NonNull Graph<T> graph) {
return topologicalSort(graph, SortType.comparable());
} | java | public static <T extends Comparable<? super T>> @NonNull List<T> orderedTopologicalSort(final @NonNull Graph<T> graph) {
return topologicalSort(graph, SortType.comparable());
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"@",
"NonNull",
"List",
"<",
"T",
">",
"orderedTopologicalSort",
"(",
"final",
"@",
"NonNull",
"Graph",
"<",
"T",
">",
"graph",
")",
"{",
"return",
"topologicalSort"... | Sorts a directed acyclic graph into a list.
<p>The particular order of elements without prerequisites is determined by the natural order.</p>
@param graph the graph to be sorted
@param <T> the node type, implementing {@link Comparable}
@return the sorted list
@throws CyclePresentException if the graph has cycles
@throws IllegalArgumentException if the graph is not directed or allows self loops | [
"Sorts",
"a",
"directed",
"acyclic",
"graph",
"into",
"a",
"list",
"."
] | train | https://github.com/KyoriPowered/lunar/blob/6856747d9034a2fe0c8d0a8a0150986797732b5c/src/main/java/net/kyori/lunar/graph/MoreGraphs.java#L87-L89 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/io/IOUtils.java | IOUtils.slurpFile | public static String slurpFile(File file, String encoding) throws IOException {
return IOUtils.slurpReader(IOUtils.encodedInputStreamReader(
new FileInputStream(file), encoding));
} | java | public static String slurpFile(File file, String encoding) throws IOException {
return IOUtils.slurpReader(IOUtils.encodedInputStreamReader(
new FileInputStream(file), encoding));
} | [
"public",
"static",
"String",
"slurpFile",
"(",
"File",
"file",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"return",
"IOUtils",
".",
"slurpReader",
"(",
"IOUtils",
".",
"encodedInputStreamReader",
"(",
"new",
"FileInputStream",
"(",
"file",
")... | Returns all the text in the given File.
@param file The file to read from
@param encoding The character encoding to assume. This may be null, and
the platform default character encoding is used. | [
"Returns",
"all",
"the",
"text",
"in",
"the",
"given",
"File",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L696-L699 |
overturetool/overture | core/interpreter/src/main/java/org/overture/interpreter/runtime/VdmRuntimeError.java | VdmRuntimeError.patternFail | public static void patternFail(int number, String msg, ILexLocation location)
throws PatternMatchException
{
throw new PatternMatchException(number, msg, location);
} | java | public static void patternFail(int number, String msg, ILexLocation location)
throws PatternMatchException
{
throw new PatternMatchException(number, msg, location);
} | [
"public",
"static",
"void",
"patternFail",
"(",
"int",
"number",
",",
"String",
"msg",
",",
"ILexLocation",
"location",
")",
"throws",
"PatternMatchException",
"{",
"throw",
"new",
"PatternMatchException",
"(",
"number",
",",
"msg",
",",
"location",
")",
";",
... | Throw a PatternMatchException with the given message.
@param number
@param msg
@param location
@throws PatternMatchException | [
"Throw",
"a",
"PatternMatchException",
"with",
"the",
"given",
"message",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/VdmRuntimeError.java#L45-L49 |
hedyn/wsonrpc | wsonrpc-core/src/main/java/net/apexes/wsonrpc/core/JsonRpcControl.java | JsonRpcControl.invoke | public void invoke(String serviceName, String methodName, Object[] args, String id, Transport transport)
throws IOException, WsonrpcException {
if (methodName == null) {
throw new NullPointerException("methodName");
}
String method;
if (serviceName == null) {
method = methodName;
} else {
method = serviceName + "." + methodName;
}
Node[] params = null;
if (args != null) {
params = new Node[args.length];
for (int i = 0; i < args.length; i++) {
params[i] = jsonImpl.convert(args[i]);
}
}
transmit(transport, new JsonRpcRequest(id, method, params));
} | java | public void invoke(String serviceName, String methodName, Object[] args, String id, Transport transport)
throws IOException, WsonrpcException {
if (methodName == null) {
throw new NullPointerException("methodName");
}
String method;
if (serviceName == null) {
method = methodName;
} else {
method = serviceName + "." + methodName;
}
Node[] params = null;
if (args != null) {
params = new Node[args.length];
for (int i = 0; i < args.length; i++) {
params[i] = jsonImpl.convert(args[i]);
}
}
transmit(transport, new JsonRpcRequest(id, method, params));
} | [
"public",
"void",
"invoke",
"(",
"String",
"serviceName",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"args",
",",
"String",
"id",
",",
"Transport",
"transport",
")",
"throws",
"IOException",
",",
"WsonrpcException",
"{",
"if",
"(",
"methodName",
"... | 远程调用方法。
@param serviceName 服务名
@param methodName 方法名
@param args 参数
@param id 请求ID
@param transport {@link Transport}实例
@throws IOException
@throws WsonrpcException | [
"远程调用方法。"
] | train | https://github.com/hedyn/wsonrpc/blob/decbaad4cb8145590bab039d5cfe12437ada0d0a/wsonrpc-core/src/main/java/net/apexes/wsonrpc/core/JsonRpcControl.java#L118-L139 |
bugsnag/bugsnag-java | bugsnag/src/main/java/com/bugsnag/BugsnagAppender.java | BugsnagAppender.populateContextData | private void populateContextData(Report report, ILoggingEvent event) {
Map<String, String> propertyMap = event.getMDCPropertyMap();
if (propertyMap != null) {
// Loop through all the keys and put them in the correct tabs
for (Map.Entry<String, String> entry : propertyMap.entrySet()) {
report.addToTab("Context", entry.getKey(), entry.getValue());
}
}
} | java | private void populateContextData(Report report, ILoggingEvent event) {
Map<String, String> propertyMap = event.getMDCPropertyMap();
if (propertyMap != null) {
// Loop through all the keys and put them in the correct tabs
for (Map.Entry<String, String> entry : propertyMap.entrySet()) {
report.addToTab("Context", entry.getKey(), entry.getValue());
}
}
} | [
"private",
"void",
"populateContextData",
"(",
"Report",
"report",
",",
"ILoggingEvent",
"event",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"propertyMap",
"=",
"event",
".",
"getMDCPropertyMap",
"(",
")",
";",
"if",
"(",
"propertyMap",
"!=",
"null"... | Adds logging context values to the given report meta data
@param report The report being sent to Bugsnag
@param event The logging event | [
"Adds",
"logging",
"context",
"values",
"to",
"the",
"given",
"report",
"meta",
"data"
] | train | https://github.com/bugsnag/bugsnag-java/blob/11817d63949bcf2b2b6b765a1d37305cdec356f2/bugsnag/src/main/java/com/bugsnag/BugsnagAppender.java#L146-L156 |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java | CommonOps_DSCC.sumCols | public static DMatrixRMaj sumCols(DMatrixSparseCSC input , @Nullable DMatrixRMaj output ) {
if( output == null ) {
output = new DMatrixRMaj(1,input.numCols);
} else {
output.reshape(1,input.numCols);
}
for (int col = 0; col < input.numCols; col++) {
int idx0 = input.col_idx[col];
int idx1 = input.col_idx[col + 1];
double sum = 0;
for (int i = idx0; i < idx1; i++) {
sum += input.nz_values[i];
}
output.data[col] = sum;
}
return output;
} | java | public static DMatrixRMaj sumCols(DMatrixSparseCSC input , @Nullable DMatrixRMaj output ) {
if( output == null ) {
output = new DMatrixRMaj(1,input.numCols);
} else {
output.reshape(1,input.numCols);
}
for (int col = 0; col < input.numCols; col++) {
int idx0 = input.col_idx[col];
int idx1 = input.col_idx[col + 1];
double sum = 0;
for (int i = idx0; i < idx1; i++) {
sum += input.nz_values[i];
}
output.data[col] = sum;
}
return output;
} | [
"public",
"static",
"DMatrixRMaj",
"sumCols",
"(",
"DMatrixSparseCSC",
"input",
",",
"@",
"Nullable",
"DMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"DMatrixRMaj",
"(",
"1",
",",
"input",
".",
"numCols... | <p>
Computes the sum of each column in the input matrix and returns the results in a vector:<br>
<br>
b<sub>j</sub> = sum(i=1:m ; a<sub>ij</sub>)
</p>
@param input Input matrix
@param output Optional storage for output. Reshaped into a row vector. Modified.
@return Vector containing the sum of each column | [
"<p",
">",
"Computes",
"the",
"sum",
"of",
"each",
"column",
"in",
"the",
"input",
"matrix",
"and",
"returns",
"the",
"results",
"in",
"a",
"vector",
":",
"<br",
">",
"<br",
">",
"b<sub",
">",
"j<",
"/",
"sub",
">",
"=",
"sum",
"(",
"i",
"=",
"1"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L1288-L1308 |
unbescape/unbescape | src/main/java/org/unbescape/xml/XmlEscape.java | XmlEscape.escapeXml10 | public static void escapeXml10(final Reader reader, final Writer writer)
throws IOException {
escapeXml(reader, writer, XmlEscapeSymbols.XML10_SYMBOLS,
XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA,
XmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT);
} | java | public static void escapeXml10(final Reader reader, final Writer writer)
throws IOException {
escapeXml(reader, writer, XmlEscapeSymbols.XML10_SYMBOLS,
XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA,
XmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT);
} | [
"public",
"static",
"void",
"escapeXml10",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapeXml",
"(",
"reader",
",",
"writer",
",",
"XmlEscapeSymbols",
".",
"XML10_SYMBOLS",
",",
"XmlEscapeType",
".",... | <p>
Perform an XML 1.0 level 2 (markup-significant and all non-ASCII chars) <strong>escape</strong> operation
on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 2</em> means this method will escape:
</p>
<ul>
<li>The five markup-significant characters: <tt><</tt>, <tt>></tt>, <tt>&</tt>,
<tt>"</tt> and <tt>'</tt></li>
<li>All non ASCII characters.</li>
</ul>
<p>
This escape will be performed by replacing those chars by the corresponding XML Character Entity References
(e.g. <tt>'&lt;'</tt>) when such CER exists for the replaced character, and replacing by a hexadecimal
character reference (e.g. <tt>'&#x2430;'</tt>) when there there is no CER for the replaced character.
</p>
<p>
This method calls {@link #escapeXml10(Reader, Writer, XmlEscapeType, XmlEscapeLevel)} with the following
preconfigured values:
</p>
<ul>
<li><tt>type</tt>:
{@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li>
<li><tt>level</tt>:
{@link org.unbescape.xml.XmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"an",
"XML",
"1",
".",
"0",
"level",
"2",
"(",
"markup",
"-",
"significant",
"and",
"all",
"non",
"-",
"ASCII",
"chars",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1403-L1408 |
jbundle/jbundle | base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java | NameValue.getNameValueNode | public NameValue getNameValueNode(String strName, Object objValue, boolean bAddIfNotFound)
{
Map<String,NameValue> map = this.getValueMap(bAddIfNotFound);
if (map == null)
return null;
NameValue value = (NameValue)map.get(this.getKey(strName, objValue));
if (value == null)
if (bAddIfNotFound)
this.addNameValueNode(value = new NameValue(strName, objValue));
return value;
} | java | public NameValue getNameValueNode(String strName, Object objValue, boolean bAddIfNotFound)
{
Map<String,NameValue> map = this.getValueMap(bAddIfNotFound);
if (map == null)
return null;
NameValue value = (NameValue)map.get(this.getKey(strName, objValue));
if (value == null)
if (bAddIfNotFound)
this.addNameValueNode(value = new NameValue(strName, objValue));
return value;
} | [
"public",
"NameValue",
"getNameValueNode",
"(",
"String",
"strName",
",",
"Object",
"objValue",
",",
"boolean",
"bAddIfNotFound",
")",
"{",
"Map",
"<",
"String",
",",
"NameValue",
">",
"map",
"=",
"this",
".",
"getValueMap",
"(",
"bAddIfNotFound",
")",
";",
... | Get my child value node (that matches this value).
@param objValue The value to find/match.
@param bAddIfNotFound Add this value if it was not found.
@return Return this child value node. | [
"Get",
"my",
"child",
"value",
"node",
"(",
"that",
"matches",
"this",
"value",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/NameValue.java#L186-L196 |
code4craft/webmagic | webmagic-core/src/main/java/us/codecraft/webmagic/Site.java | Site.addCookie | public Site addCookie(String name, String value) {
defaultCookies.put(name, value);
return this;
} | java | public Site addCookie(String name, String value) {
defaultCookies.put(name, value);
return this;
} | [
"public",
"Site",
"addCookie",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"defaultCookies",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add a cookie with domain {@link #getDomain()}
@param name name
@param value value
@return this | [
"Add",
"a",
"cookie",
"with",
"domain",
"{",
"@link",
"#getDomain",
"()",
"}"
] | train | https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Site.java#L66-L69 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/DatatypeFactory.java | DatatypeFactory.newDurationDayTime | public Duration newDurationDayTime(
final boolean isPositive,
final int day,
final int hour,
final int minute,
final int second) {
return newDuration(isPositive,
DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED,
day, hour, minute, second);
} | java | public Duration newDurationDayTime(
final boolean isPositive,
final int day,
final int hour,
final int minute,
final int second) {
return newDuration(isPositive,
DatatypeConstants.FIELD_UNDEFINED, DatatypeConstants.FIELD_UNDEFINED,
day, hour, minute, second);
} | [
"public",
"Duration",
"newDurationDayTime",
"(",
"final",
"boolean",
"isPositive",
",",
"final",
"int",
"day",
",",
"final",
"int",
"hour",
",",
"final",
"int",
"minute",
",",
"final",
"int",
"second",
")",
"{",
"return",
"newDuration",
"(",
"isPositive",
",... | <p>Create a <code>Duration</code> of type <code>xdt:dayTimeDuration</code> using the specified
<code>day</code>, <code>hour</code>, <code>minute</code> and <code>second</code> as defined in
<a href="http://www.w3.org/TR/xpath-datamodel#dt-dayTimeDuration">
XQuery 1.0 and XPath 2.0 Data Model, xdt:dayTimeDuration</a>.</p>
<p>The datatype <code>xdt:dayTimeDuration</code> is a subtype of <code>xs:duration</code>
whose lexical representation contains only day, hour, minute, and second components.
This datatype resides in the namespace <code>http://www.w3.org/2003/11/xpath-datatypes</code>.</p>
<p>A {@link DatatypeConstants#FIELD_UNDEFINED} value indicates that field is not set.</p>
@param isPositive Set to <code>false</code> to create a negative duration. When the length
of the duration is zero, this parameter will be ignored.
@param day Day of <code>Duration</code>.
@param hour Hour of <code>Duration</code>.
@param minute Minute of <code>Duration</code>.
@param second Second of <code>Duration</code>.
@return New <code>Duration</code> created with the specified <code>day</code>, <code>hour</code>, <code>minute</code>
and <code>second</code>.
@throws IllegalArgumentException If any values would create an invalid <code>Duration</code>. | [
"<p",
">",
"Create",
"a",
"<code",
">",
"Duration<",
"/",
"code",
">",
"of",
"type",
"<code",
">",
"xdt",
":",
"dayTimeDuration<",
"/",
"code",
">",
"using",
"the",
"specified",
"<code",
">",
"day<",
"/",
"code",
">",
"<code",
">",
"hour<",
"/",
"cod... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/DatatypeFactory.java#L508-L517 |
alkacon/opencms-core | src/org/opencms/search/solr/CmsSolrQuery.java | CmsSolrQuery.addSortFieldOrders | public void addSortFieldOrders(Map<String, ORDER> sortFields) {
if ((sortFields != null) && !sortFields.isEmpty()) {
// add the sort fields to the query
for (Map.Entry<String, ORDER> entry : sortFields.entrySet()) {
addSort(entry.getKey(), entry.getValue());
}
}
} | java | public void addSortFieldOrders(Map<String, ORDER> sortFields) {
if ((sortFields != null) && !sortFields.isEmpty()) {
// add the sort fields to the query
for (Map.Entry<String, ORDER> entry : sortFields.entrySet()) {
addSort(entry.getKey(), entry.getValue());
}
}
} | [
"public",
"void",
"addSortFieldOrders",
"(",
"Map",
"<",
"String",
",",
"ORDER",
">",
"sortFields",
")",
"{",
"if",
"(",
"(",
"sortFields",
"!=",
"null",
")",
"&&",
"!",
"sortFields",
".",
"isEmpty",
"(",
")",
")",
"{",
"// add the sort fields to the query",... | Adds the given fields/orders to the existing sort fields.<p>
@param sortFields the sortFields to set | [
"Adds",
"the",
"given",
"fields",
"/",
"orders",
"to",
"the",
"existing",
"sort",
"fields",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrQuery.java#L223-L231 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java | Http2FrameCodec.onStreamError | @Override
protected final void onStreamError(ChannelHandlerContext ctx, boolean outbound, Throwable cause,
Http2Exception.StreamException streamException) {
int streamId = streamException.streamId();
Http2Stream connectionStream = connection().stream(streamId);
if (connectionStream == null) {
onHttp2UnknownStreamError(ctx, cause, streamException);
// Write a RST_STREAM
super.onStreamError(ctx, outbound, cause, streamException);
return;
}
Http2FrameStream stream = connectionStream.getProperty(streamKey);
if (stream == null) {
LOG.warn("Stream exception thrown without stream object attached.", cause);
// Write a RST_STREAM
super.onStreamError(ctx, outbound, cause, streamException);
return;
}
if (!outbound) {
// We only forward non outbound errors as outbound errors will already be reflected by failing the promise.
onHttp2FrameStreamException(ctx, new Http2FrameStreamException(stream, streamException.error(), cause));
}
} | java | @Override
protected final void onStreamError(ChannelHandlerContext ctx, boolean outbound, Throwable cause,
Http2Exception.StreamException streamException) {
int streamId = streamException.streamId();
Http2Stream connectionStream = connection().stream(streamId);
if (connectionStream == null) {
onHttp2UnknownStreamError(ctx, cause, streamException);
// Write a RST_STREAM
super.onStreamError(ctx, outbound, cause, streamException);
return;
}
Http2FrameStream stream = connectionStream.getProperty(streamKey);
if (stream == null) {
LOG.warn("Stream exception thrown without stream object attached.", cause);
// Write a RST_STREAM
super.onStreamError(ctx, outbound, cause, streamException);
return;
}
if (!outbound) {
// We only forward non outbound errors as outbound errors will already be reflected by failing the promise.
onHttp2FrameStreamException(ctx, new Http2FrameStreamException(stream, streamException.error(), cause));
}
} | [
"@",
"Override",
"protected",
"final",
"void",
"onStreamError",
"(",
"ChannelHandlerContext",
"ctx",
",",
"boolean",
"outbound",
",",
"Throwable",
"cause",
",",
"Http2Exception",
".",
"StreamException",
"streamException",
")",
"{",
"int",
"streamId",
"=",
"streamExc... | Exceptions for unknown streams, that is streams that have no {@link Http2FrameStream} object attached
are simply logged and replied to by sending a RST_STREAM frame. | [
"Exceptions",
"for",
"unknown",
"streams",
"that",
"is",
"streams",
"that",
"have",
"no",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java#L477-L501 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/JobCancellationsInner.java | JobCancellationsInner.trigger | public void trigger(String vaultName, String resourceGroupName, String jobName) {
triggerWithServiceResponseAsync(vaultName, resourceGroupName, jobName).toBlocking().single().body();
} | java | public void trigger(String vaultName, String resourceGroupName, String jobName) {
triggerWithServiceResponseAsync(vaultName, resourceGroupName, jobName).toBlocking().single().body();
} | [
"public",
"void",
"trigger",
"(",
"String",
"vaultName",
",",
"String",
"resourceGroupName",
",",
"String",
"jobName",
")",
"{",
"triggerWithServiceResponseAsync",
"(",
"vaultName",
",",
"resourceGroupName",
",",
"jobName",
")",
".",
"toBlocking",
"(",
")",
".",
... | Cancels a job. This is an asynchronous operation. To know the status of the cancellation, call GetCancelOperationResult API.
@param vaultName The name of the recovery services vault.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@param jobName Name of the job to cancel.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Cancels",
"a",
"job",
".",
"This",
"is",
"an",
"asynchronous",
"operation",
".",
"To",
"know",
"the",
"status",
"of",
"the",
"cancellation",
"call",
"GetCancelOperationResult",
"API",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/JobCancellationsInner.java#L70-L72 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java | ChineseCalendar.isLeapMonthBetween | private boolean isLeapMonthBetween(int newMoon1, int newMoon2) {
// This is only needed to debug the timeOfAngle divergence bug.
// Remove this later. Liu 11/9/00
// DEBUG
if (synodicMonthsBetween(newMoon1, newMoon2) >= 50) {
throw new IllegalArgumentException("isLeapMonthBetween(" + newMoon1 +
", " + newMoon2 +
"): Invalid parameters");
}
return (newMoon2 >= newMoon1) &&
(isLeapMonthBetween(newMoon1, newMoonNear(newMoon2 - SYNODIC_GAP, false)) ||
hasNoMajorSolarTerm(newMoon2));
} | java | private boolean isLeapMonthBetween(int newMoon1, int newMoon2) {
// This is only needed to debug the timeOfAngle divergence bug.
// Remove this later. Liu 11/9/00
// DEBUG
if (synodicMonthsBetween(newMoon1, newMoon2) >= 50) {
throw new IllegalArgumentException("isLeapMonthBetween(" + newMoon1 +
", " + newMoon2 +
"): Invalid parameters");
}
return (newMoon2 >= newMoon1) &&
(isLeapMonthBetween(newMoon1, newMoonNear(newMoon2 - SYNODIC_GAP, false)) ||
hasNoMajorSolarTerm(newMoon2));
} | [
"private",
"boolean",
"isLeapMonthBetween",
"(",
"int",
"newMoon1",
",",
"int",
"newMoon2",
")",
"{",
"// This is only needed to debug the timeOfAngle divergence bug.",
"// Remove this later. Liu 11/9/00",
"// DEBUG",
"if",
"(",
"synodicMonthsBetween",
"(",
"newMoon1",
",",
"... | Return true if there is a leap month on or after month newMoon1 and
at or before month newMoon2.
@param newMoon1 days after January 1, 1970 0:00 astronomical base zone of a
new moon
@param newMoon2 days after January 1, 1970 0:00 astronomical base zone of a
new moon | [
"Return",
"true",
"if",
"there",
"is",
"a",
"leap",
"month",
"on",
"or",
"after",
"month",
"newMoon1",
"and",
"at",
"or",
"before",
"month",
"newMoon2",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L778-L792 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java | RegistriesInner.beginCreate | public RegistryInner beginCreate(String resourceGroupName, String registryName, RegistryCreateParameters registryCreateParameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, registryCreateParameters).toBlocking().single().body();
} | java | public RegistryInner beginCreate(String resourceGroupName, String registryName, RegistryCreateParameters registryCreateParameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, registryCreateParameters).toBlocking().single().body();
} | [
"public",
"RegistryInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"RegistryCreateParameters",
"registryCreateParameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
... | Creates a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param registryCreateParameters The parameters for creating a container registry.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RegistryInner object if successful. | [
"Creates",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java#L379-L381 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java | SpiderTransaction.deleteTermIndexColumn | public void deleteTermIndexColumn(TableDefinition tableDef, DBObject dbObj, String fieldName, String term) {
deleteColumn(SpiderService.termsStoreName(tableDef),
SpiderService.termIndexRowKey(tableDef, dbObj, fieldName, term),
dbObj.getObjectID());
} | java | public void deleteTermIndexColumn(TableDefinition tableDef, DBObject dbObj, String fieldName, String term) {
deleteColumn(SpiderService.termsStoreName(tableDef),
SpiderService.termIndexRowKey(tableDef, dbObj, fieldName, term),
dbObj.getObjectID());
} | [
"public",
"void",
"deleteTermIndexColumn",
"(",
"TableDefinition",
"tableDef",
",",
"DBObject",
"dbObj",
",",
"String",
"fieldName",
",",
"String",
"term",
")",
"{",
"deleteColumn",
"(",
"SpiderService",
".",
"termsStoreName",
"(",
"tableDef",
")",
",",
"SpiderSer... | Un-index the given term by deleting the Terms column for the given DBObject, field
name, and term.
@param tableDef {@link TableDefinition} of table that owns object.
@param dbObj DBObject that owns field.
@param fieldName Field name.
@param term Term being un-indexed. | [
"Un",
"-",
"index",
"the",
"given",
"term",
"by",
"deleting",
"the",
"Terms",
"column",
"for",
"the",
"given",
"DBObject",
"field",
"name",
"and",
"term",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java#L421-L425 |
xedin/disruptor_thrift_server | src/main/java/com/thinkaurelius/thrift/util/mem/Memory.java | Memory.setBytes | public void setBytes(long memoryOffset, byte[] buffer, int bufferOffset, int count)
{
if (buffer == null)
throw new NullPointerException();
else if (bufferOffset < 0
|| count < 0
|| bufferOffset + count > buffer.length)
throw new IndexOutOfBoundsException();
else if (count == 0)
return;
checkPosition(memoryOffset);
long end = memoryOffset + count;
checkPosition(end - 1);
while (memoryOffset < end)
{
unsafe.putByte(peer + memoryOffset, buffer[bufferOffset]);
memoryOffset++;
bufferOffset++;
}
} | java | public void setBytes(long memoryOffset, byte[] buffer, int bufferOffset, int count)
{
if (buffer == null)
throw new NullPointerException();
else if (bufferOffset < 0
|| count < 0
|| bufferOffset + count > buffer.length)
throw new IndexOutOfBoundsException();
else if (count == 0)
return;
checkPosition(memoryOffset);
long end = memoryOffset + count;
checkPosition(end - 1);
while (memoryOffset < end)
{
unsafe.putByte(peer + memoryOffset, buffer[bufferOffset]);
memoryOffset++;
bufferOffset++;
}
} | [
"public",
"void",
"setBytes",
"(",
"long",
"memoryOffset",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"bufferOffset",
",",
"int",
"count",
")",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"else",
... | Transfers count bytes from buffer to Memory
@param memoryOffset start offset in the memory
@param buffer the data buffer
@param bufferOffset start offset of the buffer
@param count number of bytes to transfer | [
"Transfers",
"count",
"bytes",
"from",
"buffer",
"to",
"Memory"
] | train | https://github.com/xedin/disruptor_thrift_server/blob/5bf0c3d6968e1ea79f5ea939dde7b8ced3d91a2c/src/main/java/com/thinkaurelius/thrift/util/mem/Memory.java#L114-L134 |
h2oai/h2o-3 | h2o-core/src/main/java/water/parser/SVMLightParser.java | SVMLightParser.guessSetup | public static ParseSetup guessSetup(byte [] bits) {
int lastNewline = bits.length-1;
while(lastNewline > 0 && !CsvParser.isEOL(bits[lastNewline]))lastNewline--;
if(lastNewline > 0) bits = Arrays.copyOf(bits,lastNewline+1);
SVMLightParser p = new SVMLightParser(new ParseSetup(SVMLight_INFO,
ParseSetup.GUESS_SEP, false,ParseSetup.GUESS_HEADER,ParseSetup.GUESS_COL_CNT,
null,null,null,null,null), null);
SVMLightInspectParseWriter dout = new SVMLightInspectParseWriter();
p.parseChunk(0,new ByteAryData(bits,0), dout);
if (dout._ncols > 0 && dout._nlines > 0 && dout._nlines > dout._invalidLines)
return new ParseSetup(SVMLight_INFO, ParseSetup.GUESS_SEP,
false,ParseSetup.NO_HEADER,dout._ncols,null,dout.guessTypes(),null,null,dout._data, dout.removeErrors());
else throw new ParseDataset.H2OParseException("Could not parse file as an SVMLight file.");
} | java | public static ParseSetup guessSetup(byte [] bits) {
int lastNewline = bits.length-1;
while(lastNewline > 0 && !CsvParser.isEOL(bits[lastNewline]))lastNewline--;
if(lastNewline > 0) bits = Arrays.copyOf(bits,lastNewline+1);
SVMLightParser p = new SVMLightParser(new ParseSetup(SVMLight_INFO,
ParseSetup.GUESS_SEP, false,ParseSetup.GUESS_HEADER,ParseSetup.GUESS_COL_CNT,
null,null,null,null,null), null);
SVMLightInspectParseWriter dout = new SVMLightInspectParseWriter();
p.parseChunk(0,new ByteAryData(bits,0), dout);
if (dout._ncols > 0 && dout._nlines > 0 && dout._nlines > dout._invalidLines)
return new ParseSetup(SVMLight_INFO, ParseSetup.GUESS_SEP,
false,ParseSetup.NO_HEADER,dout._ncols,null,dout.guessTypes(),null,null,dout._data, dout.removeErrors());
else throw new ParseDataset.H2OParseException("Could not parse file as an SVMLight file.");
} | [
"public",
"static",
"ParseSetup",
"guessSetup",
"(",
"byte",
"[",
"]",
"bits",
")",
"{",
"int",
"lastNewline",
"=",
"bits",
".",
"length",
"-",
"1",
";",
"while",
"(",
"lastNewline",
">",
"0",
"&&",
"!",
"CsvParser",
".",
"isEOL",
"(",
"bits",
"[",
"... | Try to parse the bytes as svm light format, return a ParseSetupHandler with type
SVMLight if the input is in svm light format, throw an exception otherwise. | [
"Try",
"to",
"parse",
"the",
"bytes",
"as",
"svm",
"light",
"format",
"return",
"a",
"ParseSetupHandler",
"with",
"type",
"SVMLight",
"if",
"the",
"input",
"is",
"in",
"svm",
"light",
"format",
"throw",
"an",
"exception",
"otherwise",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/parser/SVMLightParser.java#L27-L40 |
fnklabs/draenei | src/main/java/com/fnklabs/draenei/CassandraClient.java | CassandraClient.executeAsync | @NotNull
public ResultSetFuture executeAsync(@NotNull String keyspace, @NotNull Statement statement) {
Timer time = getMetricsFactory().getTimer(MetricsType.CASSANDRA_EXECUTE_ASYNC.name());
getMetricsFactory().getCounter(MetricsType.CASSANDRA_PROCESSING_QUERIES.name()).inc();
ResultSetFuture resultSetFuture = getOrCreateSession(keyspace).executeAsync(statement);
String query = (statement instanceof BoundStatement) ? ((BoundStatement) statement).preparedStatement().getQueryString() : statement.toString();
Futures.addCallback(resultSetFuture, new StatementExecutionCallback(keyspace, query));
monitorFuture(time, resultSetFuture);
return resultSetFuture;
} | java | @NotNull
public ResultSetFuture executeAsync(@NotNull String keyspace, @NotNull Statement statement) {
Timer time = getMetricsFactory().getTimer(MetricsType.CASSANDRA_EXECUTE_ASYNC.name());
getMetricsFactory().getCounter(MetricsType.CASSANDRA_PROCESSING_QUERIES.name()).inc();
ResultSetFuture resultSetFuture = getOrCreateSession(keyspace).executeAsync(statement);
String query = (statement instanceof BoundStatement) ? ((BoundStatement) statement).preparedStatement().getQueryString() : statement.toString();
Futures.addCallback(resultSetFuture, new StatementExecutionCallback(keyspace, query));
monitorFuture(time, resultSetFuture);
return resultSetFuture;
} | [
"@",
"NotNull",
"public",
"ResultSetFuture",
"executeAsync",
"(",
"@",
"NotNull",
"String",
"keyspace",
",",
"@",
"NotNull",
"Statement",
"statement",
")",
"{",
"Timer",
"time",
"=",
"getMetricsFactory",
"(",
")",
".",
"getTimer",
"(",
"MetricsType",
".",
"CAS... | Execute statement asynchronously
@param statement Statement that must be executed
@return ResultSetFuture | [
"Execute",
"statement",
"asynchronously"
] | train | https://github.com/fnklabs/draenei/blob/0a8cac54f1f635be3e2950375a23291d38453ae8/src/main/java/com/fnklabs/draenei/CassandraClient.java#L240-L254 |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java | CheckArg.isNotSame | public static <T> void isNotSame( final T argument,
String argumentName,
final T object,
String objectName ) {
if (argument == object) {
if (objectName == null) objectName = getObjectName(object);
throw new IllegalArgumentException(CommonI18n.argumentMustNotBeSameAs.text(argumentName, objectName));
}
} | java | public static <T> void isNotSame( final T argument,
String argumentName,
final T object,
String objectName ) {
if (argument == object) {
if (objectName == null) objectName = getObjectName(object);
throw new IllegalArgumentException(CommonI18n.argumentMustNotBeSameAs.text(argumentName, objectName));
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"isNotSame",
"(",
"final",
"T",
"argument",
",",
"String",
"argumentName",
",",
"final",
"T",
"object",
",",
"String",
"objectName",
")",
"{",
"if",
"(",
"argument",
"==",
"object",
")",
"{",
"if",
"(",
"objec... | Asserts that the specified first object is not the same as (==) the specified second object.
@param <T>
@param argument The argument to assert as not the same as <code>object</code>.
@param argumentName The name that will be used within the exception message for the argument should an exception be thrown
@param object The object to assert as not the same as <code>argument</code>.
@param objectName The name that will be used within the exception message for <code>object</code> should an exception be
thrown; if <code>null</code> and <code>object</code> is not <code>null</code>, <code>object.toString()</code> will
be used.
@throws IllegalArgumentException If the specified objects are the same. | [
"Asserts",
"that",
"the",
"specified",
"first",
"object",
"is",
"not",
"the",
"same",
"as",
"(",
"==",
")",
"the",
"specified",
"second",
"object",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L494-L502 |
jfinal/jfinal | src/main/java/com/jfinal/token/TokenManager.java | TokenManager.validateToken | public static boolean validateToken(Controller controller, String tokenName) {
String clientTokenId = controller.getPara(tokenName);
if (tokenCache == null) {
String serverTokenId = controller.getSessionAttr(tokenName);
controller.removeSessionAttr(tokenName); // important!
return StrKit.notBlank(clientTokenId) && clientTokenId.equals(serverTokenId);
}
else {
Token token = new Token(clientTokenId);
boolean result = tokenCache.contains(token);
tokenCache.remove(token);
return result;
}
} | java | public static boolean validateToken(Controller controller, String tokenName) {
String clientTokenId = controller.getPara(tokenName);
if (tokenCache == null) {
String serverTokenId = controller.getSessionAttr(tokenName);
controller.removeSessionAttr(tokenName); // important!
return StrKit.notBlank(clientTokenId) && clientTokenId.equals(serverTokenId);
}
else {
Token token = new Token(clientTokenId);
boolean result = tokenCache.contains(token);
tokenCache.remove(token);
return result;
}
} | [
"public",
"static",
"boolean",
"validateToken",
"(",
"Controller",
"controller",
",",
"String",
"tokenName",
")",
"{",
"String",
"clientTokenId",
"=",
"controller",
".",
"getPara",
"(",
"tokenName",
")",
";",
"if",
"(",
"tokenCache",
"==",
"null",
")",
"{",
... | Check token to prevent resubmit.
@param tokenName the token name used in view's form
@return true if token is correct | [
"Check",
"token",
"to",
"prevent",
"resubmit",
"."
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/token/TokenManager.java#L106-L119 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/chrono/EthiopicDate.java | EthiopicDate.ofEpochDay | static EthiopicDate ofEpochDay(final long epochDay) {
EPOCH_DAY.range().checkValidValue(epochDay, EPOCH_DAY); // validate outer bounds
long ethiopicED = epochDay + EPOCH_DAY_DIFFERENCE;
int adjustment = 0;
if (ethiopicED < 0) {
ethiopicED = ethiopicED + (1461L * (1_000_000L / 4));
adjustment = -1_000_000;
}
int prolepticYear = (int) (((ethiopicED * 4) + 1463) / 1461);
int startYearEpochDay = (prolepticYear - 1) * 365 + (prolepticYear / 4);
int doy0 = (int) (ethiopicED - startYearEpochDay);
int month = doy0 / 30 + 1;
int dom = doy0 % 30 + 1;
return new EthiopicDate(prolepticYear + adjustment, month, dom);
} | java | static EthiopicDate ofEpochDay(final long epochDay) {
EPOCH_DAY.range().checkValidValue(epochDay, EPOCH_DAY); // validate outer bounds
long ethiopicED = epochDay + EPOCH_DAY_DIFFERENCE;
int adjustment = 0;
if (ethiopicED < 0) {
ethiopicED = ethiopicED + (1461L * (1_000_000L / 4));
adjustment = -1_000_000;
}
int prolepticYear = (int) (((ethiopicED * 4) + 1463) / 1461);
int startYearEpochDay = (prolepticYear - 1) * 365 + (prolepticYear / 4);
int doy0 = (int) (ethiopicED - startYearEpochDay);
int month = doy0 / 30 + 1;
int dom = doy0 % 30 + 1;
return new EthiopicDate(prolepticYear + adjustment, month, dom);
} | [
"static",
"EthiopicDate",
"ofEpochDay",
"(",
"final",
"long",
"epochDay",
")",
"{",
"EPOCH_DAY",
".",
"range",
"(",
")",
".",
"checkValidValue",
"(",
"epochDay",
",",
"EPOCH_DAY",
")",
";",
"// validate outer bounds",
"long",
"ethiopicED",
"=",
"epochDay",
"+",
... | Obtains a {@code EthiopicDate} representing a date in the Ethiopic calendar
system from the epoch-day.
@param epochDay the epoch day to convert based on 1970-01-01 (ISO)
@return the date in Ethiopic calendar system, not null
@throws DateTimeException if the epoch-day is out of range | [
"Obtains",
"a",
"{",
"@code",
"EthiopicDate",
"}",
"representing",
"a",
"date",
"in",
"the",
"Ethiopic",
"calendar",
"system",
"from",
"the",
"epoch",
"-",
"day",
"."
] | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/EthiopicDate.java#L220-L234 |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/OutputRedirector.java | OutputRedirector.containsIgnoreCase | private static boolean containsIgnoreCase(String str, String searchStr) {
if (str == null || searchStr == null) {
return false;
}
int len = searchStr.length();
int max = str.length() - len;
for (int i = 0; i <= max; i++) {
if (str.regionMatches(true, i, searchStr, 0, len)) {
return true;
}
}
return false;
} | java | private static boolean containsIgnoreCase(String str, String searchStr) {
if (str == null || searchStr == null) {
return false;
}
int len = searchStr.length();
int max = str.length() - len;
for (int i = 0; i <= max; i++) {
if (str.regionMatches(true, i, searchStr, 0, len)) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"containsIgnoreCase",
"(",
"String",
"str",
",",
"String",
"searchStr",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"searchStr",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"int",
"len",
"=",
"searchStr",
".",... | Copied from Apache Commons Lang {@code StringUtils#containsIgnoreCase(String, String)} | [
"Copied",
"from",
"Apache",
"Commons",
"Lang",
"{"
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/OutputRedirector.java#L100-L112 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/util/impl/TupleContextHelper.java | TupleContextHelper.tupleContext | public static TupleContext tupleContext(SharedSessionContractImplementor session, EntityMetadataInformation metadata) {
if ( metadata != null ) {
OgmEntityPersister persister = (OgmEntityPersister) session.getFactory().getMetamodel().entityPersister( metadata.getTypeName() );
return persister.getTupleContext( session );
}
else if ( session != null ) {
// We are not dealing with a single entity but we might still need the transactionContext
TransactionContext transactionContext = TransactionContextHelper.transactionContext( session );
TupleContext tupleContext = new OnlyWithTransactionContext( transactionContext );
return tupleContext;
}
else {
return null;
}
} | java | public static TupleContext tupleContext(SharedSessionContractImplementor session, EntityMetadataInformation metadata) {
if ( metadata != null ) {
OgmEntityPersister persister = (OgmEntityPersister) session.getFactory().getMetamodel().entityPersister( metadata.getTypeName() );
return persister.getTupleContext( session );
}
else if ( session != null ) {
// We are not dealing with a single entity but we might still need the transactionContext
TransactionContext transactionContext = TransactionContextHelper.transactionContext( session );
TupleContext tupleContext = new OnlyWithTransactionContext( transactionContext );
return tupleContext;
}
else {
return null;
}
} | [
"public",
"static",
"TupleContext",
"tupleContext",
"(",
"SharedSessionContractImplementor",
"session",
",",
"EntityMetadataInformation",
"metadata",
")",
"{",
"if",
"(",
"metadata",
"!=",
"null",
")",
"{",
"OgmEntityPersister",
"persister",
"=",
"(",
"OgmEntityPersiste... | Given a {@link SessionImplementor} returns the {@link TupleContext} associated to an entity.
@param session the current session
@param metadata the {@link EntityMetadataInformation} of the entity associated to the TupleContext
@return the TupleContext associated to the current session for the entity specified | [
"Given",
"a",
"{",
"@link",
"SessionImplementor",
"}",
"returns",
"the",
"{",
"@link",
"TupleContext",
"}",
"associated",
"to",
"an",
"entity",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/TupleContextHelper.java#L34-L48 |
Teddy-Zhu/SilentGo | utils/src/main/java/com/silentgo/utils/log/StaticLog.java | StaticLog.log | public static boolean log(Level level, Throwable t, String format, Object... arguments) {
return log(LogFactory.indirectGet(), level, t, format, arguments);
} | java | public static boolean log(Level level, Throwable t, String format, Object... arguments) {
return log(LogFactory.indirectGet(), level, t, format, arguments);
} | [
"public",
"static",
"boolean",
"log",
"(",
"Level",
"level",
",",
"Throwable",
"t",
",",
"String",
"format",
",",
"Object",
"...",
"arguments",
")",
"{",
"return",
"log",
"(",
"LogFactory",
".",
"indirectGet",
"(",
")",
",",
"level",
",",
"t",
",",
"fo... | 打印日志<br>
@param level 日志级别
@param t 需在日志中堆栈打印的异常
@param format 格式文本,{} 代表变量
@param arguments 变量对应的参数 | [
"打印日志<br",
">"
] | train | https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/log/StaticLog.java#L222-L224 |
pebble/pebble-android-sdk | PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java | PebbleDictionary.addInt32 | public void addInt32(final int key, final int i) {
PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.INT, PebbleTuple.Width.WORD, i);
addTuple(t);
} | java | public void addInt32(final int key, final int i) {
PebbleTuple t = PebbleTuple.create(key, PebbleTuple.TupleType.INT, PebbleTuple.Width.WORD, i);
addTuple(t);
} | [
"public",
"void",
"addInt32",
"(",
"final",
"int",
"key",
",",
"final",
"int",
"i",
")",
"{",
"PebbleTuple",
"t",
"=",
"PebbleTuple",
".",
"create",
"(",
"key",
",",
"PebbleTuple",
".",
"TupleType",
".",
"INT",
",",
"PebbleTuple",
".",
"Width",
".",
"W... | Associate the specified signed int with the provided key in the dictionary. If another key-value pair with the
same key is already present in the dictionary, it will be replaced.
@param key
key with which the specified value is associated
@param i
value to be associated with the specified key | [
"Associate",
"the",
"specified",
"signed",
"int",
"with",
"the",
"provided",
"key",
"in",
"the",
"dictionary",
".",
"If",
"another",
"key",
"-",
"value",
"pair",
"with",
"the",
"same",
"key",
"is",
"already",
"present",
"in",
"the",
"dictionary",
"it",
"wi... | train | https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/util/PebbleDictionary.java#L163-L166 |
alibaba/jstorm | jstorm-on-yarn/src/main/java/com/alibaba/jstorm/yarn/utils/JstormYarnUtils.java | JstormYarnUtils.getSupervisorSlotPorts | public static String getSupervisorSlotPorts(int memory, int vcores, String instanceName, String supervisorHost, RegistryOperations registryOperations) {
return join(getSupervisorPorts(memory, vcores, instanceName, supervisorHost, registryOperations), JOYConstants.COMMA, false);
} | java | public static String getSupervisorSlotPorts(int memory, int vcores, String instanceName, String supervisorHost, RegistryOperations registryOperations) {
return join(getSupervisorPorts(memory, vcores, instanceName, supervisorHost, registryOperations), JOYConstants.COMMA, false);
} | [
"public",
"static",
"String",
"getSupervisorSlotPorts",
"(",
"int",
"memory",
",",
"int",
"vcores",
",",
"String",
"instanceName",
",",
"String",
"supervisorHost",
",",
"RegistryOperations",
"registryOperations",
")",
"{",
"return",
"join",
"(",
"getSupervisorPorts",
... | this is for jstorm configuration's format
@param memory
@param vcores
@param supervisorHost
@return | [
"this",
"is",
"for",
"jstorm",
"configuration",
"s",
"format"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-on-yarn/src/main/java/com/alibaba/jstorm/yarn/utils/JstormYarnUtils.java#L283-L285 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java | ServerCommunicationLinksInner.beginCreateOrUpdate | public ServerCommunicationLinkInner beginCreateOrUpdate(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).toBlocking().single().body();
} | java | public ServerCommunicationLinkInner beginCreateOrUpdate(String resourceGroupName, String serverName, String communicationLinkName, String partnerServer) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, communicationLinkName, partnerServer).toBlocking().single().body();
} | [
"public",
"ServerCommunicationLinkInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"communicationLinkName",
",",
"String",
"partnerServer",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"r... | Creates a server communication link.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param communicationLinkName The name of the server communication link.
@param partnerServer The name of the partner server.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ServerCommunicationLinkInner object if successful. | [
"Creates",
"a",
"server",
"communication",
"link",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerCommunicationLinksInner.java#L362-L364 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java | PublicIPPrefixesInner.beginUpdateTags | public PublicIPPrefixInner beginUpdateTags(String resourceGroupName, String publicIpPrefixName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).toBlocking().single().body();
} | java | public PublicIPPrefixInner beginUpdateTags(String resourceGroupName, String publicIpPrefixName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).toBlocking().single().body();
} | [
"public",
"PublicIPPrefixInner",
"beginUpdateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"publicIpPrefixName",
")",
"{",
"return",
"beginUpdateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"publicIpPrefixName",
")",
".",
"toBlocking",
"(",
")",... | Updates public IP prefix tags.
@param resourceGroupName The name of the resource group.
@param publicIpPrefixName The name of the public IP prefix.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PublicIPPrefixInner object if successful. | [
"Updates",
"public",
"IP",
"prefix",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java#L754-L756 |
GoogleCloudPlatform/bigdata-interop | gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java | GoogleHadoopFileSystemBase.globStatus | @Override
public FileStatus[] globStatus(Path pathPattern, PathFilter filter) throws IOException {
checkOpen();
logger.atFine().log("GHFS.globStatus: %s", pathPattern);
// URI does not handle glob expressions nicely, for the purpose of
// fully-qualifying a path we can URI-encode them.
// Using toString() to avoid Path(URI) constructor.
Path encodedPath = new Path(pathPattern.toUri().toString());
// We convert pathPattern to GCS path and then to Hadoop path to ensure that it ends up in
// the correct format. See note in getHadoopPath for more information.
Path encodedFixedPath = getHadoopPath(getGcsPath(encodedPath));
// Decode URI-encoded path back into a glob path.
Path fixedPath = new Path(URI.create(encodedFixedPath.toString()));
logger.atFine().log("GHFS.globStatus fixedPath: %s => %s", pathPattern, fixedPath);
if (enableConcurrentGlob && couldUseFlatGlob(fixedPath)) {
return concurrentGlobInternal(fixedPath, filter);
}
if (enableFlatGlob && couldUseFlatGlob(fixedPath)) {
return flatGlobInternal(fixedPath, filter);
}
return super.globStatus(fixedPath, filter);
} | java | @Override
public FileStatus[] globStatus(Path pathPattern, PathFilter filter) throws IOException {
checkOpen();
logger.atFine().log("GHFS.globStatus: %s", pathPattern);
// URI does not handle glob expressions nicely, for the purpose of
// fully-qualifying a path we can URI-encode them.
// Using toString() to avoid Path(URI) constructor.
Path encodedPath = new Path(pathPattern.toUri().toString());
// We convert pathPattern to GCS path and then to Hadoop path to ensure that it ends up in
// the correct format. See note in getHadoopPath for more information.
Path encodedFixedPath = getHadoopPath(getGcsPath(encodedPath));
// Decode URI-encoded path back into a glob path.
Path fixedPath = new Path(URI.create(encodedFixedPath.toString()));
logger.atFine().log("GHFS.globStatus fixedPath: %s => %s", pathPattern, fixedPath);
if (enableConcurrentGlob && couldUseFlatGlob(fixedPath)) {
return concurrentGlobInternal(fixedPath, filter);
}
if (enableFlatGlob && couldUseFlatGlob(fixedPath)) {
return flatGlobInternal(fixedPath, filter);
}
return super.globStatus(fixedPath, filter);
} | [
"@",
"Override",
"public",
"FileStatus",
"[",
"]",
"globStatus",
"(",
"Path",
"pathPattern",
",",
"PathFilter",
"filter",
")",
"throws",
"IOException",
"{",
"checkOpen",
"(",
")",
";",
"logger",
".",
"atFine",
"(",
")",
".",
"log",
"(",
"\"GHFS.globStatus: %... | Returns an array of FileStatus objects whose path names match pathPattern and is accepted by
the user-supplied path filter. Results are sorted by their path names.
<p>Return null if pathPattern has no glob and the path does not exist. Return an empty array if
pathPattern has a glob and no path matches it.
@param pathPattern A regular expression specifying the path pattern.
@param filter A user-supplied path filter.
@return An array of FileStatus objects.
@throws IOException if an error occurs. | [
"Returns",
"an",
"array",
"of",
"FileStatus",
"objects",
"whose",
"path",
"names",
"match",
"pathPattern",
"and",
"is",
"accepted",
"by",
"the",
"user",
"-",
"supplied",
"path",
"filter",
".",
"Results",
"are",
"sorted",
"by",
"their",
"path",
"names",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/GoogleHadoopFileSystemBase.java#L1222-L1247 |
aws/aws-sdk-java | aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/ListObjectParentsResult.java | ListObjectParentsResult.withParents | public ListObjectParentsResult withParents(java.util.Map<String, String> parents) {
setParents(parents);
return this;
} | java | public ListObjectParentsResult withParents(java.util.Map<String, String> parents) {
setParents(parents);
return this;
} | [
"public",
"ListObjectParentsResult",
"withParents",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"parents",
")",
"{",
"setParents",
"(",
"parents",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The parent structure, which is a map with key as the <code>ObjectIdentifier</code> and LinkName as the value.
</p>
@param parents
The parent structure, which is a map with key as the <code>ObjectIdentifier</code> and LinkName as the
value.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"parent",
"structure",
"which",
"is",
"a",
"map",
"with",
"key",
"as",
"the",
"<code",
">",
"ObjectIdentifier<",
"/",
"code",
">",
"and",
"LinkName",
"as",
"the",
"value",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/ListObjectParentsResult.java#L83-L86 |
GII/broccoli | broccoli-tools/src/main/java/com/hi3project/broccoli/bsdf/impl/implementation/AJavaServiceImplementation.java | AJavaServiceImplementation.getResponseToFrom | private static String getResponseToFrom(String callerClassName, String callerMethodName) throws ServiceExecutionException
{
try
{
Class<?> clas = Class.forName(callerClassName);
Method[] methods = clas.getMethods();
for (Method method : methods)
{
if (method.getName().equalsIgnoreCase(callerMethodName))
{
ResponseTo annotation = method.getAnnotation(ResponseTo.class);
return (null!=annotation)?annotation.value():null;
}
}
} catch (ClassNotFoundException ex)
{
throw new ServiceExecutionException(callerClassName, ex);
}
return null;
} | java | private static String getResponseToFrom(String callerClassName, String callerMethodName) throws ServiceExecutionException
{
try
{
Class<?> clas = Class.forName(callerClassName);
Method[] methods = clas.getMethods();
for (Method method : methods)
{
if (method.getName().equalsIgnoreCase(callerMethodName))
{
ResponseTo annotation = method.getAnnotation(ResponseTo.class);
return (null!=annotation)?annotation.value():null;
}
}
} catch (ClassNotFoundException ex)
{
throw new ServiceExecutionException(callerClassName, ex);
}
return null;
} | [
"private",
"static",
"String",
"getResponseToFrom",
"(",
"String",
"callerClassName",
",",
"String",
"callerMethodName",
")",
"throws",
"ServiceExecutionException",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"clas",
"=",
"Class",
".",
"forName",
"(",
"callerClassNam... | /*
Utility method to extract the value of @ResponseTo for a method supposedly annotated. | [
"/",
"*",
"Utility",
"method",
"to",
"extract",
"the",
"value",
"of"
] | train | https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-tools/src/main/java/com/hi3project/broccoli/bsdf/impl/implementation/AJavaServiceImplementation.java#L233-L255 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java | KeyVaultClientCustomImpl.listSecretVersionsAsync | public ServiceFuture<List<SecretItem>> listSecretVersionsAsync(final String vaultBaseUrl, final String secretName,
final ListOperationCallback<SecretItem> serviceCallback) {
return getSecretVersionsAsync(vaultBaseUrl, secretName, serviceCallback);
} | java | public ServiceFuture<List<SecretItem>> listSecretVersionsAsync(final String vaultBaseUrl, final String secretName,
final ListOperationCallback<SecretItem> serviceCallback) {
return getSecretVersionsAsync(vaultBaseUrl, secretName, serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"SecretItem",
">",
">",
"listSecretVersionsAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"String",
"secretName",
",",
"final",
"ListOperationCallback",
"<",
"SecretItem",
">",
"serviceCallback",
")",
"{",
... | List the versions of the specified secret.
@param vaultBaseUrl
The vault name, e.g. https://myvault.vault.azure.net
@param secretName
The name of the secret in the given vault
@param serviceCallback
the async ServiceCallback to handle successful and failed
responses.
@return the {@link ServiceFuture} object | [
"List",
"the",
"versions",
"of",
"the",
"specified",
"secret",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L1245-L1248 |
apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/encoder/BaseHttpServletAwareSamlObjectEncoder.java | BaseHttpServletAwareSamlObjectEncoder.getEncoderMessageContext | protected MessageContext getEncoderMessageContext(final RequestAbstractType request, final T samlObject, final String relayState) {
val ctx = new MessageContext<SAMLObject>();
ctx.setMessage(samlObject);
SAMLBindingSupport.setRelayState(ctx, relayState);
SamlIdPUtils.preparePeerEntitySamlEndpointContext(request, ctx, adaptor, getBinding());
val self = ctx.getSubcontext(SAMLSelfEntityContext.class, true);
self.setEntityId(SamlIdPUtils.getIssuerFromSamlObject(samlObject));
return ctx;
} | java | protected MessageContext getEncoderMessageContext(final RequestAbstractType request, final T samlObject, final String relayState) {
val ctx = new MessageContext<SAMLObject>();
ctx.setMessage(samlObject);
SAMLBindingSupport.setRelayState(ctx, relayState);
SamlIdPUtils.preparePeerEntitySamlEndpointContext(request, ctx, adaptor, getBinding());
val self = ctx.getSubcontext(SAMLSelfEntityContext.class, true);
self.setEntityId(SamlIdPUtils.getIssuerFromSamlObject(samlObject));
return ctx;
} | [
"protected",
"MessageContext",
"getEncoderMessageContext",
"(",
"final",
"RequestAbstractType",
"request",
",",
"final",
"T",
"samlObject",
",",
"final",
"String",
"relayState",
")",
"{",
"val",
"ctx",
"=",
"new",
"MessageContext",
"<",
"SAMLObject",
">",
"(",
")"... | Build encoder message context.
@param request the authn request
@param samlObject the saml response
@param relayState the relay state
@return the message context | [
"Build",
"encoder",
"message",
"context",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/encoder/BaseHttpServletAwareSamlObjectEncoder.java#L78-L86 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/access/ecr/EcrExtendedAuth.java | EcrExtendedAuth.extendedAuth | public AuthConfig extendedAuth(AuthConfig localCredentials) throws IOException, MojoExecutionException {
JsonObject jo = getAuthorizationToken(localCredentials);
JsonArray authorizationDatas = jo.getAsJsonArray("authorizationData");
JsonObject authorizationData = authorizationDatas.get(0).getAsJsonObject();
String authorizationToken = authorizationData.get("authorizationToken").getAsString();
return new AuthConfig(authorizationToken, "none");
} | java | public AuthConfig extendedAuth(AuthConfig localCredentials) throws IOException, MojoExecutionException {
JsonObject jo = getAuthorizationToken(localCredentials);
JsonArray authorizationDatas = jo.getAsJsonArray("authorizationData");
JsonObject authorizationData = authorizationDatas.get(0).getAsJsonObject();
String authorizationToken = authorizationData.get("authorizationToken").getAsString();
return new AuthConfig(authorizationToken, "none");
} | [
"public",
"AuthConfig",
"extendedAuth",
"(",
"AuthConfig",
"localCredentials",
")",
"throws",
"IOException",
",",
"MojoExecutionException",
"{",
"JsonObject",
"jo",
"=",
"getAuthorizationToken",
"(",
"localCredentials",
")",
";",
"JsonArray",
"authorizationDatas",
"=",
... | Perform extended authentication. Use the provided credentials as IAM credentials and
get a temporary ECR token.
@param localCredentials IAM id/secret
@return ECR base64 encoded username:password
@throws IOException
@throws MojoExecutionException | [
"Perform",
"extended",
"authentication",
".",
"Use",
"the",
"provided",
"credentials",
"as",
"IAM",
"credentials",
"and",
"get",
"a",
"temporary",
"ECR",
"token",
"."
] | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/ecr/EcrExtendedAuth.java#L89-L97 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.listMetricsWithServiceResponseAsync | public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMetricsWithServiceResponseAsync(final String resourceGroupName, final String name) {
return listMetricsSinglePageAsync(resourceGroupName, name)
.concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listMetricsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMetricsWithServiceResponseAsync(final String resourceGroupName, final String name) {
return listMetricsSinglePageAsync(resourceGroupName, name)
.concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listMetricsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"ResourceMetricInner",
">",
">",
">",
"listMetricsWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
")",
"{",
"return",
"listMetricsSinglePageAsync",
... | Get metrics for an App Serice plan.
Get metrics for an App Serice plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ResourceMetricInner> object | [
"Get",
"metrics",
"for",
"an",
"App",
"Serice",
"plan",
".",
"Get",
"metrics",
"for",
"an",
"App",
"Serice",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1995-L2007 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.getPKEnumerationByQuery | public Enumeration getPKEnumerationByQuery(Class primaryKeyClass, Query query) throws PersistenceBrokerException
{
if (logger.isDebugEnabled()) logger.debug("getPKEnumerationByQuery " + query);
query.setFetchSize(1);
ClassDescriptor cld = getClassDescriptor(query.getSearchClass());
return new PkEnumeration(query, cld, primaryKeyClass, this);
} | java | public Enumeration getPKEnumerationByQuery(Class primaryKeyClass, Query query) throws PersistenceBrokerException
{
if (logger.isDebugEnabled()) logger.debug("getPKEnumerationByQuery " + query);
query.setFetchSize(1);
ClassDescriptor cld = getClassDescriptor(query.getSearchClass());
return new PkEnumeration(query, cld, primaryKeyClass, this);
} | [
"public",
"Enumeration",
"getPKEnumerationByQuery",
"(",
"Class",
"primaryKeyClass",
",",
"Query",
"query",
")",
"throws",
"PersistenceBrokerException",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"logger",
".",
"debug",
"(",
"\"getPKEnumerationB... | returns an Enumeration of PrimaryKey Objects for objects of class DataClass.
The Elements returned come from a SELECT ... WHERE Statement
that is defined by the fields and their coresponding values of listFields
and listValues.
Useful for EJB Finder Methods...
@param primaryKeyClass the pk class for the searched objects
@param query the query | [
"returns",
"an",
"Enumeration",
"of",
"PrimaryKey",
"Objects",
"for",
"objects",
"of",
"class",
"DataClass",
".",
"The",
"Elements",
"returned",
"come",
"from",
"a",
"SELECT",
"...",
"WHERE",
"Statement",
"that",
"is",
"defined",
"by",
"the",
"fields",
"and",
... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1830-L1837 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java | EJSContainer.getCurrentSessionalUOW | public ContainerAS getCurrentSessionalUOW(boolean checkMarkedReset) throws CSIException, CSITransactionRolledbackException {
ContainerAS result = null;
Object currASKey = uowCtrl.getCurrentSessionalUOW(checkMarkedReset);
//---------------------------------------------------------
// No activity session available in after_completion callbacks.
// Okay to return null in this case.
//---------------------------------------------------------
if (currASKey == null) {
return null;
}
result = containerASMap.get(currASKey);
if (result == null) {
result = new ContainerAS(this, currASKey);
uowCtrl.enlistWithSession(result);
containerASMap.put(currASKey, result);
}
return result;
} | java | public ContainerAS getCurrentSessionalUOW(boolean checkMarkedReset) throws CSIException, CSITransactionRolledbackException {
ContainerAS result = null;
Object currASKey = uowCtrl.getCurrentSessionalUOW(checkMarkedReset);
//---------------------------------------------------------
// No activity session available in after_completion callbacks.
// Okay to return null in this case.
//---------------------------------------------------------
if (currASKey == null) {
return null;
}
result = containerASMap.get(currASKey);
if (result == null) {
result = new ContainerAS(this, currASKey);
uowCtrl.enlistWithSession(result);
containerASMap.put(currASKey, result);
}
return result;
} | [
"public",
"ContainerAS",
"getCurrentSessionalUOW",
"(",
"boolean",
"checkMarkedReset",
")",
"throws",
"CSIException",
",",
"CSITransactionRolledbackException",
"{",
"ContainerAS",
"result",
"=",
"null",
";",
"Object",
"currASKey",
"=",
"uowCtrl",
".",
"getCurrentSessional... | Added checMarkedRest parameter. d348420 | [
"Added",
"checMarkedRest",
"parameter",
".",
"d348420"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java#L1343-L1364 |
mikepenz/MaterialDrawer | library/src/main/java/com/mikepenz/materialdrawer/util/DrawerUIUtils.java | DrawerUIUtils.getBooleanStyleable | public static boolean getBooleanStyleable(Context ctx, @StyleableRes int styleable, boolean def) {
TypedArray ta = ctx.getTheme().obtainStyledAttributes(R.styleable.MaterialDrawer);
return ta.getBoolean(styleable, def);
} | java | public static boolean getBooleanStyleable(Context ctx, @StyleableRes int styleable, boolean def) {
TypedArray ta = ctx.getTheme().obtainStyledAttributes(R.styleable.MaterialDrawer);
return ta.getBoolean(styleable, def);
} | [
"public",
"static",
"boolean",
"getBooleanStyleable",
"(",
"Context",
"ctx",
",",
"@",
"StyleableRes",
"int",
"styleable",
",",
"boolean",
"def",
")",
"{",
"TypedArray",
"ta",
"=",
"ctx",
".",
"getTheme",
"(",
")",
".",
"obtainStyledAttributes",
"(",
"R",
".... | Get the boolean value of a given styleable.
@param ctx
@param styleable
@param def
@return | [
"Get",
"the",
"boolean",
"value",
"of",
"a",
"given",
"styleable",
"."
] | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/util/DrawerUIUtils.java#L42-L45 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java | NetUtil.createAddress | public static InetSocketAddress createAddress(String host, int port) {
if (StrUtil.isBlank(host)) {
return new InetSocketAddress(port);
}
return new InetSocketAddress(host, port);
} | java | public static InetSocketAddress createAddress(String host, int port) {
if (StrUtil.isBlank(host)) {
return new InetSocketAddress(port);
}
return new InetSocketAddress(host, port);
} | [
"public",
"static",
"InetSocketAddress",
"createAddress",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"host",
")",
")",
"{",
"return",
"new",
"InetSocketAddress",
"(",
"port",
")",
";",
"}",
"return",
"... | 创建 {@link InetSocketAddress}
@param host 域名或IP地址,空表示任意地址
@param port 端口,0表示系统分配临时端口
@return {@link InetSocketAddress}
@since 3.3.0 | [
"创建",
"{",
"@link",
"InetSocketAddress",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L467-L472 |
kaazing/gateway | transport/http/src/main/java/org/kaazing/gateway/transport/http/HttpUtils.java | HttpUtils.getCanonicalURI | public static URI getCanonicalURI(String uriString, boolean canonicalizePath) {
if ((uriString != null) && !"".equals(uriString)) {
return getCanonicalURI(URI.create(uriString), canonicalizePath);
}
return null;
} | java | public static URI getCanonicalURI(String uriString, boolean canonicalizePath) {
if ((uriString != null) && !"".equals(uriString)) {
return getCanonicalURI(URI.create(uriString), canonicalizePath);
}
return null;
} | [
"public",
"static",
"URI",
"getCanonicalURI",
"(",
"String",
"uriString",
",",
"boolean",
"canonicalizePath",
")",
"{",
"if",
"(",
"(",
"uriString",
"!=",
"null",
")",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"uriString",
")",
")",
"{",
"return",
"getCanonic... | Create a canonical URI from a given URI. A canonical URI is a URI with:<ul>
<li>the host part of the authority lower-case since URI semantics dictate that hostnames are case insensitive
<li>(optionally, NOT appropriate for Origin headers) the path part set to "/" if there was no path in the
input URI (this conforms to the WebSocket and HTTP protocol specifications and avoids us having to do special
handling for path throughout the server code).
</ul>
@param uriString the URI to canonicalize, in string form
@param canonicalizePath if true, append trailing '/' when missing
@return a URI with the host part of the authority lower-case and (optionally) trailing / added, or null if the uri is null
@throws IllegalArgumentException if the uriString is not valid syntax | [
"Create",
"a",
"canonical",
"URI",
"from",
"a",
"given",
"URI",
".",
"A",
"canonical",
"URI",
"is",
"a",
"URI",
"with",
":",
"<ul",
">",
"<li",
">",
"the",
"host",
"part",
"of",
"the",
"authority",
"lower",
"-",
"case",
"since",
"URI",
"semantics",
"... | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/HttpUtils.java#L503-L508 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ParseUtil.java | ParseUtil.matchInf | private static boolean matchInf(byte[] str, byte firstchar, int start, int end) {
final int len = end - start;
// The wonders of unicode. The infinity symbol \u221E is three bytes:
if(len == 3 && firstchar == -0x1E && str[start + 1] == -0x78 && str[start + 2] == -0x62) {
return true;
}
if((len != 3 && len != INFINITY_LENGTH) //
|| (firstchar != 'I' && firstchar != 'i')) {
return false;
}
for(int i = 1, j = INFINITY_LENGTH + 1; i < INFINITY_LENGTH; i++, j++) {
final byte c = str[start + i];
if(c != INFINITY_PATTERN[i] && c != INFINITY_PATTERN[j]) {
return false;
}
if(i == 2 && len == 3) {
return true;
}
}
return true;
} | java | private static boolean matchInf(byte[] str, byte firstchar, int start, int end) {
final int len = end - start;
// The wonders of unicode. The infinity symbol \u221E is three bytes:
if(len == 3 && firstchar == -0x1E && str[start + 1] == -0x78 && str[start + 2] == -0x62) {
return true;
}
if((len != 3 && len != INFINITY_LENGTH) //
|| (firstchar != 'I' && firstchar != 'i')) {
return false;
}
for(int i = 1, j = INFINITY_LENGTH + 1; i < INFINITY_LENGTH; i++, j++) {
final byte c = str[start + i];
if(c != INFINITY_PATTERN[i] && c != INFINITY_PATTERN[j]) {
return false;
}
if(i == 2 && len == 3) {
return true;
}
}
return true;
} | [
"private",
"static",
"boolean",
"matchInf",
"(",
"byte",
"[",
"]",
"str",
",",
"byte",
"firstchar",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"final",
"int",
"len",
"=",
"end",
"-",
"start",
";",
"// The wonders of unicode. The infinity symbol \\u221E ... | Match "inf", "infinity" in a number of different capitalizations.
@param str String to match
@param firstchar First character
@param start Interval begin
@param end Interval end
@return {@code true} when infinity was recognized. | [
"Match",
"inf",
"infinity",
"in",
"a",
"number",
"of",
"different",
"capitalizations",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ParseUtil.java#L481-L501 |
dkmfbk/knowledgestore | ks-server/src/main/java/eu/fbk/knowledgestore/triplestore/SelectQuery.java | SelectQuery.from | public static SelectQuery from(final String string) throws ParseException {
Preconditions.checkNotNull(string);
SelectQuery query = CACHE.getIfPresent(string);
if (query == null) {
final ParsedTupleQuery parsedQuery;
try {
parsedQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, string, null);
} catch (final IllegalArgumentException ex) {
throw new ParseException(string, "SPARQL query not in SELECT form", ex);
} catch (final MalformedQueryException ex) {
throw new ParseException(string, "Invalid SPARQL query: " + ex.getMessage(), ex);
}
query = new SelectQuery(string, parsedQuery.getTupleExpr(), parsedQuery.getDataset());
CACHE.put(string, query);
}
return query;
} | java | public static SelectQuery from(final String string) throws ParseException {
Preconditions.checkNotNull(string);
SelectQuery query = CACHE.getIfPresent(string);
if (query == null) {
final ParsedTupleQuery parsedQuery;
try {
parsedQuery = QueryParserUtil.parseTupleQuery(QueryLanguage.SPARQL, string, null);
} catch (final IllegalArgumentException ex) {
throw new ParseException(string, "SPARQL query not in SELECT form", ex);
} catch (final MalformedQueryException ex) {
throw new ParseException(string, "Invalid SPARQL query: " + ex.getMessage(), ex);
}
query = new SelectQuery(string, parsedQuery.getTupleExpr(), parsedQuery.getDataset());
CACHE.put(string, query);
}
return query;
} | [
"public",
"static",
"SelectQuery",
"from",
"(",
"final",
"String",
"string",
")",
"throws",
"ParseException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"string",
")",
";",
"SelectQuery",
"query",
"=",
"CACHE",
".",
"getIfPresent",
"(",
"string",
")",
";"... | Returns a <tt>SelectQuery</tt> for the specified SPARQL SELECT query string.
@param string
the query string, in SPARQL and without relative URIs
@return the corresponding <tt>SelectQuery</tt>
@throws ParseException
in case the string does not denote a valid SPARQL SELECT query | [
"Returns",
"a",
"<tt",
">",
"SelectQuery<",
"/",
"tt",
">",
"for",
"the",
"specified",
"SPARQL",
"SELECT",
"query",
"string",
"."
] | train | https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-server/src/main/java/eu/fbk/knowledgestore/triplestore/SelectQuery.java#L85-L103 |
rzwitserloot/lombok | src/utils/lombok/javac/TreeMirrorMaker.java | TreeMirrorMaker.visitLabeledStatement | @Override public JCTree visitLabeledStatement(LabeledStatementTree node, Void p) {
return node.getStatement().accept(this, p);
} | java | @Override public JCTree visitLabeledStatement(LabeledStatementTree node, Void p) {
return node.getStatement().accept(this, p);
} | [
"@",
"Override",
"public",
"JCTree",
"visitLabeledStatement",
"(",
"LabeledStatementTree",
"node",
",",
"Void",
"p",
")",
"{",
"return",
"node",
".",
"getStatement",
"(",
")",
".",
"accept",
"(",
"this",
",",
"p",
")",
";",
"}"
] | This and visitVariable is rather hacky but we're working around evident bugs or at least inconsistencies in javac. | [
"This",
"and",
"visitVariable",
"is",
"rather",
"hacky",
"but",
"we",
"re",
"working",
"around",
"evident",
"bugs",
"or",
"at",
"least",
"inconsistencies",
"in",
"javac",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/utils/lombok/javac/TreeMirrorMaker.java#L120-L122 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/DoubleField.java | DoubleField.moveSQLToField | public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException
{
double dResult = resultset.getDouble(iColumn);
if (resultset.wasNull())
this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value
else
{
if ((!this.isNullable()) && (dResult == Double.NaN))
this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value
else
this.setValue(dResult, false, DBConstants.READ_MOVE);
}
} | java | public void moveSQLToField(ResultSet resultset, int iColumn) throws SQLException
{
double dResult = resultset.getDouble(iColumn);
if (resultset.wasNull())
this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value
else
{
if ((!this.isNullable()) && (dResult == Double.NaN))
this.setString(Constants.BLANK, false, DBConstants.READ_MOVE); // Null value
else
this.setValue(dResult, false, DBConstants.READ_MOVE);
}
} | [
"public",
"void",
"moveSQLToField",
"(",
"ResultSet",
"resultset",
",",
"int",
"iColumn",
")",
"throws",
"SQLException",
"{",
"double",
"dResult",
"=",
"resultset",
".",
"getDouble",
"(",
"iColumn",
")",
";",
"if",
"(",
"resultset",
".",
"wasNull",
"(",
")",... | Move the physical binary data to this SQL parameter row.
@param resultset The resultset to get the SQL data from.
@param iColumn the column in the resultset that has my data.
@exception SQLException From SQL calls. | [
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"SQL",
"parameter",
"row",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DoubleField.java#L161-L173 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java | UScript.getScriptExtensions | public static final int getScriptExtensions(int c, BitSet set) {
set.clear();
int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK;
if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) {
set.set(scriptX);
return scriptX;
}
char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_;
int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions
if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) {
scx=scriptExtensions[scx+1];
}
int length=0;
int sx;
do {
sx=scriptExtensions[scx++];
set.set(sx&0x7fff);
++length;
} while(sx<0x8000);
// length==set.cardinality()
return -length;
} | java | public static final int getScriptExtensions(int c, BitSet set) {
set.clear();
int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK;
if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) {
set.set(scriptX);
return scriptX;
}
char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_;
int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions
if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) {
scx=scriptExtensions[scx+1];
}
int length=0;
int sx;
do {
sx=scriptExtensions[scx++];
set.set(sx&0x7fff);
++length;
} while(sx<0x8000);
// length==set.cardinality()
return -length;
} | [
"public",
"static",
"final",
"int",
"getScriptExtensions",
"(",
"int",
"c",
",",
"BitSet",
"set",
")",
"{",
"set",
".",
"clear",
"(",
")",
";",
"int",
"scriptX",
"=",
"UCharacterProperty",
".",
"INSTANCE",
".",
"getAdditional",
"(",
"c",
",",
"0",
")",
... | Sets code point c's Script_Extensions as script code integers into the output BitSet.
<ul>
<li>If c does have Script_Extensions, then the return value is
the negative number of Script_Extensions codes (= -set.cardinality());
in this case, the Script property value
(normally Common or Inherited) is not included in the set.
<li>If c does not have Script_Extensions, then the one Script code is put into the set
and also returned.
<li>If c is not a valid code point, then the one {@link #UNKNOWN} code is put into the set
and also returned.
</ul>
In other words, if the return value is non-negative, it is c's single Script code
and the set contains exactly this Script code.
If the return value is -n, then the set contains c's n>=2 Script_Extensions script codes.
<p>Some characters are commonly used in multiple scripts.
For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
@param c code point
@param set set of script code integers; will be cleared, then bits are set
corresponding to c's Script_Extensions
@return negative number of script codes in c's Script_Extensions,
or the non-negative single Script value | [
"Sets",
"code",
"point",
"c",
"s",
"Script_Extensions",
"as",
"script",
"code",
"integers",
"into",
"the",
"output",
"BitSet",
".",
"<ul",
">",
"<li",
">",
"If",
"c",
"does",
"have",
"Script_Extensions",
"then",
"the",
"return",
"value",
"is",
"the",
"nega... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java#L1019-L1041 |
ehcache/ehcache3 | core/src/main/java/org/ehcache/core/spi/service/ServiceUtils.java | ServiceUtils.findAmongst | public static <T> Collection<T> findAmongst(Class<T> clazz, Collection<?> instances) {
return findStreamAmongst(clazz, instances)
.collect(Collectors.toList());
} | java | public static <T> Collection<T> findAmongst(Class<T> clazz, Collection<?> instances) {
return findStreamAmongst(clazz, instances)
.collect(Collectors.toList());
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"findAmongst",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Collection",
"<",
"?",
">",
"instances",
")",
"{",
"return",
"findStreamAmongst",
"(",
"clazz",
",",
"instances",
")",
".",
"coll... | Find instances of {@code clazz} among the {@code instances}.
@param clazz searched class
@param instances instances looked at
@param <T> type of the searched instances
@return the list of compatible instances | [
"Find",
"instances",
"of",
"{",
"@code",
"clazz",
"}",
"among",
"the",
"{",
"@code",
"instances",
"}",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/core/src/main/java/org/ehcache/core/spi/service/ServiceUtils.java#L49-L52 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/FileLocator.java | FileLocator.matchFileInFilePath | public static File matchFileInFilePath(String regex, Collection<File> pathList) {
if (regex == null || pathList == null || pathList.size() == 0)
return null;
for (File dirPath : pathList) {
File result = matchFile(dirPath, regex);
if (result != null)
return result;
}
return null;
} | java | public static File matchFileInFilePath(String regex, Collection<File> pathList) {
if (regex == null || pathList == null || pathList.size() == 0)
return null;
for (File dirPath : pathList) {
File result = matchFile(dirPath, regex);
if (result != null)
return result;
}
return null;
} | [
"public",
"static",
"File",
"matchFileInFilePath",
"(",
"String",
"regex",
",",
"Collection",
"<",
"File",
">",
"pathList",
")",
"{",
"if",
"(",
"regex",
"==",
"null",
"||",
"pathList",
"==",
"null",
"||",
"pathList",
".",
"size",
"(",
")",
"==",
"0",
... | Look for given file in any of the specified directories, return the first
one found.
@param name
The name of the file to find
@param pathList
The list of directories to check
@return The File object if the file is found;
null if the pathList is null or empty, or file is not found.
@throws SecurityException
If a security manager exists and its <code>{@link java.lang.SecurityManager#checkRead(java.lang.String)}</code> method denies read access to the file. | [
"Look",
"for",
"given",
"file",
"in",
"any",
"of",
"the",
"specified",
"directories",
"return",
"the",
"first",
"one",
"found",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/FileLocator.java#L178-L189 |
cojen/Cojen | src/main/java/org/cojen/classfile/ClassFile.java | ClassFile.addInnerClass | public ClassFile addInnerClass(String fullInnerClassName, String innerClassName) {
return addInnerClass(fullInnerClassName, innerClassName, (String)null);
} | java | public ClassFile addInnerClass(String fullInnerClassName, String innerClassName) {
return addInnerClass(fullInnerClassName, innerClassName, (String)null);
} | [
"public",
"ClassFile",
"addInnerClass",
"(",
"String",
"fullInnerClassName",
",",
"String",
"innerClassName",
")",
"{",
"return",
"addInnerClass",
"(",
"fullInnerClassName",
",",
"innerClassName",
",",
"(",
"String",
")",
"null",
")",
";",
"}"
] | Add an inner class to this class. By default, inner classes are private
static.
@param fullInnerClassName Optional full inner class name.
@param innerClassName Optional short inner class name. | [
"Add",
"an",
"inner",
"class",
"to",
"this",
"class",
".",
"By",
"default",
"inner",
"classes",
"are",
"private",
"static",
"."
] | train | https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/ClassFile.java#L837-L839 |
apache/groovy | src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java | BytecodeHelper.getTypeDescription | private static String getTypeDescription(ClassNode c, boolean end) {
ClassNode d = c;
if (ClassHelper.isPrimitiveType(d.redirect())) {
d = d.redirect();
}
String desc = TypeUtil.getDescriptionByType(d);
if (!end && desc.endsWith(";")) {
desc = desc.substring(0, desc.length() - 1);
}
return desc;
} | java | private static String getTypeDescription(ClassNode c, boolean end) {
ClassNode d = c;
if (ClassHelper.isPrimitiveType(d.redirect())) {
d = d.redirect();
}
String desc = TypeUtil.getDescriptionByType(d);
if (!end && desc.endsWith(";")) {
desc = desc.substring(0, desc.length() - 1);
}
return desc;
} | [
"private",
"static",
"String",
"getTypeDescription",
"(",
"ClassNode",
"c",
",",
"boolean",
"end",
")",
"{",
"ClassNode",
"d",
"=",
"c",
";",
"if",
"(",
"ClassHelper",
".",
"isPrimitiveType",
"(",
"d",
".",
"redirect",
"(",
")",
")",
")",
"{",
"d",
"="... | array types are special:
eg.: String[]: classname: [Ljava/lang/String;
int[]: [I
@return the ASM type description | [
"array",
"types",
"are",
"special",
":",
"eg",
".",
":",
"String",
"[]",
":",
"classname",
":",
"[",
"Ljava",
"/",
"lang",
"/",
"String",
";",
"int",
"[]",
":",
"[",
"I"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java#L163-L176 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vod/VodClient.java | VodClient.deleteMediaResource | public DeleteMediaResourceResponse deleteMediaResource(DeleteMediaResourceRequest request) {
checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!");
InternalRequest internalRequest =
createRequest(HttpMethodName.DELETE, request, PATH_MEDIA, request.getMediaId());
return invokeHttpClient(internalRequest, DeleteMediaResourceResponse.class);
} | java | public DeleteMediaResourceResponse deleteMediaResource(DeleteMediaResourceRequest request) {
checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!");
InternalRequest internalRequest =
createRequest(HttpMethodName.DELETE, request, PATH_MEDIA, request.getMediaId());
return invokeHttpClient(internalRequest, DeleteMediaResourceResponse.class);
} | [
"public",
"DeleteMediaResourceResponse",
"deleteMediaResource",
"(",
"DeleteMediaResourceRequest",
"request",
")",
"{",
"checkStringNotEmpty",
"(",
"request",
".",
"getMediaId",
"(",
")",
",",
"\"Media ID should not be null or empty!\"",
")",
";",
"InternalRequest",
"internal... | Delete the specific media resource managed by VOD service.
<p>
The caller <i>must</i> authenticate with a valid BCE Access Key / Private Key pair.
@param request The request object containing all the options on how to
@return empty response will be returned | [
"Delete",
"the",
"specific",
"media",
"resource",
"managed",
"by",
"VOD",
"service",
".",
"<p",
">",
"The",
"caller",
"<i",
">",
"must<",
"/",
"i",
">",
"authenticate",
"with",
"a",
"valid",
"BCE",
"Access",
"Key",
"/",
"Private",
"Key",
"pair",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L740-L745 |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seekToSeason | public void seekToSeason(String seasonString, String direction, String seekAmount) {
Season season = Season.valueOf(seasonString);
assert(season!= null);
seekToIcsEvent(SEASON_ICS_FILE, season.getSummary(), direction, seekAmount);
} | java | public void seekToSeason(String seasonString, String direction, String seekAmount) {
Season season = Season.valueOf(seasonString);
assert(season!= null);
seekToIcsEvent(SEASON_ICS_FILE, season.getSummary(), direction, seekAmount);
} | [
"public",
"void",
"seekToSeason",
"(",
"String",
"seasonString",
",",
"String",
"direction",
",",
"String",
"seekAmount",
")",
"{",
"Season",
"season",
"=",
"Season",
".",
"valueOf",
"(",
"seasonString",
")",
";",
"assert",
"(",
"season",
"!=",
"null",
")",
... | Seeks forward or backwards to a particular season based on the current date
@param seasonString The season to seek to
@param direction The direction to seek
@param seekAmount The number of years to seek | [
"Seeks",
"forward",
"or",
"backwards",
"to",
"a",
"particular",
"season",
"based",
"on",
"the",
"current",
"date"
] | train | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L416-L421 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/core/image/ConvertImage.java | ConvertImage.convertF32U8 | public static InterleavedU8 convertF32U8( Planar<GrayF32> input , InterleavedU8 output ) {
if (output == null) {
output = new InterleavedU8(input.width, input.height,input.getNumBands());
} else {
output.reshape(input.width,input.height,input.getNumBands());
}
if( BoofConcurrency.USE_CONCURRENT ) {
ImplConvertImage_MT.convertF32U8(input,output);
} else {
ImplConvertImage.convertF32U8(input,output);
}
return output;
} | java | public static InterleavedU8 convertF32U8( Planar<GrayF32> input , InterleavedU8 output ) {
if (output == null) {
output = new InterleavedU8(input.width, input.height,input.getNumBands());
} else {
output.reshape(input.width,input.height,input.getNumBands());
}
if( BoofConcurrency.USE_CONCURRENT ) {
ImplConvertImage_MT.convertF32U8(input,output);
} else {
ImplConvertImage.convertF32U8(input,output);
}
return output;
} | [
"public",
"static",
"InterleavedU8",
"convertF32U8",
"(",
"Planar",
"<",
"GrayF32",
">",
"input",
",",
"InterleavedU8",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"InterleavedU8",
"(",
"input",
".",
"width",
",",... | Converts a {@link Planar} into the equivalent {@link InterleavedU8}
@param input (Input) Planar image that is being converted. Not modified.
@param output (Optional) The output image. If null a new image is created. Modified.
@return Converted image. | [
"Converts",
"a",
"{",
"@link",
"Planar",
"}",
"into",
"the",
"equivalent",
"{",
"@link",
"InterleavedU8",
"}"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/core/image/ConvertImage.java#L3604-L3618 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java | ElementMatchers.nameContains | public static <T extends NamedElement> ElementMatcher.Junction<T> nameContains(String infix) {
return new NameMatcher<T>(new StringMatcher(infix, StringMatcher.Mode.CONTAINS));
} | java | public static <T extends NamedElement> ElementMatcher.Junction<T> nameContains(String infix) {
return new NameMatcher<T>(new StringMatcher(infix, StringMatcher.Mode.CONTAINS));
} | [
"public",
"static",
"<",
"T",
"extends",
"NamedElement",
">",
"ElementMatcher",
".",
"Junction",
"<",
"T",
">",
"nameContains",
"(",
"String",
"infix",
")",
"{",
"return",
"new",
"NameMatcher",
"<",
"T",
">",
"(",
"new",
"StringMatcher",
"(",
"infix",
",",... | Matches a {@link NamedElement} for an infix of its name.
@param infix The expected infix of the name.
@param <T> The type of the matched object.
@return An element matcher for a named element's name's infix. | [
"Matches",
"a",
"{",
"@link",
"NamedElement",
"}",
"for",
"an",
"infix",
"of",
"its",
"name",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L723-L725 |
JodaOrg/joda-time | src/main/java/org/joda/time/convert/ReadableInstantConverter.java | ReadableInstantConverter.getChronology | public Chronology getChronology(Object object, Chronology chrono) {
if (chrono == null) {
chrono = ((ReadableInstant) object).getChronology();
chrono = DateTimeUtils.getChronology(chrono);
}
return chrono;
} | java | public Chronology getChronology(Object object, Chronology chrono) {
if (chrono == null) {
chrono = ((ReadableInstant) object).getChronology();
chrono = DateTimeUtils.getChronology(chrono);
}
return chrono;
} | [
"public",
"Chronology",
"getChronology",
"(",
"Object",
"object",
",",
"Chronology",
"chrono",
")",
"{",
"if",
"(",
"chrono",
"==",
"null",
")",
"{",
"chrono",
"=",
"(",
"(",
"ReadableInstant",
")",
"object",
")",
".",
"getChronology",
"(",
")",
";",
"ch... | Gets the chronology, which is taken from the ReadableInstant.
<p>
If the passed in chronology is non-null, it is used.
Otherwise the chronology from the instant is used.
@param object the ReadableInstant to convert, must not be null
@param chrono the chronology to use, null means use that from object
@return the chronology, never null | [
"Gets",
"the",
"chronology",
"which",
"is",
"taken",
"from",
"the",
"ReadableInstant",
".",
"<p",
">",
"If",
"the",
"passed",
"in",
"chronology",
"is",
"non",
"-",
"null",
"it",
"is",
"used",
".",
"Otherwise",
"the",
"chronology",
"from",
"the",
"instant",... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/convert/ReadableInstantConverter.java#L82-L88 |
fcrepo3/fcrepo | fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/FedoraClient.java | FedoraClient.getTuples | public TupleIterator getTuples(Map<String, String> params)
throws IOException {
params.put("type", "tuples");
params.put("format", RDFFormat.SPARQL.getName());
try {
String url = getRIQueryURL(params);
return TupleIterator.fromStream(get(url, true, true),
RDFFormat.SPARQL);
} catch (TrippiException e) {
throw new IOException("Error getting tuple iterator: "
+ e.getMessage());
}
} | java | public TupleIterator getTuples(Map<String, String> params)
throws IOException {
params.put("type", "tuples");
params.put("format", RDFFormat.SPARQL.getName());
try {
String url = getRIQueryURL(params);
return TupleIterator.fromStream(get(url, true, true),
RDFFormat.SPARQL);
} catch (TrippiException e) {
throw new IOException("Error getting tuple iterator: "
+ e.getMessage());
}
} | [
"public",
"TupleIterator",
"getTuples",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"IOException",
"{",
"params",
".",
"put",
"(",
"\"type\"",
",",
"\"tuples\"",
")",
";",
"params",
".",
"put",
"(",
"\"format\"",
",",
"RDFFormat... | Get tuples from the remote resource index. The map contains
<em>String</em> values for parameters that should be passed to the
service. Two parameters are required: 1) lang 2) query Two parameters to
the risearch service are implied: 1) type = tuples 2) format = sparql See
http
://www.fedora.info/download/2.0/userdocs/server/webservices/risearch/#
app.tuples | [
"Get",
"tuples",
"from",
"the",
"remote",
"resource",
"index",
".",
"The",
"map",
"contains",
"<em",
">",
"String<",
"/",
"em",
">",
"values",
"for",
"parameters",
"that",
"should",
"be",
"passed",
"to",
"the",
"service",
".",
"Two",
"parameters",
"are",
... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/FedoraClient.java#L808-L820 |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/NDCG.java | NDCG.computeDCG | protected double computeDCG(final double rel, final int rank) {
double dcg = 0.0;
if (rel >= getRelevanceThreshold()) {
switch (type) {
default:
case EXP:
dcg = (Math.pow(2.0, rel) - 1.0) / (Math.log(rank + 1) / Math.log(2));
break;
case LIN:
dcg = rel;
if (rank > 1) {
dcg /= (Math.log(rank) / Math.log(2));
}
break;
case TREC_EVAL:
dcg = rel / (Math.log(rank + 1) / Math.log(2));
break;
}
}
return dcg;
} | java | protected double computeDCG(final double rel, final int rank) {
double dcg = 0.0;
if (rel >= getRelevanceThreshold()) {
switch (type) {
default:
case EXP:
dcg = (Math.pow(2.0, rel) - 1.0) / (Math.log(rank + 1) / Math.log(2));
break;
case LIN:
dcg = rel;
if (rank > 1) {
dcg /= (Math.log(rank) / Math.log(2));
}
break;
case TREC_EVAL:
dcg = rel / (Math.log(rank + 1) / Math.log(2));
break;
}
}
return dcg;
} | [
"protected",
"double",
"computeDCG",
"(",
"final",
"double",
"rel",
",",
"final",
"int",
"rank",
")",
"{",
"double",
"dcg",
"=",
"0.0",
";",
"if",
"(",
"rel",
">=",
"getRelevanceThreshold",
"(",
")",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"default"... | Method that computes the discounted cumulative gain of a specific item,
taking into account its ranking in a user's list and its relevance value.
@param rel the item's relevance
@param rank the item's rank in a user's list (sorted by predicted rating)
@return the dcg of the item | [
"Method",
"that",
"computes",
"the",
"discounted",
"cumulative",
"gain",
"of",
"a",
"specific",
"item",
"taking",
"into",
"account",
"its",
"ranking",
"in",
"a",
"user",
"s",
"list",
"and",
"its",
"relevance",
"value",
"."
] | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/NDCG.java#L178-L198 |
orbisgis/h2gis | postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java | JtsBinaryParser.parsePoint | private Point parsePoint(ValueGetter data, boolean haveZ, boolean haveM) {
double X = data.getDouble();
double Y = data.getDouble();
Point result;
if (haveZ) {
double Z = data.getDouble();
result = JtsGeometry.geofac.createPoint(new Coordinate(X, Y, Z));
} else {
result = JtsGeometry.geofac.createPoint(new Coordinate(X, Y));
}
if (haveM) {
data.getDouble();
}
return result;
} | java | private Point parsePoint(ValueGetter data, boolean haveZ, boolean haveM) {
double X = data.getDouble();
double Y = data.getDouble();
Point result;
if (haveZ) {
double Z = data.getDouble();
result = JtsGeometry.geofac.createPoint(new Coordinate(X, Y, Z));
} else {
result = JtsGeometry.geofac.createPoint(new Coordinate(X, Y));
}
if (haveM) {
data.getDouble();
}
return result;
} | [
"private",
"Point",
"parsePoint",
"(",
"ValueGetter",
"data",
",",
"boolean",
"haveZ",
",",
"boolean",
"haveM",
")",
"{",
"double",
"X",
"=",
"data",
".",
"getDouble",
"(",
")",
";",
"double",
"Y",
"=",
"data",
".",
"getDouble",
"(",
")",
";",
"Point",... | Parse the given {@link org.postgis.binary.ValueGetter} into a JTS {@link org.locationtech.jts.geom.Point}.
@param data {@link org.postgis.binary.ValueGetter} to parse.
@param haveZ True if the {@link org.locationtech.jts.geom.Point} has a Z component.
@param haveM True if the {@link org.locationtech.jts.geom.Point} has a M component.
@return The parsed {@link org.locationtech.jts.geom.Point}. | [
"Parse",
"the",
"given",
"{",
"@link",
"org",
".",
"postgis",
".",
"binary",
".",
"ValueGetter",
"}",
"into",
"a",
"JTS",
"{",
"@link",
"org",
".",
"locationtech",
".",
"jts",
".",
"geom",
".",
"Point",
"}",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java#L167-L183 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.telephony_billingAccount_numberNogeographic_POST | public OvhOrder telephony_billingAccount_numberNogeographic_POST(String billingAccount, String ape, String city, OvhNumberCountryEnum country, Boolean displayUniversalDirectory, String email, String firstname, OvhLegalFormEnum legalform, String name, OvhNumberOffer offer, String organisation, String phone, OvhNumberPoolEnum pool, Boolean retractation, String siret, String socialNomination, String specificNumber, String streetName, String streetNumber, String zip) throws IOException {
String qPath = "/order/telephony/{billingAccount}/numberNogeographic";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ape", ape);
addBody(o, "city", city);
addBody(o, "country", country);
addBody(o, "displayUniversalDirectory", displayUniversalDirectory);
addBody(o, "email", email);
addBody(o, "firstname", firstname);
addBody(o, "legalform", legalform);
addBody(o, "name", name);
addBody(o, "offer", offer);
addBody(o, "organisation", organisation);
addBody(o, "phone", phone);
addBody(o, "pool", pool);
addBody(o, "retractation", retractation);
addBody(o, "siret", siret);
addBody(o, "socialNomination", socialNomination);
addBody(o, "specificNumber", specificNumber);
addBody(o, "streetName", streetName);
addBody(o, "streetNumber", streetNumber);
addBody(o, "zip", zip);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder telephony_billingAccount_numberNogeographic_POST(String billingAccount, String ape, String city, OvhNumberCountryEnum country, Boolean displayUniversalDirectory, String email, String firstname, OvhLegalFormEnum legalform, String name, OvhNumberOffer offer, String organisation, String phone, OvhNumberPoolEnum pool, Boolean retractation, String siret, String socialNomination, String specificNumber, String streetName, String streetNumber, String zip) throws IOException {
String qPath = "/order/telephony/{billingAccount}/numberNogeographic";
StringBuilder sb = path(qPath, billingAccount);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ape", ape);
addBody(o, "city", city);
addBody(o, "country", country);
addBody(o, "displayUniversalDirectory", displayUniversalDirectory);
addBody(o, "email", email);
addBody(o, "firstname", firstname);
addBody(o, "legalform", legalform);
addBody(o, "name", name);
addBody(o, "offer", offer);
addBody(o, "organisation", organisation);
addBody(o, "phone", phone);
addBody(o, "pool", pool);
addBody(o, "retractation", retractation);
addBody(o, "siret", siret);
addBody(o, "socialNomination", socialNomination);
addBody(o, "specificNumber", specificNumber);
addBody(o, "streetName", streetName);
addBody(o, "streetNumber", streetNumber);
addBody(o, "zip", zip);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"telephony_billingAccount_numberNogeographic_POST",
"(",
"String",
"billingAccount",
",",
"String",
"ape",
",",
"String",
"city",
",",
"OvhNumberCountryEnum",
"country",
",",
"Boolean",
"displayUniversalDirectory",
",",
"String",
"email",
",",
"Strin... | Create order
REST: POST /order/telephony/{billingAccount}/numberNogeographic
@param firstname [required] Contact firstname
@param streetName [required] Street name
@param email [required]
@param organisation [required] Contact organisation
@param pool [required] Number of alias in case of pool
@param socialNomination [required] Company social nomination
@param zip [required] Contact zip
@param name [required] Contact name
@param country [required] Number country
@param retractation [required] Retractation rights if set
@param displayUniversalDirectory [required] Publish contact informations on universal directories
@param siret [required] Companu siret
@param phone [required] Contact phone
@param specificNumber [required] Preselected standard number
@param streetNumber [required] Street number
@param legalform [required] Legal form
@param offer [required] Number offer
@param city [required] Contact city
@param ape [required] Company ape
@param billingAccount [required] The name of your billingAccount | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6291-L6316 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/application/impl/ProcessApplicationScriptEnvironment.java | ProcessApplicationScriptEnvironment.getScriptEngineForName | public ScriptEngine getScriptEngineForName(String scriptEngineName, boolean cache) {
if(processApplicationScriptEngineResolver == null) {
synchronized (this) {
if(processApplicationScriptEngineResolver == null) {
processApplicationScriptEngineResolver = new ScriptEngineResolver(new ScriptEngineManager(getProcessApplicationClassloader()));
}
}
}
return processApplicationScriptEngineResolver.getScriptEngine(scriptEngineName, cache);
} | java | public ScriptEngine getScriptEngineForName(String scriptEngineName, boolean cache) {
if(processApplicationScriptEngineResolver == null) {
synchronized (this) {
if(processApplicationScriptEngineResolver == null) {
processApplicationScriptEngineResolver = new ScriptEngineResolver(new ScriptEngineManager(getProcessApplicationClassloader()));
}
}
}
return processApplicationScriptEngineResolver.getScriptEngine(scriptEngineName, cache);
} | [
"public",
"ScriptEngine",
"getScriptEngineForName",
"(",
"String",
"scriptEngineName",
",",
"boolean",
"cache",
")",
"{",
"if",
"(",
"processApplicationScriptEngineResolver",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"processApplicati... | <p>Returns an instance of {@link ScriptEngine} for the given <code>scriptEngineName</code>.</p>
<p>Iff the given parameter <code>cache</code> is set <code>true</code>,
then the instance {@link ScriptEngine} will be cached.</p>
@param scriptEngineName the name of the {@link ScriptEngine} to return
@param cache a boolean value which indicates whether the {@link ScriptEngine} should
be cached or not.
@return a {@link ScriptEngine} | [
"<p",
">",
"Returns",
"an",
"instance",
"of",
"{",
"@link",
"ScriptEngine",
"}",
"for",
"the",
"given",
"<code",
">",
"scriptEngineName<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/application/impl/ProcessApplicationScriptEnvironment.java#L57-L66 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java | TmdbMovies.getMovieAccountState | public MediaState getMovieAccountState(int movieId, String sessionId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.SESSION_ID, sessionId);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, MediaState.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex);
}
} | java | public MediaState getMovieAccountState(int movieId, String sessionId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
parameters.add(Param.SESSION_ID, sessionId);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, MediaState.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex);
}
} | [
"public",
"MediaState",
"getMovieAccountState",
"(",
"int",
"movieId",
",",
"String",
"sessionId",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"... | This method lets a user get the status of whether or not the movie has been rated or added to their favourite or movie watch
list.
A valid session id is required.
@param movieId
@param sessionId
@return
@throws MovieDbException | [
"This",
"method",
"lets",
"a",
"user",
"get",
"the",
"status",
"of",
"whether",
"or",
"not",
"the",
"movie",
"has",
"been",
"rated",
"or",
"added",
"to",
"their",
"favourite",
"or",
"movie",
"watch",
"list",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L153-L166 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDs.java | LocaleIDs.findIndex | private static int findIndex(String[] array, String target){
for (int i = 0; i < array.length; i++) {
if (target.equals(array[i])) {
return i;
}
}
return -1;
} | java | private static int findIndex(String[] array, String target){
for (int i = 0; i < array.length; i++) {
if (target.equals(array[i])) {
return i;
}
}
return -1;
} | [
"private",
"static",
"int",
"findIndex",
"(",
"String",
"[",
"]",
"array",
",",
"String",
"target",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"target",
".",
"equals",
... | linear search of the string array. the arrays are unfortunately ordered by the
two-letter target code, not the three-letter search code, which seems backwards. | [
"linear",
"search",
"of",
"the",
"string",
"array",
".",
"the",
"arrays",
"are",
"unfortunately",
"ordered",
"by",
"the",
"two",
"-",
"letter",
"target",
"code",
"not",
"the",
"three",
"-",
"letter",
"search",
"code",
"which",
"seems",
"backwards",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDs.java#L122-L129 |
vkostyukov/la4j | src/main/java/org/la4j/matrix/SparseMatrix.java | SparseMatrix.foldNonZeroInRow | public double foldNonZeroInRow(int i, VectorAccumulator accumulator) {
eachNonZeroInRow(i, Vectors.asAccumulatorProcedure(accumulator));
return accumulator.accumulate();
} | java | public double foldNonZeroInRow(int i, VectorAccumulator accumulator) {
eachNonZeroInRow(i, Vectors.asAccumulatorProcedure(accumulator));
return accumulator.accumulate();
} | [
"public",
"double",
"foldNonZeroInRow",
"(",
"int",
"i",
",",
"VectorAccumulator",
"accumulator",
")",
"{",
"eachNonZeroInRow",
"(",
"i",
",",
"Vectors",
".",
"asAccumulatorProcedure",
"(",
"accumulator",
")",
")",
";",
"return",
"accumulator",
".",
"accumulate",
... | Folds non-zero elements of the specified row in this matrix with the given {@code accumulator}.
@param i the row index.
@param accumulator the {@link VectorAccumulator}.
@return the accumulated value. | [
"Folds",
"non",
"-",
"zero",
"elements",
"of",
"the",
"specified",
"row",
"in",
"this",
"matrix",
"with",
"the",
"given",
"{",
"@code",
"accumulator",
"}",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/SparseMatrix.java#L353-L356 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/ArrayLabelSetterFactory.java | ArrayLabelSetterFactory.createMethod | private Optional<ArrayLabelSetter> createMethod(final Class<?> beanClass, final String fieldName) {
final String labelMethodName = "set" + Utils.capitalize(fieldName) + "Label";
try {
final Method method = beanClass.getDeclaredMethod(labelMethodName, Integer.TYPE, String.class);
method.setAccessible(true);
return Optional.of(new ArrayLabelSetter() {
@Override
public void set(final Object beanObj, final String label, final int index) {
ArgUtils.notNull(beanObj, "beanObj");
ArgUtils.notEmpty(label, "label");
try {
method.invoke(beanObj, index, label);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new RuntimeException("fail access label field.", e);
}
}
});
} catch (NoSuchMethodException | SecurityException e) {
}
return Optional.empty();
} | java | private Optional<ArrayLabelSetter> createMethod(final Class<?> beanClass, final String fieldName) {
final String labelMethodName = "set" + Utils.capitalize(fieldName) + "Label";
try {
final Method method = beanClass.getDeclaredMethod(labelMethodName, Integer.TYPE, String.class);
method.setAccessible(true);
return Optional.of(new ArrayLabelSetter() {
@Override
public void set(final Object beanObj, final String label, final int index) {
ArgUtils.notNull(beanObj, "beanObj");
ArgUtils.notEmpty(label, "label");
try {
method.invoke(beanObj, index, label);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new RuntimeException("fail access label field.", e);
}
}
});
} catch (NoSuchMethodException | SecurityException e) {
}
return Optional.empty();
} | [
"private",
"Optional",
"<",
"ArrayLabelSetter",
">",
"createMethod",
"(",
"final",
"Class",
"<",
"?",
">",
"beanClass",
",",
"final",
"String",
"fieldName",
")",
"{",
"final",
"String",
"labelMethodName",
"=",
"\"set\"",
"+",
"Utils",
".",
"capitalize",
"(",
... | setterメソッドによるラベル情報を格納する場合。
<p>{@code set + <フィールド名> + Labels}のメソッド名</p>
@param beanClass フィールドが定義してあるクラスのインスタンス
@param fieldName フィールド名
@return ラベル情報の設定用クラス | [
"setterメソッドによるラベル情報を格納する場合。",
"<p",
">",
"{",
"@code",
"set",
"+",
"<フィールド名",
">",
"+",
"Labels",
"}",
"のメソッド名<",
"/",
"p",
">"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/ArrayLabelSetterFactory.java#L139-L171 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.beginCreateOrUpdateAsync | public Observable<DataBoxEdgeDeviceInner> beginCreateOrUpdateAsync(String deviceName, String resourceGroupName, DataBoxEdgeDeviceInner dataBoxEdgeDevice) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, dataBoxEdgeDevice).map(new Func1<ServiceResponse<DataBoxEdgeDeviceInner>, DataBoxEdgeDeviceInner>() {
@Override
public DataBoxEdgeDeviceInner call(ServiceResponse<DataBoxEdgeDeviceInner> response) {
return response.body();
}
});
} | java | public Observable<DataBoxEdgeDeviceInner> beginCreateOrUpdateAsync(String deviceName, String resourceGroupName, DataBoxEdgeDeviceInner dataBoxEdgeDevice) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, dataBoxEdgeDevice).map(new Func1<ServiceResponse<DataBoxEdgeDeviceInner>, DataBoxEdgeDeviceInner>() {
@Override
public DataBoxEdgeDeviceInner call(ServiceResponse<DataBoxEdgeDeviceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataBoxEdgeDeviceInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
",",
"DataBoxEdgeDeviceInner",
"dataBoxEdgeDevice",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
... | Creates or updates a Data Box Edge/Gateway resource.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@param dataBoxEdgeDevice The resource object.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataBoxEdgeDeviceInner object | [
"Creates",
"or",
"updates",
"a",
"Data",
"Box",
"Edge",
"/",
"Gateway",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L807-L814 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/DBFDriverFunction.java | DBFDriverFunction.getSQLColumnTypes | public static String getSQLColumnTypes(DbaseFileHeader header, boolean isH2Database) throws IOException {
StringBuilder stringBuilder = new StringBuilder();
for(int idColumn = 0; idColumn < header.getNumFields(); idColumn++) {
if(idColumn > 0) {
stringBuilder.append(", ");
}
String fieldName = TableLocation.capsIdentifier(header.getFieldName(idColumn), isH2Database);
stringBuilder.append(TableLocation.quoteIdentifier(fieldName,isH2Database));
stringBuilder.append(" ");
switch (header.getFieldType(idColumn)) {
// (L)logical (T,t,F,f,Y,y,N,n)
case 'l':
case 'L':
stringBuilder.append("BOOLEAN");
break;
// (C)character (String)
case 'c':
case 'C':
stringBuilder.append("VARCHAR(");
// Append size
int length = header.getFieldLength(idColumn);
stringBuilder.append(String.valueOf(length));
stringBuilder.append(")");
break;
// (D)date (Date)
case 'd':
case 'D':
stringBuilder.append("DATE");
break;
// (F)floating (Double)
case 'n':
case 'N':
if ((header.getFieldDecimalCount(idColumn) == 0)) {
if ((header.getFieldLength(idColumn) >= 0)
&& (header.getFieldLength(idColumn) < 10)) {
stringBuilder.append("INT4");
} else {
stringBuilder.append("INT8");
}
} else {
stringBuilder.append("FLOAT8");
}
break;
case 'f':
case 'F': // floating point number
case 'o':
case 'O': // floating point number
stringBuilder.append("FLOAT8");
break;
default:
throw new IOException("Unknown DBF field type " + header.getFieldType(idColumn));
}
}
return stringBuilder.toString();
} | java | public static String getSQLColumnTypes(DbaseFileHeader header, boolean isH2Database) throws IOException {
StringBuilder stringBuilder = new StringBuilder();
for(int idColumn = 0; idColumn < header.getNumFields(); idColumn++) {
if(idColumn > 0) {
stringBuilder.append(", ");
}
String fieldName = TableLocation.capsIdentifier(header.getFieldName(idColumn), isH2Database);
stringBuilder.append(TableLocation.quoteIdentifier(fieldName,isH2Database));
stringBuilder.append(" ");
switch (header.getFieldType(idColumn)) {
// (L)logical (T,t,F,f,Y,y,N,n)
case 'l':
case 'L':
stringBuilder.append("BOOLEAN");
break;
// (C)character (String)
case 'c':
case 'C':
stringBuilder.append("VARCHAR(");
// Append size
int length = header.getFieldLength(idColumn);
stringBuilder.append(String.valueOf(length));
stringBuilder.append(")");
break;
// (D)date (Date)
case 'd':
case 'D':
stringBuilder.append("DATE");
break;
// (F)floating (Double)
case 'n':
case 'N':
if ((header.getFieldDecimalCount(idColumn) == 0)) {
if ((header.getFieldLength(idColumn) >= 0)
&& (header.getFieldLength(idColumn) < 10)) {
stringBuilder.append("INT4");
} else {
stringBuilder.append("INT8");
}
} else {
stringBuilder.append("FLOAT8");
}
break;
case 'f':
case 'F': // floating point number
case 'o':
case 'O': // floating point number
stringBuilder.append("FLOAT8");
break;
default:
throw new IOException("Unknown DBF field type " + header.getFieldType(idColumn));
}
}
return stringBuilder.toString();
} | [
"public",
"static",
"String",
"getSQLColumnTypes",
"(",
"DbaseFileHeader",
"header",
",",
"boolean",
"isH2Database",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"idColumn",
"="... | Return SQL Columns declaration
@param header DBAse file header
@param isH2Database true if H2 database
@return Array of columns ex: ["id INTEGER", "len DOUBLE"]
@throws IOException | [
"Return",
"SQL",
"Columns",
"declaration"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/dbf/DBFDriverFunction.java#L304-L358 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getAttributeClass | @Pure
public static Class<?> getAttributeClass(Node document, boolean caseSensitive, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeClassWithDefault(document, caseSensitive, null, path);
} | java | @Pure
public static Class<?> getAttributeClass(Node document, boolean caseSensitive, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeClassWithDefault(document, caseSensitive, null, path);
} | [
"@",
"Pure",
"public",
"static",
"Class",
"<",
"?",
">",
"getAttributeClass",
"(",
"Node",
"document",
",",
"boolean",
"caseSensitive",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
... | Read an enumeration value.
@param document is the XML document to explore.
@param caseSensitive indicates of the {@code path}'s components are case sensitive.
@param path is the list of and ended by the attribute's name.
@return the java class or <code>null</code> if none. | [
"Read",
"an",
"enumeration",
"value",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L356-L360 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentsInner.java | DatabaseVulnerabilityAssessmentsInner.createOrUpdateAsync | public Observable<DatabaseVulnerabilityAssessmentInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseVulnerabilityAssessmentInner>, DatabaseVulnerabilityAssessmentInner>() {
@Override
public DatabaseVulnerabilityAssessmentInner call(ServiceResponse<DatabaseVulnerabilityAssessmentInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseVulnerabilityAssessmentInner> createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseVulnerabilityAssessmentInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseVulnerabilityAssessmentInner>, DatabaseVulnerabilityAssessmentInner>() {
@Override
public DatabaseVulnerabilityAssessmentInner call(ServiceResponse<DatabaseVulnerabilityAssessmentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseVulnerabilityAssessmentInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"DatabaseVulnerabilityAssessmentInner",
"parameters",
")",
"{",
"return",
"c... | Creates or updates the database's vulnerability assessment.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database for which the vulnerability assessment is defined.
@param parameters The requested resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseVulnerabilityAssessmentInner object | [
"Creates",
"or",
"updates",
"the",
"database",
"s",
"vulnerability",
"assessment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentsInner.java#L221-L228 |
google/truth | core/src/main/java/com/google/common/truth/Truth.java | Truth.assertWithMessage | public static StandardSubjectBuilder assertWithMessage(String format, Object... args) {
return assert_().withMessage(format, args);
} | java | public static StandardSubjectBuilder assertWithMessage(String format, Object... args) {
return assert_().withMessage(format, args);
} | [
"public",
"static",
"StandardSubjectBuilder",
"assertWithMessage",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"assert_",
"(",
")",
".",
"withMessage",
"(",
"format",
",",
"args",
")",
";",
"}"
] | Returns a {@link StandardSubjectBuilder} that will prepend the formatted message using the
specified arguments to the failure message in the event of a test failure.
<p><b>Note:</b> the arguments will be substituted into the format template using {@link
com.google.common.base.Strings#lenientFormat Strings.lenientFormat}. Note this only supports
the {@code %s} specifier.
@throws IllegalArgumentException if the number of placeholders in the format string does not
equal the number of given arguments | [
"Returns",
"a",
"{",
"@link",
"StandardSubjectBuilder",
"}",
"that",
"will",
"prepend",
"the",
"formatted",
"message",
"using",
"the",
"specified",
"arguments",
"to",
"the",
"failure",
"message",
"in",
"the",
"event",
"of",
"a",
"test",
"failure",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/Truth.java#L118-L120 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java | FastDateFormat.getDateInstance | public static FastDateFormat getDateInstance(final int style, final Locale locale) {
return cache.getDateInstance(style, null, locale);
} | java | public static FastDateFormat getDateInstance(final int style, final Locale locale) {
return cache.getDateInstance(style, null, locale);
} | [
"public",
"static",
"FastDateFormat",
"getDateInstance",
"(",
"final",
"int",
"style",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"cache",
".",
"getDateInstance",
"(",
"style",
",",
"null",
",",
"locale",
")",
";",
"}"
] | 获得 {@link FastDateFormat} 实例<br>
支持缓存
@param style date style: FULL, LONG, MEDIUM, or SHORT
@param locale {@link Locale} 日期地理位置
@return 本地化 {@link FastDateFormat} | [
"获得",
"{",
"@link",
"FastDateFormat",
"}",
"实例<br",
">",
"支持缓存"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L133-L135 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.