repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
grpc/grpc-java | core/src/main/java/io/grpc/internal/GzipInflatingBuffer.java | GzipInflatingBuffer.inflateBytes | int inflateBytes(byte[] b, int offset, int length) throws DataFormatException, ZipException {
checkState(!closed, "GzipInflatingBuffer is closed");
int bytesRead = 0;
int missingBytes;
boolean madeProgress = true;
while (madeProgress && (missingBytes = length - bytesRead) > 0) {
switch (state) {
case HEADER:
madeProgress = processHeader();
break;
case HEADER_EXTRA_LEN:
madeProgress = processHeaderExtraLen();
break;
case HEADER_EXTRA:
madeProgress = processHeaderExtra();
break;
case HEADER_NAME:
madeProgress = processHeaderName();
break;
case HEADER_COMMENT:
madeProgress = processHeaderComment();
break;
case HEADER_CRC:
madeProgress = processHeaderCrc();
break;
case INITIALIZE_INFLATER:
madeProgress = initializeInflater();
break;
case INFLATING:
bytesRead += inflate(b, offset + bytesRead, missingBytes);
if (state == State.TRAILER) {
// Eagerly process trailer, if available, to validate CRC.
madeProgress = processTrailer();
} else {
// Continue in INFLATING until we have the required bytes or we transition to
// INFLATER_NEEDS_INPUT
madeProgress = true;
}
break;
case INFLATER_NEEDS_INPUT:
madeProgress = fill();
break;
case TRAILER:
madeProgress = processTrailer();
break;
default:
throw new AssertionError("Invalid state: " + state);
}
}
// If we finished a gzip block, check if we have enough bytes to read another header
isStalled =
!madeProgress
|| (state == State.HEADER && gzipMetadataReader.readableBytes() < GZIP_HEADER_MIN_SIZE);
return bytesRead;
} | java | int inflateBytes(byte[] b, int offset, int length) throws DataFormatException, ZipException {
checkState(!closed, "GzipInflatingBuffer is closed");
int bytesRead = 0;
int missingBytes;
boolean madeProgress = true;
while (madeProgress && (missingBytes = length - bytesRead) > 0) {
switch (state) {
case HEADER:
madeProgress = processHeader();
break;
case HEADER_EXTRA_LEN:
madeProgress = processHeaderExtraLen();
break;
case HEADER_EXTRA:
madeProgress = processHeaderExtra();
break;
case HEADER_NAME:
madeProgress = processHeaderName();
break;
case HEADER_COMMENT:
madeProgress = processHeaderComment();
break;
case HEADER_CRC:
madeProgress = processHeaderCrc();
break;
case INITIALIZE_INFLATER:
madeProgress = initializeInflater();
break;
case INFLATING:
bytesRead += inflate(b, offset + bytesRead, missingBytes);
if (state == State.TRAILER) {
// Eagerly process trailer, if available, to validate CRC.
madeProgress = processTrailer();
} else {
// Continue in INFLATING until we have the required bytes or we transition to
// INFLATER_NEEDS_INPUT
madeProgress = true;
}
break;
case INFLATER_NEEDS_INPUT:
madeProgress = fill();
break;
case TRAILER:
madeProgress = processTrailer();
break;
default:
throw new AssertionError("Invalid state: " + state);
}
}
// If we finished a gzip block, check if we have enough bytes to read another header
isStalled =
!madeProgress
|| (state == State.HEADER && gzipMetadataReader.readableBytes() < GZIP_HEADER_MIN_SIZE);
return bytesRead;
} | [
"int",
"inflateBytes",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"DataFormatException",
",",
"ZipException",
"{",
"checkState",
"(",
"!",
"closed",
",",
"\"GzipInflatingBuffer is closed\"",
")",
";",
"int",
"bytesRe... | Attempts to inflate {@code length} bytes of data into {@code b}.
<p>Any gzipped bytes consumed by this method will be added to the counter returned by {@link
#getAndResetBytesConsumed()}. This method may consume gzipped bytes without writing any data to
{@code b}, and may also write data to {@code b} without consuming additional gzipped bytes (if
the inflater on an earlier call consumed the bytes necessary to produce output).
@param b the destination array to receive the bytes.
@param offset the starting offset in the destination array.
@param length the number of bytes to be copied.
@throws IndexOutOfBoundsException if {@code b} is too small to hold the requested bytes. | [
"Attempts",
"to",
"inflate",
"{",
"@code",
"length",
"}",
"bytes",
"of",
"data",
"into",
"{",
"@code",
"b",
"}",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/GzipInflatingBuffer.java#L260-L316 |
motown-io/motown | ocpp/v15-soap/src/main/java/io/motown/ocpp/v15/soap/chargepoint/IdentifyingTokenConverterService.java | IdentifyingTokenConverterService.convertIdentifyingToken | public AuthorisationData convertIdentifyingToken(IdentifyingToken token) {
AuthorisationData authData = new AuthorisationData();
authData.setIdTag(token.getToken());
//The OCPP spec describes that the IdTagInfo should not be present in case the charging station has to remove the entry from the list
IdentifyingToken.AuthenticationStatus status = token.getAuthenticationStatus();
if (status != null && !IdentifyingToken.AuthenticationStatus.DELETED.equals(status)) {
IdTagInfo info = new IdTagInfo();
switch (token.getAuthenticationStatus()) {
case ACCEPTED:
info.setStatus(AuthorizationStatus.ACCEPTED);
break;
case BLOCKED:
info.setStatus(AuthorizationStatus.BLOCKED);
break;
case EXPIRED:
info.setStatus(AuthorizationStatus.EXPIRED);
break;
case INVALID:
info.setStatus(AuthorizationStatus.INVALID);
break;
case CONCURRENT_TX:
info.setStatus(AuthorizationStatus.CONCURRENT_TX);
break;
default:
throw new AssertionError(String.format("Unknown authentication status [%s] in given identifying token [%s].", token.getAuthenticationStatus(), token.getToken()));
}
authData.setIdTagInfo(info);
}
return authData;
} | java | public AuthorisationData convertIdentifyingToken(IdentifyingToken token) {
AuthorisationData authData = new AuthorisationData();
authData.setIdTag(token.getToken());
//The OCPP spec describes that the IdTagInfo should not be present in case the charging station has to remove the entry from the list
IdentifyingToken.AuthenticationStatus status = token.getAuthenticationStatus();
if (status != null && !IdentifyingToken.AuthenticationStatus.DELETED.equals(status)) {
IdTagInfo info = new IdTagInfo();
switch (token.getAuthenticationStatus()) {
case ACCEPTED:
info.setStatus(AuthorizationStatus.ACCEPTED);
break;
case BLOCKED:
info.setStatus(AuthorizationStatus.BLOCKED);
break;
case EXPIRED:
info.setStatus(AuthorizationStatus.EXPIRED);
break;
case INVALID:
info.setStatus(AuthorizationStatus.INVALID);
break;
case CONCURRENT_TX:
info.setStatus(AuthorizationStatus.CONCURRENT_TX);
break;
default:
throw new AssertionError(String.format("Unknown authentication status [%s] in given identifying token [%s].", token.getAuthenticationStatus(), token.getToken()));
}
authData.setIdTagInfo(info);
}
return authData;
} | [
"public",
"AuthorisationData",
"convertIdentifyingToken",
"(",
"IdentifyingToken",
"token",
")",
"{",
"AuthorisationData",
"authData",
"=",
"new",
"AuthorisationData",
"(",
")",
";",
"authData",
".",
"setIdTag",
"(",
"token",
".",
"getToken",
"(",
")",
")",
";",
... | Converts a {@code IdentifyingToken} to a {@code AuthorisationData} object. If the authentication status is not
null or DELETED then the IdTagInfo will be set based on the authentication status.
@param token identifying token.
@return authorisation data object. | [
"Converts",
"a",
"{",
"@code",
"IdentifyingToken",
"}",
"to",
"a",
"{",
"@code",
"AuthorisationData",
"}",
"object",
".",
"If",
"the",
"authentication",
"status",
"is",
"not",
"null",
"or",
"DELETED",
"then",
"the",
"IdTagInfo",
"will",
"be",
"set",
"based",... | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/v15-soap/src/main/java/io/motown/ocpp/v15/soap/chargepoint/IdentifyingTokenConverterService.java#L51-L82 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java | ScreenField.getSFieldValue | public String getSFieldValue(boolean bDisplayFormat, boolean bRawData)
{
Convert converter = this.getConverter();
if (converter == null)
return Constant.BLANK;
if (bRawData)
{
converter = converter.getField();
if (converter == null)
return Constant.BLANK;
}
return converter.getString();
} | java | public String getSFieldValue(boolean bDisplayFormat, boolean bRawData)
{
Convert converter = this.getConverter();
if (converter == null)
return Constant.BLANK;
if (bRawData)
{
converter = converter.getField();
if (converter == null)
return Constant.BLANK;
}
return converter.getString();
} | [
"public",
"String",
"getSFieldValue",
"(",
"boolean",
"bDisplayFormat",
",",
"boolean",
"bRawData",
")",
"{",
"Convert",
"converter",
"=",
"this",
".",
"getConverter",
"(",
")",
";",
"if",
"(",
"converter",
"==",
"null",
")",
"return",
"Constant",
".",
"BLAN... | Retrieve (in HTML format) from this field.
(Only for XML/HTML fields).
@param bDisplayFormat Display (with html codes) or Input format?
@param bRawData If true return the Raw data (not through the converters)?
@return The HTML string. | [
"Retrieve",
"(",
"in",
"HTML",
"format",
")",
"from",
"this",
"field",
".",
"(",
"Only",
"for",
"XML",
"/",
"HTML",
"fields",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L569-L581 |
EMCECS/nfs-client-java | src/main/java/com/emc/ecs/nfsclient/nfs/NfsResponseBase.java | NfsResponseBase.unmarshallingFileHandle | protected void unmarshallingFileHandle(Xdr xdr, boolean force) {
if (force || xdr.getBoolean()) {
_fileHandle = xdr.getByteArray();
}
} | java | protected void unmarshallingFileHandle(Xdr xdr, boolean force) {
if (force || xdr.getBoolean()) {
_fileHandle = xdr.getByteArray();
}
} | [
"protected",
"void",
"unmarshallingFileHandle",
"(",
"Xdr",
"xdr",
",",
"boolean",
"force",
")",
"{",
"if",
"(",
"force",
"||",
"xdr",
".",
"getBoolean",
"(",
")",
")",
"{",
"_fileHandle",
"=",
"xdr",
".",
"getByteArray",
"(",
")",
";",
"}",
"}"
] | Unmarshall the object if it is there, or skip the existence check if
<code>force</code> is <code>true</code>. Convenience method for use in
subclasses.
@param xdr
@param force | [
"Unmarshall",
"the",
"object",
"if",
"it",
"is",
"there",
"or",
"skip",
"the",
"existence",
"check",
"if",
"<code",
">",
"force<",
"/",
"code",
">",
"is",
"<code",
">",
"true<",
"/",
"code",
">",
".",
"Convenience",
"method",
"for",
"use",
"in",
"subcl... | train | https://github.com/EMCECS/nfs-client-java/blob/7ba25bad5052b95cd286052745327729288b2843/src/main/java/com/emc/ecs/nfsclient/nfs/NfsResponseBase.java#L163-L167 |
GCRC/nunaliit | nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/ImageIOUtil.java | ImageIOUtil.writeImage | public static boolean writeImage(BufferedImage image, String filename,
int dpi) throws IOException
{
return writeImage(image, filename, dpi, 1.0f);
} | java | public static boolean writeImage(BufferedImage image, String filename,
int dpi) throws IOException
{
return writeImage(image, filename, dpi, 1.0f);
} | [
"public",
"static",
"boolean",
"writeImage",
"(",
"BufferedImage",
"image",
",",
"String",
"filename",
",",
"int",
"dpi",
")",
"throws",
"IOException",
"{",
"return",
"writeImage",
"(",
"image",
",",
"filename",
",",
"dpi",
",",
"1.0f",
")",
";",
"}"
] | Writes a buffered image to a file using the given image format. See
{@link #writeImage(BufferedImage image, String formatName,
OutputStream output, int dpi, float quality)} for more details.
@param image the image to be written
@param filename used to construct the filename for the individual image.
Its suffix will be used as the image format.
@param dpi the resolution in dpi (dots per inch) to be used in metadata
@return true if the image file was produced, false if there was an error.
@throws IOException if an I/O error occurs | [
"Writes",
"a",
"buffered",
"image",
"to",
"a",
"file",
"using",
"the",
"given",
"image",
"format",
".",
"See",
"{",
"@link",
"#writeImage",
"(",
"BufferedImage",
"image",
"String",
"formatName",
"OutputStream",
"output",
"int",
"dpi",
"float",
"quality",
")",
... | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/ImageIOUtil.java#L62-L66 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/KafkaSpec.java | KafkaSpec.connectKafka | @Given("^I connect to kafka at '(.+)' using path '(.+)'$")
public void connectKafka(String zkHost, String zkPath) throws UnknownHostException {
String zkPort = zkHost.split(":")[1];
zkHost = zkHost.split(":")[0];
commonspec.getKafkaUtils().setZkHost(zkHost, zkPort, zkPath);
commonspec.getKafkaUtils().connect();
} | java | @Given("^I connect to kafka at '(.+)' using path '(.+)'$")
public void connectKafka(String zkHost, String zkPath) throws UnknownHostException {
String zkPort = zkHost.split(":")[1];
zkHost = zkHost.split(":")[0];
commonspec.getKafkaUtils().setZkHost(zkHost, zkPort, zkPath);
commonspec.getKafkaUtils().connect();
} | [
"@",
"Given",
"(",
"\"^I connect to kafka at '(.+)' using path '(.+)'$\"",
")",
"public",
"void",
"connectKafka",
"(",
"String",
"zkHost",
",",
"String",
"zkPath",
")",
"throws",
"UnknownHostException",
"{",
"String",
"zkPort",
"=",
"zkHost",
".",
"split",
"(",
"\":... | Connect to Kafka.
@param zkHost ZK host
@param zkPath ZK port
@throws UnknownHostException exception | [
"Connect",
"to",
"Kafka",
"."
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/KafkaSpec.java#L49-L55 |
sd4324530/fastweixin | src/main/java/com/github/sd4324530/fastweixin/api/QrcodeAPI.java | QrcodeAPI.createQrcode | public QrcodeResponse createQrcode(QrcodeType actionName, String sceneId, String sceneStr, Integer expireSeconds) {
BeanUtil.requireNonNull(actionName, "actionName is null");
BeanUtil.requireNonNull(sceneId, "actionInfo is null");
LOG.debug("创建二维码信息.....");
QrcodeResponse response = null;
String url = BASE_API_URL + "cgi-bin/qrcode/create?access_token=#";
Map<String, Object> param = new HashMap<String, Object>();
param.put("action_name", actionName);
Map<String, Object> actionInfo = new HashMap<String, Object>();
Map<String, Object> scene = new HashMap<String, Object>();
if (StrUtil.isNotBlank(sceneId))
scene.put("scene_id", sceneId);
if (StrUtil.isNotBlank(sceneStr))
scene.put("scene_str", sceneStr);
actionInfo.put("scene", scene);
param.put("action_info", actionInfo);
if (BeanUtil.nonNull(expireSeconds) && 0 != expireSeconds) {
param.put("expire_seconds", expireSeconds);
}
BaseResponse r = executePost(url, JSONUtil.toJson(param));
String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
response = JSONUtil.toBean(resultJson, QrcodeResponse.class);
return response;
} | java | public QrcodeResponse createQrcode(QrcodeType actionName, String sceneId, String sceneStr, Integer expireSeconds) {
BeanUtil.requireNonNull(actionName, "actionName is null");
BeanUtil.requireNonNull(sceneId, "actionInfo is null");
LOG.debug("创建二维码信息.....");
QrcodeResponse response = null;
String url = BASE_API_URL + "cgi-bin/qrcode/create?access_token=#";
Map<String, Object> param = new HashMap<String, Object>();
param.put("action_name", actionName);
Map<String, Object> actionInfo = new HashMap<String, Object>();
Map<String, Object> scene = new HashMap<String, Object>();
if (StrUtil.isNotBlank(sceneId))
scene.put("scene_id", sceneId);
if (StrUtil.isNotBlank(sceneStr))
scene.put("scene_str", sceneStr);
actionInfo.put("scene", scene);
param.put("action_info", actionInfo);
if (BeanUtil.nonNull(expireSeconds) && 0 != expireSeconds) {
param.put("expire_seconds", expireSeconds);
}
BaseResponse r = executePost(url, JSONUtil.toJson(param));
String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
response = JSONUtil.toBean(resultJson, QrcodeResponse.class);
return response;
} | [
"public",
"QrcodeResponse",
"createQrcode",
"(",
"QrcodeType",
"actionName",
",",
"String",
"sceneId",
",",
"String",
"sceneStr",
",",
"Integer",
"expireSeconds",
")",
"{",
"BeanUtil",
".",
"requireNonNull",
"(",
"actionName",
",",
"\"actionName is null\"",
")",
";"... | 创建二维码
@param actionName 二维码类型,QR_SCENE为临时,QR_LIMIT_SCENE为永久
@param sceneId 场景值ID,临时二维码时为32位非0整型,永久二维码时最大值为100000(目前参数只支持1--100000)
@param sceneStr 场景值ID(字符串形式的ID),字符串类型,长度限制为1到64,仅永久二维码支持此字段
@param expireSeconds 该二维码有效时间,以秒为单位。 最大不超过2592000(即30天),此字段如果不填,则默认有效期为30秒
@return 二维码对象 | [
"创建二维码"
] | train | https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/api/QrcodeAPI.java#L51-L77 |
mfornos/humanize | humanize-icu/src/main/java/humanize/ICUHumanize.java | ICUHumanize.dateFormatInstance | public static DateFormat dateFormatInstance(final String pattern, final Locale locale)
{
return withinLocale(new Callable<DateFormat>()
{
public DateFormat call() throws Exception
{
return dateFormatInstance(pattern);
}
}, locale);
} | java | public static DateFormat dateFormatInstance(final String pattern, final Locale locale)
{
return withinLocale(new Callable<DateFormat>()
{
public DateFormat call() throws Exception
{
return dateFormatInstance(pattern);
}
}, locale);
} | [
"public",
"static",
"DateFormat",
"dateFormatInstance",
"(",
"final",
"String",
"pattern",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"withinLocale",
"(",
"new",
"Callable",
"<",
"DateFormat",
">",
"(",
")",
"{",
"public",
"DateFormat",
"call",
"(",... | <p>
Same as {@link #dateFormatInstance(String) dateFormatInstance} for the
specified locale.
</p>
@param pattern
Format pattern that follows the conventions of
{@link com.ibm.icu.text.DateFormat DateFormat}
@param locale
Target locale
@return a DateFormat instance for the current thread | [
"<p",
">",
"Same",
"as",
"{",
"@link",
"#dateFormatInstance",
"(",
"String",
")",
"dateFormatInstance",
"}",
"for",
"the",
"specified",
"locale",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L278-L287 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/SessionApi.java | SessionApi.initializeWorkspace | public ApiSuccessResponse initializeWorkspace(String code, String redirectUri, String state, String authorization) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = initializeWorkspaceWithHttpInfo(code, redirectUri, state, authorization);
return resp.getData();
} | java | public ApiSuccessResponse initializeWorkspace(String code, String redirectUri, String state, String authorization) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = initializeWorkspaceWithHttpInfo(code, redirectUri, state, authorization);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"initializeWorkspace",
"(",
"String",
"code",
",",
"String",
"redirectUri",
",",
"String",
"state",
",",
"String",
"authorization",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"initi... | Get and register an auth token
Retrieve the authorization token using the authorization code. Workspace then registers the token and prepares the user's environment.
@param code The authorization code. You must include this parameter for the [Authorization Code Grant flow](/reference/authentication/). (optional)
@param redirectUri The same redirect URI you used in the initial login step. You must include this parameter for the [Authorization Code Grant flow](/reference/authentication/). (optional)
@param state The state parameter provide by the auth service on redirect that should be used to validate. This parameter must be provided if the include_state parameter is sent with the /login request. (optional)
@param authorization Bearer authorization. For example, \"Authorization&colon; Bearer access_token\". (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"and",
"register",
"an",
"auth",
"token",
"Retrieve",
"the",
"authorization",
"token",
"using",
"the",
"authorization",
"code",
".",
"Workspace",
"then",
"registers",
"the",
"token",
"and",
"prepares",
"the",
"user'",
";",
"s",
"environment",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/SessionApi.java#L1097-L1100 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java | OUTRES.outresScore | public double outresScore(final int s, long[] subspace, DBIDRef id, KernelDensityEstimator kernel, DBIDs cands) {
double score = 1.0; // Initial score is 1.0
final SubspaceEuclideanDistanceFunction df = new SubspaceEuclideanDistanceFunction(subspace);
MeanVariance meanv = new MeanVariance();
ModifiableDoubleDBIDList neighcand = DBIDUtil.newDistanceDBIDList(cands.size());
ModifiableDoubleDBIDList nn = DBIDUtil.newDistanceDBIDList(cands.size());
for(int i = s; i < kernel.dim; i++) {
assert !BitsUtil.get(subspace, i);
BitsUtil.setI(subspace, i);
df.setSelectedDimensions(subspace);
final double adjustedEps = kernel.adjustedEps(kernel.dim);
DoubleDBIDList neigh = initialRange(id, cands, df, adjustedEps * 2, kernel, neighcand);
// Relevance test
if(neigh.size() > 2) {
if(relevantSubspace(subspace, neigh, kernel)) {
final double density = kernel.subspaceDensity(subspace, neigh);
// Compute mean and standard deviation for densities of neighbors.
meanv.reset();
for(DoubleDBIDListIter neighbor = neigh.iter(); neighbor.valid(); neighbor.advance()) {
subsetNeighborhoodQuery(neighcand, neighbor, df, adjustedEps, kernel, nn);
meanv.put(kernel.subspaceDensity(subspace, nn));
}
final double deviation = (meanv.getMean() - density) / (2. * meanv.getSampleStddev());
// High deviation:
if(deviation >= 1) {
score *= density / deviation;
}
// Recursion
score *= outresScore(i + 1, subspace, id, kernel, neighcand);
}
}
BitsUtil.clearI(subspace, i);
}
return score;
} | java | public double outresScore(final int s, long[] subspace, DBIDRef id, KernelDensityEstimator kernel, DBIDs cands) {
double score = 1.0; // Initial score is 1.0
final SubspaceEuclideanDistanceFunction df = new SubspaceEuclideanDistanceFunction(subspace);
MeanVariance meanv = new MeanVariance();
ModifiableDoubleDBIDList neighcand = DBIDUtil.newDistanceDBIDList(cands.size());
ModifiableDoubleDBIDList nn = DBIDUtil.newDistanceDBIDList(cands.size());
for(int i = s; i < kernel.dim; i++) {
assert !BitsUtil.get(subspace, i);
BitsUtil.setI(subspace, i);
df.setSelectedDimensions(subspace);
final double adjustedEps = kernel.adjustedEps(kernel.dim);
DoubleDBIDList neigh = initialRange(id, cands, df, adjustedEps * 2, kernel, neighcand);
// Relevance test
if(neigh.size() > 2) {
if(relevantSubspace(subspace, neigh, kernel)) {
final double density = kernel.subspaceDensity(subspace, neigh);
// Compute mean and standard deviation for densities of neighbors.
meanv.reset();
for(DoubleDBIDListIter neighbor = neigh.iter(); neighbor.valid(); neighbor.advance()) {
subsetNeighborhoodQuery(neighcand, neighbor, df, adjustedEps, kernel, nn);
meanv.put(kernel.subspaceDensity(subspace, nn));
}
final double deviation = (meanv.getMean() - density) / (2. * meanv.getSampleStddev());
// High deviation:
if(deviation >= 1) {
score *= density / deviation;
}
// Recursion
score *= outresScore(i + 1, subspace, id, kernel, neighcand);
}
}
BitsUtil.clearI(subspace, i);
}
return score;
} | [
"public",
"double",
"outresScore",
"(",
"final",
"int",
"s",
",",
"long",
"[",
"]",
"subspace",
",",
"DBIDRef",
"id",
",",
"KernelDensityEstimator",
"kernel",
",",
"DBIDs",
"cands",
")",
"{",
"double",
"score",
"=",
"1.0",
";",
"// Initial score is 1.0",
"fi... | Main loop of OUTRES. Run for each object
@param s start dimension
@param subspace Current subspace
@param id Current object ID
@param kernel Kernel
@param cands neighbor candidates
@return Score | [
"Main",
"loop",
"of",
"OUTRES",
".",
"Run",
"for",
"each",
"object"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java#L151-L186 |
buschmais/jqa-core-framework | report/src/main/java/com/buschmais/jqassistant/core/report/api/ReportHelper.java | ReportHelper.verifyConstraintResults | public int verifyConstraintResults(Severity warnOnSeverity, Severity failOnSeverity, InMemoryReportPlugin inMemoryReportWriter) {
Collection<Result<Constraint>> constraintResults = inMemoryReportWriter.getConstraintResults().values();
return verifyRuleResults(constraintResults, warnOnSeverity, failOnSeverity, "Constraint", CONSTRAINT_VIOLATION_HEADER, true);
} | java | public int verifyConstraintResults(Severity warnOnSeverity, Severity failOnSeverity, InMemoryReportPlugin inMemoryReportWriter) {
Collection<Result<Constraint>> constraintResults = inMemoryReportWriter.getConstraintResults().values();
return verifyRuleResults(constraintResults, warnOnSeverity, failOnSeverity, "Constraint", CONSTRAINT_VIOLATION_HEADER, true);
} | [
"public",
"int",
"verifyConstraintResults",
"(",
"Severity",
"warnOnSeverity",
",",
"Severity",
"failOnSeverity",
",",
"InMemoryReportPlugin",
"inMemoryReportWriter",
")",
"{",
"Collection",
"<",
"Result",
"<",
"Constraint",
">>",
"constraintResults",
"=",
"inMemoryReport... | Verifies the constraint results returned by the
{@link InMemoryReportPlugin} .
@param warnOnSeverity
The severity threshold to warn.
@param failOnSeverity
The severity threshold to fail.
@param inMemoryReportWriter
The {@link InMemoryReportPlugin}
@return The number of failed concepts, i.e. for breaking the build if
higher than 0. | [
"Verifies",
"the",
"constraint",
"results",
"returned",
"by",
"the",
"{",
"@link",
"InMemoryReportPlugin",
"}",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/report/src/main/java/com/buschmais/jqassistant/core/report/api/ReportHelper.java#L79-L82 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/model/LineSegment.java | LineSegment.intersectsRectangle | public boolean intersectsRectangle(Rectangle r, boolean bias) {
int codeStart = code(r, this.start);
int codeEnd = code(r, this.end);
if (0 == (codeStart | codeEnd)) {
// both points are inside, trivial case
return true;
} else if (0 != (codeStart & codeEnd)) {
// both points are either below, above, left or right of the box, no intersection
return false;
}
return bias;
} | java | public boolean intersectsRectangle(Rectangle r, boolean bias) {
int codeStart = code(r, this.start);
int codeEnd = code(r, this.end);
if (0 == (codeStart | codeEnd)) {
// both points are inside, trivial case
return true;
} else if (0 != (codeStart & codeEnd)) {
// both points are either below, above, left or right of the box, no intersection
return false;
}
return bias;
} | [
"public",
"boolean",
"intersectsRectangle",
"(",
"Rectangle",
"r",
",",
"boolean",
"bias",
")",
"{",
"int",
"codeStart",
"=",
"code",
"(",
"r",
",",
"this",
".",
"start",
")",
";",
"int",
"codeEnd",
"=",
"code",
"(",
"r",
",",
"this",
".",
"end",
")"... | Returns a fast computation if the line intersects the rectangle or bias if there
is no fast way to compute the intersection.
@param r retangle to test
@param bias the result if no fast computation is possible
@return either the fast and correct result or the bias (which might be wrong). | [
"Returns",
"a",
"fast",
"computation",
"if",
"the",
"line",
"intersects",
"the",
"rectangle",
"or",
"bias",
"if",
"there",
"is",
"no",
"fast",
"way",
"to",
"compute",
"the",
"intersection",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/LineSegment.java#L167-L179 |
js-lib-com/template.xhtml | src/main/java/js/template/xhtml/Content.java | Content.getValue | private Object getValue(Object object, String propertyPath) throws TemplateException
{
if(this.model == null) {
return null;
}
// anonymous property path has only a dot
if(propertyPath.equals(".")) {
return object;
}
Object o = object;
if(propertyPath.charAt(0) == '.') {
o = this.model;
propertyPath = propertyPath.substring(1);
}
for(String property : propertyPath.split("\\.")) {
o = getObjectProperty(o, property);
if(o == null) {
return null;
}
}
return o;
} | java | private Object getValue(Object object, String propertyPath) throws TemplateException
{
if(this.model == null) {
return null;
}
// anonymous property path has only a dot
if(propertyPath.equals(".")) {
return object;
}
Object o = object;
if(propertyPath.charAt(0) == '.') {
o = this.model;
propertyPath = propertyPath.substring(1);
}
for(String property : propertyPath.split("\\.")) {
o = getObjectProperty(o, property);
if(o == null) {
return null;
}
}
return o;
} | [
"private",
"Object",
"getValue",
"(",
"Object",
"object",
",",
"String",
"propertyPath",
")",
"throws",
"TemplateException",
"{",
"if",
"(",
"this",
".",
"model",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// anonymous property path has only a dot\r",
... | Get content value. This method consider object as a graph of values and property path as a list of path components
separated by dots and uses next logic to retrieve requested value:
<ul>
<li>if property path is anonymous, i.e. is exactly ".", returns given object itself,
<li>if property path is absolute, starts with ".", uses content root object and transform the path as relative,
<li>split property path and traverse all path components returning last found object.
</ul>
Value can be about anything: primitives or aggregates. Anyway, there is distinction between not found value and a
null one. First condition is known as undefined value and throws content exception; null value denotes an existing
one but not initialized. Finally, this method uses {@link #getObjectProperty(Object, String)} to actually process
path components in sequence.
@param object instance to use if property path is relative,
@param propertyPath object property path.
@return requested content value or null.
@throws TemplateException if requested value is undefined. | [
"Get",
"content",
"value",
".",
"This",
"method",
"consider",
"object",
"as",
"a",
"graph",
"of",
"values",
"and",
"property",
"path",
"as",
"a",
"list",
"of",
"path",
"components",
"separated",
"by",
"dots",
"and",
"uses",
"next",
"logic",
"to",
"retrieve... | train | https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/Content.java#L313-L336 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.enableAsync | public Observable<Void> enableAsync(String jobId) {
return enableWithServiceResponseAsync(jobId).map(new Func1<ServiceResponseWithHeaders<Void, JobEnableHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobEnableHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> enableAsync(String jobId) {
return enableWithServiceResponseAsync(jobId).map(new Func1<ServiceResponseWithHeaders<Void, JobEnableHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobEnableHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"enableAsync",
"(",
"String",
"jobId",
")",
"{",
"return",
"enableWithServiceResponseAsync",
"(",
"jobId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponseWithHeaders",
"<",
"Void",
",",
"JobEnableHeaders",
">... | Enables the specified job, allowing new tasks to run.
When you call this API, the Batch service sets a disabled job to the enabling state. After the this operation is completed, the job moves to the active state, and scheduling of new tasks under the job resumes. The Batch service does not allow a task to remain in the active state for more than 180 days. Therefore, if you enable a job containing active tasks which were added more than 180 days ago, those tasks will not run.
@param jobId The ID of the job to enable.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Enables",
"the",
"specified",
"job",
"allowing",
"new",
"tasks",
"to",
"run",
".",
"When",
"you",
"call",
"this",
"API",
"the",
"Batch",
"service",
"sets",
"a",
"disabled",
"job",
"to",
"the",
"enabling",
"state",
".",
"After",
"the",
"this",
"operation",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L1587-L1594 |
joniles/mpxj | src/main/java/net/sf/mpxj/json/JsonWriter.java | JsonWriter.writeDurationField | private void writeDurationField(String fieldName, Object value) throws IOException
{
if (value instanceof String)
{
m_writer.writeNameValuePair(fieldName + "_text", (String) value);
}
else
{
Duration val = (Duration) value;
if (val.getDuration() != 0)
{
Duration minutes = val.convertUnits(TimeUnit.MINUTES, m_projectFile.getProjectProperties());
long seconds = (long) (minutes.getDuration() * 60.0);
m_writer.writeNameValuePair(fieldName, seconds);
}
}
} | java | private void writeDurationField(String fieldName, Object value) throws IOException
{
if (value instanceof String)
{
m_writer.writeNameValuePair(fieldName + "_text", (String) value);
}
else
{
Duration val = (Duration) value;
if (val.getDuration() != 0)
{
Duration minutes = val.convertUnits(TimeUnit.MINUTES, m_projectFile.getProjectProperties());
long seconds = (long) (minutes.getDuration() * 60.0);
m_writer.writeNameValuePair(fieldName, seconds);
}
}
} | [
"private",
"void",
"writeDurationField",
"(",
"String",
"fieldName",
",",
"Object",
"value",
")",
"throws",
"IOException",
"{",
"if",
"(",
"value",
"instanceof",
"String",
")",
"{",
"m_writer",
".",
"writeNameValuePair",
"(",
"fieldName",
"+",
"\"_text\"",
",",
... | Write a duration field to the JSON file.
@param fieldName field name
@param value field value | [
"Write",
"a",
"duration",
"field",
"to",
"the",
"JSON",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonWriter.java#L415-L431 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/certificatevalidation/crl/CRLVerifier.java | CRLVerifier.downloadCRLFromWeb | protected X509CRL downloadCRLFromWeb(String crlURL) throws IOException, CertificateVerificationException {
URL url = new URL(crlURL);
try (InputStream crlStream = url.openStream()) {
CertificateFactory cf = CertificateFactory.getInstance(Constants.X_509);
return (X509CRL) cf.generateCRL(crlStream);
} catch (MalformedURLException e) {
throw new CertificateVerificationException("CRL URL is malformed", e);
} catch (IOException e) {
throw new CertificateVerificationException("Cant reach URI: " + crlURL + " - only support HTTP", e);
} catch (CertificateException e) {
throw new CertificateVerificationException(e);
} catch (CRLException e) {
throw new CertificateVerificationException("Cannot generate X509CRL from the stream data", e);
}
} | java | protected X509CRL downloadCRLFromWeb(String crlURL) throws IOException, CertificateVerificationException {
URL url = new URL(crlURL);
try (InputStream crlStream = url.openStream()) {
CertificateFactory cf = CertificateFactory.getInstance(Constants.X_509);
return (X509CRL) cf.generateCRL(crlStream);
} catch (MalformedURLException e) {
throw new CertificateVerificationException("CRL URL is malformed", e);
} catch (IOException e) {
throw new CertificateVerificationException("Cant reach URI: " + crlURL + " - only support HTTP", e);
} catch (CertificateException e) {
throw new CertificateVerificationException(e);
} catch (CRLException e) {
throw new CertificateVerificationException("Cannot generate X509CRL from the stream data", e);
}
} | [
"protected",
"X509CRL",
"downloadCRLFromWeb",
"(",
"String",
"crlURL",
")",
"throws",
"IOException",
",",
"CertificateVerificationException",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"crlURL",
")",
";",
"try",
"(",
"InputStream",
"crlStream",
"=",
"url",
".",
... | Downloads CRL from the crlUrl. Does not support HTTPS.
@param crlURL URL of the CRL distribution point.
@return Downloaded CRL.
@throws IOException If an error occurs while downloading the CRL from web.
@throws CertificateVerificationException If an error occurs in CRL download process. | [
"Downloads",
"CRL",
"from",
"the",
"crlUrl",
".",
"Does",
"not",
"support",
"HTTPS",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/certificatevalidation/crl/CRLVerifier.java#L124-L138 |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java | JavaUtils.determineMostSpecificType | public static String determineMostSpecificType(final String... types) {
switch (types.length) {
case 0:
throw new IllegalArgumentException("At least one type has to be provided");
case 1:
return types[0];
case 2:
return determineMostSpecific(types[0], types[1]);
default:
String currentMostSpecific = determineMostSpecific(types[0], types[1]);
for (int i = 2; i < types.length; i++) {
currentMostSpecific = determineMostSpecific(currentMostSpecific, types[i]);
}
return currentMostSpecific;
}
} | java | public static String determineMostSpecificType(final String... types) {
switch (types.length) {
case 0:
throw new IllegalArgumentException("At least one type has to be provided");
case 1:
return types[0];
case 2:
return determineMostSpecific(types[0], types[1]);
default:
String currentMostSpecific = determineMostSpecific(types[0], types[1]);
for (int i = 2; i < types.length; i++) {
currentMostSpecific = determineMostSpecific(currentMostSpecific, types[i]);
}
return currentMostSpecific;
}
} | [
"public",
"static",
"String",
"determineMostSpecificType",
"(",
"final",
"String",
"...",
"types",
")",
"{",
"switch",
"(",
"types",
".",
"length",
")",
"{",
"case",
"0",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"At least one type has to be provided\"... | Determines the type which is most "specific" (i. e. parametrized types are more "specific" than generic types,
types which are not {@link Object} are less specific). If no exact statement can be made, the first type is chosen.
@param types The types
@return The most "specific" type | [
"Determines",
"the",
"type",
"which",
"is",
"most",
"specific",
"(",
"i",
".",
"e",
".",
"parametrized",
"types",
"are",
"more",
"specific",
"than",
"generic",
"types",
"types",
"which",
"are",
"not",
"{",
"@link",
"Object",
"}",
"are",
"less",
"specific",... | train | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java#L89-L104 |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java | PrimaveraPMFileReader.readActivityCodes | private void readActivityCodes(Task task, List<CodeAssignmentType> codes)
{
for (CodeAssignmentType assignment : codes)
{
ActivityCodeValue code = m_activityCodeMap.get(Integer.valueOf(assignment.getValueObjectId()));
if (code != null)
{
task.addActivityCode(code);
}
}
} | java | private void readActivityCodes(Task task, List<CodeAssignmentType> codes)
{
for (CodeAssignmentType assignment : codes)
{
ActivityCodeValue code = m_activityCodeMap.get(Integer.valueOf(assignment.getValueObjectId()));
if (code != null)
{
task.addActivityCode(code);
}
}
} | [
"private",
"void",
"readActivityCodes",
"(",
"Task",
"task",
",",
"List",
"<",
"CodeAssignmentType",
">",
"codes",
")",
"{",
"for",
"(",
"CodeAssignmentType",
"assignment",
":",
"codes",
")",
"{",
"ActivityCodeValue",
"code",
"=",
"m_activityCodeMap",
".",
"get"... | Read details of any activity codes assigned to this task.
@param task parent task
@param codes activity code assignments | [
"Read",
"details",
"of",
"any",
"activity",
"codes",
"assigned",
"to",
"this",
"task",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java#L1115-L1125 |
dwdyer/watchmaker | examples/src/java/main/org/uncommons/watchmaker/examples/monalisa/PolygonColourMutation.java | PolygonColourMutation.mutateColour | private Color mutateColour(Color colour, Random rng)
{
if (mutationProbability.nextValue().nextEvent(rng))
{
return new Color(mutateColourComponent(colour.getRed()),
mutateColourComponent(colour.getGreen()),
mutateColourComponent(colour.getBlue()),
mutateColourComponent(colour.getAlpha()));
}
else
{
return colour;
}
} | java | private Color mutateColour(Color colour, Random rng)
{
if (mutationProbability.nextValue().nextEvent(rng))
{
return new Color(mutateColourComponent(colour.getRed()),
mutateColourComponent(colour.getGreen()),
mutateColourComponent(colour.getBlue()),
mutateColourComponent(colour.getAlpha()));
}
else
{
return colour;
}
} | [
"private",
"Color",
"mutateColour",
"(",
"Color",
"colour",
",",
"Random",
"rng",
")",
"{",
"if",
"(",
"mutationProbability",
".",
"nextValue",
"(",
")",
".",
"nextEvent",
"(",
"rng",
")",
")",
"{",
"return",
"new",
"Color",
"(",
"mutateColourComponent",
"... | Mutate the specified colour.
@param colour The colour to mutate.
@param rng A source of randomness.
@return The (possibly) mutated colour. | [
"Mutate",
"the",
"specified",
"colour",
"."
] | train | https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/examples/src/java/main/org/uncommons/watchmaker/examples/monalisa/PolygonColourMutation.java#L86-L99 |
ogaclejapan/SmartTabLayout | utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java | Bundler.putCharSequenceArrayList | @TargetApi(8)
public Bundler putCharSequenceArrayList(String key, ArrayList<CharSequence> value) {
bundle.putCharSequenceArrayList(key, value);
return this;
} | java | @TargetApi(8)
public Bundler putCharSequenceArrayList(String key, ArrayList<CharSequence> value) {
bundle.putCharSequenceArrayList(key, value);
return this;
} | [
"@",
"TargetApi",
"(",
"8",
")",
"public",
"Bundler",
"putCharSequenceArrayList",
"(",
"String",
"key",
",",
"ArrayList",
"<",
"CharSequence",
">",
"value",
")",
"{",
"bundle",
".",
"putCharSequenceArrayList",
"(",
"key",
",",
"value",
")",
";",
"return",
"t... | Inserts an ArrayList<CharSequence> value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value an ArrayList<CharSequence> object, or null
@return this | [
"Inserts",
"an",
"ArrayList<CharSequence",
">",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L251-L255 |
real-logic/agrona | agrona/src/main/java/org/agrona/collections/BiInt2ObjectMap.java | BiInt2ObjectMap.computeIfAbsent | public V computeIfAbsent(final int keyPartA, final int keyPartB, final EntryFunction<? extends V> mappingFunction)
{
V value = get(keyPartA, keyPartB);
if (value == null)
{
value = mappingFunction.apply(keyPartA, keyPartB);
if (value != null)
{
put(keyPartA, keyPartB, value);
}
}
return value;
} | java | public V computeIfAbsent(final int keyPartA, final int keyPartB, final EntryFunction<? extends V> mappingFunction)
{
V value = get(keyPartA, keyPartB);
if (value == null)
{
value = mappingFunction.apply(keyPartA, keyPartB);
if (value != null)
{
put(keyPartA, keyPartB, value);
}
}
return value;
} | [
"public",
"V",
"computeIfAbsent",
"(",
"final",
"int",
"keyPartA",
",",
"final",
"int",
"keyPartB",
",",
"final",
"EntryFunction",
"<",
"?",
"extends",
"V",
">",
"mappingFunction",
")",
"{",
"V",
"value",
"=",
"get",
"(",
"keyPartA",
",",
"keyPartB",
")",
... | If the specified key is not already associated with a value (or is mapped
to {@code null}), attempts to compute its value using the given mapping
function and enters it into this map unless {@code null}.
@param keyPartA for the key
@param keyPartB for the key
@param mappingFunction creates values based upon keys if the key pair is missing
@return the newly created or stored value. | [
"If",
"the",
"specified",
"key",
"is",
"not",
"already",
"associated",
"with",
"a",
"value",
"(",
"or",
"is",
"mapped",
"to",
"{",
"@code",
"null",
"}",
")",
"attempts",
"to",
"compute",
"its",
"value",
"using",
"the",
"given",
"mapping",
"function",
"an... | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/collections/BiInt2ObjectMap.java#L270-L283 |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/LocalCall.java | LocalCall.callSync | public CompletionStage<Map<String, Result<R>>> callSync(final SaltClient client, Target<?> target,
AuthMethod auth) {
return callSyncHelperNonBlock(client, target, auth, Optional.empty())
.thenApply(r -> r.get(0));
} | java | public CompletionStage<Map<String, Result<R>>> callSync(final SaltClient client, Target<?> target,
AuthMethod auth) {
return callSyncHelperNonBlock(client, target, auth, Optional.empty())
.thenApply(r -> r.get(0));
} | [
"public",
"CompletionStage",
"<",
"Map",
"<",
"String",
",",
"Result",
"<",
"R",
">",
">",
">",
"callSync",
"(",
"final",
"SaltClient",
"client",
",",
"Target",
"<",
"?",
">",
"target",
",",
"AuthMethod",
"auth",
")",
"{",
"return",
"callSyncHelperNonBlock... | Calls a execution module function on the given target and synchronously
waits for the result. Authentication is done with the token therefore you
have to login prior to using this function.
@param client SaltClient instance
@param target the target for the function
@param auth authentication credentials to use
@return a map containing the results with the minion name as key | [
"Calls",
"a",
"execution",
"module",
"function",
"on",
"the",
"given",
"target",
"and",
"synchronously",
"waits",
"for",
"the",
"result",
".",
"Authentication",
"is",
"done",
"with",
"the",
"token",
"therefore",
"you",
"have",
"to",
"login",
"prior",
"to",
"... | train | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/LocalCall.java#L332-L336 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/base/internal/Finalizer.java | Finalizer.startFinalizer | public static void startFinalizer(
Class<?> finalizableReferenceClass,
ReferenceQueue<Object> queue,
PhantomReference<Object> frqReference) {
/*
* We use FinalizableReference.class for two things:
*
* 1) To invoke FinalizableReference.finalizeReferent()
*
* 2) To detect when FinalizableReference's class loader has to be garbage collected, at which
* point, Finalizer can stop running
*/
if (!finalizableReferenceClass.getName().equals(FINALIZABLE_REFERENCE)) {
throw new IllegalArgumentException("Expected " + FINALIZABLE_REFERENCE + ".");
}
Finalizer finalizer = new Finalizer(finalizableReferenceClass, queue, frqReference);
Thread thread = new Thread(finalizer);
thread.setName(Finalizer.class.getName());
thread.setDaemon(true);
try {
if (inheritableThreadLocals != null) {
inheritableThreadLocals.set(thread, null);
}
} catch (Throwable t) {
logger.log(
Level.INFO,
"Failed to clear thread local values inherited by reference finalizer thread.",
t);
}
thread.start();
} | java | public static void startFinalizer(
Class<?> finalizableReferenceClass,
ReferenceQueue<Object> queue,
PhantomReference<Object> frqReference) {
/*
* We use FinalizableReference.class for two things:
*
* 1) To invoke FinalizableReference.finalizeReferent()
*
* 2) To detect when FinalizableReference's class loader has to be garbage collected, at which
* point, Finalizer can stop running
*/
if (!finalizableReferenceClass.getName().equals(FINALIZABLE_REFERENCE)) {
throw new IllegalArgumentException("Expected " + FINALIZABLE_REFERENCE + ".");
}
Finalizer finalizer = new Finalizer(finalizableReferenceClass, queue, frqReference);
Thread thread = new Thread(finalizer);
thread.setName(Finalizer.class.getName());
thread.setDaemon(true);
try {
if (inheritableThreadLocals != null) {
inheritableThreadLocals.set(thread, null);
}
} catch (Throwable t) {
logger.log(
Level.INFO,
"Failed to clear thread local values inherited by reference finalizer thread.",
t);
}
thread.start();
} | [
"public",
"static",
"void",
"startFinalizer",
"(",
"Class",
"<",
"?",
">",
"finalizableReferenceClass",
",",
"ReferenceQueue",
"<",
"Object",
">",
"queue",
",",
"PhantomReference",
"<",
"Object",
">",
"frqReference",
")",
"{",
"/*\n * We use FinalizableReference.c... | Starts the Finalizer thread. FinalizableReferenceQueue calls this method reflectively.
@param finalizableReferenceClass FinalizableReference.class.
@param queue a reference queue that the thread will poll.
@param frqReference a phantom reference to the FinalizableReferenceQueue, which will be queued
either when the FinalizableReferenceQueue is no longer referenced anywhere, or when its
close() method is called. | [
"Starts",
"the",
"Finalizer",
"thread",
".",
"FinalizableReferenceQueue",
"calls",
"this",
"method",
"reflectively",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/base/internal/Finalizer.java#L61-L94 |
kiswanij/jk-util | src/main/java/com/jk/util/mime/MagicMimeEntry.java | MagicMimeEntry.matchShort | private boolean matchShort(final ByteBuffer bbuf, final ByteOrder bo, final boolean needMask, final short sMask) throws IOException {
bbuf.order(bo);
short got;
final String testContent = getContent();
if (testContent.startsWith("0x")) {
got = (short) Integer.parseInt(testContent.substring(2), 16);
} else if (testContent.startsWith("&")) {
got = (short) Integer.parseInt(testContent.substring(3), 16);
} else {
got = (short) Integer.parseInt(testContent);
}
short found = bbuf.getShort();
if (needMask) {
found = (short) (found & sMask);
}
if (got != found) {
return false;
}
return true;
} | java | private boolean matchShort(final ByteBuffer bbuf, final ByteOrder bo, final boolean needMask, final short sMask) throws IOException {
bbuf.order(bo);
short got;
final String testContent = getContent();
if (testContent.startsWith("0x")) {
got = (short) Integer.parseInt(testContent.substring(2), 16);
} else if (testContent.startsWith("&")) {
got = (short) Integer.parseInt(testContent.substring(3), 16);
} else {
got = (short) Integer.parseInt(testContent);
}
short found = bbuf.getShort();
if (needMask) {
found = (short) (found & sMask);
}
if (got != found) {
return false;
}
return true;
} | [
"private",
"boolean",
"matchShort",
"(",
"final",
"ByteBuffer",
"bbuf",
",",
"final",
"ByteOrder",
"bo",
",",
"final",
"boolean",
"needMask",
",",
"final",
"short",
"sMask",
")",
"throws",
"IOException",
"{",
"bbuf",
".",
"order",
"(",
"bo",
")",
";",
"sho... | Match short.
@param bbuf the bbuf
@param bo the bo
@param needMask the need mask
@param sMask the s mask
@return true, if successful
@throws IOException Signals that an I/O exception has occurred. | [
"Match",
"short",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/mime/MagicMimeEntry.java#L595-L618 |
rzwitserloot/lombok | src/core/lombok/bytecode/ClassFileMetaData.java | ClassFileMetaData.usesMethod | public boolean usesMethod(String className, String methodName, String descriptor) {
int classIndex = findClass(className);
if (classIndex == NOT_FOUND) return false;
int nameAndTypeIndex = findNameAndType(methodName, descriptor);
if (nameAndTypeIndex == NOT_FOUND) return false;
for (int i = 1; i < maxPoolSize; i++) {
if (isMethod(i) &&
readValue(offsets[i]) == classIndex &&
readValue(offsets[i] + 2) == nameAndTypeIndex) return true;
}
return false;
} | java | public boolean usesMethod(String className, String methodName, String descriptor) {
int classIndex = findClass(className);
if (classIndex == NOT_FOUND) return false;
int nameAndTypeIndex = findNameAndType(methodName, descriptor);
if (nameAndTypeIndex == NOT_FOUND) return false;
for (int i = 1; i < maxPoolSize; i++) {
if (isMethod(i) &&
readValue(offsets[i]) == classIndex &&
readValue(offsets[i] + 2) == nameAndTypeIndex) return true;
}
return false;
} | [
"public",
"boolean",
"usesMethod",
"(",
"String",
"className",
",",
"String",
"methodName",
",",
"String",
"descriptor",
")",
"{",
"int",
"classIndex",
"=",
"findClass",
"(",
"className",
")",
";",
"if",
"(",
"classIndex",
"==",
"NOT_FOUND",
")",
"return",
"... | Checks if the constant pool contains a reference to a given method.
@param className must be provided JVM-style, such as {@code java/lang/String}
@param descriptor must be provided JVM-style, such as {@code (IZ)Ljava/lang/String;} | [
"Checks",
"if",
"the",
"constant",
"pool",
"contains",
"a",
"reference",
"to",
"a",
"given",
"method",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/bytecode/ClassFileMetaData.java#L205-L217 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/Mixture.java | Mixture.score | public double score(StringWrapper s,StringWrapper t)
{
BagOfTokens sBag = asBagOfTokens(s);
BagOfTokens tBag = asBagOfTokens(t);
double lambda = 0.5;
int iterations = 0;
while (true) {
double newLamba = 0.0;
// E step: compute prob each token is draw from T
for (Iterator i = sBag.tokenIterator(); i.hasNext(); ) {
Token tok = (Token)i.next();
double sWeight = sBag.getWeight(tok);
double tWeight = tBag.getWeight(tok);
double probTokGivenT = tWeight/tBag.getTotalWeight();
double probTokGivenCorpus = ((double)getDocumentFrequency(tok))/totalTokenCount;
double probDrawnFromT = lambda * probTokGivenT;
double probDrawnFromCorpus = (1.0-lambda) * probTokGivenCorpus;
double normalizingConstant = probTokGivenT + probTokGivenCorpus;
probDrawnFromT /= normalizingConstant;
probDrawnFromCorpus /= normalizingConstant;
newLamba += probDrawnFromT * sWeight;
}
// M step: find best value of lambda
newLamba /= sBag.getTotalWeight();
// halt if converged
double change = newLamba - lambda;
if (iterations>maxIterate || (change>= -minChange && change<=minChange)) break;
else lambda = newLamba;
}
return lambda;
} | java | public double score(StringWrapper s,StringWrapper t)
{
BagOfTokens sBag = asBagOfTokens(s);
BagOfTokens tBag = asBagOfTokens(t);
double lambda = 0.5;
int iterations = 0;
while (true) {
double newLamba = 0.0;
// E step: compute prob each token is draw from T
for (Iterator i = sBag.tokenIterator(); i.hasNext(); ) {
Token tok = (Token)i.next();
double sWeight = sBag.getWeight(tok);
double tWeight = tBag.getWeight(tok);
double probTokGivenT = tWeight/tBag.getTotalWeight();
double probTokGivenCorpus = ((double)getDocumentFrequency(tok))/totalTokenCount;
double probDrawnFromT = lambda * probTokGivenT;
double probDrawnFromCorpus = (1.0-lambda) * probTokGivenCorpus;
double normalizingConstant = probTokGivenT + probTokGivenCorpus;
probDrawnFromT /= normalizingConstant;
probDrawnFromCorpus /= normalizingConstant;
newLamba += probDrawnFromT * sWeight;
}
// M step: find best value of lambda
newLamba /= sBag.getTotalWeight();
// halt if converged
double change = newLamba - lambda;
if (iterations>maxIterate || (change>= -minChange && change<=minChange)) break;
else lambda = newLamba;
}
return lambda;
} | [
"public",
"double",
"score",
"(",
"StringWrapper",
"s",
",",
"StringWrapper",
"t",
")",
"{",
"BagOfTokens",
"sBag",
"=",
"asBagOfTokens",
"(",
"s",
")",
";",
"BagOfTokens",
"tBag",
"=",
"asBagOfTokens",
"(",
"t",
")",
";",
"double",
"lambda",
"=",
"0.5",
... | Distance is argmax_lambda prod_{w in s} lambda Pr(w|t) * (1-lambda) Pr(w|background).
This is computed with E/M. | [
"Distance",
"is",
"argmax_lambda",
"prod_",
"{",
"w",
"in",
"s",
"}",
"lambda",
"Pr",
"(",
"w|t",
")",
"*",
"(",
"1",
"-",
"lambda",
")",
"Pr",
"(",
"w|background",
")",
".",
"This",
"is",
"computed",
"with",
"E",
"/",
"M",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/Mixture.java#L21-L51 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsListItem.java | CmsListItem.initContent | protected void initContent(CmsCheckBox checkbox, Widget mainWidget) {
addCheckBox(checkbox);
addMainWidget(mainWidget);
initContent();
} | java | protected void initContent(CmsCheckBox checkbox, Widget mainWidget) {
addCheckBox(checkbox);
addMainWidget(mainWidget);
initContent();
} | [
"protected",
"void",
"initContent",
"(",
"CmsCheckBox",
"checkbox",
",",
"Widget",
"mainWidget",
")",
"{",
"addCheckBox",
"(",
"checkbox",
")",
";",
"addMainWidget",
"(",
"mainWidget",
")",
";",
"initContent",
"(",
")",
";",
"}"
] | This method is a convenience method which sets the checkbox and main widget of this widget, and then calls {@link CmsListItem#initContent()}.<p>
@param checkbox the checkbox to add
@param mainWidget the mainWidget to add | [
"This",
"method",
"is",
"a",
"convenience",
"method",
"which",
"sets",
"the",
"checkbox",
"and",
"main",
"widget",
"of",
"this",
"widget",
"and",
"then",
"calls",
"{",
"@link",
"CmsListItem#initContent",
"()",
"}",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsListItem.java#L652-L657 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/TagsApi.java | TagsApi.getHotList | public HotList getHotList(JinxConstants.Period period, Integer count) throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getHotList");
if (period != null) {
params.put("period", period.toString());
}
if (count != null && count > 0) {
params.put("count", count.toString());
}
return jinx.flickrGet(params, HotList.class, false);
} | java | public HotList getHotList(JinxConstants.Period period, Integer count) throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getHotList");
if (period != null) {
params.put("period", period.toString());
}
if (count != null && count > 0) {
params.put("count", count.toString());
}
return jinx.flickrGet(params, HotList.class, false);
} | [
"public",
"HotList",
"getHotList",
"(",
"JinxConstants",
".",
"Period",
"period",
",",
"Integer",
"count",
")",
"throws",
"JinxException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
... | Returns a list of hot tags for the given period.
This method does not require authentication.
@param period period for which to fetch hot tags. Optional.
@param count number of tags to return. Defaults to 20. Maximum allowed value is 200. Optional.
@return hot tags for the given period.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.tags.getHotList.html">flickr.tags.getHotList</a> | [
"Returns",
"a",
"list",
"of",
"hot",
"tags",
"for",
"the",
"given",
"period",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/TagsApi.java#L126-L136 |
CodeNarc/CodeNarc | src/main/java/org/codenarc/rule/AbstractMethodVisitor.java | AbstractMethodVisitor.addViolation | protected void addViolation(MethodNode node, String message) {
addViolation((ASTNode) node, String.format(
"Violation in class %s. %s", node.getDeclaringClass().getNameWithoutPackage(), message
));
} | java | protected void addViolation(MethodNode node, String message) {
addViolation((ASTNode) node, String.format(
"Violation in class %s. %s", node.getDeclaringClass().getNameWithoutPackage(), message
));
} | [
"protected",
"void",
"addViolation",
"(",
"MethodNode",
"node",
",",
"String",
"message",
")",
"{",
"addViolation",
"(",
"(",
"ASTNode",
")",
"node",
",",
"String",
".",
"format",
"(",
"\"Violation in class %s. %s\"",
",",
"node",
".",
"getDeclaringClass",
"(",
... | Add a new Violation to the list of violations found by this visitor.
Only add the violation if the node lineNumber >= 0.
@param node - the Groovy AST Node
@param message - the message for the violation; defaults to null | [
"Add",
"a",
"new",
"Violation",
"to",
"the",
"list",
"of",
"violations",
"found",
"by",
"this",
"visitor",
".",
"Only",
"add",
"the",
"violation",
"if",
"the",
"node",
"lineNumber",
">",
"=",
"0",
"."
] | train | https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/rule/AbstractMethodVisitor.java#L76-L80 |
Stratio/deep-spark | deep-commons/src/main/java/com/stratio/deep/commons/config/ExtractorConfig.java | ExtractorConfig.getPair | public <K, V> Pair<K, V> getPair(String key, Class<K> keyClass, Class<V> valueClass) {
return getValue(Pair.class, key);
} | java | public <K, V> Pair<K, V> getPair(String key, Class<K> keyClass, Class<V> valueClass) {
return getValue(Pair.class, key);
} | [
"public",
"<",
"K",
",",
"V",
">",
"Pair",
"<",
"K",
",",
"V",
">",
"getPair",
"(",
"String",
"key",
",",
"Class",
"<",
"K",
">",
"keyClass",
",",
"Class",
"<",
"V",
">",
"valueClass",
")",
"{",
"return",
"getValue",
"(",
"Pair",
".",
"class",
... | Gets pair.
@param key the key
@param keyClass the key class
@param valueClass the value class
@return the pair | [
"Gets",
"pair",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/config/ExtractorConfig.java#L221-L223 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/AbstractRedisClient.java | AbstractRedisClient.initializeChannelAsync | @SuppressWarnings("unchecked")
protected <K, V, T extends RedisChannelHandler<K, V>> ConnectionFuture<T> initializeChannelAsync(
ConnectionBuilder connectionBuilder) {
Mono<SocketAddress> socketAddressSupplier = connectionBuilder.socketAddress();
if (clientResources.eventExecutorGroup().isShuttingDown()) {
throw new IllegalStateException("Cannot connect, Event executor group is terminated.");
}
CompletableFuture<SocketAddress> socketAddressFuture = new CompletableFuture<>();
CompletableFuture<Channel> channelReadyFuture = new CompletableFuture<>();
socketAddressSupplier.doOnError(socketAddressFuture::completeExceptionally).doOnNext(socketAddressFuture::complete)
.subscribe(redisAddress -> {
if (channelReadyFuture.isCancelled()) {
return;
}
initializeChannelAsync0(connectionBuilder, channelReadyFuture, redisAddress);
}, channelReadyFuture::completeExceptionally);
return new DefaultConnectionFuture<>(socketAddressFuture, channelReadyFuture.thenApply(channel -> (T) connectionBuilder
.connection()));
} | java | @SuppressWarnings("unchecked")
protected <K, V, T extends RedisChannelHandler<K, V>> ConnectionFuture<T> initializeChannelAsync(
ConnectionBuilder connectionBuilder) {
Mono<SocketAddress> socketAddressSupplier = connectionBuilder.socketAddress();
if (clientResources.eventExecutorGroup().isShuttingDown()) {
throw new IllegalStateException("Cannot connect, Event executor group is terminated.");
}
CompletableFuture<SocketAddress> socketAddressFuture = new CompletableFuture<>();
CompletableFuture<Channel> channelReadyFuture = new CompletableFuture<>();
socketAddressSupplier.doOnError(socketAddressFuture::completeExceptionally).doOnNext(socketAddressFuture::complete)
.subscribe(redisAddress -> {
if (channelReadyFuture.isCancelled()) {
return;
}
initializeChannelAsync0(connectionBuilder, channelReadyFuture, redisAddress);
}, channelReadyFuture::completeExceptionally);
return new DefaultConnectionFuture<>(socketAddressFuture, channelReadyFuture.thenApply(channel -> (T) connectionBuilder
.connection()));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"K",
",",
"V",
",",
"T",
"extends",
"RedisChannelHandler",
"<",
"K",
",",
"V",
">",
">",
"ConnectionFuture",
"<",
"T",
">",
"initializeChannelAsync",
"(",
"ConnectionBuilder",
"connectionBuild... | Connect and initialize a channel from {@link ConnectionBuilder}.
@param connectionBuilder must not be {@literal null}.
@return the {@link ConnectionFuture} to synchronize the connection process.
@since 4.4 | [
"Connect",
"and",
"initialize",
"a",
"channel",
"from",
"{",
"@link",
"ConnectionBuilder",
"}",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/AbstractRedisClient.java#L275-L299 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java | TreeUtil.findWComponent | public static ComponentWithContext findWComponent(final WComponent component,
final String[] path) {
return findWComponent(component, path, true);
} | java | public static ComponentWithContext findWComponent(final WComponent component,
final String[] path) {
return findWComponent(component, path, true);
} | [
"public",
"static",
"ComponentWithContext",
"findWComponent",
"(",
"final",
"WComponent",
"component",
",",
"final",
"String",
"[",
"]",
"path",
")",
"{",
"return",
"findWComponent",
"(",
"component",
",",
"path",
",",
"true",
")",
";",
"}"
] | Retrieves the first WComponent by its path in the WComponent tree. See
{@link #findWComponents(WComponent, String[])} for a description of paths.
<p>
Searches only visible components.
</p>
@param component the component to search from.
@param path the path to the WComponent.
@return the first component matching the given path, or null if not found. | [
"Retrieves",
"the",
"first",
"WComponent",
"by",
"its",
"path",
"in",
"the",
"WComponent",
"tree",
".",
"See",
"{",
"@link",
"#findWComponents",
"(",
"WComponent",
"String",
"[]",
")",
"}",
"for",
"a",
"description",
"of",
"paths",
".",
"<p",
">",
"Searche... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java#L483-L486 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/formatting/PatternMatchingSupport.java | PatternMatchingSupport.valueMatchesRegularExpression | public static boolean valueMatchesRegularExpression(String val, String regexp) {
Pattern p = cache.get(regexp);
if(p == null) {
p = Pattern.compile(regexp);
cache.put(regexp, p);
}
return valueMatchesRegularExpression(val, p);
} | java | public static boolean valueMatchesRegularExpression(String val, String regexp) {
Pattern p = cache.get(regexp);
if(p == null) {
p = Pattern.compile(regexp);
cache.put(regexp, p);
}
return valueMatchesRegularExpression(val, p);
} | [
"public",
"static",
"boolean",
"valueMatchesRegularExpression",
"(",
"String",
"val",
",",
"String",
"regexp",
")",
"{",
"Pattern",
"p",
"=",
"cache",
".",
"get",
"(",
"regexp",
")",
";",
"if",
"(",
"p",
"==",
"null",
")",
"{",
"p",
"=",
"Pattern",
"."... | Returns true only if the value matches the regular expression
only once and exactly.
@param val string value that may match the expression
@param regexp regular expression
@return true if val matches regular expression regexp | [
"Returns",
"true",
"only",
"if",
"the",
"value",
"matches",
"the",
"regular",
"expression",
"only",
"once",
"and",
"exactly",
"."
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/formatting/PatternMatchingSupport.java#L46-L53 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java | UnicodeSet._appendToPat | private static <T extends Appendable> T _appendToPat(T buf, int c, boolean escapeUnprintable) {
try {
if (escapeUnprintable && Utility.isUnprintable(c)) {
// Use hex escape notation (<backslash>uxxxx or <backslash>Uxxxxxxxx) for anything
// unprintable
if (Utility.escapeUnprintable(buf, c)) {
return buf;
}
}
// Okay to let ':' pass through
switch (c) {
case '[': // SET_OPEN:
case ']': // SET_CLOSE:
case '-': // HYPHEN:
case '^': // COMPLEMENT:
case '&': // INTERSECTION:
case '\\': //BACKSLASH:
case '{':
case '}':
case '$':
case ':':
buf.append('\\');
break;
default:
// Escape whitespace
if (PatternProps.isWhiteSpace(c)) {
buf.append('\\');
}
break;
}
appendCodePoint(buf, c);
return buf;
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
} | java | private static <T extends Appendable> T _appendToPat(T buf, int c, boolean escapeUnprintable) {
try {
if (escapeUnprintable && Utility.isUnprintable(c)) {
// Use hex escape notation (<backslash>uxxxx or <backslash>Uxxxxxxxx) for anything
// unprintable
if (Utility.escapeUnprintable(buf, c)) {
return buf;
}
}
// Okay to let ':' pass through
switch (c) {
case '[': // SET_OPEN:
case ']': // SET_CLOSE:
case '-': // HYPHEN:
case '^': // COMPLEMENT:
case '&': // INTERSECTION:
case '\\': //BACKSLASH:
case '{':
case '}':
case '$':
case ':':
buf.append('\\');
break;
default:
// Escape whitespace
if (PatternProps.isWhiteSpace(c)) {
buf.append('\\');
}
break;
}
appendCodePoint(buf, c);
return buf;
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
} | [
"private",
"static",
"<",
"T",
"extends",
"Appendable",
">",
"T",
"_appendToPat",
"(",
"T",
"buf",
",",
"int",
"c",
",",
"boolean",
"escapeUnprintable",
")",
"{",
"try",
"{",
"if",
"(",
"escapeUnprintable",
"&&",
"Utility",
".",
"isUnprintable",
"(",
"c",
... | Append the <code>toPattern()</code> representation of a
character to the given <code>Appendable</code>. | [
"Append",
"the",
"<code",
">",
"toPattern",
"()",
"<",
"/",
"code",
">",
"representation",
"of",
"a",
"character",
"to",
"the",
"given",
"<code",
">",
"Appendable<",
"/",
"code",
">",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L636-L671 |
borball/weixin-sdk | weixin-mp/src/main/java/com/riversoft/weixin/mp/media/Materials.java | Materials.addVideo | public Material addVideo(InputStream inputStream, String fileName, String title, String description) {
String url = WxEndpoint.get("url.material.binary.upload");
String desc = "{\"title\":\"%s\",\"introduction\":\"%s\"}";
Map<String, String> form = new HashMap<>();
form.put("description", String.format(desc, title, description));
String response = wxClient.post(String.format(url, MediaType.video.name()), inputStream, fileName, form);
Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response);
if (result.containsKey("media_id")) {
return JsonMapper.defaultMapper().fromJson(response, Material.class);
} else {
logger.warn("image upload failed: {}", response);
throw new WxRuntimeException(999, response);
}
} | java | public Material addVideo(InputStream inputStream, String fileName, String title, String description) {
String url = WxEndpoint.get("url.material.binary.upload");
String desc = "{\"title\":\"%s\",\"introduction\":\"%s\"}";
Map<String, String> form = new HashMap<>();
form.put("description", String.format(desc, title, description));
String response = wxClient.post(String.format(url, MediaType.video.name()), inputStream, fileName, form);
Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response);
if (result.containsKey("media_id")) {
return JsonMapper.defaultMapper().fromJson(response, Material.class);
} else {
logger.warn("image upload failed: {}", response);
throw new WxRuntimeException(999, response);
}
} | [
"public",
"Material",
"addVideo",
"(",
"InputStream",
"inputStream",
",",
"String",
"fileName",
",",
"String",
"title",
",",
"String",
"description",
")",
"{",
"String",
"url",
"=",
"WxEndpoint",
".",
"get",
"(",
"\"url.material.binary.upload\"",
")",
";",
"Stri... | 上传视频
@param inputStream 视频流
@param fileName 文件名
@param title title
@param description 描述
@return 上传结果 | [
"上传视频"
] | train | https://github.com/borball/weixin-sdk/blob/32bf5e45cdd8d0d28074e83954e1ec62dcf25cb7/weixin-mp/src/main/java/com/riversoft/weixin/mp/media/Materials.java#L198-L212 |
threerings/narya | core/src/main/java/com/threerings/crowd/chat/server/ChatProvider.java | ChatProvider.deliverTell | public void deliverTell (BodyObject target, UserMessage message)
{
SpeakUtil.sendMessage(target, message);
// note that the teller "heard" what they said
SpeakUtil.noteMessage(target, message.speaker, message);
} | java | public void deliverTell (BodyObject target, UserMessage message)
{
SpeakUtil.sendMessage(target, message);
// note that the teller "heard" what they said
SpeakUtil.noteMessage(target, message.speaker, message);
} | [
"public",
"void",
"deliverTell",
"(",
"BodyObject",
"target",
",",
"UserMessage",
"message",
")",
"{",
"SpeakUtil",
".",
"sendMessage",
"(",
"target",
",",
"message",
")",
";",
"// note that the teller \"heard\" what they said",
"SpeakUtil",
".",
"noteMessage",
"(",
... | Delivers a tell notification to the specified target player. It is assumed that the message
is coming from some server entity and need not be permissions checked or notified of the
result. | [
"Delivers",
"a",
"tell",
"notification",
"to",
"the",
"specified",
"target",
"player",
".",
"It",
"is",
"assumed",
"that",
"the",
"message",
"is",
"coming",
"from",
"some",
"server",
"entity",
"and",
"need",
"not",
"be",
"permissions",
"checked",
"or",
"noti... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/server/ChatProvider.java#L261-L267 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/XMLUtils.java | XMLUtils.getElementNode | public static Element getElementNode(final Element element, final DitaClass classValue) {
final NodeList list = element.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
final Node node = list.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
final Element child = (Element) node;
if (classValue.matches(child)) {
return child;
}
}
}
return null;
} | java | public static Element getElementNode(final Element element, final DitaClass classValue) {
final NodeList list = element.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
final Node node = list.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
final Element child = (Element) node;
if (classValue.matches(child)) {
return child;
}
}
}
return null;
} | [
"public",
"static",
"Element",
"getElementNode",
"(",
"final",
"Element",
"element",
",",
"final",
"DitaClass",
"classValue",
")",
"{",
"final",
"NodeList",
"list",
"=",
"element",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",... | Get specific element node from child nodes.
@param element parent node
@param classValue DITA class to search for
@return element node, {@code null} if not found | [
"Get",
"specific",
"element",
"node",
"from",
"child",
"nodes",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLUtils.java#L241-L253 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/datastyle/NumberStyleHelper.java | NumberStyleHelper.appendStyleMap | private void appendStyleMap(final XMLUtil util, final Appendable appendable) throws IOException {
appendable.append("<style:map");
util.appendEAttribute(appendable, "style:condition", "value()>=0");
util.appendEAttribute(appendable, "style:apply-style-name", this.dataStyle.getName());
appendable.append("/>");
} | java | private void appendStyleMap(final XMLUtil util, final Appendable appendable) throws IOException {
appendable.append("<style:map");
util.appendEAttribute(appendable, "style:condition", "value()>=0");
util.appendEAttribute(appendable, "style:apply-style-name", this.dataStyle.getName());
appendable.append("/>");
} | [
"private",
"void",
"appendStyleMap",
"(",
"final",
"XMLUtil",
"util",
",",
"final",
"Appendable",
"appendable",
")",
"throws",
"IOException",
"{",
"appendable",
".",
"append",
"(",
"\"<style:map\"",
")",
";",
"util",
".",
"appendEAttribute",
"(",
"appendable",
"... | Appends 16.3 style:map tag.
@param util XML util for escaping
@param appendable where to write
@throws IOException If an I/O error occurs | [
"Appends",
"16",
".",
"3",
"style",
":",
"map",
"tag",
"."
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/datastyle/NumberStyleHelper.java#L144-L149 |
jingwei/krati | krati-main/src/retention/java/krati/retention/SimplePosition.java | SimplePosition.parsePosition | public static SimplePosition parsePosition(String s) {
String[] parts = s.split(":");
int id = Integer.parseInt(parts[0]);
long offset = Long.parseLong(parts[1]);
int index = Integer.parseInt(parts[2]);
if(parts.length == 3) {
return new SimplePosition(id, offset, index, Clock.ZERO);
}
long[] values = new long[parts.length - 3];
for(int i = 0; i < values.length; i++) {
values[i] = Long.parseLong(parts[3+i]);
}
return new SimplePosition(id, offset, index, new Clock(values));
} | java | public static SimplePosition parsePosition(String s) {
String[] parts = s.split(":");
int id = Integer.parseInt(parts[0]);
long offset = Long.parseLong(parts[1]);
int index = Integer.parseInt(parts[2]);
if(parts.length == 3) {
return new SimplePosition(id, offset, index, Clock.ZERO);
}
long[] values = new long[parts.length - 3];
for(int i = 0; i < values.length; i++) {
values[i] = Long.parseLong(parts[3+i]);
}
return new SimplePosition(id, offset, index, new Clock(values));
} | [
"public",
"static",
"SimplePosition",
"parsePosition",
"(",
"String",
"s",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"s",
".",
"split",
"(",
"\":\"",
")",
";",
"int",
"id",
"=",
"Integer",
".",
"parseInt",
"(",
"parts",
"[",
"0",
"]",
")",
";",
"... | Parses a string representation of <tt>SimplePosition</tt> in the form of <tt>Id:Offset:Index:Clock</tt>.
<p>
For example, <tt>1:128956235:59272:12789234:12789257:12789305</tt> defines a position with <tt>Id=1</tt>,
<tt>Offset=128956235</tt>, <tt>Index=59272</tt> and <tt>Clock=12789234:12789257:12789305</tt>.
@param s - the string representation of a position.
@throws <tt>NullPointerException</tt> if the string <tt>s</tt> is null.
@throws <tt>NumberFormatException</tt> if the string <tt>s</tt> contains non-parsable <tt>int</tt> or <tt>long</tt>. | [
"Parses",
"a",
"string",
"representation",
"of",
"<tt",
">",
"SimplePosition<",
"/",
"tt",
">",
"in",
"the",
"form",
"of",
"<tt",
">",
"Id",
":",
"Offset",
":",
"Index",
":",
"Clock<",
"/",
"tt",
">",
"."
] | train | https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/retention/java/krati/retention/SimplePosition.java#L130-L146 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_Svf.java | ST_Svf.computeSvf | public static double computeSvf(Point pt, Geometry geoms, double distance, int rayCount) {
return computeSvf(pt, geoms, distance, rayCount, RAY_STEP_LENGTH);
} | java | public static double computeSvf(Point pt, Geometry geoms, double distance, int rayCount) {
return computeSvf(pt, geoms, distance, rayCount, RAY_STEP_LENGTH);
} | [
"public",
"static",
"double",
"computeSvf",
"(",
"Point",
"pt",
",",
"Geometry",
"geoms",
",",
"double",
"distance",
",",
"int",
"rayCount",
")",
"{",
"return",
"computeSvf",
"(",
"pt",
",",
"geoms",
",",
"distance",
",",
"rayCount",
",",
"RAY_STEP_LENGTH",
... | The method to compute the Sky View Factor
@param pt
@param distance
@param rayCount number of rays
@param geoms
@return | [
"The",
"method",
"to",
"compute",
"the",
"Sky",
"View",
"Factor"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/ST_Svf.java#L66-L68 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java | StringUtils.toStringBuilder | public static StringBuilder toStringBuilder(Collection<? extends Object> collection, String delimiter) {
StringBuilder sb = new StringBuilder(collection.size() * 20);
for (Iterator<? extends Object> it = collection.iterator(); it.hasNext();) {
Object cs = it.next();
sb.append(cs);
if (it.hasNext()) {
sb.append(delimiter);
}
}
return sb;
} | java | public static StringBuilder toStringBuilder(Collection<? extends Object> collection, String delimiter) {
StringBuilder sb = new StringBuilder(collection.size() * 20);
for (Iterator<? extends Object> it = collection.iterator(); it.hasNext();) {
Object cs = it.next();
sb.append(cs);
if (it.hasNext()) {
sb.append(delimiter);
}
}
return sb;
} | [
"public",
"static",
"StringBuilder",
"toStringBuilder",
"(",
"Collection",
"<",
"?",
"extends",
"Object",
">",
"collection",
",",
"String",
"delimiter",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"collection",
".",
"size",
"(",
")",
"*"... | Transform a collection of objects to a delimited String.
@param collection the collection to transform.
@param delimiter the delimiter used to delimit the Strings.
@return a StringBuilder with all the elements of the collection. | [
"Transform",
"a",
"collection",
"of",
"objects",
"to",
"a",
"delimited",
"String",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java#L390-L400 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java | WebSocketClientHandshakerFactory.newHandshaker | public static WebSocketClientHandshaker newHandshaker(
URI webSocketURL, WebSocketVersion version, String subprotocol,
boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) {
return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders,
maxFramePayloadLength, true, false);
} | java | public static WebSocketClientHandshaker newHandshaker(
URI webSocketURL, WebSocketVersion version, String subprotocol,
boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength) {
return newHandshaker(webSocketURL, version, subprotocol, allowExtensions, customHeaders,
maxFramePayloadLength, true, false);
} | [
"public",
"static",
"WebSocketClientHandshaker",
"newHandshaker",
"(",
"URI",
"webSocketURL",
",",
"WebSocketVersion",
"version",
",",
"String",
"subprotocol",
",",
"boolean",
"allowExtensions",
",",
"HttpHeaders",
"customHeaders",
",",
"int",
"maxFramePayloadLength",
")"... | Creates a new handshaker.
@param webSocketURL
URL for web socket communications. e.g "ws://myhost.com/mypath".
Subsequent web socket frames will be sent to this URL.
@param version
Version of web socket specification to use to connect to the server
@param subprotocol
Sub protocol request sent to the server. Null if no sub-protocol support is required.
@param allowExtensions
Allow extensions to be used in the reserved bits of the web socket frame
@param customHeaders
Custom HTTP headers to send during the handshake
@param maxFramePayloadLength
Maximum allowable frame payload length. Setting this value to your application's
requirement may reduce denial of service attacks using long data frames. | [
"Creates",
"a",
"new",
"handshaker",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshakerFactory.java#L74-L79 |
likethecolor/Alchemy-API | src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java | AbstractParser.getJSONArray | protected JSONArray getJSONArray(final String key, final JSONObject jsonObject) {
JSONArray value = new JSONArray();
if(hasKey(key, jsonObject)) {
try {
value = jsonObject.getJSONArray(key);
}
catch(JSONException e) {
LOGGER.error("Could not get JSONArray from JSONObject for key: " + key, e);
}
}
return value;
} | java | protected JSONArray getJSONArray(final String key, final JSONObject jsonObject) {
JSONArray value = new JSONArray();
if(hasKey(key, jsonObject)) {
try {
value = jsonObject.getJSONArray(key);
}
catch(JSONException e) {
LOGGER.error("Could not get JSONArray from JSONObject for key: " + key, e);
}
}
return value;
} | [
"protected",
"JSONArray",
"getJSONArray",
"(",
"final",
"String",
"key",
",",
"final",
"JSONObject",
"jsonObject",
")",
"{",
"JSONArray",
"value",
"=",
"new",
"JSONArray",
"(",
")",
";",
"if",
"(",
"hasKey",
"(",
"key",
",",
"jsonObject",
")",
")",
"{",
... | Check to make sure the JSONObject has the specified key and if so return
the value as a JSONArray. If no key is found an empty JSONArray is
returned.
@param key name of the field to fetch from the json object
@param jsonObject object from which to fetch the value
@return json array value corresponding to the key or "" if key not found | [
"Check",
"to",
"make",
"sure",
"the",
"JSONObject",
"has",
"the",
"specified",
"key",
"and",
"if",
"so",
"return",
"the",
"value",
"as",
"a",
"JSONArray",
".",
"If",
"no",
"key",
"is",
"found",
"an",
"empty",
"JSONArray",
"is",
"returned",
"."
] | train | https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java#L256-L267 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/io/SynchronizedIO.java | SynchronizedIO.writeFile | public void writeFile(String filePath, byte[] data) throws IOException
{
Object lock = retrieveLock(filePath);
synchronized (lock)
{
IO.writeFile(filePath, data);
}
} | java | public void writeFile(String filePath, byte[] data) throws IOException
{
Object lock = retrieveLock(filePath);
synchronized (lock)
{
IO.writeFile(filePath, data);
}
} | [
"public",
"void",
"writeFile",
"(",
"String",
"filePath",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"IOException",
"{",
"Object",
"lock",
"=",
"retrieveLock",
"(",
"filePath",
")",
";",
"synchronized",
"(",
"lock",
")",
"{",
"IO",
".",
"writeFile",
"... | Write binary file data
@param filePath the file path to write
@param data the write
@throws IOException when IO error occurs | [
"Write",
"binary",
"file",
"data"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/io/SynchronizedIO.java#L86-L93 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.xmlGlobalExistent | public static void xmlGlobalExistent(Class<?> aClass) {
throw new XmlMappingGlobalExistException(MSG.INSTANCE.message(xmlMappingGlobalExistException, aClass.getSimpleName()));
} | java | public static void xmlGlobalExistent(Class<?> aClass) {
throw new XmlMappingGlobalExistException(MSG.INSTANCE.message(xmlMappingGlobalExistException, aClass.getSimpleName()));
} | [
"public",
"static",
"void",
"xmlGlobalExistent",
"(",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"throw",
"new",
"XmlMappingGlobalExistException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"xmlMappingGlobalExistException",
",",
"aClass",
".",
"getSimpleNa... | Thrown when global mapping is absent from XML configuration file.
@param aClass class | [
"Thrown",
"when",
"global",
"mapping",
"is",
"absent",
"from",
"XML",
"configuration",
"file",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L255-L257 |
phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.addRect | public void addRect (final float x, final float y, final float width, final float height) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: addRect is not allowed within a text block.");
}
writeOperand (x);
writeOperand (y);
writeOperand (width);
writeOperand (height);
writeOperator ((byte) 'r', (byte) 'e');
} | java | public void addRect (final float x, final float y, final float width, final float height) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: addRect is not allowed within a text block.");
}
writeOperand (x);
writeOperand (y);
writeOperand (width);
writeOperand (height);
writeOperator ((byte) 'r', (byte) 'e');
} | [
"public",
"void",
"addRect",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
",",
"final",
"float",
"width",
",",
"final",
"float",
"height",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateExcepti... | Add a rectangle to the current path.
@param x
The lower left x coordinate.
@param y
The lower left y coordinate.
@param width
The width of the rectangle.
@param height
The height of the rectangle.
@throws IOException
If the content stream could not be written.
@throws IllegalStateException
If the method was called within a text block. | [
"Add",
"a",
"rectangle",
"to",
"the",
"current",
"path",
"."
] | train | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1093-L1104 |
buschmais/jqa-rdbms-plugin | src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java | AbstractSchemaScannerPlugin.scanConnection | protected List<SchemaDescriptor> scanConnection(String url, String user, String password, String infoLevelName, String bundledDriverName,
Properties properties, Store store) throws IOException {
LOGGER.info("Scanning schema '{}'", url);
Catalog catalog = getCatalog(url, user, password, infoLevelName, bundledDriverName, properties);
return createSchemas(catalog, store);
} | java | protected List<SchemaDescriptor> scanConnection(String url, String user, String password, String infoLevelName, String bundledDriverName,
Properties properties, Store store) throws IOException {
LOGGER.info("Scanning schema '{}'", url);
Catalog catalog = getCatalog(url, user, password, infoLevelName, bundledDriverName, properties);
return createSchemas(catalog, store);
} | [
"protected",
"List",
"<",
"SchemaDescriptor",
">",
"scanConnection",
"(",
"String",
"url",
",",
"String",
"user",
",",
"String",
"password",
",",
"String",
"infoLevelName",
",",
"String",
"bundledDriverName",
",",
"Properties",
"properties",
",",
"Store",
"store",... | Scans the connection identified by the given parameters.
@param url The url.
@param user The user.
@param password The password.
@param properties The properties to pass to schema crawler.
@param infoLevelName The name of the info level to use.
@param bundledDriverName The name of the bundled driver as provided by schema crawler.
@param store The store.
@return The list of created schema descriptors.
@throws java.io.IOException If retrieval fails. | [
"Scans",
"the",
"connection",
"identified",
"by",
"the",
"given",
"parameters",
"."
] | train | https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/AbstractSchemaScannerPlugin.java#L53-L58 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/file/FileCopier.java | FileCopier.create | public static FileCopier create(String srcPath, String destPath) {
return new FileCopier(FileUtil.file(srcPath), FileUtil.file(destPath));
} | java | public static FileCopier create(String srcPath, String destPath) {
return new FileCopier(FileUtil.file(srcPath), FileUtil.file(destPath));
} | [
"public",
"static",
"FileCopier",
"create",
"(",
"String",
"srcPath",
",",
"String",
"destPath",
")",
"{",
"return",
"new",
"FileCopier",
"(",
"FileUtil",
".",
"file",
"(",
"srcPath",
")",
",",
"FileUtil",
".",
"file",
"(",
"destPath",
")",
")",
";",
"}"... | 新建一个文件复制器
@param srcPath 源文件路径(相对ClassPath路径或绝对路径)
@param destPath 目标文件路径(相对ClassPath路径或绝对路径)
@return {@link FileCopier} | [
"新建一个文件复制器"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/file/FileCopier.java#L47-L49 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.mkdirs | public static boolean mkdirs(FileSystem fs, Path dir, FsPermission permission)
throws IOException {
// create the directory using the default permission
boolean result = fs.mkdirs(dir);
// set its permission to be the supplied one
fs.setPermission(dir, permission);
return result;
} | java | public static boolean mkdirs(FileSystem fs, Path dir, FsPermission permission)
throws IOException {
// create the directory using the default permission
boolean result = fs.mkdirs(dir);
// set its permission to be the supplied one
fs.setPermission(dir, permission);
return result;
} | [
"public",
"static",
"boolean",
"mkdirs",
"(",
"FileSystem",
"fs",
",",
"Path",
"dir",
",",
"FsPermission",
"permission",
")",
"throws",
"IOException",
"{",
"// create the directory using the default permission",
"boolean",
"result",
"=",
"fs",
".",
"mkdirs",
"(",
"d... | create a directory with the provided permission
The permission of the directory is set to be the provided permission as in
setPermission, not permission&~umask
@see #create(FileSystem, Path, FsPermission)
@param fs file system handle
@param dir the name of the directory to be created
@param permission the permission of the directory
@return true if the directory creation succeeds; false otherwise
@throws IOException | [
"create",
"a",
"directory",
"with",
"the",
"provided",
"permission",
"The",
"permission",
"of",
"the",
"directory",
"is",
"set",
"to",
"be",
"the",
"provided",
"permission",
"as",
"in",
"setPermission",
"not",
"permission&~umask"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L328-L335 |
JoeKerouac/utils | src/main/java/com/joe/utils/img/IQRCode.java | IQRCode.createQRCode | private static QRCode createQRCode(String data, int width, int height) {
logger.debug("生成二维码,要生成的图片的宽为{},高为{}", width, height);
QRCode code = QRCode.from(data);
code.withCharset("UTF8");
code.withSize(width, height);
logger.debug("二维码生成成功");
return code;
} | java | private static QRCode createQRCode(String data, int width, int height) {
logger.debug("生成二维码,要生成的图片的宽为{},高为{}", width, height);
QRCode code = QRCode.from(data);
code.withCharset("UTF8");
code.withSize(width, height);
logger.debug("二维码生成成功");
return code;
} | [
"private",
"static",
"QRCode",
"createQRCode",
"(",
"String",
"data",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"logger",
".",
"debug",
"(",
"\"生成二维码,要生成的图片的宽为{},高为{}\", width, height);",
"",
"",
"",
"",
"",
"",
"QRCode",
"code",
"=",
"QRCode",
... | 将指定数据生成二维码
@param data 二维码数据
@param width 图片的宽
@param height 图片的高
@return QRCode QRCode | [
"将指定数据生成二维码"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/img/IQRCode.java#L127-L134 |
aws/aws-sdk-java | aws-java-sdk-appstream/src/main/java/com/amazonaws/services/appstream/model/Application.java | Application.withMetadata | public Application withMetadata(java.util.Map<String, String> metadata) {
setMetadata(metadata);
return this;
} | java | public Application withMetadata(java.util.Map<String, String> metadata) {
setMetadata(metadata);
return this;
} | [
"public",
"Application",
"withMetadata",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"metadata",
")",
"{",
"setMetadata",
"(",
"metadata",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Additional attributes that describe the application.
</p>
@param metadata
Additional attributes that describe the application.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Additional",
"attributes",
"that",
"describe",
"the",
"application",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-appstream/src/main/java/com/amazonaws/services/appstream/model/Application.java#L361-L364 |
BlueBrain/bluima | modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/tools/sentdetect/SDContextGenerator.java | SDContextGenerator.nextSpaceIndex | private static final int nextSpaceIndex(StringBuffer sb, int seek, int lastIndex) {
seek++;
char c;
while (seek < lastIndex) {
c = sb.charAt(seek);
if (c == ' ' || c == '\n') {
while (sb.length() > seek + 1 && sb.charAt(seek + 1) == ' ')
seek++;
return seek;
}
seek++;
}
return lastIndex;
} | java | private static final int nextSpaceIndex(StringBuffer sb, int seek, int lastIndex) {
seek++;
char c;
while (seek < lastIndex) {
c = sb.charAt(seek);
if (c == ' ' || c == '\n') {
while (sb.length() > seek + 1 && sb.charAt(seek + 1) == ' ')
seek++;
return seek;
}
seek++;
}
return lastIndex;
} | [
"private",
"static",
"final",
"int",
"nextSpaceIndex",
"(",
"StringBuffer",
"sb",
",",
"int",
"seek",
",",
"int",
"lastIndex",
")",
"{",
"seek",
"++",
";",
"char",
"c",
";",
"while",
"(",
"seek",
"<",
"lastIndex",
")",
"{",
"c",
"=",
"sb",
".",
"char... | Finds the index of the nearest space after a specified index.
@param sb The string buffer which contains the text being examined.
@param seek The index to begin searching from.
@param lastIndex The highest index of the StringBuffer sb.
@return The index which contains the nearest space. | [
"Finds",
"the",
"index",
"of",
"the",
"nearest",
"space",
"after",
"a",
"specified",
"index",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/tools/sentdetect/SDContextGenerator.java#L240-L253 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.holdCall | public void holdCall(
String connId,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidanswerData holdData = new VoicecallsidanswerData();
holdData.setReasons(Util.toKVList(reasons));
holdData.setExtensions(Util.toKVList(extensions));
HoldData data = new HoldData();
data.data(holdData);
ApiSuccessResponse response = this.voiceApi.hold(connId, data);
throwIfNotOk("holdCall", response);
} catch (ApiException e) {
throw new WorkspaceApiException("holdCall failed.", e);
}
} | java | public void holdCall(
String connId,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidanswerData holdData = new VoicecallsidanswerData();
holdData.setReasons(Util.toKVList(reasons));
holdData.setExtensions(Util.toKVList(extensions));
HoldData data = new HoldData();
data.data(holdData);
ApiSuccessResponse response = this.voiceApi.hold(connId, data);
throwIfNotOk("holdCall", response);
} catch (ApiException e) {
throw new WorkspaceApiException("holdCall failed.", e);
}
} | [
"public",
"void",
"holdCall",
"(",
"String",
"connId",
",",
"KeyValueCollection",
"reasons",
",",
"KeyValueCollection",
"extensions",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"VoicecallsidanswerData",
"holdData",
"=",
"new",
"VoicecallsidanswerData",
"("... | Place the specified call on hold.
@param connId The connection ID of the call.
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) | [
"Place",
"the",
"specified",
"call",
"on",
"hold",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L567-L585 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateAround | public Matrix4f rotateAround(Quaternionfc quat, float ox, float oy, float oz, Matrix4f dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return rotationAround(quat, ox, oy, oz);
else if ((properties & PROPERTY_AFFINE) != 0)
return rotateAroundAffine(quat, ox, oy, oz, dest);
return rotateAroundGeneric(quat, ox, oy, oz, dest);
} | java | public Matrix4f rotateAround(Quaternionfc quat, float ox, float oy, float oz, Matrix4f dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return rotationAround(quat, ox, oy, oz);
else if ((properties & PROPERTY_AFFINE) != 0)
return rotateAroundAffine(quat, ox, oy, oz, dest);
return rotateAroundGeneric(quat, ox, oy, oz, dest);
} | [
"public",
"Matrix4f",
"rotateAround",
"(",
"Quaternionfc",
"quat",
",",
"float",
"ox",
",",
"float",
"oy",
",",
"float",
"oz",
",",
"Matrix4f",
"dest",
")",
"{",
"if",
"(",
"(",
"properties",
"&",
"PROPERTY_IDENTITY",
")",
"!=",
"0",
")",
"return",
"rota... | /* (non-Javadoc)
@see org.joml.Matrix4fc#rotateAround(org.joml.Quaternionfc, float, float, float, org.joml.Matrix4f) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L11277-L11283 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterTokenServices.java | TwitterTokenServices.isSuccessfulResult | protected boolean isSuccessfulResult(@Sensitive Map<String, Object> result, String endpoint) {
if (result == null) {
Tr.error(tc, "TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT", new Object[] { endpoint });
return false;
}
String responseStatus = result.containsKey(TwitterConstants.RESULT_RESPONSE_STATUS) ? (String) result.get(TwitterConstants.RESULT_RESPONSE_STATUS) : null;
String responseMsg = result.containsKey(TwitterConstants.RESULT_MESSAGE) ? (String) result.get(TwitterConstants.RESULT_MESSAGE) : null;
if (responseStatus == null) {
Tr.error(tc, "TWITTER_RESPONSE_STATUS_MISSING", new Object[] { endpoint });
return false;
}
if (!responseStatus.equals(TwitterConstants.RESULT_SUCCESS)) {
Tr.error(tc, "TWITTER_RESPONSE_FAILURE", new Object[] { endpoint, (responseMsg == null) ? "" : responseMsg });
return false;
}
return true;
} | java | protected boolean isSuccessfulResult(@Sensitive Map<String, Object> result, String endpoint) {
if (result == null) {
Tr.error(tc, "TWITTER_ERROR_OBTAINING_ENDPOINT_RESULT", new Object[] { endpoint });
return false;
}
String responseStatus = result.containsKey(TwitterConstants.RESULT_RESPONSE_STATUS) ? (String) result.get(TwitterConstants.RESULT_RESPONSE_STATUS) : null;
String responseMsg = result.containsKey(TwitterConstants.RESULT_MESSAGE) ? (String) result.get(TwitterConstants.RESULT_MESSAGE) : null;
if (responseStatus == null) {
Tr.error(tc, "TWITTER_RESPONSE_STATUS_MISSING", new Object[] { endpoint });
return false;
}
if (!responseStatus.equals(TwitterConstants.RESULT_SUCCESS)) {
Tr.error(tc, "TWITTER_RESPONSE_FAILURE", new Object[] { endpoint, (responseMsg == null) ? "" : responseMsg });
return false;
}
return true;
} | [
"protected",
"boolean",
"isSuccessfulResult",
"(",
"@",
"Sensitive",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
",",
"String",
"endpoint",
")",
"{",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"Tr",
".",
"error",
"(",
"tc",
",",
"\"TWITTER_ERRO... | Determines whether the result was successful by looking at the response status value contained in the result.
@param result
May contain token secrets, so has been annotated as @Sensitive.
@param endpoint
@return | [
"Determines",
"whether",
"the",
"result",
"was",
"successful",
"by",
"looking",
"at",
"the",
"response",
"status",
"value",
"contained",
"in",
"the",
"result",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterTokenServices.java#L233-L252 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java | SQLiteDatabase.dumpAll | static void dumpAll(Printer printer, boolean verbose) {
for (SQLiteDatabase db : getActiveDatabases()) {
db.dump(printer, verbose);
}
} | java | static void dumpAll(Printer printer, boolean verbose) {
for (SQLiteDatabase db : getActiveDatabases()) {
db.dump(printer, verbose);
}
} | [
"static",
"void",
"dumpAll",
"(",
"Printer",
"printer",
",",
"boolean",
"verbose",
")",
"{",
"for",
"(",
"SQLiteDatabase",
"db",
":",
"getActiveDatabases",
"(",
")",
")",
"{",
"db",
".",
"dump",
"(",
"printer",
",",
"verbose",
")",
";",
"}",
"}"
] | Dump detailed information about all open databases in the current process.
Used by bug report. | [
"Dump",
"detailed",
"information",
"about",
"all",
"open",
"databases",
"in",
"the",
"current",
"process",
".",
"Used",
"by",
"bug",
"report",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L2062-L2066 |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/util/ExternalEntryPointHelper.java | ExternalEntryPointHelper.getEntryPointDecoratedName | public static String getEntryPointDecoratedName(Method method, boolean scanEntryPointAnnotation) {
String decoratedName = method.getName();
if (scanEntryPointAnnotation) {
// we look at the method level
if (method.isAnnotationPresent(ExternalEntryPoint.class)) {
final ExternalEntryPoint externalEntryPoint = method.getAnnotation(ExternalEntryPoint.class);
if (StringUtils.isNotBlank(externalEntryPoint.name())) {
decoratedName = externalEntryPoint.name();
}
}
}
return decoratedName;
} | java | public static String getEntryPointDecoratedName(Method method, boolean scanEntryPointAnnotation) {
String decoratedName = method.getName();
if (scanEntryPointAnnotation) {
// we look at the method level
if (method.isAnnotationPresent(ExternalEntryPoint.class)) {
final ExternalEntryPoint externalEntryPoint = method.getAnnotation(ExternalEntryPoint.class);
if (StringUtils.isNotBlank(externalEntryPoint.name())) {
decoratedName = externalEntryPoint.name();
}
}
}
return decoratedName;
} | [
"public",
"static",
"String",
"getEntryPointDecoratedName",
"(",
"Method",
"method",
",",
"boolean",
"scanEntryPointAnnotation",
")",
"{",
"String",
"decoratedName",
"=",
"method",
".",
"getName",
"(",
")",
";",
"if",
"(",
"scanEntryPointAnnotation",
")",
"{",
"//... | Based on the input for scanning annotations, look for @ExternalEntryPoint and get the decorated name from it, if any.
@param method method to check
@param scanEntryPointAnnotation annotation
@return String | [
"Based",
"on",
"the",
"input",
"for",
"scanning",
"annotations",
"look",
"for",
"@ExternalEntryPoint",
"and",
"get",
"the",
"decorated",
"name",
"from",
"it",
"if",
"any",
"."
] | train | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/util/ExternalEntryPointHelper.java#L125-L140 |
google/gson | gson/src/main/java/com/google/gson/internal/LinkedHashTreeMap.java | LinkedHashTreeMap.rotateLeft | private void rotateLeft(Node<K, V> root) {
Node<K, V> left = root.left;
Node<K, V> pivot = root.right;
Node<K, V> pivotLeft = pivot.left;
Node<K, V> pivotRight = pivot.right;
// move the pivot's left child to the root's right
root.right = pivotLeft;
if (pivotLeft != null) {
pivotLeft.parent = root;
}
replaceInParent(root, pivot);
// move the root to the pivot's left
pivot.left = root;
root.parent = pivot;
// fix heights
root.height = Math.max(left != null ? left.height : 0,
pivotLeft != null ? pivotLeft.height : 0) + 1;
pivot.height = Math.max(root.height,
pivotRight != null ? pivotRight.height : 0) + 1;
} | java | private void rotateLeft(Node<K, V> root) {
Node<K, V> left = root.left;
Node<K, V> pivot = root.right;
Node<K, V> pivotLeft = pivot.left;
Node<K, V> pivotRight = pivot.right;
// move the pivot's left child to the root's right
root.right = pivotLeft;
if (pivotLeft != null) {
pivotLeft.parent = root;
}
replaceInParent(root, pivot);
// move the root to the pivot's left
pivot.left = root;
root.parent = pivot;
// fix heights
root.height = Math.max(left != null ? left.height : 0,
pivotLeft != null ? pivotLeft.height : 0) + 1;
pivot.height = Math.max(root.height,
pivotRight != null ? pivotRight.height : 0) + 1;
} | [
"private",
"void",
"rotateLeft",
"(",
"Node",
"<",
"K",
",",
"V",
">",
"root",
")",
"{",
"Node",
"<",
"K",
",",
"V",
">",
"left",
"=",
"root",
".",
"left",
";",
"Node",
"<",
"K",
",",
"V",
">",
"pivot",
"=",
"root",
".",
"right",
";",
"Node",... | Rotates the subtree so that its root's right child is the new root. | [
"Rotates",
"the",
"subtree",
"so",
"that",
"its",
"root",
"s",
"right",
"child",
"is",
"the",
"new",
"root",
"."
] | train | https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/internal/LinkedHashTreeMap.java#L401-L424 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java | FileUtil.copyFile | public static File copyFile(String source, String target) throws IOException {
FileChannel inputChannel = null;
FileChannel outputChannel = null;
try {
inputChannel = new FileInputStream(source).getChannel();
outputChannel = new FileOutputStream(target).getChannel();
outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
} finally {
if (inputChannel != null) {
inputChannel.close();
}
if (outputChannel != null) {
outputChannel.close();
}
}
return new File(target);
} | java | public static File copyFile(String source, String target) throws IOException {
FileChannel inputChannel = null;
FileChannel outputChannel = null;
try {
inputChannel = new FileInputStream(source).getChannel();
outputChannel = new FileOutputStream(target).getChannel();
outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
} finally {
if (inputChannel != null) {
inputChannel.close();
}
if (outputChannel != null) {
outputChannel.close();
}
}
return new File(target);
} | [
"public",
"static",
"File",
"copyFile",
"(",
"String",
"source",
",",
"String",
"target",
")",
"throws",
"IOException",
"{",
"FileChannel",
"inputChannel",
"=",
"null",
";",
"FileChannel",
"outputChannel",
"=",
"null",
";",
"try",
"{",
"inputChannel",
"=",
"ne... | Copies source file to target.
@param source source file to copy.
@param target destination to copy to.
@return target as File.
@throws IOException when unable to copy. | [
"Copies",
"source",
"file",
"to",
"target",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L114-L130 |
apiman/apiman | gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/auth/JDBCIdentityValidator.java | JDBCIdentityValidator.createClient | private IJdbcClient createClient(IPolicyContext context, JDBCIdentitySource config) throws Throwable {
IJdbcComponent jdbcComponent = context.getComponent(IJdbcComponent.class);
if (config.getType() == JDBCType.datasource || config.getType() == null) {
DataSource ds = lookupDatasource(config);
return jdbcComponent.create(ds);
}
if (config.getType() == JDBCType.url) {
JdbcOptionsBean options = new JdbcOptionsBean();
options.setJdbcUrl(config.getJdbcUrl());
options.setUsername(config.getUsername());
options.setPassword(config.getPassword());
options.setAutoCommit(true);
return jdbcComponent.createStandalone(options);
}
throw new Exception("Unknown JDBC options."); //$NON-NLS-1$
} | java | private IJdbcClient createClient(IPolicyContext context, JDBCIdentitySource config) throws Throwable {
IJdbcComponent jdbcComponent = context.getComponent(IJdbcComponent.class);
if (config.getType() == JDBCType.datasource || config.getType() == null) {
DataSource ds = lookupDatasource(config);
return jdbcComponent.create(ds);
}
if (config.getType() == JDBCType.url) {
JdbcOptionsBean options = new JdbcOptionsBean();
options.setJdbcUrl(config.getJdbcUrl());
options.setUsername(config.getUsername());
options.setPassword(config.getPassword());
options.setAutoCommit(true);
return jdbcComponent.createStandalone(options);
}
throw new Exception("Unknown JDBC options."); //$NON-NLS-1$
} | [
"private",
"IJdbcClient",
"createClient",
"(",
"IPolicyContext",
"context",
",",
"JDBCIdentitySource",
"config",
")",
"throws",
"Throwable",
"{",
"IJdbcComponent",
"jdbcComponent",
"=",
"context",
".",
"getComponent",
"(",
"IJdbcComponent",
".",
"class",
")",
";",
"... | Creates the appropriate jdbc client.
@param context
@param config | [
"Creates",
"the",
"appropriate",
"jdbc",
"client",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/auth/JDBCIdentityValidator.java#L113-L129 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/CFFFontSubset.java | CFFFontSubset.BuildFDSubrsOffsets | protected void BuildFDSubrsOffsets(int Font,int FD)
{
// Initiate to -1 to indicate lsubr operator present
fonts[Font].PrivateSubrsOffset[FD] = -1;
// Goto beginning of objects
seek(fonts[Font].fdprivateOffsets[FD]);
// While in the same object:
while (getPosition() < fonts[Font].fdprivateOffsets[FD]+fonts[Font].fdprivateLengths[FD])
{
getDictItem();
// If the dictItem is the "Subrs" then find and store offset,
if (key=="Subrs")
fonts[Font].PrivateSubrsOffset[FD] = ((Integer)args[0]).intValue()+fonts[Font].fdprivateOffsets[FD];
}
//Read the lsubr index if the lsubr was found
if (fonts[Font].PrivateSubrsOffset[FD] >= 0)
fonts[Font].PrivateSubrsOffsetsArray[FD] = getIndex(fonts[Font].PrivateSubrsOffset[FD]);
} | java | protected void BuildFDSubrsOffsets(int Font,int FD)
{
// Initiate to -1 to indicate lsubr operator present
fonts[Font].PrivateSubrsOffset[FD] = -1;
// Goto beginning of objects
seek(fonts[Font].fdprivateOffsets[FD]);
// While in the same object:
while (getPosition() < fonts[Font].fdprivateOffsets[FD]+fonts[Font].fdprivateLengths[FD])
{
getDictItem();
// If the dictItem is the "Subrs" then find and store offset,
if (key=="Subrs")
fonts[Font].PrivateSubrsOffset[FD] = ((Integer)args[0]).intValue()+fonts[Font].fdprivateOffsets[FD];
}
//Read the lsubr index if the lsubr was found
if (fonts[Font].PrivateSubrsOffset[FD] >= 0)
fonts[Font].PrivateSubrsOffsetsArray[FD] = getIndex(fonts[Font].PrivateSubrsOffset[FD]);
} | [
"protected",
"void",
"BuildFDSubrsOffsets",
"(",
"int",
"Font",
",",
"int",
"FD",
")",
"{",
"// Initiate to -1 to indicate lsubr operator present",
"fonts",
"[",
"Font",
"]",
".",
"PrivateSubrsOffset",
"[",
"FD",
"]",
"=",
"-",
"1",
";",
"// Goto beginning of object... | The function finds for the FD array processed the local subr offset and its
offset array.
@param Font the font
@param FD The FDARRAY processed | [
"The",
"function",
"finds",
"for",
"the",
"FD",
"array",
"processed",
"the",
"local",
"subr",
"offset",
"and",
"its",
"offset",
"array",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/CFFFontSubset.java#L500-L517 |
apache/incubator-gobblin | gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/converter/EnvelopeSchemaConverter.java | EnvelopeSchemaConverter.getPayload | public byte[] getPayload(GenericRecord inputRecord, String payloadFieldName) {
ByteBuffer bb = (ByteBuffer) inputRecord.get(payloadFieldName);
byte[] payloadBytes;
if (bb.hasArray()) {
payloadBytes = bb.array();
} else {
payloadBytes = new byte[bb.remaining()];
bb.get(payloadBytes);
}
String hexString = new String(payloadBytes, StandardCharsets.UTF_8);
return DatatypeConverter.parseHexBinary(hexString);
} | java | public byte[] getPayload(GenericRecord inputRecord, String payloadFieldName) {
ByteBuffer bb = (ByteBuffer) inputRecord.get(payloadFieldName);
byte[] payloadBytes;
if (bb.hasArray()) {
payloadBytes = bb.array();
} else {
payloadBytes = new byte[bb.remaining()];
bb.get(payloadBytes);
}
String hexString = new String(payloadBytes, StandardCharsets.UTF_8);
return DatatypeConverter.parseHexBinary(hexString);
} | [
"public",
"byte",
"[",
"]",
"getPayload",
"(",
"GenericRecord",
"inputRecord",
",",
"String",
"payloadFieldName",
")",
"{",
"ByteBuffer",
"bb",
"=",
"(",
"ByteBuffer",
")",
"inputRecord",
".",
"get",
"(",
"payloadFieldName",
")",
";",
"byte",
"[",
"]",
"payl... | Get payload field from GenericRecord and convert to byte array | [
"Get",
"payload",
"field",
"from",
"GenericRecord",
"and",
"convert",
"to",
"byte",
"array"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/converter/EnvelopeSchemaConverter.java#L134-L145 |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ThreadContextBuilderImpl.java | ThreadContextBuilderImpl.failOnUnknownContextTypes | static void failOnUnknownContextTypes(HashSet<String> unknown, ArrayList<ThreadContextProvider> contextProviders) {
Set<String> known = new TreeSet<>(); // alphabetize for readability of message
known.addAll(Arrays.asList(ThreadContext.ALL_REMAINING, ThreadContext.APPLICATION, ThreadContext.CDI, ThreadContext.SECURITY, ThreadContext.TRANSACTION));
for (ThreadContextProvider provider : contextProviders) {
String contextType = provider.getThreadContextType();
known.add(contextType);
}
throw new IllegalStateException(Tr.formatMessage(tc, "CWWKC1155.unknown.context", new TreeSet<String>(unknown), known));
} | java | static void failOnUnknownContextTypes(HashSet<String> unknown, ArrayList<ThreadContextProvider> contextProviders) {
Set<String> known = new TreeSet<>(); // alphabetize for readability of message
known.addAll(Arrays.asList(ThreadContext.ALL_REMAINING, ThreadContext.APPLICATION, ThreadContext.CDI, ThreadContext.SECURITY, ThreadContext.TRANSACTION));
for (ThreadContextProvider provider : contextProviders) {
String contextType = provider.getThreadContextType();
known.add(contextType);
}
throw new IllegalStateException(Tr.formatMessage(tc, "CWWKC1155.unknown.context", new TreeSet<String>(unknown), known));
} | [
"static",
"void",
"failOnUnknownContextTypes",
"(",
"HashSet",
"<",
"String",
">",
"unknown",
",",
"ArrayList",
"<",
"ThreadContextProvider",
">",
"contextProviders",
")",
"{",
"Set",
"<",
"String",
">",
"known",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"... | Fail with error identifying unknown context type(s) that were specified.
@param unknown set of unknown context types(s) that were specified.
@param contextProviders | [
"Fail",
"with",
"error",
"identifying",
"unknown",
"context",
"type",
"(",
"s",
")",
"that",
"were",
"specified",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ThreadContextBuilderImpl.java#L156-L165 |
threerings/playn | core/src/playn/core/util/TextBlock.java | TextBlock.toImage | public CanvasImage toImage(Align align, int fillColor) {
float pad = pad();
CanvasImage image = graphics().createImage(bounds.width()+2*pad, bounds.height()+2*pad);
image.canvas().setFillColor(fillColor);
fill(image.canvas(), align, pad, pad);
return image;
} | java | public CanvasImage toImage(Align align, int fillColor) {
float pad = pad();
CanvasImage image = graphics().createImage(bounds.width()+2*pad, bounds.height()+2*pad);
image.canvas().setFillColor(fillColor);
fill(image.canvas(), align, pad, pad);
return image;
} | [
"public",
"CanvasImage",
"toImage",
"(",
"Align",
"align",
",",
"int",
"fillColor",
")",
"{",
"float",
"pad",
"=",
"pad",
"(",
")",
";",
"CanvasImage",
"image",
"=",
"graphics",
"(",
")",
".",
"createImage",
"(",
"bounds",
".",
"width",
"(",
")",
"+",
... | Creates a canvas image large enough to accommodate this text block and renders the lines into
it. The image will include padding around the edge to ensure that antialiasing has a bit of
extra space to do its work. | [
"Creates",
"a",
"canvas",
"image",
"large",
"enough",
"to",
"accommodate",
"this",
"text",
"block",
"and",
"renders",
"the",
"lines",
"into",
"it",
".",
"The",
"image",
"will",
"include",
"padding",
"around",
"the",
"edge",
"to",
"ensure",
"that",
"antialias... | train | https://github.com/threerings/playn/blob/c266eeb39188dcada4b00992a0d1199759e03d42/core/src/playn/core/util/TextBlock.java#L148-L154 |
kaazing/gateway | service/update.check/src/main/java/org/kaazing/gateway/service/update/check/GatewayVersion.java | GatewayVersion.parseGatewayVersion | public static GatewayVersion parseGatewayVersion(String version) throws Exception {
if ("develop-SNAPSHOT".equals(version)) {
return new GatewayVersion(0, 0, 0);
} else {
String regex = "(?<major>[0-9]+)\\.(?<minor>[0-9]+)\\.(?<patch>[0-9]+)-?(?<rc>[RC0-9{3}]*)";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(version);
if (matcher.matches()) {
int major = Integer.parseInt(matcher.group("major"));
int minor = Integer.parseInt(matcher.group("minor"));
int patch = Integer.parseInt(matcher.group("patch"));
String rc = matcher.group("rc");
return new GatewayVersion(major, minor, patch, rc);
} else {
throw new IllegalArgumentException(String.format("version String is not of form %s", regex));
}
}
} | java | public static GatewayVersion parseGatewayVersion(String version) throws Exception {
if ("develop-SNAPSHOT".equals(version)) {
return new GatewayVersion(0, 0, 0);
} else {
String regex = "(?<major>[0-9]+)\\.(?<minor>[0-9]+)\\.(?<patch>[0-9]+)-?(?<rc>[RC0-9{3}]*)";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(version);
if (matcher.matches()) {
int major = Integer.parseInt(matcher.group("major"));
int minor = Integer.parseInt(matcher.group("minor"));
int patch = Integer.parseInt(matcher.group("patch"));
String rc = matcher.group("rc");
return new GatewayVersion(major, minor, patch, rc);
} else {
throw new IllegalArgumentException(String.format("version String is not of form %s", regex));
}
}
} | [
"public",
"static",
"GatewayVersion",
"parseGatewayVersion",
"(",
"String",
"version",
")",
"throws",
"Exception",
"{",
"if",
"(",
"\"develop-SNAPSHOT\"",
".",
"equals",
"(",
"version",
")",
")",
"{",
"return",
"new",
"GatewayVersion",
"(",
"0",
",",
"0",
",",... | Parses a GatewayVersion from a String
@param version
@return
@throws Exception | [
"Parses",
"a",
"GatewayVersion",
"from",
"a",
"String"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/update.check/src/main/java/org/kaazing/gateway/service/update/check/GatewayVersion.java#L92-L109 |
logic-ng/LogicNG | src/main/java/org/logicng/formulas/printer/SortedStringRepresentation.java | SortedStringRepresentation.naryOperator | @Override
protected String naryOperator(final NAryOperator operator, final String opString) {
final List<Formula> operands = new ArrayList<>();
for (final Formula op : operator) {
operands.add(op);
}
final int size = operator.numberOfOperands();
Collections.sort(operands, this.comparator);
final StringBuilder sb = new StringBuilder();
int count = 0;
Formula last = null;
for (final Formula op : operands) {
if (++count == size) {
last = op;
} else {
sb.append(operator.type().precedence() < op.type().precedence() ? toString(op) : bracket(op));
sb.append(opString);
}
}
if (last != null) {
sb.append(operator.type().precedence() < last.type().precedence() ? toString(last) : bracket(last));
}
return sb.toString();
} | java | @Override
protected String naryOperator(final NAryOperator operator, final String opString) {
final List<Formula> operands = new ArrayList<>();
for (final Formula op : operator) {
operands.add(op);
}
final int size = operator.numberOfOperands();
Collections.sort(operands, this.comparator);
final StringBuilder sb = new StringBuilder();
int count = 0;
Formula last = null;
for (final Formula op : operands) {
if (++count == size) {
last = op;
} else {
sb.append(operator.type().precedence() < op.type().precedence() ? toString(op) : bracket(op));
sb.append(opString);
}
}
if (last != null) {
sb.append(operator.type().precedence() < last.type().precedence() ? toString(last) : bracket(last));
}
return sb.toString();
} | [
"@",
"Override",
"protected",
"String",
"naryOperator",
"(",
"final",
"NAryOperator",
"operator",
",",
"final",
"String",
"opString",
")",
"{",
"final",
"List",
"<",
"Formula",
">",
"operands",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"fin... | Returns the sorted string representation of an n-ary operator.
@param operator the n-ary operator
@param opString the operator string
@return the string representation | [
"Returns",
"the",
"sorted",
"string",
"representation",
"of",
"an",
"n",
"-",
"ary",
"operator",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/printer/SortedStringRepresentation.java#L142-L165 |
ebean-orm/ebean-mocker | src/main/java/io/ebean/MockiEbean.java | MockiEbean.start | public static MockiEbean start(EbeanServer mock) {
// using $mock as the server name
EbeanServer original = Ebean.mock("$mock", mock, true);
if (mock instanceof DelegateAwareEbeanServer) {
((DelegateAwareEbeanServer)mock).withDelegateIfRequired(original);
}
return new MockiEbean(mock, original);
} | java | public static MockiEbean start(EbeanServer mock) {
// using $mock as the server name
EbeanServer original = Ebean.mock("$mock", mock, true);
if (mock instanceof DelegateAwareEbeanServer) {
((DelegateAwareEbeanServer)mock).withDelegateIfRequired(original);
}
return new MockiEbean(mock, original);
} | [
"public",
"static",
"MockiEbean",
"start",
"(",
"EbeanServer",
"mock",
")",
"{",
"// using $mock as the server name",
"EbeanServer",
"original",
"=",
"Ebean",
".",
"mock",
"(",
"\"$mock\"",
",",
"mock",
",",
"true",
")",
";",
"if",
"(",
"mock",
"instanceof",
"... | Set a mock implementation of EbeanServer as the default server.
<p>
Typically the mock instance passed in is created by Mockito or similar tool.
<p>
The default EbeanSever is the instance returned by {@link Ebean#getServer(String)} when the
server name is null.
@param mock the mock instance that becomes the default EbeanServer
@return The MockiEbean with a {@link #restoreOriginal()} method that can be used to restore the
original EbeanServer implementation. | [
"Set",
"a",
"mock",
"implementation",
"of",
"EbeanServer",
"as",
"the",
"default",
"server",
".",
"<p",
">",
"Typically",
"the",
"mock",
"instance",
"passed",
"in",
"is",
"created",
"by",
"Mockito",
"or",
"similar",
"tool",
".",
"<p",
">",
"The",
"default"... | train | https://github.com/ebean-orm/ebean-mocker/blob/98c14a58253e8cd40b2a0c9b49526a307079389a/src/main/java/io/ebean/MockiEbean.java#L78-L88 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java | AvatarNodeZkUtil.writeToZooKeeperAfterFailover | static long writeToZooKeeperAfterFailover(Configuration startupConf,
Configuration confg) throws IOException {
AvatarZooKeeperClient zk = null;
// Register client port address.
String address = startupConf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
String realAddress = confg.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
int maxTries = startupConf.getInt("dfs.avatarnode.zk.retries", 3);
for (int i = 0; i < maxTries; i++) {
try {
zk = new AvatarZooKeeperClient(confg, null, false);
LOG.info("Failover: Registering to ZK as primary");
final boolean toOverwrite = true;
zk.registerPrimary(address, realAddress, toOverwrite);
registerClientProtocolAddress(zk, startupConf, confg, toOverwrite);
registerDnProtocolAddress(zk, startupConf, confg, toOverwrite);
registerHttpAddress(zk, startupConf, confg, toOverwrite);
LOG.info("Failover: Writting session id to ZK");
return writeSessionIdToZK(startupConf, zk);
} catch (Exception e) {
LOG.error("Got Exception registering the new primary "
+ "with ZooKeeper. Will retry...", e);
} finally {
shutdownZkClient(zk);
}
}
throw new IOException("Cannot connect to zk");
} | java | static long writeToZooKeeperAfterFailover(Configuration startupConf,
Configuration confg) throws IOException {
AvatarZooKeeperClient zk = null;
// Register client port address.
String address = startupConf.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
String realAddress = confg.get(NameNode.DFS_NAMENODE_RPC_ADDRESS_KEY);
int maxTries = startupConf.getInt("dfs.avatarnode.zk.retries", 3);
for (int i = 0; i < maxTries; i++) {
try {
zk = new AvatarZooKeeperClient(confg, null, false);
LOG.info("Failover: Registering to ZK as primary");
final boolean toOverwrite = true;
zk.registerPrimary(address, realAddress, toOverwrite);
registerClientProtocolAddress(zk, startupConf, confg, toOverwrite);
registerDnProtocolAddress(zk, startupConf, confg, toOverwrite);
registerHttpAddress(zk, startupConf, confg, toOverwrite);
LOG.info("Failover: Writting session id to ZK");
return writeSessionIdToZK(startupConf, zk);
} catch (Exception e) {
LOG.error("Got Exception registering the new primary "
+ "with ZooKeeper. Will retry...", e);
} finally {
shutdownZkClient(zk);
}
}
throw new IOException("Cannot connect to zk");
} | [
"static",
"long",
"writeToZooKeeperAfterFailover",
"(",
"Configuration",
"startupConf",
",",
"Configuration",
"confg",
")",
"throws",
"IOException",
"{",
"AvatarZooKeeperClient",
"zk",
"=",
"null",
";",
"// Register client port address.",
"String",
"address",
"=",
"startu... | Performs some operations after failover such as writing a new session id
and registering to zookeeper as the new primary.
@param startupConf
the startup configuration
@param confg
the current configuration
@return the session id for the new node after failover
@throws IOException | [
"Performs",
"some",
"operations",
"after",
"failover",
"such",
"as",
"writing",
"a",
"new",
"session",
"id",
"and",
"registering",
"to",
"zookeeper",
"as",
"the",
"new",
"primary",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNodeZkUtil.java#L111-L138 |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/tcl/TCLStatement.java | TCLStatement.isTCLUnsafe | public static boolean isTCLUnsafe(final DatabaseType databaseType, final TokenType tokenType, final LexerEngine lexerEngine) {
if (DefaultKeyword.SET.equals(tokenType) || DatabaseType.SQLServer.equals(databaseType) && DefaultKeyword.IF.equals(tokenType)) {
lexerEngine.skipUntil(DefaultKeyword.TRANSACTION, DefaultKeyword.AUTOCOMMIT, DefaultKeyword.IMPLICIT_TRANSACTIONS);
if (!lexerEngine.isEnd()) {
return true;
}
}
return false;
} | java | public static boolean isTCLUnsafe(final DatabaseType databaseType, final TokenType tokenType, final LexerEngine lexerEngine) {
if (DefaultKeyword.SET.equals(tokenType) || DatabaseType.SQLServer.equals(databaseType) && DefaultKeyword.IF.equals(tokenType)) {
lexerEngine.skipUntil(DefaultKeyword.TRANSACTION, DefaultKeyword.AUTOCOMMIT, DefaultKeyword.IMPLICIT_TRANSACTIONS);
if (!lexerEngine.isEnd()) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isTCLUnsafe",
"(",
"final",
"DatabaseType",
"databaseType",
",",
"final",
"TokenType",
"tokenType",
",",
"final",
"LexerEngine",
"lexerEngine",
")",
"{",
"if",
"(",
"DefaultKeyword",
".",
"SET",
".",
"equals",
"(",
"tokenType",
")... | Is TCL statement.
@param databaseType database type
@param tokenType token type
@param lexerEngine lexer engine
@return is TCL or not | [
"Is",
"TCL",
"statement",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/tcl/TCLStatement.java#L65-L73 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketFactory.java | SocketFactory.createSocket | SocketInterface createSocket(@NonNull final String token, @NonNull final WeakReference<SocketStateListener> stateListenerWeakReference) {
WebSocket socket = null;
WebSocketFactory factory = new WebSocketFactory();
// Configure proxy if provided
if (proxyAddress != null) {
ProxySettings settings = factory.getProxySettings();
settings.setServer(proxyAddress);
}
try {
socket = factory.createSocket(uri, TIMEOUT);
} catch (IOException e) {
log.f("Creating socket failed", e);
}
if (socket != null) {
String header = AuthManager.AUTH_PREFIX + token;
socket.addHeader("Authorization", header);
socket.addListener(createWebSocketAdapter(stateListenerWeakReference));
socket.setPingInterval(PING_INTERVAL);
return new SocketWrapperImpl(socket);
}
return null;
} | java | SocketInterface createSocket(@NonNull final String token, @NonNull final WeakReference<SocketStateListener> stateListenerWeakReference) {
WebSocket socket = null;
WebSocketFactory factory = new WebSocketFactory();
// Configure proxy if provided
if (proxyAddress != null) {
ProxySettings settings = factory.getProxySettings();
settings.setServer(proxyAddress);
}
try {
socket = factory.createSocket(uri, TIMEOUT);
} catch (IOException e) {
log.f("Creating socket failed", e);
}
if (socket != null) {
String header = AuthManager.AUTH_PREFIX + token;
socket.addHeader("Authorization", header);
socket.addListener(createWebSocketAdapter(stateListenerWeakReference));
socket.setPingInterval(PING_INTERVAL);
return new SocketWrapperImpl(socket);
}
return null;
} | [
"SocketInterface",
"createSocket",
"(",
"@",
"NonNull",
"final",
"String",
"token",
",",
"@",
"NonNull",
"final",
"WeakReference",
"<",
"SocketStateListener",
">",
"stateListenerWeakReference",
")",
"{",
"WebSocket",
"socket",
"=",
"null",
";",
"WebSocketFactory",
"... | Creates and configures web socket instance.
@param token Authentication token.
@param stateListenerWeakReference Weak reference to socket connection state callbacks. | [
"Creates",
"and",
"configures",
"web",
"socket",
"instance",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/sockets/SocketFactory.java#L97-L128 |
prestodb/presto | presto-spi/src/main/java/com/facebook/presto/spi/block/MethodHandleUtil.java | MethodHandleUtil.methodHandle | public static MethodHandle methodHandle(Class<?> clazz, String name, Class<?>... parameterTypes)
{
try {
return MethodHandles.lookup().unreflect(clazz.getMethod(name, parameterTypes));
}
catch (IllegalAccessException | NoSuchMethodException e) {
throw new PrestoException(GENERIC_INTERNAL_ERROR, e);
}
} | java | public static MethodHandle methodHandle(Class<?> clazz, String name, Class<?>... parameterTypes)
{
try {
return MethodHandles.lookup().unreflect(clazz.getMethod(name, parameterTypes));
}
catch (IllegalAccessException | NoSuchMethodException e) {
throw new PrestoException(GENERIC_INTERNAL_ERROR, e);
}
} | [
"public",
"static",
"MethodHandle",
"methodHandle",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"try",
"{",
"return",
"MethodHandles",
".",
"lookup",
"(",
")",
".",
"unrefle... | Returns a MethodHandle corresponding to the specified method.
<p>
Warning: The way Oracle JVM implements producing MethodHandle for a method involves creating
JNI global weak references. G1 processes such references serially. As a result, calling this
method in a tight loop can create significant GC pressure and significantly increase
application pause time. | [
"Returns",
"a",
"MethodHandle",
"corresponding",
"to",
"the",
"specified",
"method",
".",
"<p",
">",
"Warning",
":",
"The",
"way",
"Oracle",
"JVM",
"implements",
"producing",
"MethodHandle",
"for",
"a",
"method",
"involves",
"creating",
"JNI",
"global",
"weak",
... | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/MethodHandleUtil.java#L118-L126 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedBlockingQueue.java | LinkedBlockingQueue.offer | public boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException {
if (e == null) throw new NullPointerException();
long nanos = unit.toNanos(timeout);
int c = -1;
final ReentrantLock putLock = this.putLock;
final AtomicInteger count = this.count;
putLock.lockInterruptibly();
try {
while (count.get() == capacity) {
if (nanos <= 0L)
return false;
nanos = notFull.awaitNanos(nanos);
}
enqueue(new Node<E>(e));
c = count.getAndIncrement();
if (c + 1 < capacity)
notFull.signal();
} finally {
putLock.unlock();
}
if (c == 0)
signalNotEmpty();
return true;
} | java | public boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException {
if (e == null) throw new NullPointerException();
long nanos = unit.toNanos(timeout);
int c = -1;
final ReentrantLock putLock = this.putLock;
final AtomicInteger count = this.count;
putLock.lockInterruptibly();
try {
while (count.get() == capacity) {
if (nanos <= 0L)
return false;
nanos = notFull.awaitNanos(nanos);
}
enqueue(new Node<E>(e));
c = count.getAndIncrement();
if (c + 1 < capacity)
notFull.signal();
} finally {
putLock.unlock();
}
if (c == 0)
signalNotEmpty();
return true;
} | [
"public",
"boolean",
"offer",
"(",
"E",
"e",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"e",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"long",
"nanos",
"=",
"uni... | Inserts the specified element at the tail of this queue, waiting if
necessary up to the specified wait time for space to become available.
@return {@code true} if successful, or {@code false} if
the specified waiting time elapses before space is available
@throws InterruptedException {@inheritDoc}
@throws NullPointerException {@inheritDoc} | [
"Inserts",
"the",
"specified",
"element",
"at",
"the",
"tail",
"of",
"this",
"queue",
"waiting",
"if",
"necessary",
"up",
"to",
"the",
"specified",
"wait",
"time",
"for",
"space",
"to",
"become",
"available",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/LinkedBlockingQueue.java#L378-L403 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java | SslContextBuilder.keyManager | public SslContextBuilder keyManager(InputStream keyCertChainInputStream, InputStream keyInputStream,
String keyPassword) {
X509Certificate[] keyCertChain;
PrivateKey key;
try {
keyCertChain = SslContext.toX509Certificates(keyCertChainInputStream);
} catch (Exception e) {
throw new IllegalArgumentException("Input stream not contain valid certificates.", e);
}
try {
key = SslContext.toPrivateKey(keyInputStream, keyPassword);
} catch (Exception e) {
throw new IllegalArgumentException("Input stream does not contain valid private key.", e);
}
return keyManager(key, keyPassword, keyCertChain);
} | java | public SslContextBuilder keyManager(InputStream keyCertChainInputStream, InputStream keyInputStream,
String keyPassword) {
X509Certificate[] keyCertChain;
PrivateKey key;
try {
keyCertChain = SslContext.toX509Certificates(keyCertChainInputStream);
} catch (Exception e) {
throw new IllegalArgumentException("Input stream not contain valid certificates.", e);
}
try {
key = SslContext.toPrivateKey(keyInputStream, keyPassword);
} catch (Exception e) {
throw new IllegalArgumentException("Input stream does not contain valid private key.", e);
}
return keyManager(key, keyPassword, keyCertChain);
} | [
"public",
"SslContextBuilder",
"keyManager",
"(",
"InputStream",
"keyCertChainInputStream",
",",
"InputStream",
"keyInputStream",
",",
"String",
"keyPassword",
")",
"{",
"X509Certificate",
"[",
"]",
"keyCertChain",
";",
"PrivateKey",
"key",
";",
"try",
"{",
"keyCertCh... | Identifying certificate for this host. {@code keyCertChainInputStream} and {@code keyInputStream} may
be {@code null} for client contexts, which disables mutual authentication.
@param keyCertChainInputStream an input stream for an X.509 certificate chain in PEM format
@param keyInputStream an input stream for a PKCS#8 private key in PEM format
@param keyPassword the password of the {@code keyInputStream}, or {@code null} if it's not
password-protected | [
"Identifying",
"certificate",
"for",
"this",
"host",
".",
"{",
"@code",
"keyCertChainInputStream",
"}",
"and",
"{",
"@code",
"keyInputStream",
"}",
"may",
"be",
"{",
"@code",
"null",
"}",
"for",
"client",
"contexts",
"which",
"disables",
"mutual",
"authenticatio... | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L284-L299 |
google/closure-compiler | src/com/google/javascript/rhino/TypeDeclarationsIR.java | TypeDeclarationsIR.parameterizedType | public static TypeDeclarationNode parameterizedType(
TypeDeclarationNode baseType, Iterable<TypeDeclarationNode> typeParameters) {
if (Iterables.isEmpty(typeParameters)) {
return baseType;
}
TypeDeclarationNode node = new TypeDeclarationNode(Token.PARAMETERIZED_TYPE, baseType);
for (Node typeParameter : typeParameters) {
node.addChildToBack(typeParameter);
}
return node;
} | java | public static TypeDeclarationNode parameterizedType(
TypeDeclarationNode baseType, Iterable<TypeDeclarationNode> typeParameters) {
if (Iterables.isEmpty(typeParameters)) {
return baseType;
}
TypeDeclarationNode node = new TypeDeclarationNode(Token.PARAMETERIZED_TYPE, baseType);
for (Node typeParameter : typeParameters) {
node.addChildToBack(typeParameter);
}
return node;
} | [
"public",
"static",
"TypeDeclarationNode",
"parameterizedType",
"(",
"TypeDeclarationNode",
"baseType",
",",
"Iterable",
"<",
"TypeDeclarationNode",
">",
"typeParameters",
")",
"{",
"if",
"(",
"Iterables",
".",
"isEmpty",
"(",
"typeParameters",
")",
")",
"{",
"retur... | Represents a parameterized, or generic, type.
Closure calls this a Type Application and accepts syntax like
{@code {Object.<string, number>}}
<p>Example:
<pre>
PARAMETERIZED_TYPE
NAMED_TYPE
NAME Object
STRING_TYPE
NUMBER_TYPE
</pre>
@param baseType
@param typeParameters | [
"Represents",
"a",
"parameterized",
"or",
"generic",
"type",
".",
"Closure",
"calls",
"this",
"a",
"Type",
"Application",
"and",
"accepts",
"syntax",
"like",
"{",
"@code",
"{",
"Object",
".",
"<string",
"number",
">",
"}}"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/TypeDeclarationsIR.java#L230-L240 |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.findAndRemoveBlock | private NamedOutputBlockContext findAndRemoveBlock(List<NamedOutputBlockContext> blocks, String name) {
if(blocks == null) {
return null;
}
Iterator<NamedOutputBlockContext> blockIter = blocks.iterator();
while (blockIter.hasNext()) {
NamedOutputBlockContext block = blockIter.next();
String blockName = name(block);
if(name.equals(blockName)) {
blockIter.remove();
return block;
}
}
return null;
} | java | private NamedOutputBlockContext findAndRemoveBlock(List<NamedOutputBlockContext> blocks, String name) {
if(blocks == null) {
return null;
}
Iterator<NamedOutputBlockContext> blockIter = blocks.iterator();
while (blockIter.hasNext()) {
NamedOutputBlockContext block = blockIter.next();
String blockName = name(block);
if(name.equals(blockName)) {
blockIter.remove();
return block;
}
}
return null;
} | [
"private",
"NamedOutputBlockContext",
"findAndRemoveBlock",
"(",
"List",
"<",
"NamedOutputBlockContext",
">",
"blocks",
",",
"String",
"name",
")",
"{",
"if",
"(",
"blocks",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Iterator",
"<",
"NamedOutputBlockCo... | Find and remove block with specific name
@param blocks List of ParamOutputBlocks to search
@param name Name of block to find
@return ParamOutputBlock with specified name | [
"Find",
"and",
"remove",
"block",
"with",
"specific",
"name"
] | train | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2758-L2775 |
mongodb/stitch-android-sdk | server/services/mongodb-remote/src/main/java/com/mongodb/stitch/server/services/mongodb/remote/internal/RemoteMongoCollectionImpl.java | RemoteMongoCollectionImpl.updateOne | public RemoteUpdateResult updateOne(final Bson filter, final Bson update) {
return proxy.updateOne(filter, update);
} | java | public RemoteUpdateResult updateOne(final Bson filter, final Bson update) {
return proxy.updateOne(filter, update);
} | [
"public",
"RemoteUpdateResult",
"updateOne",
"(",
"final",
"Bson",
"filter",
",",
"final",
"Bson",
"update",
")",
"{",
"return",
"proxy",
".",
"updateOne",
"(",
"filter",
",",
"update",
")",
";",
"}"
] | Update a single document in the collection according to the specified arguments.
@param filter a document describing the query filter, which may not be null.
@param update a document describing the update, which may not be null. The update to apply
must include only update operators.
@return the result of the update one operation | [
"Update",
"a",
"single",
"document",
"in",
"the",
"collection",
"according",
"to",
"the",
"specified",
"arguments",
"."
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/server/services/mongodb-remote/src/main/java/com/mongodb/stitch/server/services/mongodb/remote/internal/RemoteMongoCollectionImpl.java#L311-L313 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/rendering/AbstractHtmlState.java | AbstractHtmlState.selectMap | public Map selectMap(int type, boolean createIfNull)
{
if (type == ATTR_JAVASCRIPT) {
if (_jsMap == null && createIfNull)
_jsMap = new HashMap();
return _jsMap;
}
return super.selectMap(type, createIfNull);
} | java | public Map selectMap(int type, boolean createIfNull)
{
if (type == ATTR_JAVASCRIPT) {
if (_jsMap == null && createIfNull)
_jsMap = new HashMap();
return _jsMap;
}
return super.selectMap(type, createIfNull);
} | [
"public",
"Map",
"selectMap",
"(",
"int",
"type",
",",
"boolean",
"createIfNull",
")",
"{",
"if",
"(",
"type",
"==",
"ATTR_JAVASCRIPT",
")",
"{",
"if",
"(",
"_jsMap",
"==",
"null",
"&&",
"createIfNull",
")",
"_jsMap",
"=",
"new",
"HashMap",
"(",
")",
"... | This method will return the map that represents the passed in <code>type</code>. The boolean flag
</code>createIfNull</code> indicates that the map should be created or not if it's null. This
class defines two maps defined by <code>@see #ATTR_STYLE</code> and <code>ATTR_JAVASCRIPT</code>
@param type <code>integer</code> type indentifying the map to be created.
@param createIfNull <code>boolean</code> flag indicating if the map should be created if it doesn't exist.
@return The map or null
@see #ATTR_JAVASCRIPT | [
"This",
"method",
"will",
"return",
"the",
"map",
"that",
"represents",
"the",
"passed",
"in",
"<code",
">",
"type<",
"/",
"code",
">",
".",
"The",
"boolean",
"flag",
"<",
"/",
"code",
">",
"createIfNull<",
"/",
"code",
">",
"indicates",
"that",
"the",
... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/rendering/AbstractHtmlState.java#L87-L95 |
twotoasters/RecyclerViewLib | library/src/main/java/com/twotoasters/android/support/v7/widget/LinearSmoothScroller.java | LinearSmoothScroller.calculateDxToMakeVisible | public int calculateDxToMakeVisible(View view, int snapPreference) {
final RecyclerView.LayoutManager layoutManager = getLayoutManager();
if (!layoutManager.canScrollHorizontally()) {
return 0;
}
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)
view.getLayoutParams();
final int left = layoutManager.getDecoratedLeft(view) - params.leftMargin;
final int right = layoutManager.getDecoratedRight(view) + params.rightMargin;
final int start = layoutManager.getPaddingLeft();
final int end = layoutManager.getWidth() - layoutManager.getPaddingRight();
return calculateDtToFit(left, right, start, end, snapPreference);
} | java | public int calculateDxToMakeVisible(View view, int snapPreference) {
final RecyclerView.LayoutManager layoutManager = getLayoutManager();
if (!layoutManager.canScrollHorizontally()) {
return 0;
}
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams)
view.getLayoutParams();
final int left = layoutManager.getDecoratedLeft(view) - params.leftMargin;
final int right = layoutManager.getDecoratedRight(view) + params.rightMargin;
final int start = layoutManager.getPaddingLeft();
final int end = layoutManager.getWidth() - layoutManager.getPaddingRight();
return calculateDtToFit(left, right, start, end, snapPreference);
} | [
"public",
"int",
"calculateDxToMakeVisible",
"(",
"View",
"view",
",",
"int",
"snapPreference",
")",
"{",
"final",
"RecyclerView",
".",
"LayoutManager",
"layoutManager",
"=",
"getLayoutManager",
"(",
")",
";",
"if",
"(",
"!",
"layoutManager",
".",
"canScrollHorizo... | Calculates the horizontal scroll amount necessary to make the given view fully visible
inside the RecyclerView.
@param view The view which we want to make fully visible
@param snapPreference The edge which the view should snap to when entering the visible
area. One of {@link #SNAP_TO_START}, {@link #SNAP_TO_END} or
{@link #SNAP_TO_END}
@return The vertical scroll amount necessary to make the view visible with the given
snap preference. | [
"Calculates",
"the",
"horizontal",
"scroll",
"amount",
"necessary",
"to",
"make",
"the",
"given",
"view",
"fully",
"visible",
"inside",
"the",
"RecyclerView",
"."
] | train | https://github.com/twotoasters/RecyclerViewLib/blob/2379fd5bbf57d4dfc8b28046b7ace950905c75f0/library/src/main/java/com/twotoasters/android/support/v7/widget/LinearSmoothScroller.java#L323-L335 |
fcrepo4/fcrepo4 | fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java | WebACRolesProvider.getAllPathAncestors | private static List<String> getAllPathAncestors(final String path) {
final List<String> segments = asList(path.split("/"));
return range(1, segments.size())
.mapToObj(frameSize -> FEDORA_INTERNAL_PREFIX + "/" + String.join("/", segments.subList(1, frameSize)))
.collect(toList());
} | java | private static List<String> getAllPathAncestors(final String path) {
final List<String> segments = asList(path.split("/"));
return range(1, segments.size())
.mapToObj(frameSize -> FEDORA_INTERNAL_PREFIX + "/" + String.join("/", segments.subList(1, frameSize)))
.collect(toList());
} | [
"private",
"static",
"List",
"<",
"String",
">",
"getAllPathAncestors",
"(",
"final",
"String",
"path",
")",
"{",
"final",
"List",
"<",
"String",
">",
"segments",
"=",
"asList",
"(",
"path",
".",
"split",
"(",
"\"/\"",
")",
")",
";",
"return",
"range",
... | Given a path (e.g. /a/b/c/d) retrieve a list of all ancestor paths.
In this case, that would be a list of "/a/b/c", "/a/b", "/a" and "/". | [
"Given",
"a",
"path",
"(",
"e",
".",
"g",
".",
"/",
"a",
"/",
"b",
"/",
"c",
"/",
"d",
")",
"retrieve",
"a",
"list",
"of",
"all",
"ancestor",
"paths",
".",
"In",
"this",
"case",
"that",
"would",
"be",
"a",
"list",
"of",
"/",
"a",
"/",
"b",
... | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java#L197-L202 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java | IntTrieBuilder.getValue | public int getValue(int ch, boolean [] inBlockZero)
{
// valid, uncompacted trie and valid c?
if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) {
if (inBlockZero != null) {
inBlockZero[0] = true;
}
return 0;
}
int block = m_index_[ch >> SHIFT_];
if (inBlockZero != null) {
inBlockZero[0] = (block == 0);
}
return m_data_[Math.abs(block) + (ch & MASK_)];
} | java | public int getValue(int ch, boolean [] inBlockZero)
{
// valid, uncompacted trie and valid c?
if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) {
if (inBlockZero != null) {
inBlockZero[0] = true;
}
return 0;
}
int block = m_index_[ch >> SHIFT_];
if (inBlockZero != null) {
inBlockZero[0] = (block == 0);
}
return m_data_[Math.abs(block) + (ch & MASK_)];
} | [
"public",
"int",
"getValue",
"(",
"int",
"ch",
",",
"boolean",
"[",
"]",
"inBlockZero",
")",
"{",
"// valid, uncompacted trie and valid c?",
"if",
"(",
"m_isCompacted_",
"||",
"ch",
">",
"UCharacter",
".",
"MAX_VALUE",
"||",
"ch",
"<",
"0",
")",
"{",
"if",
... | Get a 32 bit data from the table data
@param ch code point for which data is to be retrieved.
@param inBlockZero Output parameter, inBlockZero[0] returns true if the
char maps into block zero, otherwise false.
@return the 32 bit data value. | [
"Get",
"a",
"32",
"bit",
"data",
"from",
"the",
"table",
"data"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java#L190-L205 |
alkacon/opencms-core | src/org/opencms/report/A_CmsReportThread.java | A_CmsReportThread.initHtmlReport | protected void initHtmlReport(Locale locale) {
m_report = new CmsWorkplaceReport(locale, m_cms.getRequestContext().getSiteRoot(), getLogChannel());
} | java | protected void initHtmlReport(Locale locale) {
m_report = new CmsWorkplaceReport(locale, m_cms.getRequestContext().getSiteRoot(), getLogChannel());
} | [
"protected",
"void",
"initHtmlReport",
"(",
"Locale",
"locale",
")",
"{",
"m_report",
"=",
"new",
"CmsWorkplaceReport",
"(",
"locale",
",",
"m_cms",
".",
"getRequestContext",
"(",
")",
".",
"getSiteRoot",
"(",
")",
",",
"getLogChannel",
"(",
")",
")",
";",
... | Initialize a HTML report for this Thread.<p>
@param locale the locale for the report output messages | [
"Initialize",
"a",
"HTML",
"report",
"for",
"this",
"Thread",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/report/A_CmsReportThread.java#L255-L258 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkContinue | private Environment checkContinue(Stmt.Continue stmt, Environment environment, EnclosingScope scope) {
// FIXME: need to check environment to the continue destination
return FlowTypeUtils.BOTTOM;
} | java | private Environment checkContinue(Stmt.Continue stmt, Environment environment, EnclosingScope scope) {
// FIXME: need to check environment to the continue destination
return FlowTypeUtils.BOTTOM;
} | [
"private",
"Environment",
"checkContinue",
"(",
"Stmt",
".",
"Continue",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"// FIXME: need to check environment to the continue destination",
"return",
"FlowTypeUtils",
".",
"BOTTOM",
";",
... | Type check a continue statement. This requires propagating the current
environment to the block destination, to ensure that the actual types of all
variables at that point are precise.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"a",
"continue",
"statement",
".",
"This",
"requires",
"propagating",
"the",
"current",
"environment",
"to",
"the",
"block",
"destination",
"to",
"ensure",
"that",
"the",
"actual",
"types",
"of",
"all",
"variables",
"at",
"that",
"point",
"are... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L481-L484 |
magik6k/JWWF | src/main/java/net/magik6k/jwwf/widgets/basic/panel/TablePanel.java | TablePanel.put | public TablePanel put(Widget widget, int x, int y) {
if (x < 0 || y < 0 || x >= content.length || y >= content[x].length)
throw new IndexOutOfBoundsException();
attach(widget);
content[x][y] = widget;
this.sendElement();
return this;
} | java | public TablePanel put(Widget widget, int x, int y) {
if (x < 0 || y < 0 || x >= content.length || y >= content[x].length)
throw new IndexOutOfBoundsException();
attach(widget);
content[x][y] = widget;
this.sendElement();
return this;
} | [
"public",
"TablePanel",
"put",
"(",
"Widget",
"widget",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"x",
"<",
"0",
"||",
"y",
"<",
"0",
"||",
"x",
">=",
"content",
".",
"length",
"||",
"y",
">=",
"content",
"[",
"x",
"]",
".",
"len... | Set widget to certain cell in table
@param widget Widget to set
@param x Column
@param y Row
@return This instance for chaining | [
"Set",
"widget",
"to",
"certain",
"cell",
"in",
"table"
] | train | https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/widgets/basic/panel/TablePanel.java#L195-L202 |
alkacon/opencms-core | src/org/opencms/gwt/CmsVfsService.java | CmsVfsService.makeEntryBean | protected CmsVfsEntryBean makeEntryBean(CmsResource resource, boolean root) throws CmsException {
CmsObject cms = getCmsObject();
boolean isFolder = resource.isFolder();
String name = root ? "/" : resource.getName();
String path = cms.getSitePath(resource);
boolean hasChildren = false;
if (isFolder) {
List<CmsResource> children = cms.getResourcesInFolder(
cms.getRequestContext().getSitePath(resource),
CmsResourceFilter.DEFAULT);
if (!children.isEmpty()) {
hasChildren = true;
}
}
String resourceType = OpenCms.getResourceManager().getResourceType(resource.getTypeId()).getTypeName();
return new CmsVfsEntryBean(path, name, resourceType, isFolder, hasChildren);
} | java | protected CmsVfsEntryBean makeEntryBean(CmsResource resource, boolean root) throws CmsException {
CmsObject cms = getCmsObject();
boolean isFolder = resource.isFolder();
String name = root ? "/" : resource.getName();
String path = cms.getSitePath(resource);
boolean hasChildren = false;
if (isFolder) {
List<CmsResource> children = cms.getResourcesInFolder(
cms.getRequestContext().getSitePath(resource),
CmsResourceFilter.DEFAULT);
if (!children.isEmpty()) {
hasChildren = true;
}
}
String resourceType = OpenCms.getResourceManager().getResourceType(resource.getTypeId()).getTypeName();
return new CmsVfsEntryBean(path, name, resourceType, isFolder, hasChildren);
} | [
"protected",
"CmsVfsEntryBean",
"makeEntryBean",
"(",
"CmsResource",
"resource",
",",
"boolean",
"root",
")",
"throws",
"CmsException",
"{",
"CmsObject",
"cms",
"=",
"getCmsObject",
"(",
")",
";",
"boolean",
"isFolder",
"=",
"resource",
".",
"isFolder",
"(",
")"... | Helper method for creating a VFS entry bean from a resource.<p>
@param resource the resource whose data should be stored in the bean
@param root true if the resource is a root resource
@return the data bean representing the resource
@throws CmsException if something goes wrong | [
"Helper",
"method",
"for",
"creating",
"a",
"VFS",
"entry",
"bean",
"from",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsVfsService.java#L1235-L1253 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java | ArrayFunctions.arrayReplace | public static Expression arrayReplace(String expression, Expression value1, Expression value2, long n) {
return arrayReplace(x(expression), value1, value2, n);
} | java | public static Expression arrayReplace(String expression, Expression value1, Expression value2, long n) {
return arrayReplace(x(expression), value1, value2, n);
} | [
"public",
"static",
"Expression",
"arrayReplace",
"(",
"String",
"expression",
",",
"Expression",
"value1",
",",
"Expression",
"value2",
",",
"long",
"n",
")",
"{",
"return",
"arrayReplace",
"(",
"x",
"(",
"expression",
")",
",",
"value1",
",",
"value2",
","... | Returned expression results in new array with at most n occurrences of value1 replaced with value2. | [
"Returned",
"expression",
"results",
"in",
"new",
"array",
"with",
"at",
"most",
"n",
"occurrences",
"of",
"value1",
"replaced",
"with",
"value2",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L424-L426 |
real-logic/agrona | agrona/src/main/java/org/agrona/IoUtil.java | IoUtil.mapExistingFile | public static MappedByteBuffer mapExistingFile(
final File location,
final FileChannel.MapMode mapMode,
final String descriptionLabel)
{
checkFileExists(location, descriptionLabel);
MappedByteBuffer mappedByteBuffer = null;
try (RandomAccessFile file = new RandomAccessFile(location, "rw");
FileChannel channel = file.getChannel())
{
mappedByteBuffer = channel.map(mapMode, 0, channel.size());
}
catch (final IOException ex)
{
LangUtil.rethrowUnchecked(ex);
}
return mappedByteBuffer;
} | java | public static MappedByteBuffer mapExistingFile(
final File location,
final FileChannel.MapMode mapMode,
final String descriptionLabel)
{
checkFileExists(location, descriptionLabel);
MappedByteBuffer mappedByteBuffer = null;
try (RandomAccessFile file = new RandomAccessFile(location, "rw");
FileChannel channel = file.getChannel())
{
mappedByteBuffer = channel.map(mapMode, 0, channel.size());
}
catch (final IOException ex)
{
LangUtil.rethrowUnchecked(ex);
}
return mappedByteBuffer;
} | [
"public",
"static",
"MappedByteBuffer",
"mapExistingFile",
"(",
"final",
"File",
"location",
",",
"final",
"FileChannel",
".",
"MapMode",
"mapMode",
",",
"final",
"String",
"descriptionLabel",
")",
"{",
"checkFileExists",
"(",
"location",
",",
"descriptionLabel",
")... | Check that file exists, open file, and return MappedByteBuffer for entire file for a given
{@link java.nio.channels.FileChannel.MapMode}.
<p>
The file itself will be closed, but the mapping will persist.
@param location of the file to map
@param mapMode for the mapping
@param descriptionLabel to be associated for any exceptions
@return {@link java.nio.MappedByteBuffer} for the file | [
"Check",
"that",
"file",
"exists",
"open",
"file",
"and",
"return",
"MappedByteBuffer",
"for",
"entire",
"file",
"for",
"a",
"given",
"{",
"@link",
"java",
".",
"nio",
".",
"channels",
".",
"FileChannel",
".",
"MapMode",
"}",
".",
"<p",
">",
"The",
"file... | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/IoUtil.java#L314-L333 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java | ModelControllerImpl.awaitContainerStability | void awaitContainerStability(long timeout, TimeUnit timeUnit, final boolean interruptibly)
throws InterruptedException, TimeoutException {
if (interruptibly) {
stateMonitor.awaitStability(timeout, timeUnit);
} else {
stateMonitor.awaitStabilityUninterruptibly(timeout, timeUnit);
}
} | java | void awaitContainerStability(long timeout, TimeUnit timeUnit, final boolean interruptibly)
throws InterruptedException, TimeoutException {
if (interruptibly) {
stateMonitor.awaitStability(timeout, timeUnit);
} else {
stateMonitor.awaitStabilityUninterruptibly(timeout, timeUnit);
}
} | [
"void",
"awaitContainerStability",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
",",
"final",
"boolean",
"interruptibly",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"if",
"(",
"interruptibly",
")",
"{",
"stateMonitor",
".",
"awaitSt... | Await service container stability.
@param timeout maximum period to wait for service container stability
@param timeUnit unit in which {@code timeout} is expressed
@param interruptibly {@code true} if thread interruption should be ignored
@throws java.lang.InterruptedException if {@code interruptibly} is {@code false} and the thread is interrupted while awaiting service container stability
@throws java.util.concurrent.TimeoutException if service container stability is not reached before the specified timeout | [
"Await",
"service",
"container",
"stability",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java#L816-L823 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java | NamespacesInner.deleteAuthorizationRule | public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) {
deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body();
} | java | public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) {
deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body();
} | [
"public",
"void",
"deleteAuthorizationRule",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
",",
"String",
"authorizationRuleName",
")",
"{",
"deleteAuthorizationRuleWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"namespaceName",
",",
"authoriz... | Deletes a namespace authorization rule.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@param authorizationRuleName Authorization Rule Name.
@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 | [
"Deletes",
"a",
"namespace",
"authorization",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java#L765-L767 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java | CsvFileExtensions.formatToCSV | public static void formatToCSV(final File input, final File output, final String encoding)
throws IOException
{
final List<String> list = readLinesInList(input, "UTF-8");
final String sb = formatListToString(list);
WriteFileExtensions.writeStringToFile(output, sb, encoding);
} | java | public static void formatToCSV(final File input, final File output, final String encoding)
throws IOException
{
final List<String> list = readLinesInList(input, "UTF-8");
final String sb = formatListToString(list);
WriteFileExtensions.writeStringToFile(output, sb, encoding);
} | [
"public",
"static",
"void",
"formatToCSV",
"(",
"final",
"File",
"input",
",",
"final",
"File",
"output",
",",
"final",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
"String",
">",
"list",
"=",
"readLinesInList",
"(",
"input"... | Formats a file that has in every line one input-data into a csv-file.
@param input
The input-file to format. The current format from the file is every data in a
line.
@param output
The file where the formatted data should be inserted.
@param encoding
the encoding
@throws IOException
When an io error occurs. | [
"Formats",
"a",
"file",
"that",
"has",
"in",
"every",
"line",
"one",
"input",
"-",
"data",
"into",
"a",
"csv",
"-",
"file",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L143-L149 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java | XNodeSet.greaterThan | public boolean greaterThan(XObject obj2) throws javax.xml.transform.TransformerException
{
return compare(obj2, S_GT);
} | java | public boolean greaterThan(XObject obj2) throws javax.xml.transform.TransformerException
{
return compare(obj2, S_GT);
} | [
"public",
"boolean",
"greaterThan",
"(",
"XObject",
"obj2",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"return",
"compare",
"(",
"obj2",
",",
"S_GT",
")",
";",
"}"
] | Tell if one object is less than the other.
@param obj2 object to compare this nodeset to
@return see this.compare(...)
@throws javax.xml.transform.TransformerException | [
"Tell",
"if",
"one",
"object",
"is",
"less",
"than",
"the",
"other",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L672-L675 |
google/closure-compiler | src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java | DevirtualizePrototypeMethods.replaceReferencesToThis | private void replaceReferencesToThis(Node node, String name) {
if (node.isFunction() && !node.isArrowFunction()) {
// Functions (besides arrows) create a new binding for `this`.
return;
}
for (Node child : node.children()) {
if (child.isThis()) {
Node newName = IR.name(name).useSourceInfoFrom(child).setJSType(child.getJSType());
node.replaceChild(child, newName);
compiler.reportChangeToEnclosingScope(newName);
} else {
replaceReferencesToThis(child, name);
}
}
} | java | private void replaceReferencesToThis(Node node, String name) {
if (node.isFunction() && !node.isArrowFunction()) {
// Functions (besides arrows) create a new binding for `this`.
return;
}
for (Node child : node.children()) {
if (child.isThis()) {
Node newName = IR.name(name).useSourceInfoFrom(child).setJSType(child.getJSType());
node.replaceChild(child, newName);
compiler.reportChangeToEnclosingScope(newName);
} else {
replaceReferencesToThis(child, name);
}
}
} | [
"private",
"void",
"replaceReferencesToThis",
"(",
"Node",
"node",
",",
"String",
"name",
")",
"{",
"if",
"(",
"node",
".",
"isFunction",
"(",
")",
"&&",
"!",
"node",
".",
"isArrowFunction",
"(",
")",
")",
"{",
"// Functions (besides arrows) create a new binding... | Replaces references to "this" with references to name. Do not traverse function boundaries. | [
"Replaces",
"references",
"to",
"this",
"with",
"references",
"to",
"name",
".",
"Do",
"not",
"traverse",
"function",
"boundaries",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java#L475-L490 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/meta/LockedInodePath.java | LockedInodePath.lockFinalEdgeWrite | public LockedInodePath lockFinalEdgeWrite() throws InvalidPathException {
Preconditions.checkState(!fullPathExists());
LockedInodePath newPath =
new LockedInodePath(mUri, this, mPathComponents, LockPattern.WRITE_EDGE);
newPath.traverse();
return newPath;
} | java | public LockedInodePath lockFinalEdgeWrite() throws InvalidPathException {
Preconditions.checkState(!fullPathExists());
LockedInodePath newPath =
new LockedInodePath(mUri, this, mPathComponents, LockPattern.WRITE_EDGE);
newPath.traverse();
return newPath;
} | [
"public",
"LockedInodePath",
"lockFinalEdgeWrite",
"(",
")",
"throws",
"InvalidPathException",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"fullPathExists",
"(",
")",
")",
";",
"LockedInodePath",
"newPath",
"=",
"new",
"LockedInodePath",
"(",
"mUri",
",",
"... | Returns a copy of the path with the final edge write locked. This requires that we haven't
already locked the final edge, i.e. the path is incomplete.
@return the new locked path | [
"Returns",
"a",
"copy",
"of",
"the",
"path",
"with",
"the",
"final",
"edge",
"write",
"locked",
".",
"This",
"requires",
"that",
"we",
"haven",
"t",
"already",
"locked",
"the",
"final",
"edge",
"i",
".",
"e",
".",
"the",
"path",
"is",
"incomplete",
"."... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/LockedInodePath.java#L416-L423 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/concurrent/atomiclong/AtomicLongContainerCollector.java | AtomicLongContainerCollector.onIteration | @Override
protected void onIteration(String containerName, AtomicLongContainer container) {
AtomicLongConfig atomicLongConfig = config.findAtomicLongConfig(containerName);
containerNames.put(container, containerName);
containerPolicies.put(container, atomicLongConfig.getMergePolicyConfig());
} | java | @Override
protected void onIteration(String containerName, AtomicLongContainer container) {
AtomicLongConfig atomicLongConfig = config.findAtomicLongConfig(containerName);
containerNames.put(container, containerName);
containerPolicies.put(container, atomicLongConfig.getMergePolicyConfig());
} | [
"@",
"Override",
"protected",
"void",
"onIteration",
"(",
"String",
"containerName",
",",
"AtomicLongContainer",
"container",
")",
"{",
"AtomicLongConfig",
"atomicLongConfig",
"=",
"config",
".",
"findAtomicLongConfig",
"(",
"containerName",
")",
";",
"containerNames",
... | The {@link AtomicLongContainer} doesn't know its name or configuration, so we create these lookup maps.
This is cheaper than storing this information permanently in the container. | [
"The",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/concurrent/atomiclong/AtomicLongContainerCollector.java#L47-L53 |
greese/dasein-util | src/main/java/org/dasein/util/ConcurrentMultiCache.java | ConcurrentMultiCache.find | public T find(String key, Object val) {
return find(key, val, null);
} | java | public T find(String key, Object val) {
return find(key, val, null);
} | [
"public",
"T",
"find",
"(",
"String",
"key",
",",
"Object",
"val",
")",
"{",
"return",
"find",
"(",
"key",
",",
"val",
",",
"null",
")",
";",
"}"
] | Returns the object identified by the specified key/value pair if it is currently
in memory in the cache. Just because this value returns <code>null</code> does
not mean the object does not exist. Instead, it may be that it is simply not
cached in memory.
@param key they unique identifier attribute on which you are searching
@param val the value of the unique identifier on which you are searching
@return the matching object from the cache | [
"Returns",
"the",
"object",
"identified",
"by",
"the",
"specified",
"key",
"/",
"value",
"pair",
"if",
"it",
"is",
"currently",
"in",
"memory",
"in",
"the",
"cache",
".",
"Just",
"because",
"this",
"value",
"returns",
"<code",
">",
"null<",
"/",
"code",
... | train | https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentMultiCache.java#L210-L212 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/AbstractBusPrimitive.java | AbstractBusPrimitive.removeListener | protected final <T extends EventListener> void removeListener(Class<T> listenerType, T listener) {
if (this.listeners != null) {
this.listeners.remove(listenerType, listener);
if (this.listeners.isEmpty()) {
this.listeners = null;
}
}
} | java | protected final <T extends EventListener> void removeListener(Class<T> listenerType, T listener) {
if (this.listeners != null) {
this.listeners.remove(listenerType, listener);
if (this.listeners.isEmpty()) {
this.listeners = null;
}
}
} | [
"protected",
"final",
"<",
"T",
"extends",
"EventListener",
">",
"void",
"removeListener",
"(",
"Class",
"<",
"T",
">",
"listenerType",
",",
"T",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"!=",
"null",
")",
"{",
"this",
".",
"listeners",... | Remove a listener.
@param <T> is the type of listener to add.
@param listenerType is the type of listener to remove.
@param listener is the new listener. | [
"Remove",
"a",
"listener",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/AbstractBusPrimitive.java#L162-L169 |
Azure/azure-sdk-for-java | locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java | ManagementLocksInner.deleteAtResourceLevelAsync | public Observable<Void> deleteAtResourceLevelAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) {
return deleteAtResourceLevelWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteAtResourceLevelAsync(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) {
return deleteAtResourceLevelWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteAtResourceLevelAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceProviderNamespace",
",",
"String",
"parentResourcePath",
",",
"String",
"resourceType",
",",
"String",
"resourceName",
",",
"String",
"loc... | Deletes the management lock of a resource or any level below the resource.
To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
@param resourceGroupName The name of the resource group containing the resource with the lock to delete.
@param resourceProviderNamespace The resource provider namespace of the resource with the lock to delete.
@param parentResourcePath The parent resource identity.
@param resourceType The resource type of the resource with the lock to delete.
@param resourceName The name of the resource with the lock to delete.
@param lockName The name of the lock to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Deletes",
"the",
"management",
"lock",
"of",
"a",
"resource",
"or",
"any",
"level",
"below",
"the",
"resource",
".",
"To",
"delete",
"management",
"locks",
"you",
"must",
"have",
"access",
"to",
"Microsoft",
".",
"Authorization",
"/",
"*",
"or",
"Microsoft"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L849-L856 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getRegexEntityEntityInfo | public RegexEntityExtractor getRegexEntityEntityInfo(UUID appId, String versionId, UUID regexEntityId) {
return getRegexEntityEntityInfoWithServiceResponseAsync(appId, versionId, regexEntityId).toBlocking().single().body();
} | java | public RegexEntityExtractor getRegexEntityEntityInfo(UUID appId, String versionId, UUID regexEntityId) {
return getRegexEntityEntityInfoWithServiceResponseAsync(appId, versionId, regexEntityId).toBlocking().single().body();
} | [
"public",
"RegexEntityExtractor",
"getRegexEntityEntityInfo",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"regexEntityId",
")",
"{",
"return",
"getRegexEntityEntityInfoWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"regexEntityId",
")",... | Gets information of a regex entity model.
@param appId The application ID.
@param versionId The version ID.
@param regexEntityId The regex entity model ID.
@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 RegexEntityExtractor object if successful. | [
"Gets",
"information",
"of",
"a",
"regex",
"entity",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10179-L10181 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/common/impl/URLFileUpdater.java | URLFileUpdater.applyCacheHeaders | private void applyCacheHeaders(final Properties cacheProperties, final httpClientInteraction method) {
if (isCachedContentPresent() && null != contentType) {
if (cacheProperties.containsKey(E_TAG)) {
method.setRequestHeader(IF_NONE_MATCH, cacheProperties.getProperty(E_TAG));
}
if (cacheProperties.containsKey(LAST_MODIFIED)) {
method.setRequestHeader(IF_MODIFIED_SINCE, cacheProperties.getProperty(LAST_MODIFIED));
}
}
} | java | private void applyCacheHeaders(final Properties cacheProperties, final httpClientInteraction method) {
if (isCachedContentPresent() && null != contentType) {
if (cacheProperties.containsKey(E_TAG)) {
method.setRequestHeader(IF_NONE_MATCH, cacheProperties.getProperty(E_TAG));
}
if (cacheProperties.containsKey(LAST_MODIFIED)) {
method.setRequestHeader(IF_MODIFIED_SINCE, cacheProperties.getProperty(LAST_MODIFIED));
}
}
} | [
"private",
"void",
"applyCacheHeaders",
"(",
"final",
"Properties",
"cacheProperties",
",",
"final",
"httpClientInteraction",
"method",
")",
"{",
"if",
"(",
"isCachedContentPresent",
"(",
")",
"&&",
"null",
"!=",
"contentType",
")",
"{",
"if",
"(",
"cachePropertie... | Add appropriate cache headers to the request method, but only if there is valid data in the cache (content type
as well as file content) | [
"Add",
"appropriate",
"cache",
"headers",
"to",
"the",
"request",
"method",
"but",
"only",
"if",
"there",
"is",
"valid",
"data",
"in",
"the",
"cache",
"(",
"content",
"type",
"as",
"well",
"as",
"file",
"content",
")"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/impl/URLFileUpdater.java#L316-L325 |
voldemort/voldemort | src/java/voldemort/utils/UpdateClusterUtils.java | UpdateClusterUtils.updateNode | public static Node updateNode(Node node, List<Integer> partitionsList) {
return new Node(node.getId(),
node.getHost(),
node.getHttpPort(),
node.getSocketPort(),
node.getAdminPort(),
node.getZoneId(),
partitionsList);
} | java | public static Node updateNode(Node node, List<Integer> partitionsList) {
return new Node(node.getId(),
node.getHost(),
node.getHttpPort(),
node.getSocketPort(),
node.getAdminPort(),
node.getZoneId(),
partitionsList);
} | [
"public",
"static",
"Node",
"updateNode",
"(",
"Node",
"node",
",",
"List",
"<",
"Integer",
">",
"partitionsList",
")",
"{",
"return",
"new",
"Node",
"(",
"node",
".",
"getId",
"(",
")",
",",
"node",
".",
"getHost",
"(",
")",
",",
"node",
".",
"getHt... | Creates a replica of the node with the new partitions list
@param node The node whose replica we are creating
@param partitionsList The new partitions list
@return Replica of node with new partitions list | [
"Creates",
"a",
"replica",
"of",
"the",
"node",
"with",
"the",
"new",
"partitions",
"list"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/UpdateClusterUtils.java#L50-L58 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java | ElementPlugin.setPropertyValue | @Override
public void setPropertyValue(PropertyInfo propInfo, Object value) throws Exception {
String propId = propInfo.getId();
Object obj = registeredProperties == null ? null : registeredProperties.get(propId);
if (obj == null) {
obj = new PropertyProxy(propInfo, value);
registerProperties(obj, propId);
} else if (obj instanceof PropertyProxy) {
((PropertyProxy) obj).setValue(value);
} else {
propInfo.setPropertyValue(obj, value, obj == this);
}
} | java | @Override
public void setPropertyValue(PropertyInfo propInfo, Object value) throws Exception {
String propId = propInfo.getId();
Object obj = registeredProperties == null ? null : registeredProperties.get(propId);
if (obj == null) {
obj = new PropertyProxy(propInfo, value);
registerProperties(obj, propId);
} else if (obj instanceof PropertyProxy) {
((PropertyProxy) obj).setValue(value);
} else {
propInfo.setPropertyValue(obj, value, obj == this);
}
} | [
"@",
"Override",
"public",
"void",
"setPropertyValue",
"(",
"PropertyInfo",
"propInfo",
",",
"Object",
"value",
")",
"throws",
"Exception",
"{",
"String",
"propId",
"=",
"propInfo",
".",
"getId",
"(",
")",
";",
"Object",
"obj",
"=",
"registeredProperties",
"==... | Sets a value for a registered property.
@param propInfo Property info.
@param value The value to set.
@throws Exception Unspecified exception. | [
"Sets",
"a",
"value",
"for",
"a",
"registered",
"property",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java#L261-L274 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.