repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
JOML-CI/JOML | src/org/joml/Intersectiond.java | Intersectiond.intersectRayLineSegment | public static double intersectRayLineSegment(Vector2dc origin, Vector2dc dir, Vector2dc a, Vector2dc b) {
return intersectRayLineSegment(origin.x(), origin.y(), dir.x(), dir.y(), a.x(), a.y(), b.x(), b.y());
} | java | public static double intersectRayLineSegment(Vector2dc origin, Vector2dc dir, Vector2dc a, Vector2dc b) {
return intersectRayLineSegment(origin.x(), origin.y(), dir.x(), dir.y(), a.x(), a.y(), b.x(), b.y());
} | [
"public",
"static",
"double",
"intersectRayLineSegment",
"(",
"Vector2dc",
"origin",
",",
"Vector2dc",
"dir",
",",
"Vector2dc",
"a",
",",
"Vector2dc",
"b",
")",
"{",
"return",
"intersectRayLineSegment",
"(",
"origin",
".",
"x",
"(",
")",
",",
"origin",
".",
... | Determine whether the ray with given <code>origin</code> and direction <code>dir</code> intersects the undirected line segment
given by the two end points <code>a</code> and <code>b</code>, and return the value of the parameter <i>t</i> in the ray equation
<i>p(t) = origin + t * dir</i> of the intersection point, if any.
<p>
This method returns <code>-1.0</code> if the ray does not intersect the line segment.
@see #intersectRayLineSegment(double, double, double, double, double, double, double, double)
@param origin
the ray's origin
@param dir
the ray's direction
@param a
the line segment's first end point
@param b
the line segment's second end point
@return the value of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> of the intersection point, if the ray
intersects the line segment; <code>-1.0</code> otherwise | [
"Determine",
"whether",
"the",
"ray",
"with",
"given",
"<code",
">",
"origin<",
"/",
"code",
">",
"and",
"direction",
"<code",
">",
"dir<",
"/",
"code",
">",
"intersects",
"the",
"undirected",
"line",
"segment",
"given",
"by",
"the",
"two",
"end",
"points"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L4015-L4017 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_hunting_agent_agentId_PUT | public void billingAccount_easyHunting_serviceName_hunting_agent_agentId_PUT(String billingAccount, String serviceName, Long agentId, OvhOvhPabxHuntingAgent body) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, agentId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_easyHunting_serviceName_hunting_agent_agentId_PUT(String billingAccount, String serviceName, Long agentId, OvhOvhPabxHuntingAgent body) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, agentId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_easyHunting_serviceName_hunting_agent_agentId_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"agentId",
",",
"OvhOvhPabxHuntingAgent",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"... | Alter this object properties
REST: PUT /telephony/{billingAccount}/easyHunting/{serviceName}/hunting/agent/{agentId}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param agentId [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L2374-L2378 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java | UserResourcesImpl.addUser | public User addUser(User user, boolean sendEmail) throws SmartsheetException {
return this.createResource("users?sendEmail=" + sendEmail, User.class, user);
} | java | public User addUser(User user, boolean sendEmail) throws SmartsheetException {
return this.createResource("users?sendEmail=" + sendEmail, User.class, user);
} | [
"public",
"User",
"addUser",
"(",
"User",
"user",
",",
"boolean",
"sendEmail",
")",
"throws",
"SmartsheetException",
"{",
"return",
"this",
".",
"createResource",
"(",
"\"users?sendEmail=\"",
"+",
"sendEmail",
",",
"User",
".",
"class",
",",
"user",
")",
";",
... | Add a user to the organization, without sending email.
It mirrors to the following Smartsheet REST API method: POST /users
Exceptions:
- IllegalArgumentException : if any argument is null
- InvalidRequestException : if there is any problem with the REST API request
- AuthorizationException : if there is any problem with the REST API authorization(access token)
- ResourceNotFoundException : if the resource can not be found
- ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
- SmartsheetRestException : if there is any other REST API related error occurred during the operation
- SmartsheetException : if there is any other error occurred during the operation
@param user the created user
@param sendEmail whether to send email
@return the user object limited to the following attributes: * admin * email * licensedSheetCreator
@throws SmartsheetException the smartsheet exception | [
"Add",
"a",
"user",
"to",
"the",
"organization",
"without",
"sending",
"email",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/UserResourcesImpl.java#L145-L147 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.setTransactionIsolation | public final void setTransactionIsolation(int isoLevel) throws SQLException
{
if (currentTransactionIsolation != isoLevel) {
// Reject switching to an isolation level of TRANSACTION_NONE
if (isoLevel == Connection.TRANSACTION_NONE) {
throw new SQLException(AdapterUtil.getNLSMessage("DSRA4011.tran.none.iso.switch.unsupported", dsConfig.get().id));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Set Isolation Level to " + AdapterUtil.getIsolationLevelString(isoLevel));
// Don't update the isolation level until AFTER the operation completes
// succesfully on the underlying Connection.
sqlConn.setTransactionIsolation(isoLevel);
currentTransactionIsolation = isoLevel;
isolationChanged = true;
}
if (cachedConnection != null)
cachedConnection.setCurrentTransactionIsolation(currentTransactionIsolation, key);
} | java | public final void setTransactionIsolation(int isoLevel) throws SQLException
{
if (currentTransactionIsolation != isoLevel) {
// Reject switching to an isolation level of TRANSACTION_NONE
if (isoLevel == Connection.TRANSACTION_NONE) {
throw new SQLException(AdapterUtil.getNLSMessage("DSRA4011.tran.none.iso.switch.unsupported", dsConfig.get().id));
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Set Isolation Level to " + AdapterUtil.getIsolationLevelString(isoLevel));
// Don't update the isolation level until AFTER the operation completes
// succesfully on the underlying Connection.
sqlConn.setTransactionIsolation(isoLevel);
currentTransactionIsolation = isoLevel;
isolationChanged = true;
}
if (cachedConnection != null)
cachedConnection.setCurrentTransactionIsolation(currentTransactionIsolation, key);
} | [
"public",
"final",
"void",
"setTransactionIsolation",
"(",
"int",
"isoLevel",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"currentTransactionIsolation",
"!=",
"isoLevel",
")",
"{",
"// Reject switching to an isolation level of TRANSACTION_NONE",
"if",
"(",
"isoLevel",
... | Set the transactionIsolation level to the requested Isolation Level.
If the requested and current are the same, then do not drive it to the database
If they are different, drive it all the way to the database. | [
"Set",
"the",
"transactionIsolation",
"level",
"to",
"the",
"requested",
"Isolation",
"Level",
".",
"If",
"the",
"requested",
"and",
"current",
"are",
"the",
"same",
"then",
"do",
"not",
"drive",
"it",
"to",
"the",
"database",
"If",
"they",
"are",
"different... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L3975-L3995 |
SQLDroid/SQLDroid | src/main/java/org/sqldroid/SQLDroidPreparedStatement.java | SQLDroidPreparedStatement.setBinaryStream | @Override
public void setBinaryStream(int parameterIndex, InputStream inputStream, int length) throws SQLException {
if (length <= 0) {
throw new SQLException ("Invalid length " + length);
}
if (inputStream == null ) {
throw new SQLException ("Input Stream cannot be null");
}
final int bufferSize = 8192;
byte[] buffer = new byte[bufferSize];
ByteArrayOutputStream outputStream = null;
try {
outputStream = new ByteArrayOutputStream();
int bytesRemaining = length;
int bytesRead;
int maxReadSize;
while (bytesRemaining > 0) {
maxReadSize = (bytesRemaining > bufferSize) ? bufferSize : bytesRemaining;
bytesRead = inputStream.read(buffer, 0, maxReadSize);
if (bytesRead == -1) { // inputStream exhausted
break;
}
outputStream.write(buffer, 0, bytesRead);
bytesRemaining = bytesRemaining - bytesRead;
}
setBytes(parameterIndex, outputStream.toByteArray());
outputStream.close();
} catch (IOException e) {
throw new SQLException(e.getMessage());
}
} | java | @Override
public void setBinaryStream(int parameterIndex, InputStream inputStream, int length) throws SQLException {
if (length <= 0) {
throw new SQLException ("Invalid length " + length);
}
if (inputStream == null ) {
throw new SQLException ("Input Stream cannot be null");
}
final int bufferSize = 8192;
byte[] buffer = new byte[bufferSize];
ByteArrayOutputStream outputStream = null;
try {
outputStream = new ByteArrayOutputStream();
int bytesRemaining = length;
int bytesRead;
int maxReadSize;
while (bytesRemaining > 0) {
maxReadSize = (bytesRemaining > bufferSize) ? bufferSize : bytesRemaining;
bytesRead = inputStream.read(buffer, 0, maxReadSize);
if (bytesRead == -1) { // inputStream exhausted
break;
}
outputStream.write(buffer, 0, bytesRead);
bytesRemaining = bytesRemaining - bytesRead;
}
setBytes(parameterIndex, outputStream.toByteArray());
outputStream.close();
} catch (IOException e) {
throw new SQLException(e.getMessage());
}
} | [
"@",
"Override",
"public",
"void",
"setBinaryStream",
"(",
"int",
"parameterIndex",
",",
"InputStream",
"inputStream",
",",
"int",
"length",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"length",
"<=",
"0",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"\... | Set the parameter from the contents of a binary stream.
@param parameterIndex the index of the parameter to set
@param inputStream the input stream from which a byte array will be read and set as the value. If inputStream is null
this method will throw a SQLException
@param length a positive non-zero length values
@exception SQLException thrown if the length is <= 0, the inputStream is null,
there is an IOException reading the inputStream or if "setBytes" throws a SQLException | [
"Set",
"the",
"parameter",
"from",
"the",
"contents",
"of",
"a",
"binary",
"stream",
"."
] | train | https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLDroidPreparedStatement.java#L514-L544 |
alibaba/canal | client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESTemplate.java | ESTemplate.getEsType | @SuppressWarnings("unchecked")
private String getEsType(ESMapping mapping, String fieldName) {
String key = mapping.get_index() + "-" + mapping.get_type();
Map<String, String> fieldType = esFieldTypes.get(key);
if (fieldType == null) {
ImmutableOpenMap<String, MappingMetaData> mappings;
try {
mappings = transportClient.admin()
.cluster()
.prepareState()
.execute()
.actionGet()
.getState()
.getMetaData()
.getIndices()
.get(mapping.get_index())
.getMappings();
} catch (NullPointerException e) {
throw new IllegalArgumentException("Not found the mapping info of index: " + mapping.get_index());
}
MappingMetaData mappingMetaData = mappings.get(mapping.get_type());
if (mappingMetaData == null) {
throw new IllegalArgumentException("Not found the mapping info of index: " + mapping.get_index());
}
fieldType = new LinkedHashMap<>();
Map<String, Object> sourceMap = mappingMetaData.getSourceAsMap();
Map<String, Object> esMapping = (Map<String, Object>) sourceMap.get("properties");
for (Map.Entry<String, Object> entry : esMapping.entrySet()) {
Map<String, Object> value = (Map<String, Object>) entry.getValue();
if (value.containsKey("properties")) {
fieldType.put(entry.getKey(), "object");
} else {
fieldType.put(entry.getKey(), (String) value.get("type"));
}
}
esFieldTypes.put(key, fieldType);
}
return fieldType.get(fieldName);
} | java | @SuppressWarnings("unchecked")
private String getEsType(ESMapping mapping, String fieldName) {
String key = mapping.get_index() + "-" + mapping.get_type();
Map<String, String> fieldType = esFieldTypes.get(key);
if (fieldType == null) {
ImmutableOpenMap<String, MappingMetaData> mappings;
try {
mappings = transportClient.admin()
.cluster()
.prepareState()
.execute()
.actionGet()
.getState()
.getMetaData()
.getIndices()
.get(mapping.get_index())
.getMappings();
} catch (NullPointerException e) {
throw new IllegalArgumentException("Not found the mapping info of index: " + mapping.get_index());
}
MappingMetaData mappingMetaData = mappings.get(mapping.get_type());
if (mappingMetaData == null) {
throw new IllegalArgumentException("Not found the mapping info of index: " + mapping.get_index());
}
fieldType = new LinkedHashMap<>();
Map<String, Object> sourceMap = mappingMetaData.getSourceAsMap();
Map<String, Object> esMapping = (Map<String, Object>) sourceMap.get("properties");
for (Map.Entry<String, Object> entry : esMapping.entrySet()) {
Map<String, Object> value = (Map<String, Object>) entry.getValue();
if (value.containsKey("properties")) {
fieldType.put(entry.getKey(), "object");
} else {
fieldType.put(entry.getKey(), (String) value.get("type"));
}
}
esFieldTypes.put(key, fieldType);
}
return fieldType.get(fieldName);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"String",
"getEsType",
"(",
"ESMapping",
"mapping",
",",
"String",
"fieldName",
")",
"{",
"String",
"key",
"=",
"mapping",
".",
"get_index",
"(",
")",
"+",
"\"-\"",
"+",
"mapping",
".",
"get_type... | 获取es mapping中的属性类型
@param mapping mapping配置
@param fieldName 属性名
@return 类型 | [
"获取es",
"mapping中的属性类型"
] | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/elasticsearch/src/main/java/com/alibaba/otter/canal/client/adapter/es/support/ESTemplate.java#L489-L530 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfPKCS7.java | PdfPKCS7.getAuthenticatedAttributeBytes | public byte[] getAuthenticatedAttributeBytes(byte secondDigest[], Calendar signingTime, byte[] ocsp) {
try {
return getAuthenticatedAttributeSet(secondDigest, signingTime, ocsp).getEncoded(ASN1Encoding.DER);
}
catch (Exception e) {
throw new ExceptionConverter(e);
}
} | java | public byte[] getAuthenticatedAttributeBytes(byte secondDigest[], Calendar signingTime, byte[] ocsp) {
try {
return getAuthenticatedAttributeSet(secondDigest, signingTime, ocsp).getEncoded(ASN1Encoding.DER);
}
catch (Exception e) {
throw new ExceptionConverter(e);
}
} | [
"public",
"byte",
"[",
"]",
"getAuthenticatedAttributeBytes",
"(",
"byte",
"secondDigest",
"[",
"]",
",",
"Calendar",
"signingTime",
",",
"byte",
"[",
"]",
"ocsp",
")",
"{",
"try",
"{",
"return",
"getAuthenticatedAttributeSet",
"(",
"secondDigest",
",",
"signing... | When using authenticatedAttributes the authentication process is different.
The document digest is generated and put inside the attribute. The signing is done over the DER encoded
authenticatedAttributes. This method provides that encoding and the parameters must be
exactly the same as in {@link #getEncodedPKCS7(byte[],Calendar)}.
<p>
A simple example:
<p>
<pre>
Calendar cal = Calendar.getInstance();
PdfPKCS7 pk7 = new PdfPKCS7(key, chain, null, "SHA1", null, false);
MessageDigest messageDigest = MessageDigest.getInstance("SHA1");
byte buf[] = new byte[8192];
int n;
InputStream inp = sap.getRangeStream();
while ((n = inp.read(buf)) > 0) {
messageDigest.update(buf, 0, n);
}
byte hash[] = messageDigest.digest();
byte sh[] = pk7.getAuthenticatedAttributeBytes(hash, cal);
pk7.update(sh, 0, sh.length);
byte sg[] = pk7.getEncodedPKCS7(hash, cal);
</pre>
@param secondDigest the content digest
@param signingTime the signing time
@return the byte array representation of the authenticatedAttributes ready to be signed | [
"When",
"using",
"authenticatedAttributes",
"the",
"authentication",
"process",
"is",
"different",
".",
"The",
"document",
"digest",
"is",
"generated",
"and",
"put",
"inside",
"the",
"attribute",
".",
"The",
"signing",
"is",
"done",
"over",
"the",
"DER",
"encode... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfPKCS7.java#L1356-L1363 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/DiSH.java | DiSH.subspaceDimensionality | private int subspaceDimensionality(NumberVector v1, NumberVector v2, long[] pv1, long[] pv2, long[] commonPreferenceVector) {
// number of zero values in commonPreferenceVector
int subspaceDim = v1.getDimensionality() - BitsUtil.cardinality(commonPreferenceVector);
// special case: v1 and v2 are in parallel subspaces
if(BitsUtil.equal(commonPreferenceVector, pv1) || BitsUtil.equal(commonPreferenceVector, pv2)) {
double d = weightedDistance(v1, v2, commonPreferenceVector);
if(d > 2 * epsilon) {
subspaceDim++;
}
}
return subspaceDim;
} | java | private int subspaceDimensionality(NumberVector v1, NumberVector v2, long[] pv1, long[] pv2, long[] commonPreferenceVector) {
// number of zero values in commonPreferenceVector
int subspaceDim = v1.getDimensionality() - BitsUtil.cardinality(commonPreferenceVector);
// special case: v1 and v2 are in parallel subspaces
if(BitsUtil.equal(commonPreferenceVector, pv1) || BitsUtil.equal(commonPreferenceVector, pv2)) {
double d = weightedDistance(v1, v2, commonPreferenceVector);
if(d > 2 * epsilon) {
subspaceDim++;
}
}
return subspaceDim;
} | [
"private",
"int",
"subspaceDimensionality",
"(",
"NumberVector",
"v1",
",",
"NumberVector",
"v2",
",",
"long",
"[",
"]",
"pv1",
",",
"long",
"[",
"]",
"pv2",
",",
"long",
"[",
"]",
"commonPreferenceVector",
")",
"{",
"// number of zero values in commonPreferenceVe... | Compute the common subspace dimensionality of two vectors.
@param v1 First vector
@param v2 Second vector
@param pv1 First preference
@param pv2 Second preference
@param commonPreferenceVector Common preference
@return Usually, v1.dim - commonPreference.cardinality, unless either pv1
and pv2 are a subset of the other. | [
"Compute",
"the",
"common",
"subspace",
"dimensionality",
"of",
"two",
"vectors",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/DiSH.java#L577-L589 |
belaban/JGroups | src/org/jgroups/blocks/MessageDispatcher.java | MessageDispatcher.sendMessageWithFuture | public <T> CompletableFuture<T> sendMessageWithFuture(Address dest, Buffer data, RequestOptions opts) throws Exception {
if(dest == null)
throw new IllegalArgumentException("message destination is null, cannot send message");
if(opts == null) {
log.warn("request options were null, using default of sync");
opts=RequestOptions.SYNC();
}
rpc_stats.add(RpcStats.Type.UNICAST, dest, opts.mode() != ResponseMode.GET_NONE, 0);
if(opts.mode() == ResponseMode.GET_NONE) {
corr.sendUnicastRequest(dest, data, null, opts);
return null;
}
// if we get here, the RPC is synchronous
UnicastRequest<T> req=new UnicastRequest<>(corr, dest, opts);
req.execute(data, false);
return req;
} | java | public <T> CompletableFuture<T> sendMessageWithFuture(Address dest, Buffer data, RequestOptions opts) throws Exception {
if(dest == null)
throw new IllegalArgumentException("message destination is null, cannot send message");
if(opts == null) {
log.warn("request options were null, using default of sync");
opts=RequestOptions.SYNC();
}
rpc_stats.add(RpcStats.Type.UNICAST, dest, opts.mode() != ResponseMode.GET_NONE, 0);
if(opts.mode() == ResponseMode.GET_NONE) {
corr.sendUnicastRequest(dest, data, null, opts);
return null;
}
// if we get here, the RPC is synchronous
UnicastRequest<T> req=new UnicastRequest<>(corr, dest, opts);
req.execute(data, false);
return req;
} | [
"public",
"<",
"T",
">",
"CompletableFuture",
"<",
"T",
">",
"sendMessageWithFuture",
"(",
"Address",
"dest",
",",
"Buffer",
"data",
",",
"RequestOptions",
"opts",
")",
"throws",
"Exception",
"{",
"if",
"(",
"dest",
"==",
"null",
")",
"throw",
"new",
"Ille... | Sends a unicast message to the target defined by msg.getDest() and returns a future
@param dest the target to which to send the unicast message. Must not be null.
@param data the payload to send
@param opts the options
@return CompletableFuture<T> A future from which the result can be fetched, or null if the call was asynchronous
@throws Exception If there was problem sending the request, processing it at the receiver, or processing
it at the sender. {@link java.util.concurrent.Future#get()} will throw this exception | [
"Sends",
"a",
"unicast",
"message",
"to",
"the",
"target",
"defined",
"by",
"msg",
".",
"getDest",
"()",
"and",
"returns",
"a",
"future"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/MessageDispatcher.java#L412-L431 |
mnlipp/jgrapes | org.jgrapes.io/src/org/jgrapes/net/SslCodec.java | SslCodec.onAccepted | @Handler(channels = EncryptedChannel.class)
public void onAccepted(Accepted event, IOSubchannel encryptedChannel) {
new PlainChannel(event, encryptedChannel);
} | java | @Handler(channels = EncryptedChannel.class)
public void onAccepted(Accepted event, IOSubchannel encryptedChannel) {
new PlainChannel(event, encryptedChannel);
} | [
"@",
"Handler",
"(",
"channels",
"=",
"EncryptedChannel",
".",
"class",
")",
"public",
"void",
"onAccepted",
"(",
"Accepted",
"event",
",",
"IOSubchannel",
"encryptedChannel",
")",
"{",
"new",
"PlainChannel",
"(",
"event",
",",
"encryptedChannel",
")",
";",
"}... | Creates a new downstream connection as {@link LinkedIOSubchannel}
of the network connection together with an {@link SSLEngine}.
@param event
the accepted event | [
"Creates",
"a",
"new",
"downstream",
"connection",
"as",
"{",
"@link",
"LinkedIOSubchannel",
"}",
"of",
"the",
"network",
"connection",
"together",
"with",
"an",
"{",
"@link",
"SSLEngine",
"}",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/net/SslCodec.java#L155-L158 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.purgeDeletedKeyAsync | public Observable<Void> purgeDeletedKeyAsync(String vaultBaseUrl, String keyName) {
return purgeDeletedKeyWithServiceResponseAsync(vaultBaseUrl, keyName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> purgeDeletedKeyAsync(String vaultBaseUrl, String keyName) {
return purgeDeletedKeyWithServiceResponseAsync(vaultBaseUrl, keyName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"purgeDeletedKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
")",
"{",
"return",
"purgeDeletedKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
")",
".",
"map",
"(",
"new",
"Func1",
"<"... | Permanently deletes the specified key.
The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the operation can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/purge permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Permanently",
"deletes",
"the",
"specified",
"key",
".",
"The",
"Purge",
"Deleted",
"Key",
"operation",
"is",
"applicable",
"for",
"soft",
"-",
"delete",
"enabled",
"vaults",
".",
"While",
"the",
"operation",
"can",
"be",
"invoked",
"on",
"any",
"vault",
"i... | 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#L3172-L3179 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/EnforceTrifocalGeometry.java | EnforceTrifocalGeometry.constructE | protected void constructE( Point3D_F64 e2 , Point3D_F64 e3 ) {
E.zero();
for( int i = 0; i < 3; i++ ) {
for( int j = 0; j < 3; j++ ) {
for( int k = 0; k < 3; k++ ) {
// which element in the trifocal tensor is being manipulated
int row = 9*i + 3*j + k;
// which unknowns are being multiplied by
int col1 = j*3 + i;
int col2 = k*3 + i + 9;
E.data[row*18 + col1 ] = e3.getIdx(k);
E.data[row*18 + col2 ] = -e2.getIdx(j);
}
}
}
} | java | protected void constructE( Point3D_F64 e2 , Point3D_F64 e3 ) {
E.zero();
for( int i = 0; i < 3; i++ ) {
for( int j = 0; j < 3; j++ ) {
for( int k = 0; k < 3; k++ ) {
// which element in the trifocal tensor is being manipulated
int row = 9*i + 3*j + k;
// which unknowns are being multiplied by
int col1 = j*3 + i;
int col2 = k*3 + i + 9;
E.data[row*18 + col1 ] = e3.getIdx(k);
E.data[row*18 + col2 ] = -e2.getIdx(j);
}
}
}
} | [
"protected",
"void",
"constructE",
"(",
"Point3D_F64",
"e2",
",",
"Point3D_F64",
"e3",
")",
"{",
"E",
".",
"zero",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0"... | The matrix E is a linear system for computing the trifocal tensor. The columns
are the unknown square matrices from view 2 and 3. The right most column in
both projection matrices are the provided epipoles, whose values are inserted into E | [
"The",
"matrix",
"E",
"is",
"a",
"linear",
"system",
"for",
"computing",
"the",
"trifocal",
"tensor",
".",
"The",
"columns",
"are",
"the",
"unknown",
"square",
"matrices",
"from",
"view",
"2",
"and",
"3",
".",
"The",
"right",
"most",
"column",
"in",
"bot... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/trifocal/EnforceTrifocalGeometry.java#L140-L157 |
mgormley/optimize | src/main/java/edu/jhu/hlt/optimize/LBFGS_port.java | LBFGS_port.CUBIC_MINIMIZER2 | private static double CUBIC_MINIMIZER2(double cm, double u, double fu, double du, double v, double fv, double dv, double xmin, double xmax) {
double a, d, gamma, theta, p, q, r, s;
d = (v) - (u);
theta = ((fu) - (fv)) * 3 / d + (du) + (dv);
p = Math.abs(theta);
q = Math.abs(du);
r = Math.abs(dv);
s = max3(p, q, r);
/* gamma = s*sqrt((theta/s)**2 - (du/s) * (dv/s)) */
a = theta / s;
gamma = s * Math.sqrt(max2(0, a * a - ((du) / s) * ((dv) / s)));
if ((u) < (v)) gamma = -gamma;
p = gamma - (dv) + theta;
q = gamma - (dv) + gamma + (du);
r = p / q;
if (r < 0. && gamma != 0.) {
(cm) = (v) - r * d;
} else if (a < 0) {
(cm) = (xmax);
} else {
(cm) = (xmin);
}
return cm;
} | java | private static double CUBIC_MINIMIZER2(double cm, double u, double fu, double du, double v, double fv, double dv, double xmin, double xmax) {
double a, d, gamma, theta, p, q, r, s;
d = (v) - (u);
theta = ((fu) - (fv)) * 3 / d + (du) + (dv);
p = Math.abs(theta);
q = Math.abs(du);
r = Math.abs(dv);
s = max3(p, q, r);
/* gamma = s*sqrt((theta/s)**2 - (du/s) * (dv/s)) */
a = theta / s;
gamma = s * Math.sqrt(max2(0, a * a - ((du) / s) * ((dv) / s)));
if ((u) < (v)) gamma = -gamma;
p = gamma - (dv) + theta;
q = gamma - (dv) + gamma + (du);
r = p / q;
if (r < 0. && gamma != 0.) {
(cm) = (v) - r * d;
} else if (a < 0) {
(cm) = (xmax);
} else {
(cm) = (xmin);
}
return cm;
} | [
"private",
"static",
"double",
"CUBIC_MINIMIZER2",
"(",
"double",
"cm",
",",
"double",
"u",
",",
"double",
"fu",
",",
"double",
"du",
",",
"double",
"v",
",",
"double",
"fv",
",",
"double",
"dv",
",",
"double",
"xmin",
",",
"double",
"xmax",
")",
"{",
... | Find a minimizer of an interpolated cubic function.
@param cm The minimizer of the interpolated cubic.
@param u The value of one point, u.
@param fu The value of f(u).
@param du The value of f'(u).
@param v The value of another point, v.
@param fv The value of f(v).
@param du The value of f'(v).
@param xmin The maximum value.
@param xmin The minimum value. | [
"Find",
"a",
"minimizer",
"of",
"an",
"interpolated",
"cubic",
"function",
"."
] | train | https://github.com/mgormley/optimize/blob/3d1b93260b99febb8a5ecd9e8543c223e151a8d3/src/main/java/edu/jhu/hlt/optimize/LBFGS_port.java#L1817-L1840 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java | MapDotApi.dotDissoc | public static Map dotDissoc(final Map map, final String pathString) {
if (pathString == null || pathString.isEmpty()) {
throw new IllegalArgumentException(PATH_MUST_BE_SPECIFIED);
}
if (!pathString.contains(SEPARATOR)) {
map.remove(pathString);
return map;
}
final Object[] path = pathString.split(SEPARATOR_REGEX);
return MapApi.dissoc(map, path);
} | java | public static Map dotDissoc(final Map map, final String pathString) {
if (pathString == null || pathString.isEmpty()) {
throw new IllegalArgumentException(PATH_MUST_BE_SPECIFIED);
}
if (!pathString.contains(SEPARATOR)) {
map.remove(pathString);
return map;
}
final Object[] path = pathString.split(SEPARATOR_REGEX);
return MapApi.dissoc(map, path);
} | [
"public",
"static",
"Map",
"dotDissoc",
"(",
"final",
"Map",
"map",
",",
"final",
"String",
"pathString",
")",
"{",
"if",
"(",
"pathString",
"==",
"null",
"||",
"pathString",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"... | Dissociates value by specified path.
@param map subject original map
@param pathString nodes to walk in map path of value
@return original map | [
"Dissociates",
"value",
"by",
"specified",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L342-L352 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.createPreset | public CreatePresetResponse createPreset(CreatePresetRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getName(),
"The parameter name should NOT be null or empty string.");
if (request.getAudio() != null) {
checkNotNull(request.getAudio().getBitRateInBps(),
"The parameter bitRateInBps in audio should NOT be null.");
checkIsTrue(request.getAudio().getBitRateInBps() > 0,
"The audio's parameter bitRateInBps should be greater than zero.");
}
if (request.getVideo() != null) {
checkNotNull(request.getVideo().getBitRateInBps(),
"The parameter bitRateInBps in video should NOT be null.");
checkIsTrue(request.getVideo().getBitRateInBps() > 0,
"The video's parameter bitRateInBps should be greater than zero.");
checkNotNull(request.getVideo().getMaxFrameRate(),
"The parameter maxFrameRate in video should NOT be null.");
checkIsTrue(request.getVideo().getMaxFrameRate() > 0,
"The video's parameter maxFrameRate should be greater than zero.");
checkNotNull(request.getVideo().getMaxWidthInPixel(),
"The parameter maxWidthInPixel in video should NOT be null.");
checkIsTrue(request.getVideo().getMaxWidthInPixel() > 0,
"The video's parameter maxWidthInPixel should be greater than zero.");
checkNotNull(request.getVideo().getMaxHeightInPixel(),
"The parameter maxHeightInPixel in video should NOT be null.");
checkIsTrue(request.getVideo().getMaxHeightInPixel() > 0,
"The video's parameter maxHeightInPixel should be greater than zero.");
}
// not support yet
request.setThumbnail(null);
request.setWatermarks(null);
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_PRESET);
return invokeHttpClient(internalRequest, CreatePresetResponse.class);
} | java | public CreatePresetResponse createPreset(CreatePresetRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getName(),
"The parameter name should NOT be null or empty string.");
if (request.getAudio() != null) {
checkNotNull(request.getAudio().getBitRateInBps(),
"The parameter bitRateInBps in audio should NOT be null.");
checkIsTrue(request.getAudio().getBitRateInBps() > 0,
"The audio's parameter bitRateInBps should be greater than zero.");
}
if (request.getVideo() != null) {
checkNotNull(request.getVideo().getBitRateInBps(),
"The parameter bitRateInBps in video should NOT be null.");
checkIsTrue(request.getVideo().getBitRateInBps() > 0,
"The video's parameter bitRateInBps should be greater than zero.");
checkNotNull(request.getVideo().getMaxFrameRate(),
"The parameter maxFrameRate in video should NOT be null.");
checkIsTrue(request.getVideo().getMaxFrameRate() > 0,
"The video's parameter maxFrameRate should be greater than zero.");
checkNotNull(request.getVideo().getMaxWidthInPixel(),
"The parameter maxWidthInPixel in video should NOT be null.");
checkIsTrue(request.getVideo().getMaxWidthInPixel() > 0,
"The video's parameter maxWidthInPixel should be greater than zero.");
checkNotNull(request.getVideo().getMaxHeightInPixel(),
"The parameter maxHeightInPixel in video should NOT be null.");
checkIsTrue(request.getVideo().getMaxHeightInPixel() > 0,
"The video's parameter maxHeightInPixel should be greater than zero.");
}
// not support yet
request.setThumbnail(null);
request.setWatermarks(null);
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_PRESET);
return invokeHttpClient(internalRequest, CreatePresetResponse.class);
} | [
"public",
"CreatePresetResponse",
"createPreset",
"(",
"CreatePresetRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getName",
"(",
")",
",",
"\"Th... | Create a live preset which contains parameters needed in the live stream service.
@param request The request object containing all options for creating presets.
@return the response | [
"Create",
"a",
"live",
"preset",
"which",
"contains",
"parameters",
"needed",
"in",
"the",
"live",
"stream",
"service",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L290-L327 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.anyOf | public static <T extends Tree> Matcher<T> anyOf(
final Iterable<? extends Matcher<? super T>> matchers) {
return new Matcher<T>() {
@Override
public boolean matches(T t, VisitorState state) {
for (Matcher<? super T> matcher : matchers) {
if (matcher.matches(t, state)) {
return true;
}
}
return false;
}
};
} | java | public static <T extends Tree> Matcher<T> anyOf(
final Iterable<? extends Matcher<? super T>> matchers) {
return new Matcher<T>() {
@Override
public boolean matches(T t, VisitorState state) {
for (Matcher<? super T> matcher : matchers) {
if (matcher.matches(t, state)) {
return true;
}
}
return false;
}
};
} | [
"public",
"static",
"<",
"T",
"extends",
"Tree",
">",
"Matcher",
"<",
"T",
">",
"anyOf",
"(",
"final",
"Iterable",
"<",
"?",
"extends",
"Matcher",
"<",
"?",
"super",
"T",
">",
">",
"matchers",
")",
"{",
"return",
"new",
"Matcher",
"<",
"T",
">",
"(... | Compose several matchers together, such that the composite matches an AST node if any of the
given matchers do. | [
"Compose",
"several",
"matchers",
"together",
"such",
"that",
"the",
"composite",
"matches",
"an",
"AST",
"node",
"if",
"any",
"of",
"the",
"given",
"matchers",
"do",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L150-L163 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric_ca/sdk/HFCAAffiliation.java | HFCAAffiliation.read | public int read(User registrar) throws AffiliationException, InvalidArgumentException {
if (registrar == null) {
throw new InvalidArgumentException("Registrar should be a valid member");
}
String readAffURL = "";
try {
readAffURL = HFCA_AFFILIATION + "/" + name;
logger.debug(format("affiliation url: %s, registrar: %s", readAffURL, registrar.getName()));
JsonObject result = client.httpGet(readAffURL, registrar);
logger.debug(format("affiliation url: %s, registrar: %s done.", readAffURL, registrar));
HFCAAffiliationResp resp = getResponse(result);
this.childHFCAAffiliations = resp.getChildren();
this.identities = resp.getIdentities();
this.deleted = false;
return resp.statusCode;
} catch (HTTPException e) {
String msg = format("[Code: %d] - Error while getting affiliation '%s' from url '%s': %s", e.getStatusCode(), this.name, readAffURL, e.getMessage());
AffiliationException affiliationException = new AffiliationException(msg, e);
logger.error(msg);
throw affiliationException;
} catch (Exception e) {
String msg = format("Error while getting affiliation %s url: %s %s ", this.name, readAffURL, e.getMessage());
AffiliationException affiliationException = new AffiliationException(msg, e);
logger.error(msg);
throw affiliationException;
}
} | java | public int read(User registrar) throws AffiliationException, InvalidArgumentException {
if (registrar == null) {
throw new InvalidArgumentException("Registrar should be a valid member");
}
String readAffURL = "";
try {
readAffURL = HFCA_AFFILIATION + "/" + name;
logger.debug(format("affiliation url: %s, registrar: %s", readAffURL, registrar.getName()));
JsonObject result = client.httpGet(readAffURL, registrar);
logger.debug(format("affiliation url: %s, registrar: %s done.", readAffURL, registrar));
HFCAAffiliationResp resp = getResponse(result);
this.childHFCAAffiliations = resp.getChildren();
this.identities = resp.getIdentities();
this.deleted = false;
return resp.statusCode;
} catch (HTTPException e) {
String msg = format("[Code: %d] - Error while getting affiliation '%s' from url '%s': %s", e.getStatusCode(), this.name, readAffURL, e.getMessage());
AffiliationException affiliationException = new AffiliationException(msg, e);
logger.error(msg);
throw affiliationException;
} catch (Exception e) {
String msg = format("Error while getting affiliation %s url: %s %s ", this.name, readAffURL, e.getMessage());
AffiliationException affiliationException = new AffiliationException(msg, e);
logger.error(msg);
throw affiliationException;
}
} | [
"public",
"int",
"read",
"(",
"User",
"registrar",
")",
"throws",
"AffiliationException",
",",
"InvalidArgumentException",
"{",
"if",
"(",
"registrar",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Registrar should be a valid member\"",
"... | gets a specific affiliation
@param registrar The identity of the registrar
@return Returns response
@throws AffiliationException if getting an affiliation fails.
@throws InvalidArgumentException | [
"gets",
"a",
"specific",
"affiliation"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric_ca/sdk/HFCAAffiliation.java#L194-L224 |
osiam/connector4java | src/main/java/org/osiam/client/OsiamConnector.java | OsiamConnector.getMe | public User getMe(AccessToken accessToken, String... attributes) {
return getUserService().getMe(accessToken, attributes);
} | java | public User getMe(AccessToken accessToken, String... attributes) {
return getUserService().getMe(accessToken, attributes);
} | [
"public",
"User",
"getMe",
"(",
"AccessToken",
"accessToken",
",",
"String",
"...",
"attributes",
")",
"{",
"return",
"getUserService",
"(",
")",
".",
"getMe",
"(",
"accessToken",
",",
"attributes",
")",
";",
"}"
] | Retrieves the User holding the given access token.
@param accessToken the OSIAM access token from for the current session
@param attributes the attributes that should be returned in the response. If none are given, all are returned
@return the actual logged in user
@throws UnauthorizedException if the request could not be authorized.
@throws ForbiddenException if the scope doesn't allow this request
@throws ConnectionInitializationException if no connection to the given OSIAM services could be initialized
@throws IllegalStateException if OSIAM's endpoint(s) are not properly configured | [
"Retrieves",
"the",
"User",
"holding",
"the",
"given",
"access",
"token",
"."
] | train | https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L292-L294 |
Squarespace/cldr | runtime/src/main/java/com/squarespace/cldr/LanguageMatcher.java | LanguageMatcher.matchImpl | private Match matchImpl(List<Entry> desiredLocales, int threshold) {
int bestDistance = MAX_DISTANCE;
Entry bestMatch = null;
for (Entry desired : desiredLocales) {
List<String> exact = exactMatch.get(desired.locale);
if (exact != null) {
return new Match(exact.get(0), 0);
}
for (Entry supported : supportedLocales) {
int distance = DISTANCE_TABLE.distance(desired.locale, supported.locale, threshold);
if (distance < bestDistance) {
bestDistance = distance;
bestMatch = supported;
}
}
}
return bestMatch == null
? new Match(firstEntry.bundleId, MAX_DISTANCE)
: new Match(bestMatch.bundleId, bestDistance);
} | java | private Match matchImpl(List<Entry> desiredLocales, int threshold) {
int bestDistance = MAX_DISTANCE;
Entry bestMatch = null;
for (Entry desired : desiredLocales) {
List<String> exact = exactMatch.get(desired.locale);
if (exact != null) {
return new Match(exact.get(0), 0);
}
for (Entry supported : supportedLocales) {
int distance = DISTANCE_TABLE.distance(desired.locale, supported.locale, threshold);
if (distance < bestDistance) {
bestDistance = distance;
bestMatch = supported;
}
}
}
return bestMatch == null
? new Match(firstEntry.bundleId, MAX_DISTANCE)
: new Match(bestMatch.bundleId, bestDistance);
} | [
"private",
"Match",
"matchImpl",
"(",
"List",
"<",
"Entry",
">",
"desiredLocales",
",",
"int",
"threshold",
")",
"{",
"int",
"bestDistance",
"=",
"MAX_DISTANCE",
";",
"Entry",
"bestMatch",
"=",
"null",
";",
"for",
"(",
"Entry",
"desired",
":",
"desiredLocale... | Return the best match that exceeds the threshold, or the default.
If the default is returned its distance is set to MAX_DISTANCE.
An exact match has distance of 0. | [
"Return",
"the",
"best",
"match",
"that",
"exceeds",
"the",
"threshold",
"or",
"the",
"default",
".",
"If",
"the",
"default",
"is",
"returned",
"its",
"distance",
"is",
"set",
"to",
"MAX_DISTANCE",
".",
"An",
"exact",
"match",
"has",
"distance",
"of",
"0",... | train | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/LanguageMatcher.java#L158-L177 |
redkale/redkale | src/org/redkale/util/ByteArray.java | ByteArray.find | public int find(int offset, int limit, byte value) {
byte[] bytes = this.content;
int end = limit > 0 ? limit : count;
for (int i = offset; i < end; i++) {
if (bytes[i] == value) return i;
}
return -1;
} | java | public int find(int offset, int limit, byte value) {
byte[] bytes = this.content;
int end = limit > 0 ? limit : count;
for (int i = offset; i < end; i++) {
if (bytes[i] == value) return i;
}
return -1;
} | [
"public",
"int",
"find",
"(",
"int",
"offset",
",",
"int",
"limit",
",",
"byte",
"value",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"this",
".",
"content",
";",
"int",
"end",
"=",
"limit",
">",
"0",
"?",
"limit",
":",
"count",
";",
"for",
"(",
... | 从指定的起始位置和长度查询value值出现的位置,没有返回-1
@param offset 起始位置
@param limit 长度限制
@param value 查询值
@return 所在位置 | [
"从指定的起始位置和长度查询value值出现的位置",
"没有返回",
"-",
"1"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/util/ByteArray.java#L213-L220 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getAttributeLongWithDefault | @Pure
public static Long getAttributeLongWithDefault(Node document, Long defaultValue, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeLongWithDefault(document, true, defaultValue, path);
} | java | @Pure
public static Long getAttributeLongWithDefault(Node document, Long defaultValue, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
return getAttributeLongWithDefault(document, true, defaultValue, path);
} | [
"@",
"Pure",
"public",
"static",
"Long",
"getAttributeLongWithDefault",
"(",
"Node",
"document",
",",
"Long",
"defaultValue",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
... | Replies the long value that corresponds to the specified attribute's path.
<p>The path is an ordered list of tag's names and ended by the name of
the attribute.
Be careful about the fact that the names are case sensitives.
@param document is the XML document to explore.
@param defaultValue is the default value to reply.
@param path is the list of and ended by the attribute's name.
@return the long value of the specified attribute or <code>0</code>. | [
"Replies",
"the",
"long",
"value",
"that",
"corresponds",
"to",
"the",
"specified",
"attribute",
"s",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L945-L949 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java | SARLQuickfixProvider.fixDiscouragedBooleanExpression | @Fix(io.sarl.lang.validation.IssueCodes.DISCOURAGED_BOOLEAN_EXPRESSION)
public void fixDiscouragedBooleanExpression(final Issue issue, IssueResolutionAcceptor acceptor) {
BehaviorUnitGuardRemoveModification.accept(this, issue, acceptor);
} | java | @Fix(io.sarl.lang.validation.IssueCodes.DISCOURAGED_BOOLEAN_EXPRESSION)
public void fixDiscouragedBooleanExpression(final Issue issue, IssueResolutionAcceptor acceptor) {
BehaviorUnitGuardRemoveModification.accept(this, issue, acceptor);
} | [
"@",
"Fix",
"(",
"io",
".",
"sarl",
".",
"lang",
".",
"validation",
".",
"IssueCodes",
".",
"DISCOURAGED_BOOLEAN_EXPRESSION",
")",
"public",
"void",
"fixDiscouragedBooleanExpression",
"(",
"final",
"Issue",
"issue",
",",
"IssueResolutionAcceptor",
"acceptor",
")",
... | Quick fix for "Discouraged boolean expression".
@param issue the issue.
@param acceptor the quick fix acceptor. | [
"Quick",
"fix",
"for",
"Discouraged",
"boolean",
"expression",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L765-L768 |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java | TableFactoryService.findInternal | public static <T> T findInternal(Class<T> factoryClass, Map<String, String> properties, Optional<ClassLoader> classLoader) {
Preconditions.checkNotNull(factoryClass);
Preconditions.checkNotNull(properties);
List<TableFactory> foundFactories = discoverFactories(classLoader);
List<TableFactory> classFactories = filterByFactoryClass(
factoryClass,
properties,
foundFactories);
List<TableFactory> contextFactories = filterByContext(
factoryClass,
properties,
foundFactories,
classFactories);
return filterBySupportedProperties(
factoryClass,
properties,
foundFactories,
contextFactories);
} | java | public static <T> T findInternal(Class<T> factoryClass, Map<String, String> properties, Optional<ClassLoader> classLoader) {
Preconditions.checkNotNull(factoryClass);
Preconditions.checkNotNull(properties);
List<TableFactory> foundFactories = discoverFactories(classLoader);
List<TableFactory> classFactories = filterByFactoryClass(
factoryClass,
properties,
foundFactories);
List<TableFactory> contextFactories = filterByContext(
factoryClass,
properties,
foundFactories,
classFactories);
return filterBySupportedProperties(
factoryClass,
properties,
foundFactories,
contextFactories);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"findInternal",
"(",
"Class",
"<",
"T",
">",
"factoryClass",
",",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
",",
"Optional",
"<",
"ClassLoader",
">",
"classLoader",
")",
"{",
"Preconditions",
".",
"ch... | Finds a table factory of the given class, property map, and classloader.
@param factoryClass desired factory class
@param properties properties that describe the factory configuration
@param classLoader classloader for service loading
@param <T> factory class type
@return the matching factory | [
"Finds",
"a",
"table",
"factory",
"of",
"the",
"given",
"class",
"property",
"map",
"and",
"classloader",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/TableFactoryService.java#L120-L143 |
Red5/red5-io | src/main/java/org/red5/io/matroska/VINT.java | VINT.fromBinary | public static VINT fromBinary(long binary) {
BitSet bs = BitSet.valueOf(new long[] { binary });
long mask = MASK_BYTE_1;
byte length = 1;
if (bs.length() > 3 * BIT_IN_BYTE) {
mask = MASK_BYTE_4;
length = 4;
} else if (bs.length() > 2 * BIT_IN_BYTE) {
mask = MASK_BYTE_3;
length = 3;
} else if (bs.length() > 1 * BIT_IN_BYTE) {
mask = MASK_BYTE_2;
length = 2;
}
long value = binary & mask;
return new VINT(binary, length, value);
} | java | public static VINT fromBinary(long binary) {
BitSet bs = BitSet.valueOf(new long[] { binary });
long mask = MASK_BYTE_1;
byte length = 1;
if (bs.length() > 3 * BIT_IN_BYTE) {
mask = MASK_BYTE_4;
length = 4;
} else if (bs.length() > 2 * BIT_IN_BYTE) {
mask = MASK_BYTE_3;
length = 3;
} else if (bs.length() > 1 * BIT_IN_BYTE) {
mask = MASK_BYTE_2;
length = 2;
}
long value = binary & mask;
return new VINT(binary, length, value);
} | [
"public",
"static",
"VINT",
"fromBinary",
"(",
"long",
"binary",
")",
"{",
"BitSet",
"bs",
"=",
"BitSet",
".",
"valueOf",
"(",
"new",
"long",
"[",
"]",
"{",
"binary",
"}",
")",
";",
"long",
"mask",
"=",
"MASK_BYTE_1",
";",
"byte",
"length",
"=",
"1",... | method to construct {@link VINT} based on its binary representation
@param binary
- binary value of {@link VINT}
@return {@link VINT} corresponding to this binary | [
"method",
"to",
"construct",
"{",
"@link",
"VINT",
"}",
"based",
"on",
"its",
"binary",
"representation"
] | train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/VINT.java#L119-L135 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.forServer | public static SslContextBuilder forServer(File keyCertChainFile, File keyFile) {
return new SslContextBuilder(true).keyManager(keyCertChainFile, keyFile);
} | java | public static SslContextBuilder forServer(File keyCertChainFile, File keyFile) {
return new SslContextBuilder(true).keyManager(keyCertChainFile, keyFile);
} | [
"public",
"static",
"SslContextBuilder",
"forServer",
"(",
"File",
"keyCertChainFile",
",",
"File",
"keyFile",
")",
"{",
"return",
"new",
"SslContextBuilder",
"(",
"true",
")",
".",
"keyManager",
"(",
"keyCertChainFile",
",",
"keyFile",
")",
";",
"}"
] | Creates a builder for new server-side {@link SslContext}.
@param keyCertChainFile an X.509 certificate chain file in PEM format
@param keyFile a PKCS#8 private key file in PEM format
@see #keyManager(File, File) | [
"Creates",
"a",
"builder",
"for",
"new",
"server",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L53-L55 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.loadBalancing_serviceName_backend_backend_setWeight_POST | public OvhLoadBalancingTask loadBalancing_serviceName_backend_backend_setWeight_POST(String serviceName, String backend, Long weight) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/backend/{backend}/setWeight";
StringBuilder sb = path(qPath, serviceName, backend);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "weight", weight);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhLoadBalancingTask.class);
} | java | public OvhLoadBalancingTask loadBalancing_serviceName_backend_backend_setWeight_POST(String serviceName, String backend, Long weight) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/backend/{backend}/setWeight";
StringBuilder sb = path(qPath, serviceName, backend);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "weight", weight);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhLoadBalancingTask.class);
} | [
"public",
"OvhLoadBalancingTask",
"loadBalancing_serviceName_backend_backend_setWeight_POST",
"(",
"String",
"serviceName",
",",
"String",
"backend",
",",
"Long",
"weight",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/loadBalancing/{serviceName}/backend/{ba... | Set the weight of a backend. For instance, if backend A has a weight of 8 and backup B was a weight of 16, backend B will receive twice more connections as backend A. Backends must be on the same POP for the weight parameter to take effect between them.
REST: POST /ip/loadBalancing/{serviceName}/backend/{backend}/setWeight
@param weight [required] weight of the backend, must be between 1 and 100, default is 8
@param serviceName [required] The internal name of your IP load balancing
@param backend [required] IP of your backend | [
"Set",
"the",
"weight",
"of",
"a",
"backend",
".",
"For",
"instance",
"if",
"backend",
"A",
"has",
"a",
"weight",
"of",
"8",
"and",
"backup",
"B",
"was",
"a",
"weight",
"of",
"16",
"backend",
"B",
"will",
"receive",
"twice",
"more",
"connections",
"as"... | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1363-L1370 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java | ChannelFrameworkImpl.retryChainStart | protected void retryChainStart(ChainData chainData, Exception e) {
// Do nothing in the core implementation. This method is overloaded in the
// service.
// 7/16/04 CAL - this prevents a dependency on the Alarm Manager and
// channelfw.service
FFDCFilter.processException(e, getClass().getName() + ".retryChainStart", "3470", this, new Object[] { chainData });
Tr.error(tc, "chain.retrystart.error", new Object[] { chainData.getName(), Integer.valueOf(1) });
((ChainDataImpl) chainData).chainStartFailed(1, 0);
} | java | protected void retryChainStart(ChainData chainData, Exception e) {
// Do nothing in the core implementation. This method is overloaded in the
// service.
// 7/16/04 CAL - this prevents a dependency on the Alarm Manager and
// channelfw.service
FFDCFilter.processException(e, getClass().getName() + ".retryChainStart", "3470", this, new Object[] { chainData });
Tr.error(tc, "chain.retrystart.error", new Object[] { chainData.getName(), Integer.valueOf(1) });
((ChainDataImpl) chainData).chainStartFailed(1, 0);
} | [
"protected",
"void",
"retryChainStart",
"(",
"ChainData",
"chainData",
",",
"Exception",
"e",
")",
"{",
"// Do nothing in the core implementation. This method is overloaded in the",
"// service.",
"// 7/16/04 CAL - this prevents a dependency on the Alarm Manager and",
"// channelfw.servi... | This method is called when an initial attempt to start a chain has
failed due to a particular type of exception, RetryableChannelException,
indicating that a retry may enable the chain to be started. This could
result from something like a device side channel having bind problems
since a socket from a previous chain stop is still wrapping up.
@param chainData
specification of chain to be started
@param e
Exception that occured which caused this retry attempt to take
place | [
"This",
"method",
"is",
"called",
"when",
"an",
"initial",
"attempt",
"to",
"start",
"a",
"chain",
"has",
"failed",
"due",
"to",
"a",
"particular",
"type",
"of",
"exception",
"RetryableChannelException",
"indicating",
"that",
"a",
"retry",
"may",
"enable",
"th... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java#L3762-L3770 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingManager.java | CustomVisionTrainingManager.authenticate | public static TrainingApi authenticate(RestClient restClient, final String apiKey) {
return new TrainingApiImpl(restClient).withApiKey(apiKey);
} | java | public static TrainingApi authenticate(RestClient restClient, final String apiKey) {
return new TrainingApiImpl(restClient).withApiKey(apiKey);
} | [
"public",
"static",
"TrainingApi",
"authenticate",
"(",
"RestClient",
"restClient",
",",
"final",
"String",
"apiKey",
")",
"{",
"return",
"new",
"TrainingApiImpl",
"(",
"restClient",
")",
".",
"withApiKey",
"(",
"apiKey",
")",
";",
"}"
] | Initializes an instance of Custom Vision Training API client.
@param restClient the REST client to connect to Azure.
@param apiKey the Custom Vision Training API key
@return the Custom Vision Training API client | [
"Initializes",
"an",
"instance",
"of",
"Custom",
"Vision",
"Training",
"API",
"client",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingManager.java#L74-L76 |
puniverse/capsule | capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java | Jar.setListAttribute | public Jar setListAttribute(String name, Collection<?> values) {
return setAttribute(name, join(values));
} | java | public Jar setListAttribute(String name, Collection<?> values) {
return setAttribute(name, join(values));
} | [
"public",
"Jar",
"setListAttribute",
"(",
"String",
"name",
",",
"Collection",
"<",
"?",
">",
"values",
")",
"{",
"return",
"setAttribute",
"(",
"name",
",",
"join",
"(",
"values",
")",
")",
";",
"}"
] | Sets an attribute in the main section of the manifest to a list.
The list elements will be joined with a single whitespace character.
@param name the attribute's name
@param values the attribute's value
@return {@code this}
@throws IllegalStateException if entries have been added or the JAR has been written prior to calling this methods. | [
"Sets",
"an",
"attribute",
"in",
"the",
"main",
"section",
"of",
"the",
"manifest",
"to",
"a",
"list",
".",
"The",
"list",
"elements",
"will",
"be",
"joined",
"with",
"a",
"single",
"whitespace",
"character",
"."
] | train | https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L174-L176 |
real-logic/agrona | agrona/src/main/java/org/agrona/PrintBufferUtil.java | PrintBufferUtil.hexDump | public static String hexDump(final byte[] array, final int fromIndex, final int length)
{
return HexUtil.hexDump(array, fromIndex, length);
} | java | public static String hexDump(final byte[] array, final int fromIndex, final int length)
{
return HexUtil.hexDump(array, fromIndex, length);
} | [
"public",
"static",
"String",
"hexDump",
"(",
"final",
"byte",
"[",
"]",
"array",
",",
"final",
"int",
"fromIndex",
",",
"final",
"int",
"length",
")",
"{",
"return",
"HexUtil",
".",
"hexDump",
"(",
"array",
",",
"fromIndex",
",",
"length",
")",
";",
"... | Returns a <a href="http://en.wikipedia.org/wiki/Hex_dump">hex dump</a>
of the specified byte array's sub-region.
@param array dumped array
@param fromIndex where should we start to print
@param length how much should we print
@return hex dump in a string representation | [
"Returns",
"a",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Hex_dump",
">",
"hex",
"dump<",
"/",
"a",
">",
"of",
"the",
"specified",
"byte",
"array",
"s",
"sub",
"-",
"region",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/PrintBufferUtil.java#L98-L101 |
btaz/data-util | src/main/java/com/btaz/util/unit/ResourceUtil.java | ResourceUtil.createRandomData | public static String createRandomData(int rows, int rowLength, boolean skipTrailingNewline) {
Random random = new Random(System.currentTimeMillis());
StringBuilder strb = new StringBuilder();
for(int i=0; i<rows; i++) {
for(int j=0; j<rowLength; j++) {
strb.append((char)(((int)'a') + random.nextFloat() * 25));
}
if(skipTrailingNewline || i<rows) {
strb.append("\n");
}
}
return strb.toString();
} | java | public static String createRandomData(int rows, int rowLength, boolean skipTrailingNewline) {
Random random = new Random(System.currentTimeMillis());
StringBuilder strb = new StringBuilder();
for(int i=0; i<rows; i++) {
for(int j=0; j<rowLength; j++) {
strb.append((char)(((int)'a') + random.nextFloat() * 25));
}
if(skipTrailingNewline || i<rows) {
strb.append("\n");
}
}
return strb.toString();
} | [
"public",
"static",
"String",
"createRandomData",
"(",
"int",
"rows",
",",
"int",
"rowLength",
",",
"boolean",
"skipTrailingNewline",
")",
"{",
"Random",
"random",
"=",
"new",
"Random",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"StringBuilde... | This method creates test data containing letters between a-z
@param rows how many rows of data to create
@param rowLength how many characters per row
@param skipTrailingNewline if true then a trailing newline is always added
@return <code>String</code> contain all random data | [
"This",
"method",
"creates",
"test",
"data",
"containing",
"letters",
"between",
"a",
"-",
"z"
] | train | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/unit/ResourceUtil.java#L112-L124 |
tipsy/javalin | src/main/java/io/javalin/Javalin.java | Javalin.addWsHandler | private Javalin addWsHandler(@NotNull WsHandlerType handlerType, @NotNull String path, @NotNull Consumer<WsHandler> wsHandler, @NotNull Set<Role> roles) {
wsServlet.addHandler(handlerType, path, wsHandler, roles);
eventManager.fireWsHandlerAddedEvent(new WsHandlerMetaInfo(handlerType, Util.prefixContextPath(servlet.getConfig().contextPath, path), wsHandler, roles));
return this;
} | java | private Javalin addWsHandler(@NotNull WsHandlerType handlerType, @NotNull String path, @NotNull Consumer<WsHandler> wsHandler, @NotNull Set<Role> roles) {
wsServlet.addHandler(handlerType, path, wsHandler, roles);
eventManager.fireWsHandlerAddedEvent(new WsHandlerMetaInfo(handlerType, Util.prefixContextPath(servlet.getConfig().contextPath, path), wsHandler, roles));
return this;
} | [
"private",
"Javalin",
"addWsHandler",
"(",
"@",
"NotNull",
"WsHandlerType",
"handlerType",
",",
"@",
"NotNull",
"String",
"path",
",",
"@",
"NotNull",
"Consumer",
"<",
"WsHandler",
">",
"wsHandler",
",",
"@",
"NotNull",
"Set",
"<",
"Role",
">",
"roles",
")",... | Adds a specific WebSocket handler for the given path to the instance.
Requires an access manager to be set on the instance. | [
"Adds",
"a",
"specific",
"WebSocket",
"handler",
"for",
"the",
"given",
"path",
"to",
"the",
"instance",
".",
"Requires",
"an",
"access",
"manager",
"to",
"be",
"set",
"on",
"the",
"instance",
"."
] | train | https://github.com/tipsy/javalin/blob/68b2f7592f237db1c2b597e645697eb75fdaee53/src/main/java/io/javalin/Javalin.java#L505-L509 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/Criteria.java | Criteria.addEqualToColumn | public void addEqualToColumn(String attribute, String colName)
{
// FieldCriteria c = FieldCriteria.buildEqualToCriteria(attribute, colName, getAlias());
FieldCriteria c = FieldCriteria.buildEqualToCriteria(attribute, colName, getUserAlias(attribute));
c.setTranslateField(false);
addSelectionCriteria(c);
} | java | public void addEqualToColumn(String attribute, String colName)
{
// FieldCriteria c = FieldCriteria.buildEqualToCriteria(attribute, colName, getAlias());
FieldCriteria c = FieldCriteria.buildEqualToCriteria(attribute, colName, getUserAlias(attribute));
c.setTranslateField(false);
addSelectionCriteria(c);
} | [
"public",
"void",
"addEqualToColumn",
"(",
"String",
"attribute",
",",
"String",
"colName",
")",
"{",
"// FieldCriteria c = FieldCriteria.buildEqualToCriteria(attribute, colName, getAlias());\r",
"FieldCriteria",
"c",
"=",
"FieldCriteria",
".",
"buildEqualToCriteria",
"(",
"att... | Adds and equals (=) criteria for column comparison.
The column Name will NOT be translated.
<br>
name = T_BOSS.LASTNMAE
@param attribute The field name to be used
@param colName The name of the column to compare with | [
"Adds",
"and",
"equals",
"(",
"=",
")",
"criteria",
"for",
"column",
"comparison",
".",
"The",
"column",
"Name",
"will",
"NOT",
"be",
"translated",
".",
"<br",
">",
"name",
"=",
"T_BOSS",
".",
"LASTNMAE"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L392-L398 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/visual/datastructures/Linear.java | Linear.computeNearestNeighborsInternal | protected BoundedPriorityQueue<Result> computeNearestNeighborsInternal(int k, double[] queryVector)
throws Exception {
BoundedPriorityQueue<Result> nn = new BoundedPriorityQueue<Result>(new Result(), k);
double lowest = Double.MAX_VALUE;
for (int i = 0; i < (vectorsList.size() / vectorLength); i++) {
boolean skip = false;
int startIndex = i * vectorLength;
double l2distance = 0;
for (int j = 0; j < vectorLength; j++) {
l2distance += (queryVector[j] - vectorsList.getQuick(startIndex + j))
* (queryVector[j] - vectorsList.getQuick(startIndex + j));
if (l2distance > lowest) {
skip = true;
break;
}
}
if (!skip) {
nn.offer(new Result(i, l2distance));
if (i >= k) {
lowest = nn.last().getDistance();
}
}
}
return nn;
} | java | protected BoundedPriorityQueue<Result> computeNearestNeighborsInternal(int k, double[] queryVector)
throws Exception {
BoundedPriorityQueue<Result> nn = new BoundedPriorityQueue<Result>(new Result(), k);
double lowest = Double.MAX_VALUE;
for (int i = 0; i < (vectorsList.size() / vectorLength); i++) {
boolean skip = false;
int startIndex = i * vectorLength;
double l2distance = 0;
for (int j = 0; j < vectorLength; j++) {
l2distance += (queryVector[j] - vectorsList.getQuick(startIndex + j))
* (queryVector[j] - vectorsList.getQuick(startIndex + j));
if (l2distance > lowest) {
skip = true;
break;
}
}
if (!skip) {
nn.offer(new Result(i, l2distance));
if (i >= k) {
lowest = nn.last().getDistance();
}
}
}
return nn;
} | [
"protected",
"BoundedPriorityQueue",
"<",
"Result",
">",
"computeNearestNeighborsInternal",
"(",
"int",
"k",
",",
"double",
"[",
"]",
"queryVector",
")",
"throws",
"Exception",
"{",
"BoundedPriorityQueue",
"<",
"Result",
">",
"nn",
"=",
"new",
"BoundedPriorityQueue"... | Computes the k-nearest neighbors of the given query vector. The search is exhaustive but includes some
optimizations that make it faster, especially for high dimensional vectors.
@param k
The number of nearest neighbors to be returned
@param queryVector
The query vector
@return A bounded priority queue of Result objects, which contains the k nearest neighbors along with
their iids and distances from the query vector, ordered by lowest distance.
@throws Exception
If the index is not loaded in memory | [
"Computes",
"the",
"k",
"-",
"nearest",
"neighbors",
"of",
"the",
"given",
"query",
"vector",
".",
"The",
"search",
"is",
"exhaustive",
"but",
"includes",
"some",
"optimizations",
"that",
"make",
"it",
"faster",
"especially",
"for",
"high",
"dimensional",
"vec... | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/datastructures/Linear.java#L138-L163 |
xmlunit/xmlunit | xmlunit-core/src/main/java/org/xmlunit/diff/DOMDifferenceEngine.java | DOMDifferenceEngine.splitAttributes | private Attributes splitAttributes(final NamedNodeMap map) {
Attr sLoc = (Attr) map.getNamedItemNS(XMLConstants
.W3C_XML_SCHEMA_INSTANCE_NS_URI,
"schemaLocation");
Attr nNsLoc = (Attr) map.getNamedItemNS(XMLConstants
.W3C_XML_SCHEMA_INSTANCE_NS_URI,
"noNamespaceSchemaLocation");
Attr type = (Attr) map.getNamedItemNS(XMLConstants
.W3C_XML_SCHEMA_INSTANCE_NS_URI,
"type");
List<Attr> rest = new LinkedList<Attr>();
final int len = map.getLength();
for (int i = 0; i < len; i++) {
Attr a = (Attr) map.item(i);
if (!XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(a.getNamespaceURI())
&& a != sLoc && a != nNsLoc && a != type
&& getAttributeFilter().test(a)) {
rest.add(a);
}
}
return new Attributes(sLoc, nNsLoc, type, rest);
} | java | private Attributes splitAttributes(final NamedNodeMap map) {
Attr sLoc = (Attr) map.getNamedItemNS(XMLConstants
.W3C_XML_SCHEMA_INSTANCE_NS_URI,
"schemaLocation");
Attr nNsLoc = (Attr) map.getNamedItemNS(XMLConstants
.W3C_XML_SCHEMA_INSTANCE_NS_URI,
"noNamespaceSchemaLocation");
Attr type = (Attr) map.getNamedItemNS(XMLConstants
.W3C_XML_SCHEMA_INSTANCE_NS_URI,
"type");
List<Attr> rest = new LinkedList<Attr>();
final int len = map.getLength();
for (int i = 0; i < len; i++) {
Attr a = (Attr) map.item(i);
if (!XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(a.getNamespaceURI())
&& a != sLoc && a != nNsLoc && a != type
&& getAttributeFilter().test(a)) {
rest.add(a);
}
}
return new Attributes(sLoc, nNsLoc, type, rest);
} | [
"private",
"Attributes",
"splitAttributes",
"(",
"final",
"NamedNodeMap",
"map",
")",
"{",
"Attr",
"sLoc",
"=",
"(",
"Attr",
")",
"map",
".",
"getNamedItemNS",
"(",
"XMLConstants",
".",
"W3C_XML_SCHEMA_INSTANCE_NS_URI",
",",
"\"schemaLocation\"",
")",
";",
"Attr",... | Separates XML namespace related attributes from "normal" attributes.xb | [
"Separates",
"XML",
"namespace",
"related",
"attributes",
"from",
"normal",
"attributes",
".",
"xb"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DOMDifferenceEngine.java#L747-L768 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java | IoUtil.copy | public static long copy(InputStream in, OutputStream out) throws IORuntimeException {
return copy(in, out, DEFAULT_BUFFER_SIZE);
} | java | public static long copy(InputStream in, OutputStream out) throws IORuntimeException {
return copy(in, out, DEFAULT_BUFFER_SIZE);
} | [
"public",
"static",
"long",
"copy",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"return",
"copy",
"(",
"in",
",",
"out",
",",
"DEFAULT_BUFFER_SIZE",
")",
";",
"}"
] | 拷贝流,使用默认Buffer大小
@param in 输入流
@param out 输出流
@return 传输的byte数
@throws IORuntimeException IO异常 | [
"拷贝流,使用默认Buffer大小"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L133-L135 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/base64/Base64.java | Base64.safeDecodeAsString | @Nullable
public static String safeDecodeAsString (@Nullable final byte [] aEncodedBytes, @Nonnull final Charset aCharset)
{
ValueEnforcer.notNull (aCharset, "Charset");
return aEncodedBytes == null ? null : safeDecodeAsString (aEncodedBytes, 0, aEncodedBytes.length, aCharset);
} | java | @Nullable
public static String safeDecodeAsString (@Nullable final byte [] aEncodedBytes, @Nonnull final Charset aCharset)
{
ValueEnforcer.notNull (aCharset, "Charset");
return aEncodedBytes == null ? null : safeDecodeAsString (aEncodedBytes, 0, aEncodedBytes.length, aCharset);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"safeDecodeAsString",
"(",
"@",
"Nullable",
"final",
"byte",
"[",
"]",
"aEncodedBytes",
",",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aCharset",
",",
"\"Char... | Decode the byte array and convert it to a string.
@param aEncodedBytes
The encoded byte array.
@param aCharset
The character set to be used.
@return <code>null</code> if decoding failed. | [
"Decode",
"the",
"byte",
"array",
"and",
"convert",
"it",
"to",
"a",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/base64/Base64.java#L2690-L2696 |
Omertron/api-omdb | src/main/java/com/omertron/omdbapi/tools/OmdbBuilder.java | OmdbBuilder.setImdbId | public OmdbBuilder setImdbId(final String imdbId) throws OMDBException {
if (StringUtils.isBlank(imdbId)) {
throw new OMDBException(ApiExceptionType.UNKNOWN_CAUSE, "Must provide an IMDB ID!");
}
params.add(Param.IMDB, imdbId);
return this;
} | java | public OmdbBuilder setImdbId(final String imdbId) throws OMDBException {
if (StringUtils.isBlank(imdbId)) {
throw new OMDBException(ApiExceptionType.UNKNOWN_CAUSE, "Must provide an IMDB ID!");
}
params.add(Param.IMDB, imdbId);
return this;
} | [
"public",
"OmdbBuilder",
"setImdbId",
"(",
"final",
"String",
"imdbId",
")",
"throws",
"OMDBException",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"imdbId",
")",
")",
"{",
"throw",
"new",
"OMDBException",
"(",
"ApiExceptionType",
".",
"UNKNOWN_CAUSE",
... | A valid IMDb ID
@param imdbId The IMDB ID
@return
@throws OMDBException | [
"A",
"valid",
"IMDb",
"ID"
] | train | https://github.com/Omertron/api-omdb/blob/acb506ded2d7b8a4159b48161ffab8cb5b7bad44/src/main/java/com/omertron/omdbapi/tools/OmdbBuilder.java#L74-L80 |
pierre/serialization | hadoop/src/main/java/com/ning/metrics/serialization/hadoop/SmileRecordReader.java | SmileRecordReader.initialize | @Override
public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException, InterruptedException
{
FileSplit split = (FileSplit) genericSplit;
Configuration job = context.getConfiguration();
start = split.getStart();
end = start + split.getLength();
final Path file = split.getPath();
// Open the file and seek to the start of the split
FileSystem fs = file.getFileSystem(job);
fileIn = fs.open(split.getPath());
if (start != 0) {
--start;
fileIn.seek(start);
}
this.pos = start;
deserializer = new SmileEnvelopeEventDeserializer(fileIn, false);
} | java | @Override
public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException, InterruptedException
{
FileSplit split = (FileSplit) genericSplit;
Configuration job = context.getConfiguration();
start = split.getStart();
end = start + split.getLength();
final Path file = split.getPath();
// Open the file and seek to the start of the split
FileSystem fs = file.getFileSystem(job);
fileIn = fs.open(split.getPath());
if (start != 0) {
--start;
fileIn.seek(start);
}
this.pos = start;
deserializer = new SmileEnvelopeEventDeserializer(fileIn, false);
} | [
"@",
"Override",
"public",
"void",
"initialize",
"(",
"InputSplit",
"genericSplit",
",",
"TaskAttemptContext",
"context",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"FileSplit",
"split",
"=",
"(",
"FileSplit",
")",
"genericSplit",
";",
"Configur... | Called once at initialization.
@param genericSplit the split that defines the range of records to read
@param context the information about the task
@throws java.io.IOException
@throws InterruptedException | [
"Called",
"once",
"at",
"initialization",
"."
] | train | https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/hadoop/src/main/java/com/ning/metrics/serialization/hadoop/SmileRecordReader.java#L55-L74 |
cchantep/acolyte | jdbc-driver/src/main/java/acolyte/jdbc/ParameterMetaData.java | ParameterMetaData.Scaled | public static ParameterDef Scaled(final int sqlType, final int scale) {
return new ParameterDef(jdbcTypeMappings.get(sqlType),
parameterModeIn,
sqlType,
jdbcTypeNames.get(sqlType),
jdbcTypePrecisions.get(sqlType),
scale,
parameterNullableUnknown,
jdbcTypeSigns.get(sqlType));
} | java | public static ParameterDef Scaled(final int sqlType, final int scale) {
return new ParameterDef(jdbcTypeMappings.get(sqlType),
parameterModeIn,
sqlType,
jdbcTypeNames.get(sqlType),
jdbcTypePrecisions.get(sqlType),
scale,
parameterNullableUnknown,
jdbcTypeSigns.get(sqlType));
} | [
"public",
"static",
"ParameterDef",
"Scaled",
"(",
"final",
"int",
"sqlType",
",",
"final",
"int",
"scale",
")",
"{",
"return",
"new",
"ParameterDef",
"(",
"jdbcTypeMappings",
".",
"get",
"(",
"sqlType",
")",
",",
"parameterModeIn",
",",
"sqlType",
",",
"jdb... | Decimal parameter.
@param sqlType the SQL type for the parameter definition
@param scale the scale of the numeric parameter
@return the parameter definition for a number with specified scale | [
"Decimal",
"parameter",
"."
] | train | https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/jdbc-driver/src/main/java/acolyte/jdbc/ParameterMetaData.java#L203-L213 |
javamelody/javamelody | javamelody-core/src/main/java/net/bull/javamelody/PayloadNameRequestWrapper.java | PayloadNameRequestWrapper.parseGwtRpcMethodName | @SuppressWarnings("resource")
private static String parseGwtRpcMethodName(InputStream stream, String charEncoding) {
//commented out code uses GWT-user library for a more 'proper' approach.
//GWT-user library approach is more future-proof, but requires more dependency management.
// RPCRequest decodeRequest = RPC.decodeRequest(readLine);
// gwtmethodname = decodeRequest.getMethod().getName();
try {
final Scanner scanner;
if (charEncoding == null) {
scanner = new Scanner(stream);
} else {
scanner = new Scanner(stream, charEncoding);
}
scanner.useDelimiter(GWT_RPC_SEPARATOR_CHAR_PATTERN); //AbstractSerializationStream.RPC_SEPARATOR_CHAR
//AbstractSerializationStreamReader.prepareToRead(...)
scanner.next(); //stream version number
scanner.next(); //flags
//ServerSerializationStreamReader.deserializeStringTable()
scanner.next(); //type name count
//ServerSerializationStreamReader.preapreToRead(...)
scanner.next(); //module base URL
scanner.next(); //strong name
//RPC.decodeRequest(...)
scanner.next(); //service interface name
return "." + scanner.next(); //service method name
//note we don't close the scanner because we don't want to close the underlying stream
} catch (final NoSuchElementException e) {
LOG.debug("Unable to parse GWT-RPC request", e);
//code above is best-effort - we were unable to parse GWT payload so
//treat as a normal HTTP request
return null;
}
} | java | @SuppressWarnings("resource")
private static String parseGwtRpcMethodName(InputStream stream, String charEncoding) {
//commented out code uses GWT-user library for a more 'proper' approach.
//GWT-user library approach is more future-proof, but requires more dependency management.
// RPCRequest decodeRequest = RPC.decodeRequest(readLine);
// gwtmethodname = decodeRequest.getMethod().getName();
try {
final Scanner scanner;
if (charEncoding == null) {
scanner = new Scanner(stream);
} else {
scanner = new Scanner(stream, charEncoding);
}
scanner.useDelimiter(GWT_RPC_SEPARATOR_CHAR_PATTERN); //AbstractSerializationStream.RPC_SEPARATOR_CHAR
//AbstractSerializationStreamReader.prepareToRead(...)
scanner.next(); //stream version number
scanner.next(); //flags
//ServerSerializationStreamReader.deserializeStringTable()
scanner.next(); //type name count
//ServerSerializationStreamReader.preapreToRead(...)
scanner.next(); //module base URL
scanner.next(); //strong name
//RPC.decodeRequest(...)
scanner.next(); //service interface name
return "." + scanner.next(); //service method name
//note we don't close the scanner because we don't want to close the underlying stream
} catch (final NoSuchElementException e) {
LOG.debug("Unable to parse GWT-RPC request", e);
//code above is best-effort - we were unable to parse GWT payload so
//treat as a normal HTTP request
return null;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"private",
"static",
"String",
"parseGwtRpcMethodName",
"(",
"InputStream",
"stream",
",",
"String",
"charEncoding",
")",
"{",
"//commented out code uses GWT-user library for a more 'proper' approach.\r",
"//GWT-user library appr... | Try to parse GWT-RPC method name from request body stream. Does not close the stream.
@param stream GWT-RPC request body stream @nonnull
@param charEncoding character encoding of stream, or null for platform default @null
@return GWT-RPC method name, or null if unable to parse @null | [
"Try",
"to",
"parse",
"GWT",
"-",
"RPC",
"method",
"name",
"from",
"request",
"body",
"stream",
".",
"Does",
"not",
"close",
"the",
"stream",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/PayloadNameRequestWrapper.java#L152-L191 |
aws/aws-sdk-java | src/samples/AmazonKinesisFirehose/AbstractAmazonKinesisFirehoseDelivery.java | AbstractAmazonKinesisFirehoseDelivery.readResource | private static String readResource(String name) {
try {
return IOUtils.toString(AmazonKinesisFirehoseToRedshiftSample.class.getResourceAsStream(name));
} catch (IOException e) {
throw new RuntimeException("Failed to read document resource: " + name, e);
}
} | java | private static String readResource(String name) {
try {
return IOUtils.toString(AmazonKinesisFirehoseToRedshiftSample.class.getResourceAsStream(name));
} catch (IOException e) {
throw new RuntimeException("Failed to read document resource: " + name, e);
}
} | [
"private",
"static",
"String",
"readResource",
"(",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"IOUtils",
".",
"toString",
"(",
"AmazonKinesisFirehoseToRedshiftSample",
".",
"class",
".",
"getResourceAsStream",
"(",
"name",
")",
")",
";",
"}",
"catch",
... | Method to read the resource for the given filename.
@param name the file name
@return the input stream as string | [
"Method",
"to",
"read",
"the",
"resource",
"for",
"the",
"given",
"filename",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/src/samples/AmazonKinesisFirehose/AbstractAmazonKinesisFirehoseDelivery.java#L462-L468 |
drewwills/cernunnos | cernunnos-core/src/main/java/org/danann/cernunnos/runtime/ScriptRunner.java | ScriptRunner.compileTask | public Task compileTask(String location) {
// Assertions.
if (location == null) {
String msg = "Argument 'location' cannot be null.";
throw new IllegalArgumentException(msg);
}
Document doc = null;
URL origin = null;
try {
origin = new URL(new File(".").toURI().toURL(), location);
doc = new SAXReader().read(origin);
} catch (Throwable t) {
String msg = "Error reading a script from the specified location: " + location;
throw new RuntimeException(msg, t);
}
return new TaskDecorator(grammar.newTask(doc.getRootElement(), null),
origin.toExternalForm());
} | java | public Task compileTask(String location) {
// Assertions.
if (location == null) {
String msg = "Argument 'location' cannot be null.";
throw new IllegalArgumentException(msg);
}
Document doc = null;
URL origin = null;
try {
origin = new URL(new File(".").toURI().toURL(), location);
doc = new SAXReader().read(origin);
} catch (Throwable t) {
String msg = "Error reading a script from the specified location: " + location;
throw new RuntimeException(msg, t);
}
return new TaskDecorator(grammar.newTask(doc.getRootElement(), null),
origin.toExternalForm());
} | [
"public",
"Task",
"compileTask",
"(",
"String",
"location",
")",
"{",
"// Assertions.",
"if",
"(",
"location",
"==",
"null",
")",
"{",
"String",
"msg",
"=",
"\"Argument 'location' cannot be null.\"",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"msg",
")"... | Prepares a <code>Task</code> for (subsequent) execution.
@param location Absolute or relative location of a Cernunnos script file. | [
"Prepares",
"a",
"<code",
">",
"Task<",
"/",
"code",
">",
"for",
"(",
"subsequent",
")",
"execution",
"."
] | train | https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/runtime/ScriptRunner.java#L91-L112 |
kstateome/canvas-api | src/main/java/edu/ksu/canvas/model/BaseCanvasModel.java | BaseCanvasModel.toPostMap | public Map<String, List<String>> toPostMap(boolean includeNulls) {
Class<? extends BaseCanvasModel> clazz = this.getClass();
Map<String, List<String>> postMap = new HashMap<>();
for (Method method : clazz.getMethods()) {
CanvasField canvasFieldAnnotation = method.getAnnotation(CanvasField.class);
if (canvasFieldAnnotation != null && canvasFieldAnnotation.postKey() != null) {
final String postKey = getPostKey(canvasFieldAnnotation);
try {
final List<String> fieldValues = getFieldValues(method);
if ((fieldValues != null && !fieldValues.isEmpty()) || includeNulls) {
if (postMap.containsKey(postKey)) {
postMap.get(postKey).addAll(fieldValues);
} else {
postMap.put(postKey, fieldValues);
}
}
} catch (final IllegalAccessException | InvocationTargetException e) {
final String message = "Could not access Canvas model getter for" + postKey;
LOG.error(message, e);
throw new IllegalStateException(message, e);
}
}
}
return postMap;
} | java | public Map<String, List<String>> toPostMap(boolean includeNulls) {
Class<? extends BaseCanvasModel> clazz = this.getClass();
Map<String, List<String>> postMap = new HashMap<>();
for (Method method : clazz.getMethods()) {
CanvasField canvasFieldAnnotation = method.getAnnotation(CanvasField.class);
if (canvasFieldAnnotation != null && canvasFieldAnnotation.postKey() != null) {
final String postKey = getPostKey(canvasFieldAnnotation);
try {
final List<String> fieldValues = getFieldValues(method);
if ((fieldValues != null && !fieldValues.isEmpty()) || includeNulls) {
if (postMap.containsKey(postKey)) {
postMap.get(postKey).addAll(fieldValues);
} else {
postMap.put(postKey, fieldValues);
}
}
} catch (final IllegalAccessException | InvocationTargetException e) {
final String message = "Could not access Canvas model getter for" + postKey;
LOG.error(message, e);
throw new IllegalStateException(message, e);
}
}
}
return postMap;
} | [
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"toPostMap",
"(",
"boolean",
"includeNulls",
")",
"{",
"Class",
"<",
"?",
"extends",
"BaseCanvasModel",
">",
"clazz",
"=",
"this",
".",
"getClass",
"(",
")",
";",
"Map",
"<",
"String... | /* Canvas has post parameter keys in non consistent formats. Occasionally they are 'class[field]' and other times
they are just 'field'. This method will create a map with the correct post keys and values based on the
@CanvasField and @CanvasObject annotations. | [
"/",
"*",
"Canvas",
"has",
"post",
"parameter",
"keys",
"in",
"non",
"consistent",
"formats",
".",
"Occasionally",
"they",
"are",
"class",
"[",
"field",
"]",
"and",
"other",
"times",
"they",
"are",
"just",
"field",
".",
"This",
"method",
"will",
"create",
... | train | https://github.com/kstateome/canvas-api/blob/426bf403a8fd7aca3f170348005feda25b374e5a/src/main/java/edu/ksu/canvas/model/BaseCanvasModel.java#L26-L50 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CertificatesInner.java | CertificatesInner.createOrUpdate | public CertificateInner createOrUpdate(String resourceGroupName, String automationAccountName, String certificateName, CertificateCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, certificateName, parameters).toBlocking().single().body();
} | java | public CertificateInner createOrUpdate(String resourceGroupName, String automationAccountName, String certificateName, CertificateCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, certificateName, parameters).toBlocking().single().body();
} | [
"public",
"CertificateInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"certificateName",
",",
"CertificateCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
... | Create a certificate.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param certificateName The parameters supplied to the create or update certificate operation.
@param parameters The parameters supplied to the create or update certificate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the CertificateInner object if successful. | [
"Create",
"a",
"certificate",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CertificatesInner.java#L286-L288 |
MKLab-ITI/multimedia-indexing | src/main/java/gr/iti/mklab/visual/datastructures/AbstractSearchStructure.java | AbstractSearchStructure.getGeolocation | public LatLng getGeolocation(int iid) {
if (iid < 0 || iid > loadCounter) {
System.out.println("Internal id " + iid + " is out of range!");
return null;
}
DatabaseEntry key = new DatabaseEntry();
IntegerBinding.intToEntry(iid, key);
DatabaseEntry data = new DatabaseEntry();
if ((iidToGeolocationDB.get(null, key, data, null) == OperationStatus.SUCCESS)) {
TupleInput input = TupleBinding.entryToInput(data);
double latitude = input.readDouble();
double longitude = input.readDouble();
LatLng geolocation = new LatLng(latitude, longitude);
return geolocation;
} else {
System.out.println("Internal id " + iid + " is in range but gelocation was not found.");
return null;
}
} | java | public LatLng getGeolocation(int iid) {
if (iid < 0 || iid > loadCounter) {
System.out.println("Internal id " + iid + " is out of range!");
return null;
}
DatabaseEntry key = new DatabaseEntry();
IntegerBinding.intToEntry(iid, key);
DatabaseEntry data = new DatabaseEntry();
if ((iidToGeolocationDB.get(null, key, data, null) == OperationStatus.SUCCESS)) {
TupleInput input = TupleBinding.entryToInput(data);
double latitude = input.readDouble();
double longitude = input.readDouble();
LatLng geolocation = new LatLng(latitude, longitude);
return geolocation;
} else {
System.out.println("Internal id " + iid + " is in range but gelocation was not found.");
return null;
}
} | [
"public",
"LatLng",
"getGeolocation",
"(",
"int",
"iid",
")",
"{",
"if",
"(",
"iid",
"<",
"0",
"||",
"iid",
">",
"loadCounter",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Internal id \"",
"+",
"iid",
"+",
"\" is out of range!\"",
")",
";",
... | Returns a {@link LatLng} object with the geolocation of the vector with the given internal id or null
if the internal id does not exist. Accesses the BDB store!
@param iid
The internal id of the vector
@return The geolocation mapped to the given internal id or null if the internal id does not exist | [
"Returns",
"a",
"{",
"@link",
"LatLng",
"}",
"object",
"with",
"the",
"geolocation",
"of",
"the",
"vector",
"with",
"the",
"given",
"internal",
"id",
"or",
"null",
"if",
"the",
"internal",
"id",
"does",
"not",
"exist",
".",
"Accesses",
"the",
"BDB",
"sto... | train | https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/datastructures/AbstractSearchStructure.java#L429-L447 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsync | public static <R> Func0<Observable<R>> toAsync(Func0<? extends R> func) {
return toAsync(func, Schedulers.computation());
} | java | public static <R> Func0<Observable<R>> toAsync(Func0<? extends R> func) {
return toAsync(func, Schedulers.computation());
} | [
"public",
"static",
"<",
"R",
">",
"Func0",
"<",
"Observable",
"<",
"R",
">",
">",
"toAsync",
"(",
"Func0",
"<",
"?",
"extends",
"R",
">",
"func",
")",
"{",
"return",
"toAsync",
"(",
"func",
",",
"Schedulers",
".",
"computation",
"(",
")",
")",
";"... | Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.png" alt="">
@param <R> the result value type
@param func the function to convert
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh229182.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"function",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki"... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L161-L163 |
twilio/twilio-java | src/main/java/com/twilio/rest/serverless/v1/service/environment/VariableReader.java | VariableReader.previousPage | @Override
public Page<Variable> previousPage(final Page<Variable> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.SERVERLESS.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | java | @Override
public Page<Variable> previousPage(final Page<Variable> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.SERVERLESS.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | [
"@",
"Override",
"public",
"Page",
"<",
"Variable",
">",
"previousPage",
"(",
"final",
"Page",
"<",
"Variable",
">",
"page",
",",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
"... | Retrieve the previous page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Previous Page | [
"Retrieve",
"the",
"previous",
"page",
"from",
"the",
"Twilio",
"API",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/serverless/v1/service/environment/VariableReader.java#L119-L130 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.naturalDay | public static String naturalDay(final int style, final Date then, final Locale locale)
{
return withinLocale(new Callable<String>()
{
public String call() throws Exception
{
return naturalDay(style, then);
}
}, locale);
} | java | public static String naturalDay(final int style, final Date then, final Locale locale)
{
return withinLocale(new Callable<String>()
{
public String call() throws Exception
{
return naturalDay(style, then);
}
}, locale);
} | [
"public",
"static",
"String",
"naturalDay",
"(",
"final",
"int",
"style",
",",
"final",
"Date",
"then",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"withinLocale",
"(",
"new",
"Callable",
"<",
"String",
">",
"(",
")",
"{",
"public",
"String",
"... | Same as {@link #naturalDay(int, Date)} with the given locale.
@param style
The style of the Date
@param then
The date (GMT)
@param locale
Target locale
@return String with 'today', 'tomorrow' or 'yesterday' compared to
current day. Otherwise, returns a string formatted according to a
locale sensitive DateFormat. | [
"Same",
"as",
"{",
"@link",
"#naturalDay",
"(",
"int",
"Date",
")",
"}",
"with",
"the",
"given",
"locale",
"."
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L1521-L1530 |
eurekaclinical/eurekaclinical-common | src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java | EurekaClinicalClient.doPut | protected void doPut(String path, Object o) throws ClientException {
doPut(path, o, null);
} | java | protected void doPut(String path, Object o) throws ClientException {
doPut(path, o, null);
} | [
"protected",
"void",
"doPut",
"(",
"String",
"path",
",",
"Object",
"o",
")",
"throws",
"ClientException",
"{",
"doPut",
"(",
"path",
",",
"o",
",",
"null",
")",
";",
"}"
] | Updates the resource specified by the path. Sends to the server a Content
Type header for JSON.
@param o the updated object, will be transmitted as JSON. It must be a
Java bean or an object that the object mapper that is in use knows about.
@param path the path to the resource. Cannot be <code>null</code>.
@throws ClientException if a status code other than 204 (No Content) or
200 (OK) is returned. | [
"Updates",
"the",
"resource",
"specified",
"by",
"the",
"path",
".",
"Sends",
"to",
"the",
"server",
"a",
"Content",
"Type",
"header",
"for",
"JSON",
"."
] | train | https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L179-L181 |
Azure/azure-sdk-for-java | common/azure-common-mgmt/src/main/java/com/azure/common/mgmt/AzureProxy.java | AzureProxy.createDefaultPipeline | public static HttpPipeline createDefaultPipeline(Class<?> swaggerInterface, ServiceClientCredentials credentials) {
return createDefaultPipeline(swaggerInterface, new CredentialsPolicy(credentials));
} | java | public static HttpPipeline createDefaultPipeline(Class<?> swaggerInterface, ServiceClientCredentials credentials) {
return createDefaultPipeline(swaggerInterface, new CredentialsPolicy(credentials));
} | [
"public",
"static",
"HttpPipeline",
"createDefaultPipeline",
"(",
"Class",
"<",
"?",
">",
"swaggerInterface",
",",
"ServiceClientCredentials",
"credentials",
")",
"{",
"return",
"createDefaultPipeline",
"(",
"swaggerInterface",
",",
"new",
"CredentialsPolicy",
"(",
"cre... | Create the default HttpPipeline.
@param swaggerInterface The interface that the pipeline will use to generate a user-agent
string.
@param credentials The credentials to use to apply authentication to the pipeline.
@return the default HttpPipeline. | [
"Create",
"the",
"default",
"HttpPipeline",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common-mgmt/src/main/java/com/azure/common/mgmt/AzureProxy.java#L169-L171 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java | DatabaseThreatDetectionPoliciesInner.getAsync | public Observable<DatabaseSecurityAlertPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseSecurityAlertPolicyInner>, DatabaseSecurityAlertPolicyInner>() {
@Override
public DatabaseSecurityAlertPolicyInner call(ServiceResponse<DatabaseSecurityAlertPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseSecurityAlertPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseSecurityAlertPolicyInner>, DatabaseSecurityAlertPolicyInner>() {
@Override
public DatabaseSecurityAlertPolicyInner call(ServiceResponse<DatabaseSecurityAlertPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseSecurityAlertPolicyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName"... | Gets a database's threat detection policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database for which database Threat Detection policy is defined.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseSecurityAlertPolicyInner object | [
"Gets",
"a",
"database",
"s",
"threat",
"detection",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseThreatDetectionPoliciesInner.java#L105-L112 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java | ComputeNodesImpl.enableScheduling | public void enableScheduling(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions) {
enableSchedulingWithServiceResponseAsync(poolId, nodeId, computeNodeEnableSchedulingOptions).toBlocking().single().body();
} | java | public void enableScheduling(String poolId, String nodeId, ComputeNodeEnableSchedulingOptions computeNodeEnableSchedulingOptions) {
enableSchedulingWithServiceResponseAsync(poolId, nodeId, computeNodeEnableSchedulingOptions).toBlocking().single().body();
} | [
"public",
"void",
"enableScheduling",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"ComputeNodeEnableSchedulingOptions",
"computeNodeEnableSchedulingOptions",
")",
"{",
"enableSchedulingWithServiceResponseAsync",
"(",
"poolId",
",",
"nodeId",
",",
"computeNodeEnable... | Enables task scheduling on the specified compute node.
You can enable task scheduling on a node only if its current scheduling state is disabled.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node on which you want to enable task scheduling.
@param computeNodeEnableSchedulingOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Enables",
"task",
"scheduling",
"on",
"the",
"specified",
"compute",
"node",
".",
"You",
"can",
"enable",
"task",
"scheduling",
"on",
"a",
"node",
"only",
"if",
"its",
"current",
"scheduling",
"state",
"is",
"disabled",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L1814-L1816 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/function/Actions.java | Actions.toFunc | public static <T1, T2, T3, R> Func3<T1, T2, T3, R> toFunc(final Action3<T1, T2, T3> action, final R result) {
return new Func3<T1, T2, T3, R>() {
@Override
public R call(T1 t1, T2 t2, T3 t3) {
action.call(t1, t2, t3);
return result;
}
};
} | java | public static <T1, T2, T3, R> Func3<T1, T2, T3, R> toFunc(final Action3<T1, T2, T3> action, final R result) {
return new Func3<T1, T2, T3, R>() {
@Override
public R call(T1 t1, T2 t2, T3 t3) {
action.call(t1, t2, t3);
return result;
}
};
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"Func3",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"toFunc",
"(",
"final",
"Action3",
"<",
"T1",
",",
"T2",
",",
"T3",
">",
"action",
",",
"final",
"R",
"result",
")",
... | Converts an {@link Action3} to a function that calls the action and returns a specified value.
@param action the {@link Action3} to convert
@param result the value to return from the function call
@return a {@link Func3} that calls {@code action} and returns {@code result} | [
"Converts",
"an",
"{",
"@link",
"Action3",
"}",
"to",
"a",
"function",
"that",
"calls",
"the",
"action",
"and",
"returns",
"a",
"specified",
"value",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L253-L261 |
undera/jmeter-plugins | infra/common/src/main/java/kg/apc/jmeter/JMeterPluginsUtils.java | JMeterPluginsUtils.addHelpLinkToPanel | public static Component addHelpLinkToPanel(Container panel, String helpPage) {
if (!java.awt.Desktop.isDesktopSupported()) {
return panel;
}
JLabel icon = new JLabel();
icon.setIcon(new javax.swing.ImageIcon(JMeterPluginsUtils.class.getResource("vizualizers/information.png")));
JLabel link = new JLabel("Help on this plugin");
link.setForeground(Color.blue);
link.setFont(link.getFont().deriveFont(Font.PLAIN));
link.setCursor(new Cursor(Cursor.HAND_CURSOR));
link.addMouseListener(new URIOpener(buildHelpPageUrl(helpPage)));
Border border = BorderFactory.createMatteBorder(0, 0, 1, 0, java.awt.Color.blue);
link.setBorder(border);
JLabel version = new JLabel(""); // FIXME: what to do?
version.setFont(version.getFont().deriveFont(Font.PLAIN).deriveFont(11F));
version.setForeground(Color.GRAY);
Container innerPanel = findComponentWithBorder((JComponent) panel, EtchedBorder.class);
JPanel panelLink = new JPanel(new GridBagLayout());
GridBagConstraints gridBagConstraints;
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0);
panelLink.add(icon, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 2, 3, 0);
panelLink.add(link, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
panelLink.add(version, gridBagConstraints);
if (innerPanel != null) {
innerPanel.add(panelLink);
} else {
panel.add(panelLink);
}
return panel;
} | java | public static Component addHelpLinkToPanel(Container panel, String helpPage) {
if (!java.awt.Desktop.isDesktopSupported()) {
return panel;
}
JLabel icon = new JLabel();
icon.setIcon(new javax.swing.ImageIcon(JMeterPluginsUtils.class.getResource("vizualizers/information.png")));
JLabel link = new JLabel("Help on this plugin");
link.setForeground(Color.blue);
link.setFont(link.getFont().deriveFont(Font.PLAIN));
link.setCursor(new Cursor(Cursor.HAND_CURSOR));
link.addMouseListener(new URIOpener(buildHelpPageUrl(helpPage)));
Border border = BorderFactory.createMatteBorder(0, 0, 1, 0, java.awt.Color.blue);
link.setBorder(border);
JLabel version = new JLabel(""); // FIXME: what to do?
version.setFont(version.getFont().deriveFont(Font.PLAIN).deriveFont(11F));
version.setForeground(Color.GRAY);
Container innerPanel = findComponentWithBorder((JComponent) panel, EtchedBorder.class);
JPanel panelLink = new JPanel(new GridBagLayout());
GridBagConstraints gridBagConstraints;
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0);
panelLink.add(icon, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 2, 3, 0);
panelLink.add(link, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
panelLink.add(version, gridBagConstraints);
if (innerPanel != null) {
innerPanel.add(panelLink);
} else {
panel.add(panelLink);
}
return panel;
} | [
"public",
"static",
"Component",
"addHelpLinkToPanel",
"(",
"Container",
"panel",
",",
"String",
"helpPage",
")",
"{",
"if",
"(",
"!",
"java",
".",
"awt",
".",
"Desktop",
".",
"isDesktopSupported",
"(",
")",
")",
"{",
"return",
"panel",
";",
"}",
"JLabel",... | Find in panel appropriate place and put hyperlink there. I know that it
is stupid way. But the result is so good!
@param panel - supposed to be result of makeTitlePanel()
@param helpPage wiki page name, or full URL in case of external wiki
@return original panel
@see AbstractJMeterGuiComponent | [
"Find",
"in",
"panel",
"appropriate",
"place",
"and",
"put",
"hyperlink",
"there",
".",
"I",
"know",
"that",
"it",
"is",
"stupid",
"way",
".",
"But",
"the",
"result",
"is",
"so",
"good!"
] | train | https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/infra/common/src/main/java/kg/apc/jmeter/JMeterPluginsUtils.java#L200-L251 |
VoltDB/voltdb | src/frontend/org/voltdb/planner/AbstractParsedStmt.java | AbstractParsedStmt.addSubqueryToStmtCache | protected StmtSubqueryScan addSubqueryToStmtCache(
AbstractParsedStmt subquery, String tableAlias) {
assert(subquery != null);
// If there is no usable alias because the subquery is inside an expression,
// generate a unique one for internal use.
if (tableAlias == null) {
tableAlias = AbstractParsedStmt.TEMP_TABLE_NAME + "_" + subquery.m_stmtId;
}
StmtSubqueryScan subqueryScan =
new StmtSubqueryScan(subquery, tableAlias, m_stmtId);
StmtTableScan prior = m_tableAliasMap.put(tableAlias, subqueryScan);
assert(prior == null);
return subqueryScan;
} | java | protected StmtSubqueryScan addSubqueryToStmtCache(
AbstractParsedStmt subquery, String tableAlias) {
assert(subquery != null);
// If there is no usable alias because the subquery is inside an expression,
// generate a unique one for internal use.
if (tableAlias == null) {
tableAlias = AbstractParsedStmt.TEMP_TABLE_NAME + "_" + subquery.m_stmtId;
}
StmtSubqueryScan subqueryScan =
new StmtSubqueryScan(subquery, tableAlias, m_stmtId);
StmtTableScan prior = m_tableAliasMap.put(tableAlias, subqueryScan);
assert(prior == null);
return subqueryScan;
} | [
"protected",
"StmtSubqueryScan",
"addSubqueryToStmtCache",
"(",
"AbstractParsedStmt",
"subquery",
",",
"String",
"tableAlias",
")",
"{",
"assert",
"(",
"subquery",
"!=",
"null",
")",
";",
"// If there is no usable alias because the subquery is inside an expression,",
"// genera... | Add a sub-query to the statement cache.
@param subquery
@param tableAlias
@return the cache entry | [
"Add",
"a",
"sub",
"-",
"query",
"to",
"the",
"statement",
"cache",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/AbstractParsedStmt.java#L820-L833 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwxmlcontenttype.java | appfwxmlcontenttype.get | public static appfwxmlcontenttype get(nitro_service service, String xmlcontenttypevalue) throws Exception{
appfwxmlcontenttype obj = new appfwxmlcontenttype();
obj.set_xmlcontenttypevalue(xmlcontenttypevalue);
appfwxmlcontenttype response = (appfwxmlcontenttype) obj.get_resource(service);
return response;
} | java | public static appfwxmlcontenttype get(nitro_service service, String xmlcontenttypevalue) throws Exception{
appfwxmlcontenttype obj = new appfwxmlcontenttype();
obj.set_xmlcontenttypevalue(xmlcontenttypevalue);
appfwxmlcontenttype response = (appfwxmlcontenttype) obj.get_resource(service);
return response;
} | [
"public",
"static",
"appfwxmlcontenttype",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"xmlcontenttypevalue",
")",
"throws",
"Exception",
"{",
"appfwxmlcontenttype",
"obj",
"=",
"new",
"appfwxmlcontenttype",
"(",
")",
";",
"obj",
".",
"set_xmlcontenttypeval... | Use this API to fetch appfwxmlcontenttype resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"appfwxmlcontenttype",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwxmlcontenttype.java#L218-L223 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java | Frame.getStackLocation | public int getStackLocation(int loc) throws DataflowAnalysisException {
int stackDepth = getStackDepth();
if (loc >= stackDepth) {
throw new DataflowAnalysisException("not enough values on stack: access=" + loc + ", avail=" + stackDepth);
}
return slotList.size() - (loc + 1);
} | java | public int getStackLocation(int loc) throws DataflowAnalysisException {
int stackDepth = getStackDepth();
if (loc >= stackDepth) {
throw new DataflowAnalysisException("not enough values on stack: access=" + loc + ", avail=" + stackDepth);
}
return slotList.size() - (loc + 1);
} | [
"public",
"int",
"getStackLocation",
"(",
"int",
"loc",
")",
"throws",
"DataflowAnalysisException",
"{",
"int",
"stackDepth",
"=",
"getStackDepth",
"(",
")",
";",
"if",
"(",
"loc",
">=",
"stackDepth",
")",
"{",
"throw",
"new",
"DataflowAnalysisException",
"(",
... | Get a the location in the frame of a value on the operand stack.
@param loc
the stack location, counting downwards from the top (location
0) | [
"Get",
"a",
"the",
"location",
"in",
"the",
"frame",
"of",
"a",
"value",
"on",
"the",
"operand",
"stack",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L263-L269 |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/util/CaseInsensitiveStringMap.java | CaseInsensitiveStringMap.getBoolean | public boolean getBoolean(String key, boolean defaultValue) {
String value = get(key);
// We can't use `Boolean.parseBoolean` here, as it returns false for invalid strings.
if (value == null) {
return defaultValue;
} else if (value.equalsIgnoreCase("true")) {
return true;
} else if (value.equalsIgnoreCase("false")) {
return false;
} else {
throw new IllegalArgumentException(value + " is not a boolean string.");
}
} | java | public boolean getBoolean(String key, boolean defaultValue) {
String value = get(key);
// We can't use `Boolean.parseBoolean` here, as it returns false for invalid strings.
if (value == null) {
return defaultValue;
} else if (value.equalsIgnoreCase("true")) {
return true;
} else if (value.equalsIgnoreCase("false")) {
return false;
} else {
throw new IllegalArgumentException(value + " is not a boolean string.");
}
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"// We can't use `Boolean.parseBoolean` here, as it returns false for invalid strings.",
"if",
"(",
"value",
"==",
"... | Returns the boolean value to which the specified key is mapped,
or defaultValue if there is no mapping for the key. The key match is case-insensitive. | [
"Returns",
"the",
"boolean",
"value",
"to",
"which",
"the",
"specified",
"key",
"is",
"mapped",
"or",
"defaultValue",
"if",
"there",
"is",
"no",
"mapping",
"for",
"the",
"key",
".",
"The",
"key",
"match",
"is",
"case",
"-",
"insensitive",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/util/CaseInsensitiveStringMap.java#L134-L146 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.onSetGcGrace | private void onSetGcGrace(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String gcGraceSeconds = cfProperties.getProperty(CassandraConstants.GC_GRACE_SECONDS);
if (gcGraceSeconds != null)
{
try
{
if (builder != null)
{
appendPropertyToBuilder(builder, gcGraceSeconds, CassandraConstants.GC_GRACE_SECONDS);
}
else
{
cfDef.setGc_grace_seconds(Integer.parseInt(gcGraceSeconds));
}
}
catch (NumberFormatException nfe)
{
log.error("GC_GRACE_SECONDS should be numeric type, Caused by: .", nfe);
throw new SchemaGenerationException(nfe);
}
}
} | java | private void onSetGcGrace(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String gcGraceSeconds = cfProperties.getProperty(CassandraConstants.GC_GRACE_SECONDS);
if (gcGraceSeconds != null)
{
try
{
if (builder != null)
{
appendPropertyToBuilder(builder, gcGraceSeconds, CassandraConstants.GC_GRACE_SECONDS);
}
else
{
cfDef.setGc_grace_seconds(Integer.parseInt(gcGraceSeconds));
}
}
catch (NumberFormatException nfe)
{
log.error("GC_GRACE_SECONDS should be numeric type, Caused by: .", nfe);
throw new SchemaGenerationException(nfe);
}
}
} | [
"private",
"void",
"onSetGcGrace",
"(",
"CfDef",
"cfDef",
",",
"Properties",
"cfProperties",
",",
"StringBuilder",
"builder",
")",
"{",
"String",
"gcGraceSeconds",
"=",
"cfProperties",
".",
"getProperty",
"(",
"CassandraConstants",
".",
"GC_GRACE_SECONDS",
")",
";",... | On set gc grace.
@param cfDef
the cf def
@param cfProperties
the cf properties
@param builder
the builder | [
"On",
"set",
"gc",
"grace",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2496-L2518 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/Session.java | Session.sortGrantsByStartTime | private void sortGrantsByStartTime(List<ResourceGrant> grants) {
Collections.sort(grants, new Comparator<ResourceGrant>() {
@Override
public int compare(ResourceGrant g1, ResourceGrant g2) {
if (g1.grantedTime < g2.grantedTime) {
return 1;
}
if (g1.grantedTime > g2.grantedTime) {
return -1;
}
return g2.id - g1.id;
}
});
} | java | private void sortGrantsByStartTime(List<ResourceGrant> grants) {
Collections.sort(grants, new Comparator<ResourceGrant>() {
@Override
public int compare(ResourceGrant g1, ResourceGrant g2) {
if (g1.grantedTime < g2.grantedTime) {
return 1;
}
if (g1.grantedTime > g2.grantedTime) {
return -1;
}
return g2.id - g1.id;
}
});
} | [
"private",
"void",
"sortGrantsByStartTime",
"(",
"List",
"<",
"ResourceGrant",
">",
"grants",
")",
"{",
"Collections",
".",
"sort",
"(",
"grants",
",",
"new",
"Comparator",
"<",
"ResourceGrant",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare"... | Sort grants on granted time in descending order
@param grants the list of grants to sort | [
"Sort",
"grants",
"on",
"granted",
"time",
"in",
"descending",
"order"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Session.java#L1253-L1266 |
wcm-io/wcm-io-tooling | commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java | ContentPackage.addFile | public void addFile(String path, InputStream inputStream, String contentType) throws IOException {
String fullPath = buildJcrPathForZip(path);
writeBinaryFile(fullPath, inputStream);
if (StringUtils.isNotEmpty(contentType)) {
String mimeType = StringUtils.substringBefore(contentType, CONTENT_TYPE_CHARSET_EXTENSION);
String encoding = StringUtils.substringAfter(contentType, CONTENT_TYPE_CHARSET_EXTENSION);
String fullPathMetadata = fullPath + DOT_DIR_FOLDER + "/" + DOT_CONTENT_XML;
Document doc = xmlContentBuilder.buildNtFile(mimeType, encoding);
writeXmlDocument(fullPathMetadata, doc);
}
} | java | public void addFile(String path, InputStream inputStream, String contentType) throws IOException {
String fullPath = buildJcrPathForZip(path);
writeBinaryFile(fullPath, inputStream);
if (StringUtils.isNotEmpty(contentType)) {
String mimeType = StringUtils.substringBefore(contentType, CONTENT_TYPE_CHARSET_EXTENSION);
String encoding = StringUtils.substringAfter(contentType, CONTENT_TYPE_CHARSET_EXTENSION);
String fullPathMetadata = fullPath + DOT_DIR_FOLDER + "/" + DOT_CONTENT_XML;
Document doc = xmlContentBuilder.buildNtFile(mimeType, encoding);
writeXmlDocument(fullPathMetadata, doc);
}
} | [
"public",
"void",
"addFile",
"(",
"String",
"path",
",",
"InputStream",
"inputStream",
",",
"String",
"contentType",
")",
"throws",
"IOException",
"{",
"String",
"fullPath",
"=",
"buildJcrPathForZip",
"(",
"path",
")",
";",
"writeBinaryFile",
"(",
"fullPath",
",... | Adds a binary file with explicit mime type.
@param path Full content path and file name of file
@param inputStream Input stream with binary data
@param contentType Mime type, optionally with ";charset=XYZ" extension
@throws IOException I/O exception | [
"Adds",
"a",
"binary",
"file",
"with",
"explicit",
"mime",
"type",
"."
] | train | https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/content-package-builder/src/main/java/io/wcm/tooling/commons/contentpackagebuilder/ContentPackage.java#L188-L200 |
aws/aws-sdk-java | aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateCoreDefinitionRequest.java | CreateCoreDefinitionRequest.withTags | public CreateCoreDefinitionRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public CreateCoreDefinitionRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateCoreDefinitionRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | Tag(s) to add to the new resource
@param tags
Tag(s) to add to the new resource
@return Returns a reference to this object so that method calls can be chained together. | [
"Tag",
"(",
"s",
")",
"to",
"add",
"to",
"the",
"new",
"resource"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateCoreDefinitionRequest.java#L169-L172 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/passivator/EJBObjectInfo.java | EJBObjectInfo.addFieldInfo | void addFieldInfo(String className, List<FieldInfo> fieldInfoList) {
if (ivFieldInfoMap == null) {
ivFieldInfoMap = new HashMap<String, List<FieldInfo>>();
}
ivFieldInfoMap.put(className, fieldInfoList);
} | java | void addFieldInfo(String className, List<FieldInfo> fieldInfoList) {
if (ivFieldInfoMap == null) {
ivFieldInfoMap = new HashMap<String, List<FieldInfo>>();
}
ivFieldInfoMap.put(className, fieldInfoList);
} | [
"void",
"addFieldInfo",
"(",
"String",
"className",
",",
"List",
"<",
"FieldInfo",
">",
"fieldInfoList",
")",
"{",
"if",
"(",
"ivFieldInfoMap",
"==",
"null",
")",
"{",
"ivFieldInfoMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"List",
"<",
"FieldInfo",
"... | Adds the className and fieldInfoList to the ivFieldInfoMap.
@param className
@param fieldInfoList | [
"Adds",
"the",
"className",
"and",
"fieldInfoList",
"to",
"the",
"ivFieldInfoMap",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/passivator/EJBObjectInfo.java#L76-L81 |
keenon/loglinear | src/main/java/com/github/keenon/loglinear/learning/AbstractBatchOptimizer.java | AbstractBatchOptimizer.addSparseConstraint | public void addSparseConstraint(int component, int index, double value) {
constraints.add(new Constraint(component, index, value));
} | java | public void addSparseConstraint(int component, int index, double value) {
constraints.add(new Constraint(component, index, value));
} | [
"public",
"void",
"addSparseConstraint",
"(",
"int",
"component",
",",
"int",
"index",
",",
"double",
"value",
")",
"{",
"constraints",
".",
"add",
"(",
"new",
"Constraint",
"(",
"component",
",",
"index",
",",
"value",
")",
")",
";",
"}"
] | This adds a constraint on the weight vector, that a certain component must be set to a sparse index=value
@param component the component to fix
@param index the index of the fixed sparse component
@param value the value to fix at | [
"This",
"adds",
"a",
"constraint",
"on",
"the",
"weight",
"vector",
"that",
"a",
"certain",
"component",
"must",
"be",
"set",
"to",
"a",
"sparse",
"index",
"=",
"value"
] | train | https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/learning/AbstractBatchOptimizer.java#L106-L108 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java | Pool.addConnection | private void addConnection() throws SQLException {
//create new connection
Protocol protocol = Utils.retrieveProxy(urlParser, globalInfo);
MariaDbConnection connection = new MariaDbConnection(protocol);
MariaDbPooledConnection pooledConnection = createPoolConnection(connection);
if (options.staticGlobal) {
//on first connection load initial state
if (globalInfo == null) {
initializePoolGlobalState(connection);
}
//set default transaction isolation level to permit resetting to initial state
connection.setDefaultTransactionIsolation(globalInfo.getDefaultTransactionIsolation());
} else {
//set default transaction isolation level to permit resetting to initial state
connection.setDefaultTransactionIsolation(connection.getTransactionIsolation());
}
if (poolState.get() == POOL_STATE_OK
&& totalConnection.incrementAndGet() <= options.maxPoolSize) {
idleConnections.addFirst(pooledConnection);
if (logger.isDebugEnabled()) {
logger.debug("pool {} new physical connection created (total:{}, active:{}, pending:{})",
poolTag, totalConnection.get(), getActiveConnections(), pendingRequestNumber.get());
}
return;
}
silentCloseConnection(pooledConnection);
} | java | private void addConnection() throws SQLException {
//create new connection
Protocol protocol = Utils.retrieveProxy(urlParser, globalInfo);
MariaDbConnection connection = new MariaDbConnection(protocol);
MariaDbPooledConnection pooledConnection = createPoolConnection(connection);
if (options.staticGlobal) {
//on first connection load initial state
if (globalInfo == null) {
initializePoolGlobalState(connection);
}
//set default transaction isolation level to permit resetting to initial state
connection.setDefaultTransactionIsolation(globalInfo.getDefaultTransactionIsolation());
} else {
//set default transaction isolation level to permit resetting to initial state
connection.setDefaultTransactionIsolation(connection.getTransactionIsolation());
}
if (poolState.get() == POOL_STATE_OK
&& totalConnection.incrementAndGet() <= options.maxPoolSize) {
idleConnections.addFirst(pooledConnection);
if (logger.isDebugEnabled()) {
logger.debug("pool {} new physical connection created (total:{}, active:{}, pending:{})",
poolTag, totalConnection.get(), getActiveConnections(), pendingRequestNumber.get());
}
return;
}
silentCloseConnection(pooledConnection);
} | [
"private",
"void",
"addConnection",
"(",
")",
"throws",
"SQLException",
"{",
"//create new connection",
"Protocol",
"protocol",
"=",
"Utils",
".",
"retrieveProxy",
"(",
"urlParser",
",",
"globalInfo",
")",
";",
"MariaDbConnection",
"connection",
"=",
"new",
"MariaDb... | Create new connection.
@throws SQLException if connection creation failed | [
"Create",
"new",
"connection",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/pool/Pool.java#L215-L246 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java | BlobContainersInner.createOrUpdateImmutabilityPolicy | public ImmutabilityPolicyInner createOrUpdateImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, int immutabilityPeriodSinceCreationInDays, String ifMatch) {
return createOrUpdateImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, immutabilityPeriodSinceCreationInDays, ifMatch).toBlocking().single().body();
} | java | public ImmutabilityPolicyInner createOrUpdateImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, int immutabilityPeriodSinceCreationInDays, String ifMatch) {
return createOrUpdateImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, immutabilityPeriodSinceCreationInDays, ifMatch).toBlocking().single().body();
} | [
"public",
"ImmutabilityPolicyInner",
"createOrUpdateImmutabilityPolicy",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"containerName",
",",
"int",
"immutabilityPeriodSinceCreationInDays",
",",
"String",
"ifMatch",
")",
"{",
"return",
"cre... | Creates or updates an unlocked immutability policy. ETag in If-Match is honored if given but not required for this operation.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
@param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days.
@param ifMatch The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ImmutabilityPolicyInner object if successful. | [
"Creates",
"or",
"updates",
"an",
"unlocked",
"immutability",
"policy",
".",
"ETag",
"in",
"If",
"-",
"Match",
"is",
"honored",
"if",
"given",
"but",
"not",
"required",
"for",
"this",
"operation",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L1096-L1098 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newClientContext | @Deprecated
public static SslContext newClientContext(
File certChainFile, TrustManagerFactory trustManagerFactory) throws SSLException {
return newClientContext(null, certChainFile, trustManagerFactory);
} | java | @Deprecated
public static SslContext newClientContext(
File certChainFile, TrustManagerFactory trustManagerFactory) throws SSLException {
return newClientContext(null, certChainFile, trustManagerFactory);
} | [
"@",
"Deprecated",
"public",
"static",
"SslContext",
"newClientContext",
"(",
"File",
"certChainFile",
",",
"TrustManagerFactory",
"trustManagerFactory",
")",
"throws",
"SSLException",
"{",
"return",
"newClientContext",
"(",
"null",
",",
"certChainFile",
",",
"trustMana... | Creates a new client-side {@link SslContext}.
@param certChainFile an X.509 certificate chain file in PEM format.
{@code null} to use the system default
@param trustManagerFactory the {@link TrustManagerFactory} that provides the {@link TrustManager}s
that verifies the certificates sent from servers.
{@code null} to use the default.
@return a new client-side {@link SslContext}
@deprecated Replaced by {@link SslContextBuilder} | [
"Creates",
"a",
"new",
"client",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L495-L499 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java | SearchIndex.createDocument | protected Document createDocument(NodeDataIndexing node, NamespaceMappings nsMappings,
IndexFormatVersion indexFormatVersion, boolean loadAllProperties, VolatileIndex volatileIndex) throws RepositoryException
{
NodeIndexer indexer =
new NodeIndexer(node, getContext().getItemStateManager(), nsMappings, extractor);
indexer.setSupportHighlighting(supportHighlighting);
indexer.setIndexingConfiguration(indexingConfig);
indexer.setIndexFormatVersion(indexFormatVersion);
indexer.setLoadBatchingThreshold(indexingLoadBatchingThresholdProperty);
indexer.setLoadPropertyByName(indexingLoadPropertyByName);
indexer.setLoadAllProperties(loadAllProperties);
Document doc = indexer.createDoc();
mergeAggregatedNodeIndexes(node, doc, loadAllProperties, volatileIndex);
return doc;
} | java | protected Document createDocument(NodeDataIndexing node, NamespaceMappings nsMappings,
IndexFormatVersion indexFormatVersion, boolean loadAllProperties, VolatileIndex volatileIndex) throws RepositoryException
{
NodeIndexer indexer =
new NodeIndexer(node, getContext().getItemStateManager(), nsMappings, extractor);
indexer.setSupportHighlighting(supportHighlighting);
indexer.setIndexingConfiguration(indexingConfig);
indexer.setIndexFormatVersion(indexFormatVersion);
indexer.setLoadBatchingThreshold(indexingLoadBatchingThresholdProperty);
indexer.setLoadPropertyByName(indexingLoadPropertyByName);
indexer.setLoadAllProperties(loadAllProperties);
Document doc = indexer.createDoc();
mergeAggregatedNodeIndexes(node, doc, loadAllProperties, volatileIndex);
return doc;
} | [
"protected",
"Document",
"createDocument",
"(",
"NodeDataIndexing",
"node",
",",
"NamespaceMappings",
"nsMappings",
",",
"IndexFormatVersion",
"indexFormatVersion",
",",
"boolean",
"loadAllProperties",
",",
"VolatileIndex",
"volatileIndex",
")",
"throws",
"RepositoryException... | Creates a lucene <code>Document</code> for a node state using the
namespace mappings <code>nsMappings</code>.
@param node
the node state to index.
@param nsMappings
the namespace mappings of the search index.
@param indexFormatVersion
the index format version that should be used to index the
passed node state.
@param loadAllProperties
Indicates whether all the properties should be loaded using the method
{@link ItemDataConsumer#getChildPropertiesData(org.exoplatform.services.jcr.datamodel.NodeData)}
@return a lucene <code>Document</code> that contains all properties of
<code>node</code>.
@throws RepositoryException
if an error occurs while indexing the <code>node</code>. | [
"Creates",
"a",
"lucene",
"<code",
">",
"Document<",
"/",
"code",
">",
"for",
"a",
"node",
"state",
"using",
"the",
"namespace",
"mappings",
"<code",
">",
"nsMappings<",
"/",
"code",
">",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java#L1841-L1855 |
vincentk/joptimizer | src/main/java/com/joptimizer/util/ColtUtils.java | ColtUtils.add | public static final DoubleMatrix2D add(DoubleMatrix2D A, DoubleMatrix2D B){
if(A.rows()!=B.rows() || A.columns()!=B.columns()){
throw new IllegalArgumentException("wrong matrices dimensions");
}
DoubleMatrix2D ret = DoubleFactory2D.dense.make(A.rows(), A.columns());
for(int i=0; i<ret.rows(); i++){
for(int j=0; j<ret.columns(); j++){
ret.setQuick(i, j, A.getQuick(i, j) + B.getQuick(i, j));
}
}
return ret;
} | java | public static final DoubleMatrix2D add(DoubleMatrix2D A, DoubleMatrix2D B){
if(A.rows()!=B.rows() || A.columns()!=B.columns()){
throw new IllegalArgumentException("wrong matrices dimensions");
}
DoubleMatrix2D ret = DoubleFactory2D.dense.make(A.rows(), A.columns());
for(int i=0; i<ret.rows(); i++){
for(int j=0; j<ret.columns(); j++){
ret.setQuick(i, j, A.getQuick(i, j) + B.getQuick(i, j));
}
}
return ret;
} | [
"public",
"static",
"final",
"DoubleMatrix2D",
"add",
"(",
"DoubleMatrix2D",
"A",
",",
"DoubleMatrix2D",
"B",
")",
"{",
"if",
"(",
"A",
".",
"rows",
"(",
")",
"!=",
"B",
".",
"rows",
"(",
")",
"||",
"A",
".",
"columns",
"(",
")",
"!=",
"B",
".",
... | Returns C = A + B.
Useful in avoiding the need of the copy() in the colt api. | [
"Returns",
"C",
"=",
"A",
"+",
"B",
".",
"Useful",
"in",
"avoiding",
"the",
"need",
"of",
"the",
"copy",
"()",
"in",
"the",
"colt",
"api",
"."
] | train | https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/util/ColtUtils.java#L313-L325 |
phax/ph-css | ph-css/src/main/java/com/helger/css/utils/CSSColorHelper.java | CSSColorHelper.getRGBAColorValue | @Nonnull
@Nonempty
public static String getRGBAColorValue (final int nRed, final int nGreen, final int nBlue, final float fOpacity)
{
return new StringBuilder (24).append (CCSSValue.PREFIX_RGBA_OPEN)
.append (getRGBValue (nRed))
.append (',')
.append (getRGBValue (nGreen))
.append (',')
.append (getRGBValue (nBlue))
.append (',')
.append (getOpacityToUse (fOpacity))
.append (CCSSValue.SUFFIX_RGBA_CLOSE)
.toString ();
} | java | @Nonnull
@Nonempty
public static String getRGBAColorValue (final int nRed, final int nGreen, final int nBlue, final float fOpacity)
{
return new StringBuilder (24).append (CCSSValue.PREFIX_RGBA_OPEN)
.append (getRGBValue (nRed))
.append (',')
.append (getRGBValue (nGreen))
.append (',')
.append (getRGBValue (nBlue))
.append (',')
.append (getOpacityToUse (fOpacity))
.append (CCSSValue.SUFFIX_RGBA_CLOSE)
.toString ();
} | [
"@",
"Nonnull",
"@",
"Nonempty",
"public",
"static",
"String",
"getRGBAColorValue",
"(",
"final",
"int",
"nRed",
",",
"final",
"int",
"nGreen",
",",
"final",
"int",
"nBlue",
",",
"final",
"float",
"fOpacity",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
... | Get the passed values as CSS RGBA color value
@param nRed
Red - is scaled to 0-255
@param nGreen
Green - is scaled to 0-255
@param nBlue
Blue - is scaled to 0-255
@param fOpacity
Opacity to use - is scaled to 0-1.
@return The CSS string to use | [
"Get",
"the",
"passed",
"values",
"as",
"CSS",
"RGBA",
"color",
"value"
] | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/utils/CSSColorHelper.java#L392-L406 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java | Matrix.setMatrix | public void setMatrix(int i0, int i1, int[] c, Matrix X)
{
try
{
for (int i = i0; i <= i1; i++)
{
for (int j = 0; j < c.length; j++)
{
A[i][c[j]] = X.get(i - i0, j);
}
}
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new ArrayIndexOutOfBoundsException("Submatrix indices");
}
} | java | public void setMatrix(int i0, int i1, int[] c, Matrix X)
{
try
{
for (int i = i0; i <= i1; i++)
{
for (int j = 0; j < c.length; j++)
{
A[i][c[j]] = X.get(i - i0, j);
}
}
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new ArrayIndexOutOfBoundsException("Submatrix indices");
}
} | [
"public",
"void",
"setMatrix",
"(",
"int",
"i0",
",",
"int",
"i1",
",",
"int",
"[",
"]",
"c",
",",
"Matrix",
"X",
")",
"{",
"try",
"{",
"for",
"(",
"int",
"i",
"=",
"i0",
";",
"i",
"<=",
"i1",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
... | Set a submatrix.
@param i0 Initial row index
@param i1 Final row index
@param c Array of column indices.
@param X A(i0:i1,c(:))
@throws ArrayIndexOutOfBoundsException Submatrix indices | [
"Set",
"a",
"submatrix",
"."
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/nnparser/Matrix.java#L583-L599 |
haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java | PICTUtil.readPascalString | public static String readPascalString(final DataInput pStream) throws IOException {
// Get as many bytes as indicated by byte count
int length = pStream.readUnsignedByte();
byte[] bytes = new byte[length];
pStream.readFully(bytes, 0, length);
return new String(bytes, ENCODING);
} | java | public static String readPascalString(final DataInput pStream) throws IOException {
// Get as many bytes as indicated by byte count
int length = pStream.readUnsignedByte();
byte[] bytes = new byte[length];
pStream.readFully(bytes, 0, length);
return new String(bytes, ENCODING);
} | [
"public",
"static",
"String",
"readPascalString",
"(",
"final",
"DataInput",
"pStream",
")",
"throws",
"IOException",
"{",
"// Get as many bytes as indicated by byte count",
"int",
"length",
"=",
"pStream",
".",
"readUnsignedByte",
"(",
")",
";",
"byte",
"[",
"]",
"... | Reads a Pascal String from the given stream.
The input stream must be positioned at the length byte of the text,
which can thus be a maximum of 255 characters long.
@param pStream the input stream
@return the text read
@throws IOException if an I/O exception occurs during reading | [
"Reads",
"a",
"Pascal",
"String",
"from",
"the",
"given",
"stream",
".",
"The",
"input",
"stream",
"must",
"be",
"positioned",
"at",
"the",
"length",
"byte",
"of",
"the",
"text",
"which",
"can",
"thus",
"be",
"a",
"maximum",
"of",
"255",
"characters",
"l... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java#L126-L134 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_tcp_route_routeId_DELETE | public void serviceName_tcp_route_routeId_DELETE(String serviceName, Long routeId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}";
StringBuilder sb = path(qPath, serviceName, routeId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void serviceName_tcp_route_routeId_DELETE(String serviceName, Long routeId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}";
StringBuilder sb = path(qPath, serviceName, routeId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"serviceName_tcp_route_routeId_DELETE",
"(",
"String",
"serviceName",
",",
"Long",
"routeId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/tcp/route/{routeId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(... | Delete this TCP route
REST: DELETE /ipLoadbalancing/{serviceName}/tcp/route/{routeId}
@param serviceName [required] The internal name of your IP load balancing
@param routeId [required] Id of your route | [
"Delete",
"this",
"TCP",
"route"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1334-L1338 |
structr/structr | structr-ui/src/main/java/org/structr/web/common/FileHelper.java | FileHelper.createFileBase64 | public static <T extends File> T createFileBase64(final SecurityContext securityContext, final String rawData, final Class<T> t) throws FrameworkException, IOException {
Base64URIData uriData = new Base64URIData(rawData);
return createFile(securityContext, uriData.getBinaryData(), uriData.getContentType(), t);
} | java | public static <T extends File> T createFileBase64(final SecurityContext securityContext, final String rawData, final Class<T> t) throws FrameworkException, IOException {
Base64URIData uriData = new Base64URIData(rawData);
return createFile(securityContext, uriData.getBinaryData(), uriData.getContentType(), t);
} | [
"public",
"static",
"<",
"T",
"extends",
"File",
">",
"T",
"createFileBase64",
"(",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"String",
"rawData",
",",
"final",
"Class",
"<",
"T",
">",
"t",
")",
"throws",
"FrameworkException",
",",
"IOExcept... | Create a new image node from image data encoded in base64 format.
If the given string is an uuid of an existing file, transform it into
the target class.
@param <T>
@param securityContext
@param rawData
@param t defaults to File.class if null
@return file
@throws FrameworkException
@throws IOException | [
"Create",
"a",
"new",
"image",
"node",
"from",
"image",
"data",
"encoded",
"in",
"base64",
"format",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L110-L116 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/XmlHttpResponse.java | XmlHttpResponse.checkXPaths | public XPathCheckResult checkXPaths(Map<String, Object> values, Map<String, String> expressionsToCheck) {
XPathCheckResult result;
String content = getResponse();
if (content == null) {
result = new XPathCheckResult();
result.setMismatchDetail("NOK: no response available.");
} else {
validResponse();
result = checkRawXPaths(content, expressionsToCheck, values);
}
return result;
} | java | public XPathCheckResult checkXPaths(Map<String, Object> values, Map<String, String> expressionsToCheck) {
XPathCheckResult result;
String content = getResponse();
if (content == null) {
result = new XPathCheckResult();
result.setMismatchDetail("NOK: no response available.");
} else {
validResponse();
result = checkRawXPaths(content, expressionsToCheck, values);
}
return result;
} | [
"public",
"XPathCheckResult",
"checkXPaths",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
",",
"Map",
"<",
"String",
",",
"String",
">",
"expressionsToCheck",
")",
"{",
"XPathCheckResult",
"result",
";",
"String",
"content",
"=",
"getResponse",
"("... | Checks whether input values are present at correct locations in the response.
@param values keyName -> value, input parameters supplied to get request.
@param expressionsToCheck xpath -> keyName, each xpath in this map is expected
to evaluate to the value present in values for that key (i.e. values[keyName])
@return OK if all xpath expressions evaluated to the correct value. A description
of the mismatches otherwise. | [
"Checks",
"whether",
"input",
"values",
"are",
"present",
"at",
"correct",
"locations",
"in",
"the",
"response",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/XmlHttpResponse.java#L143-L155 |
yidongnan/grpc-spring-boot-starter | grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/serverfactory/AbstractGrpcServerFactory.java | AbstractGrpcServerFactory.toCheckedFile | protected File toCheckedFile(final String context, final String path) {
if (path == null || path.trim().isEmpty()) {
throw new IllegalArgumentException(context + " path cannot be null or blank");
}
final File file = new File(path);
if (!file.isFile()) {
String message =
context + " file does not exist or path does not refer to a file: '" + file.getPath() + "'";
if (!file.isAbsolute()) {
message += " (" + file.getAbsolutePath() + ")";
}
throw new IllegalArgumentException(message);
}
return file;
} | java | protected File toCheckedFile(final String context, final String path) {
if (path == null || path.trim().isEmpty()) {
throw new IllegalArgumentException(context + " path cannot be null or blank");
}
final File file = new File(path);
if (!file.isFile()) {
String message =
context + " file does not exist or path does not refer to a file: '" + file.getPath() + "'";
if (!file.isAbsolute()) {
message += " (" + file.getAbsolutePath() + ")";
}
throw new IllegalArgumentException(message);
}
return file;
} | [
"protected",
"File",
"toCheckedFile",
"(",
"final",
"String",
"context",
",",
"final",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"==",
"null",
"||",
"path",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumen... | Converts the given path to a file. This method checks that the file exists and refers to a file.
@param context The context for what the file is used. This value will be used in case of exceptions.
@param path The path of the file to use.
@return The file instance created with the given path. | [
"Converts",
"the",
"given",
"path",
"to",
"a",
"file",
".",
"This",
"method",
"checks",
"that",
"the",
"file",
"exists",
"and",
"refers",
"to",
"a",
"file",
"."
] | train | https://github.com/yidongnan/grpc-spring-boot-starter/blob/07f8853cfafc9707584f2371aff012e590217b85/grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/serverfactory/AbstractGrpcServerFactory.java#L151-L165 |
jenkinsci/java-client-api | jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildWithDetails.java | BuildWithDetails.streamConsoleOutput | public void streamConsoleOutput(final BuildConsoleStreamListener listener, final int poolingInterval, final int poolingTimeout, boolean crumbFlag) throws InterruptedException, IOException {
// Calculate start and timeout
final long startTime = System.currentTimeMillis();
final long timeoutTime = startTime + (poolingTimeout * 1000);
int bufferOffset = 0;
while (true) {
Thread.sleep(poolingInterval * 1000);
ConsoleLog consoleLog = null;
consoleLog = getConsoleOutputText(bufferOffset, crumbFlag);
String logString = consoleLog.getConsoleLog();
if (logString != null && !logString.isEmpty()) {
listener.onData(logString);
}
if (consoleLog.getHasMoreData()) {
bufferOffset = consoleLog.getCurrentBufferSize();
} else {
listener.finished();
break;
}
long currentTime = System.currentTimeMillis();
if (currentTime > timeoutTime) {
LOGGER.warn("Pooling for build {0} for {2} timeout! Check if job stuck in jenkins",
BuildWithDetails.this.getDisplayName(), BuildWithDetails.this.getNumber());
break;
}
}
} | java | public void streamConsoleOutput(final BuildConsoleStreamListener listener, final int poolingInterval, final int poolingTimeout, boolean crumbFlag) throws InterruptedException, IOException {
// Calculate start and timeout
final long startTime = System.currentTimeMillis();
final long timeoutTime = startTime + (poolingTimeout * 1000);
int bufferOffset = 0;
while (true) {
Thread.sleep(poolingInterval * 1000);
ConsoleLog consoleLog = null;
consoleLog = getConsoleOutputText(bufferOffset, crumbFlag);
String logString = consoleLog.getConsoleLog();
if (logString != null && !logString.isEmpty()) {
listener.onData(logString);
}
if (consoleLog.getHasMoreData()) {
bufferOffset = consoleLog.getCurrentBufferSize();
} else {
listener.finished();
break;
}
long currentTime = System.currentTimeMillis();
if (currentTime > timeoutTime) {
LOGGER.warn("Pooling for build {0} for {2} timeout! Check if job stuck in jenkins",
BuildWithDetails.this.getDisplayName(), BuildWithDetails.this.getNumber());
break;
}
}
} | [
"public",
"void",
"streamConsoleOutput",
"(",
"final",
"BuildConsoleStreamListener",
"listener",
",",
"final",
"int",
"poolingInterval",
",",
"final",
"int",
"poolingTimeout",
",",
"boolean",
"crumbFlag",
")",
"throws",
"InterruptedException",
",",
"IOException",
"{",
... | Stream build console output log as text using BuildConsoleStreamListener
Method can be used to asynchronously obtain logs for running build.
@param listener interface used to asynchronously obtain logs
@param poolingInterval interval (seconds) used to pool jenkins for logs
@param poolingTimeout pooling timeout (seconds) used to break pooling in case build stuck
@throws InterruptedException in case of an error.
@throws IOException in case of an error. | [
"Stream",
"build",
"console",
"output",
"log",
"as",
"text",
"using",
"BuildConsoleStreamListener",
"Method",
"can",
"be",
"used",
"to",
"asynchronously",
"obtain",
"logs",
"for",
"running",
"build",
"."
] | train | https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/model/BuildWithDetails.java#L395-L424 |
alkacon/opencms-core | src-modules/org/opencms/workplace/CmsWidgetDialogParameter.java | CmsWidgetDialogParameter.createId | public static String createId(String name, int index) {
StringBuffer result = new StringBuffer();
result.append(name);
result.append('.');
result.append(index);
return result.toString();
} | java | public static String createId(String name, int index) {
StringBuffer result = new StringBuffer();
result.append(name);
result.append('.');
result.append(index);
return result.toString();
} | [
"public",
"static",
"String",
"createId",
"(",
"String",
"name",
",",
"int",
"index",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"result",
".",
"append",
"(",
"name",
")",
";",
"result",
".",
"append",
"(",
"'",
"'",... | Returns a from id representation for the given widget name and id.<p>
@param name the widget parameter name
@param index the widget parameter index
@return a from id representation for the given widget name and id | [
"Returns",
"a",
"from",
"id",
"representation",
"for",
"the",
"given",
"widget",
"name",
"and",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsWidgetDialogParameter.java#L393-L401 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java | UnicodeSet.containsAll | public boolean containsAll(String s) {
int cp;
for (int i = 0; i < s.length(); i += UTF16.getCharCount(cp)) {
cp = UTF16.charAt(s, i);
if (!contains(cp)) {
if (strings.size() == 0) {
return false;
}
return containsAll(s, 0);
}
}
return true;
} | java | public boolean containsAll(String s) {
int cp;
for (int i = 0; i < s.length(); i += UTF16.getCharCount(cp)) {
cp = UTF16.charAt(s, i);
if (!contains(cp)) {
if (strings.size() == 0) {
return false;
}
return containsAll(s, 0);
}
}
return true;
} | [
"public",
"boolean",
"containsAll",
"(",
"String",
"s",
")",
"{",
"int",
"cp",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"+=",
"UTF16",
".",
"getCharCount",
"(",
"cp",
")",
")",
"{",
"cp",
"... | Returns true if there is a partition of the string such that this set contains each of the partitioned strings.
For example, for the Unicode set [a{bc}{cd}]<br>
containsAll is true for each of: "a", "bc", ""cdbca"<br>
containsAll is false for each of: "acb", "bcda", "bcx"<br>
@param s string containing characters to be checked for containment
@return true if the test condition is met | [
"Returns",
"true",
"if",
"there",
"is",
"a",
"partition",
"of",
"the",
"string",
"such",
"that",
"this",
"set",
"contains",
"each",
"of",
"the",
"partitioned",
"strings",
".",
"For",
"example",
"for",
"the",
"Unicode",
"set",
"[",
"a",
"{",
"bc",
"}",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L1928-L1940 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsInner.java | ApplicationsInner.createAsync | public Observable<ApplicationInner> createAsync(String resourceGroupName, String clusterName, String applicationName, ApplicationInner parameters) {
return createWithServiceResponseAsync(resourceGroupName, clusterName, applicationName, parameters).map(new Func1<ServiceResponse<ApplicationInner>, ApplicationInner>() {
@Override
public ApplicationInner call(ServiceResponse<ApplicationInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationInner> createAsync(String resourceGroupName, String clusterName, String applicationName, ApplicationInner parameters) {
return createWithServiceResponseAsync(resourceGroupName, clusterName, applicationName, parameters).map(new Func1<ServiceResponse<ApplicationInner>, ApplicationInner>() {
@Override
public ApplicationInner call(ServiceResponse<ApplicationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationInner",
">",
"createAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"applicationName",
",",
"ApplicationInner",
"parameters",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"re... | Creates applications for the HDInsight cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param applicationName The constant value for the application name.
@param parameters The application create request.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"applications",
"for",
"the",
"HDInsight",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsInner.java#L351-L358 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/CassandraClientBase.java | CassandraClientBase.persistJoinTableByCql | protected void persistJoinTableByCql(JoinTableData joinTableData, Cassandra.Client conn) {
String joinTableName = joinTableData.getJoinTableName();
String invJoinColumnName = joinTableData.getInverseJoinColumnName();
Map<Object, Set<Object>> joinTableRecords = joinTableData.getJoinTableRecords();
EntityMetadata entityMetadata =
KunderaMetadataManager.getEntityMetadata(kunderaMetadata, joinTableData.getEntityClass());
// need to bring in an insert query for this
// add columns & execute query
CQLTranslator translator = new CQLTranslator();
String batch_Query = CQLTranslator.BATCH_QUERY;
String insert_Query = translator.INSERT_QUERY;
StringBuilder builder = new StringBuilder();
builder.append(CQLTranslator.DEFAULT_KEY_NAME);
builder.append(CQLTranslator.COMMA_STR);
builder.append(translator.ensureCase(new StringBuilder(), joinTableData.getJoinColumnName(), false));
builder.append(CQLTranslator.COMMA_STR);
builder.append(translator.ensureCase(new StringBuilder(), joinTableData.getInverseJoinColumnName(), false));
insert_Query = StringUtils.replace(insert_Query, CQLTranslator.COLUMN_FAMILY,
translator.ensureCase(new StringBuilder(), joinTableName, false).toString());
insert_Query = StringUtils.replace(insert_Query, CQLTranslator.COLUMNS, builder.toString());
StringBuilder columnValueBuilder = new StringBuilder();
StringBuilder statements = new StringBuilder();
// insert query for each row key
for (Object key : joinTableRecords.keySet()) {
PropertyAccessor accessor =
PropertyAccessorFactory.getPropertyAccessor((Field) entityMetadata.getIdAttribute().getJavaMember());
Set<Object> values = joinTableRecords.get(key); // join column value
for (Object value : values) {
if (value != null) {
String insertQuery = insert_Query;
columnValueBuilder.append(CQLTranslator.QUOTE_STR);
columnValueBuilder.append(
PropertyAccessorHelper.getString(key) + "\001" + PropertyAccessorHelper.getString(value));
columnValueBuilder.append(CQLTranslator.QUOTE_STR);
columnValueBuilder.append(CQLTranslator.COMMA_STR);
translator.appendValue(columnValueBuilder, key.getClass(), key, true, false);
columnValueBuilder.append(CQLTranslator.COMMA_STR);
translator.appendValue(columnValueBuilder, value.getClass(), value, true, false);
insertQuery =
StringUtils.replace(insertQuery, CQLTranslator.COLUMN_VALUES, columnValueBuilder.toString());
statements.append(insertQuery);
statements.append(" ");
}
}
}
if (!StringUtils.isBlank(statements.toString())) {
batch_Query = StringUtils.replace(batch_Query, CQLTranslator.STATEMENT, statements.toString());
StringBuilder batchBuilder = new StringBuilder();
batchBuilder.append(batch_Query);
batchBuilder.append(CQLTranslator.APPLY_BATCH);
execute(batchBuilder.toString(), conn);
}
} | java | protected void persistJoinTableByCql(JoinTableData joinTableData, Cassandra.Client conn) {
String joinTableName = joinTableData.getJoinTableName();
String invJoinColumnName = joinTableData.getInverseJoinColumnName();
Map<Object, Set<Object>> joinTableRecords = joinTableData.getJoinTableRecords();
EntityMetadata entityMetadata =
KunderaMetadataManager.getEntityMetadata(kunderaMetadata, joinTableData.getEntityClass());
// need to bring in an insert query for this
// add columns & execute query
CQLTranslator translator = new CQLTranslator();
String batch_Query = CQLTranslator.BATCH_QUERY;
String insert_Query = translator.INSERT_QUERY;
StringBuilder builder = new StringBuilder();
builder.append(CQLTranslator.DEFAULT_KEY_NAME);
builder.append(CQLTranslator.COMMA_STR);
builder.append(translator.ensureCase(new StringBuilder(), joinTableData.getJoinColumnName(), false));
builder.append(CQLTranslator.COMMA_STR);
builder.append(translator.ensureCase(new StringBuilder(), joinTableData.getInverseJoinColumnName(), false));
insert_Query = StringUtils.replace(insert_Query, CQLTranslator.COLUMN_FAMILY,
translator.ensureCase(new StringBuilder(), joinTableName, false).toString());
insert_Query = StringUtils.replace(insert_Query, CQLTranslator.COLUMNS, builder.toString());
StringBuilder columnValueBuilder = new StringBuilder();
StringBuilder statements = new StringBuilder();
// insert query for each row key
for (Object key : joinTableRecords.keySet()) {
PropertyAccessor accessor =
PropertyAccessorFactory.getPropertyAccessor((Field) entityMetadata.getIdAttribute().getJavaMember());
Set<Object> values = joinTableRecords.get(key); // join column value
for (Object value : values) {
if (value != null) {
String insertQuery = insert_Query;
columnValueBuilder.append(CQLTranslator.QUOTE_STR);
columnValueBuilder.append(
PropertyAccessorHelper.getString(key) + "\001" + PropertyAccessorHelper.getString(value));
columnValueBuilder.append(CQLTranslator.QUOTE_STR);
columnValueBuilder.append(CQLTranslator.COMMA_STR);
translator.appendValue(columnValueBuilder, key.getClass(), key, true, false);
columnValueBuilder.append(CQLTranslator.COMMA_STR);
translator.appendValue(columnValueBuilder, value.getClass(), value, true, false);
insertQuery =
StringUtils.replace(insertQuery, CQLTranslator.COLUMN_VALUES, columnValueBuilder.toString());
statements.append(insertQuery);
statements.append(" ");
}
}
}
if (!StringUtils.isBlank(statements.toString())) {
batch_Query = StringUtils.replace(batch_Query, CQLTranslator.STATEMENT, statements.toString());
StringBuilder batchBuilder = new StringBuilder();
batchBuilder.append(batch_Query);
batchBuilder.append(CQLTranslator.APPLY_BATCH);
execute(batchBuilder.toString(), conn);
}
} | [
"protected",
"void",
"persistJoinTableByCql",
"(",
"JoinTableData",
"joinTableData",
",",
"Cassandra",
".",
"Client",
"conn",
")",
"{",
"String",
"joinTableName",
"=",
"joinTableData",
".",
"getJoinTableName",
"(",
")",
";",
"String",
"invJoinColumnName",
"=",
"join... | Persist join table by cql.
@param joinTableData
the join table data
@param conn
the conn | [
"Persist",
"join",
"table",
"by",
"cql",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/CassandraClientBase.java#L2357-L2425 |
netty/netty | resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java | DnsNameResolver.resolveAll | public final Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals) {
return resolveAll(inetHost, additionals, executor().<List<InetAddress>>newPromise());
} | java | public final Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals) {
return resolveAll(inetHost, additionals, executor().<List<InetAddress>>newPromise());
} | [
"public",
"final",
"Future",
"<",
"List",
"<",
"InetAddress",
">",
">",
"resolveAll",
"(",
"String",
"inetHost",
",",
"Iterable",
"<",
"DnsRecord",
">",
"additionals",
")",
"{",
"return",
"resolveAll",
"(",
"inetHost",
",",
"additionals",
",",
"executor",
"(... | Resolves the specified host name and port into a list of address.
@param inetHost the name to resolve
@param additionals additional records ({@code OPT})
@return the list of the address as the result of the resolution | [
"Resolves",
"the",
"specified",
"host",
"name",
"and",
"port",
"into",
"a",
"list",
"of",
"address",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java#L670-L672 |
unic/neba | core/src/main/java/io/neba/core/resourcemodels/metadata/ResourceModelMetaDataRegistrar.java | ResourceModelMetaDataRegistrar.register | public synchronized void register(OsgiModelSource<?> modelSource) {
if (modelSource == null) {
throw new IllegalArgumentException("method parameter modelSource must not be null");
}
Class<?> modelType = modelSource.getModelType();
ResourceModelMetaData modelMetaData = new ResourceModelMetaData(modelType);
ResourceModelMetadataHolder holder = new ResourceModelMetadataHolder(modelSource, modelMetaData);
Map<Class<?>, ResourceModelMetadataHolder> newCache = copyCache();
newCache.put(getUserClass(modelType), holder);
this.cache = newCache;
} | java | public synchronized void register(OsgiModelSource<?> modelSource) {
if (modelSource == null) {
throw new IllegalArgumentException("method parameter modelSource must not be null");
}
Class<?> modelType = modelSource.getModelType();
ResourceModelMetaData modelMetaData = new ResourceModelMetaData(modelType);
ResourceModelMetadataHolder holder = new ResourceModelMetadataHolder(modelSource, modelMetaData);
Map<Class<?>, ResourceModelMetadataHolder> newCache = copyCache();
newCache.put(getUserClass(modelType), holder);
this.cache = newCache;
} | [
"public",
"synchronized",
"void",
"register",
"(",
"OsgiModelSource",
"<",
"?",
">",
"modelSource",
")",
"{",
"if",
"(",
"modelSource",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"method parameter modelSource must not be null\"",
")",
... | Creates a new {@link ResourceModelMetaData} for the model represented
by the provided model source.
@param modelSource must not be <code>null</code>. | [
"Creates",
"a",
"new",
"{",
"@link",
"ResourceModelMetaData",
"}",
"for",
"the",
"model",
"represented",
"by",
"the",
"provided",
"model",
"source",
"."
] | train | https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/resourcemodels/metadata/ResourceModelMetaDataRegistrar.java#L99-L112 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java | IotHubResourcesInner.importDevices | public JobResponseInner importDevices(String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters) {
return importDevicesWithServiceResponseAsync(resourceGroupName, resourceName, importDevicesParameters).toBlocking().single().body();
} | java | public JobResponseInner importDevices(String resourceGroupName, String resourceName, ImportDevicesRequest importDevicesParameters) {
return importDevicesWithServiceResponseAsync(resourceGroupName, resourceName, importDevicesParameters).toBlocking().single().body();
} | [
"public",
"JobResponseInner",
"importDevices",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"ImportDevicesRequest",
"importDevicesParameters",
")",
"{",
"return",
"importDevicesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
... | Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
Import, update, or delete device identities in the IoT hub identity registry from a blob. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param importDevicesParameters The parameters that specify the import devices operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorDetailsException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the JobResponseInner object if successful. | [
"Import",
"update",
"or",
"delete",
"device",
"identities",
"in",
"the",
"IoT",
"hub",
"identity",
"registry",
"from",
"a",
"blob",
".",
"For",
"more",
"information",
"see",
":",
"https",
":",
"//",
"docs",
".",
"microsoft",
".",
"com",
"/",
"azure",
"/"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L3165-L3167 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTransitionExtractor.java | MapTransitionExtractor.getTransitionType | private static TransitionType getTransitionType(String groupIn, Collection<String> neighborGroups)
{
final boolean[] bits = new boolean[TransitionType.BITS];
int i = 0;
for (final String neighborGroup : neighborGroups)
{
bits[i] = !groupIn.equals(neighborGroup);
i++;
}
return TransitionType.from(bits);
} | java | private static TransitionType getTransitionType(String groupIn, Collection<String> neighborGroups)
{
final boolean[] bits = new boolean[TransitionType.BITS];
int i = 0;
for (final String neighborGroup : neighborGroups)
{
bits[i] = !groupIn.equals(neighborGroup);
i++;
}
return TransitionType.from(bits);
} | [
"private",
"static",
"TransitionType",
"getTransitionType",
"(",
"String",
"groupIn",
",",
"Collection",
"<",
"String",
">",
"neighborGroups",
")",
"{",
"final",
"boolean",
"[",
"]",
"bits",
"=",
"new",
"boolean",
"[",
"TransitionType",
".",
"BITS",
"]",
";",
... | Get the transition type from one group to another.
@param groupIn The group in.
@param neighborGroups The neighbor groups.
@return The tile transition. | [
"Get",
"the",
"transition",
"type",
"from",
"one",
"group",
"to",
"another",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTransitionExtractor.java#L73-L83 |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java | PlaybackService.unregisterListener | public static void unregisterListener(Context context, PlaybackListener listener) {
LocalBroadcastManager.getInstance(context.getApplicationContext())
.unregisterReceiver(listener);
} | java | public static void unregisterListener(Context context, PlaybackListener listener) {
LocalBroadcastManager.getInstance(context.getApplicationContext())
.unregisterReceiver(listener);
} | [
"public",
"static",
"void",
"unregisterListener",
"(",
"Context",
"context",
",",
"PlaybackListener",
"listener",
")",
"{",
"LocalBroadcastManager",
".",
"getInstance",
"(",
"context",
".",
"getApplicationContext",
"(",
")",
")",
".",
"unregisterReceiver",
"(",
"lis... | Unregister a registered listener.
@param context context used to unregister the listener.
@param listener listener to unregister. | [
"Unregister",
"a",
"registered",
"listener",
"."
] | train | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/PlaybackService.java#L388-L391 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.email_exchange_organizationName_service_exchangeService_account_duration_POST | public OvhOrder email_exchange_organizationName_service_exchangeService_account_duration_POST(String organizationName, String exchangeService, String duration, OvhOvhLicenceEnum licence, Long number, OvhAccountQuotaEnum storageQuota) throws IOException {
String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/account/{duration}";
StringBuilder sb = path(qPath, organizationName, exchangeService, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "licence", licence);
addBody(o, "number", number);
addBody(o, "storageQuota", storageQuota);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder email_exchange_organizationName_service_exchangeService_account_duration_POST(String organizationName, String exchangeService, String duration, OvhOvhLicenceEnum licence, Long number, OvhAccountQuotaEnum storageQuota) throws IOException {
String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/account/{duration}";
StringBuilder sb = path(qPath, organizationName, exchangeService, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "licence", licence);
addBody(o, "number", number);
addBody(o, "storageQuota", storageQuota);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"email_exchange_organizationName_service_exchangeService_account_duration_POST",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"duration",
",",
"OvhOvhLicenceEnum",
"licence",
",",
"Long",
"number",
",",
"OvhAccountQuo... | Create order
REST: POST /order/email/exchange/{organizationName}/service/{exchangeService}/account/{duration}
@param storageQuota [required] The storage quota for the account(s) in GB (default = 50)
@param number [required] Number of Accounts to order
@param licence [required] Licence type for the account
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@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#L3945-L3954 |
phax/ph-commons | ph-cli/src/main/java/com/helger/cli/HelpFormatter.java | HelpFormatter.printHelp | public void printHelp (@Nonnull final PrintWriter aPW,
final int nWidth,
@Nonnull @Nonempty final String sCmdLineSyntax,
@Nullable final String sHeader,
@Nonnull final Options aOptions,
final int nLeftPad,
final int nDescPad,
@Nullable final String sFooter,
final boolean bAutoUsage)
{
ValueEnforcer.notEmpty (sCmdLineSyntax, "sCmdLineSyntax");
if (bAutoUsage)
printUsage (aPW, nWidth, sCmdLineSyntax, aOptions);
else
printUsage (aPW, nWidth, sCmdLineSyntax);
if (sHeader != null && sHeader.trim ().length () > 0)
printWrapped (aPW, nWidth, sHeader);
printOptions (aPW, nWidth, aOptions, nLeftPad, nDescPad);
if (sFooter != null && sFooter.trim ().length () > 0)
printWrapped (aPW, nWidth, sFooter);
} | java | public void printHelp (@Nonnull final PrintWriter aPW,
final int nWidth,
@Nonnull @Nonempty final String sCmdLineSyntax,
@Nullable final String sHeader,
@Nonnull final Options aOptions,
final int nLeftPad,
final int nDescPad,
@Nullable final String sFooter,
final boolean bAutoUsage)
{
ValueEnforcer.notEmpty (sCmdLineSyntax, "sCmdLineSyntax");
if (bAutoUsage)
printUsage (aPW, nWidth, sCmdLineSyntax, aOptions);
else
printUsage (aPW, nWidth, sCmdLineSyntax);
if (sHeader != null && sHeader.trim ().length () > 0)
printWrapped (aPW, nWidth, sHeader);
printOptions (aPW, nWidth, aOptions, nLeftPad, nDescPad);
if (sFooter != null && sFooter.trim ().length () > 0)
printWrapped (aPW, nWidth, sFooter);
} | [
"public",
"void",
"printHelp",
"(",
"@",
"Nonnull",
"final",
"PrintWriter",
"aPW",
",",
"final",
"int",
"nWidth",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sCmdLineSyntax",
",",
"@",
"Nullable",
"final",
"String",
"sHeader",
",",
"@",
"Nonnul... | Print the help for <code>options</code> with the specified command line
syntax.
@param aPW
the writer to which the help will be written
@param nWidth
the number of characters to be displayed on each line
@param sCmdLineSyntax
the syntax for this application
@param sHeader
the banner to display at the beginning of the help
@param aOptions
the Options instance
@param nLeftPad
the number of characters of padding to be prefixed to each line
@param nDescPad
the number of characters of padding to be prefixed to each
description line
@param sFooter
the banner to display at the end of the help
@param bAutoUsage
whether to print an automatically generated usage statement
@throws IllegalStateException
if there is no room to print a line | [
"Print",
"the",
"help",
"for",
"<code",
">",
"options<",
"/",
"code",
">",
"with",
"the",
"specified",
"command",
"line",
"syntax",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-cli/src/main/java/com/helger/cli/HelpFormatter.java#L588-L612 |
vladmihalcea/flexy-pool | flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java | ReflectionUtils.handleException | private static ReflectionException handleException(String memberName, IllegalAccessException e) {
LOGGER.error("Couldn't access member " + memberName, e);
return new ReflectionException(e);
} | java | private static ReflectionException handleException(String memberName, IllegalAccessException e) {
LOGGER.error("Couldn't access member " + memberName, e);
return new ReflectionException(e);
} | [
"private",
"static",
"ReflectionException",
"handleException",
"(",
"String",
"memberName",
",",
"IllegalAccessException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Couldn't access member \"",
"+",
"memberName",
",",
"e",
")",
";",
"return",
"new",
"ReflectionE... | Handle {@link IllegalAccessException} by logging it and rethrown it as a {@link ReflectionException}
@param memberName member name
@param e exception
@return wrapped exception | [
"Handle",
"{",
"@link",
"IllegalAccessException",
"}",
"by",
"logging",
"it",
"and",
"rethrown",
"it",
"as",
"a",
"{",
"@link",
"ReflectionException",
"}"
] | train | https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java#L184-L187 |
tzaeschke/zoodb | src/org/zoodb/internal/util/FormattedStringBuilder.java | FormattedStringBuilder.fillOrCutBuffer | public FormattedStringBuilder fillOrCutBuffer(int newLength, char c) {
if (newLength < _delegate.length()) {
_delegate = new StringBuilder(_delegate.substring(0, newLength));
return this;
}
for (int i = _delegate.length(); i < newLength; i++ ) {
_delegate.append(c);
}
return this;
} | java | public FormattedStringBuilder fillOrCutBuffer(int newLength, char c) {
if (newLength < _delegate.length()) {
_delegate = new StringBuilder(_delegate.substring(0, newLength));
return this;
}
for (int i = _delegate.length(); i < newLength; i++ ) {
_delegate.append(c);
}
return this;
} | [
"public",
"FormattedStringBuilder",
"fillOrCutBuffer",
"(",
"int",
"newLength",
",",
"char",
"c",
")",
"{",
"if",
"(",
"newLength",
"<",
"_delegate",
".",
"length",
"(",
")",
")",
"{",
"_delegate",
"=",
"new",
"StringBuilder",
"(",
"_delegate",
".",
"substri... | Attempts to append <tt>c</tt> until the buffer gets the length <tt>
newLength</tt>. If the buffer is already longer than <tt>newLength</tt>,
then the internal strings is cut to <tt>newLength</tt>.
@param newLength New length of the returned buffer.
@param c Character to append.
@return The updated instance of FormattedStringBuilder. | [
"Attempts",
"to",
"append",
"<tt",
">",
"c<",
"/",
"tt",
">",
"until",
"the",
"buffer",
"gets",
"the",
"length",
"<tt",
">",
"newLength<",
"/",
"tt",
">",
".",
"If",
"the",
"buffer",
"is",
"already",
"longer",
"than",
"<tt",
">",
"newLength<",
"/",
"... | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/util/FormattedStringBuilder.java#L247-L256 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/Shape.java | Shape.drawWithoutTransforms | @Override
protected void drawWithoutTransforms(final Context2D context, double alpha, final BoundingBox bounds)
{
final Attributes attr = getAttributes();
alpha = alpha * attr.getAlpha();
if (alpha <= 0)
{
return;
}
if (context.isSelection())
{
if (dofillBoundsForSelection(context, attr, alpha))
{
return;
}
}
else
{
setAppliedShadow(false);
}
if (prepare(context, attr, alpha))
{
final boolean fill = fill(context, attr, alpha);
stroke(context, attr, alpha, fill);
}
} | java | @Override
protected void drawWithoutTransforms(final Context2D context, double alpha, final BoundingBox bounds)
{
final Attributes attr = getAttributes();
alpha = alpha * attr.getAlpha();
if (alpha <= 0)
{
return;
}
if (context.isSelection())
{
if (dofillBoundsForSelection(context, attr, alpha))
{
return;
}
}
else
{
setAppliedShadow(false);
}
if (prepare(context, attr, alpha))
{
final boolean fill = fill(context, attr, alpha);
stroke(context, attr, alpha, fill);
}
} | [
"@",
"Override",
"protected",
"void",
"drawWithoutTransforms",
"(",
"final",
"Context2D",
"context",
",",
"double",
"alpha",
",",
"final",
"BoundingBox",
"bounds",
")",
"{",
"final",
"Attributes",
"attr",
"=",
"getAttributes",
"(",
")",
";",
"alpha",
"=",
"alp... | Used internally. Draws the node in the current Context2D
without applying the transformation-related attributes
(e.g. X, Y, ROTATION, SCALE, SHEAR, OFFSET and TRANSFORM.)
<p>
Shapes should apply the non-Transform related attributes (such a colors, strokeWidth etc.)
and draw the Shape's details (such as the the actual lines and fills.) | [
"Used",
"internally",
".",
"Draws",
"the",
"node",
"in",
"the",
"current",
"Context2D",
"without",
"applying",
"the",
"transformation",
"-",
"related",
"attributes",
"(",
"e",
".",
"g",
".",
"X",
"Y",
"ROTATION",
"SCALE",
"SHEAR",
"OFFSET",
"and",
"TRANSFORM... | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Shape.java#L232-L260 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.resetPassword | public void resetPassword(CmsRequestContext context, String username, String oldPassword, String newPassword)
throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
m_driverManager.resetPassword(
dbc,
CmsOrganizationalUnit.removeLeadingSeparator(username),
oldPassword,
newPassword);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_RESET_PASSWORD_1, username), e);
} finally {
dbc.clear();
}
} | java | public void resetPassword(CmsRequestContext context, String username, String oldPassword, String newPassword)
throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
m_driverManager.resetPassword(
dbc,
CmsOrganizationalUnit.removeLeadingSeparator(username),
oldPassword,
newPassword);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_RESET_PASSWORD_1, username), e);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"resetPassword",
"(",
"CmsRequestContext",
"context",
",",
"String",
"username",
",",
"String",
"oldPassword",
",",
"String",
"newPassword",
")",
"throws",
"CmsException",
",",
"CmsSecurityException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFact... | Resets the password for a specified user.<p>
@param context the current request context
@param username the name of the user
@param oldPassword the old password
@param newPassword the new password
@throws CmsException if the user data could not be read from the database
@throws CmsSecurityException if the specified user name and old password could not be verified | [
"Resets",
"the",
"password",
"for",
"a",
"specified",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L5751-L5766 |
google/closure-templates | java/src/com/google/template/soy/internal/i18n/BidiGlobalDir.java | BidiGlobalDir.forIsRtlCodeSnippet | public static BidiGlobalDir forIsRtlCodeSnippet(
String isRtlCodeSnippet, @Nullable String namespace, SoyBackendKind backend) {
Preconditions.checkArgument(
isRtlCodeSnippet != null && isRtlCodeSnippet.length() > 0,
"Bidi global direction source code snippet must be non-empty.");
Preconditions.checkArgument(
backend == SoyBackendKind.JS_SRC || backend == SoyBackendKind.PYTHON_SRC,
"Bidi code snippets are only used in JS and Python.");
if (backend == SoyBackendKind.JS_SRC) {
return new BidiGlobalDir(isRtlCodeSnippet + "?-1:1", namespace);
} else {
return new BidiGlobalDir("-1 if " + isRtlCodeSnippet + " else 1", namespace);
}
} | java | public static BidiGlobalDir forIsRtlCodeSnippet(
String isRtlCodeSnippet, @Nullable String namespace, SoyBackendKind backend) {
Preconditions.checkArgument(
isRtlCodeSnippet != null && isRtlCodeSnippet.length() > 0,
"Bidi global direction source code snippet must be non-empty.");
Preconditions.checkArgument(
backend == SoyBackendKind.JS_SRC || backend == SoyBackendKind.PYTHON_SRC,
"Bidi code snippets are only used in JS and Python.");
if (backend == SoyBackendKind.JS_SRC) {
return new BidiGlobalDir(isRtlCodeSnippet + "?-1:1", namespace);
} else {
return new BidiGlobalDir("-1 if " + isRtlCodeSnippet + " else 1", namespace);
}
} | [
"public",
"static",
"BidiGlobalDir",
"forIsRtlCodeSnippet",
"(",
"String",
"isRtlCodeSnippet",
",",
"@",
"Nullable",
"String",
"namespace",
",",
"SoyBackendKind",
"backend",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"isRtlCodeSnippet",
"!=",
"null",
"&&",
... | Creates a bidi global direction that can only be determined at template runtime, by evaluating
a given source code snippet that yields a boolean value where true indicates rtl.
@param isRtlCodeSnippet A code snippet that will evaluate at template runtime to a boolean
value indicating whether the bidi global direction is rtl.
@param backend The current backend target. | [
"Creates",
"a",
"bidi",
"global",
"direction",
"that",
"can",
"only",
"be",
"determined",
"at",
"template",
"runtime",
"by",
"evaluating",
"a",
"given",
"source",
"code",
"snippet",
"that",
"yields",
"a",
"boolean",
"value",
"where",
"true",
"indicates",
"rtl"... | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/internal/i18n/BidiGlobalDir.java#L112-L125 |
calimero-project/calimero-core | src/tuwien/auto/calimero/mgmt/PropertyClient.java | PropertyClient.addDefinitions | public void addDefinitions(final Collection<Property> definitions)
{
for (final Iterator<Property> i = definitions.iterator(); i.hasNext();) {
final Property p = i.next();
properties.put(new PropertyKey(p.objType, p.id), p);
}
} | java | public void addDefinitions(final Collection<Property> definitions)
{
for (final Iterator<Property> i = definitions.iterator(); i.hasNext();) {
final Property p = i.next();
properties.put(new PropertyKey(p.objType, p.id), p);
}
} | [
"public",
"void",
"addDefinitions",
"(",
"final",
"Collection",
"<",
"Property",
">",
"definitions",
")",
"{",
"for",
"(",
"final",
"Iterator",
"<",
"Property",
">",
"i",
"=",
"definitions",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
... | Adds the property definitions contained in the collection argument to the property
definitions of the property client.
<p>
Any definitions already existing in the client are not removed before adding new
ones. To remove definitions, use {@link #getDefinitions()} and remove entries
manually.<br>
An added property definition will replace an existing definition with its property
key being equal to the one of the added definition.
@param definitions collection of property definitions, containing entries of type
{@link Property} | [
"Adds",
"the",
"property",
"definitions",
"contained",
"in",
"the",
"collection",
"argument",
"to",
"the",
"property",
"definitions",
"of",
"the",
"property",
"client",
".",
"<p",
">",
"Any",
"definitions",
"already",
"existing",
"in",
"the",
"client",
"are",
... | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/PropertyClient.java#L514-L520 |
offbynull/coroutines | instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/OperandStackStateGenerators.java | OperandStackStateGenerators.computeSizes | public static StorageSizes computeSizes(Frame<BasicValue> frame, int offset, int length) {
Validate.notNull(frame);
Validate.isTrue(offset >= 0);
Validate.isTrue(length >= 0);
Validate.isTrue(offset < frame.getStackSize());
Validate.isTrue(offset + length <= frame.getStackSize());
// Count size required for each storage array
int intsSize = 0;
int longsSize = 0;
int floatsSize = 0;
int doublesSize = 0;
int objectsSize = 0;
for (int i = offset + length - 1; i >= offset; i--) {
BasicValue basicValue = frame.getStack(i);
Type type = basicValue.getType();
// If type is 'Lnull;', this means that the slot has been assigned null and that "there has been no merge yet that would 'raise'
// the type toward some class or interface type" (from ASM mailing list). We know this slot will always contain null at this
// point in the code so we can avoid saving it. When we load it back up, we can simply push a null in to that slot, thereby
// keeping the same 'Lnull;' type.
if ("Lnull;".equals(type.getDescriptor())) {
continue;
}
switch (type.getSort()) {
case Type.BOOLEAN:
case Type.BYTE:
case Type.SHORT:
case Type.CHAR:
case Type.INT:
intsSize++;
break;
case Type.FLOAT:
floatsSize++;
break;
case Type.LONG:
longsSize++;
break;
case Type.DOUBLE:
doublesSize++;
break;
case Type.ARRAY:
case Type.OBJECT:
objectsSize++;
break;
case Type.METHOD:
case Type.VOID:
default:
throw new IllegalStateException();
}
}
return new StorageSizes(intsSize, longsSize, floatsSize, doublesSize, objectsSize);
} | java | public static StorageSizes computeSizes(Frame<BasicValue> frame, int offset, int length) {
Validate.notNull(frame);
Validate.isTrue(offset >= 0);
Validate.isTrue(length >= 0);
Validate.isTrue(offset < frame.getStackSize());
Validate.isTrue(offset + length <= frame.getStackSize());
// Count size required for each storage array
int intsSize = 0;
int longsSize = 0;
int floatsSize = 0;
int doublesSize = 0;
int objectsSize = 0;
for (int i = offset + length - 1; i >= offset; i--) {
BasicValue basicValue = frame.getStack(i);
Type type = basicValue.getType();
// If type is 'Lnull;', this means that the slot has been assigned null and that "there has been no merge yet that would 'raise'
// the type toward some class or interface type" (from ASM mailing list). We know this slot will always contain null at this
// point in the code so we can avoid saving it. When we load it back up, we can simply push a null in to that slot, thereby
// keeping the same 'Lnull;' type.
if ("Lnull;".equals(type.getDescriptor())) {
continue;
}
switch (type.getSort()) {
case Type.BOOLEAN:
case Type.BYTE:
case Type.SHORT:
case Type.CHAR:
case Type.INT:
intsSize++;
break;
case Type.FLOAT:
floatsSize++;
break;
case Type.LONG:
longsSize++;
break;
case Type.DOUBLE:
doublesSize++;
break;
case Type.ARRAY:
case Type.OBJECT:
objectsSize++;
break;
case Type.METHOD:
case Type.VOID:
default:
throw new IllegalStateException();
}
}
return new StorageSizes(intsSize, longsSize, floatsSize, doublesSize, objectsSize);
} | [
"public",
"static",
"StorageSizes",
"computeSizes",
"(",
"Frame",
"<",
"BasicValue",
">",
"frame",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"Validate",
".",
"notNull",
"(",
"frame",
")",
";",
"Validate",
".",
"isTrue",
"(",
"offset",
">=",
"... | Compute sizes required for the storage arrays that will contain the operand stack at this frame.
@param frame frame to compute for
@param offset the position within the operand stack to start calculating
@param length the number of stack items to include in calculation
@return size required by each storage array
@throws NullPointerException if any argument is {@code null}
@throws IllegalArgumentException if any numeric argument is negative, or if {@code offset + length} is larger than the size of the
operand stack | [
"Compute",
"sizes",
"required",
"for",
"the",
"storage",
"arrays",
"that",
"will",
"contain",
"the",
"operand",
"stack",
"at",
"this",
"frame",
"."
] | train | https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/OperandStackStateGenerators.java#L458-L512 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/Validation.java | Validation.checkPolymerIDSConnection | private static void checkPolymerIDSConnection(ConnectionNotation not, List<String> listPolymerIDs)
throws PolymerIDsException {
/* the polymer ids have to be there */
checkExistenceOfPolymerID(not.getSourceId().getId(), listPolymerIDs);
checkExistenceOfPolymerID(not.getTargetId().getId(), listPolymerIDs);
} | java | private static void checkPolymerIDSConnection(ConnectionNotation not, List<String> listPolymerIDs)
throws PolymerIDsException {
/* the polymer ids have to be there */
checkExistenceOfPolymerID(not.getSourceId().getId(), listPolymerIDs);
checkExistenceOfPolymerID(not.getTargetId().getId(), listPolymerIDs);
} | [
"private",
"static",
"void",
"checkPolymerIDSConnection",
"(",
"ConnectionNotation",
"not",
",",
"List",
"<",
"String",
">",
"listPolymerIDs",
")",
"throws",
"PolymerIDsException",
"{",
"/* the polymer ids have to be there */",
"checkExistenceOfPolymerID",
"(",
"not",
".",
... | method to check for one connection if the two polymer ids exist
@param not
ConnectionNotation
@param listPolymerIDs
List of polymer ids
@throws PolymerIDsException
if the polymer ids do not exist | [
"method",
"to",
"check",
"for",
"one",
"connection",
"if",
"the",
"two",
"polymer",
"ids",
"exist"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/Validation.java#L521-L526 |
stevespringett/Alpine | alpine/src/main/java/alpine/auth/JsonWebToken.java | JsonWebToken.createToken | public String createToken(final Principal principal, final List<Permission> permissions) {
final Date today = new Date();
final JwtBuilder jwtBuilder = Jwts.builder();
jwtBuilder.setSubject(principal.getName());
jwtBuilder.setIssuer(ISSUER);
jwtBuilder.setIssuedAt(today);
jwtBuilder.setExpiration(addDays(today, 7));
if (permissions != null) {
jwtBuilder.claim("permissions", permissions.stream()
.map(Permission::getName)
.collect(Collectors.joining(","))
);
}
return jwtBuilder.signWith(SignatureAlgorithm.HS256, key).compact();
} | java | public String createToken(final Principal principal, final List<Permission> permissions) {
final Date today = new Date();
final JwtBuilder jwtBuilder = Jwts.builder();
jwtBuilder.setSubject(principal.getName());
jwtBuilder.setIssuer(ISSUER);
jwtBuilder.setIssuedAt(today);
jwtBuilder.setExpiration(addDays(today, 7));
if (permissions != null) {
jwtBuilder.claim("permissions", permissions.stream()
.map(Permission::getName)
.collect(Collectors.joining(","))
);
}
return jwtBuilder.signWith(SignatureAlgorithm.HS256, key).compact();
} | [
"public",
"String",
"createToken",
"(",
"final",
"Principal",
"principal",
",",
"final",
"List",
"<",
"Permission",
">",
"permissions",
")",
"{",
"final",
"Date",
"today",
"=",
"new",
"Date",
"(",
")",
";",
"final",
"JwtBuilder",
"jwtBuilder",
"=",
"Jwts",
... | Creates a new JWT for the specified principal. Token is signed using
the SecretKey with an HMAC 256 algorithm.
@param principal the Principal to create the token for
@param permissions the effective list of permissions for the principal
@return a String representation of the generated token
@since 1.1.0 | [
"Creates",
"a",
"new",
"JWT",
"for",
"the",
"specified",
"principal",
".",
"Token",
"is",
"signed",
"using",
"the",
"SecretKey",
"with",
"an",
"HMAC",
"256",
"algorithm",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/JsonWebToken.java#L111-L125 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp.2.3/src/org/apache/jasper/runtime/BodyContentImpl.java | BodyContentImpl.getReader | public Reader getReader() {
// PK33136
char[] charBuffer = new char[strBuffer.length()] ;
strBuffer.getChars(0, strBuffer.length(), charBuffer, 0);
//PK33136
return (writer == null) ? new CharArrayReader (charBuffer, 0, strBuffer.length()) : null;
} | java | public Reader getReader() {
// PK33136
char[] charBuffer = new char[strBuffer.length()] ;
strBuffer.getChars(0, strBuffer.length(), charBuffer, 0);
//PK33136
return (writer == null) ? new CharArrayReader (charBuffer, 0, strBuffer.length()) : null;
} | [
"public",
"Reader",
"getReader",
"(",
")",
"{",
"// PK33136",
"char",
"[",
"]",
"charBuffer",
"=",
"new",
"char",
"[",
"strBuffer",
".",
"length",
"(",
")",
"]",
";",
"strBuffer",
".",
"getChars",
"(",
"0",
",",
"strBuffer",
".",
"length",
"(",
")",
... | Return the value of this BodyJspWriter as a Reader.
Note: this is after evaluation!! There are no scriptlets,
etc in this stream.
@return the value of this BodyJspWriter as a Reader | [
"Return",
"the",
"value",
"of",
"this",
"BodyJspWriter",
"as",
"a",
"Reader",
".",
"Note",
":",
"this",
"is",
"after",
"evaluation!!",
"There",
"are",
"no",
"scriptlets",
"etc",
"in",
"this",
"stream",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp.2.3/src/org/apache/jasper/runtime/BodyContentImpl.java#L603-L609 |
Sefford/fraggle | fraggle/src/main/java/com/sefford/fraggle/FraggleManager.java | FraggleManager.configureAdditionMode | protected void configureAdditionMode(Fragment frag, int flags, FragmentTransaction ft, int containerId) {
if ((flags & DO_NOT_REPLACE_FRAGMENT) != DO_NOT_REPLACE_FRAGMENT) {
ft.replace(containerId, frag, ((FraggleFragment) frag).getFragmentTag());
} else {
ft.add(containerId, frag, ((FraggleFragment) frag).getFragmentTag());
peek().onFragmentNotVisible();
}
} | java | protected void configureAdditionMode(Fragment frag, int flags, FragmentTransaction ft, int containerId) {
if ((flags & DO_NOT_REPLACE_FRAGMENT) != DO_NOT_REPLACE_FRAGMENT) {
ft.replace(containerId, frag, ((FraggleFragment) frag).getFragmentTag());
} else {
ft.add(containerId, frag, ((FraggleFragment) frag).getFragmentTag());
peek().onFragmentNotVisible();
}
} | [
"protected",
"void",
"configureAdditionMode",
"(",
"Fragment",
"frag",
",",
"int",
"flags",
",",
"FragmentTransaction",
"ft",
",",
"int",
"containerId",
")",
"{",
"if",
"(",
"(",
"flags",
"&",
"DO_NOT_REPLACE_FRAGMENT",
")",
"!=",
"DO_NOT_REPLACE_FRAGMENT",
")",
... | Configures the way to add the Fragment into the transaction. It can vary from adding a new fragment,
to using a previous instance and refresh it, or replacing the last one.
@param frag Fragment to add
@param flags Added flags to the Fragment configuration
@param ft Transaction to add the fragment
@param containerId Target container ID | [
"Configures",
"the",
"way",
"to",
"add",
"the",
"Fragment",
"into",
"the",
"transaction",
".",
"It",
"can",
"vary",
"from",
"adding",
"a",
"new",
"fragment",
"to",
"using",
"a",
"previous",
"instance",
"and",
"refresh",
"it",
"or",
"replacing",
"the",
"las... | train | https://github.com/Sefford/fraggle/blob/d1b65a99ecc3c3faeef8f288ca6225bbf475c3a3/fraggle/src/main/java/com/sefford/fraggle/FraggleManager.java#L253-L260 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.