repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/util/MirrorTable.java | MirrorTable.setHandle | public FieldList setHandle(Object bookmark, int iHandleType) throws DBException {
"""
Reposition to this record Using this bookmark.
@exception DBException File exception.
"""
FieldList record = super.setHandle(bookmark, iHandleType);
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
this.syncTables(table, this.getRecord());
}
return record;
} | java | public FieldList setHandle(Object bookmark, int iHandleType) throws DBException
{
FieldList record = super.setHandle(bookmark, iHandleType);
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
this.syncTables(table, this.getRecord());
}
return record;
} | [
"public",
"FieldList",
"setHandle",
"(",
"Object",
"bookmark",
",",
"int",
"iHandleType",
")",
"throws",
"DBException",
"{",
"FieldList",
"record",
"=",
"super",
".",
"setHandle",
"(",
"bookmark",
",",
"iHandleType",
")",
";",
"Iterator",
"<",
"BaseTable",
">",
"iterator",
"=",
"this",
".",
"getTables",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"BaseTable",
"table",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"(",
"table",
"!=",
"null",
")",
"&&",
"(",
"table",
"!=",
"this",
".",
"getNextTable",
"(",
")",
")",
")",
"this",
".",
"syncTables",
"(",
"table",
",",
"this",
".",
"getRecord",
"(",
")",
")",
";",
"}",
"return",
"record",
";",
"}"
]
| Reposition to this record Using this bookmark.
@exception DBException File exception. | [
"Reposition",
"to",
"this",
"record",
"Using",
"this",
"bookmark",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/MirrorTable.java#L295-L306 |
akarnokd/akarnokd-xml | src/main/java/hu/akarnokd/xml/XNElement.java | XNElement.getLong | public long getLong(String attribute, String namespace, long defaultValue) {
"""
Retrieve an integer attribute or the default value if not exists.
@param attribute the attribute name
@param namespace the attribute namespace URI
@param defaultValue the default value to return
@return the value
"""
String value = get(attribute, namespace);
if (value == null) {
return defaultValue;
}
return Long.parseLong(value);
} | java | public long getLong(String attribute, String namespace, long defaultValue) {
String value = get(attribute, namespace);
if (value == null) {
return defaultValue;
}
return Long.parseLong(value);
} | [
"public",
"long",
"getLong",
"(",
"String",
"attribute",
",",
"String",
"namespace",
",",
"long",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"attribute",
",",
"namespace",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"return",
"Long",
".",
"parseLong",
"(",
"value",
")",
";",
"}"
]
| Retrieve an integer attribute or the default value if not exists.
@param attribute the attribute name
@param namespace the attribute namespace URI
@param defaultValue the default value to return
@return the value | [
"Retrieve",
"an",
"integer",
"attribute",
"or",
"the",
"default",
"value",
"if",
"not",
"exists",
"."
]
| train | https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L882-L888 |
knightliao/disconf | disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/mapper/GenericMapper.java | GenericMapper.getSetters | private List<Setter> getSetters(ResultSetMetaData meta) throws SQLException {
"""
@param meta
@param genericMapper2
@return 下午3:45:38 created by Darwin(Tianxin)
@throws SQLException
"""
int columnCount = meta.getColumnCount();
List<Setter> setters = new ArrayList<Setter>(columnCount);
for (int i = 1; i <= columnCount; i++) {
String column = meta.getColumnName(i);
Method setMethod = orMapping.getSetter(column);
if (setMethod != null) {
Setter setter = new Setter(setMethod, column, setMethod.getParameterTypes()[0]);
setters.add(setter);
}
}
return setters;
} | java | private List<Setter> getSetters(ResultSetMetaData meta) throws SQLException {
int columnCount = meta.getColumnCount();
List<Setter> setters = new ArrayList<Setter>(columnCount);
for (int i = 1; i <= columnCount; i++) {
String column = meta.getColumnName(i);
Method setMethod = orMapping.getSetter(column);
if (setMethod != null) {
Setter setter = new Setter(setMethod, column, setMethod.getParameterTypes()[0]);
setters.add(setter);
}
}
return setters;
} | [
"private",
"List",
"<",
"Setter",
">",
"getSetters",
"(",
"ResultSetMetaData",
"meta",
")",
"throws",
"SQLException",
"{",
"int",
"columnCount",
"=",
"meta",
".",
"getColumnCount",
"(",
")",
";",
"List",
"<",
"Setter",
">",
"setters",
"=",
"new",
"ArrayList",
"<",
"Setter",
">",
"(",
"columnCount",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"columnCount",
";",
"i",
"++",
")",
"{",
"String",
"column",
"=",
"meta",
".",
"getColumnName",
"(",
"i",
")",
";",
"Method",
"setMethod",
"=",
"orMapping",
".",
"getSetter",
"(",
"column",
")",
";",
"if",
"(",
"setMethod",
"!=",
"null",
")",
"{",
"Setter",
"setter",
"=",
"new",
"Setter",
"(",
"setMethod",
",",
"column",
",",
"setMethod",
".",
"getParameterTypes",
"(",
")",
"[",
"0",
"]",
")",
";",
"setters",
".",
"add",
"(",
"setter",
")",
";",
"}",
"}",
"return",
"setters",
";",
"}"
]
| @param meta
@param genericMapper2
@return 下午3:45:38 created by Darwin(Tianxin)
@throws SQLException | [
"@param",
"meta",
"@param",
"genericMapper2"
]
| train | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/mapper/GenericMapper.java#L102-L116 |
Netflix/astyanax | astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java | ShardedDistributedMessageQueue.hasMessages | private boolean hasMessages(String shardName) throws MessageQueueException {
"""
Fast check to see if a shard has messages to process
@param shardName
@throws MessageQueueException
"""
UUID currentTime = TimeUUIDUtils.getUniqueTimeUUIDinMicros();
try {
ColumnList<MessageQueueEntry> result = keyspace.prepareQuery(queueColumnFamily)
.setConsistencyLevel(consistencyLevel)
.getKey(shardName)
.withColumnRange(new RangeBuilder()
.setLimit(1) // Read extra messages because of the lock column
.setStart(entrySerializer
.makeEndpoint((byte)MessageQueueEntryType.Message.ordinal(), Equality.EQUAL)
.toBytes()
)
.setEnd(entrySerializer
.makeEndpoint((byte)MessageQueueEntryType.Message.ordinal(), Equality.EQUAL)
.append((byte)0, Equality.EQUAL)
.append(currentTime, Equality.LESS_THAN_EQUALS)
.toBytes()
)
.build())
.execute()
.getResult();
return !result.isEmpty();
} catch (ConnectionException e) {
throw new MessageQueueException("Error checking shard for messages. " + shardName, e);
}
} | java | private boolean hasMessages(String shardName) throws MessageQueueException {
UUID currentTime = TimeUUIDUtils.getUniqueTimeUUIDinMicros();
try {
ColumnList<MessageQueueEntry> result = keyspace.prepareQuery(queueColumnFamily)
.setConsistencyLevel(consistencyLevel)
.getKey(shardName)
.withColumnRange(new RangeBuilder()
.setLimit(1) // Read extra messages because of the lock column
.setStart(entrySerializer
.makeEndpoint((byte)MessageQueueEntryType.Message.ordinal(), Equality.EQUAL)
.toBytes()
)
.setEnd(entrySerializer
.makeEndpoint((byte)MessageQueueEntryType.Message.ordinal(), Equality.EQUAL)
.append((byte)0, Equality.EQUAL)
.append(currentTime, Equality.LESS_THAN_EQUALS)
.toBytes()
)
.build())
.execute()
.getResult();
return !result.isEmpty();
} catch (ConnectionException e) {
throw new MessageQueueException("Error checking shard for messages. " + shardName, e);
}
} | [
"private",
"boolean",
"hasMessages",
"(",
"String",
"shardName",
")",
"throws",
"MessageQueueException",
"{",
"UUID",
"currentTime",
"=",
"TimeUUIDUtils",
".",
"getUniqueTimeUUIDinMicros",
"(",
")",
";",
"try",
"{",
"ColumnList",
"<",
"MessageQueueEntry",
">",
"result",
"=",
"keyspace",
".",
"prepareQuery",
"(",
"queueColumnFamily",
")",
".",
"setConsistencyLevel",
"(",
"consistencyLevel",
")",
".",
"getKey",
"(",
"shardName",
")",
".",
"withColumnRange",
"(",
"new",
"RangeBuilder",
"(",
")",
".",
"setLimit",
"(",
"1",
")",
"// Read extra messages because of the lock column",
".",
"setStart",
"(",
"entrySerializer",
".",
"makeEndpoint",
"(",
"(",
"byte",
")",
"MessageQueueEntryType",
".",
"Message",
".",
"ordinal",
"(",
")",
",",
"Equality",
".",
"EQUAL",
")",
".",
"toBytes",
"(",
")",
")",
".",
"setEnd",
"(",
"entrySerializer",
".",
"makeEndpoint",
"(",
"(",
"byte",
")",
"MessageQueueEntryType",
".",
"Message",
".",
"ordinal",
"(",
")",
",",
"Equality",
".",
"EQUAL",
")",
".",
"append",
"(",
"(",
"byte",
")",
"0",
",",
"Equality",
".",
"EQUAL",
")",
".",
"append",
"(",
"currentTime",
",",
"Equality",
".",
"LESS_THAN_EQUALS",
")",
".",
"toBytes",
"(",
")",
")",
".",
"build",
"(",
")",
")",
".",
"execute",
"(",
")",
".",
"getResult",
"(",
")",
";",
"return",
"!",
"result",
".",
"isEmpty",
"(",
")",
";",
"}",
"catch",
"(",
"ConnectionException",
"e",
")",
"{",
"throw",
"new",
"MessageQueueException",
"(",
"\"Error checking shard for messages. \"",
"+",
"shardName",
",",
"e",
")",
";",
"}",
"}"
]
| Fast check to see if a shard has messages to process
@param shardName
@throws MessageQueueException | [
"Fast",
"check",
"to",
"see",
"if",
"a",
"shard",
"has",
"messages",
"to",
"process"
]
| train | https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-queue/src/main/java/com/netflix/astyanax/recipes/queue/ShardedDistributedMessageQueue.java#L1099-L1125 |
kiegroup/drools | kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java | CompiledFEELSemanticMappings.lt | public static Boolean lt(Object left, Object right) {
"""
FEEL spec Table 42 and derivations
Delegates to {@link EvalHelper} except evaluationcontext
"""
return EvalHelper.compare(left, right, null, (l, r) -> l.compareTo(r) < 0);
} | java | public static Boolean lt(Object left, Object right) {
return EvalHelper.compare(left, right, null, (l, r) -> l.compareTo(r) < 0);
} | [
"public",
"static",
"Boolean",
"lt",
"(",
"Object",
"left",
",",
"Object",
"right",
")",
"{",
"return",
"EvalHelper",
".",
"compare",
"(",
"left",
",",
"right",
",",
"null",
",",
"(",
"l",
",",
"r",
")",
"->",
"l",
".",
"compareTo",
"(",
"r",
")",
"<",
"0",
")",
";",
"}"
]
| FEEL spec Table 42 and derivations
Delegates to {@link EvalHelper} except evaluationcontext | [
"FEEL",
"spec",
"Table",
"42",
"and",
"derivations",
"Delegates",
"to",
"{"
]
| train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java#L348-L350 |
CloudSlang/score | worker/worker-execution/score-worker-execution-impl/src/main/java/io/cloudslang/worker/execution/services/ExecutionServiceImpl.java | ExecutionServiceImpl.handlePausedFlowAfterStep | private boolean handlePausedFlowAfterStep(Execution execution) throws InterruptedException {
"""
no need to check if paused - because this is called after the step, when the Pause flag exists in the context
"""
String branchId = execution.getSystemContext().getBranchId();
PauseReason reason = null;
ExecutionSummary execSummary = pauseService.readPausedExecution(execution.getExecutionId(), branchId);
if (execSummary != null && execSummary.getStatus().equals(ExecutionStatus.PENDING_PAUSE)) {
reason = execSummary.getPauseReason();
}
if (reason != null) { // need to pause the execution
pauseFlow(reason, execution);
return true;
}
return false;
} | java | private boolean handlePausedFlowAfterStep(Execution execution) throws InterruptedException {
String branchId = execution.getSystemContext().getBranchId();
PauseReason reason = null;
ExecutionSummary execSummary = pauseService.readPausedExecution(execution.getExecutionId(), branchId);
if (execSummary != null && execSummary.getStatus().equals(ExecutionStatus.PENDING_PAUSE)) {
reason = execSummary.getPauseReason();
}
if (reason != null) { // need to pause the execution
pauseFlow(reason, execution);
return true;
}
return false;
} | [
"private",
"boolean",
"handlePausedFlowAfterStep",
"(",
"Execution",
"execution",
")",
"throws",
"InterruptedException",
"{",
"String",
"branchId",
"=",
"execution",
".",
"getSystemContext",
"(",
")",
".",
"getBranchId",
"(",
")",
";",
"PauseReason",
"reason",
"=",
"null",
";",
"ExecutionSummary",
"execSummary",
"=",
"pauseService",
".",
"readPausedExecution",
"(",
"execution",
".",
"getExecutionId",
"(",
")",
",",
"branchId",
")",
";",
"if",
"(",
"execSummary",
"!=",
"null",
"&&",
"execSummary",
".",
"getStatus",
"(",
")",
".",
"equals",
"(",
"ExecutionStatus",
".",
"PENDING_PAUSE",
")",
")",
"{",
"reason",
"=",
"execSummary",
".",
"getPauseReason",
"(",
")",
";",
"}",
"if",
"(",
"reason",
"!=",
"null",
")",
"{",
"// need to pause the execution",
"pauseFlow",
"(",
"reason",
",",
"execution",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
]
| no need to check if paused - because this is called after the step, when the Pause flag exists in the context | [
"no",
"need",
"to",
"check",
"if",
"paused",
"-",
"because",
"this",
"is",
"called",
"after",
"the",
"step",
"when",
"the",
"Pause",
"flag",
"exists",
"in",
"the",
"context"
]
| train | https://github.com/CloudSlang/score/blob/796134e917843f4d95a90f7740d69dc5257a1a0e/worker/worker-execution/score-worker-execution-impl/src/main/java/io/cloudslang/worker/execution/services/ExecutionServiceImpl.java#L281-L293 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/Assembler.java | Assembler.if_tcmpeq | public void if_tcmpeq(TypeMirror type, String target) throws IOException {
"""
eq succeeds if and only if value1 == value2
<p>Stack: ..., value1, value2 => ...
@param type
@param target
@throws IOException
"""
pushType(type);
if_tcmpeq(target);
popType();
} | java | public void if_tcmpeq(TypeMirror type, String target) throws IOException
{
pushType(type);
if_tcmpeq(target);
popType();
} | [
"public",
"void",
"if_tcmpeq",
"(",
"TypeMirror",
"type",
",",
"String",
"target",
")",
"throws",
"IOException",
"{",
"pushType",
"(",
"type",
")",
";",
"if_tcmpeq",
"(",
"target",
")",
";",
"popType",
"(",
")",
";",
"}"
]
| eq succeeds if and only if value1 == value2
<p>Stack: ..., value1, value2 => ...
@param type
@param target
@throws IOException | [
"eq",
"succeeds",
"if",
"and",
"only",
"if",
"value1",
"==",
"value2",
"<p",
">",
"Stack",
":",
"...",
"value1",
"value2",
"=",
">",
";",
"..."
]
| train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/Assembler.java#L676-L681 |
brettwooldridge/HikariCP | src/main/java/com/zaxxer/hikari/pool/HikariPool.java | HikariPool.setMetricRegistry | public void setMetricRegistry(Object metricRegistry) {
"""
Set a metrics registry to be used when registering metrics collectors. The HikariDataSource prevents this
method from being called more than once.
@param metricRegistry the metrics registry instance to use
"""
if (metricRegistry != null && safeIsAssignableFrom(metricRegistry, "com.codahale.metrics.MetricRegistry")) {
setMetricsTrackerFactory(new CodahaleMetricsTrackerFactory((MetricRegistry) metricRegistry));
}
else if (metricRegistry != null && safeIsAssignableFrom(metricRegistry, "io.micrometer.core.instrument.MeterRegistry")) {
setMetricsTrackerFactory(new MicrometerMetricsTrackerFactory((MeterRegistry) metricRegistry));
}
else {
setMetricsTrackerFactory(null);
}
} | java | public void setMetricRegistry(Object metricRegistry)
{
if (metricRegistry != null && safeIsAssignableFrom(metricRegistry, "com.codahale.metrics.MetricRegistry")) {
setMetricsTrackerFactory(new CodahaleMetricsTrackerFactory((MetricRegistry) metricRegistry));
}
else if (metricRegistry != null && safeIsAssignableFrom(metricRegistry, "io.micrometer.core.instrument.MeterRegistry")) {
setMetricsTrackerFactory(new MicrometerMetricsTrackerFactory((MeterRegistry) metricRegistry));
}
else {
setMetricsTrackerFactory(null);
}
} | [
"public",
"void",
"setMetricRegistry",
"(",
"Object",
"metricRegistry",
")",
"{",
"if",
"(",
"metricRegistry",
"!=",
"null",
"&&",
"safeIsAssignableFrom",
"(",
"metricRegistry",
",",
"\"com.codahale.metrics.MetricRegistry\"",
")",
")",
"{",
"setMetricsTrackerFactory",
"(",
"new",
"CodahaleMetricsTrackerFactory",
"(",
"(",
"MetricRegistry",
")",
"metricRegistry",
")",
")",
";",
"}",
"else",
"if",
"(",
"metricRegistry",
"!=",
"null",
"&&",
"safeIsAssignableFrom",
"(",
"metricRegistry",
",",
"\"io.micrometer.core.instrument.MeterRegistry\"",
")",
")",
"{",
"setMetricsTrackerFactory",
"(",
"new",
"MicrometerMetricsTrackerFactory",
"(",
"(",
"MeterRegistry",
")",
"metricRegistry",
")",
")",
";",
"}",
"else",
"{",
"setMetricsTrackerFactory",
"(",
"null",
")",
";",
"}",
"}"
]
| Set a metrics registry to be used when registering metrics collectors. The HikariDataSource prevents this
method from being called more than once.
@param metricRegistry the metrics registry instance to use | [
"Set",
"a",
"metrics",
"registry",
"to",
"be",
"used",
"when",
"registering",
"metrics",
"collectors",
".",
"The",
"HikariDataSource",
"prevents",
"this",
"method",
"from",
"being",
"called",
"more",
"than",
"once",
"."
]
| train | https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L287-L298 |
kiegroup/droolsjbpm-integration | kie-server-parent/kie-server-remote/kie-server-jms/src/main/java/org/kie/server/jms/KieServerMDB.java | KieServerMDB.startConnectionAndSession | private JMSConnection startConnectionAndSession() {
"""
This method is used to initialize the JMS connection and
session. It is done in its own method so that if the
point at which it is done needs to be changed then
it can be done by just changing the invocation point.
"""
JMSConnection result = null;
Connection connection = null;
Session session = null;
try {
connection = factory.createConnection();
if ( connection != null ) {
session = connection.createSession( sessionTransacted, sessionAck );
result = new JMSConnection(connection,session);
if ( logger.isDebugEnabled() ) {
logger.debug( "KieServerMDB sessionTransacted={}, sessionAck={}",
sessionTransacted,
sessionAck);
}
}
} catch (JMSException jmse) {
String errMsg = "Unable to obtain connection/session";
logger.error( errMsg, jmse );
throw new JMSRuntimeException( errMsg, jmse );
} finally {
if (connection != null && session == null){
logger.error("KieServerMDB: Session creation failed - closing connection");
try {
connection.close();
} catch (JMSException jmse) {
String errMsg = "KieServerMDB: Error closing connection after failing to open session";
throw new JMSRuntimeException(errMsg, jmse);
}
}
}
return result;
} | java | private JMSConnection startConnectionAndSession() {
JMSConnection result = null;
Connection connection = null;
Session session = null;
try {
connection = factory.createConnection();
if ( connection != null ) {
session = connection.createSession( sessionTransacted, sessionAck );
result = new JMSConnection(connection,session);
if ( logger.isDebugEnabled() ) {
logger.debug( "KieServerMDB sessionTransacted={}, sessionAck={}",
sessionTransacted,
sessionAck);
}
}
} catch (JMSException jmse) {
String errMsg = "Unable to obtain connection/session";
logger.error( errMsg, jmse );
throw new JMSRuntimeException( errMsg, jmse );
} finally {
if (connection != null && session == null){
logger.error("KieServerMDB: Session creation failed - closing connection");
try {
connection.close();
} catch (JMSException jmse) {
String errMsg = "KieServerMDB: Error closing connection after failing to open session";
throw new JMSRuntimeException(errMsg, jmse);
}
}
}
return result;
} | [
"private",
"JMSConnection",
"startConnectionAndSession",
"(",
")",
"{",
"JMSConnection",
"result",
"=",
"null",
";",
"Connection",
"connection",
"=",
"null",
";",
"Session",
"session",
"=",
"null",
";",
"try",
"{",
"connection",
"=",
"factory",
".",
"createConnection",
"(",
")",
";",
"if",
"(",
"connection",
"!=",
"null",
")",
"{",
"session",
"=",
"connection",
".",
"createSession",
"(",
"sessionTransacted",
",",
"sessionAck",
")",
";",
"result",
"=",
"new",
"JMSConnection",
"(",
"connection",
",",
"session",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"KieServerMDB sessionTransacted={}, sessionAck={}\"",
",",
"sessionTransacted",
",",
"sessionAck",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"JMSException",
"jmse",
")",
"{",
"String",
"errMsg",
"=",
"\"Unable to obtain connection/session\"",
";",
"logger",
".",
"error",
"(",
"errMsg",
",",
"jmse",
")",
";",
"throw",
"new",
"JMSRuntimeException",
"(",
"errMsg",
",",
"jmse",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"connection",
"!=",
"null",
"&&",
"session",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"KieServerMDB: Session creation failed - closing connection\"",
")",
";",
"try",
"{",
"connection",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JMSException",
"jmse",
")",
"{",
"String",
"errMsg",
"=",
"\"KieServerMDB: Error closing connection after failing to open session\"",
";",
"throw",
"new",
"JMSRuntimeException",
"(",
"errMsg",
",",
"jmse",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
]
| This method is used to initialize the JMS connection and
session. It is done in its own method so that if the
point at which it is done needs to be changed then
it can be done by just changing the invocation point. | [
"This",
"method",
"is",
"used",
"to",
"initialize",
"the",
"JMS",
"connection",
"and",
"session",
".",
"It",
"is",
"done",
"in",
"its",
"own",
"method",
"so",
"that",
"if",
"the",
"point",
"at",
"which",
"it",
"is",
"done",
"needs",
"to",
"be",
"changed",
"then",
"it",
"can",
"be",
"done",
"by",
"just",
"changing",
"the",
"invocation",
"point",
"."
]
| train | https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-remote/kie-server-jms/src/main/java/org/kie/server/jms/KieServerMDB.java#L109-L140 |
alkacon/opencms-core | src/org/opencms/module/CmsModuleUpdater.java | CmsModuleUpdater.createAndSetModuleImportProject | protected CmsProject createAndSetModuleImportProject(CmsObject cms, CmsModule module) throws CmsException {
"""
Creates the project used to import module resources and sets it on the CmsObject.
@param cms the CmsObject to set the project on
@param module the module
@return the created project
@throws CmsException if something goes wrong
"""
CmsProject importProject = cms.createProject(
org.opencms.module.Messages.get().getBundle(cms.getRequestContext().getLocale()).key(
org.opencms.module.Messages.GUI_IMPORT_MODULE_PROJECT_NAME_1,
new Object[] {module.getName()}),
org.opencms.module.Messages.get().getBundle(cms.getRequestContext().getLocale()).key(
org.opencms.module.Messages.GUI_IMPORT_MODULE_PROJECT_DESC_1,
new Object[] {module.getName()}),
OpenCms.getDefaultUsers().getGroupAdministrators(),
OpenCms.getDefaultUsers().getGroupAdministrators(),
CmsProject.PROJECT_TYPE_TEMPORARY);
cms.getRequestContext().setCurrentProject(importProject);
cms.copyResourceToProject("/");
return importProject;
} | java | protected CmsProject createAndSetModuleImportProject(CmsObject cms, CmsModule module) throws CmsException {
CmsProject importProject = cms.createProject(
org.opencms.module.Messages.get().getBundle(cms.getRequestContext().getLocale()).key(
org.opencms.module.Messages.GUI_IMPORT_MODULE_PROJECT_NAME_1,
new Object[] {module.getName()}),
org.opencms.module.Messages.get().getBundle(cms.getRequestContext().getLocale()).key(
org.opencms.module.Messages.GUI_IMPORT_MODULE_PROJECT_DESC_1,
new Object[] {module.getName()}),
OpenCms.getDefaultUsers().getGroupAdministrators(),
OpenCms.getDefaultUsers().getGroupAdministrators(),
CmsProject.PROJECT_TYPE_TEMPORARY);
cms.getRequestContext().setCurrentProject(importProject);
cms.copyResourceToProject("/");
return importProject;
} | [
"protected",
"CmsProject",
"createAndSetModuleImportProject",
"(",
"CmsObject",
"cms",
",",
"CmsModule",
"module",
")",
"throws",
"CmsException",
"{",
"CmsProject",
"importProject",
"=",
"cms",
".",
"createProject",
"(",
"org",
".",
"opencms",
".",
"module",
".",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getLocale",
"(",
")",
")",
".",
"key",
"(",
"org",
".",
"opencms",
".",
"module",
".",
"Messages",
".",
"GUI_IMPORT_MODULE_PROJECT_NAME_1",
",",
"new",
"Object",
"[",
"]",
"{",
"module",
".",
"getName",
"(",
")",
"}",
")",
",",
"org",
".",
"opencms",
".",
"module",
".",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getLocale",
"(",
")",
")",
".",
"key",
"(",
"org",
".",
"opencms",
".",
"module",
".",
"Messages",
".",
"GUI_IMPORT_MODULE_PROJECT_DESC_1",
",",
"new",
"Object",
"[",
"]",
"{",
"module",
".",
"getName",
"(",
")",
"}",
")",
",",
"OpenCms",
".",
"getDefaultUsers",
"(",
")",
".",
"getGroupAdministrators",
"(",
")",
",",
"OpenCms",
".",
"getDefaultUsers",
"(",
")",
".",
"getGroupAdministrators",
"(",
")",
",",
"CmsProject",
".",
"PROJECT_TYPE_TEMPORARY",
")",
";",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setCurrentProject",
"(",
"importProject",
")",
";",
"cms",
".",
"copyResourceToProject",
"(",
"\"/\"",
")",
";",
"return",
"importProject",
";",
"}"
]
| Creates the project used to import module resources and sets it on the CmsObject.
@param cms the CmsObject to set the project on
@param module the module
@return the created project
@throws CmsException if something goes wrong | [
"Creates",
"the",
"project",
"used",
"to",
"import",
"module",
"resources",
"and",
"sets",
"it",
"on",
"the",
"CmsObject",
"."
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleUpdater.java#L398-L413 |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java | Scopes.scopeFor | public static IScope scopeFor(Iterable<? extends EObject> elements, IScope outer) {
"""
creates a scope using {@link SimpleAttributeResolver#NAME_RESOLVER} to compute the names
"""
return scopeFor(elements, QualifiedName.wrapper(SimpleAttributeResolver.NAME_RESOLVER), outer);
} | java | public static IScope scopeFor(Iterable<? extends EObject> elements, IScope outer) {
return scopeFor(elements, QualifiedName.wrapper(SimpleAttributeResolver.NAME_RESOLVER), outer);
} | [
"public",
"static",
"IScope",
"scopeFor",
"(",
"Iterable",
"<",
"?",
"extends",
"EObject",
">",
"elements",
",",
"IScope",
"outer",
")",
"{",
"return",
"scopeFor",
"(",
"elements",
",",
"QualifiedName",
".",
"wrapper",
"(",
"SimpleAttributeResolver",
".",
"NAME_RESOLVER",
")",
",",
"outer",
")",
";",
"}"
]
| creates a scope using {@link SimpleAttributeResolver#NAME_RESOLVER} to compute the names | [
"creates",
"a",
"scope",
"using",
"{"
]
| train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/scoping/Scopes.java#L61-L63 |
dhemery/hartley | src/main/java/com/dhemery/expressing/ImmediateExpressions.java | ImmediateExpressions.assertThat | public static <S> void assertThat(S subject, Feature<? super S,Boolean> feature) {
"""
Assert that a sample of the feature is {@code true}.
<p>Example:</p>
<pre>
{@code
Page settingsPage = ...;
Feature<Page,Boolean> displayed() { ... }
...
assertThat(settingsPage, is(displayed()));
}
"""
assertThat(subject, feature, isQuietlyTrue());
} | java | public static <S> void assertThat(S subject, Feature<? super S,Boolean> feature) {
assertThat(subject, feature, isQuietlyTrue());
} | [
"public",
"static",
"<",
"S",
">",
"void",
"assertThat",
"(",
"S",
"subject",
",",
"Feature",
"<",
"?",
"super",
"S",
",",
"Boolean",
">",
"feature",
")",
"{",
"assertThat",
"(",
"subject",
",",
"feature",
",",
"isQuietlyTrue",
"(",
")",
")",
";",
"}"
]
| Assert that a sample of the feature is {@code true}.
<p>Example:</p>
<pre>
{@code
Page settingsPage = ...;
Feature<Page,Boolean> displayed() { ... }
...
assertThat(settingsPage, is(displayed()));
} | [
"Assert",
"that",
"a",
"sample",
"of",
"the",
"feature",
"is",
"{",
"@code",
"true",
"}",
".",
"<p",
">",
"Example",
":",
"<",
"/",
"p",
">",
"<pre",
">",
"{",
"@code"
]
| train | https://github.com/dhemery/hartley/blob/7754bd6bc12695f2249601b8890da530a61fcf33/src/main/java/com/dhemery/expressing/ImmediateExpressions.java#L96-L98 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java | FeatureShapes.removeShapesNotWithinMap | public int removeShapesNotWithinMap(BoundingBox boundingBox, String database) {
"""
Remove all map shapes in the database that are not visible in the bounding box
@param boundingBox bounding box
@param database GeoPackage database
@return count of removed features
@since 3.2.0
"""
int count = 0;
Map<String, Map<Long, FeatureShape>> tables = getTables(database);
if (tables != null) {
for (String table : tables.keySet()) {
count += removeShapesNotWithinMap(boundingBox, database, table);
}
}
return count;
} | java | public int removeShapesNotWithinMap(BoundingBox boundingBox, String database) {
int count = 0;
Map<String, Map<Long, FeatureShape>> tables = getTables(database);
if (tables != null) {
for (String table : tables.keySet()) {
count += removeShapesNotWithinMap(boundingBox, database, table);
}
}
return count;
} | [
"public",
"int",
"removeShapesNotWithinMap",
"(",
"BoundingBox",
"boundingBox",
",",
"String",
"database",
")",
"{",
"int",
"count",
"=",
"0",
";",
"Map",
"<",
"String",
",",
"Map",
"<",
"Long",
",",
"FeatureShape",
">",
">",
"tables",
"=",
"getTables",
"(",
"database",
")",
";",
"if",
"(",
"tables",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"table",
":",
"tables",
".",
"keySet",
"(",
")",
")",
"{",
"count",
"+=",
"removeShapesNotWithinMap",
"(",
"boundingBox",
",",
"database",
",",
"table",
")",
";",
"}",
"}",
"return",
"count",
";",
"}"
]
| Remove all map shapes in the database that are not visible in the bounding box
@param boundingBox bounding box
@param database GeoPackage database
@return count of removed features
@since 3.2.0 | [
"Remove",
"all",
"map",
"shapes",
"in",
"the",
"database",
"that",
"are",
"not",
"visible",
"in",
"the",
"bounding",
"box"
]
| train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L490-L504 |
ykrasik/jaci | jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionSuppliers.java | ReflectionSuppliers.reflectionSupplier | public static <T> Spplr<T> reflectionSupplier(Object instance,
String methodName,
Class<T> primaryClass,
Class<T> secondaryClass) {
"""
Similar to {@link #reflectionSupplier(Object, String, Class)}, except allows for an alternative return type.
Will first try to create a reflection supplier using the primary class, but if that fails (the method doesn't
return the primary class), will re-try with the secondary class.
Useful for cases where the return type could be either a primitive or the primitive's boxed version
(i.e. Integer.type or Integer.class).
@param instance Instance to invoke the method one.
@param methodName Method name to invoke. Method must be no-args and return a value of
either the primary class or the secondary type.
@param primaryClass Primary return type of the method. Will be tried first.
@param secondaryClass Secondary return type of the method.
Will be tried if the method doesn't return the primary type.
@param <T> Supplier return type.
@return A {@link Spplr} that will invoke the no-args method specified by the given name on the given instance.
"""
try {
return reflectionSupplier(instance, methodName, primaryClass);
} catch (IllegalArgumentException e) {
// Try the alternative return value.
return reflectionSupplier(instance, methodName, secondaryClass);
}
} | java | public static <T> Spplr<T> reflectionSupplier(Object instance,
String methodName,
Class<T> primaryClass,
Class<T> secondaryClass) {
try {
return reflectionSupplier(instance, methodName, primaryClass);
} catch (IllegalArgumentException e) {
// Try the alternative return value.
return reflectionSupplier(instance, methodName, secondaryClass);
}
} | [
"public",
"static",
"<",
"T",
">",
"Spplr",
"<",
"T",
">",
"reflectionSupplier",
"(",
"Object",
"instance",
",",
"String",
"methodName",
",",
"Class",
"<",
"T",
">",
"primaryClass",
",",
"Class",
"<",
"T",
">",
"secondaryClass",
")",
"{",
"try",
"{",
"return",
"reflectionSupplier",
"(",
"instance",
",",
"methodName",
",",
"primaryClass",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"// Try the alternative return value.",
"return",
"reflectionSupplier",
"(",
"instance",
",",
"methodName",
",",
"secondaryClass",
")",
";",
"}",
"}"
]
| Similar to {@link #reflectionSupplier(Object, String, Class)}, except allows for an alternative return type.
Will first try to create a reflection supplier using the primary class, but if that fails (the method doesn't
return the primary class), will re-try with the secondary class.
Useful for cases where the return type could be either a primitive or the primitive's boxed version
(i.e. Integer.type or Integer.class).
@param instance Instance to invoke the method one.
@param methodName Method name to invoke. Method must be no-args and return a value of
either the primary class or the secondary type.
@param primaryClass Primary return type of the method. Will be tried first.
@param secondaryClass Secondary return type of the method.
Will be tried if the method doesn't return the primary type.
@param <T> Supplier return type.
@return A {@link Spplr} that will invoke the no-args method specified by the given name on the given instance. | [
"Similar",
"to",
"{",
"@link",
"#reflectionSupplier",
"(",
"Object",
"String",
"Class",
")",
"}",
"except",
"allows",
"for",
"an",
"alternative",
"return",
"type",
".",
"Will",
"first",
"try",
"to",
"create",
"a",
"reflection",
"supplier",
"using",
"the",
"primary",
"class",
"but",
"if",
"that",
"fails",
"(",
"the",
"method",
"doesn",
"t",
"return",
"the",
"primary",
"class",
")",
"will",
"re",
"-",
"try",
"with",
"the",
"secondary",
"class",
".",
"Useful",
"for",
"cases",
"where",
"the",
"return",
"type",
"could",
"be",
"either",
"a",
"primitive",
"or",
"the",
"primitive",
"s",
"boxed",
"version",
"(",
"i",
".",
"e",
".",
"Integer",
".",
"type",
"or",
"Integer",
".",
"class",
")",
"."
]
| train | https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionSuppliers.java#L69-L79 |
hibernate/hibernate-metamodelgen | src/main/java/org/hibernate/jpamodelgen/ClassWriter.java | ClassWriter.generateBody | private static StringBuffer generateBody(MetaEntity entity, Context context) {
"""
Generate everything after import statements.
@param entity The meta entity for which to write the body
@param context The processing context
@return body content
"""
StringWriter sw = new StringWriter();
PrintWriter pw = null;
try {
pw = new PrintWriter( sw );
if ( context.addGeneratedAnnotation() ) {
pw.println( writeGeneratedAnnotation( entity, context ) );
}
if ( context.isAddSuppressWarningsAnnotation() ) {
pw.println( writeSuppressWarnings() );
}
pw.println( writeStaticMetaModelAnnotation( entity ) );
printClassDeclaration( entity, pw, context );
pw.println();
List<MetaAttribute> members = entity.getMembers();
for ( MetaAttribute metaMember : members ) {
pw.println( " " + metaMember.getDeclarationString() );
}
pw.println();
pw.println( "}" );
return sw.getBuffer();
}
finally {
if ( pw != null ) {
pw.close();
}
}
} | java | private static StringBuffer generateBody(MetaEntity entity, Context context) {
StringWriter sw = new StringWriter();
PrintWriter pw = null;
try {
pw = new PrintWriter( sw );
if ( context.addGeneratedAnnotation() ) {
pw.println( writeGeneratedAnnotation( entity, context ) );
}
if ( context.isAddSuppressWarningsAnnotation() ) {
pw.println( writeSuppressWarnings() );
}
pw.println( writeStaticMetaModelAnnotation( entity ) );
printClassDeclaration( entity, pw, context );
pw.println();
List<MetaAttribute> members = entity.getMembers();
for ( MetaAttribute metaMember : members ) {
pw.println( " " + metaMember.getDeclarationString() );
}
pw.println();
pw.println( "}" );
return sw.getBuffer();
}
finally {
if ( pw != null ) {
pw.close();
}
}
} | [
"private",
"static",
"StringBuffer",
"generateBody",
"(",
"MetaEntity",
"entity",
",",
"Context",
"context",
")",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"pw",
"=",
"null",
";",
"try",
"{",
"pw",
"=",
"new",
"PrintWriter",
"(",
"sw",
")",
";",
"if",
"(",
"context",
".",
"addGeneratedAnnotation",
"(",
")",
")",
"{",
"pw",
".",
"println",
"(",
"writeGeneratedAnnotation",
"(",
"entity",
",",
"context",
")",
")",
";",
"}",
"if",
"(",
"context",
".",
"isAddSuppressWarningsAnnotation",
"(",
")",
")",
"{",
"pw",
".",
"println",
"(",
"writeSuppressWarnings",
"(",
")",
")",
";",
"}",
"pw",
".",
"println",
"(",
"writeStaticMetaModelAnnotation",
"(",
"entity",
")",
")",
";",
"printClassDeclaration",
"(",
"entity",
",",
"pw",
",",
"context",
")",
";",
"pw",
".",
"println",
"(",
")",
";",
"List",
"<",
"MetaAttribute",
">",
"members",
"=",
"entity",
".",
"getMembers",
"(",
")",
";",
"for",
"(",
"MetaAttribute",
"metaMember",
":",
"members",
")",
"{",
"pw",
".",
"println",
"(",
"\"\t\"",
"+",
"metaMember",
".",
"getDeclarationString",
"(",
")",
")",
";",
"}",
"pw",
".",
"println",
"(",
")",
";",
"pw",
".",
"println",
"(",
"\"}\"",
")",
";",
"return",
"sw",
".",
"getBuffer",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"pw",
"!=",
"null",
")",
"{",
"pw",
".",
"close",
"(",
")",
";",
"}",
"}",
"}"
]
| Generate everything after import statements.
@param entity The meta entity for which to write the body
@param context The processing context
@return body content | [
"Generate",
"everything",
"after",
"import",
"statements",
"."
]
| train | https://github.com/hibernate/hibernate-metamodelgen/blob/2c87b262bc03b1a5a541789fc00c54e0531a36b2/src/main/java/org/hibernate/jpamodelgen/ClassWriter.java#L103-L136 |
threerings/nenya | core/src/main/java/com/threerings/cast/CharacterManager.java | CharacterManager.resolveActionSequence | public void resolveActionSequence (CharacterDescriptor desc, String action) {
"""
Informs the character manager that the action sequence for the
given character descriptor is likely to be needed in the near
future and so any efforts that can be made to load it into the
action sequence cache in advance should be undertaken.
<p> This will eventually be revamped to spiffily load action
sequences in the background.
"""
try {
if (getActionFrames(desc, action) == null) {
log.warning("Failed to resolve action sequence " +
"[desc=" + desc + ", action=" + action + "].");
}
} catch (NoSuchComponentException nsce) {
log.warning("Failed to resolve action sequence " +
"[nsce=" + nsce + "].");
}
} | java | public void resolveActionSequence (CharacterDescriptor desc, String action)
{
try {
if (getActionFrames(desc, action) == null) {
log.warning("Failed to resolve action sequence " +
"[desc=" + desc + ", action=" + action + "].");
}
} catch (NoSuchComponentException nsce) {
log.warning("Failed to resolve action sequence " +
"[nsce=" + nsce + "].");
}
} | [
"public",
"void",
"resolveActionSequence",
"(",
"CharacterDescriptor",
"desc",
",",
"String",
"action",
")",
"{",
"try",
"{",
"if",
"(",
"getActionFrames",
"(",
"desc",
",",
"action",
")",
"==",
"null",
")",
"{",
"log",
".",
"warning",
"(",
"\"Failed to resolve action sequence \"",
"+",
"\"[desc=\"",
"+",
"desc",
"+",
"\", action=\"",
"+",
"action",
"+",
"\"].\"",
")",
";",
"}",
"}",
"catch",
"(",
"NoSuchComponentException",
"nsce",
")",
"{",
"log",
".",
"warning",
"(",
"\"Failed to resolve action sequence \"",
"+",
"\"[nsce=\"",
"+",
"nsce",
"+",
"\"].\"",
")",
";",
"}",
"}"
]
| Informs the character manager that the action sequence for the
given character descriptor is likely to be needed in the near
future and so any efforts that can be made to load it into the
action sequence cache in advance should be undertaken.
<p> This will eventually be revamped to spiffily load action
sequences in the background. | [
"Informs",
"the",
"character",
"manager",
"that",
"the",
"action",
"sequence",
"for",
"the",
"given",
"character",
"descriptor",
"is",
"likely",
"to",
"be",
"needed",
"in",
"the",
"near",
"future",
"and",
"so",
"any",
"efforts",
"that",
"can",
"be",
"made",
"to",
"load",
"it",
"into",
"the",
"action",
"sequence",
"cache",
"in",
"advance",
"should",
"be",
"undertaken",
"."
]
| train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/CharacterManager.java#L203-L215 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getAllContinentRegionID | public void getAllContinentRegionID(int continentID, int floorID, Callback<List<Integer>> callback) throws NullPointerException {
"""
For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param continentID {@link Continent#id}
@param floorID {@link ContinentFloor#id}
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see ContinentRegion continents region info
"""
gw2API.getAllContinentRegionIDs(Integer.toString(continentID), Integer.toString(floorID)).enqueue(callback);
} | java | public void getAllContinentRegionID(int continentID, int floorID, Callback<List<Integer>> callback) throws NullPointerException {
gw2API.getAllContinentRegionIDs(Integer.toString(continentID), Integer.toString(floorID)).enqueue(callback);
} | [
"public",
"void",
"getAllContinentRegionID",
"(",
"int",
"continentID",
",",
"int",
"floorID",
",",
"Callback",
"<",
"List",
"<",
"Integer",
">",
">",
"callback",
")",
"throws",
"NullPointerException",
"{",
"gw2API",
".",
"getAllContinentRegionIDs",
"(",
"Integer",
".",
"toString",
"(",
"continentID",
")",
",",
"Integer",
".",
"toString",
"(",
"floorID",
")",
")",
".",
"enqueue",
"(",
"callback",
")",
";",
"}"
]
| For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param continentID {@link Continent#id}
@param floorID {@link ContinentFloor#id}
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see ContinentRegion continents region info | [
"For",
"more",
"info",
"on",
"continents",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"continents",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
"the",
"access",
"to",
"{",
"@link",
"Callback#onResponse",
"(",
"Call",
"Response",
")",
"}",
"and",
"{",
"@link",
"Callback#onFailure",
"(",
"Call",
"Throwable",
")",
"}",
"methods",
"for",
"custom",
"interactions"
]
| train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1076-L1078 |
andrehertwig/admintool | admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java | ReflectUtils.invokeGetter | public static <S extends Serializable> S invokeGetter(Object object, String fieldName) {
"""
invokes the getter on the filed
@param object
@param field
@return
"""
Field field = ReflectionUtils.findField(object.getClass(), fieldName);
return invokeGetter(object, field);
} | java | public static <S extends Serializable> S invokeGetter(Object object, String fieldName)
{
Field field = ReflectionUtils.findField(object.getClass(), fieldName);
return invokeGetter(object, field);
} | [
"public",
"static",
"<",
"S",
"extends",
"Serializable",
">",
"S",
"invokeGetter",
"(",
"Object",
"object",
",",
"String",
"fieldName",
")",
"{",
"Field",
"field",
"=",
"ReflectionUtils",
".",
"findField",
"(",
"object",
".",
"getClass",
"(",
")",
",",
"fieldName",
")",
";",
"return",
"invokeGetter",
"(",
"object",
",",
"field",
")",
";",
"}"
]
| invokes the getter on the filed
@param object
@param field
@return | [
"invokes",
"the",
"getter",
"on",
"the",
"filed"
]
| train | https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ReflectUtils.java#L152-L156 |
lviggiano/owner | owner/src/main/java/org/aeonbits/owner/ConfigCache.java | ConfigCache.getOrCreate | public static <T extends Config> T getOrCreate(Factory factory, Class<? extends T> clazz, Map<?, ?>... imports) {
"""
Gets from the cache or create, an instance of the given class using the given imports.
@param factory the factory to use to eventually create the instance.
@param clazz the interface extending from {@link Config} that you want to instantiate.
@param imports additional variables to be used to resolve the properties.
@param <T> type of the interface.
@return an object implementing the given interface, that can be taken from the cache,
which maps methods to property values.
"""
return getOrCreate(factory, clazz, clazz, imports);
} | java | public static <T extends Config> T getOrCreate(Factory factory, Class<? extends T> clazz, Map<?, ?>... imports) {
return getOrCreate(factory, clazz, clazz, imports);
} | [
"public",
"static",
"<",
"T",
"extends",
"Config",
">",
"T",
"getOrCreate",
"(",
"Factory",
"factory",
",",
"Class",
"<",
"?",
"extends",
"T",
">",
"clazz",
",",
"Map",
"<",
"?",
",",
"?",
">",
"...",
"imports",
")",
"{",
"return",
"getOrCreate",
"(",
"factory",
",",
"clazz",
",",
"clazz",
",",
"imports",
")",
";",
"}"
]
| Gets from the cache or create, an instance of the given class using the given imports.
@param factory the factory to use to eventually create the instance.
@param clazz the interface extending from {@link Config} that you want to instantiate.
@param imports additional variables to be used to resolve the properties.
@param <T> type of the interface.
@return an object implementing the given interface, that can be taken from the cache,
which maps methods to property values. | [
"Gets",
"from",
"the",
"cache",
"or",
"create",
"an",
"instance",
"of",
"the",
"given",
"class",
"using",
"the",
"given",
"imports",
"."
]
| train | https://github.com/lviggiano/owner/blob/1223ecfbe3c275b3b7c5ec13e9238c9bb888754f/owner/src/main/java/org/aeonbits/owner/ConfigCache.java#L55-L57 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_instance_instanceId_interface_interfaceId_DELETE | public void project_serviceName_instance_instanceId_interface_interfaceId_DELETE(String serviceName, String instanceId, String interfaceId) throws IOException {
"""
Delete an interface
REST: DELETE /cloud/project/{serviceName}/instance/{instanceId}/interface/{interfaceId}
@param instanceId [required] Instance id
@param interfaceId [required] Interface id
@param serviceName [required] Service name
"""
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/interface/{interfaceId}";
StringBuilder sb = path(qPath, serviceName, instanceId, interfaceId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void project_serviceName_instance_instanceId_interface_interfaceId_DELETE(String serviceName, String instanceId, String interfaceId) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/interface/{interfaceId}";
StringBuilder sb = path(qPath, serviceName, instanceId, interfaceId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"project_serviceName_instance_instanceId_interface_interfaceId_DELETE",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
",",
"String",
"interfaceId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/instance/{instanceId}/interface/{interfaceId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"instanceId",
",",
"interfaceId",
")",
";",
"exec",
"(",
"qPath",
",",
"\"DELETE\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"}"
]
| Delete an interface
REST: DELETE /cloud/project/{serviceName}/instance/{instanceId}/interface/{interfaceId}
@param instanceId [required] Instance id
@param interfaceId [required] Interface id
@param serviceName [required] Service name | [
"Delete",
"an",
"interface"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1959-L1963 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFolder.java | UtilFolder.getPathSeparator | public static String getPathSeparator(String separator, String... path) {
"""
Construct a usable path using a list of string, automatically separated by the portable separator.
@param separator The separator to use (must not be <code>null</code>).
@param path The list of directories, if has, and file (must not be <code>null</code>).
@return The full media path.
@throws LionEngineException If invalid parameters.
"""
Check.notNull(separator);
Check.notNull(path);
final StringBuilder fullPath = new StringBuilder(path.length);
for (int i = 0; i < path.length; i++)
{
if (i == path.length - 1)
{
fullPath.append(path[i]);
}
else if (path[i] != null && path[i].length() > 0)
{
fullPath.append(path[i]);
if (!fullPath.substring(fullPath.length() - 1, fullPath.length()).equals(separator))
{
fullPath.append(separator);
}
}
}
return fullPath.toString();
} | java | public static String getPathSeparator(String separator, String... path)
{
Check.notNull(separator);
Check.notNull(path);
final StringBuilder fullPath = new StringBuilder(path.length);
for (int i = 0; i < path.length; i++)
{
if (i == path.length - 1)
{
fullPath.append(path[i]);
}
else if (path[i] != null && path[i].length() > 0)
{
fullPath.append(path[i]);
if (!fullPath.substring(fullPath.length() - 1, fullPath.length()).equals(separator))
{
fullPath.append(separator);
}
}
}
return fullPath.toString();
} | [
"public",
"static",
"String",
"getPathSeparator",
"(",
"String",
"separator",
",",
"String",
"...",
"path",
")",
"{",
"Check",
".",
"notNull",
"(",
"separator",
")",
";",
"Check",
".",
"notNull",
"(",
"path",
")",
";",
"final",
"StringBuilder",
"fullPath",
"=",
"new",
"StringBuilder",
"(",
"path",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"path",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"path",
".",
"length",
"-",
"1",
")",
"{",
"fullPath",
".",
"append",
"(",
"path",
"[",
"i",
"]",
")",
";",
"}",
"else",
"if",
"(",
"path",
"[",
"i",
"]",
"!=",
"null",
"&&",
"path",
"[",
"i",
"]",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"fullPath",
".",
"append",
"(",
"path",
"[",
"i",
"]",
")",
";",
"if",
"(",
"!",
"fullPath",
".",
"substring",
"(",
"fullPath",
".",
"length",
"(",
")",
"-",
"1",
",",
"fullPath",
".",
"length",
"(",
")",
")",
".",
"equals",
"(",
"separator",
")",
")",
"{",
"fullPath",
".",
"append",
"(",
"separator",
")",
";",
"}",
"}",
"}",
"return",
"fullPath",
".",
"toString",
"(",
")",
";",
"}"
]
| Construct a usable path using a list of string, automatically separated by the portable separator.
@param separator The separator to use (must not be <code>null</code>).
@param path The list of directories, if has, and file (must not be <code>null</code>).
@return The full media path.
@throws LionEngineException If invalid parameters. | [
"Construct",
"a",
"usable",
"path",
"using",
"a",
"list",
"of",
"string",
"automatically",
"separated",
"by",
"the",
"portable",
"separator",
"."
]
| train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFolder.java#L82-L104 |
jayantk/jklol | src/com/jayantkrish/jklol/inference/JunctionTree.java | JunctionTree.cliqueTreeToMaxMarginalSet | private static MaxMarginalSet cliqueTreeToMaxMarginalSet(CliqueTree cliqueTree,
FactorGraph originalFactorGraph) {
"""
Retrieves max marginals from the given clique tree.
@param cliqueTree
@param rootFactorNum
@return
"""
for (int i = 0; i < cliqueTree.numFactors(); i++) {
computeMarginal(cliqueTree, i, false);
}
return new FactorMaxMarginalSet(cliqueTree, originalFactorGraph.getConditionedValues());
} | java | private static MaxMarginalSet cliqueTreeToMaxMarginalSet(CliqueTree cliqueTree,
FactorGraph originalFactorGraph) {
for (int i = 0; i < cliqueTree.numFactors(); i++) {
computeMarginal(cliqueTree, i, false);
}
return new FactorMaxMarginalSet(cliqueTree, originalFactorGraph.getConditionedValues());
} | [
"private",
"static",
"MaxMarginalSet",
"cliqueTreeToMaxMarginalSet",
"(",
"CliqueTree",
"cliqueTree",
",",
"FactorGraph",
"originalFactorGraph",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cliqueTree",
".",
"numFactors",
"(",
")",
";",
"i",
"++",
")",
"{",
"computeMarginal",
"(",
"cliqueTree",
",",
"i",
",",
"false",
")",
";",
"}",
"return",
"new",
"FactorMaxMarginalSet",
"(",
"cliqueTree",
",",
"originalFactorGraph",
".",
"getConditionedValues",
"(",
")",
")",
";",
"}"
]
| Retrieves max marginals from the given clique tree.
@param cliqueTree
@param rootFactorNum
@return | [
"Retrieves",
"max",
"marginals",
"from",
"the",
"given",
"clique",
"tree",
"."
]
| train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/inference/JunctionTree.java#L309-L315 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_storage_containerId_GET | public OvhContainerDetail project_serviceName_storage_containerId_GET(String serviceName, String containerId) throws IOException {
"""
Get storage container
REST: GET /cloud/project/{serviceName}/storage/{containerId}
@param containerId [required] Container id
@param serviceName [required] Service name
"""
String qPath = "/cloud/project/{serviceName}/storage/{containerId}";
StringBuilder sb = path(qPath, serviceName, containerId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhContainerDetail.class);
} | java | public OvhContainerDetail project_serviceName_storage_containerId_GET(String serviceName, String containerId) throws IOException {
String qPath = "/cloud/project/{serviceName}/storage/{containerId}";
StringBuilder sb = path(qPath, serviceName, containerId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhContainerDetail.class);
} | [
"public",
"OvhContainerDetail",
"project_serviceName_storage_containerId_GET",
"(",
"String",
"serviceName",
",",
"String",
"containerId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/storage/{containerId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"containerId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhContainerDetail",
".",
"class",
")",
";",
"}"
]
| Get storage container
REST: GET /cloud/project/{serviceName}/storage/{containerId}
@param containerId [required] Container id
@param serviceName [required] Service name | [
"Get",
"storage",
"container"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L619-L624 |
JodaOrg/joda-time | src/main/java/org/joda/time/TimeOfDay.java | TimeOfDay.withFieldAdded | public TimeOfDay withFieldAdded(DurationFieldType fieldType, int amount) {
"""
Returns a copy of this time with the value of the specified field increased,
wrapping to what would be a new day if required.
<p>
If the addition is zero, then <code>this</code> is returned.
<p>
These three lines are equivalent:
<pre>
TimeOfDay added = tod.withFieldAdded(DurationFieldType.minutes(), 6);
TimeOfDay added = tod.plusMinutes(6);
TimeOfDay added = tod.minuteOfHour().addToCopy(6);
</pre>
@param fieldType the field type to add to, not null
@param amount the amount to add
@return a copy of this instance with the field updated
@throws IllegalArgumentException if the value is null or invalid
@throws ArithmeticException if the new datetime exceeds the capacity
"""
int index = indexOfSupported(fieldType);
if (amount == 0) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).addWrapPartial(this, index, newValues, amount);
return new TimeOfDay(this, newValues);
} | java | public TimeOfDay withFieldAdded(DurationFieldType fieldType, int amount) {
int index = indexOfSupported(fieldType);
if (amount == 0) {
return this;
}
int[] newValues = getValues();
newValues = getField(index).addWrapPartial(this, index, newValues, amount);
return new TimeOfDay(this, newValues);
} | [
"public",
"TimeOfDay",
"withFieldAdded",
"(",
"DurationFieldType",
"fieldType",
",",
"int",
"amount",
")",
"{",
"int",
"index",
"=",
"indexOfSupported",
"(",
"fieldType",
")",
";",
"if",
"(",
"amount",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"int",
"[",
"]",
"newValues",
"=",
"getValues",
"(",
")",
";",
"newValues",
"=",
"getField",
"(",
"index",
")",
".",
"addWrapPartial",
"(",
"this",
",",
"index",
",",
"newValues",
",",
"amount",
")",
";",
"return",
"new",
"TimeOfDay",
"(",
"this",
",",
"newValues",
")",
";",
"}"
]
| Returns a copy of this time with the value of the specified field increased,
wrapping to what would be a new day if required.
<p>
If the addition is zero, then <code>this</code> is returned.
<p>
These three lines are equivalent:
<pre>
TimeOfDay added = tod.withFieldAdded(DurationFieldType.minutes(), 6);
TimeOfDay added = tod.plusMinutes(6);
TimeOfDay added = tod.minuteOfHour().addToCopy(6);
</pre>
@param fieldType the field type to add to, not null
@param amount the amount to add
@return a copy of this instance with the field updated
@throws IllegalArgumentException if the value is null or invalid
@throws ArithmeticException if the new datetime exceeds the capacity | [
"Returns",
"a",
"copy",
"of",
"this",
"time",
"with",
"the",
"value",
"of",
"the",
"specified",
"field",
"increased",
"wrapping",
"to",
"what",
"would",
"be",
"a",
"new",
"day",
"if",
"required",
".",
"<p",
">",
"If",
"the",
"addition",
"is",
"zero",
"then",
"<code",
">",
"this<",
"/",
"code",
">",
"is",
"returned",
".",
"<p",
">",
"These",
"three",
"lines",
"are",
"equivalent",
":",
"<pre",
">",
"TimeOfDay",
"added",
"=",
"tod",
".",
"withFieldAdded",
"(",
"DurationFieldType",
".",
"minutes",
"()",
"6",
")",
";",
"TimeOfDay",
"added",
"=",
"tod",
".",
"plusMinutes",
"(",
"6",
")",
";",
"TimeOfDay",
"added",
"=",
"tod",
".",
"minuteOfHour",
"()",
".",
"addToCopy",
"(",
"6",
")",
";",
"<",
"/",
"pre",
">"
]
| train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/TimeOfDay.java#L552-L560 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java | AbstractDocumentationMojo.internalExecute | protected String internalExecute(Map<File, File> files, File outputFolder) {
"""
Execute the mojo on the given set of files.
@param files the files
@param outputFolder the output directory.
@return the error message
"""
String firstErrorMessage = null;
for (final Entry<File, File> entry : files.entrySet()) {
final File inputFile = entry.getKey();
try {
final AbstractMarkerLanguageParser parser = createLanguageParser(inputFile);
final File sourceFolder = entry.getValue();
final File relativePath = FileSystem.makeRelative(inputFile, sourceFolder);
internalExecute(sourceFolder, inputFile, relativePath, outputFolder, parser);
} catch (Throwable exception) {
final String errorMessage = formatErrorMessage(inputFile, exception);
getLog().error(errorMessage);
if (Strings.isEmpty(firstErrorMessage)) {
firstErrorMessage = errorMessage;
}
getLog().debug(exception);
}
}
return firstErrorMessage;
} | java | protected String internalExecute(Map<File, File> files, File outputFolder) {
String firstErrorMessage = null;
for (final Entry<File, File> entry : files.entrySet()) {
final File inputFile = entry.getKey();
try {
final AbstractMarkerLanguageParser parser = createLanguageParser(inputFile);
final File sourceFolder = entry.getValue();
final File relativePath = FileSystem.makeRelative(inputFile, sourceFolder);
internalExecute(sourceFolder, inputFile, relativePath, outputFolder, parser);
} catch (Throwable exception) {
final String errorMessage = formatErrorMessage(inputFile, exception);
getLog().error(errorMessage);
if (Strings.isEmpty(firstErrorMessage)) {
firstErrorMessage = errorMessage;
}
getLog().debug(exception);
}
}
return firstErrorMessage;
} | [
"protected",
"String",
"internalExecute",
"(",
"Map",
"<",
"File",
",",
"File",
">",
"files",
",",
"File",
"outputFolder",
")",
"{",
"String",
"firstErrorMessage",
"=",
"null",
";",
"for",
"(",
"final",
"Entry",
"<",
"File",
",",
"File",
">",
"entry",
":",
"files",
".",
"entrySet",
"(",
")",
")",
"{",
"final",
"File",
"inputFile",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"try",
"{",
"final",
"AbstractMarkerLanguageParser",
"parser",
"=",
"createLanguageParser",
"(",
"inputFile",
")",
";",
"final",
"File",
"sourceFolder",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"final",
"File",
"relativePath",
"=",
"FileSystem",
".",
"makeRelative",
"(",
"inputFile",
",",
"sourceFolder",
")",
";",
"internalExecute",
"(",
"sourceFolder",
",",
"inputFile",
",",
"relativePath",
",",
"outputFolder",
",",
"parser",
")",
";",
"}",
"catch",
"(",
"Throwable",
"exception",
")",
"{",
"final",
"String",
"errorMessage",
"=",
"formatErrorMessage",
"(",
"inputFile",
",",
"exception",
")",
";",
"getLog",
"(",
")",
".",
"error",
"(",
"errorMessage",
")",
";",
"if",
"(",
"Strings",
".",
"isEmpty",
"(",
"firstErrorMessage",
")",
")",
"{",
"firstErrorMessage",
"=",
"errorMessage",
";",
"}",
"getLog",
"(",
")",
".",
"debug",
"(",
"exception",
")",
";",
"}",
"}",
"return",
"firstErrorMessage",
";",
"}"
]
| Execute the mojo on the given set of files.
@param files the files
@param outputFolder the output directory.
@return the error message | [
"Execute",
"the",
"mojo",
"on",
"the",
"given",
"set",
"of",
"files",
"."
]
| train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/AbstractDocumentationMojo.java#L265-L285 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/cache/CmsFlexCacheClearDialog.java | CmsFlexCacheClearDialog.actionPurgeJspRepository | public void actionPurgeJspRepository() throws JspException {
"""
Purges the jsp repository.<p>
@throws JspException if something goes wrong
"""
OpenCms.fireCmsEvent(
new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, Collections.<String, Object> emptyMap()));
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR,
Collections.<String, Object> singletonMap("action", new Integer(CmsFlexCache.CLEAR_ENTRIES))));
setAction(CmsDialog.ACTION_CANCEL);
actionCloseDialog();
} | java | public void actionPurgeJspRepository() throws JspException {
OpenCms.fireCmsEvent(
new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, Collections.<String, Object> emptyMap()));
OpenCms.fireCmsEvent(
new CmsEvent(
I_CmsEventListener.EVENT_FLEX_CACHE_CLEAR,
Collections.<String, Object> singletonMap("action", new Integer(CmsFlexCache.CLEAR_ENTRIES))));
setAction(CmsDialog.ACTION_CANCEL);
actionCloseDialog();
} | [
"public",
"void",
"actionPurgeJspRepository",
"(",
")",
"throws",
"JspException",
"{",
"OpenCms",
".",
"fireCmsEvent",
"(",
"new",
"CmsEvent",
"(",
"I_CmsEventListener",
".",
"EVENT_FLEX_PURGE_JSP_REPOSITORY",
",",
"Collections",
".",
"<",
"String",
",",
"Object",
">",
"emptyMap",
"(",
")",
")",
")",
";",
"OpenCms",
".",
"fireCmsEvent",
"(",
"new",
"CmsEvent",
"(",
"I_CmsEventListener",
".",
"EVENT_FLEX_CACHE_CLEAR",
",",
"Collections",
".",
"<",
"String",
",",
"Object",
">",
"singletonMap",
"(",
"\"action\"",
",",
"new",
"Integer",
"(",
"CmsFlexCache",
".",
"CLEAR_ENTRIES",
")",
")",
")",
")",
";",
"setAction",
"(",
"CmsDialog",
".",
"ACTION_CANCEL",
")",
";",
"actionCloseDialog",
"(",
")",
";",
"}"
]
| Purges the jsp repository.<p>
@throws JspException if something goes wrong | [
"Purges",
"the",
"jsp",
"repository",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/cache/CmsFlexCacheClearDialog.java#L163-L174 |
apache/incubator-heron | heron/api/src/java/org/apache/heron/api/Config.java | Config.addClasspath | public void addClasspath(Map<String, Object> conf, String classpath) {
"""
/*
Appends the given classpath to the additional classpath config
"""
String cpKey = Config.TOPOLOGY_ADDITIONAL_CLASSPATH;
if (conf.containsKey(cpKey)) {
String newEntry = String.format("%s:%s", conf.get(cpKey), classpath);
conf.put(cpKey, newEntry);
} else {
conf.put(cpKey, classpath);
}
} | java | public void addClasspath(Map<String, Object> conf, String classpath) {
String cpKey = Config.TOPOLOGY_ADDITIONAL_CLASSPATH;
if (conf.containsKey(cpKey)) {
String newEntry = String.format("%s:%s", conf.get(cpKey), classpath);
conf.put(cpKey, newEntry);
} else {
conf.put(cpKey, classpath);
}
} | [
"public",
"void",
"addClasspath",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"conf",
",",
"String",
"classpath",
")",
"{",
"String",
"cpKey",
"=",
"Config",
".",
"TOPOLOGY_ADDITIONAL_CLASSPATH",
";",
"if",
"(",
"conf",
".",
"containsKey",
"(",
"cpKey",
")",
")",
"{",
"String",
"newEntry",
"=",
"String",
".",
"format",
"(",
"\"%s:%s\"",
",",
"conf",
".",
"get",
"(",
"cpKey",
")",
",",
"classpath",
")",
";",
"conf",
".",
"put",
"(",
"cpKey",
",",
"newEntry",
")",
";",
"}",
"else",
"{",
"conf",
".",
"put",
"(",
"cpKey",
",",
"classpath",
")",
";",
"}",
"}"
]
| /*
Appends the given classpath to the additional classpath config | [
"/",
"*",
"Appends",
"the",
"given",
"classpath",
"to",
"the",
"additional",
"classpath",
"config"
]
| train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/Config.java#L836-L845 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/JapaneseCalendar.java | JapaneseCalendar.getDefaultDayInMonth | protected int getDefaultDayInMonth(int extendedYear, int month) {
"""
Called by handleComputeJulianDay. Returns the default day (1-based) for the month,
taking currently-set year and era into account. Defaults to 1 for Gregorian.
@param extendedYear the extendedYear, as returned by handleGetExtendedYear
@param month the month, as returned by getDefaultMonthInYear
@return the default day of the month
@see #DAY_OF_MONTH
@hide draft / provisional / internal are hidden on Android
"""
int era = internalGet(ERA, CURRENT_ERA);
if(extendedYear == ERAS[era*3]) { // if it is year 1..
if(month == ((ERAS[(era*3)+1])-1)) { // if it is the emperor's first month..
return ERAS[(era*3)+2]; // return the D_O_M of acession
}
}
return super.getDefaultDayInMonth(extendedYear, month);
} | java | protected int getDefaultDayInMonth(int extendedYear, int month) {
int era = internalGet(ERA, CURRENT_ERA);
if(extendedYear == ERAS[era*3]) { // if it is year 1..
if(month == ((ERAS[(era*3)+1])-1)) { // if it is the emperor's first month..
return ERAS[(era*3)+2]; // return the D_O_M of acession
}
}
return super.getDefaultDayInMonth(extendedYear, month);
} | [
"protected",
"int",
"getDefaultDayInMonth",
"(",
"int",
"extendedYear",
",",
"int",
"month",
")",
"{",
"int",
"era",
"=",
"internalGet",
"(",
"ERA",
",",
"CURRENT_ERA",
")",
";",
"if",
"(",
"extendedYear",
"==",
"ERAS",
"[",
"era",
"*",
"3",
"]",
")",
"{",
"// if it is year 1..",
"if",
"(",
"month",
"==",
"(",
"(",
"ERAS",
"[",
"(",
"era",
"*",
"3",
")",
"+",
"1",
"]",
")",
"-",
"1",
")",
")",
"{",
"// if it is the emperor's first month.. ",
"return",
"ERAS",
"[",
"(",
"era",
"*",
"3",
")",
"+",
"2",
"]",
";",
"// return the D_O_M of acession",
"}",
"}",
"return",
"super",
".",
"getDefaultDayInMonth",
"(",
"extendedYear",
",",
"month",
")",
";",
"}"
]
| Called by handleComputeJulianDay. Returns the default day (1-based) for the month,
taking currently-set year and era into account. Defaults to 1 for Gregorian.
@param extendedYear the extendedYear, as returned by handleGetExtendedYear
@param month the month, as returned by getDefaultMonthInYear
@return the default day of the month
@see #DAY_OF_MONTH
@hide draft / provisional / internal are hidden on Android | [
"Called",
"by",
"handleComputeJulianDay",
".",
"Returns",
"the",
"default",
"day",
"(",
"1",
"-",
"based",
")",
"for",
"the",
"month",
"taking",
"currently",
"-",
"set",
"year",
"and",
"era",
"into",
"account",
".",
"Defaults",
"to",
"1",
"for",
"Gregorian",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/JapaneseCalendar.java#L252-L262 |
geomajas/geomajas-project-client-gwt2 | common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/impl/DomImpl.java | DomImpl.createElement | public Element createElement(String tagName, String id) {
"""
Creates an HTML element with the given id.
@param tagName
the HTML tag of the element to be created
@return the newly-created element
"""
Element element = DOM.createElement(tagName).cast();
DOM.setElementAttribute(element, "id", id);
return element;
} | java | public Element createElement(String tagName, String id) {
Element element = DOM.createElement(tagName).cast();
DOM.setElementAttribute(element, "id", id);
return element;
} | [
"public",
"Element",
"createElement",
"(",
"String",
"tagName",
",",
"String",
"id",
")",
"{",
"Element",
"element",
"=",
"DOM",
".",
"createElement",
"(",
"tagName",
")",
".",
"cast",
"(",
")",
";",
"DOM",
".",
"setElementAttribute",
"(",
"element",
",",
"\"id\"",
",",
"id",
")",
";",
"return",
"element",
";",
"}"
]
| Creates an HTML element with the given id.
@param tagName
the HTML tag of the element to be created
@return the newly-created element | [
"Creates",
"an",
"HTML",
"element",
"with",
"the",
"given",
"id",
"."
]
| train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/common-gwt/src/main/java/org/geomajas/gwt/client/util/impl/DomImpl.java#L132-L136 |
apache/incubator-heron | heron/api/src/java/org/apache/heron/streamlet/impl/StreamletImpl.java | StreamletImpl.keyBy | @Override
public <K> KVStreamlet<K, R> keyBy(SerializableFunction<R, K> keyExtractor) {
"""
Return a new KVStreamlet<K, R> by applying key extractor to each element of this Streamlet
@param keyExtractor The function applied to a tuple of this streamlet to get the key
"""
return keyBy(keyExtractor, (a) -> a);
} | java | @Override
public <K> KVStreamlet<K, R> keyBy(SerializableFunction<R, K> keyExtractor) {
return keyBy(keyExtractor, (a) -> a);
} | [
"@",
"Override",
"public",
"<",
"K",
">",
"KVStreamlet",
"<",
"K",
",",
"R",
">",
"keyBy",
"(",
"SerializableFunction",
"<",
"R",
",",
"K",
">",
"keyExtractor",
")",
"{",
"return",
"keyBy",
"(",
"keyExtractor",
",",
"(",
"a",
")",
"-",
"",
">",
"a",
")",
";",
"}"
]
| Return a new KVStreamlet<K, R> by applying key extractor to each element of this Streamlet
@param keyExtractor The function applied to a tuple of this streamlet to get the key | [
"Return",
"a",
"new",
"KVStreamlet<K",
"R",
">",
"by",
"applying",
"key",
"extractor",
"to",
"each",
"element",
"of",
"this",
"Streamlet"
]
| train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/streamlet/impl/StreamletImpl.java#L676-L679 |
ragunathjawahar/adapter-kit | library/src/com/mobsandgeeks/adapters/InstantAdapterCore.java | InstantAdapterCore.setViewHandler | public void setViewHandler(final int viewId, final ViewHandler<T> viewHandler) {
"""
Sets an {@link ViewHandler} for a given View id.
@param viewId Designated View id.
@param viewHandler A {@link ViewHandler} for the corresponding View.
@throws IllegalArgumentException If evaluator is {@code null}.
"""
if (viewHandler == null) {
throw new IllegalArgumentException("'viewHandler' cannot be null.");
}
mViewHandlers.put(viewId, viewHandler);
} | java | public void setViewHandler(final int viewId, final ViewHandler<T> viewHandler) {
if (viewHandler == null) {
throw new IllegalArgumentException("'viewHandler' cannot be null.");
}
mViewHandlers.put(viewId, viewHandler);
} | [
"public",
"void",
"setViewHandler",
"(",
"final",
"int",
"viewId",
",",
"final",
"ViewHandler",
"<",
"T",
">",
"viewHandler",
")",
"{",
"if",
"(",
"viewHandler",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"'viewHandler' cannot be null.\"",
")",
";",
"}",
"mViewHandlers",
".",
"put",
"(",
"viewId",
",",
"viewHandler",
")",
";",
"}"
]
| Sets an {@link ViewHandler} for a given View id.
@param viewId Designated View id.
@param viewHandler A {@link ViewHandler} for the corresponding View.
@throws IllegalArgumentException If evaluator is {@code null}. | [
"Sets",
"an",
"{",
"@link",
"ViewHandler",
"}",
"for",
"a",
"given",
"View",
"id",
"."
]
| train | https://github.com/ragunathjawahar/adapter-kit/blob/e5c13458c7f6dcc1c61410f9cfb55cd24bd31ca2/library/src/com/mobsandgeeks/adapters/InstantAdapterCore.java#L161-L166 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java | ElemTemplateElement.excludeResultNSDecl | private boolean excludeResultNSDecl(String prefix, String uri)
throws TransformerException {
"""
Tell if the result namespace decl should be excluded. Should be called before
namespace aliasing (I think).
@param prefix non-null reference to prefix.
@param uri reference to namespace that prefix maps to, which is protected
for null, but should really never be passed as null.
@return true if the given namespace should be excluded.
@throws TransformerException
"""
if (uri != null)
{
if (uri.equals(Constants.S_XSLNAMESPACEURL)
|| getStylesheet().containsExtensionElementURI(uri))
return true;
if (containsExcludeResultPrefix(prefix, uri))
return true;
}
return false;
} | java | private boolean excludeResultNSDecl(String prefix, String uri)
throws TransformerException
{
if (uri != null)
{
if (uri.equals(Constants.S_XSLNAMESPACEURL)
|| getStylesheet().containsExtensionElementURI(uri))
return true;
if (containsExcludeResultPrefix(prefix, uri))
return true;
}
return false;
} | [
"private",
"boolean",
"excludeResultNSDecl",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"throws",
"TransformerException",
"{",
"if",
"(",
"uri",
"!=",
"null",
")",
"{",
"if",
"(",
"uri",
".",
"equals",
"(",
"Constants",
".",
"S_XSLNAMESPACEURL",
")",
"||",
"getStylesheet",
"(",
")",
".",
"containsExtensionElementURI",
"(",
"uri",
")",
")",
"return",
"true",
";",
"if",
"(",
"containsExcludeResultPrefix",
"(",
"prefix",
",",
"uri",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
]
| Tell if the result namespace decl should be excluded. Should be called before
namespace aliasing (I think).
@param prefix non-null reference to prefix.
@param uri reference to namespace that prefix maps to, which is protected
for null, but should really never be passed as null.
@return true if the given namespace should be excluded.
@throws TransformerException | [
"Tell",
"if",
"the",
"result",
"namespace",
"decl",
"should",
"be",
"excluded",
".",
"Should",
"be",
"called",
"before",
"namespace",
"aliasing",
"(",
"I",
"think",
")",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemTemplateElement.java#L1001-L1016 |
LearnLib/learnlib | oracles/parallelism/src/main/java/de/learnlib/oracle/parallelism/ParallelOracleBuilders.java | ParallelOracleBuilders.newStaticParallelOracle | @Nonnull
@SafeVarargs
public static <I, D> StaticParallelOracleBuilder<I, D> newStaticParallelOracle(MembershipOracle<I, D> firstOracle,
MembershipOracle<I, D>... otherOracles) {
"""
Convenience method for {@link #newStaticParallelOracle(Collection)}.
@param firstOracle
the first (mandatory) oracle
@param otherOracles
further (optional) oracles to be used by other threads
@param <I>
input symbol type
@param <D>
output domain type
@return a preconfigured oracle builder
"""
return newStaticParallelOracle(Lists.asList(firstOracle, otherOracles));
} | java | @Nonnull
@SafeVarargs
public static <I, D> StaticParallelOracleBuilder<I, D> newStaticParallelOracle(MembershipOracle<I, D> firstOracle,
MembershipOracle<I, D>... otherOracles) {
return newStaticParallelOracle(Lists.asList(firstOracle, otherOracles));
} | [
"@",
"Nonnull",
"@",
"SafeVarargs",
"public",
"static",
"<",
"I",
",",
"D",
">",
"StaticParallelOracleBuilder",
"<",
"I",
",",
"D",
">",
"newStaticParallelOracle",
"(",
"MembershipOracle",
"<",
"I",
",",
"D",
">",
"firstOracle",
",",
"MembershipOracle",
"<",
"I",
",",
"D",
">",
"...",
"otherOracles",
")",
"{",
"return",
"newStaticParallelOracle",
"(",
"Lists",
".",
"asList",
"(",
"firstOracle",
",",
"otherOracles",
")",
")",
";",
"}"
]
| Convenience method for {@link #newStaticParallelOracle(Collection)}.
@param firstOracle
the first (mandatory) oracle
@param otherOracles
further (optional) oracles to be used by other threads
@param <I>
input symbol type
@param <D>
output domain type
@return a preconfigured oracle builder | [
"Convenience",
"method",
"for",
"{",
"@link",
"#newStaticParallelOracle",
"(",
"Collection",
")",
"}",
"."
]
| train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/oracles/parallelism/src/main/java/de/learnlib/oracle/parallelism/ParallelOracleBuilders.java#L162-L167 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConnection.java | SibRaConnection.createConsumerSessionForDurableSubscription | @Override
public ConsumerSession createConsumerSessionForDurableSubscription(
final String subscriptionName,
final String durableSubscriptionHome,
final SIDestinationAddress destinationAddress,
final SelectionCriteria criteria,
final boolean supportsMultipleConsumers, final boolean nolocal,
final Reliability reliability, final boolean enableReadAhead,
final Reliability unrecoverableReliability,
final boolean bifurcatable, final String alternateUser)
throws SIConnectionDroppedException,
SIConnectionUnavailableException, SIConnectionLostException,
SILimitExceededException, SINotAuthorizedException,
SIDurableSubscriptionNotFoundException,
SIDurableSubscriptionMismatchException,
SIDestinationLockedException, SIResourceException,
SIErrorException, SIIncorrectCallException {
"""
Creates a consumer session for a durable subscription. Checks that the
connection is valid and then delegates. Wraps the
<code>ConsumerSession</code> returned from the delegate in a
<code>SibRaConsumerSession</code>.
@param subscriptionName
the name for the subscription
@param durableSubscriptionHome
the home for the durable subscription
@param destinationAddress
the address of the destination
@param criteria
the selection criteria
@param reliability
the reliability
@param enableReadAhead
flag indicating whether read ahead is enabled
@param supportsMultipleConsumers
flag indicating whether multiple consumers are supported
@param nolocal
flag indicating whether local messages should be received
@param unrecoverableReliability
the unrecoverable reliability
@param bifurcatable
whether the new ConsumerSession may be bifurcated
@param alternateUser
the name of the user under whose authority operations of the
ConsumerSession should be performed (may be null)
@return the consumer session representing the durable subscription
@throws SIIncorrectCallException
if the delegation fails
@throws SIErrorException
if the delegation fails
@throws SIResourceException
if the delegation fails
@throws SIDestinationLockedException
if the delegation fails
@throws SIDurableSubscriptionMismatchException
if the delegation fails
@throws SIDurableSubscriptionNotFoundException
if the delegation fails
@throws SINotAuthorizedException
if the delegation fails
@throws SILimitExceededException
if the delegation fails
@throws SIConnectionLostException
if the delegation fails
@throws SIConnectionUnavailableException
if the connection is not valid
@throws SIConnectionDroppedException
if the delegation fails
"""
checkValid();
final ConsumerSession consumerSession = _delegateConnection
.createConsumerSessionForDurableSubscription(subscriptionName,
durableSubscriptionHome, destinationAddress, criteria,
supportsMultipleConsumers, nolocal, reliability,
enableReadAhead, unrecoverableReliability,
bifurcatable, alternateUser);
return new SibRaConsumerSession(this, consumerSession);
} | java | @Override
public ConsumerSession createConsumerSessionForDurableSubscription(
final String subscriptionName,
final String durableSubscriptionHome,
final SIDestinationAddress destinationAddress,
final SelectionCriteria criteria,
final boolean supportsMultipleConsumers, final boolean nolocal,
final Reliability reliability, final boolean enableReadAhead,
final Reliability unrecoverableReliability,
final boolean bifurcatable, final String alternateUser)
throws SIConnectionDroppedException,
SIConnectionUnavailableException, SIConnectionLostException,
SILimitExceededException, SINotAuthorizedException,
SIDurableSubscriptionNotFoundException,
SIDurableSubscriptionMismatchException,
SIDestinationLockedException, SIResourceException,
SIErrorException, SIIncorrectCallException {
checkValid();
final ConsumerSession consumerSession = _delegateConnection
.createConsumerSessionForDurableSubscription(subscriptionName,
durableSubscriptionHome, destinationAddress, criteria,
supportsMultipleConsumers, nolocal, reliability,
enableReadAhead, unrecoverableReliability,
bifurcatable, alternateUser);
return new SibRaConsumerSession(this, consumerSession);
} | [
"@",
"Override",
"public",
"ConsumerSession",
"createConsumerSessionForDurableSubscription",
"(",
"final",
"String",
"subscriptionName",
",",
"final",
"String",
"durableSubscriptionHome",
",",
"final",
"SIDestinationAddress",
"destinationAddress",
",",
"final",
"SelectionCriteria",
"criteria",
",",
"final",
"boolean",
"supportsMultipleConsumers",
",",
"final",
"boolean",
"nolocal",
",",
"final",
"Reliability",
"reliability",
",",
"final",
"boolean",
"enableReadAhead",
",",
"final",
"Reliability",
"unrecoverableReliability",
",",
"final",
"boolean",
"bifurcatable",
",",
"final",
"String",
"alternateUser",
")",
"throws",
"SIConnectionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SINotAuthorizedException",
",",
"SIDurableSubscriptionNotFoundException",
",",
"SIDurableSubscriptionMismatchException",
",",
"SIDestinationLockedException",
",",
"SIResourceException",
",",
"SIErrorException",
",",
"SIIncorrectCallException",
"{",
"checkValid",
"(",
")",
";",
"final",
"ConsumerSession",
"consumerSession",
"=",
"_delegateConnection",
".",
"createConsumerSessionForDurableSubscription",
"(",
"subscriptionName",
",",
"durableSubscriptionHome",
",",
"destinationAddress",
",",
"criteria",
",",
"supportsMultipleConsumers",
",",
"nolocal",
",",
"reliability",
",",
"enableReadAhead",
",",
"unrecoverableReliability",
",",
"bifurcatable",
",",
"alternateUser",
")",
";",
"return",
"new",
"SibRaConsumerSession",
"(",
"this",
",",
"consumerSession",
")",
";",
"}"
]
| Creates a consumer session for a durable subscription. Checks that the
connection is valid and then delegates. Wraps the
<code>ConsumerSession</code> returned from the delegate in a
<code>SibRaConsumerSession</code>.
@param subscriptionName
the name for the subscription
@param durableSubscriptionHome
the home for the durable subscription
@param destinationAddress
the address of the destination
@param criteria
the selection criteria
@param reliability
the reliability
@param enableReadAhead
flag indicating whether read ahead is enabled
@param supportsMultipleConsumers
flag indicating whether multiple consumers are supported
@param nolocal
flag indicating whether local messages should be received
@param unrecoverableReliability
the unrecoverable reliability
@param bifurcatable
whether the new ConsumerSession may be bifurcated
@param alternateUser
the name of the user under whose authority operations of the
ConsumerSession should be performed (may be null)
@return the consumer session representing the durable subscription
@throws SIIncorrectCallException
if the delegation fails
@throws SIErrorException
if the delegation fails
@throws SIResourceException
if the delegation fails
@throws SIDestinationLockedException
if the delegation fails
@throws SIDurableSubscriptionMismatchException
if the delegation fails
@throws SIDurableSubscriptionNotFoundException
if the delegation fails
@throws SINotAuthorizedException
if the delegation fails
@throws SILimitExceededException
if the delegation fails
@throws SIConnectionLostException
if the delegation fails
@throws SIConnectionUnavailableException
if the connection is not valid
@throws SIConnectionDroppedException
if the delegation fails | [
"Creates",
"a",
"consumer",
"session",
"for",
"a",
"durable",
"subscription",
".",
"Checks",
"that",
"the",
"connection",
"is",
"valid",
"and",
"then",
"delegates",
".",
"Wraps",
"the",
"<code",
">",
"ConsumerSession<",
"/",
"code",
">",
"returned",
"from",
"the",
"delegate",
"in",
"a",
"<code",
">",
"SibRaConsumerSession<",
"/",
"code",
">",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConnection.java#L1288-L1316 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java | CellUtil.getCellValue | public static Object getCellValue(Cell cell, CellEditor cellEditor) {
"""
获取单元格值
@param cell {@link Cell}单元格
@param cellEditor 单元格值编辑器。可以通过此编辑器对单元格值做自定义操作
@return 值,类型可能为:Date、Double、Boolean、String
"""
if (null == cell) {
return null;
}
return getCellValue(cell, cell.getCellTypeEnum(), cellEditor);
} | java | public static Object getCellValue(Cell cell, CellEditor cellEditor) {
if (null == cell) {
return null;
}
return getCellValue(cell, cell.getCellTypeEnum(), cellEditor);
} | [
"public",
"static",
"Object",
"getCellValue",
"(",
"Cell",
"cell",
",",
"CellEditor",
"cellEditor",
")",
"{",
"if",
"(",
"null",
"==",
"cell",
")",
"{",
"return",
"null",
";",
"}",
"return",
"getCellValue",
"(",
"cell",
",",
"cell",
".",
"getCellTypeEnum",
"(",
")",
",",
"cellEditor",
")",
";",
"}"
]
| 获取单元格值
@param cell {@link Cell}单元格
@param cellEditor 单元格值编辑器。可以通过此编辑器对单元格值做自定义操作
@return 值,类型可能为:Date、Double、Boolean、String | [
"获取单元格值"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java#L50-L55 |
zaproxy/zaproxy | src/org/zaproxy/zap/view/StandardFieldsDialog.java | StandardFieldsDialog.addComboField | public <E> void addComboField(String fieldLabel, ComboBoxModel<E> comboBoxModel, boolean editable) {
"""
Adds a combo box field, possibly editable, with the given label and model.
<p>
Control of selection state (i.e. set/get selected item) is done through the combo box model.
@param <E> the type of the elements of the combo box model.
@param fieldLabel the name of the label of the combo box field.
@param comboBoxModel the model to set into the combo box.
@param editable {@code true} if the combo box should be editable, {@code false} otherwise.
@throws IllegalArgumentException if any of the following conditions is true:
<ul>
<li>the dialogue has tabs;</li>
<li>a field with the given label already exists.</li>
</ul>
@since 2.6.0
@see #addComboField(String, ComboBoxModel)
@see #addComboField(int, String, ComboBoxModel, boolean)
@see #setComboBoxModel(String, ComboBoxModel)
"""
validateNotTabbed();
JComboBox<E> field = new JComboBox<>(comboBoxModel);
field.setEditable(editable);
this.addField(fieldLabel, field, field, 0.0D);
} | java | public <E> void addComboField(String fieldLabel, ComboBoxModel<E> comboBoxModel, boolean editable) {
validateNotTabbed();
JComboBox<E> field = new JComboBox<>(comboBoxModel);
field.setEditable(editable);
this.addField(fieldLabel, field, field, 0.0D);
} | [
"public",
"<",
"E",
">",
"void",
"addComboField",
"(",
"String",
"fieldLabel",
",",
"ComboBoxModel",
"<",
"E",
">",
"comboBoxModel",
",",
"boolean",
"editable",
")",
"{",
"validateNotTabbed",
"(",
")",
";",
"JComboBox",
"<",
"E",
">",
"field",
"=",
"new",
"JComboBox",
"<>",
"(",
"comboBoxModel",
")",
";",
"field",
".",
"setEditable",
"(",
"editable",
")",
";",
"this",
".",
"addField",
"(",
"fieldLabel",
",",
"field",
",",
"field",
",",
"0.0D",
")",
";",
"}"
]
| Adds a combo box field, possibly editable, with the given label and model.
<p>
Control of selection state (i.e. set/get selected item) is done through the combo box model.
@param <E> the type of the elements of the combo box model.
@param fieldLabel the name of the label of the combo box field.
@param comboBoxModel the model to set into the combo box.
@param editable {@code true} if the combo box should be editable, {@code false} otherwise.
@throws IllegalArgumentException if any of the following conditions is true:
<ul>
<li>the dialogue has tabs;</li>
<li>a field with the given label already exists.</li>
</ul>
@since 2.6.0
@see #addComboField(String, ComboBoxModel)
@see #addComboField(int, String, ComboBoxModel, boolean)
@see #setComboBoxModel(String, ComboBoxModel) | [
"Adds",
"a",
"combo",
"box",
"field",
"possibly",
"editable",
"with",
"the",
"given",
"label",
"and",
"model",
".",
"<p",
">",
"Control",
"of",
"selection",
"state",
"(",
"i",
".",
"e",
".",
"set",
"/",
"get",
"selected",
"item",
")",
"is",
"done",
"through",
"the",
"combo",
"box",
"model",
"."
]
| train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/StandardFieldsDialog.java#L879-L884 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/BinaryHeapPriorityQueue.java | BinaryHeapPriorityQueue.relaxPriority | public boolean relaxPriority(E key, double priority) {
"""
Promotes a key in the queue, adding it if it wasn't there already. If the specified priority is worse than the current priority, nothing happens. Faster than add if you don't care about whether the key is new.
@param key an <code>Object</code> value
@return whether the priority actually improved.
"""
Entry<E> entry = getEntry(key);
if (entry == null) {
entry = makeEntry(key);
}
if (compare(priority, entry.priority) <= 0) {
return false;
}
entry.priority = priority;
heapifyUp(entry);
return true;
} | java | public boolean relaxPriority(E key, double priority) {
Entry<E> entry = getEntry(key);
if (entry == null) {
entry = makeEntry(key);
}
if (compare(priority, entry.priority) <= 0) {
return false;
}
entry.priority = priority;
heapifyUp(entry);
return true;
} | [
"public",
"boolean",
"relaxPriority",
"(",
"E",
"key",
",",
"double",
"priority",
")",
"{",
"Entry",
"<",
"E",
">",
"entry",
"=",
"getEntry",
"(",
"key",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"entry",
"=",
"makeEntry",
"(",
"key",
")",
";",
"}",
"if",
"(",
"compare",
"(",
"priority",
",",
"entry",
".",
"priority",
")",
"<=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"entry",
".",
"priority",
"=",
"priority",
";",
"heapifyUp",
"(",
"entry",
")",
";",
"return",
"true",
";",
"}"
]
| Promotes a key in the queue, adding it if it wasn't there already. If the specified priority is worse than the current priority, nothing happens. Faster than add if you don't care about whether the key is new.
@param key an <code>Object</code> value
@return whether the priority actually improved. | [
"Promotes",
"a",
"key",
"in",
"the",
"queue",
"adding",
"it",
"if",
"it",
"wasn",
"t",
"there",
"already",
".",
"If",
"the",
"specified",
"priority",
"is",
"worse",
"than",
"the",
"current",
"priority",
"nothing",
"happens",
".",
"Faster",
"than",
"add",
"if",
"you",
"don",
"t",
"care",
"about",
"whether",
"the",
"key",
"is",
"new",
"."
]
| train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/BinaryHeapPriorityQueue.java#L318-L329 |
datacleaner/DataCleaner | desktop/api/src/main/java/org/datacleaner/util/WidgetUtils.java | WidgetUtils.colorBetween | public static Color colorBetween(final Color c1, final Color c2) {
"""
Creates a color that is in between two colors, in terms of RGB balance.
@param c1
@param c2
@return
"""
final int red = (c1.getRed() + c2.getRed()) / 2;
final int green = (c1.getGreen() + c2.getGreen()) / 2;
final int blue = (c1.getBlue() + c2.getBlue()) / 2;
return new Color(red, green, blue);
} | java | public static Color colorBetween(final Color c1, final Color c2) {
final int red = (c1.getRed() + c2.getRed()) / 2;
final int green = (c1.getGreen() + c2.getGreen()) / 2;
final int blue = (c1.getBlue() + c2.getBlue()) / 2;
return new Color(red, green, blue);
} | [
"public",
"static",
"Color",
"colorBetween",
"(",
"final",
"Color",
"c1",
",",
"final",
"Color",
"c2",
")",
"{",
"final",
"int",
"red",
"=",
"(",
"c1",
".",
"getRed",
"(",
")",
"+",
"c2",
".",
"getRed",
"(",
")",
")",
"/",
"2",
";",
"final",
"int",
"green",
"=",
"(",
"c1",
".",
"getGreen",
"(",
")",
"+",
"c2",
".",
"getGreen",
"(",
")",
")",
"/",
"2",
";",
"final",
"int",
"blue",
"=",
"(",
"c1",
".",
"getBlue",
"(",
")",
"+",
"c2",
".",
"getBlue",
"(",
")",
")",
"/",
"2",
";",
"return",
"new",
"Color",
"(",
"red",
",",
"green",
",",
"blue",
")",
";",
"}"
]
| Creates a color that is in between two colors, in terms of RGB balance.
@param c1
@param c2
@return | [
"Creates",
"a",
"color",
"that",
"is",
"in",
"between",
"two",
"colors",
"in",
"terms",
"of",
"RGB",
"balance",
"."
]
| train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/util/WidgetUtils.java#L516-L521 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.sendUpgradeProposal | public Collection<ProposalResponse> sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest, Collection<Peer> peers)
throws InvalidArgumentException, ProposalException {
"""
Send Upgrade proposal proposal to upgrade chaincode to a new version.
@param upgradeProposalRequest
@param peers the specific peers to send to.
@return Collection of proposal responses.
@throws ProposalException
@throws InvalidArgumentException
@deprecated See new Lifecycle chaincode management. {@link Channel#sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest, Peer)}
"""
checkChannelState();
checkPeers(peers);
if (null == upgradeProposalRequest) {
throw new InvalidArgumentException("Upgradeproposal is null");
}
try {
TransactionContext transactionContext = getTransactionContext(upgradeProposalRequest.getUserContext());
//transactionContext.verify(false); // Install will have no signing cause it's not really targeted to a channel.
transactionContext.setProposalWaitTime(upgradeProposalRequest.getProposalWaitTime());
UpgradeProposalBuilder upgradeProposalBuilder = UpgradeProposalBuilder.newBuilder();
upgradeProposalBuilder.context(transactionContext);
upgradeProposalBuilder.argss(upgradeProposalRequest.getArgs());
upgradeProposalBuilder.chaincodeName(upgradeProposalRequest.getChaincodeName());
upgradeProposalBuilder.chaincodePath(upgradeProposalRequest.getChaincodePath());
upgradeProposalBuilder.chaincodeVersion(upgradeProposalRequest.getChaincodeVersion());
upgradeProposalBuilder.chaincodEndorsementPolicy(upgradeProposalRequest.getChaincodeEndorsementPolicy());
upgradeProposalBuilder.chaincodeCollectionConfiguration(upgradeProposalRequest.getChaincodeCollectionConfiguration());
SignedProposal signedProposal = getSignedProposal(transactionContext, upgradeProposalBuilder.build());
return sendProposalToPeers(peers, signedProposal, transactionContext);
} catch (Exception e) {
throw new ProposalException(e);
}
} | java | public Collection<ProposalResponse> sendUpgradeProposal(UpgradeProposalRequest upgradeProposalRequest, Collection<Peer> peers)
throws InvalidArgumentException, ProposalException {
checkChannelState();
checkPeers(peers);
if (null == upgradeProposalRequest) {
throw new InvalidArgumentException("Upgradeproposal is null");
}
try {
TransactionContext transactionContext = getTransactionContext(upgradeProposalRequest.getUserContext());
//transactionContext.verify(false); // Install will have no signing cause it's not really targeted to a channel.
transactionContext.setProposalWaitTime(upgradeProposalRequest.getProposalWaitTime());
UpgradeProposalBuilder upgradeProposalBuilder = UpgradeProposalBuilder.newBuilder();
upgradeProposalBuilder.context(transactionContext);
upgradeProposalBuilder.argss(upgradeProposalRequest.getArgs());
upgradeProposalBuilder.chaincodeName(upgradeProposalRequest.getChaincodeName());
upgradeProposalBuilder.chaincodePath(upgradeProposalRequest.getChaincodePath());
upgradeProposalBuilder.chaincodeVersion(upgradeProposalRequest.getChaincodeVersion());
upgradeProposalBuilder.chaincodEndorsementPolicy(upgradeProposalRequest.getChaincodeEndorsementPolicy());
upgradeProposalBuilder.chaincodeCollectionConfiguration(upgradeProposalRequest.getChaincodeCollectionConfiguration());
SignedProposal signedProposal = getSignedProposal(transactionContext, upgradeProposalBuilder.build());
return sendProposalToPeers(peers, signedProposal, transactionContext);
} catch (Exception e) {
throw new ProposalException(e);
}
} | [
"public",
"Collection",
"<",
"ProposalResponse",
">",
"sendUpgradeProposal",
"(",
"UpgradeProposalRequest",
"upgradeProposalRequest",
",",
"Collection",
"<",
"Peer",
">",
"peers",
")",
"throws",
"InvalidArgumentException",
",",
"ProposalException",
"{",
"checkChannelState",
"(",
")",
";",
"checkPeers",
"(",
"peers",
")",
";",
"if",
"(",
"null",
"==",
"upgradeProposalRequest",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Upgradeproposal is null\"",
")",
";",
"}",
"try",
"{",
"TransactionContext",
"transactionContext",
"=",
"getTransactionContext",
"(",
"upgradeProposalRequest",
".",
"getUserContext",
"(",
")",
")",
";",
"//transactionContext.verify(false); // Install will have no signing cause it's not really targeted to a channel.",
"transactionContext",
".",
"setProposalWaitTime",
"(",
"upgradeProposalRequest",
".",
"getProposalWaitTime",
"(",
")",
")",
";",
"UpgradeProposalBuilder",
"upgradeProposalBuilder",
"=",
"UpgradeProposalBuilder",
".",
"newBuilder",
"(",
")",
";",
"upgradeProposalBuilder",
".",
"context",
"(",
"transactionContext",
")",
";",
"upgradeProposalBuilder",
".",
"argss",
"(",
"upgradeProposalRequest",
".",
"getArgs",
"(",
")",
")",
";",
"upgradeProposalBuilder",
".",
"chaincodeName",
"(",
"upgradeProposalRequest",
".",
"getChaincodeName",
"(",
")",
")",
";",
"upgradeProposalBuilder",
".",
"chaincodePath",
"(",
"upgradeProposalRequest",
".",
"getChaincodePath",
"(",
")",
")",
";",
"upgradeProposalBuilder",
".",
"chaincodeVersion",
"(",
"upgradeProposalRequest",
".",
"getChaincodeVersion",
"(",
")",
")",
";",
"upgradeProposalBuilder",
".",
"chaincodEndorsementPolicy",
"(",
"upgradeProposalRequest",
".",
"getChaincodeEndorsementPolicy",
"(",
")",
")",
";",
"upgradeProposalBuilder",
".",
"chaincodeCollectionConfiguration",
"(",
"upgradeProposalRequest",
".",
"getChaincodeCollectionConfiguration",
"(",
")",
")",
";",
"SignedProposal",
"signedProposal",
"=",
"getSignedProposal",
"(",
"transactionContext",
",",
"upgradeProposalBuilder",
".",
"build",
"(",
")",
")",
";",
"return",
"sendProposalToPeers",
"(",
"peers",
",",
"signedProposal",
",",
"transactionContext",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"ProposalException",
"(",
"e",
")",
";",
"}",
"}"
]
| Send Upgrade proposal proposal to upgrade chaincode to a new version.
@param upgradeProposalRequest
@param peers the specific peers to send to.
@return Collection of proposal responses.
@throws ProposalException
@throws InvalidArgumentException
@deprecated See new Lifecycle chaincode management. {@link Channel#sendLifecycleApproveChaincodeDefinitionForMyOrgProposal(LifecycleApproveChaincodeDefinitionForMyOrgRequest, Peer)} | [
"Send",
"Upgrade",
"proposal",
"proposal",
"to",
"upgrade",
"chaincode",
"to",
"a",
"new",
"version",
"."
]
| train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L2588-L2617 |
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/JobStepsInner.java | JobStepsInner.createOrUpdateAsync | public Observable<JobStepInner> createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner parameters) {
"""
Creates or updates a job step. This will implicitly create a new job version.
@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 jobAgentName The name of the job agent.
@param jobName The name of the job.
@param stepName The name of the job step.
@param parameters The requested state of the job step.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobStepInner object
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters).map(new Func1<ServiceResponse<JobStepInner>, JobStepInner>() {
@Override
public JobStepInner call(ServiceResponse<JobStepInner> response) {
return response.body();
}
});
} | java | public Observable<JobStepInner> createOrUpdateAsync(String resourceGroupName, String serverName, String jobAgentName, String jobName, String stepName, JobStepInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, stepName, parameters).map(new Func1<ServiceResponse<JobStepInner>, JobStepInner>() {
@Override
public JobStepInner call(ServiceResponse<JobStepInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobStepInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
",",
"String",
"jobName",
",",
"String",
"stepName",
",",
"JobStepInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"jobAgentName",
",",
"jobName",
",",
"stepName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"JobStepInner",
">",
",",
"JobStepInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"JobStepInner",
"call",
"(",
"ServiceResponse",
"<",
"JobStepInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Creates or updates a job step. This will implicitly create a new job version.
@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 jobAgentName The name of the job agent.
@param jobName The name of the job.
@param stepName The name of the job step.
@param parameters The requested state of the job step.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobStepInner object | [
"Creates",
"or",
"updates",
"a",
"job",
"step",
".",
"This",
"will",
"implicitly",
"create",
"a",
"new",
"job",
"version",
"."
]
| 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/JobStepsInner.java#L646-L653 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java | NotificationHubsInner.patchAsync | public Observable<NotificationHubResourceInner> patchAsync(String resourceGroupName, String namespaceName, String notificationHubName) {
"""
Patch a NotificationHub in a namespace.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@param notificationHubName The notification hub name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NotificationHubResourceInner object
"""
return patchWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<NotificationHubResourceInner>, NotificationHubResourceInner>() {
@Override
public NotificationHubResourceInner call(ServiceResponse<NotificationHubResourceInner> response) {
return response.body();
}
});
} | java | public Observable<NotificationHubResourceInner> patchAsync(String resourceGroupName, String namespaceName, String notificationHubName) {
return patchWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<NotificationHubResourceInner>, NotificationHubResourceInner>() {
@Override
public NotificationHubResourceInner call(ServiceResponse<NotificationHubResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NotificationHubResourceInner",
">",
"patchAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
",",
"String",
"notificationHubName",
")",
"{",
"return",
"patchWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"namespaceName",
",",
"notificationHubName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"NotificationHubResourceInner",
">",
",",
"NotificationHubResourceInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"NotificationHubResourceInner",
"call",
"(",
"ServiceResponse",
"<",
"NotificationHubResourceInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Patch a NotificationHub in a namespace.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@param notificationHubName The notification hub name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NotificationHubResourceInner object | [
"Patch",
"a",
"NotificationHub",
"in",
"a",
"namespace",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L372-L379 |
FINRAOS/DataGenerator | dg-common/src/main/java/org/finra/datagenerator/common/SocialNetwork_Example_Java/SocialNetworkUtilities.java | SocialNetworkUtilities.getDistanceBetweenCoordinates | public static Double getDistanceBetweenCoordinates(Tuple2<Double, Double> point1, Tuple2<Double, Double> point2) {
"""
Get distance between geographical coordinates
@param point1 Point1
@param point2 Point2
@return Distance (double)
"""
// sqrt( (x2-x1)^2 + (y2-y2)^2 )
Double xDiff = point1._1() - point2._1();
Double yDiff = point1._2() - point2._2();
return Math.sqrt(xDiff * xDiff + yDiff * yDiff);
} | java | public static Double getDistanceBetweenCoordinates(Tuple2<Double, Double> point1, Tuple2<Double, Double> point2) {
// sqrt( (x2-x1)^2 + (y2-y2)^2 )
Double xDiff = point1._1() - point2._1();
Double yDiff = point1._2() - point2._2();
return Math.sqrt(xDiff * xDiff + yDiff * yDiff);
} | [
"public",
"static",
"Double",
"getDistanceBetweenCoordinates",
"(",
"Tuple2",
"<",
"Double",
",",
"Double",
">",
"point1",
",",
"Tuple2",
"<",
"Double",
",",
"Double",
">",
"point2",
")",
"{",
"// sqrt( (x2-x1)^2 + (y2-y2)^2 )\r",
"Double",
"xDiff",
"=",
"point1",
".",
"_1",
"(",
")",
"-",
"point2",
".",
"_1",
"(",
")",
";",
"Double",
"yDiff",
"=",
"point1",
".",
"_2",
"(",
")",
"-",
"point2",
".",
"_2",
"(",
")",
";",
"return",
"Math",
".",
"sqrt",
"(",
"xDiff",
"*",
"xDiff",
"+",
"yDiff",
"*",
"yDiff",
")",
";",
"}"
]
| Get distance between geographical coordinates
@param point1 Point1
@param point2 Point2
@return Distance (double) | [
"Get",
"distance",
"between",
"geographical",
"coordinates"
]
| train | https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-common/src/main/java/org/finra/datagenerator/common/SocialNetwork_Example_Java/SocialNetworkUtilities.java#L60-L65 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/query/EnvKelp.java | EnvKelp.scanObjectInstance | private void scanObjectInstance(String type, String []fields, int fieldLen)
throws IOException {
"""
/*
private void scanMap(String type)
throws IOException
{
String key;
PathMapHessian pathMap = _pathMap;
while ((key = scanKey()) != null) {
PathHessian path = pathMap.get(key);
if (path != null) {
_pathMap = path.getPathMap();
path.scan(this, _values);
_pathMap = pathMap;
}
else {
skipObject();
}
}
}
"""
PathMapHessian pathMap = _pathMap;
for (int i = 0; i < fieldLen; i++) {
String key = fields[i];
PathHessian path = pathMap.get(key);
if (path == null) {
skipObject();
}
else {
_pathMap = path.getPathMap();
path.scan(this, _values);
_pathMap = pathMap;
}
}
} | java | private void scanObjectInstance(String type, String []fields, int fieldLen)
throws IOException
{
PathMapHessian pathMap = _pathMap;
for (int i = 0; i < fieldLen; i++) {
String key = fields[i];
PathHessian path = pathMap.get(key);
if (path == null) {
skipObject();
}
else {
_pathMap = path.getPathMap();
path.scan(this, _values);
_pathMap = pathMap;
}
}
} | [
"private",
"void",
"scanObjectInstance",
"(",
"String",
"type",
",",
"String",
"[",
"]",
"fields",
",",
"int",
"fieldLen",
")",
"throws",
"IOException",
"{",
"PathMapHessian",
"pathMap",
"=",
"_pathMap",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fieldLen",
";",
"i",
"++",
")",
"{",
"String",
"key",
"=",
"fields",
"[",
"i",
"]",
";",
"PathHessian",
"path",
"=",
"pathMap",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"skipObject",
"(",
")",
";",
"}",
"else",
"{",
"_pathMap",
"=",
"path",
".",
"getPathMap",
"(",
")",
";",
"path",
".",
"scan",
"(",
"this",
",",
"_values",
")",
";",
"_pathMap",
"=",
"pathMap",
";",
"}",
"}",
"}"
]
| /*
private void scanMap(String type)
throws IOException
{
String key;
PathMapHessian pathMap = _pathMap;
while ((key = scanKey()) != null) {
PathHessian path = pathMap.get(key);
if (path != null) {
_pathMap = path.getPathMap();
path.scan(this, _values);
_pathMap = pathMap;
}
else {
skipObject();
}
}
} | [
"/",
"*",
"private",
"void",
"scanMap",
"(",
"String",
"type",
")",
"throws",
"IOException",
"{",
"String",
"key",
";"
]
| train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/query/EnvKelp.java#L951-L972 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java | IPv6Address.toNormalizedString | public static String toNormalizedString(IPv6AddressNetwork network, SegmentValueProvider lowerValueProvider, SegmentValueProvider upperValueProvider, Integer prefixLength, CharSequence zone) {
"""
Creates the normalized string for an address without having to create the address objects first.
@param lowerValueProvider
@param upperValueProvider
@param prefixLength
@param zone
@param network use {@link #defaultIpv6Network()} if there is no custom network in use
@return
"""
return toNormalizedString(network.getPrefixConfiguration(), lowerValueProvider, upperValueProvider, prefixLength, SEGMENT_COUNT, BYTES_PER_SEGMENT, BITS_PER_SEGMENT, MAX_VALUE_PER_SEGMENT, SEGMENT_SEPARATOR, DEFAULT_TEXTUAL_RADIX, zone);
} | java | public static String toNormalizedString(IPv6AddressNetwork network, SegmentValueProvider lowerValueProvider, SegmentValueProvider upperValueProvider, Integer prefixLength, CharSequence zone) {
return toNormalizedString(network.getPrefixConfiguration(), lowerValueProvider, upperValueProvider, prefixLength, SEGMENT_COUNT, BYTES_PER_SEGMENT, BITS_PER_SEGMENT, MAX_VALUE_PER_SEGMENT, SEGMENT_SEPARATOR, DEFAULT_TEXTUAL_RADIX, zone);
} | [
"public",
"static",
"String",
"toNormalizedString",
"(",
"IPv6AddressNetwork",
"network",
",",
"SegmentValueProvider",
"lowerValueProvider",
",",
"SegmentValueProvider",
"upperValueProvider",
",",
"Integer",
"prefixLength",
",",
"CharSequence",
"zone",
")",
"{",
"return",
"toNormalizedString",
"(",
"network",
".",
"getPrefixConfiguration",
"(",
")",
",",
"lowerValueProvider",
",",
"upperValueProvider",
",",
"prefixLength",
",",
"SEGMENT_COUNT",
",",
"BYTES_PER_SEGMENT",
",",
"BITS_PER_SEGMENT",
",",
"MAX_VALUE_PER_SEGMENT",
",",
"SEGMENT_SEPARATOR",
",",
"DEFAULT_TEXTUAL_RADIX",
",",
"zone",
")",
";",
"}"
]
| Creates the normalized string for an address without having to create the address objects first.
@param lowerValueProvider
@param upperValueProvider
@param prefixLength
@param zone
@param network use {@link #defaultIpv6Network()} if there is no custom network in use
@return | [
"Creates",
"the",
"normalized",
"string",
"for",
"an",
"address",
"without",
"having",
"to",
"create",
"the",
"address",
"objects",
"first",
"."
]
| train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6Address.java#L1764-L1766 |
JOML-CI/JOML | src/org/joml/Quaternionf.java | Quaternionf.rotationAxis | public Quaternionf rotationAxis(AxisAngle4f axisAngle) {
"""
Set this {@link Quaternionf} to a rotation of the given angle in radians about the supplied
axis, all of which are specified via the {@link AxisAngle4f}.
@see #rotationAxis(float, float, float, float)
@param axisAngle
the {@link AxisAngle4f} giving the rotation angle in radians and the axis to rotate about
@return this
"""
return rotationAxis(axisAngle.angle, axisAngle.x, axisAngle.y, axisAngle.z);
} | java | public Quaternionf rotationAxis(AxisAngle4f axisAngle) {
return rotationAxis(axisAngle.angle, axisAngle.x, axisAngle.y, axisAngle.z);
} | [
"public",
"Quaternionf",
"rotationAxis",
"(",
"AxisAngle4f",
"axisAngle",
")",
"{",
"return",
"rotationAxis",
"(",
"axisAngle",
".",
"angle",
",",
"axisAngle",
".",
"x",
",",
"axisAngle",
".",
"y",
",",
"axisAngle",
".",
"z",
")",
";",
"}"
]
| Set this {@link Quaternionf} to a rotation of the given angle in radians about the supplied
axis, all of which are specified via the {@link AxisAngle4f}.
@see #rotationAxis(float, float, float, float)
@param axisAngle
the {@link AxisAngle4f} giving the rotation angle in radians and the axis to rotate about
@return this | [
"Set",
"this",
"{",
"@link",
"Quaternionf",
"}",
"to",
"a",
"rotation",
"of",
"the",
"given",
"angle",
"in",
"radians",
"about",
"the",
"supplied",
"axis",
"all",
"of",
"which",
"are",
"specified",
"via",
"the",
"{",
"@link",
"AxisAngle4f",
"}",
"."
]
| train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaternionf.java#L511-L513 |
iipc/webarchive-commons | src/main/java/org/archive/url/UsableURIFactory.java | UsableURIFactory.fixupAuthority | private String fixupAuthority(String uriAuthority, String charset) throws URIException {
"""
Fixup 'authority' portion of URI, by removing any stray
encoded spaces, lowercasing any domain names, and applying
IDN-punycoding to Unicode domains.
@param uriAuthority the authority string to fix
@return fixed version
@throws URIException
"""
// Lowercase the host part of the uriAuthority; don't destroy any
// userinfo capitalizations. Make sure no illegal characters in
// domainlabel substring of the uri authority.
if (uriAuthority != null) {
// Get rid of any trailing escaped spaces:
// http://www.archive.org%20. Rare but happens.
// TODO: reevaluate: do IE or firefox do such mid-URI space-removal?
// if not, we shouldn't either.
while(uriAuthority.endsWith(ESCAPED_SPACE)) {
uriAuthority = uriAuthority.substring(0,uriAuthority.length()-3);
}
// lowercase & IDN-punycode only the domain portion
int atIndex = uriAuthority.indexOf(COMMERCIAL_AT);
int portColonIndex = uriAuthority.indexOf(COLON,(atIndex<0)?0:atIndex);
if(atIndex<0 && portColonIndex<0) {
// most common case: neither userinfo nor port
return fixupDomainlabel(uriAuthority);
} else if (atIndex<0 && portColonIndex>-1) {
// next most common: port but no userinfo
String domain = fixupDomainlabel(uriAuthority.substring(0,portColonIndex));
String port = uriAuthority.substring(portColonIndex);
return domain + port;
} else if (atIndex>-1 && portColonIndex<0) {
// uncommon: userinfo, no port
String userinfo = ensureMinimalEscaping(uriAuthority.substring(0,atIndex+1),charset);
String domain = fixupDomainlabel(uriAuthority.substring(atIndex+1));
return userinfo + domain;
} else {
// uncommon: userinfo, port
String userinfo = ensureMinimalEscaping(uriAuthority.substring(0,atIndex+1),charset);
String domain = fixupDomainlabel(uriAuthority.substring(atIndex+1,portColonIndex));
String port = uriAuthority.substring(portColonIndex);
return userinfo + domain + port;
}
}
return uriAuthority;
} | java | private String fixupAuthority(String uriAuthority, String charset) throws URIException {
// Lowercase the host part of the uriAuthority; don't destroy any
// userinfo capitalizations. Make sure no illegal characters in
// domainlabel substring of the uri authority.
if (uriAuthority != null) {
// Get rid of any trailing escaped spaces:
// http://www.archive.org%20. Rare but happens.
// TODO: reevaluate: do IE or firefox do such mid-URI space-removal?
// if not, we shouldn't either.
while(uriAuthority.endsWith(ESCAPED_SPACE)) {
uriAuthority = uriAuthority.substring(0,uriAuthority.length()-3);
}
// lowercase & IDN-punycode only the domain portion
int atIndex = uriAuthority.indexOf(COMMERCIAL_AT);
int portColonIndex = uriAuthority.indexOf(COLON,(atIndex<0)?0:atIndex);
if(atIndex<0 && portColonIndex<0) {
// most common case: neither userinfo nor port
return fixupDomainlabel(uriAuthority);
} else if (atIndex<0 && portColonIndex>-1) {
// next most common: port but no userinfo
String domain = fixupDomainlabel(uriAuthority.substring(0,portColonIndex));
String port = uriAuthority.substring(portColonIndex);
return domain + port;
} else if (atIndex>-1 && portColonIndex<0) {
// uncommon: userinfo, no port
String userinfo = ensureMinimalEscaping(uriAuthority.substring(0,atIndex+1),charset);
String domain = fixupDomainlabel(uriAuthority.substring(atIndex+1));
return userinfo + domain;
} else {
// uncommon: userinfo, port
String userinfo = ensureMinimalEscaping(uriAuthority.substring(0,atIndex+1),charset);
String domain = fixupDomainlabel(uriAuthority.substring(atIndex+1,portColonIndex));
String port = uriAuthority.substring(portColonIndex);
return userinfo + domain + port;
}
}
return uriAuthority;
} | [
"private",
"String",
"fixupAuthority",
"(",
"String",
"uriAuthority",
",",
"String",
"charset",
")",
"throws",
"URIException",
"{",
"// Lowercase the host part of the uriAuthority; don't destroy any",
"// userinfo capitalizations. Make sure no illegal characters in",
"// domainlabel substring of the uri authority.",
"if",
"(",
"uriAuthority",
"!=",
"null",
")",
"{",
"// Get rid of any trailing escaped spaces:",
"// http://www.archive.org%20. Rare but happens.",
"// TODO: reevaluate: do IE or firefox do such mid-URI space-removal?",
"// if not, we shouldn't either. ",
"while",
"(",
"uriAuthority",
".",
"endsWith",
"(",
"ESCAPED_SPACE",
")",
")",
"{",
"uriAuthority",
"=",
"uriAuthority",
".",
"substring",
"(",
"0",
",",
"uriAuthority",
".",
"length",
"(",
")",
"-",
"3",
")",
";",
"}",
"// lowercase & IDN-punycode only the domain portion",
"int",
"atIndex",
"=",
"uriAuthority",
".",
"indexOf",
"(",
"COMMERCIAL_AT",
")",
";",
"int",
"portColonIndex",
"=",
"uriAuthority",
".",
"indexOf",
"(",
"COLON",
",",
"(",
"atIndex",
"<",
"0",
")",
"?",
"0",
":",
"atIndex",
")",
";",
"if",
"(",
"atIndex",
"<",
"0",
"&&",
"portColonIndex",
"<",
"0",
")",
"{",
"// most common case: neither userinfo nor port",
"return",
"fixupDomainlabel",
"(",
"uriAuthority",
")",
";",
"}",
"else",
"if",
"(",
"atIndex",
"<",
"0",
"&&",
"portColonIndex",
">",
"-",
"1",
")",
"{",
"// next most common: port but no userinfo",
"String",
"domain",
"=",
"fixupDomainlabel",
"(",
"uriAuthority",
".",
"substring",
"(",
"0",
",",
"portColonIndex",
")",
")",
";",
"String",
"port",
"=",
"uriAuthority",
".",
"substring",
"(",
"portColonIndex",
")",
";",
"return",
"domain",
"+",
"port",
";",
"}",
"else",
"if",
"(",
"atIndex",
">",
"-",
"1",
"&&",
"portColonIndex",
"<",
"0",
")",
"{",
"// uncommon: userinfo, no port",
"String",
"userinfo",
"=",
"ensureMinimalEscaping",
"(",
"uriAuthority",
".",
"substring",
"(",
"0",
",",
"atIndex",
"+",
"1",
")",
",",
"charset",
")",
";",
"String",
"domain",
"=",
"fixupDomainlabel",
"(",
"uriAuthority",
".",
"substring",
"(",
"atIndex",
"+",
"1",
")",
")",
";",
"return",
"userinfo",
"+",
"domain",
";",
"}",
"else",
"{",
"// uncommon: userinfo, port",
"String",
"userinfo",
"=",
"ensureMinimalEscaping",
"(",
"uriAuthority",
".",
"substring",
"(",
"0",
",",
"atIndex",
"+",
"1",
")",
",",
"charset",
")",
";",
"String",
"domain",
"=",
"fixupDomainlabel",
"(",
"uriAuthority",
".",
"substring",
"(",
"atIndex",
"+",
"1",
",",
"portColonIndex",
")",
")",
";",
"String",
"port",
"=",
"uriAuthority",
".",
"substring",
"(",
"portColonIndex",
")",
";",
"return",
"userinfo",
"+",
"domain",
"+",
"port",
";",
"}",
"}",
"return",
"uriAuthority",
";",
"}"
]
| Fixup 'authority' portion of URI, by removing any stray
encoded spaces, lowercasing any domain names, and applying
IDN-punycoding to Unicode domains.
@param uriAuthority the authority string to fix
@return fixed version
@throws URIException | [
"Fixup",
"authority",
"portion",
"of",
"URI",
"by",
"removing",
"any",
"stray",
"encoded",
"spaces",
"lowercasing",
"any",
"domain",
"names",
"and",
"applying",
"IDN",
"-",
"punycoding",
"to",
"Unicode",
"domains",
"."
]
| train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/url/UsableURIFactory.java#L545-L583 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/builder/patch/PatchedRuntimeEnvironmentBuilder.java | PatchedRuntimeEnvironmentBuilder.addEnvironmentEntry | public RuntimeEnvironmentBuilder addEnvironmentEntry(String name, Object value) {
"""
Adds an environmentEntry name/value pair.
@param name name
@param value value
@return this RuntimeEnvironmentBuilder
"""
if (name == null || value == null) {
return this;
}
_runtimeEnvironment.addToEnvironment(name, value);
return this;
} | java | public RuntimeEnvironmentBuilder addEnvironmentEntry(String name, Object value) {
if (name == null || value == null) {
return this;
}
_runtimeEnvironment.addToEnvironment(name, value);
return this;
} | [
"public",
"RuntimeEnvironmentBuilder",
"addEnvironmentEntry",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"value",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"_runtimeEnvironment",
".",
"addToEnvironment",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
]
| Adds an environmentEntry name/value pair.
@param name name
@param value value
@return this RuntimeEnvironmentBuilder | [
"Adds",
"an",
"environmentEntry",
"name",
"/",
"value",
"pair",
"."
]
| train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/builder/patch/PatchedRuntimeEnvironmentBuilder.java#L373-L380 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java | DocBookBuilder.createSubRootContainerXML | protected Element createSubRootContainerXML(final BuildData buildData, final Document doc, final Level container,
final String parentFileDirectory, final boolean flattenStructure) throws BuildProcessingException {
"""
Creates all the chapters/appendixes for a book that are contained within another part/chapter/appendix and generates the
section/topic data inside of each chapter.
@param buildData Information and data structures for the build.
@param doc The document object to add the child level content to.
@param container The level to build the chapter from.
@param parentFileDirectory The parent file location, so any files can be saved in a subdirectory of the parents location.
@param flattenStructure Whether or not the build should be flattened.
@return The Element that specifies the XiInclude for the chapter/appendix in the files.
@throws BuildProcessingException Thrown if an unexpected error occurs during building.
"""
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
// Get the name of the element based on the type
final String elementName = container.getLevelType() == LevelType.PROCESS ? "chapter" : container.getLevelType().getTitle()
.toLowerCase(Locale.ENGLISH);
Document chapter = null;
try {
chapter = XMLUtilities.convertStringToDocument("<" + elementName + "></" + elementName + ">");
} catch (Exception ex) {
// Exit since we shouldn't fail at converting a basic chapter
log.debug("", ex);
throw new BuildProcessingException(getMessages().getString("FAILED_CREATING_BASIC_TEMPLATE"));
}
// Create the title
final String chapterName = container.getUniqueLinkId(buildData.isUseFixedUrls());
final String chapterXMLName = chapterName + ".xml";
// Setup the title and id
setUpRootElement(buildData, container, chapter, chapter.getDocumentElement());
// Create and add the chapter/level contents
createContainerXML(buildData, container, chapter, chapter.getDocumentElement(), parentFileDirectory + chapterName + "/",
flattenStructure);
// Add the boiler plate text and add the chapter to the book
final String chapterString = DocBookBuildUtilities.convertDocumentToDocBookFormattedString(buildData.getDocBookVersion(), chapter,
elementName, buildData.getEntityFileName(), getXMLFormatProperties());
addToZip(buildData.getBookLocaleFolder() + chapterXMLName, chapterString, buildData);
// Create the XIncludes that will get set in the book.xml
final Element xiInclude = XMLUtilities.createXIInclude(doc, chapterXMLName);
return xiInclude;
} | java | protected Element createSubRootContainerXML(final BuildData buildData, final Document doc, final Level container,
final String parentFileDirectory, final boolean flattenStructure) throws BuildProcessingException {
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return null;
}
// Get the name of the element based on the type
final String elementName = container.getLevelType() == LevelType.PROCESS ? "chapter" : container.getLevelType().getTitle()
.toLowerCase(Locale.ENGLISH);
Document chapter = null;
try {
chapter = XMLUtilities.convertStringToDocument("<" + elementName + "></" + elementName + ">");
} catch (Exception ex) {
// Exit since we shouldn't fail at converting a basic chapter
log.debug("", ex);
throw new BuildProcessingException(getMessages().getString("FAILED_CREATING_BASIC_TEMPLATE"));
}
// Create the title
final String chapterName = container.getUniqueLinkId(buildData.isUseFixedUrls());
final String chapterXMLName = chapterName + ".xml";
// Setup the title and id
setUpRootElement(buildData, container, chapter, chapter.getDocumentElement());
// Create and add the chapter/level contents
createContainerXML(buildData, container, chapter, chapter.getDocumentElement(), parentFileDirectory + chapterName + "/",
flattenStructure);
// Add the boiler plate text and add the chapter to the book
final String chapterString = DocBookBuildUtilities.convertDocumentToDocBookFormattedString(buildData.getDocBookVersion(), chapter,
elementName, buildData.getEntityFileName(), getXMLFormatProperties());
addToZip(buildData.getBookLocaleFolder() + chapterXMLName, chapterString, buildData);
// Create the XIncludes that will get set in the book.xml
final Element xiInclude = XMLUtilities.createXIInclude(doc, chapterXMLName);
return xiInclude;
} | [
"protected",
"Element",
"createSubRootContainerXML",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"Document",
"doc",
",",
"final",
"Level",
"container",
",",
"final",
"String",
"parentFileDirectory",
",",
"final",
"boolean",
"flattenStructure",
")",
"throws",
"BuildProcessingException",
"{",
"// Check if the app should be shutdown",
"if",
"(",
"isShuttingDown",
".",
"get",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Get the name of the element based on the type",
"final",
"String",
"elementName",
"=",
"container",
".",
"getLevelType",
"(",
")",
"==",
"LevelType",
".",
"PROCESS",
"?",
"\"chapter\"",
":",
"container",
".",
"getLevelType",
"(",
")",
".",
"getTitle",
"(",
")",
".",
"toLowerCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"Document",
"chapter",
"=",
"null",
";",
"try",
"{",
"chapter",
"=",
"XMLUtilities",
".",
"convertStringToDocument",
"(",
"\"<\"",
"+",
"elementName",
"+",
"\"></\"",
"+",
"elementName",
"+",
"\">\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"// Exit since we shouldn't fail at converting a basic chapter",
"log",
".",
"debug",
"(",
"\"\"",
",",
"ex",
")",
";",
"throw",
"new",
"BuildProcessingException",
"(",
"getMessages",
"(",
")",
".",
"getString",
"(",
"\"FAILED_CREATING_BASIC_TEMPLATE\"",
")",
")",
";",
"}",
"// Create the title",
"final",
"String",
"chapterName",
"=",
"container",
".",
"getUniqueLinkId",
"(",
"buildData",
".",
"isUseFixedUrls",
"(",
")",
")",
";",
"final",
"String",
"chapterXMLName",
"=",
"chapterName",
"+",
"\".xml\"",
";",
"// Setup the title and id",
"setUpRootElement",
"(",
"buildData",
",",
"container",
",",
"chapter",
",",
"chapter",
".",
"getDocumentElement",
"(",
")",
")",
";",
"// Create and add the chapter/level contents",
"createContainerXML",
"(",
"buildData",
",",
"container",
",",
"chapter",
",",
"chapter",
".",
"getDocumentElement",
"(",
")",
",",
"parentFileDirectory",
"+",
"chapterName",
"+",
"\"/\"",
",",
"flattenStructure",
")",
";",
"// Add the boiler plate text and add the chapter to the book",
"final",
"String",
"chapterString",
"=",
"DocBookBuildUtilities",
".",
"convertDocumentToDocBookFormattedString",
"(",
"buildData",
".",
"getDocBookVersion",
"(",
")",
",",
"chapter",
",",
"elementName",
",",
"buildData",
".",
"getEntityFileName",
"(",
")",
",",
"getXMLFormatProperties",
"(",
")",
")",
";",
"addToZip",
"(",
"buildData",
".",
"getBookLocaleFolder",
"(",
")",
"+",
"chapterXMLName",
",",
"chapterString",
",",
"buildData",
")",
";",
"// Create the XIncludes that will get set in the book.xml",
"final",
"Element",
"xiInclude",
"=",
"XMLUtilities",
".",
"createXIInclude",
"(",
"doc",
",",
"chapterXMLName",
")",
";",
"return",
"xiInclude",
";",
"}"
]
| Creates all the chapters/appendixes for a book that are contained within another part/chapter/appendix and generates the
section/topic data inside of each chapter.
@param buildData Information and data structures for the build.
@param doc The document object to add the child level content to.
@param container The level to build the chapter from.
@param parentFileDirectory The parent file location, so any files can be saved in a subdirectory of the parents location.
@param flattenStructure Whether or not the build should be flattened.
@return The Element that specifies the XiInclude for the chapter/appendix in the files.
@throws BuildProcessingException Thrown if an unexpected error occurs during building. | [
"Creates",
"all",
"the",
"chapters",
"/",
"appendixes",
"for",
"a",
"book",
"that",
"are",
"contained",
"within",
"another",
"part",
"/",
"chapter",
"/",
"appendix",
"and",
"generates",
"the",
"section",
"/",
"topic",
"data",
"inside",
"of",
"each",
"chapter",
"."
]
| train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L2304-L2344 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/utils/BoxDateFormat.java | BoxDateFormat.getTimeRangeString | public static String getTimeRangeString(Date fromDate, Date toDate) {
"""
Get a String to represent a time range.
@param fromDate can use null if don't want to specify this.
@param toDate can use null if don't want to specify this.
@return The string will be time strings separated by a comma.
Trailing "from_date," and leading ",to_date" are also accepted if one of the date is null.
Returns null if both dates are null.
"""
if (fromDate == null && toDate == null) {
return null;
}
StringBuilder sbr = new StringBuilder();
if (fromDate != null) {
sbr.append(format(fromDate));
}
sbr.append(",");
if (toDate != null) {
sbr.append(format(toDate));
}
return sbr.toString();
} | java | public static String getTimeRangeString(Date fromDate, Date toDate) {
if (fromDate == null && toDate == null) {
return null;
}
StringBuilder sbr = new StringBuilder();
if (fromDate != null) {
sbr.append(format(fromDate));
}
sbr.append(",");
if (toDate != null) {
sbr.append(format(toDate));
}
return sbr.toString();
} | [
"public",
"static",
"String",
"getTimeRangeString",
"(",
"Date",
"fromDate",
",",
"Date",
"toDate",
")",
"{",
"if",
"(",
"fromDate",
"==",
"null",
"&&",
"toDate",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringBuilder",
"sbr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"fromDate",
"!=",
"null",
")",
"{",
"sbr",
".",
"append",
"(",
"format",
"(",
"fromDate",
")",
")",
";",
"}",
"sbr",
".",
"append",
"(",
"\",\"",
")",
";",
"if",
"(",
"toDate",
"!=",
"null",
")",
"{",
"sbr",
".",
"append",
"(",
"format",
"(",
"toDate",
")",
")",
";",
"}",
"return",
"sbr",
".",
"toString",
"(",
")",
";",
"}"
]
| Get a String to represent a time range.
@param fromDate can use null if don't want to specify this.
@param toDate can use null if don't want to specify this.
@return The string will be time strings separated by a comma.
Trailing "from_date," and leading ",to_date" are also accepted if one of the date is null.
Returns null if both dates are null. | [
"Get",
"a",
"String",
"to",
"represent",
"a",
"time",
"range",
"."
]
| train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/BoxDateFormat.java#L114-L128 |
d-sauer/JCalcAPI | src/main/java/org/jdice/calc/internal/CacheExtension.java | CacheExtension.setNumConverter | public static NumConverter setNumConverter(Class customClass, NumConverter converter) {
"""
Register custom converter class on global scope.
@param customClass define class type for conversion
@param converter define instance which knows how to convert <tt>customClass</tt>
"""
converterCache.put(customClass, converter);
return converter;
} | java | public static NumConverter setNumConverter(Class customClass, NumConverter converter) {
converterCache.put(customClass, converter);
return converter;
} | [
"public",
"static",
"NumConverter",
"setNumConverter",
"(",
"Class",
"customClass",
",",
"NumConverter",
"converter",
")",
"{",
"converterCache",
".",
"put",
"(",
"customClass",
",",
"converter",
")",
";",
"return",
"converter",
";",
"}"
]
| Register custom converter class on global scope.
@param customClass define class type for conversion
@param converter define instance which knows how to convert <tt>customClass</tt> | [
"Register",
"custom",
"converter",
"class",
"on",
"global",
"scope",
"."
]
| train | https://github.com/d-sauer/JCalcAPI/blob/36ae1f9adfe611a6f1bd8ef87cf1dc0ec88ac035/src/main/java/org/jdice/calc/internal/CacheExtension.java#L117-L120 |
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.listUsagesAsync | public Observable<Page<CsmUsageQuotaInner>> listUsagesAsync(final String resourceGroupName, final String name, final String filter) {
"""
Gets server farm usage information.
Gets server farm usage information.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of App Service Plan
@param filter Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2').
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CsmUsageQuotaInner> object
"""
return listUsagesWithServiceResponseAsync(resourceGroupName, name, filter)
.map(new Func1<ServiceResponse<Page<CsmUsageQuotaInner>>, Page<CsmUsageQuotaInner>>() {
@Override
public Page<CsmUsageQuotaInner> call(ServiceResponse<Page<CsmUsageQuotaInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<CsmUsageQuotaInner>> listUsagesAsync(final String resourceGroupName, final String name, final String filter) {
return listUsagesWithServiceResponseAsync(resourceGroupName, name, filter)
.map(new Func1<ServiceResponse<Page<CsmUsageQuotaInner>>, Page<CsmUsageQuotaInner>>() {
@Override
public Page<CsmUsageQuotaInner> call(ServiceResponse<Page<CsmUsageQuotaInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"CsmUsageQuotaInner",
">",
">",
"listUsagesAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"String",
"filter",
")",
"{",
"return",
"listUsagesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"filter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"CsmUsageQuotaInner",
">",
">",
",",
"Page",
"<",
"CsmUsageQuotaInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"CsmUsageQuotaInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"CsmUsageQuotaInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Gets server farm usage information.
Gets server farm usage information.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of App Service Plan
@param filter Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2').
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CsmUsageQuotaInner> object | [
"Gets",
"server",
"farm",
"usage",
"information",
".",
"Gets",
"server",
"farm",
"usage",
"information",
"."
]
| 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#L2895-L2903 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/routing/util/AbstractFlagEncoder.java | AbstractFlagEncoder.setSpeed | protected void setSpeed(boolean reverse, IntsRef edgeFlags, double speed) {
"""
Most use cases do not require this method. Will still keep it accessible so that one can disable it
until the averageSpeedEncodedValue is moved out of the FlagEncoder.
@Deprecated
"""
if (speed < 0 || Double.isNaN(speed))
throw new IllegalArgumentException("Speed cannot be negative or NaN: " + speed + ", flags:" + BitUtil.LITTLE.toBitString(edgeFlags));
if (speed < speedFactor / 2) {
speedEncoder.setDecimal(reverse, edgeFlags, 0);
accessEnc.setBool(reverse, edgeFlags, false);
return;
}
if (speed > getMaxSpeed())
speed = getMaxSpeed();
speedEncoder.setDecimal(reverse, edgeFlags, speed);
} | java | protected void setSpeed(boolean reverse, IntsRef edgeFlags, double speed) {
if (speed < 0 || Double.isNaN(speed))
throw new IllegalArgumentException("Speed cannot be negative or NaN: " + speed + ", flags:" + BitUtil.LITTLE.toBitString(edgeFlags));
if (speed < speedFactor / 2) {
speedEncoder.setDecimal(reverse, edgeFlags, 0);
accessEnc.setBool(reverse, edgeFlags, false);
return;
}
if (speed > getMaxSpeed())
speed = getMaxSpeed();
speedEncoder.setDecimal(reverse, edgeFlags, speed);
} | [
"protected",
"void",
"setSpeed",
"(",
"boolean",
"reverse",
",",
"IntsRef",
"edgeFlags",
",",
"double",
"speed",
")",
"{",
"if",
"(",
"speed",
"<",
"0",
"||",
"Double",
".",
"isNaN",
"(",
"speed",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Speed cannot be negative or NaN: \"",
"+",
"speed",
"+",
"\", flags:\"",
"+",
"BitUtil",
".",
"LITTLE",
".",
"toBitString",
"(",
"edgeFlags",
")",
")",
";",
"if",
"(",
"speed",
"<",
"speedFactor",
"/",
"2",
")",
"{",
"speedEncoder",
".",
"setDecimal",
"(",
"reverse",
",",
"edgeFlags",
",",
"0",
")",
";",
"accessEnc",
".",
"setBool",
"(",
"reverse",
",",
"edgeFlags",
",",
"false",
")",
";",
"return",
";",
"}",
"if",
"(",
"speed",
">",
"getMaxSpeed",
"(",
")",
")",
"speed",
"=",
"getMaxSpeed",
"(",
")",
";",
"speedEncoder",
".",
"setDecimal",
"(",
"reverse",
",",
"edgeFlags",
",",
"speed",
")",
";",
"}"
]
| Most use cases do not require this method. Will still keep it accessible so that one can disable it
until the averageSpeedEncodedValue is moved out of the FlagEncoder.
@Deprecated | [
"Most",
"use",
"cases",
"do",
"not",
"require",
"this",
"method",
".",
"Will",
"still",
"keep",
"it",
"accessible",
"so",
"that",
"one",
"can",
"disable",
"it",
"until",
"the",
"averageSpeedEncodedValue",
"is",
"moved",
"out",
"of",
"the",
"FlagEncoder",
"."
]
| train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/util/AbstractFlagEncoder.java#L540-L554 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/component/SeaGlassIcon.java | SeaGlassIcon.getIconHeight | @Override
public int getIconHeight(SynthContext context) {
"""
Returns the icon's height. This is a cover method for <code>
getIconHeight(null)</code>.
@param context the SynthContext describing the component/region, the
style, and the state.
@return an int specifying the fixed height of the icon.
"""
if (context == null) {
return height;
}
JComponent c = context.getComponent();
if (c instanceof JToolBar) {
JToolBar toolbar = (JToolBar) c;
if (toolbar.getOrientation() == JToolBar.HORIZONTAL) {
// we only do the -1 hack for UIResource borders, assuming
// that the border is probably going to be our border
if (toolbar.getBorder() instanceof UIResource) {
return c.getHeight() - 1;
} else {
return c.getHeight();
}
} else {
return scale(context, width);
}
} else {
return scale(context, height);
}
} | java | @Override
public int getIconHeight(SynthContext context) {
if (context == null) {
return height;
}
JComponent c = context.getComponent();
if (c instanceof JToolBar) {
JToolBar toolbar = (JToolBar) c;
if (toolbar.getOrientation() == JToolBar.HORIZONTAL) {
// we only do the -1 hack for UIResource borders, assuming
// that the border is probably going to be our border
if (toolbar.getBorder() instanceof UIResource) {
return c.getHeight() - 1;
} else {
return c.getHeight();
}
} else {
return scale(context, width);
}
} else {
return scale(context, height);
}
} | [
"@",
"Override",
"public",
"int",
"getIconHeight",
"(",
"SynthContext",
"context",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"return",
"height",
";",
"}",
"JComponent",
"c",
"=",
"context",
".",
"getComponent",
"(",
")",
";",
"if",
"(",
"c",
"instanceof",
"JToolBar",
")",
"{",
"JToolBar",
"toolbar",
"=",
"(",
"JToolBar",
")",
"c",
";",
"if",
"(",
"toolbar",
".",
"getOrientation",
"(",
")",
"==",
"JToolBar",
".",
"HORIZONTAL",
")",
"{",
"// we only do the -1 hack for UIResource borders, assuming",
"// that the border is probably going to be our border",
"if",
"(",
"toolbar",
".",
"getBorder",
"(",
")",
"instanceof",
"UIResource",
")",
"{",
"return",
"c",
".",
"getHeight",
"(",
")",
"-",
"1",
";",
"}",
"else",
"{",
"return",
"c",
".",
"getHeight",
"(",
")",
";",
"}",
"}",
"else",
"{",
"return",
"scale",
"(",
"context",
",",
"width",
")",
";",
"}",
"}",
"else",
"{",
"return",
"scale",
"(",
"context",
",",
"height",
")",
";",
"}",
"}"
]
| Returns the icon's height. This is a cover method for <code>
getIconHeight(null)</code>.
@param context the SynthContext describing the component/region, the
style, and the state.
@return an int specifying the fixed height of the icon. | [
"Returns",
"the",
"icon",
"s",
"height",
".",
"This",
"is",
"a",
"cover",
"method",
"for",
"<code",
">",
"getIconHeight",
"(",
"null",
")",
"<",
"/",
"code",
">",
"."
]
| train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassIcon.java#L241-L267 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuGraphNodeGetDependentNodes | public static int cuGraphNodeGetDependentNodes(CUgraphNode hNode, CUgraphNode dependentNodes[], long numDependentNodes[]) {
"""
Returns a node's dependent nodes.<br>
<br>
Returns a list of \p node's dependent nodes. \p dependentNodes may be NULL, in which
case this function will return the number of dependent nodes in \p numDependentNodes.
Otherwise, \p numDependentNodes entries will be filled in. If \p numDependentNodes is
higher than the actual number of dependent nodes, the remaining entries in
\p dependentNodes will be set to NULL, and the number of nodes actually obtained will
be returned in \p numDependentNodes.
@param hNode - Node to query
@param dependentNodes - Pointer to return the dependent nodes
@param numDependentNodes - See description
@return
CUDA_SUCCESS,
CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_VALUE
@see
JCudaDriver#cuGraphNodeGetDependencies
JCudaDriver#cuGraphGetNodes
JCudaDriver#cuGraphGetRootNodes
JCudaDriver#cuGraphGetEdges
JCudaDriver#cuGraphAddDependencies
JCudaDriver#cuGraphRemoveDependencies
"""
return checkResult(cuGraphNodeGetDependentNodesNative(hNode, dependentNodes, numDependentNodes));
} | java | public static int cuGraphNodeGetDependentNodes(CUgraphNode hNode, CUgraphNode dependentNodes[], long numDependentNodes[])
{
return checkResult(cuGraphNodeGetDependentNodesNative(hNode, dependentNodes, numDependentNodes));
} | [
"public",
"static",
"int",
"cuGraphNodeGetDependentNodes",
"(",
"CUgraphNode",
"hNode",
",",
"CUgraphNode",
"dependentNodes",
"[",
"]",
",",
"long",
"numDependentNodes",
"[",
"]",
")",
"{",
"return",
"checkResult",
"(",
"cuGraphNodeGetDependentNodesNative",
"(",
"hNode",
",",
"dependentNodes",
",",
"numDependentNodes",
")",
")",
";",
"}"
]
| Returns a node's dependent nodes.<br>
<br>
Returns a list of \p node's dependent nodes. \p dependentNodes may be NULL, in which
case this function will return the number of dependent nodes in \p numDependentNodes.
Otherwise, \p numDependentNodes entries will be filled in. If \p numDependentNodes is
higher than the actual number of dependent nodes, the remaining entries in
\p dependentNodes will be set to NULL, and the number of nodes actually obtained will
be returned in \p numDependentNodes.
@param hNode - Node to query
@param dependentNodes - Pointer to return the dependent nodes
@param numDependentNodes - See description
@return
CUDA_SUCCESS,
CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_VALUE
@see
JCudaDriver#cuGraphNodeGetDependencies
JCudaDriver#cuGraphGetNodes
JCudaDriver#cuGraphGetRootNodes
JCudaDriver#cuGraphGetEdges
JCudaDriver#cuGraphAddDependencies
JCudaDriver#cuGraphRemoveDependencies | [
"Returns",
"a",
"node",
"s",
"dependent",
"nodes",
".",
"<br",
">",
"<br",
">",
"Returns",
"a",
"list",
"of",
"\\",
"p",
"node",
"s",
"dependent",
"nodes",
".",
"\\",
"p",
"dependentNodes",
"may",
"be",
"NULL",
"in",
"which",
"case",
"this",
"function",
"will",
"return",
"the",
"number",
"of",
"dependent",
"nodes",
"in",
"\\",
"p",
"numDependentNodes",
".",
"Otherwise",
"\\",
"p",
"numDependentNodes",
"entries",
"will",
"be",
"filled",
"in",
".",
"If",
"\\",
"p",
"numDependentNodes",
"is",
"higher",
"than",
"the",
"actual",
"number",
"of",
"dependent",
"nodes",
"the",
"remaining",
"entries",
"in",
"\\",
"p",
"dependentNodes",
"will",
"be",
"set",
"to",
"NULL",
"and",
"the",
"number",
"of",
"nodes",
"actually",
"obtained",
"will",
"be",
"returned",
"in",
"\\",
"p",
"numDependentNodes",
"."
]
| train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L12816-L12819 |
fuinorg/srcgen4javassist | src/main/java/org/fuin/srcgen4javassist/SgUtils.java | SgUtils.concatPackages | public static String concatPackages(final String package1, final String package2) {
"""
Merge two packages into one. If any package is null or empty no "." will
be added. If both packages are null an empty string will be returned.
@param package1
First package - Can also be null or empty.
@param package2
Second package - Can also be null or empty.
@return Both packages added with ".".
"""
if ((package1 == null) || (package1.length() == 0)) {
if ((package2 == null) || (package2.length() == 0)) {
return "";
} else {
return package2;
}
} else {
if ((package2 == null) || (package2.length() == 0)) {
return package1;
} else {
return package1 + "." + package2;
}
}
} | java | public static String concatPackages(final String package1, final String package2) {
if ((package1 == null) || (package1.length() == 0)) {
if ((package2 == null) || (package2.length() == 0)) {
return "";
} else {
return package2;
}
} else {
if ((package2 == null) || (package2.length() == 0)) {
return package1;
} else {
return package1 + "." + package2;
}
}
} | [
"public",
"static",
"String",
"concatPackages",
"(",
"final",
"String",
"package1",
",",
"final",
"String",
"package2",
")",
"{",
"if",
"(",
"(",
"package1",
"==",
"null",
")",
"||",
"(",
"package1",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"if",
"(",
"(",
"package2",
"==",
"null",
")",
"||",
"(",
"package2",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"else",
"{",
"return",
"package2",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"(",
"package2",
"==",
"null",
")",
"||",
"(",
"package2",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"return",
"package1",
";",
"}",
"else",
"{",
"return",
"package1",
"+",
"\".\"",
"+",
"package2",
";",
"}",
"}",
"}"
]
| Merge two packages into one. If any package is null or empty no "." will
be added. If both packages are null an empty string will be returned.
@param package1
First package - Can also be null or empty.
@param package2
Second package - Can also be null or empty.
@return Both packages added with ".". | [
"Merge",
"two",
"packages",
"into",
"one",
".",
"If",
"any",
"package",
"is",
"null",
"or",
"empty",
"no",
".",
"will",
"be",
"added",
".",
"If",
"both",
"packages",
"are",
"null",
"an",
"empty",
"string",
"will",
"be",
"returned",
"."
]
| train | https://github.com/fuinorg/srcgen4javassist/blob/355828113cfce3cdd3d69ba242c5bdfc7d899f2f/src/main/java/org/fuin/srcgen4javassist/SgUtils.java#L329-L343 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ListTemplateBuilder.java | ListTemplateBuilder.addQuickReply | public ListTemplateBuilder addQuickReply(String title, String payload) {
"""
Adds a {@link QuickReply} to the current object.
@param title
the quick reply button label. It can't be empty.
@param payload
the payload sent back when the button is pressed. It can't be
empty.
@return this builder.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
> Facebook's Messenger Platform Quick Replies Documentation</a>
"""
this.messageBuilder.addQuickReply(title, payload);
return this;
} | java | public ListTemplateBuilder addQuickReply(String title, String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | [
"public",
"ListTemplateBuilder",
"addQuickReply",
"(",
"String",
"title",
",",
"String",
"payload",
")",
"{",
"this",
".",
"messageBuilder",
".",
"addQuickReply",
"(",
"title",
",",
"payload",
")",
";",
"return",
"this",
";",
"}"
]
| Adds a {@link QuickReply} to the current object.
@param title
the quick reply button label. It can't be empty.
@param payload
the payload sent back when the button is pressed. It can't be
empty.
@return this builder.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
> Facebook's Messenger Platform Quick Replies Documentation</a> | [
"Adds",
"a",
"{",
"@link",
"QuickReply",
"}",
"to",
"the",
"current",
"object",
"."
]
| train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ListTemplateBuilder.java#L127-L130 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/service/AbstractLazyService.java | AbstractLazyService.sendAndFlushWhenConnected | private static void sendAndFlushWhenConnected(final Endpoint endpoint, final CouchbaseRequest request) {
"""
Helper method to send the request and also a flush afterwards.
@param endpoint the endpoint to send the reques to.
@param request the reques to send.
"""
whenState(endpoint, LifecycleState.CONNECTED, new Action1<LifecycleState>() {
@Override
public void call(LifecycleState lifecycleState) {
endpoint.send(request);
endpoint.send(SignalFlush.INSTANCE);
}
});
} | java | private static void sendAndFlushWhenConnected(final Endpoint endpoint, final CouchbaseRequest request) {
whenState(endpoint, LifecycleState.CONNECTED, new Action1<LifecycleState>() {
@Override
public void call(LifecycleState lifecycleState) {
endpoint.send(request);
endpoint.send(SignalFlush.INSTANCE);
}
});
} | [
"private",
"static",
"void",
"sendAndFlushWhenConnected",
"(",
"final",
"Endpoint",
"endpoint",
",",
"final",
"CouchbaseRequest",
"request",
")",
"{",
"whenState",
"(",
"endpoint",
",",
"LifecycleState",
".",
"CONNECTED",
",",
"new",
"Action1",
"<",
"LifecycleState",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"call",
"(",
"LifecycleState",
"lifecycleState",
")",
"{",
"endpoint",
".",
"send",
"(",
"request",
")",
";",
"endpoint",
".",
"send",
"(",
"SignalFlush",
".",
"INSTANCE",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Helper method to send the request and also a flush afterwards.
@param endpoint the endpoint to send the reques to.
@param request the reques to send. | [
"Helper",
"method",
"to",
"send",
"the",
"request",
"and",
"also",
"a",
"flush",
"afterwards",
"."
]
| train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/service/AbstractLazyService.java#L98-L106 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java | MeasureFormat.getInstance | public static MeasureFormat getInstance(Locale locale, FormatWidth formatWidth, NumberFormat format) {
"""
Create a format from the {@link java.util.Locale}, formatWidth, and format.
@param locale the {@link java.util.Locale}.
@param formatWidth hints how long formatted strings should be.
@param format This is defensively copied.
@return The new MeasureFormat object.
"""
return getInstance(ULocale.forLocale(locale), formatWidth, format);
} | java | public static MeasureFormat getInstance(Locale locale, FormatWidth formatWidth, NumberFormat format) {
return getInstance(ULocale.forLocale(locale), formatWidth, format);
} | [
"public",
"static",
"MeasureFormat",
"getInstance",
"(",
"Locale",
"locale",
",",
"FormatWidth",
"formatWidth",
",",
"NumberFormat",
"format",
")",
"{",
"return",
"getInstance",
"(",
"ULocale",
".",
"forLocale",
"(",
"locale",
")",
",",
"formatWidth",
",",
"format",
")",
";",
"}"
]
| Create a format from the {@link java.util.Locale}, formatWidth, and format.
@param locale the {@link java.util.Locale}.
@param formatWidth hints how long formatted strings should be.
@param format This is defensively copied.
@return The new MeasureFormat object. | [
"Create",
"a",
"format",
"from",
"the",
"{",
"@link",
"java",
".",
"util",
".",
"Locale",
"}",
"formatWidth",
"and",
"format",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L273-L275 |
matthewhorridge/binaryowl | src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java | BinaryOWLMetadata.setValue | private <O> void setValue(Map<String, O> nameValueMap, String name, O value) {
"""
Sets the value of an attribute.
@param nameValueMap A map which maps attribute names to attribute values.
@param name The name of the attribute. Not null.
@param value The value of the attribute. Not null.
@throws NullPointerException if name is null, or value is null.
"""
checkForNull(name, value);
nameValueMap.put(name, value);
} | java | private <O> void setValue(Map<String, O> nameValueMap, String name, O value) {
checkForNull(name, value);
nameValueMap.put(name, value);
} | [
"private",
"<",
"O",
">",
"void",
"setValue",
"(",
"Map",
"<",
"String",
",",
"O",
">",
"nameValueMap",
",",
"String",
"name",
",",
"O",
"value",
")",
"{",
"checkForNull",
"(",
"name",
",",
"value",
")",
";",
"nameValueMap",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}"
]
| Sets the value of an attribute.
@param nameValueMap A map which maps attribute names to attribute values.
@param name The name of the attribute. Not null.
@param value The value of the attribute. Not null.
@throws NullPointerException if name is null, or value is null. | [
"Sets",
"the",
"value",
"of",
"an",
"attribute",
"."
]
| train | https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L148-L151 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/TranStrategy.java | TranStrategy.beginGlobalTx | final void beginGlobalTx(EJBKey key, EJBMethodInfoImpl methodInfo)
throws CSIException {
"""
/*
This utility attempts to begin a new global transaction. If the
begin fails an exception consistent with the EJB exception
conventions is thrown.
"""
//d135218 - removed check which assures that EJB 2.0 beans with
// sticky local transactions do not try to become involved
// in multiple transactions simultaneously. This is checked
// during activation now.
try {
// d201891 global tx set time out value is now done by the tx service
// during begin processing.
txCtrl.txService.begin();
svUOWSynchReg.putResource("com.ibm.websphere.profile", // d458031
methodInfo.getJPATaskName()); // d515803
if (TraceComponent.isAnyTracingEnabled()) // d527372
{
if (tc.isEventEnabled())
{
Tr.event(tc, "Began TX cntxt: " + txCtrl.txService.getTransaction()); //LIDB1673.2.1.5
Tr.event(tc, "Set JPA task name: " + methodInfo.getJPATaskName());
}
// d165585 Begins
if (TETxLifeCycleInfo.isTraceEnabled()) // PQ74774
{ // PQ74774
String idStr = txCtrl.txService.getTransaction().toString();
int idx;
idStr = (idStr != null)
? (((idx = idStr.indexOf("(")) != -1)
? idStr.substring(idx + 1, idStr.indexOf(")"))
: ((idx = idStr.indexOf("tid=")) != -1)
? idStr.substring(idx + 4)
: idStr)
: "NoTx";
TETxLifeCycleInfo.traceGlobalTxBegin(idStr, "Begin Global Tx");
} // PQ74774
// d165585 Ends
}
} catch (Exception ex) {
FFDCFilter.processException(ex, CLASS_NAME + ".beginGlobalTx", "243", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Begin global tx failed", ex);
}
throw new CSIException("Begin global tx failed", ex);
}
} | java | final void beginGlobalTx(EJBKey key, EJBMethodInfoImpl methodInfo)
throws CSIException
{
//d135218 - removed check which assures that EJB 2.0 beans with
// sticky local transactions do not try to become involved
// in multiple transactions simultaneously. This is checked
// during activation now.
try {
// d201891 global tx set time out value is now done by the tx service
// during begin processing.
txCtrl.txService.begin();
svUOWSynchReg.putResource("com.ibm.websphere.profile", // d458031
methodInfo.getJPATaskName()); // d515803
if (TraceComponent.isAnyTracingEnabled()) // d527372
{
if (tc.isEventEnabled())
{
Tr.event(tc, "Began TX cntxt: " + txCtrl.txService.getTransaction()); //LIDB1673.2.1.5
Tr.event(tc, "Set JPA task name: " + methodInfo.getJPATaskName());
}
// d165585 Begins
if (TETxLifeCycleInfo.isTraceEnabled()) // PQ74774
{ // PQ74774
String idStr = txCtrl.txService.getTransaction().toString();
int idx;
idStr = (idStr != null)
? (((idx = idStr.indexOf("(")) != -1)
? idStr.substring(idx + 1, idStr.indexOf(")"))
: ((idx = idStr.indexOf("tid=")) != -1)
? idStr.substring(idx + 4)
: idStr)
: "NoTx";
TETxLifeCycleInfo.traceGlobalTxBegin(idStr, "Begin Global Tx");
} // PQ74774
// d165585 Ends
}
} catch (Exception ex) {
FFDCFilter.processException(ex, CLASS_NAME + ".beginGlobalTx", "243", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Begin global tx failed", ex);
}
throw new CSIException("Begin global tx failed", ex);
}
} | [
"final",
"void",
"beginGlobalTx",
"(",
"EJBKey",
"key",
",",
"EJBMethodInfoImpl",
"methodInfo",
")",
"throws",
"CSIException",
"{",
"//d135218 - removed check which assures that EJB 2.0 beans with",
"// sticky local transactions do not try to become involved",
"// in multiple transactions simultaneously. This is checked",
"// during activation now.",
"try",
"{",
"// d201891 global tx set time out value is now done by the tx service",
"// during begin processing.",
"txCtrl",
".",
"txService",
".",
"begin",
"(",
")",
";",
"svUOWSynchReg",
".",
"putResource",
"(",
"\"com.ibm.websphere.profile\"",
",",
"// d458031",
"methodInfo",
".",
"getJPATaskName",
"(",
")",
")",
";",
"// d515803",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
")",
"// d527372",
"{",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Began TX cntxt: \"",
"+",
"txCtrl",
".",
"txService",
".",
"getTransaction",
"(",
")",
")",
";",
"//LIDB1673.2.1.5",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Set JPA task name: \"",
"+",
"methodInfo",
".",
"getJPATaskName",
"(",
")",
")",
";",
"}",
"// d165585 Begins",
"if",
"(",
"TETxLifeCycleInfo",
".",
"isTraceEnabled",
"(",
")",
")",
"// PQ74774",
"{",
"// PQ74774",
"String",
"idStr",
"=",
"txCtrl",
".",
"txService",
".",
"getTransaction",
"(",
")",
".",
"toString",
"(",
")",
";",
"int",
"idx",
";",
"idStr",
"=",
"(",
"idStr",
"!=",
"null",
")",
"?",
"(",
"(",
"(",
"idx",
"=",
"idStr",
".",
"indexOf",
"(",
"\"(\"",
")",
")",
"!=",
"-",
"1",
")",
"?",
"idStr",
".",
"substring",
"(",
"idx",
"+",
"1",
",",
"idStr",
".",
"indexOf",
"(",
"\")\"",
")",
")",
":",
"(",
"(",
"idx",
"=",
"idStr",
".",
"indexOf",
"(",
"\"tid=\"",
")",
")",
"!=",
"-",
"1",
")",
"?",
"idStr",
".",
"substring",
"(",
"idx",
"+",
"4",
")",
":",
"idStr",
")",
":",
"\"NoTx\"",
";",
"TETxLifeCycleInfo",
".",
"traceGlobalTxBegin",
"(",
"idStr",
",",
"\"Begin Global Tx\"",
")",
";",
"}",
"// PQ74774",
"// d165585 Ends",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"FFDCFilter",
".",
"processException",
"(",
"ex",
",",
"CLASS_NAME",
"+",
"\".beginGlobalTx\"",
",",
"\"243\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Begin global tx failed\"",
",",
"ex",
")",
";",
"}",
"throw",
"new",
"CSIException",
"(",
"\"Begin global tx failed\"",
",",
"ex",
")",
";",
"}",
"}"
]
| /*
This utility attempts to begin a new global transaction. If the
begin fails an exception consistent with the EJB exception
conventions is thrown. | [
"/",
"*",
"This",
"utility",
"attempts",
"to",
"begin",
"a",
"new",
"global",
"transaction",
".",
"If",
"the",
"begin",
"fails",
"an",
"exception",
"consistent",
"with",
"the",
"EJB",
"exception",
"conventions",
"is",
"thrown",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/csi/TranStrategy.java#L580-L625 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java | Schema.recordOf | public static Schema recordOf(String name) {
"""
Creates a {@link Type#RECORD RECORD} {@link Schema} of the given name. The schema created
doesn't carry any record fields, which makes it only useful to be used as a component schema
for other schema type, where the actual schema is resolved from the top level container schema.
@param name Name of the record.
@return A {@link Schema} of {@link Type#RECORD RECORD} type.
"""
Preconditions.checkNotNull(name, "Record name cannot be null.");
return new Schema(Type.RECORD, null, null, null, null, name, null, null);
} | java | public static Schema recordOf(String name) {
Preconditions.checkNotNull(name, "Record name cannot be null.");
return new Schema(Type.RECORD, null, null, null, null, name, null, null);
} | [
"public",
"static",
"Schema",
"recordOf",
"(",
"String",
"name",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"name",
",",
"\"Record name cannot be null.\"",
")",
";",
"return",
"new",
"Schema",
"(",
"Type",
".",
"RECORD",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"name",
",",
"null",
",",
"null",
")",
";",
"}"
]
| Creates a {@link Type#RECORD RECORD} {@link Schema} of the given name. The schema created
doesn't carry any record fields, which makes it only useful to be used as a component schema
for other schema type, where the actual schema is resolved from the top level container schema.
@param name Name of the record.
@return A {@link Schema} of {@link Type#RECORD RECORD} type. | [
"Creates",
"a",
"{",
"@link",
"Type#RECORD",
"RECORD",
"}",
"{",
"@link",
"Schema",
"}",
"of",
"the",
"given",
"name",
".",
"The",
"schema",
"created",
"doesn",
"t",
"carry",
"any",
"record",
"fields",
"which",
"makes",
"it",
"only",
"useful",
"to",
"be",
"used",
"as",
"a",
"component",
"schema",
"for",
"other",
"schema",
"type",
"where",
"the",
"actual",
"schema",
"is",
"resolved",
"from",
"the",
"top",
"level",
"container",
"schema",
"."
]
| train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java#L197-L200 |
lucee/Lucee | core/src/main/java/lucee/commons/io/compress/CompressUtil.java | CompressUtil._compressBZip2 | private static void _compressBZip2(InputStream source, OutputStream target) throws IOException {
"""
compress a source file to a bzip2 file
@param source
@param target
@throws IOException
"""
InputStream is = IOUtil.toBufferedInputStream(source);
OutputStream os = new BZip2CompressorOutputStream(IOUtil.toBufferedOutputStream(target));
IOUtil.copy(is, os, true, true);
} | java | private static void _compressBZip2(InputStream source, OutputStream target) throws IOException {
InputStream is = IOUtil.toBufferedInputStream(source);
OutputStream os = new BZip2CompressorOutputStream(IOUtil.toBufferedOutputStream(target));
IOUtil.copy(is, os, true, true);
} | [
"private",
"static",
"void",
"_compressBZip2",
"(",
"InputStream",
"source",
",",
"OutputStream",
"target",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"IOUtil",
".",
"toBufferedInputStream",
"(",
"source",
")",
";",
"OutputStream",
"os",
"=",
"new",
"BZip2CompressorOutputStream",
"(",
"IOUtil",
".",
"toBufferedOutputStream",
"(",
"target",
")",
")",
";",
"IOUtil",
".",
"copy",
"(",
"is",
",",
"os",
",",
"true",
",",
"true",
")",
";",
"}"
]
| compress a source file to a bzip2 file
@param source
@param target
@throws IOException | [
"compress",
"a",
"source",
"file",
"to",
"a",
"bzip2",
"file"
]
| train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/compress/CompressUtil.java#L468-L473 |
alkacon/opencms-core | src-setup/org/opencms/setup/db/CmsUpdateDBManager.java | CmsUpdateDBManager.needUpdate | public boolean needUpdate() {
"""
Checks if an update is needed.<p>
@return if an update is needed
"""
String pool = "default";
double currentVersion = 8.5;
m_detectedVersion = 8.5;
CmsSetupDb setupDb = new CmsSetupDb(null);
try {
setupDb.setConnection(
getDbDriver(pool),
getDbUrl(pool),
getDbParams(pool),
getDbUser(pool),
m_dbPools.get(pool).get("pwd"));
if (!setupDb.hasTableOrColumn("CMS_USERS", "USER_OU")) {
m_detectedVersion = 6;
} else if (!setupDb.hasTableOrColumn("CMS_ONLINE_URLNAME_MAPPINGS", null)) {
m_detectedVersion = 7;
} else if (!setupDb.hasTableOrColumn("CMS_USER_PUBLISH_LIST", null)) {
m_detectedVersion = 8;
}
} finally {
setupDb.closeConnection();
}
return currentVersion != m_detectedVersion;
} | java | public boolean needUpdate() {
String pool = "default";
double currentVersion = 8.5;
m_detectedVersion = 8.5;
CmsSetupDb setupDb = new CmsSetupDb(null);
try {
setupDb.setConnection(
getDbDriver(pool),
getDbUrl(pool),
getDbParams(pool),
getDbUser(pool),
m_dbPools.get(pool).get("pwd"));
if (!setupDb.hasTableOrColumn("CMS_USERS", "USER_OU")) {
m_detectedVersion = 6;
} else if (!setupDb.hasTableOrColumn("CMS_ONLINE_URLNAME_MAPPINGS", null)) {
m_detectedVersion = 7;
} else if (!setupDb.hasTableOrColumn("CMS_USER_PUBLISH_LIST", null)) {
m_detectedVersion = 8;
}
} finally {
setupDb.closeConnection();
}
return currentVersion != m_detectedVersion;
} | [
"public",
"boolean",
"needUpdate",
"(",
")",
"{",
"String",
"pool",
"=",
"\"default\"",
";",
"double",
"currentVersion",
"=",
"8.5",
";",
"m_detectedVersion",
"=",
"8.5",
";",
"CmsSetupDb",
"setupDb",
"=",
"new",
"CmsSetupDb",
"(",
"null",
")",
";",
"try",
"{",
"setupDb",
".",
"setConnection",
"(",
"getDbDriver",
"(",
"pool",
")",
",",
"getDbUrl",
"(",
"pool",
")",
",",
"getDbParams",
"(",
"pool",
")",
",",
"getDbUser",
"(",
"pool",
")",
",",
"m_dbPools",
".",
"get",
"(",
"pool",
")",
".",
"get",
"(",
"\"pwd\"",
")",
")",
";",
"if",
"(",
"!",
"setupDb",
".",
"hasTableOrColumn",
"(",
"\"CMS_USERS\"",
",",
"\"USER_OU\"",
")",
")",
"{",
"m_detectedVersion",
"=",
"6",
";",
"}",
"else",
"if",
"(",
"!",
"setupDb",
".",
"hasTableOrColumn",
"(",
"\"CMS_ONLINE_URLNAME_MAPPINGS\"",
",",
"null",
")",
")",
"{",
"m_detectedVersion",
"=",
"7",
";",
"}",
"else",
"if",
"(",
"!",
"setupDb",
".",
"hasTableOrColumn",
"(",
"\"CMS_USER_PUBLISH_LIST\"",
",",
"null",
")",
")",
"{",
"m_detectedVersion",
"=",
"8",
";",
"}",
"}",
"finally",
"{",
"setupDb",
".",
"closeConnection",
"(",
")",
";",
"}",
"return",
"currentVersion",
"!=",
"m_detectedVersion",
";",
"}"
]
| Checks if an update is needed.<p>
@return if an update is needed | [
"Checks",
"if",
"an",
"update",
"is",
"needed",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/CmsUpdateDBManager.java#L242-L271 |
iron-io/iron_mq_java | src/main/java/io/iron/ironmq/Queue.java | Queue.touchMessage | public MessageOptions touchMessage(String id, String reservationId, Long timeout) throws IOException {
"""
Touching a reserved message extends its timeout to the duration specified when the message was created.
@param id The ID of the message to delete.
@param reservationId This id is returned when you reserve a message and must be provided to delete a message that is reserved.
@param timeout After timeout (in seconds), item will be placed back onto queue.
@throws io.iron.ironmq.HTTPException If the IronMQ service returns a status other than 200 OK.
@throws java.io.IOException If there is an error accessing the IronMQ server.
"""
String payload = gson.toJson(new MessageOptions(null, reservationId, timeout));
IronReader reader = client.post("queues/" + name + "/messages/" + id + "/touch", payload);
try {
return gson.fromJson(reader.reader, MessageOptions.class);
} finally {
reader.close();
}
} | java | public MessageOptions touchMessage(String id, String reservationId, Long timeout) throws IOException {
String payload = gson.toJson(new MessageOptions(null, reservationId, timeout));
IronReader reader = client.post("queues/" + name + "/messages/" + id + "/touch", payload);
try {
return gson.fromJson(reader.reader, MessageOptions.class);
} finally {
reader.close();
}
} | [
"public",
"MessageOptions",
"touchMessage",
"(",
"String",
"id",
",",
"String",
"reservationId",
",",
"Long",
"timeout",
")",
"throws",
"IOException",
"{",
"String",
"payload",
"=",
"gson",
".",
"toJson",
"(",
"new",
"MessageOptions",
"(",
"null",
",",
"reservationId",
",",
"timeout",
")",
")",
";",
"IronReader",
"reader",
"=",
"client",
".",
"post",
"(",
"\"queues/\"",
"+",
"name",
"+",
"\"/messages/\"",
"+",
"id",
"+",
"\"/touch\"",
",",
"payload",
")",
";",
"try",
"{",
"return",
"gson",
".",
"fromJson",
"(",
"reader",
".",
"reader",
",",
"MessageOptions",
".",
"class",
")",
";",
"}",
"finally",
"{",
"reader",
".",
"close",
"(",
")",
";",
"}",
"}"
]
| Touching a reserved message extends its timeout to the duration specified when the message was created.
@param id The ID of the message to delete.
@param reservationId This id is returned when you reserve a message and must be provided to delete a message that is reserved.
@param timeout After timeout (in seconds), item will be placed back onto queue.
@throws io.iron.ironmq.HTTPException If the IronMQ service returns a status other than 200 OK.
@throws java.io.IOException If there is an error accessing the IronMQ server. | [
"Touching",
"a",
"reserved",
"message",
"extends",
"its",
"timeout",
"to",
"the",
"duration",
"specified",
"when",
"the",
"message",
"was",
"created",
"."
]
| train | https://github.com/iron-io/iron_mq_java/blob/62d6a86545ca7ef31b7b4797aae0c5b31394a507/src/main/java/io/iron/ironmq/Queue.java#L250-L258 |
greenjoe/sergeants | src/main/java/pl/joegreen/sergeants/simulator/SimulatorFactory.java | SimulatorFactory.createMapFromReplayFile | public static GameMap createMapFromReplayFile(String gioReplayFileLocation) {
"""
GIOReplay files can be downloaded from http://dev.generals.io/replays
@param gioReplayFileLocation file location
@return a game map
"""
try {
Replay replay = OBJECT_MAPPER.readValue(new File(gioReplayFileLocation), Replay.class);
return createMapFromReplay(replay);
} catch (IOException e) {
throw new RuntimeException("Can not create game map from file: " + gioReplayFileLocation, e);
}
} | java | public static GameMap createMapFromReplayFile(String gioReplayFileLocation) {
try {
Replay replay = OBJECT_MAPPER.readValue(new File(gioReplayFileLocation), Replay.class);
return createMapFromReplay(replay);
} catch (IOException e) {
throw new RuntimeException("Can not create game map from file: " + gioReplayFileLocation, e);
}
} | [
"public",
"static",
"GameMap",
"createMapFromReplayFile",
"(",
"String",
"gioReplayFileLocation",
")",
"{",
"try",
"{",
"Replay",
"replay",
"=",
"OBJECT_MAPPER",
".",
"readValue",
"(",
"new",
"File",
"(",
"gioReplayFileLocation",
")",
",",
"Replay",
".",
"class",
")",
";",
"return",
"createMapFromReplay",
"(",
"replay",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Can not create game map from file: \"",
"+",
"gioReplayFileLocation",
",",
"e",
")",
";",
"}",
"}"
]
| GIOReplay files can be downloaded from http://dev.generals.io/replays
@param gioReplayFileLocation file location
@return a game map | [
"GIOReplay",
"files",
"can",
"be",
"downloaded",
"from",
"http",
":",
"//",
"dev",
".",
"generals",
".",
"io",
"/",
"replays"
]
| train | https://github.com/greenjoe/sergeants/blob/db624bcea8597843210f138b82bc4a26b3ec92ca/src/main/java/pl/joegreen/sergeants/simulator/SimulatorFactory.java#L64-L71 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/querycache/subscriber/operation/PublisherCreateOperation.java | PublisherCreateOperation.readAndResetAccumulator | private Future<Object> readAndResetAccumulator(String mapName, String cacheId, Integer partitionId) {
"""
Read and reset the accumulator of query cache inside the given partition.
"""
Operation operation = new ReadAndResetAccumulatorOperation(mapName, cacheId);
OperationService operationService = getNodeEngine().getOperationService();
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
} | java | private Future<Object> readAndResetAccumulator(String mapName, String cacheId, Integer partitionId) {
Operation operation = new ReadAndResetAccumulatorOperation(mapName, cacheId);
OperationService operationService = getNodeEngine().getOperationService();
return operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId);
} | [
"private",
"Future",
"<",
"Object",
">",
"readAndResetAccumulator",
"(",
"String",
"mapName",
",",
"String",
"cacheId",
",",
"Integer",
"partitionId",
")",
"{",
"Operation",
"operation",
"=",
"new",
"ReadAndResetAccumulatorOperation",
"(",
"mapName",
",",
"cacheId",
")",
";",
"OperationService",
"operationService",
"=",
"getNodeEngine",
"(",
")",
".",
"getOperationService",
"(",
")",
";",
"return",
"operationService",
".",
"invokeOnPartition",
"(",
"MapService",
".",
"SERVICE_NAME",
",",
"operation",
",",
"partitionId",
")",
";",
"}"
]
| Read and reset the accumulator of query cache inside the given partition. | [
"Read",
"and",
"reset",
"the",
"accumulator",
"of",
"query",
"cache",
"inside",
"the",
"given",
"partition",
"."
]
| train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/querycache/subscriber/operation/PublisherCreateOperation.java#L229-L233 |
james-hu/jabb-core | src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java | AbstractRestClient.buildAddBasicAuthHeaderRequestInterceptor | protected ClientHttpRequestInterceptor buildAddBasicAuthHeaderRequestInterceptor(String user, String password) {
"""
Build a ClientHttpRequestInterceptor that adds BasicAuth header
@param user the user name, may be null or empty
@param password the password, may be null or empty
@return the ClientHttpRequestInterceptor built
"""
return new AddHeaderRequestInterceptor(HEADER_AUTHORIZATION, buildBasicAuthValue(user, password));
} | java | protected ClientHttpRequestInterceptor buildAddBasicAuthHeaderRequestInterceptor(String user, String password){
return new AddHeaderRequestInterceptor(HEADER_AUTHORIZATION, buildBasicAuthValue(user, password));
} | [
"protected",
"ClientHttpRequestInterceptor",
"buildAddBasicAuthHeaderRequestInterceptor",
"(",
"String",
"user",
",",
"String",
"password",
")",
"{",
"return",
"new",
"AddHeaderRequestInterceptor",
"(",
"HEADER_AUTHORIZATION",
",",
"buildBasicAuthValue",
"(",
"user",
",",
"password",
")",
")",
";",
"}"
]
| Build a ClientHttpRequestInterceptor that adds BasicAuth header
@param user the user name, may be null or empty
@param password the password, may be null or empty
@return the ClientHttpRequestInterceptor built | [
"Build",
"a",
"ClientHttpRequestInterceptor",
"that",
"adds",
"BasicAuth",
"header"
]
| train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/spring/rest/AbstractRestClient.java#L523-L525 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/validation/SchemaFactory.java | SchemaFactory.setProperty | public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException {
"""
Set the value of a property.
<p>The property name is any fully-qualified URI. It is
possible for a {@link SchemaFactory} to recognize a property name but
to be unable to change the current value.</p>
<p>{@link SchemaFactory}s are not required to recognize setting
any specific property names.</p>
@param name The property name, which is a non-null fully-qualified URI.
@param object The requested value for the property.
@exception org.xml.sax.SAXNotRecognizedException If the property
value can't be assigned or retrieved.
@exception org.xml.sax.SAXNotSupportedException When the
{@link SchemaFactory} recognizes the property name but
cannot set the requested value.
@exception NullPointerException
if the name parameter is null.
"""
if (name == null) {
throw new NullPointerException("name == null");
}
throw new SAXNotRecognizedException(name);
} | java | public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException {
if (name == null) {
throw new NullPointerException("name == null");
}
throw new SAXNotRecognizedException(name);
} | [
"public",
"void",
"setProperty",
"(",
"String",
"name",
",",
"Object",
"object",
")",
"throws",
"SAXNotRecognizedException",
",",
"SAXNotSupportedException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"name == null\"",
")",
";",
"}",
"throw",
"new",
"SAXNotRecognizedException",
"(",
"name",
")",
";",
"}"
]
| Set the value of a property.
<p>The property name is any fully-qualified URI. It is
possible for a {@link SchemaFactory} to recognize a property name but
to be unable to change the current value.</p>
<p>{@link SchemaFactory}s are not required to recognize setting
any specific property names.</p>
@param name The property name, which is a non-null fully-qualified URI.
@param object The requested value for the property.
@exception org.xml.sax.SAXNotRecognizedException If the property
value can't be assigned or retrieved.
@exception org.xml.sax.SAXNotSupportedException When the
{@link SchemaFactory} recognizes the property name but
cannot set the requested value.
@exception NullPointerException
if the name parameter is null. | [
"Set",
"the",
"value",
"of",
"a",
"property",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/validation/SchemaFactory.java#L343-L348 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.updateCertificateAsync | public ServiceFuture<CertificateBundle> updateCertificateAsync(String vaultBaseUrl, String certificateName, String certificateVersion, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags, final ServiceCallback<CertificateBundle> serviceCallback) {
"""
Updates the specified attributes associated with the given certificate.
The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated are the certificate's attributes. This operation requires the certificates/update permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate in the given key vault.
@param certificateVersion The version of the certificate.
@param certificatePolicy The management policy for the certificate.
@param certificateAttributes The attributes of the certificate (optional).
@param tags Application specific metadata in the form of key-value pairs.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
"""
return ServiceFuture.fromResponse(updateCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificateVersion, certificatePolicy, certificateAttributes, tags), serviceCallback);
} | java | public ServiceFuture<CertificateBundle> updateCertificateAsync(String vaultBaseUrl, String certificateName, String certificateVersion, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags, final ServiceCallback<CertificateBundle> serviceCallback) {
return ServiceFuture.fromResponse(updateCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificateVersion, certificatePolicy, certificateAttributes, tags), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"CertificateBundle",
">",
"updateCertificateAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"String",
"certificateVersion",
",",
"CertificatePolicy",
"certificatePolicy",
",",
"CertificateAttributes",
"certificateAttributes",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
",",
"final",
"ServiceCallback",
"<",
"CertificateBundle",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"updateCertificateWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"certificateName",
",",
"certificateVersion",
",",
"certificatePolicy",
",",
"certificateAttributes",
",",
"tags",
")",
",",
"serviceCallback",
")",
";",
"}"
]
| Updates the specified attributes associated with the given certificate.
The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated are the certificate's attributes. This operation requires the certificates/update permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate in the given key vault.
@param certificateVersion The version of the certificate.
@param certificatePolicy The management policy for the certificate.
@param certificateAttributes The attributes of the certificate (optional).
@param tags Application specific metadata in the form of key-value pairs.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Updates",
"the",
"specified",
"attributes",
"associated",
"with",
"the",
"given",
"certificate",
".",
"The",
"UpdateCertificate",
"operation",
"applies",
"the",
"specified",
"update",
"on",
"the",
"given",
"certificate",
";",
"the",
"only",
"elements",
"updated",
"are",
"the",
"certificate",
"s",
"attributes",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"update",
"permission",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7453-L7455 |
duracloud/duracloud | irodsstorageprovider/src/main/java/org/duracloud/irodsstorage/IrodsStorageProvider.java | IrodsStorageProvider.getSpaceContents | @Override
public Iterator<String> getSpaceContents(String spaceId, String prefix) {
"""
Prefix is assumed to be part of the collection name.
This also has an issue where items in /irods/home/account/dir1 will br
returned if /irods/home/account/dir is asked for (ie, spaceId=dir)
@param spaceId
@param prefix
@return
"""
ConnectOperation co =
new ConnectOperation(host, port, username, password, zone);
String path;
if (prefix != null && !prefix.equals("")) {
path = baseDirectory + "/" + spaceId + "/" + prefix;
} else {
path = baseDirectory + "/" + spaceId;
}
log.trace("listing space contents for " + path);
try {
return listRecursiveFiles(path, co.getConnection());
} catch (IOException e) {
log.error("Could not connect to iRODS", e);
throw new StorageException(e);
}
} | java | @Override
public Iterator<String> getSpaceContents(String spaceId, String prefix) {
ConnectOperation co =
new ConnectOperation(host, port, username, password, zone);
String path;
if (prefix != null && !prefix.equals("")) {
path = baseDirectory + "/" + spaceId + "/" + prefix;
} else {
path = baseDirectory + "/" + spaceId;
}
log.trace("listing space contents for " + path);
try {
return listRecursiveFiles(path, co.getConnection());
} catch (IOException e) {
log.error("Could not connect to iRODS", e);
throw new StorageException(e);
}
} | [
"@",
"Override",
"public",
"Iterator",
"<",
"String",
">",
"getSpaceContents",
"(",
"String",
"spaceId",
",",
"String",
"prefix",
")",
"{",
"ConnectOperation",
"co",
"=",
"new",
"ConnectOperation",
"(",
"host",
",",
"port",
",",
"username",
",",
"password",
",",
"zone",
")",
";",
"String",
"path",
";",
"if",
"(",
"prefix",
"!=",
"null",
"&&",
"!",
"prefix",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"path",
"=",
"baseDirectory",
"+",
"\"/\"",
"+",
"spaceId",
"+",
"\"/\"",
"+",
"prefix",
";",
"}",
"else",
"{",
"path",
"=",
"baseDirectory",
"+",
"\"/\"",
"+",
"spaceId",
";",
"}",
"log",
".",
"trace",
"(",
"\"listing space contents for \"",
"+",
"path",
")",
";",
"try",
"{",
"return",
"listRecursiveFiles",
"(",
"path",
",",
"co",
".",
"getConnection",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Could not connect to iRODS\"",
",",
"e",
")",
";",
"throw",
"new",
"StorageException",
"(",
"e",
")",
";",
"}",
"}"
]
| Prefix is assumed to be part of the collection name.
This also has an issue where items in /irods/home/account/dir1 will br
returned if /irods/home/account/dir is asked for (ie, spaceId=dir)
@param spaceId
@param prefix
@return | [
"Prefix",
"is",
"assumed",
"to",
"be",
"part",
"of",
"the",
"collection",
"name",
".",
"This",
"also",
"has",
"an",
"issue",
"where",
"items",
"in",
"/",
"irods",
"/",
"home",
"/",
"account",
"/",
"dir1",
"will",
"br",
"returned",
"if",
"/",
"irods",
"/",
"home",
"/",
"account",
"/",
"dir",
"is",
"asked",
"for",
"(",
"ie",
"spaceId",
"=",
"dir",
")"
]
| train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/irodsstorageprovider/src/main/java/org/duracloud/irodsstorage/IrodsStorageProvider.java#L127-L146 |
Netflix/karyon | karyon2-governator/src/main/java/netflix/karyon/Karyon.java | Karyon.forApplication | public static KaryonServer forApplication(Class<?> mainClass, Module... modules) {
"""
Creates a new {@link KaryonServer} which uses the passed class to detect any modules.
@param mainClass Any class/interface containing governator's {@link Bootstrap} annotations.
@param modules Additional modules if any.
@return {@link KaryonServer} which is to be used to start the created server.
"""
return forApplication(mainClass, toBootstrapModule(modules));
} | java | public static KaryonServer forApplication(Class<?> mainClass, Module... modules) {
return forApplication(mainClass, toBootstrapModule(modules));
} | [
"public",
"static",
"KaryonServer",
"forApplication",
"(",
"Class",
"<",
"?",
">",
"mainClass",
",",
"Module",
"...",
"modules",
")",
"{",
"return",
"forApplication",
"(",
"mainClass",
",",
"toBootstrapModule",
"(",
"modules",
")",
")",
";",
"}"
]
| Creates a new {@link KaryonServer} which uses the passed class to detect any modules.
@param mainClass Any class/interface containing governator's {@link Bootstrap} annotations.
@param modules Additional modules if any.
@return {@link KaryonServer} which is to be used to start the created server. | [
"Creates",
"a",
"new",
"{",
"@link",
"KaryonServer",
"}",
"which",
"uses",
"the",
"passed",
"class",
"to",
"detect",
"any",
"modules",
"."
]
| train | https://github.com/Netflix/karyon/blob/d50bc0ff37693ef3fbda373e90a109d1f92e0b9a/karyon2-governator/src/main/java/netflix/karyon/Karyon.java#L284-L286 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java | Uris.createUri | public static URI createUri(final String url, final boolean strict) {
"""
Creates a new URI based off the given string. This function differs from newUri in that it throws an
AssertionError instead of a URISyntaxException - so it is suitable for use in static locations as long as
you can be sure it is a valid string that is being parsed.
@param url the string to parse
@param strict whether or not to perform strict escaping. (defaults to false)
@return the parsed, normalized URI
"""
try {
return newUri(url, strict);
} catch (URISyntaxException e) {
throw new AssertionError("Error creating URI: " + e.getMessage());
}
} | java | public static URI createUri(final String url, final boolean strict) {
try {
return newUri(url, strict);
} catch (URISyntaxException e) {
throw new AssertionError("Error creating URI: " + e.getMessage());
}
} | [
"public",
"static",
"URI",
"createUri",
"(",
"final",
"String",
"url",
",",
"final",
"boolean",
"strict",
")",
"{",
"try",
"{",
"return",
"newUri",
"(",
"url",
",",
"strict",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"Error creating URI: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
]
| Creates a new URI based off the given string. This function differs from newUri in that it throws an
AssertionError instead of a URISyntaxException - so it is suitable for use in static locations as long as
you can be sure it is a valid string that is being parsed.
@param url the string to parse
@param strict whether or not to perform strict escaping. (defaults to false)
@return the parsed, normalized URI | [
"Creates",
"a",
"new",
"URI",
"based",
"off",
"the",
"given",
"string",
".",
"This",
"function",
"differs",
"from",
"newUri",
"in",
"that",
"it",
"throws",
"an",
"AssertionError",
"instead",
"of",
"a",
"URISyntaxException",
"-",
"so",
"it",
"is",
"suitable",
"for",
"use",
"in",
"static",
"locations",
"as",
"long",
"as",
"you",
"can",
"be",
"sure",
"it",
"is",
"a",
"valid",
"string",
"that",
"is",
"being",
"parsed",
"."
]
| train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L514-L520 |
opendigitaleducation/web-utils | src/main/java/org/vertx/java/core/http/RouteMatcher.java | RouteMatcher.traceWithRegEx | public RouteMatcher traceWithRegEx(String regex, Handler<HttpServerRequest> handler) {
"""
Specify a handler that will be called for a matching HTTP TRACE
@param regex A regular expression
@param handler The handler to call
"""
addRegEx(regex, handler, traceBindings);
return this;
} | java | public RouteMatcher traceWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, traceBindings);
return this;
} | [
"public",
"RouteMatcher",
"traceWithRegEx",
"(",
"String",
"regex",
",",
"Handler",
"<",
"HttpServerRequest",
">",
"handler",
")",
"{",
"addRegEx",
"(",
"regex",
",",
"handler",
",",
"traceBindings",
")",
";",
"return",
"this",
";",
"}"
]
| Specify a handler that will be called for a matching HTTP TRACE
@param regex A regular expression
@param handler The handler to call | [
"Specify",
"a",
"handler",
"that",
"will",
"be",
"called",
"for",
"a",
"matching",
"HTTP",
"TRACE"
]
| train | https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L269-L272 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/json/JsonMappingDataDictionary.java | JsonMappingDataDictionary.traverseJsonData | private void traverseJsonData(JSONObject jsonData, String jsonPath, TestContext context) {
"""
Walks through the Json object structure and translates values based on element path if necessary.
@param jsonData
@param jsonPath
@param context
"""
for (Iterator it = jsonData.entrySet().iterator(); it.hasNext();) {
Map.Entry jsonEntry = (Map.Entry) it.next();
if (jsonEntry.getValue() instanceof JSONObject) {
traverseJsonData((JSONObject) jsonEntry.getValue(), (StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()), context);
} else if (jsonEntry.getValue() instanceof JSONArray) {
JSONArray jsonArray = (JSONArray) jsonEntry.getValue();
for (int i = 0; i < jsonArray.size(); i++) {
if (jsonArray.get(i) instanceof JSONObject) {
traverseJsonData((JSONObject) jsonArray.get(i), String.format((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()) + "[%s]", i), context);
} else {
jsonArray.set(i, translate(String.format((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()) + "[%s]", i), jsonArray.get(i), context));
}
}
} else {
jsonEntry.setValue(translate((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()),
jsonEntry.getValue() != null ? jsonEntry.getValue() : null, context));
}
}
} | java | private void traverseJsonData(JSONObject jsonData, String jsonPath, TestContext context) {
for (Iterator it = jsonData.entrySet().iterator(); it.hasNext();) {
Map.Entry jsonEntry = (Map.Entry) it.next();
if (jsonEntry.getValue() instanceof JSONObject) {
traverseJsonData((JSONObject) jsonEntry.getValue(), (StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()), context);
} else if (jsonEntry.getValue() instanceof JSONArray) {
JSONArray jsonArray = (JSONArray) jsonEntry.getValue();
for (int i = 0; i < jsonArray.size(); i++) {
if (jsonArray.get(i) instanceof JSONObject) {
traverseJsonData((JSONObject) jsonArray.get(i), String.format((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()) + "[%s]", i), context);
} else {
jsonArray.set(i, translate(String.format((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()) + "[%s]", i), jsonArray.get(i), context));
}
}
} else {
jsonEntry.setValue(translate((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()),
jsonEntry.getValue() != null ? jsonEntry.getValue() : null, context));
}
}
} | [
"private",
"void",
"traverseJsonData",
"(",
"JSONObject",
"jsonData",
",",
"String",
"jsonPath",
",",
"TestContext",
"context",
")",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"jsonData",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Map",
".",
"Entry",
"jsonEntry",
"=",
"(",
"Map",
".",
"Entry",
")",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"jsonEntry",
".",
"getValue",
"(",
")",
"instanceof",
"JSONObject",
")",
"{",
"traverseJsonData",
"(",
"(",
"JSONObject",
")",
"jsonEntry",
".",
"getValue",
"(",
")",
",",
"(",
"StringUtils",
".",
"hasText",
"(",
"jsonPath",
")",
"?",
"jsonPath",
"+",
"\".\"",
"+",
"jsonEntry",
".",
"getKey",
"(",
")",
":",
"jsonEntry",
".",
"getKey",
"(",
")",
".",
"toString",
"(",
")",
")",
",",
"context",
")",
";",
"}",
"else",
"if",
"(",
"jsonEntry",
".",
"getValue",
"(",
")",
"instanceof",
"JSONArray",
")",
"{",
"JSONArray",
"jsonArray",
"=",
"(",
"JSONArray",
")",
"jsonEntry",
".",
"getValue",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"jsonArray",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"jsonArray",
".",
"get",
"(",
"i",
")",
"instanceof",
"JSONObject",
")",
"{",
"traverseJsonData",
"(",
"(",
"JSONObject",
")",
"jsonArray",
".",
"get",
"(",
"i",
")",
",",
"String",
".",
"format",
"(",
"(",
"StringUtils",
".",
"hasText",
"(",
"jsonPath",
")",
"?",
"jsonPath",
"+",
"\".\"",
"+",
"jsonEntry",
".",
"getKey",
"(",
")",
":",
"jsonEntry",
".",
"getKey",
"(",
")",
".",
"toString",
"(",
")",
")",
"+",
"\"[%s]\"",
",",
"i",
")",
",",
"context",
")",
";",
"}",
"else",
"{",
"jsonArray",
".",
"set",
"(",
"i",
",",
"translate",
"(",
"String",
".",
"format",
"(",
"(",
"StringUtils",
".",
"hasText",
"(",
"jsonPath",
")",
"?",
"jsonPath",
"+",
"\".\"",
"+",
"jsonEntry",
".",
"getKey",
"(",
")",
":",
"jsonEntry",
".",
"getKey",
"(",
")",
".",
"toString",
"(",
")",
")",
"+",
"\"[%s]\"",
",",
"i",
")",
",",
"jsonArray",
".",
"get",
"(",
"i",
")",
",",
"context",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"jsonEntry",
".",
"setValue",
"(",
"translate",
"(",
"(",
"StringUtils",
".",
"hasText",
"(",
"jsonPath",
")",
"?",
"jsonPath",
"+",
"\".\"",
"+",
"jsonEntry",
".",
"getKey",
"(",
")",
":",
"jsonEntry",
".",
"getKey",
"(",
")",
".",
"toString",
"(",
")",
")",
",",
"jsonEntry",
".",
"getValue",
"(",
")",
"!=",
"null",
"?",
"jsonEntry",
".",
"getValue",
"(",
")",
":",
"null",
",",
"context",
")",
")",
";",
"}",
"}",
"}"
]
| Walks through the Json object structure and translates values based on element path if necessary.
@param jsonData
@param jsonPath
@param context | [
"Walks",
"through",
"the",
"Json",
"object",
"structure",
"and",
"translates",
"values",
"based",
"on",
"element",
"path",
"if",
"necessary",
"."
]
| train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/json/JsonMappingDataDictionary.java#L113-L133 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.addEntry | public static void addEntry(final File zip, final ZipEntrySource entry) {
"""
Changes a zip file, adds one new entry in-place.
@param zip
an existing ZIP file (only read).
@param entry
new ZIP entry appended.
"""
operateInPlace(zip, new InPlaceAction() {
public boolean act(File tmpFile) {
addEntry(zip, entry, tmpFile);
return true;
}
});
} | java | public static void addEntry(final File zip, final ZipEntrySource entry) {
operateInPlace(zip, new InPlaceAction() {
public boolean act(File tmpFile) {
addEntry(zip, entry, tmpFile);
return true;
}
});
} | [
"public",
"static",
"void",
"addEntry",
"(",
"final",
"File",
"zip",
",",
"final",
"ZipEntrySource",
"entry",
")",
"{",
"operateInPlace",
"(",
"zip",
",",
"new",
"InPlaceAction",
"(",
")",
"{",
"public",
"boolean",
"act",
"(",
"File",
"tmpFile",
")",
"{",
"addEntry",
"(",
"zip",
",",
"entry",
",",
"tmpFile",
")",
";",
"return",
"true",
";",
"}",
"}",
")",
";",
"}"
]
| Changes a zip file, adds one new entry in-place.
@param zip
an existing ZIP file (only read).
@param entry
new ZIP entry appended. | [
"Changes",
"a",
"zip",
"file",
"adds",
"one",
"new",
"entry",
"in",
"-",
"place",
"."
]
| train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2145-L2152 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/Parser.java | Parser.isDigitAt | public static boolean isDigitAt(String s, int pos) {
"""
Returns true if a given string {@code s} has digit at position {@code pos}.
@param s input string
@param pos position (0-based)
@return true if input string s has digit at position pos
"""
return pos > 0 && pos < s.length() && Character.isDigit(s.charAt(pos));
} | java | public static boolean isDigitAt(String s, int pos) {
return pos > 0 && pos < s.length() && Character.isDigit(s.charAt(pos));
} | [
"public",
"static",
"boolean",
"isDigitAt",
"(",
"String",
"s",
",",
"int",
"pos",
")",
"{",
"return",
"pos",
">",
"0",
"&&",
"pos",
"<",
"s",
".",
"length",
"(",
")",
"&&",
"Character",
".",
"isDigit",
"(",
"s",
".",
"charAt",
"(",
"pos",
")",
")",
";",
"}"
]
| Returns true if a given string {@code s} has digit at position {@code pos}.
@param s input string
@param pos position (0-based)
@return true if input string s has digit at position pos | [
"Returns",
"true",
"if",
"a",
"given",
"string",
"{"
]
| train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Parser.java#L756-L758 |
axibase/atsd-jdbc | src/main/java/com/axibase/tsd/driver/jdbc/ext/AtsdMeta.java | AtsdMeta.appendMetaColumns | private static void appendMetaColumns(StringBuilder buffer, MetadataColumnDefinition[] values) {
"""
Append metric and entity metadata columns to series requests. This method must not be used while processing meta tables.
@param buffer StringBuilder to append to
@param values columns to append
"""
for (MetadataColumnDefinition column : values) {
buffer.append(", ").append(column.getColumnNamePrefix());
}
} | java | private static void appendMetaColumns(StringBuilder buffer, MetadataColumnDefinition[] values) {
for (MetadataColumnDefinition column : values) {
buffer.append(", ").append(column.getColumnNamePrefix());
}
} | [
"private",
"static",
"void",
"appendMetaColumns",
"(",
"StringBuilder",
"buffer",
",",
"MetadataColumnDefinition",
"[",
"]",
"values",
")",
"{",
"for",
"(",
"MetadataColumnDefinition",
"column",
":",
"values",
")",
"{",
"buffer",
".",
"append",
"(",
"\", \"",
")",
".",
"append",
"(",
"column",
".",
"getColumnNamePrefix",
"(",
")",
")",
";",
"}",
"}"
]
| Append metric and entity metadata columns to series requests. This method must not be used while processing meta tables.
@param buffer StringBuilder to append to
@param values columns to append | [
"Append",
"metric",
"and",
"entity",
"metadata",
"columns",
"to",
"series",
"requests",
".",
"This",
"method",
"must",
"not",
"be",
"used",
"while",
"processing",
"meta",
"tables",
"."
]
| train | https://github.com/axibase/atsd-jdbc/blob/8bbd9d65f645272aa1d7fc07081bd10bd3e0c376/src/main/java/com/axibase/tsd/driver/jdbc/ext/AtsdMeta.java#L578-L582 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/url/URLHelper.java | URLHelper.getURLString | @Nullable
public static String getURLString (@Nullable final String sPath,
@Nullable final List <? extends URLParameter> aQueryParams,
@Nullable final String sAnchor,
@Nullable final IEncoder <String, String> aQueryParameterEncoder) {
"""
Get the final representation of the URL using the specified elements.
@param sPath
The main path. May be <code>null</code>.
@param aQueryParams
The list of query parameters to be appended. May be
<code>null</code> .
@param sAnchor
An optional anchor to be added. May be <code>null</code>.
@param aQueryParameterEncoder
The parameters encoding to be used. May be <code>null</code>.
@return May be <code>null</code> if path, anchor and parameters are
<code>null</code>.
"""
return getURLString (sPath, getQueryParametersAsString (aQueryParams, aQueryParameterEncoder), sAnchor);
} | java | @Nullable
public static String getURLString (@Nullable final String sPath,
@Nullable final List <? extends URLParameter> aQueryParams,
@Nullable final String sAnchor,
@Nullable final IEncoder <String, String> aQueryParameterEncoder)
{
return getURLString (sPath, getQueryParametersAsString (aQueryParams, aQueryParameterEncoder), sAnchor);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getURLString",
"(",
"@",
"Nullable",
"final",
"String",
"sPath",
",",
"@",
"Nullable",
"final",
"List",
"<",
"?",
"extends",
"URLParameter",
">",
"aQueryParams",
",",
"@",
"Nullable",
"final",
"String",
"sAnchor",
",",
"@",
"Nullable",
"final",
"IEncoder",
"<",
"String",
",",
"String",
">",
"aQueryParameterEncoder",
")",
"{",
"return",
"getURLString",
"(",
"sPath",
",",
"getQueryParametersAsString",
"(",
"aQueryParams",
",",
"aQueryParameterEncoder",
")",
",",
"sAnchor",
")",
";",
"}"
]
| Get the final representation of the URL using the specified elements.
@param sPath
The main path. May be <code>null</code>.
@param aQueryParams
The list of query parameters to be appended. May be
<code>null</code> .
@param sAnchor
An optional anchor to be added. May be <code>null</code>.
@param aQueryParameterEncoder
The parameters encoding to be used. May be <code>null</code>.
@return May be <code>null</code> if path, anchor and parameters are
<code>null</code>. | [
"Get",
"the",
"final",
"representation",
"of",
"the",
"URL",
"using",
"the",
"specified",
"elements",
"."
]
| train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/url/URLHelper.java#L707-L714 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/lang/Range.java | Range.between | public static <T extends Comparable<T>> Range<T> between(T fromInclusive, T toInclusive) {
"""
<p>
Obtains a range with the specified minimum and maximum values (both inclusive). The range uses
the natural ordering of the elements to determine where values lie in the range. The arguments
may be passed in the order (min,max) or (max,min). The getMinimum and getMaximum methods will
return the correct values.
</p>
"""
return between(fromInclusive, toInclusive, null);
} | java | public static <T extends Comparable<T>> Range<T> between(T fromInclusive, T toInclusive) {
return between(fromInclusive, toInclusive, null);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"Range",
"<",
"T",
">",
"between",
"(",
"T",
"fromInclusive",
",",
"T",
"toInclusive",
")",
"{",
"return",
"between",
"(",
"fromInclusive",
",",
"toInclusive",
",",
"null",
")",
";",
"}"
]
| <p>
Obtains a range with the specified minimum and maximum values (both inclusive). The range uses
the natural ordering of the elements to determine where values lie in the range. The arguments
may be passed in the order (min,max) or (max,min). The getMinimum and getMaximum methods will
return the correct values.
</p> | [
"<p",
">",
"Obtains",
"a",
"range",
"with",
"the",
"specified",
"minimum",
"and",
"maximum",
"values",
"(",
"both",
"inclusive",
")",
".",
"The",
"range",
"uses",
"the",
"natural",
"ordering",
"of",
"the",
"elements",
"to",
"determine",
"where",
"values",
"lie",
"in",
"the",
"range",
".",
"The",
"arguments",
"may",
"be",
"passed",
"in",
"the",
"order",
"(",
"min",
"max",
")",
"or",
"(",
"max",
"min",
")",
".",
"The",
"getMinimum",
"and",
"getMaximum",
"methods",
"will",
"return",
"the",
"correct",
"values",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Range.java#L75-L77 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShadowMap.java | GVRShadowMap.getShadowMaterial | static GVRMaterial getShadowMaterial(GVRContext ctx) {
"""
Gets the shadow material used in constructing shadow maps.
<p>
Adds the shadow mapping depth shaders to the shader manager.
There are two variants - one for skinned and one for non-skinned meshes.
@return shadow map material
"""
if (sShadowMaterial == null)
{
GVRShaderId depthShader = ctx.getShaderManager().getShaderType(GVRDepthShader.class);
sShadowMaterial = new GVRMaterial(ctx, depthShader);
}
return sShadowMaterial;
} | java | static GVRMaterial getShadowMaterial(GVRContext ctx)
{
if (sShadowMaterial == null)
{
GVRShaderId depthShader = ctx.getShaderManager().getShaderType(GVRDepthShader.class);
sShadowMaterial = new GVRMaterial(ctx, depthShader);
}
return sShadowMaterial;
} | [
"static",
"GVRMaterial",
"getShadowMaterial",
"(",
"GVRContext",
"ctx",
")",
"{",
"if",
"(",
"sShadowMaterial",
"==",
"null",
")",
"{",
"GVRShaderId",
"depthShader",
"=",
"ctx",
".",
"getShaderManager",
"(",
")",
".",
"getShaderType",
"(",
"GVRDepthShader",
".",
"class",
")",
";",
"sShadowMaterial",
"=",
"new",
"GVRMaterial",
"(",
"ctx",
",",
"depthShader",
")",
";",
"}",
"return",
"sShadowMaterial",
";",
"}"
]
| Gets the shadow material used in constructing shadow maps.
<p>
Adds the shadow mapping depth shaders to the shader manager.
There are two variants - one for skinned and one for non-skinned meshes.
@return shadow map material | [
"Gets",
"the",
"shadow",
"material",
"used",
"in",
"constructing",
"shadow",
"maps",
".",
"<p",
">",
"Adds",
"the",
"shadow",
"mapping",
"depth",
"shaders",
"to",
"the",
"shader",
"manager",
".",
"There",
"are",
"two",
"variants",
"-",
"one",
"for",
"skinned",
"and",
"one",
"for",
"non",
"-",
"skinned",
"meshes",
"."
]
| train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShadowMap.java#L207-L215 |
samskivert/pythagoras | src/main/java/pythagoras/f/RectangularShape.java | RectangularShape.setFrameFromDiagonal | public void setFrameFromDiagonal (float x1, float y1, float x2, float y2) {
"""
Sets the location and size of the framing rectangle of this shape based on the specified
diagonal line.
"""
float rx, ry, rw, rh;
if (x1 < x2) {
rx = x1;
rw = x2 - x1;
} else {
rx = x2;
rw = x1 - x2;
}
if (y1 < y2) {
ry = y1;
rh = y2 - y1;
} else {
ry = y2;
rh = y1 - y2;
}
setFrame(rx, ry, rw, rh);
} | java | public void setFrameFromDiagonal (float x1, float y1, float x2, float y2) {
float rx, ry, rw, rh;
if (x1 < x2) {
rx = x1;
rw = x2 - x1;
} else {
rx = x2;
rw = x1 - x2;
}
if (y1 < y2) {
ry = y1;
rh = y2 - y1;
} else {
ry = y2;
rh = y1 - y2;
}
setFrame(rx, ry, rw, rh);
} | [
"public",
"void",
"setFrameFromDiagonal",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"float",
"rx",
",",
"ry",
",",
"rw",
",",
"rh",
";",
"if",
"(",
"x1",
"<",
"x2",
")",
"{",
"rx",
"=",
"x1",
";",
"rw",
"=",
"x2",
"-",
"x1",
";",
"}",
"else",
"{",
"rx",
"=",
"x2",
";",
"rw",
"=",
"x1",
"-",
"x2",
";",
"}",
"if",
"(",
"y1",
"<",
"y2",
")",
"{",
"ry",
"=",
"y1",
";",
"rh",
"=",
"y2",
"-",
"y1",
";",
"}",
"else",
"{",
"ry",
"=",
"y2",
";",
"rh",
"=",
"y1",
"-",
"y2",
";",
"}",
"setFrame",
"(",
"rx",
",",
"ry",
",",
"rw",
",",
"rh",
")",
";",
"}"
]
| Sets the location and size of the framing rectangle of this shape based on the specified
diagonal line. | [
"Sets",
"the",
"location",
"and",
"size",
"of",
"the",
"framing",
"rectangle",
"of",
"this",
"shape",
"based",
"on",
"the",
"specified",
"diagonal",
"line",
"."
]
| train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/RectangularShape.java#L37-L54 |
codelibs/jcifs | src/main/java/jcifs/smb1/smb1/SmbFile.java | SmbFile.getShareSecurity | public ACE[] getShareSecurity(boolean resolveSids) throws IOException {
"""
Return an array of Access Control Entry (ACE) objects representing
the share permissions on the share exporting this file or directory.
If no DACL is present, null is returned. If the DACL is empty, an array with 0 elements is returned.
<p>
Note that this is different from calling <tt>getSecurity</tt> on a
share. There are actually two different ACLs for shares - the ACL on
the share and the ACL on the folder being shared.
Go to <i>Computer Management</i>
> <i>System Tools</i> > <i>Shared Folders</i> > <i>Shares</i> and
look at the <i>Properties</i> for a share. You will see two tabs - one
for "Share Permissions" and another for "Security". These correspond to
the ACLs returned by <tt>getShareSecurity</tt> and <tt>getSecurity</tt>
respectively.
@param resolveSids Attempt to resolve the SIDs within each ACE form
their numeric representation to their corresponding account names.
"""
String p = url.getPath();
MsrpcShareGetInfo rpc;
DcerpcHandle handle;
ACE[] aces;
resolveDfs(null);
String server = getServerWithDfs();
rpc = new MsrpcShareGetInfo(server, tree.share);
handle = DcerpcHandle.getHandle("ncacn_np:" + server + "[\\PIPE\\srvsvc]", auth);
try {
handle.sendrecv(rpc);
if (rpc.retval != 0)
throw new SmbException(rpc.retval, true);
aces = rpc.getSecurity();
if (aces != null)
processAces(aces, resolveSids);
} finally {
try {
handle.close();
} catch(IOException ioe) {
if (log.level >= 1)
ioe.printStackTrace(log);
}
}
return aces;
} | java | public ACE[] getShareSecurity(boolean resolveSids) throws IOException {
String p = url.getPath();
MsrpcShareGetInfo rpc;
DcerpcHandle handle;
ACE[] aces;
resolveDfs(null);
String server = getServerWithDfs();
rpc = new MsrpcShareGetInfo(server, tree.share);
handle = DcerpcHandle.getHandle("ncacn_np:" + server + "[\\PIPE\\srvsvc]", auth);
try {
handle.sendrecv(rpc);
if (rpc.retval != 0)
throw new SmbException(rpc.retval, true);
aces = rpc.getSecurity();
if (aces != null)
processAces(aces, resolveSids);
} finally {
try {
handle.close();
} catch(IOException ioe) {
if (log.level >= 1)
ioe.printStackTrace(log);
}
}
return aces;
} | [
"public",
"ACE",
"[",
"]",
"getShareSecurity",
"(",
"boolean",
"resolveSids",
")",
"throws",
"IOException",
"{",
"String",
"p",
"=",
"url",
".",
"getPath",
"(",
")",
";",
"MsrpcShareGetInfo",
"rpc",
";",
"DcerpcHandle",
"handle",
";",
"ACE",
"[",
"]",
"aces",
";",
"resolveDfs",
"(",
"null",
")",
";",
"String",
"server",
"=",
"getServerWithDfs",
"(",
")",
";",
"rpc",
"=",
"new",
"MsrpcShareGetInfo",
"(",
"server",
",",
"tree",
".",
"share",
")",
";",
"handle",
"=",
"DcerpcHandle",
".",
"getHandle",
"(",
"\"ncacn_np:\"",
"+",
"server",
"+",
"\"[\\\\PIPE\\\\srvsvc]\"",
",",
"auth",
")",
";",
"try",
"{",
"handle",
".",
"sendrecv",
"(",
"rpc",
")",
";",
"if",
"(",
"rpc",
".",
"retval",
"!=",
"0",
")",
"throw",
"new",
"SmbException",
"(",
"rpc",
".",
"retval",
",",
"true",
")",
";",
"aces",
"=",
"rpc",
".",
"getSecurity",
"(",
")",
";",
"if",
"(",
"aces",
"!=",
"null",
")",
"processAces",
"(",
"aces",
",",
"resolveSids",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"handle",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"if",
"(",
"log",
".",
"level",
">=",
"1",
")",
"ioe",
".",
"printStackTrace",
"(",
"log",
")",
";",
"}",
"}",
"return",
"aces",
";",
"}"
]
| Return an array of Access Control Entry (ACE) objects representing
the share permissions on the share exporting this file or directory.
If no DACL is present, null is returned. If the DACL is empty, an array with 0 elements is returned.
<p>
Note that this is different from calling <tt>getSecurity</tt> on a
share. There are actually two different ACLs for shares - the ACL on
the share and the ACL on the folder being shared.
Go to <i>Computer Management</i>
> <i>System Tools</i> > <i>Shared Folders</i> > <i>Shares</i> and
look at the <i>Properties</i> for a share. You will see two tabs - one
for "Share Permissions" and another for "Security". These correspond to
the ACLs returned by <tt>getShareSecurity</tt> and <tt>getSecurity</tt>
respectively.
@param resolveSids Attempt to resolve the SIDs within each ACE form
their numeric representation to their corresponding account names. | [
"Return",
"an",
"array",
"of",
"Access",
"Control",
"Entry",
"(",
"ACE",
")",
"objects",
"representing",
"the",
"share",
"permissions",
"on",
"the",
"share",
"exporting",
"this",
"file",
"or",
"directory",
".",
"If",
"no",
"DACL",
"is",
"present",
"null",
"is",
"returned",
".",
"If",
"the",
"DACL",
"is",
"empty",
"an",
"array",
"with",
"0",
"elements",
"is",
"returned",
".",
"<p",
">",
"Note",
"that",
"this",
"is",
"different",
"from",
"calling",
"<tt",
">",
"getSecurity<",
"/",
"tt",
">",
"on",
"a",
"share",
".",
"There",
"are",
"actually",
"two",
"different",
"ACLs",
"for",
"shares",
"-",
"the",
"ACL",
"on",
"the",
"share",
"and",
"the",
"ACL",
"on",
"the",
"folder",
"being",
"shared",
".",
"Go",
"to",
"<i",
">",
"Computer",
"Management<",
"/",
"i",
">",
">",
";",
"<i",
">",
"System",
"Tools<",
"/",
"i",
">",
">",
";",
"<i",
">",
"Shared",
"Folders<",
"/",
"i",
">",
">",
"<i",
">",
"Shares<",
"/",
"i",
">",
"and",
"look",
"at",
"the",
"<i",
">",
"Properties<",
"/",
"i",
">",
"for",
"a",
"share",
".",
"You",
"will",
"see",
"two",
"tabs",
"-",
"one",
"for",
"Share",
"Permissions",
"and",
"another",
"for",
"Security",
".",
"These",
"correspond",
"to",
"the",
"ACLs",
"returned",
"by",
"<tt",
">",
"getShareSecurity<",
"/",
"tt",
">",
"and",
"<tt",
">",
"getSecurity<",
"/",
"tt",
">",
"respectively",
"."
]
| train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/SmbFile.java#L2938-L2967 |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java | CommonOps_DSCC.permutationMatrix | public static DMatrixSparseCSC permutationMatrix(int[] p, boolean inverse, int N, DMatrixSparseCSC P) {
"""
Converts the permutation vector into a matrix. B = P*A. B[p[i],:] = A[i,:]
@param p (Input) Permutation vector
@param inverse (Input) If it is the inverse. B[i,:] = A[p[i],:)
@param P (Output) Permutation matrix
"""
if( P == null )
P = new DMatrixSparseCSC(N,N,N);
else
P.reshape(N,N,N);
P.indicesSorted = true;
P.nz_length = N;
// each column should have one element inside of it
if( !inverse ) {
for (int i = 0; i < N; i++) {
P.col_idx[i + 1] = i + 1;
P.nz_rows[p[i]] = i;
P.nz_values[i] = 1;
}
} else {
for (int i = 0; i < N; i++) {
P.col_idx[i + 1] = i + 1;
P.nz_rows[i] = p[i];
P.nz_values[i] = 1;
}
}
return P;
} | java | public static DMatrixSparseCSC permutationMatrix(int[] p, boolean inverse, int N, DMatrixSparseCSC P) {
if( P == null )
P = new DMatrixSparseCSC(N,N,N);
else
P.reshape(N,N,N);
P.indicesSorted = true;
P.nz_length = N;
// each column should have one element inside of it
if( !inverse ) {
for (int i = 0; i < N; i++) {
P.col_idx[i + 1] = i + 1;
P.nz_rows[p[i]] = i;
P.nz_values[i] = 1;
}
} else {
for (int i = 0; i < N; i++) {
P.col_idx[i + 1] = i + 1;
P.nz_rows[i] = p[i];
P.nz_values[i] = 1;
}
}
return P;
} | [
"public",
"static",
"DMatrixSparseCSC",
"permutationMatrix",
"(",
"int",
"[",
"]",
"p",
",",
"boolean",
"inverse",
",",
"int",
"N",
",",
"DMatrixSparseCSC",
"P",
")",
"{",
"if",
"(",
"P",
"==",
"null",
")",
"P",
"=",
"new",
"DMatrixSparseCSC",
"(",
"N",
",",
"N",
",",
"N",
")",
";",
"else",
"P",
".",
"reshape",
"(",
"N",
",",
"N",
",",
"N",
")",
";",
"P",
".",
"indicesSorted",
"=",
"true",
";",
"P",
".",
"nz_length",
"=",
"N",
";",
"// each column should have one element inside of it",
"if",
"(",
"!",
"inverse",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"{",
"P",
".",
"col_idx",
"[",
"i",
"+",
"1",
"]",
"=",
"i",
"+",
"1",
";",
"P",
".",
"nz_rows",
"[",
"p",
"[",
"i",
"]",
"]",
"=",
"i",
";",
"P",
".",
"nz_values",
"[",
"i",
"]",
"=",
"1",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"{",
"P",
".",
"col_idx",
"[",
"i",
"+",
"1",
"]",
"=",
"i",
"+",
"1",
";",
"P",
".",
"nz_rows",
"[",
"i",
"]",
"=",
"p",
"[",
"i",
"]",
";",
"P",
".",
"nz_values",
"[",
"i",
"]",
"=",
"1",
";",
"}",
"}",
"return",
"P",
";",
"}"
]
| Converts the permutation vector into a matrix. B = P*A. B[p[i],:] = A[i,:]
@param p (Input) Permutation vector
@param inverse (Input) If it is the inverse. B[i,:] = A[p[i],:)
@param P (Output) Permutation matrix | [
"Converts",
"the",
"permutation",
"vector",
"into",
"a",
"matrix",
".",
"B",
"=",
"P",
"*",
"A",
".",
"B",
"[",
"p",
"[",
"i",
"]",
":",
"]",
"=",
"A",
"[",
"i",
":",
"]"
]
| train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L810-L835 |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/resolver/xml/transform/Transform.java | Transform.createSAXURIResolver | public static URIResolver createSAXURIResolver(Resolver resolver) {
"""
Creates a URIResolver that returns a SAXSource.
@param resolver
@return
"""
final SAXResolver saxResolver = new SAXResolver(resolver);
return new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
try {
return saxResolver.resolve(href, base);
}
catch (SAXException e) {
throw toTransformerException(e);
}
catch (IOException e) {
throw new TransformerException(e);
}
}
};
} | java | public static URIResolver createSAXURIResolver(Resolver resolver) {
final SAXResolver saxResolver = new SAXResolver(resolver);
return new URIResolver() {
public Source resolve(String href, String base) throws TransformerException {
try {
return saxResolver.resolve(href, base);
}
catch (SAXException e) {
throw toTransformerException(e);
}
catch (IOException e) {
throw new TransformerException(e);
}
}
};
} | [
"public",
"static",
"URIResolver",
"createSAXURIResolver",
"(",
"Resolver",
"resolver",
")",
"{",
"final",
"SAXResolver",
"saxResolver",
"=",
"new",
"SAXResolver",
"(",
"resolver",
")",
";",
"return",
"new",
"URIResolver",
"(",
")",
"{",
"public",
"Source",
"resolve",
"(",
"String",
"href",
",",
"String",
"base",
")",
"throws",
"TransformerException",
"{",
"try",
"{",
"return",
"saxResolver",
".",
"resolve",
"(",
"href",
",",
"base",
")",
";",
"}",
"catch",
"(",
"SAXException",
"e",
")",
"{",
"throw",
"toTransformerException",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"TransformerException",
"(",
"e",
")",
";",
"}",
"}",
"}",
";",
"}"
]
| Creates a URIResolver that returns a SAXSource.
@param resolver
@return | [
"Creates",
"a",
"URIResolver",
"that",
"returns",
"a",
"SAXSource",
"."
]
| train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/resolver/xml/transform/Transform.java#L32-L47 |
gwtplus/google-gin | src/main/java/com/google/gwt/inject/rebind/GinjectorGenerator.java | GinjectorGenerator.createGinClassLoader | private ClassLoader createGinClassLoader(TreeLogger logger, GeneratorContext context) {
"""
Creates a new gin-specific class loader that will load GWT and non-GWT types such that there is
never a conflict, especially with super source.
@param logger logger for errors that occur during class loading
@param context generator context in which classes are loaded
@return new gin class loader
@see GinBridgeClassLoader
"""
Set<String> exceptions = new LinkedHashSet<String>();
exceptions.add("com.google.inject"); // Need the non-super-source version during generation.
exceptions.add("javax.inject"); // Need the non-super-source version during generation.
exceptions.add("com.google.gwt.inject.client"); // Excluded to allow class-literal comparison.
// Required by GWT 2.8.0+ to prevent loading of GWT script only java.lang.JsException class
// See: https://github.com/gwtproject/gwt/issues/9311
// See: https://github.com/gwtproject/gwt/commit/1d660d2fc00a5cbfeccf512251f78ab4302ab633
exceptions.add("com.google.gwt.core.client");
exceptions.add("com.google.gwt.core.client.impl");
// Add any excepted packages or classes registered by other developers.
exceptions.addAll(getValuesForProperty("gin.classloading.exceptedPackages"));
return new GinBridgeClassLoader(context, logger, exceptions);
} | java | private ClassLoader createGinClassLoader(TreeLogger logger, GeneratorContext context) {
Set<String> exceptions = new LinkedHashSet<String>();
exceptions.add("com.google.inject"); // Need the non-super-source version during generation.
exceptions.add("javax.inject"); // Need the non-super-source version during generation.
exceptions.add("com.google.gwt.inject.client"); // Excluded to allow class-literal comparison.
// Required by GWT 2.8.0+ to prevent loading of GWT script only java.lang.JsException class
// See: https://github.com/gwtproject/gwt/issues/9311
// See: https://github.com/gwtproject/gwt/commit/1d660d2fc00a5cbfeccf512251f78ab4302ab633
exceptions.add("com.google.gwt.core.client");
exceptions.add("com.google.gwt.core.client.impl");
// Add any excepted packages or classes registered by other developers.
exceptions.addAll(getValuesForProperty("gin.classloading.exceptedPackages"));
return new GinBridgeClassLoader(context, logger, exceptions);
} | [
"private",
"ClassLoader",
"createGinClassLoader",
"(",
"TreeLogger",
"logger",
",",
"GeneratorContext",
"context",
")",
"{",
"Set",
"<",
"String",
">",
"exceptions",
"=",
"new",
"LinkedHashSet",
"<",
"String",
">",
"(",
")",
";",
"exceptions",
".",
"add",
"(",
"\"com.google.inject\"",
")",
";",
"// Need the non-super-source version during generation.",
"exceptions",
".",
"add",
"(",
"\"javax.inject\"",
")",
";",
"// Need the non-super-source version during generation.",
"exceptions",
".",
"add",
"(",
"\"com.google.gwt.inject.client\"",
")",
";",
"// Excluded to allow class-literal comparison.",
"// Required by GWT 2.8.0+ to prevent loading of GWT script only java.lang.JsException class",
"// See: https://github.com/gwtproject/gwt/issues/9311",
"// See: https://github.com/gwtproject/gwt/commit/1d660d2fc00a5cbfeccf512251f78ab4302ab633",
"exceptions",
".",
"add",
"(",
"\"com.google.gwt.core.client\"",
")",
";",
"exceptions",
".",
"add",
"(",
"\"com.google.gwt.core.client.impl\"",
")",
";",
"// Add any excepted packages or classes registered by other developers.",
"exceptions",
".",
"addAll",
"(",
"getValuesForProperty",
"(",
"\"gin.classloading.exceptedPackages\"",
")",
")",
";",
"return",
"new",
"GinBridgeClassLoader",
"(",
"context",
",",
"logger",
",",
"exceptions",
")",
";",
"}"
]
| Creates a new gin-specific class loader that will load GWT and non-GWT types such that there is
never a conflict, especially with super source.
@param logger logger for errors that occur during class loading
@param context generator context in which classes are loaded
@return new gin class loader
@see GinBridgeClassLoader | [
"Creates",
"a",
"new",
"gin",
"-",
"specific",
"class",
"loader",
"that",
"will",
"load",
"GWT",
"and",
"non",
"-",
"GWT",
"types",
"such",
"that",
"there",
"is",
"never",
"a",
"conflict",
"especially",
"with",
"super",
"source",
"."
]
| train | https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/GinjectorGenerator.java#L86-L101 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/related/dublin/DublinCoreMetadata.java | DublinCoreMetadata.getValue | public static Object getValue(UserCoreRow<?, ?> row, DublinCoreType type) {
"""
Get the value from the row for the Dublin Core Type term
@param row
user row
@param type
Dublin Core Type
@return value
"""
UserColumn column = getColumn(row, type);
Object value = row.getValue(column.getIndex());
return value;
} | java | public static Object getValue(UserCoreRow<?, ?> row, DublinCoreType type) {
UserColumn column = getColumn(row, type);
Object value = row.getValue(column.getIndex());
return value;
} | [
"public",
"static",
"Object",
"getValue",
"(",
"UserCoreRow",
"<",
"?",
",",
"?",
">",
"row",
",",
"DublinCoreType",
"type",
")",
"{",
"UserColumn",
"column",
"=",
"getColumn",
"(",
"row",
",",
"type",
")",
";",
"Object",
"value",
"=",
"row",
".",
"getValue",
"(",
"column",
".",
"getIndex",
"(",
")",
")",
";",
"return",
"value",
";",
"}"
]
| Get the value from the row for the Dublin Core Type term
@param row
user row
@param type
Dublin Core Type
@return value | [
"Get",
"the",
"value",
"from",
"the",
"row",
"for",
"the",
"Dublin",
"Core",
"Type",
"term"
]
| train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/dublin/DublinCoreMetadata.java#L108-L115 |
wildfly-extras/wildfly-camel | config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java | IllegalArgumentAssertion.assertNotNull | public static <T> T assertNotNull(T value, String name) {
"""
Throws an IllegalArgumentException when the given value is null.
@param value the value to assert if not null
@param name the name of the argument
@param <T> The generic type of the value to assert if not null
@return the value
"""
if (value == null)
throw new IllegalArgumentException("Null " + name);
return value;
} | java | public static <T> T assertNotNull(T value, String name) {
if (value == null)
throw new IllegalArgumentException("Null " + name);
return value;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"assertNotNull",
"(",
"T",
"value",
",",
"String",
"name",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null \"",
"+",
"name",
")",
";",
"return",
"value",
";",
"}"
]
| Throws an IllegalArgumentException when the given value is null.
@param value the value to assert if not null
@param name the name of the argument
@param <T> The generic type of the value to assert if not null
@return the value | [
"Throws",
"an",
"IllegalArgumentException",
"when",
"the",
"given",
"value",
"is",
"null",
"."
]
| train | https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/config/src/main/java/org/wildfly/extras/config/internal/IllegalArgumentAssertion.java#L41-L46 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/Searcher.java | Searcher.hasSolution | public boolean hasSolution(Pattern p, BioPAXElement ... ele) {
"""
Checks if there is any match for the given pattern if search starts from the given element.
@param p pattern to search for
@param ele element to start from
@return true if there is a match
"""
Match m = new Match(p.size());
for (int i = 0; i < ele.length; i++)
{
m.set(ele[i], i);
}
return !search(m, p).isEmpty();
} | java | public boolean hasSolution(Pattern p, BioPAXElement ... ele)
{
Match m = new Match(p.size());
for (int i = 0; i < ele.length; i++)
{
m.set(ele[i], i);
}
return !search(m, p).isEmpty();
} | [
"public",
"boolean",
"hasSolution",
"(",
"Pattern",
"p",
",",
"BioPAXElement",
"...",
"ele",
")",
"{",
"Match",
"m",
"=",
"new",
"Match",
"(",
"p",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ele",
".",
"length",
";",
"i",
"++",
")",
"{",
"m",
".",
"set",
"(",
"ele",
"[",
"i",
"]",
",",
"i",
")",
";",
"}",
"return",
"!",
"search",
"(",
"m",
",",
"p",
")",
".",
"isEmpty",
"(",
")",
";",
"}"
]
| Checks if there is any match for the given pattern if search starts from the given element.
@param p pattern to search for
@param ele element to start from
@return true if there is a match | [
"Checks",
"if",
"there",
"is",
"any",
"match",
"for",
"the",
"given",
"pattern",
"if",
"search",
"starts",
"from",
"the",
"given",
"element",
"."
]
| train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Searcher.java#L308-L317 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDAvailabilityEstimatePersistenceImpl.java | CPDAvailabilityEstimatePersistenceImpl.findAll | @Override
public List<CPDAvailabilityEstimate> findAll() {
"""
Returns all the cpd availability estimates.
@return the cpd availability estimates
"""
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPDAvailabilityEstimate> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDAvailabilityEstimate",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
]
| Returns all the cpd availability estimates.
@return the cpd availability estimates | [
"Returns",
"all",
"the",
"cpd",
"availability",
"estimates",
"."
]
| train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDAvailabilityEstimatePersistenceImpl.java#L2905-L2908 |
groupe-sii/ogham | ogham-core/src/main/java/fr/sii/ogham/core/builder/MessagingBuilder.java | MessagingBuilder.findAndRegister | public static void findAndRegister(MessagingBuilder builder, String builderName, String... basePackages) {
"""
You can use this method if {@link #standard()} and {@link #minimal()}
factory methods doesn't fit your needs. The aim is to auto-configure a
builder with matching configurers.
Utility method that searches all {@link MessagingConfigurer}s that are in
the classpath. Only configurers that are in the provided packages (and
sub-packages) are loaded.
Once configurers are found, they are filtered thanks to information
provided by {@link ConfigurerFor} annotation. Only configurers with
{@link ConfigurerFor#targetedBuilder()} value that matches the
builderName parameter are kept.
The found and filtered configurers are registered into the provided
builder instance.
@param builder
the builder to configure with matching configurers
@param builderName
the name that is referenced by
{@link ConfigurerFor#targetedBuilder()}
@param basePackages
the packages that are scanned to find
{@link MessagingConfigurer} implementations
"""
Reflections reflections = new Reflections(basePackages, new SubTypesScanner());
Set<Class<? extends MessagingConfigurer>> configurerClasses = reflections.getSubTypesOf(MessagingConfigurer.class);
for (Class<? extends MessagingConfigurer> configurerClass : configurerClasses) {
ConfigurerFor annotation = configurerClass.getAnnotation(ConfigurerFor.class);
if (annotation != null && asList(annotation.targetedBuilder()).contains(builderName)) {
try {
builder.register(configurerClass.newInstance(), annotation.priority());
} catch (InstantiationException | IllegalAccessException e) {
LOG.error("Failed to register custom auto-discovered configurer (" + configurerClass.getSimpleName() + ") for standard messaging builder", e);
throw new BuildException("Failed to register custom auto-discovered configurer (" + configurerClass.getSimpleName() + ") for standard messaging builder", e);
}
}
}
} | java | public static void findAndRegister(MessagingBuilder builder, String builderName, String... basePackages) {
Reflections reflections = new Reflections(basePackages, new SubTypesScanner());
Set<Class<? extends MessagingConfigurer>> configurerClasses = reflections.getSubTypesOf(MessagingConfigurer.class);
for (Class<? extends MessagingConfigurer> configurerClass : configurerClasses) {
ConfigurerFor annotation = configurerClass.getAnnotation(ConfigurerFor.class);
if (annotation != null && asList(annotation.targetedBuilder()).contains(builderName)) {
try {
builder.register(configurerClass.newInstance(), annotation.priority());
} catch (InstantiationException | IllegalAccessException e) {
LOG.error("Failed to register custom auto-discovered configurer (" + configurerClass.getSimpleName() + ") for standard messaging builder", e);
throw new BuildException("Failed to register custom auto-discovered configurer (" + configurerClass.getSimpleName() + ") for standard messaging builder", e);
}
}
}
} | [
"public",
"static",
"void",
"findAndRegister",
"(",
"MessagingBuilder",
"builder",
",",
"String",
"builderName",
",",
"String",
"...",
"basePackages",
")",
"{",
"Reflections",
"reflections",
"=",
"new",
"Reflections",
"(",
"basePackages",
",",
"new",
"SubTypesScanner",
"(",
")",
")",
";",
"Set",
"<",
"Class",
"<",
"?",
"extends",
"MessagingConfigurer",
">",
">",
"configurerClasses",
"=",
"reflections",
".",
"getSubTypesOf",
"(",
"MessagingConfigurer",
".",
"class",
")",
";",
"for",
"(",
"Class",
"<",
"?",
"extends",
"MessagingConfigurer",
">",
"configurerClass",
":",
"configurerClasses",
")",
"{",
"ConfigurerFor",
"annotation",
"=",
"configurerClass",
".",
"getAnnotation",
"(",
"ConfigurerFor",
".",
"class",
")",
";",
"if",
"(",
"annotation",
"!=",
"null",
"&&",
"asList",
"(",
"annotation",
".",
"targetedBuilder",
"(",
")",
")",
".",
"contains",
"(",
"builderName",
")",
")",
"{",
"try",
"{",
"builder",
".",
"register",
"(",
"configurerClass",
".",
"newInstance",
"(",
")",
",",
"annotation",
".",
"priority",
"(",
")",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"|",
"IllegalAccessException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to register custom auto-discovered configurer (\"",
"+",
"configurerClass",
".",
"getSimpleName",
"(",
")",
"+",
"\") for standard messaging builder\"",
",",
"e",
")",
";",
"throw",
"new",
"BuildException",
"(",
"\"Failed to register custom auto-discovered configurer (\"",
"+",
"configurerClass",
".",
"getSimpleName",
"(",
")",
"+",
"\") for standard messaging builder\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}"
]
| You can use this method if {@link #standard()} and {@link #minimal()}
factory methods doesn't fit your needs. The aim is to auto-configure a
builder with matching configurers.
Utility method that searches all {@link MessagingConfigurer}s that are in
the classpath. Only configurers that are in the provided packages (and
sub-packages) are loaded.
Once configurers are found, they are filtered thanks to information
provided by {@link ConfigurerFor} annotation. Only configurers with
{@link ConfigurerFor#targetedBuilder()} value that matches the
builderName parameter are kept.
The found and filtered configurers are registered into the provided
builder instance.
@param builder
the builder to configure with matching configurers
@param builderName
the name that is referenced by
{@link ConfigurerFor#targetedBuilder()}
@param basePackages
the packages that are scanned to find
{@link MessagingConfigurer} implementations | [
"You",
"can",
"use",
"this",
"method",
"if",
"{",
"@link",
"#standard",
"()",
"}",
"and",
"{",
"@link",
"#minimal",
"()",
"}",
"factory",
"methods",
"doesn",
"t",
"fit",
"your",
"needs",
".",
"The",
"aim",
"is",
"to",
"auto",
"-",
"configure",
"a",
"builder",
"with",
"matching",
"configurers",
"."
]
| train | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/builder/MessagingBuilder.java#L1873-L1887 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunsInner.java | WorkflowRunsInner.getAsync | public Observable<WorkflowRunInner> getAsync(String resourceGroupName, String workflowName, String runName) {
"""
Gets a workflow run.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param runName The workflow run name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkflowRunInner object
"""
return getWithServiceResponseAsync(resourceGroupName, workflowName, runName).map(new Func1<ServiceResponse<WorkflowRunInner>, WorkflowRunInner>() {
@Override
public WorkflowRunInner call(ServiceResponse<WorkflowRunInner> response) {
return response.body();
}
});
} | java | public Observable<WorkflowRunInner> getAsync(String resourceGroupName, String workflowName, String runName) {
return getWithServiceResponseAsync(resourceGroupName, workflowName, runName).map(new Func1<ServiceResponse<WorkflowRunInner>, WorkflowRunInner>() {
@Override
public WorkflowRunInner call(ServiceResponse<WorkflowRunInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"WorkflowRunInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workflowName",
",",
"String",
"runName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workflowName",
",",
"runName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"WorkflowRunInner",
">",
",",
"WorkflowRunInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"WorkflowRunInner",
"call",
"(",
"ServiceResponse",
"<",
"WorkflowRunInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Gets a workflow run.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param runName The workflow run name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the WorkflowRunInner object | [
"Gets",
"a",
"workflow",
"run",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunsInner.java#L368-L375 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/creational/proxy/ObjectProxy.java | ObjectProxy.executeMethod | public static Object executeMethod(Object object, MethodCallFact methodCallFact)
throws Exception {
"""
Execute the method call on a object
@param object the target object that contains the method
@param methodCallFact the method call information
@return the return object of the method call
@throws Exception
"""
if (object == null)
throw new RequiredException("object");
if (methodCallFact == null)
throw new RequiredException("methodCallFact");
return executeMethod(object, methodCallFact.getMethodName(),methodCallFact.getArguments());
} | java | public static Object executeMethod(Object object, MethodCallFact methodCallFact)
throws Exception
{
if (object == null)
throw new RequiredException("object");
if (methodCallFact == null)
throw new RequiredException("methodCallFact");
return executeMethod(object, methodCallFact.getMethodName(),methodCallFact.getArguments());
} | [
"public",
"static",
"Object",
"executeMethod",
"(",
"Object",
"object",
",",
"MethodCallFact",
"methodCallFact",
")",
"throws",
"Exception",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"throw",
"new",
"RequiredException",
"(",
"\"object\"",
")",
";",
"if",
"(",
"methodCallFact",
"==",
"null",
")",
"throw",
"new",
"RequiredException",
"(",
"\"methodCallFact\"",
")",
";",
"return",
"executeMethod",
"(",
"object",
",",
"methodCallFact",
".",
"getMethodName",
"(",
")",
",",
"methodCallFact",
".",
"getArguments",
"(",
")",
")",
";",
"}"
]
| Execute the method call on a object
@param object the target object that contains the method
@param methodCallFact the method call information
@return the return object of the method call
@throws Exception | [
"Execute",
"the",
"method",
"call",
"on",
"a",
"object"
]
| train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/creational/proxy/ObjectProxy.java#L23-L33 |
galaxyproject/blend4j | src/main/java/com/github/jmchilton/blend4j/BaseClient.java | BaseClient.deleteResponse | protected ClientResponse deleteResponse(final WebResource webResource, java.lang.Object requestEntity, final boolean checkResponse) {
"""
Gets the response for a DELETE request.
@param webResource The {@link WebResource} to send the request to.
@param requestEntity The request entity.
@param checkResponse True if an exception should be thrown on failure, false otherwise.
@return The {@link ClientResponse} for this request.
@throws ResponseException If the response was not successful.
"""
final ClientResponse response = webResource.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).delete(ClientResponse.class, requestEntity);
if(checkResponse) {
this.checkResponse(response);
}
return response;
} | java | protected ClientResponse deleteResponse(final WebResource webResource, java.lang.Object requestEntity, final boolean checkResponse) {
final ClientResponse response = webResource.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).delete(ClientResponse.class, requestEntity);
if(checkResponse) {
this.checkResponse(response);
}
return response;
} | [
"protected",
"ClientResponse",
"deleteResponse",
"(",
"final",
"WebResource",
"webResource",
",",
"java",
".",
"lang",
".",
"Object",
"requestEntity",
",",
"final",
"boolean",
"checkResponse",
")",
"{",
"final",
"ClientResponse",
"response",
"=",
"webResource",
".",
"type",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"accept",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
".",
"delete",
"(",
"ClientResponse",
".",
"class",
",",
"requestEntity",
")",
";",
"if",
"(",
"checkResponse",
")",
"{",
"this",
".",
"checkResponse",
"(",
"response",
")",
";",
"}",
"return",
"response",
";",
"}"
]
| Gets the response for a DELETE request.
@param webResource The {@link WebResource} to send the request to.
@param requestEntity The request entity.
@param checkResponse True if an exception should be thrown on failure, false otherwise.
@return The {@link ClientResponse} for this request.
@throws ResponseException If the response was not successful. | [
"Gets",
"the",
"response",
"for",
"a",
"DELETE",
"request",
"."
]
| train | https://github.com/galaxyproject/blend4j/blob/a2ec4e412be40013bb88a3a2cf2478abd19ce162/src/main/java/com/github/jmchilton/blend4j/BaseClient.java#L90-L96 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GalleryImagesInner.java | GalleryImagesInner.updateAsync | public Observable<GalleryImageInner> updateAsync(String resourceGroupName, String labAccountName, String galleryImageName, GalleryImageFragment galleryImage) {
"""
Modify properties of gallery images.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param galleryImageName The name of the gallery Image.
@param galleryImage Represents an image from the Azure Marketplace
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the GalleryImageInner object
"""
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, galleryImageName, galleryImage).map(new Func1<ServiceResponse<GalleryImageInner>, GalleryImageInner>() {
@Override
public GalleryImageInner call(ServiceResponse<GalleryImageInner> response) {
return response.body();
}
});
} | java | public Observable<GalleryImageInner> updateAsync(String resourceGroupName, String labAccountName, String galleryImageName, GalleryImageFragment galleryImage) {
return updateWithServiceResponseAsync(resourceGroupName, labAccountName, galleryImageName, galleryImage).map(new Func1<ServiceResponse<GalleryImageInner>, GalleryImageInner>() {
@Override
public GalleryImageInner call(ServiceResponse<GalleryImageInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"GalleryImageInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"galleryImageName",
",",
"GalleryImageFragment",
"galleryImage",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
",",
"galleryImageName",
",",
"galleryImage",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"GalleryImageInner",
">",
",",
"GalleryImageInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"GalleryImageInner",
"call",
"(",
"ServiceResponse",
"<",
"GalleryImageInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Modify properties of gallery images.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param galleryImageName The name of the gallery Image.
@param galleryImage Represents an image from the Azure Marketplace
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the GalleryImageInner object | [
"Modify",
"properties",
"of",
"gallery",
"images",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GalleryImagesInner.java#L775-L782 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java | UsingLookup.of | public static UsingLookup of(Object lookup) {
"""
Creates class injector that defines a class using a method handle lookup.
@param lookup The {@code java.lang.invoke.MethodHandles$Lookup} instance to use.
@return An appropriate class injector.
"""
if (!DISPATCHER.isAlive()) {
throw new IllegalStateException("The current VM does not support class definition via method handle lookups");
} else if (!JavaType.METHOD_HANDLES_LOOKUP.isInstance(lookup)) {
throw new IllegalArgumentException("Not a method handle lookup: " + lookup);
} else if ((DISPATCHER.lookupModes(lookup) & PACKAGE_LOOKUP) == 0) {
throw new IllegalArgumentException("Lookup does not imply package-access: " + lookup);
}
return new UsingLookup(DISPATCHER.dropLookupMode(lookup, Opcodes.ACC_PRIVATE));
} | java | public static UsingLookup of(Object lookup) {
if (!DISPATCHER.isAlive()) {
throw new IllegalStateException("The current VM does not support class definition via method handle lookups");
} else if (!JavaType.METHOD_HANDLES_LOOKUP.isInstance(lookup)) {
throw new IllegalArgumentException("Not a method handle lookup: " + lookup);
} else if ((DISPATCHER.lookupModes(lookup) & PACKAGE_LOOKUP) == 0) {
throw new IllegalArgumentException("Lookup does not imply package-access: " + lookup);
}
return new UsingLookup(DISPATCHER.dropLookupMode(lookup, Opcodes.ACC_PRIVATE));
} | [
"public",
"static",
"UsingLookup",
"of",
"(",
"Object",
"lookup",
")",
"{",
"if",
"(",
"!",
"DISPATCHER",
".",
"isAlive",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The current VM does not support class definition via method handle lookups\"",
")",
";",
"}",
"else",
"if",
"(",
"!",
"JavaType",
".",
"METHOD_HANDLES_LOOKUP",
".",
"isInstance",
"(",
"lookup",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Not a method handle lookup: \"",
"+",
"lookup",
")",
";",
"}",
"else",
"if",
"(",
"(",
"DISPATCHER",
".",
"lookupModes",
"(",
"lookup",
")",
"&",
"PACKAGE_LOOKUP",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Lookup does not imply package-access: \"",
"+",
"lookup",
")",
";",
"}",
"return",
"new",
"UsingLookup",
"(",
"DISPATCHER",
".",
"dropLookupMode",
"(",
"lookup",
",",
"Opcodes",
".",
"ACC_PRIVATE",
")",
")",
";",
"}"
]
| Creates class injector that defines a class using a method handle lookup.
@param lookup The {@code java.lang.invoke.MethodHandles$Lookup} instance to use.
@return An appropriate class injector. | [
"Creates",
"class",
"injector",
"that",
"defines",
"a",
"class",
"using",
"a",
"method",
"handle",
"lookup",
"."
]
| train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading/ClassInjector.java#L1370-L1379 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.unescapeUriPathSegment | public static void unescapeUriPathSegment(final String text, final Writer writer, final String encoding)
throws IOException {
"""
<p>
Perform am URI path segment <strong>unescape</strong> operation
on a <tt>String</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input,
even for those characters that do not need to be percent-encoded in this context (unreserved characters
can be percent-encoded even if/when this is not required, though it is not generally considered a
good practice).
</p>
<p>
This method will use specified <tt>encoding</tt> in order to determine the characters specified in the
percent-encoded byte sequences.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@param encoding the encoding to be used for unescaping.
@throws IOException if an input/output exception occurs
@since 1.1.2
"""
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
UriEscapeUtil.unescape(new InternalStringReader(text), writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding);
} | java | public static void unescapeUriPathSegment(final String text, final Writer writer, final String encoding)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
if (encoding == null) {
throw new IllegalArgumentException("Argument 'encoding' cannot be null");
}
UriEscapeUtil.unescape(new InternalStringReader(text), writer, UriEscapeUtil.UriEscapeType.PATH_SEGMENT, encoding);
} | [
"public",
"static",
"void",
"unescapeUriPathSegment",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
",",
"final",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'writer' cannot be null\"",
")",
";",
"}",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'encoding' cannot be null\"",
")",
";",
"}",
"UriEscapeUtil",
".",
"unescape",
"(",
"new",
"InternalStringReader",
"(",
"text",
")",
",",
"writer",
",",
"UriEscapeUtil",
".",
"UriEscapeType",
".",
"PATH_SEGMENT",
",",
"encoding",
")",
";",
"}"
]
| <p>
Perform am URI path segment <strong>unescape</strong> operation
on a <tt>String</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input,
even for those characters that do not need to be percent-encoded in this context (unreserved characters
can be percent-encoded even if/when this is not required, though it is not generally considered a
good practice).
</p>
<p>
This method will use specified <tt>encoding</tt> in order to determine the characters specified in the
percent-encoded byte sequences.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@param encoding the encoding to be used for unescaping.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"am",
"URI",
"path",
"segment",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"will",
"unescape",
"every",
"percent",
"-",
"encoded",
"(",
"<tt",
">",
"%HH<",
"/",
"tt",
">",
")",
"sequences",
"present",
"in",
"input",
"even",
"for",
"those",
"characters",
"that",
"do",
"not",
"need",
"to",
"be",
"percent",
"-",
"encoded",
"in",
"this",
"context",
"(",
"unreserved",
"characters",
"can",
"be",
"percent",
"-",
"encoded",
"even",
"if",
"/",
"when",
"this",
"is",
"not",
"required",
"though",
"it",
"is",
"not",
"generally",
"considered",
"a",
"good",
"practice",
")",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"will",
"use",
"specified",
"<tt",
">",
"encoding<",
"/",
"tt",
">",
"in",
"order",
"to",
"determine",
"the",
"characters",
"specified",
"in",
"the",
"percent",
"-",
"encoded",
"byte",
"sequences",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"method",
"is",
"<strong",
">",
"thread",
"-",
"safe<",
"/",
"strong",
">",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1911-L1924 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getDeletedSecretsAsync | public Observable<Page<DeletedSecretItem>> getDeletedSecretsAsync(final String vaultBaseUrl, final Integer maxresults) {
"""
Lists deleted secrets for the specified vault.
The Get Deleted Secrets operation returns the secrets that have been deleted for a vault enabled for soft-delete. This operation requires the secrets/list permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DeletedSecretItem> object
"""
return getDeletedSecretsWithServiceResponseAsync(vaultBaseUrl, maxresults)
.map(new Func1<ServiceResponse<Page<DeletedSecretItem>>, Page<DeletedSecretItem>>() {
@Override
public Page<DeletedSecretItem> call(ServiceResponse<Page<DeletedSecretItem>> response) {
return response.body();
}
});
} | java | public Observable<Page<DeletedSecretItem>> getDeletedSecretsAsync(final String vaultBaseUrl, final Integer maxresults) {
return getDeletedSecretsWithServiceResponseAsync(vaultBaseUrl, maxresults)
.map(new Func1<ServiceResponse<Page<DeletedSecretItem>>, Page<DeletedSecretItem>>() {
@Override
public Page<DeletedSecretItem> call(ServiceResponse<Page<DeletedSecretItem>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DeletedSecretItem",
">",
">",
"getDeletedSecretsAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"Integer",
"maxresults",
")",
"{",
"return",
"getDeletedSecretsWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"maxresults",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DeletedSecretItem",
">",
">",
",",
"Page",
"<",
"DeletedSecretItem",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"DeletedSecretItem",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"DeletedSecretItem",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Lists deleted secrets for the specified vault.
The Get Deleted Secrets operation returns the secrets that have been deleted for a vault enabled for soft-delete. This operation requires the secrets/list permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DeletedSecretItem> object | [
"Lists",
"deleted",
"secrets",
"for",
"the",
"specified",
"vault",
".",
"The",
"Get",
"Deleted",
"Secrets",
"operation",
"returns",
"the",
"secrets",
"that",
"have",
"been",
"deleted",
"for",
"a",
"vault",
"enabled",
"for",
"soft",
"-",
"delete",
".",
"This",
"operation",
"requires",
"the",
"secrets",
"/",
"list",
"permission",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L4561-L4569 |
reactor/reactor-netty | src/main/java/reactor/netty/channel/ChannelOperations.java | ChannelOperations.addReactiveBridge | public static void addReactiveBridge(Channel ch, OnSetup opsFactory, ConnectionObserver listener) {
"""
Add {@link NettyPipeline#ReactiveBridge} handler at the end of {@link Channel}
pipeline. The bridge will buffer outgoing write and pass along incoming read to
the current {@link ChannelOperations#get(Channel)}.
@param ch the channel to bridge
@param opsFactory the operations factory to invoke on channel active
@param listener the listener to forward connection events to
"""
ch.pipeline()
.addLast(NettyPipeline.ReactiveBridge, new ChannelOperationsHandler(opsFactory, listener));
} | java | public static void addReactiveBridge(Channel ch, OnSetup opsFactory, ConnectionObserver listener) {
ch.pipeline()
.addLast(NettyPipeline.ReactiveBridge, new ChannelOperationsHandler(opsFactory, listener));
} | [
"public",
"static",
"void",
"addReactiveBridge",
"(",
"Channel",
"ch",
",",
"OnSetup",
"opsFactory",
",",
"ConnectionObserver",
"listener",
")",
"{",
"ch",
".",
"pipeline",
"(",
")",
".",
"addLast",
"(",
"NettyPipeline",
".",
"ReactiveBridge",
",",
"new",
"ChannelOperationsHandler",
"(",
"opsFactory",
",",
"listener",
")",
")",
";",
"}"
]
| Add {@link NettyPipeline#ReactiveBridge} handler at the end of {@link Channel}
pipeline. The bridge will buffer outgoing write and pass along incoming read to
the current {@link ChannelOperations#get(Channel)}.
@param ch the channel to bridge
@param opsFactory the operations factory to invoke on channel active
@param listener the listener to forward connection events to | [
"Add",
"{",
"@link",
"NettyPipeline#ReactiveBridge",
"}",
"handler",
"at",
"the",
"end",
"of",
"{",
"@link",
"Channel",
"}",
"pipeline",
".",
"The",
"bridge",
"will",
"buffer",
"outgoing",
"write",
"and",
"pass",
"along",
"incoming",
"read",
"to",
"the",
"current",
"{",
"@link",
"ChannelOperations#get",
"(",
"Channel",
")",
"}",
"."
]
| train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/channel/ChannelOperations.java#L74-L77 |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java | SessionProvider.close | public synchronized void close() {
"""
Calls logout() method for all cached sessions.
Session will be removed from cache by the listener (this provider) via
ExtendedSession.logout().
"""
if (closed)
{
throw new IllegalStateException("Session provider already closed");
}
closed = true;
for (ExtendedSession session : (ExtendedSession[])cache.values().toArray(
new ExtendedSession[cache.values().size()]))
session.logout();
// the cache already empty (logout listener work, see onCloseSession())
// just to be sure
cache.clear();
} | java | public synchronized void close()
{
if (closed)
{
throw new IllegalStateException("Session provider already closed");
}
closed = true;
for (ExtendedSession session : (ExtendedSession[])cache.values().toArray(
new ExtendedSession[cache.values().size()]))
session.logout();
// the cache already empty (logout listener work, see onCloseSession())
// just to be sure
cache.clear();
} | [
"public",
"synchronized",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"closed",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Session provider already closed\"",
")",
";",
"}",
"closed",
"=",
"true",
";",
"for",
"(",
"ExtendedSession",
"session",
":",
"(",
"ExtendedSession",
"[",
"]",
")",
"cache",
".",
"values",
"(",
")",
".",
"toArray",
"(",
"new",
"ExtendedSession",
"[",
"cache",
".",
"values",
"(",
")",
".",
"size",
"(",
")",
"]",
")",
")",
"session",
".",
"logout",
"(",
")",
";",
"// the cache already empty (logout listener work, see onCloseSession())",
"// just to be sure",
"cache",
".",
"clear",
"(",
")",
";",
"}"
]
| Calls logout() method for all cached sessions.
Session will be removed from cache by the listener (this provider) via
ExtendedSession.logout(). | [
"Calls",
"logout",
"()",
"method",
"for",
"all",
"cached",
"sessions",
"."
]
| train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/common/SessionProvider.java#L219-L236 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.hosting_privateDatabase_new_duration_POST | public OvhOrder hosting_privateDatabase_new_duration_POST(String duration, OvhDatacenterEnum datacenter, net.minidev.ovh.api.hosting.privatedatabase.OvhOfferEnum offer, OvhAvailableRamSizeEnum ram, OvhOrderableVersionEnum version) throws IOException {
"""
Create order
REST: POST /order/hosting/privateDatabase/new/{duration}
@param version [required] Private database available versions
@param datacenter [required] Datacenter to deploy this new private database
@param ram [required] Private database ram size
@param offer [required] Type of offer to deploy this new private database
@param duration [required] Duration
"""
String qPath = "/order/hosting/privateDatabase/new/{duration}";
StringBuilder sb = path(qPath, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "datacenter", datacenter);
addBody(o, "offer", offer);
addBody(o, "ram", ram);
addBody(o, "version", version);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder hosting_privateDatabase_new_duration_POST(String duration, OvhDatacenterEnum datacenter, net.minidev.ovh.api.hosting.privatedatabase.OvhOfferEnum offer, OvhAvailableRamSizeEnum ram, OvhOrderableVersionEnum version) throws IOException {
String qPath = "/order/hosting/privateDatabase/new/{duration}";
StringBuilder sb = path(qPath, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "datacenter", datacenter);
addBody(o, "offer", offer);
addBody(o, "ram", ram);
addBody(o, "version", version);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"hosting_privateDatabase_new_duration_POST",
"(",
"String",
"duration",
",",
"OvhDatacenterEnum",
"datacenter",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"hosting",
".",
"privatedatabase",
".",
"OvhOfferEnum",
"offer",
",",
"OvhAvailableRamSizeEnum",
"ram",
",",
"OvhOrderableVersionEnum",
"version",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/hosting/privateDatabase/new/{duration}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"duration",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"datacenter\"",
",",
"datacenter",
")",
";",
"addBody",
"(",
"o",
",",
"\"offer\"",
",",
"offer",
")",
";",
"addBody",
"(",
"o",
",",
"\"ram\"",
",",
"ram",
")",
";",
"addBody",
"(",
"o",
",",
"\"version\"",
",",
"version",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOrder",
".",
"class",
")",
";",
"}"
]
| Create order
REST: POST /order/hosting/privateDatabase/new/{duration}
@param version [required] Private database available versions
@param datacenter [required] Datacenter to deploy this new private database
@param ram [required] Private database ram size
@param offer [required] Type of offer to deploy this new private database
@param duration [required] Duration | [
"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#L5136-L5146 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.