repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkPeeringsInner.java | VirtualNetworkPeeringsInner.listAsync | public Observable<Page<VirtualNetworkPeeringInner>> listAsync(final String resourceGroupName, final String virtualNetworkName) {
return listWithServiceResponseAsync(resourceGroupName, virtualNetworkName)
.map(new Func1<ServiceResponse<Page<VirtualNetworkPeeringInner>>, Page<VirtualNetworkPeeringInner>>() {
@Override
public Page<VirtualNetworkPeeringInner> call(ServiceResponse<Page<VirtualNetworkPeeringInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<VirtualNetworkPeeringInner>> listAsync(final String resourceGroupName, final String virtualNetworkName) {
return listWithServiceResponseAsync(resourceGroupName, virtualNetworkName)
.map(new Func1<ServiceResponse<Page<VirtualNetworkPeeringInner>>, Page<VirtualNetworkPeeringInner>>() {
@Override
public Page<VirtualNetworkPeeringInner> call(ServiceResponse<Page<VirtualNetworkPeeringInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"VirtualNetworkPeeringInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"virtualNetworkName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Gets all virtual network peerings in a virtual network.
@param resourceGroupName The name of the resource group.
@param virtualNetworkName The name of the virtual network.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<VirtualNetworkPeeringInner> object | [
"Gets",
"all",
"virtual",
"network",
"peerings",
"in",
"a",
"virtual",
"network",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkPeeringsInner.java#L581-L589 |
mgormley/prim | src/main/java/edu/jhu/prim/sample/PairSampler.java | PairSampler.sampleOrderedPairs | public static Collection<OrderedPair> sampleOrderedPairs(int minI, int maxI, int minJ, int maxJ, double prop) {
int numI = maxI - minI;
int numJ = maxJ - minJ;
// Count the max number possible:
long maxPairs = numI * numJ;
Collection<OrderedPair> samples;
if (maxPairs < 400000000 || prop > 0.1) {
samples = new ArrayList<OrderedPair>();
for (int i=minI; i<maxI; i++) {
for (int j=minJ; j<maxJ; j++) {
if (prop >= 1.0 || Prng.nextDouble() < prop) {
samples.add(new OrderedPair(i, j));
}
}
}
} else {
samples = new HashSet<OrderedPair>();
double numSamples = maxPairs * prop;
while (samples.size() < numSamples) {
int i = Prng.nextInt(numI) + minI;
int j = Prng.nextInt(numJ) + minJ;
samples.add(new OrderedPair(i, j));
}
}
return samples;
} | java | public static Collection<OrderedPair> sampleOrderedPairs(int minI, int maxI, int minJ, int maxJ, double prop) {
int numI = maxI - minI;
int numJ = maxJ - minJ;
// Count the max number possible:
long maxPairs = numI * numJ;
Collection<OrderedPair> samples;
if (maxPairs < 400000000 || prop > 0.1) {
samples = new ArrayList<OrderedPair>();
for (int i=minI; i<maxI; i++) {
for (int j=minJ; j<maxJ; j++) {
if (prop >= 1.0 || Prng.nextDouble() < prop) {
samples.add(new OrderedPair(i, j));
}
}
}
} else {
samples = new HashSet<OrderedPair>();
double numSamples = maxPairs * prop;
while (samples.size() < numSamples) {
int i = Prng.nextInt(numI) + minI;
int j = Prng.nextInt(numJ) + minJ;
samples.add(new OrderedPair(i, j));
}
}
return samples;
} | [
"public",
"static",
"Collection",
"<",
"OrderedPair",
">",
"sampleOrderedPairs",
"(",
"int",
"minI",
",",
"int",
"maxI",
",",
"int",
"minJ",
",",
"int",
"maxJ",
",",
"double",
"prop",
")",
"{",
"int",
"numI",
"=",
"maxI",
"-",
"minI",
";",
"int",
"numJ... | Sample with replacement ordered pairs of integers.
@param minI The minimum value for i (inclusive).
@param maxI The maximum value for i (exclusive).
@param minJ The minimum value for j (inclusive).
@param maxJ The maximum value for j (exclusive).
@param prop The proportion of possible pairs to return.
@return A collection of ordered pairs. | [
"Sample",
"with",
"replacement",
"ordered",
"pairs",
"of",
"integers",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/sample/PairSampler.java#L27-L57 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.translationRotate | public Matrix4f translationRotate(float tx, float ty, float tz, Quaternionfc quat) {
return translationRotate(tx, ty, tz, quat.x(), quat.y(), quat.z(), quat.w());
} | java | public Matrix4f translationRotate(float tx, float ty, float tz, Quaternionfc quat) {
return translationRotate(tx, ty, tz, quat.x(), quat.y(), quat.z(), quat.w());
} | [
"public",
"Matrix4f",
"translationRotate",
"(",
"float",
"tx",
",",
"float",
"ty",
",",
"float",
"tz",
",",
"Quaternionfc",
"quat",
")",
"{",
"return",
"translationRotate",
"(",
"tx",
",",
"ty",
",",
"tz",
",",
"quat",
".",
"x",
"(",
")",
",",
"quat",
... | Set <code>this</code> matrix to <code>T * R</code>, where <code>T</code> is a translation by the given <code>(tx, ty, tz)</code> and
<code>R</code> is a rotation - and possibly scaling - transformation specified by the given quaternion.
<p>
When transforming a vector by the resulting matrix the rotation - and possibly scaling - transformation will be applied first and then the translation.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
This method is equivalent to calling: <code>translation(tx, ty, tz).rotate(quat)</code>
@see #translation(float, float, float)
@see #rotate(Quaternionfc)
@param tx
the number of units by which to translate the x-component
@param ty
the number of units by which to translate the y-component
@param tz
the number of units by which to translate the z-component
@param quat
the quaternion representing a rotation
@return this | [
"Set",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"to",
"<code",
">",
"T",
"*",
"R<",
"/",
"code",
">",
"where",
"<code",
">",
"T<",
"/",
"code",
">",
"is",
"a",
"translation",
"by",
"the",
"given",
"<code",
">",
"(",
"tx",
"ty",
"tz",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L4479-L4481 |
alkacon/opencms-core | src/org/opencms/ui/apps/A_CmsWorkplaceApp.java | A_CmsWorkplaceApp.openSubView | public void openSubView(String state, boolean updateState) {
if (updateState) {
CmsAppWorkplaceUi.get().changeCurrentAppState(state);
}
Component comp = getComponentForState(state);
if (comp != null) {
comp.setSizeFull();
m_rootLayout.setMainContent(comp);
} else {
m_rootLayout.setMainContent(new Label("Malformed path, tool not available for path: " + state));
}
updateSubNav(getSubNavEntries(state));
updateBreadCrumb(getBreadCrumbForState(state));
} | java | public void openSubView(String state, boolean updateState) {
if (updateState) {
CmsAppWorkplaceUi.get().changeCurrentAppState(state);
}
Component comp = getComponentForState(state);
if (comp != null) {
comp.setSizeFull();
m_rootLayout.setMainContent(comp);
} else {
m_rootLayout.setMainContent(new Label("Malformed path, tool not available for path: " + state));
}
updateSubNav(getSubNavEntries(state));
updateBreadCrumb(getBreadCrumbForState(state));
} | [
"public",
"void",
"openSubView",
"(",
"String",
"state",
",",
"boolean",
"updateState",
")",
"{",
"if",
"(",
"updateState",
")",
"{",
"CmsAppWorkplaceUi",
".",
"get",
"(",
")",
".",
"changeCurrentAppState",
"(",
"state",
")",
";",
"}",
"Component",
"comp",
... | Opens the requested sub view.<p>
@param state the state
@param updateState <code>true</code> to update the state URL token | [
"Opens",
"the",
"requested",
"sub",
"view",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/A_CmsWorkplaceApp.java#L292-L306 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.delegatedAccount_email_filter_name_DELETE | public ArrayList<OvhTaskFilter> delegatedAccount_email_filter_name_DELETE(String email, String name) throws IOException {
String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}";
StringBuilder sb = path(qPath, email, name);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<OvhTaskFilter> delegatedAccount_email_filter_name_DELETE(String email, String name) throws IOException {
String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}";
StringBuilder sb = path(qPath, email, name);
String resp = exec(qPath, "DELETE", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"OvhTaskFilter",
">",
"delegatedAccount_email_filter_name_DELETE",
"(",
"String",
"email",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/delegatedAccount/{email}/filter/{name}\"",
";",
"StringB... | Delete an existing filter
REST: DELETE /email/domain/delegatedAccount/{email}/filter/{name}
@param email [required] Email
@param name [required] Filter name | [
"Delete",
"an",
"existing",
"filter"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L258-L263 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/vertex/impl/rnn/ReverseTimeSeriesVertex.java | ReverseTimeSeriesVertex.revertTimeSeries | private static INDArray revertTimeSeries(INDArray input, INDArray mask, LayerWorkspaceMgr workspaceMgr, ArrayType type) {
// Get number of samples
val n = input.size(0);
// Get maximal length of a time series
val m = input.size(2);
// Create empty output
INDArray out = workspaceMgr.create(type, input.dataType(), input.shape(), 'f');
// Iterate over all samples
for (int s = 0; s < n; s++) {
long t1 = 0; // Original time step
long t2 = m - 1; // Destination time step
// Revert Sample: Copy from origin (t1) to destination (t2)
while (t1 < m && t2 >= 0) {
// If mask is set: ignore padding
if (mask != null) {
// Origin: find next time step
while (t1 < m && mask.getDouble(s, t1) == 0) {
t1++;
}
// Destination: find next time step
while (t2 >= 0 && mask.getDouble(s, t2) == 0) {
t2--;
}
}
// Get the feature vector for the given sample and origin time step
// The vector contains features (forward pass) or errors (backward pass)
INDArray vec = input.get(
NDArrayIndex.point(s),
NDArrayIndex.all(),
NDArrayIndex.point(t1)
);
// Put the feature vector to the given destination in the output
out.put(new INDArrayIndex[]{
NDArrayIndex.point(s),
NDArrayIndex.all(),
NDArrayIndex.point(t2)
},
vec
);
// Move on
t1++;
t2--;
}
}
// Return the output
return out;
} | java | private static INDArray revertTimeSeries(INDArray input, INDArray mask, LayerWorkspaceMgr workspaceMgr, ArrayType type) {
// Get number of samples
val n = input.size(0);
// Get maximal length of a time series
val m = input.size(2);
// Create empty output
INDArray out = workspaceMgr.create(type, input.dataType(), input.shape(), 'f');
// Iterate over all samples
for (int s = 0; s < n; s++) {
long t1 = 0; // Original time step
long t2 = m - 1; // Destination time step
// Revert Sample: Copy from origin (t1) to destination (t2)
while (t1 < m && t2 >= 0) {
// If mask is set: ignore padding
if (mask != null) {
// Origin: find next time step
while (t1 < m && mask.getDouble(s, t1) == 0) {
t1++;
}
// Destination: find next time step
while (t2 >= 0 && mask.getDouble(s, t2) == 0) {
t2--;
}
}
// Get the feature vector for the given sample and origin time step
// The vector contains features (forward pass) or errors (backward pass)
INDArray vec = input.get(
NDArrayIndex.point(s),
NDArrayIndex.all(),
NDArrayIndex.point(t1)
);
// Put the feature vector to the given destination in the output
out.put(new INDArrayIndex[]{
NDArrayIndex.point(s),
NDArrayIndex.all(),
NDArrayIndex.point(t2)
},
vec
);
// Move on
t1++;
t2--;
}
}
// Return the output
return out;
} | [
"private",
"static",
"INDArray",
"revertTimeSeries",
"(",
"INDArray",
"input",
",",
"INDArray",
"mask",
",",
"LayerWorkspaceMgr",
"workspaceMgr",
",",
"ArrayType",
"type",
")",
"{",
"// Get number of samples",
"val",
"n",
"=",
"input",
".",
"size",
"(",
"0",
")"... | Reverts the element order of a tensor along the 3rd axis (time series axis).
A masking tensor is used to restrict the revert to meaningful elements and keep the padding in place.
This method is self-inverse in the following sense:
{@code revertTensor( revertTensor (input, mask), mask )}
equals
{@code input}
@param input The input tensor
@param mask The masking tensor (1 for meaningful entries, 0 for padding)
@return The reverted mask. | [
"Reverts",
"the",
"element",
"order",
"of",
"a",
"tensor",
"along",
"the",
"3rd",
"axis",
"(",
"time",
"series",
"axis",
")",
".",
"A",
"masking",
"tensor",
"is",
"used",
"to",
"restrict",
"the",
"revert",
"to",
"meaningful",
"elements",
"and",
"keep",
"... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/vertex/impl/rnn/ReverseTimeSeriesVertex.java#L132-L187 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java | FilterInvoker.getMethodParam | protected Object getMethodParam(String methodName, String paramKey) {
if (CommonUtils.isEmpty(configContext)) {
return null;
}
Object o = configContext.get(buildMethodKey(methodName, paramKey));
return o == null ? configContext.get(paramKey) : o;
} | java | protected Object getMethodParam(String methodName, String paramKey) {
if (CommonUtils.isEmpty(configContext)) {
return null;
}
Object o = configContext.get(buildMethodKey(methodName, paramKey));
return o == null ? configContext.get(paramKey) : o;
} | [
"protected",
"Object",
"getMethodParam",
"(",
"String",
"methodName",
",",
"String",
"paramKey",
")",
"{",
"if",
"(",
"CommonUtils",
".",
"isEmpty",
"(",
"configContext",
")",
")",
"{",
"return",
"null",
";",
"}",
"Object",
"o",
"=",
"configContext",
".",
... | 取得方法的特殊参数配置
@param methodName 方法名
@param paramKey 参数关键字
@return 都找不到为null method param | [
"取得方法的特殊参数配置"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java#L202-L208 |
oaqa/uima-ecd | src/main/java/edu/cmu/lti/oaqa/ecd/driver/SimplePipelineRev803.java | SimplePipelineRev803.runPipeline | public static void runPipeline(final CAS cas, final AnalysisEngine... engines)
throws UIMAException, IOException {
if (engines.length == 0) {
return;
}
CasIterator casIter = engines[0].processAndOutputNewCASes(cas);
AnalysisEngine[] enginesRemains = Arrays.copyOfRange(engines, 1, engines.length);
while (casIter.hasNext()) {
CAS nextCas = casIter.next();
runPipeline(nextCas, enginesRemains);
nextCas.release();
}
} | java | public static void runPipeline(final CAS cas, final AnalysisEngine... engines)
throws UIMAException, IOException {
if (engines.length == 0) {
return;
}
CasIterator casIter = engines[0].processAndOutputNewCASes(cas);
AnalysisEngine[] enginesRemains = Arrays.copyOfRange(engines, 1, engines.length);
while (casIter.hasNext()) {
CAS nextCas = casIter.next();
runPipeline(nextCas, enginesRemains);
nextCas.release();
}
} | [
"public",
"static",
"void",
"runPipeline",
"(",
"final",
"CAS",
"cas",
",",
"final",
"AnalysisEngine",
"...",
"engines",
")",
"throws",
"UIMAException",
",",
"IOException",
"{",
"if",
"(",
"engines",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}",
... | Run a sequence of {@link AnalysisEngine analysis engines} over a {@link CAS}. This method
does not {@link AnalysisEngine#destroy() destroy} the engines or send them other events like
{@link AnalysisEngine#collectionProcessComplete()}. This is left to the caller.
@param cas
the CAS to process
@param engines
a sequence of analysis engines to run on the jCas
@throws UIMAException
@throws IOException | [
"Run",
"a",
"sequence",
"of",
"{",
"@link",
"AnalysisEngine",
"analysis",
"engines",
"}",
"over",
"a",
"{",
"@link",
"CAS",
"}",
".",
"This",
"method",
"does",
"not",
"{",
"@link",
"AnalysisEngine#destroy",
"()",
"destroy",
"}",
"the",
"engines",
"or",
"se... | train | https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/ecd/driver/SimplePipelineRev803.java#L251-L263 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/FeaturesImpl.java | FeaturesImpl.deletePhraseList | public OperationStatus deletePhraseList(UUID appId, String versionId, int phraselistId) {
return deletePhraseListWithServiceResponseAsync(appId, versionId, phraselistId).toBlocking().single().body();
} | java | public OperationStatus deletePhraseList(UUID appId, String versionId, int phraselistId) {
return deletePhraseListWithServiceResponseAsync(appId, versionId, phraselistId).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"deletePhraseList",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"int",
"phraselistId",
")",
"{",
"return",
"deletePhraseListWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"phraselistId",
")",
".",
"toBlocking",
... | Deletes a phraselist feature.
@param appId The application ID.
@param versionId The version ID.
@param phraselistId The ID of the feature to be deleted.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Deletes",
"a",
"phraselist",
"feature",
"."
] | 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/FeaturesImpl.java#L826-L828 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.hincrByFloat | @Override
public Double hincrByFloat(final byte[] key, final byte[] field, final double value) {
checkIsInMultiOrPipeline();
client.hincrByFloat(key, field, value);
final String dval = client.getBulkReply();
return (dval != null ? new Double(dval) : null);
} | java | @Override
public Double hincrByFloat(final byte[] key, final byte[] field, final double value) {
checkIsInMultiOrPipeline();
client.hincrByFloat(key, field, value);
final String dval = client.getBulkReply();
return (dval != null ? new Double(dval) : null);
} | [
"@",
"Override",
"public",
"Double",
"hincrByFloat",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"field",
",",
"final",
"double",
"value",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"hincrByFloat",
"(",
... | Increment the number stored at field in the hash at key by a double precision floating point
value. If key does not exist, a new key holding a hash is created. If field does not exist or
holds a string, the value is set to 0 before applying the operation. Since the value argument
is signed you can use this command to perform both increments and decrements.
<p>
The range of values supported by HINCRBYFLOAT is limited to double precision floating point
values.
<p>
<b>Time complexity:</b> O(1)
@param key
@param field
@param value
@return Double precision floating point reply The new value at field after the increment
operation. | [
"Increment",
"the",
"number",
"stored",
"at",
"field",
"in",
"the",
"hash",
"at",
"key",
"by",
"a",
"double",
"precision",
"floating",
"point",
"value",
".",
"If",
"key",
"does",
"not",
"exist",
"a",
"new",
"key",
"holding",
"a",
"hash",
"is",
"created",... | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1013-L1019 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUserSegmentRelPersistenceImpl.java | CommerceDiscountUserSegmentRelPersistenceImpl.findAll | @Override
public List<CommerceDiscountUserSegmentRel> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceDiscountUserSegmentRel> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscountUserSegmentRel",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce discount user segment rels.
@return the commerce discount user segment rels | [
"Returns",
"all",
"the",
"commerce",
"discount",
"user",
"segment",
"rels",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUserSegmentRelPersistenceImpl.java#L1729-L1732 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/reflect/MethodReflector.java | MethodReflector.invokeMethod | public static Object invokeMethod(Object obj, String name, Object... args) {
if (obj == null)
throw new NullPointerException("Object cannot be null");
if (name == null)
throw new NullPointerException("Method name cannot be null");
Class<?> objClass = obj.getClass();
for (Method method : objClass.getMethods()) {
try {
if (matchMethod(method, name))
return method.invoke(obj, args);
} catch (Throwable t) {
// Ignore exceptions
}
}
return null;
} | java | public static Object invokeMethod(Object obj, String name, Object... args) {
if (obj == null)
throw new NullPointerException("Object cannot be null");
if (name == null)
throw new NullPointerException("Method name cannot be null");
Class<?> objClass = obj.getClass();
for (Method method : objClass.getMethods()) {
try {
if (matchMethod(method, name))
return method.invoke(obj, args);
} catch (Throwable t) {
// Ignore exceptions
}
}
return null;
} | [
"public",
"static",
"Object",
"invokeMethod",
"(",
"Object",
"obj",
",",
"String",
"name",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"Object cannot be null\"",
")",
";",
"if",
... | Invokes an object method by its name with specified parameters.
@param obj an object to invoke.
@param name a name of the method to invoke.
@param args a list of method arguments.
@return the result of the method invocation or null if method returns void. | [
"Invokes",
"an",
"object",
"method",
"by",
"its",
"name",
"with",
"specified",
"parameters",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/MethodReflector.java#L65-L83 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbConnection.java | MariaDbConnection.setClientInfo | public void setClientInfo(final Properties properties) throws SQLClientInfoException {
Map<String, ClientInfoStatus> propertiesExceptions = new HashMap<>();
for (String name : new String[]{"ApplicationName", "ClientUser", "ClientHostname"}) {
try {
setClientInfo(name, properties.getProperty(name));
} catch (SQLClientInfoException e) {
propertiesExceptions.putAll(e.getFailedProperties());
}
}
if (!propertiesExceptions.isEmpty()) {
String errorMsg =
"setClientInfo errors : the following properties where not set : " + propertiesExceptions
.keySet();
throw new SQLClientInfoException(errorMsg, propertiesExceptions);
}
} | java | public void setClientInfo(final Properties properties) throws SQLClientInfoException {
Map<String, ClientInfoStatus> propertiesExceptions = new HashMap<>();
for (String name : new String[]{"ApplicationName", "ClientUser", "ClientHostname"}) {
try {
setClientInfo(name, properties.getProperty(name));
} catch (SQLClientInfoException e) {
propertiesExceptions.putAll(e.getFailedProperties());
}
}
if (!propertiesExceptions.isEmpty()) {
String errorMsg =
"setClientInfo errors : the following properties where not set : " + propertiesExceptions
.keySet();
throw new SQLClientInfoException(errorMsg, propertiesExceptions);
}
} | [
"public",
"void",
"setClientInfo",
"(",
"final",
"Properties",
"properties",
")",
"throws",
"SQLClientInfoException",
"{",
"Map",
"<",
"String",
",",
"ClientInfoStatus",
">",
"propertiesExceptions",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"String... | <p>Sets the value of the connection's client info properties. The <code>Properties</code>
object contains the names and values of the client info properties to be set. The set of
client info properties contained in the properties list replaces the current set of client info
properties on the connection. If a property that is currently set on the connection is not
present in the properties list, that property is cleared. Specifying an empty properties list
will clear all of the properties on the connection. See
<code>setClientInfo (String, String)</code> for more information.</p>
<p>If an error occurs in setting any of the client info properties, a
<code>SQLClientInfoException</code> is
thrown. The <code>SQLClientInfoException</code> contains information indicating which client
info properties were not set. The state of the client information is unknown because some
databases do not allow multiple client info properties to be set atomically. For those
databases, one or more properties may have been set before the error occurred.</p>
@param properties the list of client info properties to set
@throws SQLClientInfoException if the database server returns an error while setting the
clientInfo values on the database server or this method is
called on a closed connection
@see Connection#setClientInfo(String, String) setClientInfo(String, String)
@since 1.6 | [
"<p",
">",
"Sets",
"the",
"value",
"of",
"the",
"connection",
"s",
"client",
"info",
"properties",
".",
"The",
"<code",
">",
"Properties<",
"/",
"code",
">",
"object",
"contains",
"the",
"names",
"and",
"values",
"of",
"the",
"client",
"info",
"properties"... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbConnection.java#L1404-L1420 |
chen0040/java-genetic-programming | src/main/java/com/github/chen0040/gp/lgp/gp/PopulationInitialization.java | PopulationInitialization.initializeWithConstantLength | private static void initializeWithConstantLength(List<Program> programs, LGP manager, RandEngine randEngine) {
int popSize = manager.getPopulationSize();
for(int i=0; i<popSize; ++i)
{
Program lgp= new Program();
initialize(lgp, manager, randEngine, manager.getPopInitConstantProgramLength());
programs.add(lgp);
}
} | java | private static void initializeWithConstantLength(List<Program> programs, LGP manager, RandEngine randEngine) {
int popSize = manager.getPopulationSize();
for(int i=0; i<popSize; ++i)
{
Program lgp= new Program();
initialize(lgp, manager, randEngine, manager.getPopInitConstantProgramLength());
programs.add(lgp);
}
} | [
"private",
"static",
"void",
"initializeWithConstantLength",
"(",
"List",
"<",
"Program",
">",
"programs",
",",
"LGP",
"manager",
",",
"RandEngine",
"randEngine",
")",
"{",
"int",
"popSize",
"=",
"manager",
".",
"getPopulationSize",
"(",
")",
";",
"for",
"(",
... | the program length is distributed uniformly between iMinProgLength and iMaxProgLength | [
"the",
"program",
"length",
"is",
"distributed",
"uniformly",
"between",
"iMinProgLength",
"and",
"iMaxProgLength"
] | train | https://github.com/chen0040/java-genetic-programming/blob/498fc8f4407ea9d45f2e0ac797a8948da337c74f/src/main/java/com/github/chen0040/gp/lgp/gp/PopulationInitialization.java#L51-L60 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java | BitsUtil.unionSize | public static int unionSize(long[] x, long[] y) {
final int lx = x.length, ly = y.length;
final int min = (lx < ly) ? lx : ly;
int i = 0, res = 0;
for(; i < min; i++) {
res += Long.bitCount(x[i] | y[i]);
}
for(; i < lx; i++) {
res += Long.bitCount(x[i]);
}
for(; i < ly; i++) {
res += Long.bitCount(y[i]);
}
return res;
} | java | public static int unionSize(long[] x, long[] y) {
final int lx = x.length, ly = y.length;
final int min = (lx < ly) ? lx : ly;
int i = 0, res = 0;
for(; i < min; i++) {
res += Long.bitCount(x[i] | y[i]);
}
for(; i < lx; i++) {
res += Long.bitCount(x[i]);
}
for(; i < ly; i++) {
res += Long.bitCount(y[i]);
}
return res;
} | [
"public",
"static",
"int",
"unionSize",
"(",
"long",
"[",
"]",
"x",
",",
"long",
"[",
"]",
"y",
")",
"{",
"final",
"int",
"lx",
"=",
"x",
".",
"length",
",",
"ly",
"=",
"y",
".",
"length",
";",
"final",
"int",
"min",
"=",
"(",
"lx",
"<",
"ly"... | Compute the union size of two Bitsets.
@param x First bitset
@param y Second bitset
@return Union size | [
"Compute",
"the",
"union",
"size",
"of",
"two",
"Bitsets",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java#L1490-L1504 |
trellis-ldp/trellis | core/http/src/main/java/org/trellisldp/http/impl/MementoResource.java | MementoResource.filterLinkParams | public static Link filterLinkParams(final Link link, final boolean filter) {
// from and until parameters can cause problems with downstream applications because they contain commas. This
// method makes it possible to filter out those params, if desired. By default, they are not filtered out.
if (filter) {
if (TIMEMAP.equals(link.getRel())) {
return Link.fromUri(link.getUri()).rel(TIMEMAP).type(APPLICATION_LINK_FORMAT).build();
} else if (MEMENTO.equals(link.getRel())) {
return Link.fromUri(link.getUri()).rel(MEMENTO).build();
}
}
return link;
} | java | public static Link filterLinkParams(final Link link, final boolean filter) {
// from and until parameters can cause problems with downstream applications because they contain commas. This
// method makes it possible to filter out those params, if desired. By default, they are not filtered out.
if (filter) {
if (TIMEMAP.equals(link.getRel())) {
return Link.fromUri(link.getUri()).rel(TIMEMAP).type(APPLICATION_LINK_FORMAT).build();
} else if (MEMENTO.equals(link.getRel())) {
return Link.fromUri(link.getUri()).rel(MEMENTO).build();
}
}
return link;
} | [
"public",
"static",
"Link",
"filterLinkParams",
"(",
"final",
"Link",
"link",
",",
"final",
"boolean",
"filter",
")",
"{",
"// from and until parameters can cause problems with downstream applications because they contain commas. This",
"// method makes it possible to filter out those ... | Filter link parameters from a provided Link object, if configured to do so.
@param link the link
@param filter whether to filter the memento parameters
@return a Link without Memento parameters, if desired; otherwise, the original link | [
"Filter",
"link",
"parameters",
"from",
"a",
"provided",
"Link",
"object",
"if",
"configured",
"to",
"do",
"so",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/impl/MementoResource.java#L184-L195 |
vdurmont/semver4j | src/main/java/com/vdurmont/semver4j/Requirement.java | Requirement.buildLoose | public static Requirement buildLoose(String requirement) {
return build(new Semver(requirement, Semver.SemverType.LOOSE));
} | java | public static Requirement buildLoose(String requirement) {
return build(new Semver(requirement, Semver.SemverType.LOOSE));
} | [
"public",
"static",
"Requirement",
"buildLoose",
"(",
"String",
"requirement",
")",
"{",
"return",
"build",
"(",
"new",
"Semver",
"(",
"requirement",
",",
"Semver",
".",
"SemverType",
".",
"LOOSE",
")",
")",
";",
"}"
] | Builds a loose requirement (will test that the version is equivalent to the requirement)
@param requirement the version of the requirement
@return the generated requirement | [
"Builds",
"a",
"loose",
"requirement",
"(",
"will",
"test",
"that",
"the",
"version",
"is",
"equivalent",
"to",
"the",
"requirement",
")"
] | train | https://github.com/vdurmont/semver4j/blob/3f0266e4985ac29e9da482e04001ed15fad6c3e2/src/main/java/com/vdurmont/semver4j/Requirement.java#L85-L87 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentItemPersistenceImpl.java | CommerceShipmentItemPersistenceImpl.findByGroupId | @Override
public List<CommerceShipmentItem> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceShipmentItem> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceShipmentItem",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
... | Returns all the commerce shipment items where groupId = ?.
@param groupId the group ID
@return the matching commerce shipment items | [
"Returns",
"all",
"the",
"commerce",
"shipment",
"items",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentItemPersistenceImpl.java#L122-L125 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/credentials/UserCredentialsFileRepository.java | UserCredentialsFileRepository.getUserKey | private String getUserKey( AppInfo appInfo, String userId )
{
if ( userId == null ) {
throw new IllegalArgumentException( "userId should not be null" );
}
return String.format( "%s%s", getAppPrefix( appInfo ), userId );
} | java | private String getUserKey( AppInfo appInfo, String userId )
{
if ( userId == null ) {
throw new IllegalArgumentException( "userId should not be null" );
}
return String.format( "%s%s", getAppPrefix( appInfo ), userId );
} | [
"private",
"String",
"getUserKey",
"(",
"AppInfo",
"appInfo",
",",
"String",
"userId",
")",
"{",
"if",
"(",
"userId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"userId should not be null\"",
")",
";",
"}",
"return",
"String",
"... | Builds the key of a credentials according to a given appInfo and userId
@param appInfo The application informations
@param userId The user identifier
@return The user key | [
"Builds",
"the",
"key",
"of",
"a",
"credentials",
"according",
"to",
"a",
"given",
"appInfo",
"and",
"userId"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/credentials/UserCredentialsFileRepository.java#L189-L196 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java | CommsLightTrace.traceTransaction | public static void traceTransaction(TraceComponent callersTrace, String action, Object transaction, int commsId, int commsFlags)
{
if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) {
// Build the trace string
String traceText = action + ": " + transaction +
" CommsId:" + commsId + " CommsFlags:" + commsFlags;
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
SibTr.debug(light_tc, traceText);
}
else {
SibTr.debug(callersTrace, traceText);
}
}
} | java | public static void traceTransaction(TraceComponent callersTrace, String action, Object transaction, int commsId, int commsFlags)
{
if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) {
// Build the trace string
String traceText = action + ": " + transaction +
" CommsId:" + commsId + " CommsFlags:" + commsFlags;
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
SibTr.debug(light_tc, traceText);
}
else {
SibTr.debug(callersTrace, traceText);
}
}
} | [
"public",
"static",
"void",
"traceTransaction",
"(",
"TraceComponent",
"callersTrace",
",",
"String",
"action",
",",
"Object",
"transaction",
",",
"int",
"commsId",
",",
"int",
"commsFlags",
")",
"{",
"if",
"(",
"light_tc",
".",
"isDebugEnabled",
"(",
")",
"||... | Trace a transaction associated with an action.
@param callersTrace The trace component of the caller
@param action A string (no spaces) provided by the caller to prefix the keyword included in the trace line
@param transaction An optional transaction associated with the action being performed on the message
@param commsId The comms id integer associated (on both sides) with the transaction
@param commsFlags In many cases flags are flown over with the transaction, this field can be used for these flags | [
"Trace",
"a",
"transaction",
"associated",
"with",
"an",
"action",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java#L135-L150 |
trellis-ldp-archive/trellis-http | src/main/java/org/trellisldp/http/impl/RdfUtils.java | RdfUtils.getProfile | public static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax) {
for (final MediaType type : acceptableTypes) {
if (RDFSyntax.byMediaType(type.toString()).filter(syntax::equals).isPresent() &&
type.getParameters().containsKey("profile")) {
return rdf.createIRI(type.getParameters().get("profile").split(" ")[0].trim());
}
}
return null;
} | java | public static IRI getProfile(final List<MediaType> acceptableTypes, final RDFSyntax syntax) {
for (final MediaType type : acceptableTypes) {
if (RDFSyntax.byMediaType(type.toString()).filter(syntax::equals).isPresent() &&
type.getParameters().containsKey("profile")) {
return rdf.createIRI(type.getParameters().get("profile").split(" ")[0].trim());
}
}
return null;
} | [
"public",
"static",
"IRI",
"getProfile",
"(",
"final",
"List",
"<",
"MediaType",
">",
"acceptableTypes",
",",
"final",
"RDFSyntax",
"syntax",
")",
"{",
"for",
"(",
"final",
"MediaType",
"type",
":",
"acceptableTypes",
")",
"{",
"if",
"(",
"RDFSyntax",
".",
... | Given a list of acceptable media types and an RDF syntax, get the relevant profile data, if
relevant
@param acceptableTypes the types from HTTP headers
@param syntax an RDF syntax
@return a profile IRI if relevant | [
"Given",
"a",
"list",
"of",
"acceptable",
"media",
"types",
"and",
"an",
"RDF",
"syntax",
"get",
"the",
"relevant",
"profile",
"data",
"if",
"relevant"
] | train | https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/RdfUtils.java#L214-L222 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java | DockerAgentUtils.pushImage | public static boolean pushImage(Launcher launcher, final JenkinsBuildInfoLog log, final String imageTag, final String username, final String password, final String host)
throws IOException, InterruptedException {
return launcher.getChannel().call(new MasterToSlaveCallable<Boolean, IOException>() {
public Boolean call() throws IOException {
String message = "Pushing image: " + imageTag;
if (StringUtils.isNotEmpty(host)) {
message += " using docker daemon host: " + host;
}
log.info(message);
DockerUtils.pushImage(imageTag, username, password, host);
return true;
}
});
} | java | public static boolean pushImage(Launcher launcher, final JenkinsBuildInfoLog log, final String imageTag, final String username, final String password, final String host)
throws IOException, InterruptedException {
return launcher.getChannel().call(new MasterToSlaveCallable<Boolean, IOException>() {
public Boolean call() throws IOException {
String message = "Pushing image: " + imageTag;
if (StringUtils.isNotEmpty(host)) {
message += " using docker daemon host: " + host;
}
log.info(message);
DockerUtils.pushImage(imageTag, username, password, host);
return true;
}
});
} | [
"public",
"static",
"boolean",
"pushImage",
"(",
"Launcher",
"launcher",
",",
"final",
"JenkinsBuildInfoLog",
"log",
",",
"final",
"String",
"imageTag",
",",
"final",
"String",
"username",
",",
"final",
"String",
"password",
",",
"final",
"String",
"host",
")",
... | Execute push docker image on agent
@param launcher
@param log
@param imageTag
@param username
@param password
@param host @return
@throws IOException
@throws InterruptedException | [
"Execute",
"push",
"docker",
"image",
"on",
"agent"
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerAgentUtils.java#L176-L191 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.terminateSubscription | public void terminateSubscription(final Subscription subscription, final RefundOption refund) {
doPUT(Subscription.SUBSCRIPTION_RESOURCE + "/" + subscription.getUuid() + "/terminate?refund=" + refund,
subscription, Subscription.class);
} | java | public void terminateSubscription(final Subscription subscription, final RefundOption refund) {
doPUT(Subscription.SUBSCRIPTION_RESOURCE + "/" + subscription.getUuid() + "/terminate?refund=" + refund,
subscription, Subscription.class);
} | [
"public",
"void",
"terminateSubscription",
"(",
"final",
"Subscription",
"subscription",
",",
"final",
"RefundOption",
"refund",
")",
"{",
"doPUT",
"(",
"Subscription",
".",
"SUBSCRIPTION_RESOURCE",
"+",
"\"/\"",
"+",
"subscription",
".",
"getUuid",
"(",
")",
"+",... | Terminate a particular {@link Subscription} by it's UUID
@param subscription Subscription to terminate | [
"Terminate",
"a",
"particular",
"{",
"@link",
"Subscription",
"}",
"by",
"it",
"s",
"UUID"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L561-L564 |
Stratio/deep-spark | deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java | Cells.getBoolean | public Boolean getBoolean(String nameSpace, String cellName) {
return getValue(nameSpace, cellName, Boolean.class);
} | java | public Boolean getBoolean(String nameSpace, String cellName) {
return getValue(nameSpace, cellName, Boolean.class);
} | [
"public",
"Boolean",
"getBoolean",
"(",
"String",
"nameSpace",
",",
"String",
"cellName",
")",
"{",
"return",
"getValue",
"(",
"nameSpace",
",",
"cellName",
",",
"Boolean",
".",
"class",
")",
";",
"}"
] | Returns the {@code Boolean} value of the {@link Cell} (associated to {@code table}) whose name iscellName, or
null if this Cells object contains no cell whose name is cellName.
@param nameSpace the name of the owning table
@param cellName the name of the Cell we want to retrieve from this Cells object.
@return the {@code Boolean} value of the {@link Cell} (associated to {@code table}) whose name is cellName, or
null if this Cells object contains no cell whose name is cellName | [
"Returns",
"the",
"{",
"@code",
"Boolean",
"}",
"value",
"of",
"the",
"{",
"@link",
"Cell",
"}",
"(",
"associated",
"to",
"{",
"@code",
"table",
"}",
")",
"whose",
"name",
"iscellName",
"or",
"null",
"if",
"this",
"Cells",
"object",
"contains",
"no",
"... | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L931-L933 |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java | AbstractMoskitoAspect.getProducerId | private String getProducerId(final ProceedingJoinPoint pjp, final String aPId, final boolean withMethod) {
if (!StringUtils.isEmpty(aPId))
return aPId;
String res = pjp.getSignature().getDeclaringTypeName();
try {
res = MoskitoUtils.producerName(res);
} catch (final RuntimeException e) {
if (logger.isTraceEnabled())
logger.trace(e.getMessage(), e);
}
if (withMethod) {
res += DOT + getMethodStatName(pjp.getSignature());
}
return res;
} | java | private String getProducerId(final ProceedingJoinPoint pjp, final String aPId, final boolean withMethod) {
if (!StringUtils.isEmpty(aPId))
return aPId;
String res = pjp.getSignature().getDeclaringTypeName();
try {
res = MoskitoUtils.producerName(res);
} catch (final RuntimeException e) {
if (logger.isTraceEnabled())
logger.trace(e.getMessage(), e);
}
if (withMethod) {
res += DOT + getMethodStatName(pjp.getSignature());
}
return res;
} | [
"private",
"String",
"getProducerId",
"(",
"final",
"ProceedingJoinPoint",
"pjp",
",",
"final",
"String",
"aPId",
",",
"final",
"boolean",
"withMethod",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isEmpty",
"(",
"aPId",
")",
")",
"return",
"aPId",
";",
... | Fetch producer id - for further usage.
@param pjp
{@link ProceedingJoinPoint}
@param aPId
provided producer id
@param withMethod
{@code true} in case if methodName should be used in produce id, {@code false} otheriwse
@return producer identifier | [
"Fetch",
"producer",
"id",
"-",
"for",
"further",
"usage",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java#L188-L203 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFTrustManager.java | SFTrustManager.isCached | private boolean isCached(List<SFPair<Certificate, Certificate>> pairIssuerSubjectList)
{
long currentTimeSecond = new Date().getTime() / 1000L;
boolean isCached = true;
try
{
for (SFPair<Certificate, Certificate> pairIssuerSubject : pairIssuerSubjectList)
{
OCSPReq req = createRequest(pairIssuerSubject);
CertificateID certificateId = req.getRequestList()[0].getCertID();
LOGGER.debug(CertificateIDToString(certificateId));
CertID cid = certificateId.toASN1Primitive();
OcspResponseCacheKey k = new OcspResponseCacheKey(
cid.getIssuerNameHash().getEncoded(),
cid.getIssuerKeyHash().getEncoded(),
cid.getSerialNumber().getValue());
SFPair<Long, String> res = OCSP_RESPONSE_CACHE.get(k);
if (res == null)
{
LOGGER.debug("Not all OCSP responses for the certificate is in the cache.");
isCached = false;
break;
}
else if (currentTimeSecond - CACHE_EXPIRATION_IN_SECONDS > res.left)
{
LOGGER.debug("Cache for CertID expired.");
isCached = false;
break;
}
else
{
try
{
validateRevocationStatusMain(pairIssuerSubject, res.right);
}
catch (CertificateException ex)
{
LOGGER.debug("Cache includes invalid OCSPResponse. " +
"Will download the OCSP cache from Snowflake OCSP server");
isCached = false;
}
}
}
}
catch (IOException ex)
{
LOGGER.debug("Failed to encode CertID.");
}
return isCached;
} | java | private boolean isCached(List<SFPair<Certificate, Certificate>> pairIssuerSubjectList)
{
long currentTimeSecond = new Date().getTime() / 1000L;
boolean isCached = true;
try
{
for (SFPair<Certificate, Certificate> pairIssuerSubject : pairIssuerSubjectList)
{
OCSPReq req = createRequest(pairIssuerSubject);
CertificateID certificateId = req.getRequestList()[0].getCertID();
LOGGER.debug(CertificateIDToString(certificateId));
CertID cid = certificateId.toASN1Primitive();
OcspResponseCacheKey k = new OcspResponseCacheKey(
cid.getIssuerNameHash().getEncoded(),
cid.getIssuerKeyHash().getEncoded(),
cid.getSerialNumber().getValue());
SFPair<Long, String> res = OCSP_RESPONSE_CACHE.get(k);
if (res == null)
{
LOGGER.debug("Not all OCSP responses for the certificate is in the cache.");
isCached = false;
break;
}
else if (currentTimeSecond - CACHE_EXPIRATION_IN_SECONDS > res.left)
{
LOGGER.debug("Cache for CertID expired.");
isCached = false;
break;
}
else
{
try
{
validateRevocationStatusMain(pairIssuerSubject, res.right);
}
catch (CertificateException ex)
{
LOGGER.debug("Cache includes invalid OCSPResponse. " +
"Will download the OCSP cache from Snowflake OCSP server");
isCached = false;
}
}
}
}
catch (IOException ex)
{
LOGGER.debug("Failed to encode CertID.");
}
return isCached;
} | [
"private",
"boolean",
"isCached",
"(",
"List",
"<",
"SFPair",
"<",
"Certificate",
",",
"Certificate",
">",
">",
"pairIssuerSubjectList",
")",
"{",
"long",
"currentTimeSecond",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
"/",
"1000L",
";",
"bool... | Is OCSP Response cached?
@param pairIssuerSubjectList a list of pair of issuer and subject certificates
@return true if all of OCSP response are cached else false | [
"Is",
"OCSP",
"Response",
"cached?"
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFTrustManager.java#L844-L894 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/trace/TraceId.java | TraceId.generateRandomId | public static TraceId generateRandomId(Random random) {
long idHi;
long idLo;
do {
idHi = random.nextLong();
idLo = random.nextLong();
} while (idHi == INVALID_ID && idLo == INVALID_ID);
return new TraceId(idHi, idLo);
} | java | public static TraceId generateRandomId(Random random) {
long idHi;
long idLo;
do {
idHi = random.nextLong();
idLo = random.nextLong();
} while (idHi == INVALID_ID && idLo == INVALID_ID);
return new TraceId(idHi, idLo);
} | [
"public",
"static",
"TraceId",
"generateRandomId",
"(",
"Random",
"random",
")",
"{",
"long",
"idHi",
";",
"long",
"idLo",
";",
"do",
"{",
"idHi",
"=",
"random",
".",
"nextLong",
"(",
")",
";",
"idLo",
"=",
"random",
".",
"nextLong",
"(",
")",
";",
"... | Generates a new random {@code TraceId}.
@param random the random number generator.
@return a new valid {@code TraceId}.
@since 0.5 | [
"Generates",
"a",
"new",
"random",
"{",
"@code",
"TraceId",
"}",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/TraceId.java#L140-L148 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/managers/GuildController.java | GuildController.createEmote | @CheckReturnValue
public AuditableRestAction<Emote> createEmote(String name, Icon icon, Role... roles)
{
checkPermission(Permission.MANAGE_EMOTES);
Checks.notBlank(name, "Emote name");
Checks.notNull(icon, "Emote icon");
Checks.notNull(roles, "Roles");
JSONObject body = new JSONObject();
body.put("name", name);
body.put("image", icon.getEncoding());
if (roles.length > 0) // making sure none of the provided roles are null before mapping them to the snowflake id
body.put("roles", Stream.of(roles).filter(Objects::nonNull).map(ISnowflake::getId).collect(Collectors.toSet()));
Route.CompiledRoute route = Route.Emotes.CREATE_EMOTE.compile(getGuild().getId());
return new AuditableRestAction<Emote>(getJDA(), route, body)
{
@Override
protected void handleResponse(Response response, Request<Emote> request)
{
if (!response.isOk())
{
request.onFailure(response);
return;
}
JSONObject obj = response.getObject();
EmoteImpl emote = api.get().getEntityBuilder().createEmote((GuildImpl) getGuild(), obj, true);
request.onSuccess(emote);
}
};
} | java | @CheckReturnValue
public AuditableRestAction<Emote> createEmote(String name, Icon icon, Role... roles)
{
checkPermission(Permission.MANAGE_EMOTES);
Checks.notBlank(name, "Emote name");
Checks.notNull(icon, "Emote icon");
Checks.notNull(roles, "Roles");
JSONObject body = new JSONObject();
body.put("name", name);
body.put("image", icon.getEncoding());
if (roles.length > 0) // making sure none of the provided roles are null before mapping them to the snowflake id
body.put("roles", Stream.of(roles).filter(Objects::nonNull).map(ISnowflake::getId).collect(Collectors.toSet()));
Route.CompiledRoute route = Route.Emotes.CREATE_EMOTE.compile(getGuild().getId());
return new AuditableRestAction<Emote>(getJDA(), route, body)
{
@Override
protected void handleResponse(Response response, Request<Emote> request)
{
if (!response.isOk())
{
request.onFailure(response);
return;
}
JSONObject obj = response.getObject();
EmoteImpl emote = api.get().getEntityBuilder().createEmote((GuildImpl) getGuild(), obj, true);
request.onSuccess(emote);
}
};
} | [
"@",
"CheckReturnValue",
"public",
"AuditableRestAction",
"<",
"Emote",
">",
"createEmote",
"(",
"String",
"name",
",",
"Icon",
"icon",
",",
"Role",
"...",
"roles",
")",
"{",
"checkPermission",
"(",
"Permission",
".",
"MANAGE_EMOTES",
")",
";",
"Checks",
".",
... | Creates a new {@link net.dv8tion.jda.core.entities.Emote Emote} in this Guild.
<br>If one or more Roles are specified the new Emote will only be available to Members with any of the specified Roles (see {@link Member#canInteract(Emote)})
<br>For this to be successful, the logged in account has to have the {@link net.dv8tion.jda.core.Permission#MANAGE_EMOTES MANAGE_EMOTES} Permission.
<p><b><u>Unicode emojis are not included as {@link net.dv8tion.jda.core.entities.Emote Emote}!</u></b>
<p>Note that a guild is limited to 50 normal and 50 animated emotes by default.
Some guilds are able to add additional emotes beyond this limitation due to the
{@code MORE_EMOJI} feature (see {@link net.dv8tion.jda.core.entities.Guild#getFeatures() Guild.getFeatures()}).
<br>Due to simplicity we do not check for these limits.
<p>Possible {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} caused by
the returned {@link net.dv8tion.jda.core.requests.RestAction RestAction} include the following:
<ul>
<li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS}
<br>The emote could not be created due to a permission discrepancy</li>
<li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS}
<br>We were removed from the Guild before finishing the task</li>
</ul>
@param name
The name for the new Emote
@param icon
The {@link net.dv8tion.jda.core.entities.Icon} for the new Emote
@param roles
The {@link net.dv8tion.jda.core.entities.Role Roles} the new Emote should be restricted to
<br>If no roles are provided the Emote will be available to all Members of this Guild
@throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException
If the logged in account does not have the {@link net.dv8tion.jda.core.Permission#MANAGE_EMOTES MANAGE_EMOTES} Permission
@return {@link net.dv8tion.jda.core.requests.restaction.AuditableRestAction AuditableRestAction} - Type: {@link net.dv8tion.jda.core.entities.Emote Emote} | [
"Creates",
"a",
"new",
"{",
"@link",
"net",
".",
"dv8tion",
".",
"jda",
".",
"core",
".",
"entities",
".",
"Emote",
"Emote",
"}",
"in",
"this",
"Guild",
".",
"<br",
">",
"If",
"one",
"or",
"more",
"Roles",
"are",
"specified",
"the",
"new",
"Emote",
... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/managers/GuildController.java#L2004-L2035 |
lucee/Lucee | core/src/main/java/lucee/runtime/converter/ScriptConverter.java | ScriptConverter._serializeDate | private void _serializeDate(Date date, StringBuilder sb) throws ConverterException {
_serializeDateTime(new DateTimeImpl(date), sb);
} | java | private void _serializeDate(Date date, StringBuilder sb) throws ConverterException {
_serializeDateTime(new DateTimeImpl(date), sb);
} | [
"private",
"void",
"_serializeDate",
"(",
"Date",
"date",
",",
"StringBuilder",
"sb",
")",
"throws",
"ConverterException",
"{",
"_serializeDateTime",
"(",
"new",
"DateTimeImpl",
"(",
"date",
")",
",",
"sb",
")",
";",
"}"
] | serialize a Date
@param date Date to serialize
@param sb
@throws ConverterException | [
"serialize",
"a",
"Date"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/ScriptConverter.java#L115-L117 |
JosePaumard/streams-utils | src/main/java/org/paumard/streams/StreamsUtils.java | StreamsUtils.shiftingWindowAveragingLong | public static <E> DoubleStream shiftingWindowAveragingLong(Stream<E> stream, int rollingFactor, ToLongFunction<? super E> mapper) {
Objects.requireNonNull(stream);
Objects.requireNonNull(mapper);
LongStream longStream = stream.mapToLong(mapper);
return shiftingWindowAveragingLong(longStream, rollingFactor);
} | java | public static <E> DoubleStream shiftingWindowAveragingLong(Stream<E> stream, int rollingFactor, ToLongFunction<? super E> mapper) {
Objects.requireNonNull(stream);
Objects.requireNonNull(mapper);
LongStream longStream = stream.mapToLong(mapper);
return shiftingWindowAveragingLong(longStream, rollingFactor);
} | [
"public",
"static",
"<",
"E",
">",
"DoubleStream",
"shiftingWindowAveragingLong",
"(",
"Stream",
"<",
"E",
">",
"stream",
",",
"int",
"rollingFactor",
",",
"ToLongFunction",
"<",
"?",
"super",
"E",
">",
"mapper",
")",
"{",
"Objects",
".",
"requireNonNull",
"... | <p>Generates a stream that is computed from a provided stream following two steps.</p>
<p>The first steps maps this stream to an <code>LongStream</code> that is then rolled following
the same principle as the <code>roll()</code> method. This steps builds a <code>Stream<LongStream></code>.
</p>
<p>Then the <code>average()</code> method is called on each <code>LongStream</code> using a mapper, and a
<code>DoubleStream</code> of averages is returned.</p>
<p>The resulting stream has the same number of elements as the provided stream,
minus the size of the window width, to preserve consistency of each collection. </p>
<p>A <code>NullPointerException</code> will be thrown if the provided stream or the mapper is null.</p>
@param stream the processed stream
@param rollingFactor the size of the window to apply the collector on
@param mapper the mapper applied
@param <E> the type of the provided stream
@return a stream in which each value is the collection of the provided stream | [
"<p",
">",
"Generates",
"a",
"stream",
"that",
"is",
"computed",
"from",
"a",
"provided",
"stream",
"following",
"two",
"steps",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"first",
"steps",
"maps",
"this",
"stream",
"to",
"an",
"<code",
">",
"LongStrea... | train | https://github.com/JosePaumard/streams-utils/blob/56152574af0aca44c5f679761202a8f90984ab73/src/main/java/org/paumard/streams/StreamsUtils.java#L606-L612 |
geomajas/geomajas-project-server | plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/filter/ExtendedLikeFilterImpl.java | ExtendedLikeFilterImpl.setPattern | @Deprecated
public final void setPattern(Expression p, String wildcardMultiChar, String wildcardOneChar, String escapeString) {
setPattern(p.toString(), wildcardMultiChar, wildcardOneChar, escapeString);
} | java | @Deprecated
public final void setPattern(Expression p, String wildcardMultiChar, String wildcardOneChar, String escapeString) {
setPattern(p.toString(), wildcardMultiChar, wildcardOneChar, escapeString);
} | [
"@",
"Deprecated",
"public",
"final",
"void",
"setPattern",
"(",
"Expression",
"p",
",",
"String",
"wildcardMultiChar",
",",
"String",
"wildcardOneChar",
",",
"String",
"escapeString",
")",
"{",
"setPattern",
"(",
"p",
".",
"toString",
"(",
")",
",",
"wildcard... | Set the match pattern for this FilterLike.
@param p
the expression which evaluates to the match pattern for this filter
@param wildcardMultiChar
the string that represents a multiple character (1->n) wildcard
@param wildcardOneChar
the string that represents a single character (1) wildcard
@param escapeString
the string that represents an escape character
@deprecated use one of {@link org.opengis.filter.PropertyIsLike#setExpression(Expression)}
{@link org.opengis.filter.PropertyIsLike#setWildCard(String)}
{@link org.opengis.filter.PropertyIsLike#setSingleChar(String)}
{@link org.opengis.filter.PropertyIsLike#setEscape(String)} | [
"Set",
"the",
"match",
"pattern",
"for",
"this",
"FilterLike",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/filter/ExtendedLikeFilterImpl.java#L307-L310 |
Coreoz/Wisp | src/main/java/com/coreoz/wisp/LongRunningJobMonitor.java | LongRunningJobMonitor.cleanUpLongJobIfItHasFinishedExecuting | Long cleanUpLongJobIfItHasFinishedExecuting(long currentTime, Job job) {
if(longRunningJobs.containsKey(job)
&& longRunningJobs.get(job).executionsCount != job.executionsCount()) {
Long jobLastExecutionTimeInMillis = job.lastExecutionEndedTimeInMillis();
int jobExecutionsCount = job.executionsCount();
LongRunningJobInfo jobRunningInfo = longRunningJobs.get(job);
long jobExecutionDuration = 0L;
if(jobExecutionsCount == jobRunningInfo.executionsCount + 1) {
jobExecutionDuration = jobLastExecutionTimeInMillis - jobRunningInfo.jobStartedtimeInMillis;
logger.info(
"Job '{}' has finished executing after {}ms",
job.name(),
jobExecutionDuration
);
} else {
jobExecutionDuration = currentTime - jobRunningInfo.jobStartedtimeInMillis;
logger.info(
"Job '{}' has finished executing after about {}ms",
job.name(),
jobExecutionDuration
);
}
longRunningJobs.remove(job);
return jobExecutionDuration;
}
return null;
} | java | Long cleanUpLongJobIfItHasFinishedExecuting(long currentTime, Job job) {
if(longRunningJobs.containsKey(job)
&& longRunningJobs.get(job).executionsCount != job.executionsCount()) {
Long jobLastExecutionTimeInMillis = job.lastExecutionEndedTimeInMillis();
int jobExecutionsCount = job.executionsCount();
LongRunningJobInfo jobRunningInfo = longRunningJobs.get(job);
long jobExecutionDuration = 0L;
if(jobExecutionsCount == jobRunningInfo.executionsCount + 1) {
jobExecutionDuration = jobLastExecutionTimeInMillis - jobRunningInfo.jobStartedtimeInMillis;
logger.info(
"Job '{}' has finished executing after {}ms",
job.name(),
jobExecutionDuration
);
} else {
jobExecutionDuration = currentTime - jobRunningInfo.jobStartedtimeInMillis;
logger.info(
"Job '{}' has finished executing after about {}ms",
job.name(),
jobExecutionDuration
);
}
longRunningJobs.remove(job);
return jobExecutionDuration;
}
return null;
} | [
"Long",
"cleanUpLongJobIfItHasFinishedExecuting",
"(",
"long",
"currentTime",
",",
"Job",
"job",
")",
"{",
"if",
"(",
"longRunningJobs",
".",
"containsKey",
"(",
"job",
")",
"&&",
"longRunningJobs",
".",
"get",
"(",
"job",
")",
".",
"executionsCount",
"!=",
"j... | cleanup jobs that have finished executing after {@link #thresholdDetectionInMillis} | [
"cleanup",
"jobs",
"that",
"have",
"finished",
"executing",
"after",
"{"
] | train | https://github.com/Coreoz/Wisp/blob/6d5de3b88fbe259e327296eea167b18cf41c7641/src/main/java/com/coreoz/wisp/LongRunningJobMonitor.java#L115-L144 |
aws/aws-sdk-java | aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/internal/validation/ValidationContext.java | ValidationContext.assertIsValidReferencePath | public void assertIsValidReferencePath(String path, String propertyName) {
if (path == null) {
return;
}
if (path.isEmpty()) {
problemReporter.report(new Problem(this, String.format("%s cannot be empty", propertyName)));
return;
}
} | java | public void assertIsValidReferencePath(String path, String propertyName) {
if (path == null) {
return;
}
if (path.isEmpty()) {
problemReporter.report(new Problem(this, String.format("%s cannot be empty", propertyName)));
return;
}
} | [
"public",
"void",
"assertIsValidReferencePath",
"(",
"String",
"path",
",",
"String",
"propertyName",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"path",
".",
"isEmpty",
"(",
")",
")",
"{",
"problemReporter",
".",
... | Asserts that the string represents a valid reference path expression.
@param path Path expression to validate.
@param propertyName Name of property. | [
"Asserts",
"that",
"the",
"string",
"represents",
"a",
"valid",
"reference",
"path",
"expression",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/internal/validation/ValidationContext.java#L181-L189 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseGridScreen.java | BaseGridScreen.getNextRecord | public Record getNextRecord(PrintWriter out, int iPrintOptions, boolean bFirstTime, boolean bHeadingFootingExists)
throws DBException
{
Object[] rgobjEnabled = null;
boolean bAfterRequery = !this.getMainRecord().isOpen();
if (!this.getMainRecord().isOpen())
this.getMainRecord().open(); // Make sure any listeners are called before disabling.
if (bHeadingFootingExists)
rgobjEnabled = this.getMainRecord().setEnableNonFilter(null, false, false, false, false, true);
Record record = this.getNextGridRecord(bFirstTime);
if (bHeadingFootingExists)
{
boolean bBreak = this.printHeadingFootingData(out, iPrintOptions | HtmlConstants.FOOTING_SCREEN | HtmlConstants.DETAIL_SCREEN);
this.getMainRecord().setEnableNonFilter(rgobjEnabled, (record != null), bBreak, bFirstTime | bAfterRequery, (record == null), true);
}
return record;
} | java | public Record getNextRecord(PrintWriter out, int iPrintOptions, boolean bFirstTime, boolean bHeadingFootingExists)
throws DBException
{
Object[] rgobjEnabled = null;
boolean bAfterRequery = !this.getMainRecord().isOpen();
if (!this.getMainRecord().isOpen())
this.getMainRecord().open(); // Make sure any listeners are called before disabling.
if (bHeadingFootingExists)
rgobjEnabled = this.getMainRecord().setEnableNonFilter(null, false, false, false, false, true);
Record record = this.getNextGridRecord(bFirstTime);
if (bHeadingFootingExists)
{
boolean bBreak = this.printHeadingFootingData(out, iPrintOptions | HtmlConstants.FOOTING_SCREEN | HtmlConstants.DETAIL_SCREEN);
this.getMainRecord().setEnableNonFilter(rgobjEnabled, (record != null), bBreak, bFirstTime | bAfterRequery, (record == null), true);
}
return record;
} | [
"public",
"Record",
"getNextRecord",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
",",
"boolean",
"bFirstTime",
",",
"boolean",
"bHeadingFootingExists",
")",
"throws",
"DBException",
"{",
"Object",
"[",
"]",
"rgobjEnabled",
"=",
"null",
";",
"boolean",
... | Get the next record.
This is the special method for a report. It handles breaks by disabling all listeners
except filter listeners, then reenabling and calling the listeners after the footing
has been printed, so totals, etc will be in the next break.
@param out The out stream.
@param iPrintOptions Print options.
@param bFirstTime Reading the first record?
@param bHeadingFootingExists Does a break exist (skips all the fancy code if not).
@return The next record (or null if EOF). | [
"Get",
"the",
"next",
"record",
".",
"This",
"is",
"the",
"special",
"method",
"for",
"a",
"report",
".",
"It",
"handles",
"breaks",
"by",
"disabling",
"all",
"listeners",
"except",
"filter",
"listeners",
"then",
"reenabling",
"and",
"calling",
"the",
"liste... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseGridScreen.java#L302-L321 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLLabelProvider.java | SARLLabelProvider.handleImageDescriptorError | protected ImageDescriptor handleImageDescriptorError(Object[] params, Throwable exception) {
if (exception instanceof NullPointerException) {
final Object defaultImage = getDefaultImage();
if (defaultImage instanceof ImageDescriptor) {
return (ImageDescriptor) defaultImage;
}
if (defaultImage instanceof Image) {
return ImageDescriptor.createFromImage((Image) defaultImage);
}
return super.imageDescriptor(params[0]);
}
return Exceptions.throwUncheckedException(exception);
} | java | protected ImageDescriptor handleImageDescriptorError(Object[] params, Throwable exception) {
if (exception instanceof NullPointerException) {
final Object defaultImage = getDefaultImage();
if (defaultImage instanceof ImageDescriptor) {
return (ImageDescriptor) defaultImage;
}
if (defaultImage instanceof Image) {
return ImageDescriptor.createFromImage((Image) defaultImage);
}
return super.imageDescriptor(params[0]);
}
return Exceptions.throwUncheckedException(exception);
} | [
"protected",
"ImageDescriptor",
"handleImageDescriptorError",
"(",
"Object",
"[",
"]",
"params",
",",
"Throwable",
"exception",
")",
"{",
"if",
"(",
"exception",
"instanceof",
"NullPointerException",
")",
"{",
"final",
"Object",
"defaultImage",
"=",
"getDefaultImage",... | Invoked when an image descriptor cannot be found.
@param params the parameters given to the method polymorphic dispatcher.
@param exception the cause of the error.
@return the image descriptor for the error. | [
"Invoked",
"when",
"an",
"image",
"descriptor",
"cannot",
"be",
"found",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLLabelProvider.java#L162-L174 |
haifengl/smile | math/src/main/java/smile/math/matrix/PageRank.java | PageRank.pagerank | public static double[] pagerank(Matrix A) {
int n = A.nrows();
double[] v = new double[n];
Arrays.fill(v, 1.0 / n);
return pagerank(A, v);
} | java | public static double[] pagerank(Matrix A) {
int n = A.nrows();
double[] v = new double[n];
Arrays.fill(v, 1.0 / n);
return pagerank(A, v);
} | [
"public",
"static",
"double",
"[",
"]",
"pagerank",
"(",
"Matrix",
"A",
")",
"{",
"int",
"n",
"=",
"A",
".",
"nrows",
"(",
")",
";",
"double",
"[",
"]",
"v",
"=",
"new",
"double",
"[",
"n",
"]",
";",
"Arrays",
".",
"fill",
"(",
"v",
",",
"1.0... | Calculate the page rank vector.
@param A the matrix supporting matrix vector multiplication operation.
@return the page rank vector. | [
"Calculate",
"the",
"page",
"rank",
"vector",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/PageRank.java#L42-L47 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java | PatternBox.relatedProteinRefOfInter | public static Pattern relatedProteinRefOfInter(Class<? extends Interaction>... seedType)
{
Pattern p = new Pattern(Interaction.class, "Interaction");
if (seedType.length == 1)
{
p.add(new Type(seedType[0]), "Interaction");
}
else if (seedType.length > 1)
{
MappedConst[] mc = new MappedConst[seedType.length];
for (int i = 0; i < mc.length; i++)
{
mc[i] = new MappedConst(new Type(seedType[i]), 0);
}
p.add(new OR(mc), "Interaction");
}
p.add(new OR(new MappedConst(participant(), 0, 1),
new MappedConst(new PathConstraint(
"Interaction/controlledOf*/controller:PhysicalEntity"), 0, 1)),
"Interaction", "PE");
p.add(linkToSpecific(), "PE", "SPE");
p.add(peToER(), "SPE", "generic PR");
p.add(new Type(ProteinReference.class), "generic PR");
p.add(linkedER(false), "generic PR", "PR");
return p;
} | java | public static Pattern relatedProteinRefOfInter(Class<? extends Interaction>... seedType)
{
Pattern p = new Pattern(Interaction.class, "Interaction");
if (seedType.length == 1)
{
p.add(new Type(seedType[0]), "Interaction");
}
else if (seedType.length > 1)
{
MappedConst[] mc = new MappedConst[seedType.length];
for (int i = 0; i < mc.length; i++)
{
mc[i] = new MappedConst(new Type(seedType[i]), 0);
}
p.add(new OR(mc), "Interaction");
}
p.add(new OR(new MappedConst(participant(), 0, 1),
new MappedConst(new PathConstraint(
"Interaction/controlledOf*/controller:PhysicalEntity"), 0, 1)),
"Interaction", "PE");
p.add(linkToSpecific(), "PE", "SPE");
p.add(peToER(), "SPE", "generic PR");
p.add(new Type(ProteinReference.class), "generic PR");
p.add(linkedER(false), "generic PR", "PR");
return p;
} | [
"public",
"static",
"Pattern",
"relatedProteinRefOfInter",
"(",
"Class",
"<",
"?",
"extends",
"Interaction",
">",
"...",
"seedType",
")",
"{",
"Pattern",
"p",
"=",
"new",
"Pattern",
"(",
"Interaction",
".",
"class",
",",
"\"Interaction\"",
")",
";",
"if",
"(... | Finds ProteinsReference related to an interaction. If specific types of interactions are
desired, they should be sent as parameter, otherwise leave the parameter empty.
@param seedType specific BioPAX interaction sub-types (interface classes)
@return pattern | [
"Finds",
"ProteinsReference",
"related",
"to",
"an",
"interaction",
".",
"If",
"specific",
"types",
"of",
"interactions",
"are",
"desired",
"they",
"should",
"be",
"sent",
"as",
"parameter",
"otherwise",
"leave",
"the",
"parameter",
"empty",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L680-L709 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/CookieHelper.java | CookieHelper.getCookieValue | @Sensitive
public static String getCookieValue(Cookie[] cookies, String cookieName) {
if (cookies == null) {
return null;
}
String retVal = null;
for (int i = 0; i < cookies.length; ++i) {
if (cookieName.equalsIgnoreCase(cookies[i].getName())) {
retVal = cookies[i].getValue();
break;
}
}
return retVal;
} | java | @Sensitive
public static String getCookieValue(Cookie[] cookies, String cookieName) {
if (cookies == null) {
return null;
}
String retVal = null;
for (int i = 0; i < cookies.length; ++i) {
if (cookieName.equalsIgnoreCase(cookies[i].getName())) {
retVal = cookies[i].getValue();
break;
}
}
return retVal;
} | [
"@",
"Sensitive",
"public",
"static",
"String",
"getCookieValue",
"(",
"Cookie",
"[",
"]",
"cookies",
",",
"String",
"cookieName",
")",
"{",
"if",
"(",
"cookies",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"retVal",
"=",
"null",
";",
... | Retrieve the value of the first instance of the specified Cookie name
from the array of Cookies. Note name matching ignores case.
@param cookies array of Cookie objects, may be {@code null}.
@param cookieName the name of the cookie
@return String value associated with the specified cookieName, {@code null} if no match could not be found. | [
"Retrieve",
"the",
"value",
"of",
"the",
"first",
"instance",
"of",
"the",
"specified",
"Cookie",
"name",
"from",
"the",
"array",
"of",
"Cookies",
".",
"Note",
"name",
"matching",
"ignores",
"case",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/CookieHelper.java#L39-L54 |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java | UnsafeRow.createFromByteArray | public static UnsafeRow createFromByteArray(int numBytes, int numFields) {
final UnsafeRow row = new UnsafeRow(numFields);
row.pointTo(new byte[numBytes], numBytes);
return row;
} | java | public static UnsafeRow createFromByteArray(int numBytes, int numFields) {
final UnsafeRow row = new UnsafeRow(numFields);
row.pointTo(new byte[numBytes], numBytes);
return row;
} | [
"public",
"static",
"UnsafeRow",
"createFromByteArray",
"(",
"int",
"numBytes",
",",
"int",
"numFields",
")",
"{",
"final",
"UnsafeRow",
"row",
"=",
"new",
"UnsafeRow",
"(",
"numFields",
")",
";",
"row",
".",
"pointTo",
"(",
"new",
"byte",
"[",
"numBytes",
... | Creates an empty UnsafeRow from a byte array with specified numBytes and numFields.
The returned row is invalid until we call copyFrom on it. | [
"Creates",
"an",
"empty",
"UnsafeRow",
"from",
"a",
"byte",
"array",
"with",
"specified",
"numBytes",
"and",
"numFields",
".",
"The",
"returned",
"row",
"is",
"invalid",
"until",
"we",
"call",
"copyFrom",
"on",
"it",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L475-L479 |
phax/ph-css | ph-css/src/main/java/com/helger/css/reader/CSSReader.java | CSSReader.isValidCSS | public static boolean isValidCSS (@Nonnull @WillClose final Reader aReader, @Nonnull final ECSSVersion eVersion)
{
ValueEnforcer.notNull (aReader, "Reader");
ValueEnforcer.notNull (eVersion, "Version");
try
{
final CSSCharStream aCharStream = new CSSCharStream (aReader);
final CSSNode aNode = _readStyleSheet (aCharStream,
eVersion,
getDefaultParseErrorHandler (),
new DoNothingCSSParseExceptionCallback (),
false);
return aNode != null;
}
finally
{
StreamHelper.close (aReader);
}
} | java | public static boolean isValidCSS (@Nonnull @WillClose final Reader aReader, @Nonnull final ECSSVersion eVersion)
{
ValueEnforcer.notNull (aReader, "Reader");
ValueEnforcer.notNull (eVersion, "Version");
try
{
final CSSCharStream aCharStream = new CSSCharStream (aReader);
final CSSNode aNode = _readStyleSheet (aCharStream,
eVersion,
getDefaultParseErrorHandler (),
new DoNothingCSSParseExceptionCallback (),
false);
return aNode != null;
}
finally
{
StreamHelper.close (aReader);
}
} | [
"public",
"static",
"boolean",
"isValidCSS",
"(",
"@",
"Nonnull",
"@",
"WillClose",
"final",
"Reader",
"aReader",
",",
"@",
"Nonnull",
"final",
"ECSSVersion",
"eVersion",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aReader",
",",
"\"Reader\"",
")",
";",
... | Check if the passed reader can be resembled to valid CSS content. This is
accomplished by fully parsing the CSS each time the method is called. This
is similar to calling
{@link #readFromStream(IHasInputStream, Charset, ECSSVersion)} and checking
for a non-<code>null</code> result.
@param aReader
The reader to use. May not be <code>null</code>.
@param eVersion
The CSS version to use. May not be <code>null</code>.
@return <code>true</code> if the CSS is valid according to the version,
<code>false</code> if not | [
"Check",
"if",
"the",
"passed",
"reader",
"can",
"be",
"resembled",
"to",
"valid",
"CSS",
"content",
".",
"This",
"is",
"accomplished",
"by",
"fully",
"parsing",
"the",
"CSS",
"each",
"time",
"the",
"method",
"is",
"called",
".",
"This",
"is",
"similar",
... | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/reader/CSSReader.java#L352-L371 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RuntimeExceptionsFactory.java | RuntimeExceptionsFactory.newIllegalArgumentException | public static IllegalArgumentException newIllegalArgumentException(Throwable cause, String message, Object... args) {
return new IllegalArgumentException(format(message, args), cause);
} | java | public static IllegalArgumentException newIllegalArgumentException(Throwable cause, String message, Object... args) {
return new IllegalArgumentException(format(message, args), cause);
} | [
"public",
"static",
"IllegalArgumentException",
"newIllegalArgumentException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"message",
",",
"args",
")",
... | Constructs and initializes a new {@link IllegalArgumentException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link IllegalArgumentException} was thrown.
@param message {@link String} describing the {@link IllegalArgumentException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link IllegalArgumentException} with the given {@link Throwable cause} and {@link String message}.
@see java.lang.IllegalArgumentException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"IllegalArgumentException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RuntimeExceptionsFactory.java#L62-L64 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/ThresholdSauvola_MT.java | ThresholdSauvola_MT.process | @Override
public void process(GrayF32 input , GrayU8 output ) {
inputPow2.reshape(input.width,input.height);
inputMean.reshape(input.width,input.height);
inputMeanPow2.reshape(input.width,input.height);
inputPow2Mean.reshape(input.width,input.height);
stdev.reshape(input.width,input.height);
tmp.reshape(input.width,input.height);
inputPow2.reshape(input.width,input.height);
int radius = width.computeI(Math.min(input.width,input.height))/2;
// mean of input image = E[X]
BlurImageOps.mean(input, inputMean, radius, tmp, work);
// standard deviation = sqrt( E[X^2] + E[X]^2)
PixelMath.pow2(input, inputPow2);
BlurImageOps.mean(inputPow2,inputPow2Mean,radius,tmp, work);
PixelMath.pow2(inputMean,inputMeanPow2);
PixelMath.subtract(inputPow2Mean, inputMeanPow2, stdev);
PixelMath.sqrt(stdev, stdev);
float R = ImageStatistics.max(stdev);
if( down ) {
BoofConcurrency.loopFor(0, input.height, y -> {
int i = y * stdev.width;
int indexIn = input.startIndex + y * input.stride;
int indexOut = output.startIndex + y * output.stride;
for (int x = 0; x < input.width; x++, i++) {
// threshold = mean.*(1 + k * ((deviation/R)-1));
float threshold = inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f));
output.data[indexOut++] = (byte) (input.data[indexIn++] <= threshold ? 1 : 0);
}
});
} else {
BoofConcurrency.loopFor(0, input.height, y -> {
int i = y * stdev.width;
int indexIn = input.startIndex + y * input.stride;
int indexOut = output.startIndex + y * output.stride;
for (int x = 0; x < input.width; x++, i++) {
// threshold = mean.*(1 + k * ((deviation/R)-1));
float threshold = inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f));
output.data[indexOut++] = (byte) (input.data[indexIn++] >= threshold ? 1 : 0);
}
});
}
} | java | @Override
public void process(GrayF32 input , GrayU8 output ) {
inputPow2.reshape(input.width,input.height);
inputMean.reshape(input.width,input.height);
inputMeanPow2.reshape(input.width,input.height);
inputPow2Mean.reshape(input.width,input.height);
stdev.reshape(input.width,input.height);
tmp.reshape(input.width,input.height);
inputPow2.reshape(input.width,input.height);
int radius = width.computeI(Math.min(input.width,input.height))/2;
// mean of input image = E[X]
BlurImageOps.mean(input, inputMean, radius, tmp, work);
// standard deviation = sqrt( E[X^2] + E[X]^2)
PixelMath.pow2(input, inputPow2);
BlurImageOps.mean(inputPow2,inputPow2Mean,radius,tmp, work);
PixelMath.pow2(inputMean,inputMeanPow2);
PixelMath.subtract(inputPow2Mean, inputMeanPow2, stdev);
PixelMath.sqrt(stdev, stdev);
float R = ImageStatistics.max(stdev);
if( down ) {
BoofConcurrency.loopFor(0, input.height, y -> {
int i = y * stdev.width;
int indexIn = input.startIndex + y * input.stride;
int indexOut = output.startIndex + y * output.stride;
for (int x = 0; x < input.width; x++, i++) {
// threshold = mean.*(1 + k * ((deviation/R)-1));
float threshold = inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f));
output.data[indexOut++] = (byte) (input.data[indexIn++] <= threshold ? 1 : 0);
}
});
} else {
BoofConcurrency.loopFor(0, input.height, y -> {
int i = y * stdev.width;
int indexIn = input.startIndex + y * input.stride;
int indexOut = output.startIndex + y * output.stride;
for (int x = 0; x < input.width; x++, i++) {
// threshold = mean.*(1 + k * ((deviation/R)-1));
float threshold = inputMean.data[i] * (1.0f + k * (stdev.data[i] / R - 1.0f));
output.data[indexOut++] = (byte) (input.data[indexIn++] >= threshold ? 1 : 0);
}
});
}
} | [
"@",
"Override",
"public",
"void",
"process",
"(",
"GrayF32",
"input",
",",
"GrayU8",
"output",
")",
"{",
"inputPow2",
".",
"reshape",
"(",
"input",
".",
"width",
",",
"input",
".",
"height",
")",
";",
"inputMean",
".",
"reshape",
"(",
"input",
".",
"w... | Converts the input image into a binary image.
@param input Input image. Not modified.
@param output Output binary image. Modified. | [
"Converts",
"the",
"input",
"image",
"into",
"a",
"binary",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/ThresholdSauvola_MT.java#L86-L135 |
YahooArchive/samoa | samoa-samza/src/main/java/com/yahoo/labs/samoa/utils/SamzaConfigFactory.java | SamzaConfigFactory.setJobName | private static void setJobName(Map<String,String> map, String jobName) {
map.put(JOB_NAME_KEY, jobName);
} | java | private static void setJobName(Map<String,String> map, String jobName) {
map.put(JOB_NAME_KEY, jobName);
} | [
"private",
"static",
"void",
"setJobName",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"String",
"jobName",
")",
"{",
"map",
".",
"put",
"(",
"JOB_NAME_KEY",
",",
"jobName",
")",
";",
"}"
] | /*
Helper methods to set different properties in the input map | [
"/",
"*",
"Helper",
"methods",
"to",
"set",
"different",
"properties",
"in",
"the",
"input",
"map"
] | train | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-samza/src/main/java/com/yahoo/labs/samoa/utils/SamzaConfigFactory.java#L428-L430 |
Netflix/blitz4j | src/main/java/com/netflix/logging/messaging/BatcherFactory.java | BatcherFactory.createBatcher | public static MessageBatcher createBatcher(String name,
MessageProcessor processor) {
MessageBatcher batcher = batcherMap.get(name);
if (batcher == null) {
synchronized (BatcherFactory.class) {
batcher = batcherMap.get(name);
if (batcher == null) {
batcher = new MessageBatcher(name, processor);
batcherMap.put(name, batcher);
}
}
}
return batcher;
} | java | public static MessageBatcher createBatcher(String name,
MessageProcessor processor) {
MessageBatcher batcher = batcherMap.get(name);
if (batcher == null) {
synchronized (BatcherFactory.class) {
batcher = batcherMap.get(name);
if (batcher == null) {
batcher = new MessageBatcher(name, processor);
batcherMap.put(name, batcher);
}
}
}
return batcher;
} | [
"public",
"static",
"MessageBatcher",
"createBatcher",
"(",
"String",
"name",
",",
"MessageProcessor",
"processor",
")",
"{",
"MessageBatcher",
"batcher",
"=",
"batcherMap",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"batcher",
"==",
"null",
")",
"{",
"sy... | Creates the batcher. The user needs to make sure another batcher already exists before
they create one.
@param name - The name of the batcher to be created
@param processor - The user override for actions to be performed on the batched messages.
@return | [
"Creates",
"the",
"batcher",
".",
"The",
"user",
"needs",
"to",
"make",
"sure",
"another",
"batcher",
"already",
"exists",
"before",
"they",
"create",
"one",
"."
] | train | https://github.com/Netflix/blitz4j/blob/d03aaf4ede238dc204a4420c8d333565f86fc6f2/src/main/java/com/netflix/logging/messaging/BatcherFactory.java#L63-L76 |
Erudika/para | para-client/src/main/java/com/erudika/para/client/ParaClient.java | ParaClient.findWildcard | public <P extends ParaObject> List<P> findWildcard(String type, String field, String wildcard, Pager... pager) {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("field", field);
params.putSingle("q", wildcard);
params.putSingle(Config._TYPE, type);
params.putAll(pagerToParams(pager));
return getItems(find("wildcard", params), pager);
} | java | public <P extends ParaObject> List<P> findWildcard(String type, String field, String wildcard, Pager... pager) {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("field", field);
params.putSingle("q", wildcard);
params.putSingle(Config._TYPE, type);
params.putAll(pagerToParams(pager));
return getItems(find("wildcard", params), pager);
} | [
"public",
"<",
"P",
"extends",
"ParaObject",
">",
"List",
"<",
"P",
">",
"findWildcard",
"(",
"String",
"type",
",",
"String",
"field",
",",
"String",
"wildcard",
",",
"Pager",
"...",
"pager",
")",
"{",
"MultivaluedMap",
"<",
"String",
",",
"String",
">"... | Searches for objects that have a property with a value matching a wildcard query.
@param <P> type of the object
@param type the type of object to search for. See {@link com.erudika.para.core.ParaObject#getType()}
@param field the property name of an object
@param wildcard wildcard query string. For example "cat*".
@param pager a {@link com.erudika.para.utils.Pager}
@return a list of objects found | [
"Searches",
"for",
"objects",
"that",
"have",
"a",
"property",
"with",
"a",
"value",
"matching",
"a",
"wildcard",
"query",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L860-L867 |
andrehertwig/admintool | admin-tools-core/src/main/java/de/chandre/admintool/core/utils/AdminToolMenuUtils.java | AdminToolMenuUtils.hasMenuEntry | public boolean hasMenuEntry(AdminComponent component, MenuEntry activeMenue) {
if (null != component && null != component.getMainMenu()) {
Optional<MenuEntry> result = component.getMainMenu().flattened()
.filter(menu -> checkForNull(menu, activeMenue) ? menu.getName().equals(activeMenue.getName()): false)
.findFirst();
return result.isPresent();
}
return false;
} | java | public boolean hasMenuEntry(AdminComponent component, MenuEntry activeMenue) {
if (null != component && null != component.getMainMenu()) {
Optional<MenuEntry> result = component.getMainMenu().flattened()
.filter(menu -> checkForNull(menu, activeMenue) ? menu.getName().equals(activeMenue.getName()): false)
.findFirst();
return result.isPresent();
}
return false;
} | [
"public",
"boolean",
"hasMenuEntry",
"(",
"AdminComponent",
"component",
",",
"MenuEntry",
"activeMenue",
")",
"{",
"if",
"(",
"null",
"!=",
"component",
"&&",
"null",
"!=",
"component",
".",
"getMainMenu",
"(",
")",
")",
"{",
"Optional",
"<",
"MenuEntry",
"... | checks if the activeMenue is part of given component
@param component the AdminComponent which should contain the activeMenue
@param activeMenue the menue to check
@return | [
"checks",
"if",
"the",
"activeMenue",
"is",
"part",
"of",
"given",
"component"
] | train | https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-core/src/main/java/de/chandre/admintool/core/utils/AdminToolMenuUtils.java#L182-L190 |
nguillaumin/slick2d-maven | slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/TTFSubSetFile.java | TTFSubSetFile.createMaxp | private void createMaxp(FontFileReader in, int size) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("maxp");
if (entry != null) {
pad4();
seekTab(in, "maxp", 0);
System.arraycopy(in.getBytes((int)entry.getOffset(), (int)entry.getLength()),
0, output, currentPos, (int)entry.getLength());
writeUShort(currentPos + 4, size);
int checksum = getCheckSum(currentPos, (int)entry.getLength());
writeULong(maxpDirOffset, checksum);
writeULong(maxpDirOffset + 4, currentPos);
writeULong(maxpDirOffset + 8, (int)entry.getLength());
currentPos += (int)entry.getLength();
realSize += (int)entry.getLength();
} else {
throw new IOException("Can't find maxp table");
}
} | java | private void createMaxp(FontFileReader in, int size) throws IOException {
TTFDirTabEntry entry = (TTFDirTabEntry)dirTabs.get("maxp");
if (entry != null) {
pad4();
seekTab(in, "maxp", 0);
System.arraycopy(in.getBytes((int)entry.getOffset(), (int)entry.getLength()),
0, output, currentPos, (int)entry.getLength());
writeUShort(currentPos + 4, size);
int checksum = getCheckSum(currentPos, (int)entry.getLength());
writeULong(maxpDirOffset, checksum);
writeULong(maxpDirOffset + 4, currentPos);
writeULong(maxpDirOffset + 8, (int)entry.getLength());
currentPos += (int)entry.getLength();
realSize += (int)entry.getLength();
} else {
throw new IOException("Can't find maxp table");
}
} | [
"private",
"void",
"createMaxp",
"(",
"FontFileReader",
"in",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"TTFDirTabEntry",
"entry",
"=",
"(",
"TTFDirTabEntry",
")",
"dirTabs",
".",
"get",
"(",
"\"maxp\"",
")",
";",
"if",
"(",
"entry",
"!=",
"nu... | Copy the maxp table as is from original font to subset font
and set num glyphs to size
@param in The reader from which to obtain the info
@param size The size of the MAXP table to write
@throws IOException Indicates a failure to write | [
"Copy",
"the",
"maxp",
"table",
"as",
"is",
"from",
"original",
"font",
"to",
"subset",
"font",
"and",
"set",
"num",
"glyphs",
"to",
"size"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/TTFSubSetFile.java#L273-L291 |
pravega/pravega | common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java | BTreeIndex.fetchPage | private CompletableFuture<PageWrapper> fetchPage(PagePointer pagePointer, PageWrapper parentPage, PageCollection pageCollection, Duration timeout) {
PageWrapper fromCache = pageCollection.get(pagePointer.getOffset());
if (fromCache != null) {
return CompletableFuture.completedFuture(fromCache);
}
return readPage(pagePointer.getOffset(), pagePointer.getLength(), timeout)
.thenApply(data -> {
if (data.getLength() != pagePointer.getLength()) {
throw new IllegalDataFormatException(String.format("Requested page of length %s from offset %s, got a page of length %s.",
pagePointer.getLength(), pagePointer.getOffset(), data.getLength()));
}
val pageConfig = BTreePage.isIndexPage(data) ? this.indexPageConfig : this.leafPageConfig;
return pageCollection.insert(PageWrapper.wrapExisting(new BTreePage(pageConfig, data), parentPage, pagePointer));
});
} | java | private CompletableFuture<PageWrapper> fetchPage(PagePointer pagePointer, PageWrapper parentPage, PageCollection pageCollection, Duration timeout) {
PageWrapper fromCache = pageCollection.get(pagePointer.getOffset());
if (fromCache != null) {
return CompletableFuture.completedFuture(fromCache);
}
return readPage(pagePointer.getOffset(), pagePointer.getLength(), timeout)
.thenApply(data -> {
if (data.getLength() != pagePointer.getLength()) {
throw new IllegalDataFormatException(String.format("Requested page of length %s from offset %s, got a page of length %s.",
pagePointer.getLength(), pagePointer.getOffset(), data.getLength()));
}
val pageConfig = BTreePage.isIndexPage(data) ? this.indexPageConfig : this.leafPageConfig;
return pageCollection.insert(PageWrapper.wrapExisting(new BTreePage(pageConfig, data), parentPage, pagePointer));
});
} | [
"private",
"CompletableFuture",
"<",
"PageWrapper",
">",
"fetchPage",
"(",
"PagePointer",
"pagePointer",
",",
"PageWrapper",
"parentPage",
",",
"PageCollection",
"pageCollection",
",",
"Duration",
"timeout",
")",
"{",
"PageWrapper",
"fromCache",
"=",
"pageCollection",
... | Loads up a single Page.
@param pagePointer A PagePointer indicating the Page to load.
@param parentPage The sought page's Parent Page. May be null for root pages only.
@param pageCollection A PageCollection that contains already looked up pages. If the sought page is already loaded
it will be served from here; otherwise it will be added here afterwards.
@param timeout Timeout for the operation.
@return A CompletableFuture containing a PageWrapper for the sought page. | [
"Loads",
"up",
"a",
"single",
"Page",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L651-L667 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java | SeaGlassButtonUI.getSelectedIcon | private Icon getSelectedIcon(AbstractButton b, Icon defaultIcon) {
return getIcon(b, b.getSelectedIcon(), defaultIcon, SynthConstants.SELECTED);
} | java | private Icon getSelectedIcon(AbstractButton b, Icon defaultIcon) {
return getIcon(b, b.getSelectedIcon(), defaultIcon, SynthConstants.SELECTED);
} | [
"private",
"Icon",
"getSelectedIcon",
"(",
"AbstractButton",
"b",
",",
"Icon",
"defaultIcon",
")",
"{",
"return",
"getIcon",
"(",
"b",
",",
"b",
".",
"getSelectedIcon",
"(",
")",
",",
"defaultIcon",
",",
"SynthConstants",
".",
"SELECTED",
")",
";",
"}"
] | DOCUMENT ME!
@param b DOCUMENT ME!
@param defaultIcon DOCUMENT ME!
@return DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassButtonUI.java#L467-L469 |
signalapp/curve25519-java | common/src/main/java/org/whispersystems/curve25519/java/fe_neg.java | fe_neg.fe_neg | public static void fe_neg(int[] h,int[] f)
{
int f0 = f[0];
int f1 = f[1];
int f2 = f[2];
int f3 = f[3];
int f4 = f[4];
int f5 = f[5];
int f6 = f[6];
int f7 = f[7];
int f8 = f[8];
int f9 = f[9];
int h0 = -f0;
int h1 = -f1;
int h2 = -f2;
int h3 = -f3;
int h4 = -f4;
int h5 = -f5;
int h6 = -f6;
int h7 = -f7;
int h8 = -f8;
int h9 = -f9;
h[0] = (int)h0;
h[1] = (int)h1;
h[2] = (int)h2;
h[3] = (int)h3;
h[4] = (int)h4;
h[5] = (int)h5;
h[6] = (int)h6;
h[7] = (int)h7;
h[8] = (int)h8;
h[9] = (int)h9;
} | java | public static void fe_neg(int[] h,int[] f)
{
int f0 = f[0];
int f1 = f[1];
int f2 = f[2];
int f3 = f[3];
int f4 = f[4];
int f5 = f[5];
int f6 = f[6];
int f7 = f[7];
int f8 = f[8];
int f9 = f[9];
int h0 = -f0;
int h1 = -f1;
int h2 = -f2;
int h3 = -f3;
int h4 = -f4;
int h5 = -f5;
int h6 = -f6;
int h7 = -f7;
int h8 = -f8;
int h9 = -f9;
h[0] = (int)h0;
h[1] = (int)h1;
h[2] = (int)h2;
h[3] = (int)h3;
h[4] = (int)h4;
h[5] = (int)h5;
h[6] = (int)h6;
h[7] = (int)h7;
h[8] = (int)h8;
h[9] = (int)h9;
} | [
"public",
"static",
"void",
"fe_neg",
"(",
"int",
"[",
"]",
"h",
",",
"int",
"[",
"]",
"f",
")",
"{",
"int",
"f0",
"=",
"f",
"[",
"0",
"]",
";",
"int",
"f1",
"=",
"f",
"[",
"1",
"]",
";",
"int",
"f2",
"=",
"f",
"[",
"2",
"]",
";",
"int"... | /*
h = -f
Preconditions:
|f| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
Postconditions:
|h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc. | [
"/",
"*",
"h",
"=",
"-",
"f"
] | train | https://github.com/signalapp/curve25519-java/blob/70fae57d6dccff7e78a46203c534314b07dfdd98/common/src/main/java/org/whispersystems/curve25519/java/fe_neg.java#L17-L49 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.safeLookup | public static <A, B> B safeLookup(Map<A, B> map, A key) {
if (map == null) {
return null;
}
return map.get(key);
} | java | public static <A, B> B safeLookup(Map<A, B> map, A key) {
if (map == null) {
return null;
}
return map.get(key);
} | [
"public",
"static",
"<",
"A",
",",
"B",
">",
"B",
"safeLookup",
"(",
"Map",
"<",
"A",
",",
"B",
">",
"map",
",",
"A",
"key",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"map",
".",
"get",
"(",
"... | Helper method for looking up a value in a map which may be null.<p>
@param <A> the key type
@param <B> the value type
@param map the map (which may be null)
@param key the map key
@return the value of the map at the given key, or null if the map is null | [
"Helper",
"method",
"for",
"looking",
"up",
"a",
"value",
"in",
"a",
"map",
"which",
"may",
"be",
"null",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L283-L289 |
JDBDT/jdbdt | src/main/java/org/jdbdt/Log.java | Log.write | void write(CallInfo callInfo, SimpleAssertion assertion) {
Element rootNode = root(callInfo);
if (assertion.getSource() != null) {
write(rootNode, assertion.getSource());
}
Element saNode = createNode(rootNode, SIMPLE_ASSERTION_TAG);
if (! assertion.passed()) {
Element errorsNode = createNode(saNode, ERRORS_TAG);
createNode(errorsNode, EXPECTED_TAG)
.setAttribute(VALUE_ATTR, assertion.getExpectedResult().toString());
createNode(errorsNode, ACTUAL_TAG)
.setAttribute(VALUE_ATTR, assertion.getActualResult().toString());
}
flush(rootNode);
} | java | void write(CallInfo callInfo, SimpleAssertion assertion) {
Element rootNode = root(callInfo);
if (assertion.getSource() != null) {
write(rootNode, assertion.getSource());
}
Element saNode = createNode(rootNode, SIMPLE_ASSERTION_TAG);
if (! assertion.passed()) {
Element errorsNode = createNode(saNode, ERRORS_TAG);
createNode(errorsNode, EXPECTED_TAG)
.setAttribute(VALUE_ATTR, assertion.getExpectedResult().toString());
createNode(errorsNode, ACTUAL_TAG)
.setAttribute(VALUE_ATTR, assertion.getActualResult().toString());
}
flush(rootNode);
} | [
"void",
"write",
"(",
"CallInfo",
"callInfo",
",",
"SimpleAssertion",
"assertion",
")",
"{",
"Element",
"rootNode",
"=",
"root",
"(",
"callInfo",
")",
";",
"if",
"(",
"assertion",
".",
"getSource",
"(",
")",
"!=",
"null",
")",
"{",
"write",
"(",
"rootNod... | Log simple assertion.
@param callInfo Call info.
@param assertion Delta assertion. | [
"Log",
"simple",
"assertion",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/Log.java#L298-L312 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java | DatabasesInner.getByRecommendedElasticPool | public DatabaseInner getByRecommendedElasticPool(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) {
return getByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName).toBlocking().single().body();
} | java | public DatabaseInner getByRecommendedElasticPool(String resourceGroupName, String serverName, String recommendedElasticPoolName, String databaseName) {
return getByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName, databaseName).toBlocking().single().body();
} | [
"public",
"DatabaseInner",
"getByRecommendedElasticPool",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"recommendedElasticPoolName",
",",
"String",
"databaseName",
")",
"{",
"return",
"getByRecommendedElasticPoolWithServiceResponseAsync",
"(",... | Gets a database inside of a recommented elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param recommendedElasticPoolName The name of the elastic pool to be retrieved.
@param databaseName The name of the database to be retrieved.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DatabaseInner object if successful. | [
"Gets",
"a",
"database",
"inside",
"of",
"a",
"recommented",
"elastic",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L1540-L1542 |
JoeKerouac/utils | src/main/java/com/joe/utils/reflect/asm/AsmInvokeDistributeFactory.java | AsmInvokeDistributeFactory.createIf | private static void createIf(MethodVisitor mv, Method method, Label next, Label start,
String className, Class<?> parentClass) {
// 标记分支开始位置
mv.visitLabel(start);
mv.visitFrame(F_SAME, 0, null, 0, null);
// 比较方法声明类
stringEquals(mv, () -> mv.visitVarInsn(ALOAD, 1), convert(method.getDeclaringClass()), next,
() -> {
// 比较方法名
stringEquals(mv, () -> mv.visitVarInsn(ALOAD, 2), method.getName(), next, () -> {
// 方法名一致再比较方法说明
stringEquals(mv, () -> mv.visitVarInsn(ALOAD, 3),
ByteCodeUtils.getMethodDesc(method), next, () -> {
// 方法说明也一致后执行方法
invokeMethod(mv, method, () -> {
// 调用代理对象对应的方法而不是本代理的方法
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, convert(className), TARGET_FIELD_NAME,
getByteCodeType(parentClass));
// 获取参数数量,用于载入参数
int count = method.getParameterCount();
Class<?>[] types = method.getParameterTypes();
// 循环载入参数
for (int i = 0; i < count; i++) {
mv.visitVarInsn(Opcodes.ALOAD, 4);
// 这里注意,访问数组下标0-5和6-无穷是不一样的
// 访问0-5对应的byte code: aload | iconst_[0-5] | aaload
// 访问下标大于5的byte code: aload | bipush [6-无穷] aaload
if (i <= 5) {
mv.visitInsn(ICONST_0 + i);
} else {
mv.visitIntInsn(BIPUSH, i);
}
mv.visitInsn(Opcodes.AALOAD);
mv.visitTypeInsn(CHECKCAST, convert(types[i]));
}
});
});
});
});
} | java | private static void createIf(MethodVisitor mv, Method method, Label next, Label start,
String className, Class<?> parentClass) {
// 标记分支开始位置
mv.visitLabel(start);
mv.visitFrame(F_SAME, 0, null, 0, null);
// 比较方法声明类
stringEquals(mv, () -> mv.visitVarInsn(ALOAD, 1), convert(method.getDeclaringClass()), next,
() -> {
// 比较方法名
stringEquals(mv, () -> mv.visitVarInsn(ALOAD, 2), method.getName(), next, () -> {
// 方法名一致再比较方法说明
stringEquals(mv, () -> mv.visitVarInsn(ALOAD, 3),
ByteCodeUtils.getMethodDesc(method), next, () -> {
// 方法说明也一致后执行方法
invokeMethod(mv, method, () -> {
// 调用代理对象对应的方法而不是本代理的方法
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, convert(className), TARGET_FIELD_NAME,
getByteCodeType(parentClass));
// 获取参数数量,用于载入参数
int count = method.getParameterCount();
Class<?>[] types = method.getParameterTypes();
// 循环载入参数
for (int i = 0; i < count; i++) {
mv.visitVarInsn(Opcodes.ALOAD, 4);
// 这里注意,访问数组下标0-5和6-无穷是不一样的
// 访问0-5对应的byte code: aload | iconst_[0-5] | aaload
// 访问下标大于5的byte code: aload | bipush [6-无穷] aaload
if (i <= 5) {
mv.visitInsn(ICONST_0 + i);
} else {
mv.visitIntInsn(BIPUSH, i);
}
mv.visitInsn(Opcodes.AALOAD);
mv.visitTypeInsn(CHECKCAST, convert(types[i]));
}
});
});
});
});
} | [
"private",
"static",
"void",
"createIf",
"(",
"MethodVisitor",
"mv",
",",
"Method",
"method",
",",
"Label",
"next",
",",
"Label",
"start",
",",
"String",
"className",
",",
"Class",
"<",
"?",
">",
"parentClass",
")",
"{",
"// 标记分支开始位置",
"mv",
".",
"visitLab... | 创建if分支的byte code
@param mv MethodVisitor
@param method Method
@param next 下一个分支的起始位置
@param start 该分支的结束位置 | [
"创建if分支的byte",
"code"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/asm/AsmInvokeDistributeFactory.java#L236-L277 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.expectMatch | public void expectMatch(String name, String message, List<String> values) {
String value = Optional.ofNullable(get(name)).orElse("");
if (!(values).contains(value)) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.MATCH_VALUES_KEY.name(), name)));
}
} | java | public void expectMatch(String name, String message, List<String> values) {
String value = Optional.ofNullable(get(name)).orElse("");
if (!(values).contains(value)) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.MATCH_VALUES_KEY.name(), name)));
}
} | [
"public",
"void",
"expectMatch",
"(",
"String",
"name",
",",
"String",
"message",
",",
"List",
"<",
"String",
">",
"values",
")",
"{",
"String",
"value",
"=",
"Optional",
".",
"ofNullable",
"(",
"get",
"(",
"name",
")",
")",
".",
"orElse",
"(",
"\"\"",... | Validates to fields to (case-sensitive) match
@param name The field to check
@param message A custom error message instead of the default one
@param values A list of given values to check against | [
"Validates",
"to",
"fields",
"to",
"(",
"case",
"-",
"sensitive",
")",
"match"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L234-L240 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleSystem.java | ParticleSystem.getNewParticle | public Particle getNewParticle(ParticleEmitter emitter, float life)
{
ParticlePool pool = (ParticlePool) particlesByEmitter.get(emitter);
ArrayList available = pool.available;
if (available.size() > 0)
{
Particle p = (Particle) available.remove(available.size()-1);
p.init(emitter, life);
p.setImage(sprite);
return p;
}
Log.warn("Ran out of particles (increase the limit)!");
return dummy;
} | java | public Particle getNewParticle(ParticleEmitter emitter, float life)
{
ParticlePool pool = (ParticlePool) particlesByEmitter.get(emitter);
ArrayList available = pool.available;
if (available.size() > 0)
{
Particle p = (Particle) available.remove(available.size()-1);
p.init(emitter, life);
p.setImage(sprite);
return p;
}
Log.warn("Ran out of particles (increase the limit)!");
return dummy;
} | [
"public",
"Particle",
"getNewParticle",
"(",
"ParticleEmitter",
"emitter",
",",
"float",
"life",
")",
"{",
"ParticlePool",
"pool",
"=",
"(",
"ParticlePool",
")",
"particlesByEmitter",
".",
"get",
"(",
"emitter",
")",
";",
"ArrayList",
"available",
"=",
"pool",
... | Get a new particle from the system. This should be used by emitters to
request particles
@param emitter The emitter requesting the particle
@param life The time the new particle should live for
@return A particle from the system | [
"Get",
"a",
"new",
"particle",
"from",
"the",
"system",
".",
"This",
"should",
"be",
"used",
"by",
"emitters",
"to",
"request",
"particles"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/particles/ParticleSystem.java#L546-L561 |
apiman/apiman | manager/api/war/wildfly8/src/main/java/io/apiman/manager/api/war/wildfly8/Wildfly8PluginRegistry.java | Wildfly8PluginRegistry.getPluginDir | private static File getPluginDir() {
String dataDirPath = System.getProperty("jboss.server.data.dir"); //$NON-NLS-1$
File dataDir = new File(dataDirPath);
if (!dataDir.isDirectory()) {
throw new RuntimeException("Failed to find WildFly data directory at: " + dataDirPath); //$NON-NLS-1$
}
File pluginsDir = new File(dataDir, "apiman/plugins"); //$NON-NLS-1$
return pluginsDir;
} | java | private static File getPluginDir() {
String dataDirPath = System.getProperty("jboss.server.data.dir"); //$NON-NLS-1$
File dataDir = new File(dataDirPath);
if (!dataDir.isDirectory()) {
throw new RuntimeException("Failed to find WildFly data directory at: " + dataDirPath); //$NON-NLS-1$
}
File pluginsDir = new File(dataDir, "apiman/plugins"); //$NON-NLS-1$
return pluginsDir;
} | [
"private",
"static",
"File",
"getPluginDir",
"(",
")",
"{",
"String",
"dataDirPath",
"=",
"System",
".",
"getProperty",
"(",
"\"jboss.server.data.dir\"",
")",
";",
"//$NON-NLS-1$",
"File",
"dataDir",
"=",
"new",
"File",
"(",
"dataDirPath",
")",
";",
"if",
"(",... | Creates the directory to use for the plugin registry. The location of
the plugin registry is in the Wildfly data directory. | [
"Creates",
"the",
"directory",
"to",
"use",
"for",
"the",
"plugin",
"registry",
".",
"The",
"location",
"of",
"the",
"plugin",
"registry",
"is",
"in",
"the",
"Wildfly",
"data",
"directory",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/war/wildfly8/src/main/java/io/apiman/manager/api/war/wildfly8/Wildfly8PluginRegistry.java#L48-L56 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vpc/VpcClient.java | VpcClient.listVpcs | public ListVpcsResponse listVpcs(ListVpcsRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, VPC_PREFIX);
if (request.getMarker() != null) {
internalRequest.addParameter("marker", request.getMarker());
}
if (request.getMaxKeys() > 0) {
internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
}
if (request.getIsDefault() != null) {
internalRequest.addParameter("isDefault", request.getIsDefault().toString());
}
return invokeHttpClient(internalRequest, ListVpcsResponse.class);
} | java | public ListVpcsResponse listVpcs(ListVpcsRequest request) {
checkNotNull(request, "request should not be null.");
InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, VPC_PREFIX);
if (request.getMarker() != null) {
internalRequest.addParameter("marker", request.getMarker());
}
if (request.getMaxKeys() > 0) {
internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys()));
}
if (request.getIsDefault() != null) {
internalRequest.addParameter("isDefault", request.getIsDefault().toString());
}
return invokeHttpClient(internalRequest, ListVpcsResponse.class);
} | [
"public",
"ListVpcsResponse",
"listVpcs",
"(",
"ListVpcsRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"request should not be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"this",
".",
"createRequest",
"(",
"request",
",",
"Http... | Return a list of vpcs owned by the authenticated user.
@param request The request containing all options for listing own's vpc.
@return The response containing a list of vpcs owned by the authenticated user. | [
"Return",
"a",
"list",
"of",
"vpcs",
"owned",
"by",
"the",
"authenticated",
"user",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vpc/VpcClient.java#L200-L213 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java | NodeSet.addNodesInDocOrder | public void addNodesInDocOrder(NodeList nodelist, XPathContext support)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
int nChildren = nodelist.getLength();
for (int i = 0; i < nChildren; i++)
{
Node node = nodelist.item(i);
if (null != node)
{
addNodeInDocOrder(node, support);
}
}
} | java | public void addNodesInDocOrder(NodeList nodelist, XPathContext support)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
int nChildren = nodelist.getLength();
for (int i = 0; i < nChildren; i++)
{
Node node = nodelist.item(i);
if (null != node)
{
addNodeInDocOrder(node, support);
}
}
} | [
"public",
"void",
"addNodesInDocOrder",
"(",
"NodeList",
"nodelist",
",",
"XPathContext",
"support",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER... | Copy NodeList members into this nodelist, adding in
document order. If a node is null, don't add it.
@param nodelist List of nodes to be added
@param support The XPath runtime context.
@throws RuntimeException thrown if this NodeSet is not of
a mutable type. | [
"Copy",
"NodeList",
"members",
"into",
"this",
"nodelist",
"adding",
"in",
"document",
"order",
".",
"If",
"a",
"node",
"is",
"null",
"don",
"t",
"add",
"it",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L516-L533 |
iipc/webarchive-commons | src/main/java/org/archive/io/ReplayInputStream.java | ReplayInputStream.readContentTo | public void readContentTo(OutputStream os, long maxSize) throws IOException {
setToResponseBodyStart();
byte[] buf = new byte[4096];
int c = read(buf);
long tot = 0;
while (c != -1 && tot < maxSize) {
os.write(buf,0,c);
c = read(buf);
tot += c;
}
} | java | public void readContentTo(OutputStream os, long maxSize) throws IOException {
setToResponseBodyStart();
byte[] buf = new byte[4096];
int c = read(buf);
long tot = 0;
while (c != -1 && tot < maxSize) {
os.write(buf,0,c);
c = read(buf);
tot += c;
}
} | [
"public",
"void",
"readContentTo",
"(",
"OutputStream",
"os",
",",
"long",
"maxSize",
")",
"throws",
"IOException",
"{",
"setToResponseBodyStart",
"(",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"4096",
"]",
";",
"int",
"c",
"=",
"read",... | Convenience method to copy content out to target stream.
@param os stream to write content to
@param maxSize maximum count of bytes to copy
@throws IOException | [
"Convenience",
"method",
"to",
"copy",
"content",
"out",
"to",
"target",
"stream",
"."
] | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/ReplayInputStream.java#L234-L244 |
sagiegurari/fax4j | src/main/java/org/fax4j/common/AbstractLogger.java | AbstractLogger.logDebug | public void logDebug(Object[] message,Throwable throwable)
{
this.log(LogLevel.DEBUG,message,throwable);
} | java | public void logDebug(Object[] message,Throwable throwable)
{
this.log(LogLevel.DEBUG,message,throwable);
} | [
"public",
"void",
"logDebug",
"(",
"Object",
"[",
"]",
"message",
",",
"Throwable",
"throwable",
")",
"{",
"this",
".",
"log",
"(",
"LogLevel",
".",
"DEBUG",
",",
"message",
",",
"throwable",
")",
";",
"}"
] | Logs the provided data at the debug level.
@param message
The message parts (may be null)
@param throwable
The error (may be null) | [
"Logs",
"the",
"provided",
"data",
"at",
"the",
"debug",
"level",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/common/AbstractLogger.java#L170-L173 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java | StringSearch.setCollator | public void setCollator(RuleBasedCollator collator) {
if (collator == null) {
throw new IllegalArgumentException("Collator can not be null");
}
collator_ = collator;
ceMask_ = getMask(collator_.getStrength());
ULocale collLocale = collator.getLocale(ULocale.VALID_LOCALE);
search_.internalBreakIter_ = BreakIterator.getCharacterInstance(collLocale == null ? ULocale.ROOT : collLocale);
search_.internalBreakIter_.setText((CharacterIterator)search_.text().clone()); // We need to create a clone
toShift_ = collator.isAlternateHandlingShifted();
variableTop_ = collator.getVariableTop();
textIter_ = new CollationElementIterator(pattern_.text_, collator);
utilIter_ = new CollationElementIterator(pattern_.text_, collator);
// initialize() _after_ setting the iterators for the new collator.
initialize();
} | java | public void setCollator(RuleBasedCollator collator) {
if (collator == null) {
throw new IllegalArgumentException("Collator can not be null");
}
collator_ = collator;
ceMask_ = getMask(collator_.getStrength());
ULocale collLocale = collator.getLocale(ULocale.VALID_LOCALE);
search_.internalBreakIter_ = BreakIterator.getCharacterInstance(collLocale == null ? ULocale.ROOT : collLocale);
search_.internalBreakIter_.setText((CharacterIterator)search_.text().clone()); // We need to create a clone
toShift_ = collator.isAlternateHandlingShifted();
variableTop_ = collator.getVariableTop();
textIter_ = new CollationElementIterator(pattern_.text_, collator);
utilIter_ = new CollationElementIterator(pattern_.text_, collator);
// initialize() _after_ setting the iterators for the new collator.
initialize();
} | [
"public",
"void",
"setCollator",
"(",
"RuleBasedCollator",
"collator",
")",
"{",
"if",
"(",
"collator",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Collator can not be null\"",
")",
";",
"}",
"collator_",
"=",
"collator",
";",
"ce... | Sets the {@link RuleBasedCollator} to be used for language-specific searching.
<p>
The iterator's position will not be changed by this method.
@param collator to use for this <tt>StringSearch</tt>
@throws IllegalArgumentException thrown when collator is null
@see #getCollator | [
"Sets",
"the",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringSearch.java#L309-L327 |
zsoltk/overpasser | library/src/main/java/hu/supercluster/overpasser/library/query/OverpassFilterQuery.java | OverpassFilterQuery.tagNot | public OverpassFilterQuery tagNot(String name, String value) {
builder.notEquals(name, value);
return this;
} | java | public OverpassFilterQuery tagNot(String name, String value) {
builder.notEquals(name, value);
return this;
} | [
"public",
"OverpassFilterQuery",
"tagNot",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"builder",
".",
"notEquals",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a <i>["name"!=value]</i> filter tag to the current query.
@param name the filter name
@param value the filter value
@return the current query object | [
"Adds",
"a",
"<i",
">",
"[",
"name",
"!",
"=",
"value",
"]",
"<",
"/",
"i",
">",
"filter",
"tag",
"to",
"the",
"current",
"query",
"."
] | train | https://github.com/zsoltk/overpasser/blob/0464d3844e75c5f9393d2458d3a3aedf3e40f30d/library/src/main/java/hu/supercluster/overpasser/library/query/OverpassFilterQuery.java#L177-L181 |
Netflix/dyno | dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/HostStatusTracker.java | HostStatusTracker.verifyMutuallyExclusive | private void verifyMutuallyExclusive(Collection<Host> A, Collection<Host> B) {
Set<Host> left = new HashSet<Host>(A);
Set<Host> right = new HashSet<Host>(B);
boolean modified = left.removeAll(right);
if (modified) {
throw new RuntimeException("Host up and down sets are not mutually exclusive!");
}
} | java | private void verifyMutuallyExclusive(Collection<Host> A, Collection<Host> B) {
Set<Host> left = new HashSet<Host>(A);
Set<Host> right = new HashSet<Host>(B);
boolean modified = left.removeAll(right);
if (modified) {
throw new RuntimeException("Host up and down sets are not mutually exclusive!");
}
} | [
"private",
"void",
"verifyMutuallyExclusive",
"(",
"Collection",
"<",
"Host",
">",
"A",
",",
"Collection",
"<",
"Host",
">",
"B",
")",
"{",
"Set",
"<",
"Host",
">",
"left",
"=",
"new",
"HashSet",
"<",
"Host",
">",
"(",
"A",
")",
";",
"Set",
"<",
"H... | Helper method to check that there is no overlap b/w hosts up and down.
@param A
@param B | [
"Helper",
"method",
"to",
"check",
"that",
"there",
"is",
"no",
"overlap",
"b",
"/",
"w",
"hosts",
"up",
"and",
"down",
"."
] | train | https://github.com/Netflix/dyno/blob/158f807083ea8e9b09c8089cb07f98e954ad5b23/dyno-core/src/main/java/com/netflix/dyno/connectionpool/impl/HostStatusTracker.java#L68-L77 |
SeaCloudsEU/SeaCloudsPlatform | planner/optimizer/optimizer-core/src/main/java/eu/seaclouds/platform/planner/optimizer/nfp/QualityAnalyzer.java | QualityAnalyzer.computeAvailability | public double computeAvailability(Solution bestSol, Topology topology, SuitableOptions cloudCharacteristics) {
visited = new HashSet<String>();
TopologyElement initialElement = topology.getInitialElement();
visited.add(initialElement.getName());
String cloudUsedInitialElement = bestSol.getCloudOfferNameForModule(initialElement.getName());
double instancesUsedInitialElement = -1;
try {
instancesUsedInitialElement = bestSol.getCloudInstancesForModule(initialElement.getName());
} catch (Exception E) {// nothing to do
}
double availabilityInitialElementInstance = cloudCharacteristics
.getCloudCharacteristics(initialElement.getName(), cloudUsedInitialElement).getAvailability();
double unavailabilityInitialElement = Math.pow((1.0 - availabilityInitialElementInstance),
instancesUsedInitialElement);
double availabilityInitialElement = 1.0 - unavailabilityInitialElement;
double systemAvailability = availabilityInitialElement;
for (TopologyElementCalled c : topology.getInitialElement().getDependences()) {
systemAvailability = systemAvailability
* calculateAvailabilityRecursive(c, bestSol, topology, cloudCharacteristics);
}
if (log.isDebugEnabled()) {
log.debug("Finished calculation of availability of solution: " + bestSol.toString());
}
// after computing, save the availability info in properties.availability
properties.setAvailability(systemAvailability);
return systemAvailability;
} | java | public double computeAvailability(Solution bestSol, Topology topology, SuitableOptions cloudCharacteristics) {
visited = new HashSet<String>();
TopologyElement initialElement = topology.getInitialElement();
visited.add(initialElement.getName());
String cloudUsedInitialElement = bestSol.getCloudOfferNameForModule(initialElement.getName());
double instancesUsedInitialElement = -1;
try {
instancesUsedInitialElement = bestSol.getCloudInstancesForModule(initialElement.getName());
} catch (Exception E) {// nothing to do
}
double availabilityInitialElementInstance = cloudCharacteristics
.getCloudCharacteristics(initialElement.getName(), cloudUsedInitialElement).getAvailability();
double unavailabilityInitialElement = Math.pow((1.0 - availabilityInitialElementInstance),
instancesUsedInitialElement);
double availabilityInitialElement = 1.0 - unavailabilityInitialElement;
double systemAvailability = availabilityInitialElement;
for (TopologyElementCalled c : topology.getInitialElement().getDependences()) {
systemAvailability = systemAvailability
* calculateAvailabilityRecursive(c, bestSol, topology, cloudCharacteristics);
}
if (log.isDebugEnabled()) {
log.debug("Finished calculation of availability of solution: " + bestSol.toString());
}
// after computing, save the availability info in properties.availability
properties.setAvailability(systemAvailability);
return systemAvailability;
} | [
"public",
"double",
"computeAvailability",
"(",
"Solution",
"bestSol",
",",
"Topology",
"topology",
",",
"SuitableOptions",
"cloudCharacteristics",
")",
"{",
"visited",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"TopologyElement",
"initialElement",
... | @param bestSol
@param topology
@param cloudCharacteristics
@return The calculated availability of the system.
This method will be recursive. The availablity of the system will
be the product of the availability of its first module and the
modules it requests. It will not work if there are cycles in the
topology | [
"@param",
"bestSol",
"@param",
"topology",
"@param",
"cloudCharacteristics",
"@return",
"The",
"calculated",
"availability",
"of",
"the",
"system",
"."
] | train | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/planner/optimizer/optimizer-core/src/main/java/eu/seaclouds/platform/planner/optimizer/nfp/QualityAnalyzer.java#L416-L451 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.ipOrganisation_POST | public void ipOrganisation_POST(String abuse_mailbox, String address, String city, OvhCountryEnum country, String firstname, String lastname, String phone, OvhIpRegistryEnum registry, String state, String zip) throws IOException {
String qPath = "/me/ipOrganisation";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "abuse_mailbox", abuse_mailbox);
addBody(o, "address", address);
addBody(o, "city", city);
addBody(o, "country", country);
addBody(o, "firstname", firstname);
addBody(o, "lastname", lastname);
addBody(o, "phone", phone);
addBody(o, "registry", registry);
addBody(o, "state", state);
addBody(o, "zip", zip);
exec(qPath, "POST", sb.toString(), o);
} | java | public void ipOrganisation_POST(String abuse_mailbox, String address, String city, OvhCountryEnum country, String firstname, String lastname, String phone, OvhIpRegistryEnum registry, String state, String zip) throws IOException {
String qPath = "/me/ipOrganisation";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "abuse_mailbox", abuse_mailbox);
addBody(o, "address", address);
addBody(o, "city", city);
addBody(o, "country", country);
addBody(o, "firstname", firstname);
addBody(o, "lastname", lastname);
addBody(o, "phone", phone);
addBody(o, "registry", registry);
addBody(o, "state", state);
addBody(o, "zip", zip);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"ipOrganisation_POST",
"(",
"String",
"abuse_mailbox",
",",
"String",
"address",
",",
"String",
"city",
",",
"OvhCountryEnum",
"country",
",",
"String",
"firstname",
",",
"String",
"lastname",
",",
"String",
"phone",
",",
"OvhIpRegistryEnum",
"re... | Add an organisation
REST: POST /me/ipOrganisation
@param zip [required]
@param state [required]
@param country [required]
@param city [required]
@param registry [required]
@param address [required]
@param firstname [required]
@param lastname [required]
@param phone [required]
@param abuse_mailbox [required] | [
"Add",
"an",
"organisation"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2255-L2270 |
kohsuke/args4j | args4j/src/org/kohsuke/args4j/CmdLineParser.java | CmdLineParser.printOption | protected void printOption(PrintWriter out, OptionHandler handler, int len, ResourceBundle rb, OptionHandlerFilter filter) {
// Hiding options without usage information
if (handler.option.usage() == null ||
handler.option.usage().length() == 0 ||
!filter.select(handler)) {
return;
}
// What is the width of the two data columns
int totalUsageWidth = parserProperties.getUsageWidth();
int widthMetadata = Math.min(len, (totalUsageWidth - 4) / 2);
int widthUsage = totalUsageWidth - 4 - widthMetadata;
String defaultValuePart = createDefaultValuePart(handler);
// Line wrapping
// the 'left' side
List<String> namesAndMetas = wrapLines(handler.getNameAndMeta(rb, parserProperties), widthMetadata);
// the 'right' side
List<String> usages = wrapLines(localize(handler.option.usage(),rb) + defaultValuePart, widthUsage);
// Output
for(int i=0; i<Math.max(namesAndMetas.size(), usages.size()); i++) {
String nameAndMeta = (i >= namesAndMetas.size()) ? "" : namesAndMetas.get(i);
String usage = (i >= usages.size()) ? "" : usages.get(i);
String format = ((nameAndMeta.length() > 0) && (i == 0))
? " %1$-" + widthMetadata + "s : %2$-1s"
: " %1$-" + widthMetadata + "s %2$-1s";
String output = String.format(format, nameAndMeta, usage);
out.println(output);
}
} | java | protected void printOption(PrintWriter out, OptionHandler handler, int len, ResourceBundle rb, OptionHandlerFilter filter) {
// Hiding options without usage information
if (handler.option.usage() == null ||
handler.option.usage().length() == 0 ||
!filter.select(handler)) {
return;
}
// What is the width of the two data columns
int totalUsageWidth = parserProperties.getUsageWidth();
int widthMetadata = Math.min(len, (totalUsageWidth - 4) / 2);
int widthUsage = totalUsageWidth - 4 - widthMetadata;
String defaultValuePart = createDefaultValuePart(handler);
// Line wrapping
// the 'left' side
List<String> namesAndMetas = wrapLines(handler.getNameAndMeta(rb, parserProperties), widthMetadata);
// the 'right' side
List<String> usages = wrapLines(localize(handler.option.usage(),rb) + defaultValuePart, widthUsage);
// Output
for(int i=0; i<Math.max(namesAndMetas.size(), usages.size()); i++) {
String nameAndMeta = (i >= namesAndMetas.size()) ? "" : namesAndMetas.get(i);
String usage = (i >= usages.size()) ? "" : usages.get(i);
String format = ((nameAndMeta.length() > 0) && (i == 0))
? " %1$-" + widthMetadata + "s : %2$-1s"
: " %1$-" + widthMetadata + "s %2$-1s";
String output = String.format(format, nameAndMeta, usage);
out.println(output);
}
} | [
"protected",
"void",
"printOption",
"(",
"PrintWriter",
"out",
",",
"OptionHandler",
"handler",
",",
"int",
"len",
",",
"ResourceBundle",
"rb",
",",
"OptionHandlerFilter",
"filter",
")",
"{",
"// Hiding options without usage information",
"if",
"(",
"handler",
".",
... | Prints usage information for a given option.
<p>
Subtypes may override this method and determine which options get printed (or other things),
based on {@link OptionHandler} (perhaps by using {@code handler.setter.asAnnotatedElement()}).
@param out Writer to write into
@param handler handler where to receive the information
@param len Maximum length of metadata column
@param rb {@code ResourceBundle} for I18N
@see Setter#asAnnotatedElement() | [
"Prints",
"usage",
"information",
"for",
"a",
"given",
"option",
"."
] | train | https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L322-L354 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxRepresentation.java | BoxRepresentation.getRepresentationHintString | public static String getRepresentationHintString(String repType, String repSize) {
StringBuffer sb = new StringBuffer(repType);
if(TYPE_JPG.equals(repType) || TYPE_PNG.equals(repType)) {
if(TextUtils.isEmpty(repSize)) {
throw new InvalidParameterException("Size is not optional when creating representation hints for images");
}
sb.append("?" + BoxRepPropertiesMap.FIELD_PROPERTIES_DIMENSIONS + "=" + repSize);
}
return sb.toString();
} | java | public static String getRepresentationHintString(String repType, String repSize) {
StringBuffer sb = new StringBuffer(repType);
if(TYPE_JPG.equals(repType) || TYPE_PNG.equals(repType)) {
if(TextUtils.isEmpty(repSize)) {
throw new InvalidParameterException("Size is not optional when creating representation hints for images");
}
sb.append("?" + BoxRepPropertiesMap.FIELD_PROPERTIES_DIMENSIONS + "=" + repSize);
}
return sb.toString();
} | [
"public",
"static",
"String",
"getRepresentationHintString",
"(",
"String",
"repType",
",",
"String",
"repSize",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"repType",
")",
";",
"if",
"(",
"TYPE_JPG",
".",
"equals",
"(",
"repType",
")",
... | Helper method to generate representation hint string
@param repType the type of representation
@param repSize the size of representation, used for image types. (please refer to dimension string
@return string that can be used on server requests hinting the type of representation to return | [
"Helper",
"method",
"to",
"generate",
"representation",
"hint",
"string"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxRepresentation.java#L165-L174 |
OpenBEL/openbel-framework | org.openbel.framework.core/src/main/java/org/openbel/framework/core/namespace/DefaultNamespaceService.java | DefaultNamespaceService.doVerify | private void doVerify(Parameter p) throws NamespaceSyntaxWarning {
if (p.getValue() == null) {
throw new InvalidArgument("parameter value is null");
}
Namespace ns = p.getNamespace();
String resourceLocation = ns.getResourceLocation();
if (resourceLocation == null) {
throw new InvalidArgument("resourceLocation", resourceLocation);
}
// get opened namespace and lookup namespace parameter encoding
JDBMNamespaceLookup il = openNamespaces.get(ns.getResourceLocation());
if (il == null) {
throw new IllegalStateException("namespace index is not open.");
}
String encoding = il.lookup(p.getValue());
if (encoding == null) {
throw new NamespaceSyntaxWarning(ns.getResourceLocation(),
ns.getPrefix(),
p.getValue());
}
} | java | private void doVerify(Parameter p) throws NamespaceSyntaxWarning {
if (p.getValue() == null) {
throw new InvalidArgument("parameter value is null");
}
Namespace ns = p.getNamespace();
String resourceLocation = ns.getResourceLocation();
if (resourceLocation == null) {
throw new InvalidArgument("resourceLocation", resourceLocation);
}
// get opened namespace and lookup namespace parameter encoding
JDBMNamespaceLookup il = openNamespaces.get(ns.getResourceLocation());
if (il == null) {
throw new IllegalStateException("namespace index is not open.");
}
String encoding = il.lookup(p.getValue());
if (encoding == null) {
throw new NamespaceSyntaxWarning(ns.getResourceLocation(),
ns.getPrefix(),
p.getValue());
}
} | [
"private",
"void",
"doVerify",
"(",
"Parameter",
"p",
")",
"throws",
"NamespaceSyntaxWarning",
"{",
"if",
"(",
"p",
".",
"getValue",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidArgument",
"(",
"\"parameter value is null\"",
")",
";",
"}",
"Name... | Do namespace value verification against a resource location. This
implementation assumes the namespace has been open prior to execution.
@param p {@link Parameter}, the parameter to verify namespace value for
which cannot be null and must have a non-null namespace and value
@throws NamespaceSyntaxWarning Thrown if parameter's {@link Namespace} is
not null and it does not contain the parameter's value
@throws InvalidArgument Thrown if <tt>p</tt> argument is null, its value
is null, or if its namespace's resource location is null | [
"Do",
"namespace",
"value",
"verification",
"against",
"a",
"resource",
"location",
".",
"This",
"implementation",
"assumes",
"the",
"namespace",
"has",
"been",
"open",
"prior",
"to",
"execution",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/namespace/DefaultNamespaceService.java#L409-L433 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/cdi/util/BeanProvider.java | BeanProvider.getContextualReference | private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Bean<?> bean)
{
//noinspection unchecked
return getContextualReference(type, beanManager, new HashSet<Bean<?>>((Collection) Arrays.asList(bean)));
} | java | private static <T> T getContextualReference(Class<T> type, BeanManager beanManager, Bean<?> bean)
{
//noinspection unchecked
return getContextualReference(type, beanManager, new HashSet<Bean<?>>((Collection) Arrays.asList(bean)));
} | [
"private",
"static",
"<",
"T",
">",
"T",
"getContextualReference",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"BeanManager",
"beanManager",
",",
"Bean",
"<",
"?",
">",
"bean",
")",
"{",
"//noinspection unchecked",
"return",
"getContextualReference",
"(",
"type"... | /*
public static <T> T getContextualReference(Class<T> type, Bean<T> bean)
{
return getContextualReference(type, getBeanManager(), bean);
} | [
"/",
"*",
"public",
"static",
"<T",
">",
"T",
"getContextualReference",
"(",
"Class<T",
">",
"type",
"Bean<T",
">",
"bean",
")",
"{",
"return",
"getContextualReference",
"(",
"type",
"getBeanManager",
"()",
"bean",
")",
";",
"}"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/cdi/util/BeanProvider.java#L233-L237 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/AbstractCommand.java | AbstractCommand.createMenuItem | public final JMenuItem createMenuItem(String faceDescriptorId, MenuFactory menuFactory) {
return createMenuItem(faceDescriptorId, menuFactory, getMenuItemButtonConfigurer());
} | java | public final JMenuItem createMenuItem(String faceDescriptorId, MenuFactory menuFactory) {
return createMenuItem(faceDescriptorId, menuFactory, getMenuItemButtonConfigurer());
} | [
"public",
"final",
"JMenuItem",
"createMenuItem",
"(",
"String",
"faceDescriptorId",
",",
"MenuFactory",
"menuFactory",
")",
"{",
"return",
"createMenuItem",
"(",
"faceDescriptorId",
",",
"menuFactory",
",",
"getMenuItemButtonConfigurer",
"(",
")",
")",
";",
"}"
] | Create a menuItem using the default and menuItemButtonConfigurer.
@see #createMenuItem(String, MenuFactory, CommandButtonConfigurer) | [
"Create",
"a",
"menuItem",
"using",
"the",
"default",
"and",
"menuItemButtonConfigurer",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/AbstractCommand.java#L822-L824 |
FINRAOS/JTAF-ExtWebDriver | src/main/java/org/finra/jtaf/ewd/widget/element/Element.java | Element.isElementPresentJavaXPath | private boolean isElementPresentJavaXPath() throws Exception {
String xpath = ((StringLocatorAwareBy)getByLocator()).getLocator();
try {
xpath = formatXPathForJavaXPath(xpath);
NodeList nodes = getNodeListUsingJavaXPath(xpath);
if (nodes.getLength() > 0) {
return true;
} else {
return false;
}
} catch (Exception e) {
throw new Exception("Error performing isElement present using Java XPath: " + xpath, e);
}
} | java | private boolean isElementPresentJavaXPath() throws Exception {
String xpath = ((StringLocatorAwareBy)getByLocator()).getLocator();
try {
xpath = formatXPathForJavaXPath(xpath);
NodeList nodes = getNodeListUsingJavaXPath(xpath);
if (nodes.getLength() > 0) {
return true;
} else {
return false;
}
} catch (Exception e) {
throw new Exception("Error performing isElement present using Java XPath: " + xpath, e);
}
} | [
"private",
"boolean",
"isElementPresentJavaXPath",
"(",
")",
"throws",
"Exception",
"{",
"String",
"xpath",
"=",
"(",
"(",
"StringLocatorAwareBy",
")",
"getByLocator",
"(",
")",
")",
".",
"getLocator",
"(",
")",
";",
"try",
"{",
"xpath",
"=",
"formatXPathForJa... | Use the Java Xpath API to determine if the element is present or not
@return boolean true or false as the case is
@throws Exception | [
"Use",
"the",
"Java",
"Xpath",
"API",
"to",
"determine",
"if",
"the",
"element",
"is",
"present",
"or",
"not"
] | train | https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/widget/element/Element.java#L808-L821 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java | SpiderService.addAutoTable | private TableDefinition addAutoTable(ApplicationDefinition appDef, String tableName) {
m_logger.debug("Adding implicit table '{}' to application '{}'", tableName, appDef.getAppName());
Tenant tenant = Tenant.getTenant(appDef);
TableDefinition tableDef = new TableDefinition(appDef);
tableDef.setTableName(tableName);
appDef.addTable(tableDef);
SchemaService.instance().defineApplication(tenant, appDef);
appDef = SchemaService.instance().getApplication(tenant, appDef.getAppName());
return appDef.getTableDef(tableName);
} | java | private TableDefinition addAutoTable(ApplicationDefinition appDef, String tableName) {
m_logger.debug("Adding implicit table '{}' to application '{}'", tableName, appDef.getAppName());
Tenant tenant = Tenant.getTenant(appDef);
TableDefinition tableDef = new TableDefinition(appDef);
tableDef.setTableName(tableName);
appDef.addTable(tableDef);
SchemaService.instance().defineApplication(tenant, appDef);
appDef = SchemaService.instance().getApplication(tenant, appDef.getAppName());
return appDef.getTableDef(tableName);
} | [
"private",
"TableDefinition",
"addAutoTable",
"(",
"ApplicationDefinition",
"appDef",
",",
"String",
"tableName",
")",
"{",
"m_logger",
".",
"debug",
"(",
"\"Adding implicit table '{}' to application '{}'\"",
",",
"tableName",
",",
"appDef",
".",
"getAppName",
"(",
")",... | Add an implicit table to the given application and return its new TableDefinition. | [
"Add",
"an",
"implicit",
"table",
"to",
"the",
"given",
"application",
"and",
"return",
"its",
"new",
"TableDefinition",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java#L515-L524 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/recovery/SecurityActions.java | SecurityActions.setAccessible | static void setAccessible(final Method m, final boolean value)
{
AccessController.doPrivileged(new PrivilegedAction<Object>()
{
public Object run()
{
m.setAccessible(value);
return null;
}
});
} | java | static void setAccessible(final Method m, final boolean value)
{
AccessController.doPrivileged(new PrivilegedAction<Object>()
{
public Object run()
{
m.setAccessible(value);
return null;
}
});
} | [
"static",
"void",
"setAccessible",
"(",
"final",
"Method",
"m",
",",
"final",
"boolean",
"value",
")",
"{",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Object",
">",
"(",
")",
"{",
"public",
"Object",
"run",
"(",
")",
"{"... | Invoke setAccessible on a method
@param m The method
@param value The value | [
"Invoke",
"setAccessible",
"on",
"a",
"method"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/recovery/SecurityActions.java#L46-L56 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java | CommerceCountryPersistenceImpl.findByGroupId | @Override
public List<CommerceCountry> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceCountry> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceCountry",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce countries where groupId = ?.
@param groupId the group ID
@return the matching commerce countries | [
"Returns",
"all",
"the",
"commerce",
"countries",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L1513-L1516 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/PartnersInner.java | PartnersInner.createOrUpdate | public IntegrationAccountPartnerInner createOrUpdate(String resourceGroupName, String integrationAccountName, String partnerName, IntegrationAccountPartnerInner partner) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, partnerName, partner).toBlocking().single().body();
} | java | public IntegrationAccountPartnerInner createOrUpdate(String resourceGroupName, String integrationAccountName, String partnerName, IntegrationAccountPartnerInner partner) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, partnerName, partner).toBlocking().single().body();
} | [
"public",
"IntegrationAccountPartnerInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"partnerName",
",",
"IntegrationAccountPartnerInner",
"partner",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",... | Creates or updates an integration account partner.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param partnerName The integration account partner name.
@param partner The integration account partner.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the IntegrationAccountPartnerInner object if successful. | [
"Creates",
"or",
"updates",
"an",
"integration",
"account",
"partner",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/PartnersInner.java#L448-L450 |
ontop/ontop | engine/reformulation/sql/src/main/java/it/unibz/inf/ontop/answering/reformulation/generation/impl/OneShotSQLGeneratorEngine.java | OneShotSQLGeneratorEngine.generateSourceQuery | SQLExecutableQuery generateSourceQuery(IntermediateQuery intermediateQuery)
throws OntopReformulationException {
IQ normalizedQuery = normalizeIQ(intermediateQuery);
DatalogProgram queryProgram = iq2DatalogTranslator.translate(normalizedQuery);
for (CQIE cq : queryProgram.getRules()) {
datalogNormalizer.addMinimalEqualityToLeftOrNestedInnerJoin(cq);
}
log.debug("Program normalized for SQL translation:\n" + queryProgram);
MutableQueryModifiers queryModifiers = queryProgram.getQueryModifiers();
isDistinct = queryModifiers.hasModifiers() && queryModifiers.isDistinct();
isOrderBy = queryModifiers.hasModifiers() && !queryModifiers.getSortConditions().isEmpty();
DatalogDependencyGraphGenerator depGraph = new DatalogDependencyGraphGenerator(queryProgram.getRules());
Multimap<Predicate, CQIE> ruleIndex = depGraph.getRuleIndex();
List<Predicate> predicatesInBottomUp = depGraph.getPredicatesInBottomUp();
List<Predicate> extensionalPredicates = depGraph.getExtensionalPredicates();
ImmutableList<String> signature = intermediateQuery.getProjectionAtom().getArguments().stream()
.map(Variable::getName)
.collect(ImmutableCollectors.toList());
final String resultingQuery;
String queryString = generateQuery(signature, ruleIndex, predicatesInBottomUp, extensionalPredicates);
if (queryModifiers.hasModifiers()) {
//List<Variable> groupby = queryProgram.getQueryModifiers().getGroupConditions();
// if (!groupby.isEmpty()) {
// subquery += "\n" + sqladapter.sqlGroupBy(groupby, "") + " " +
// havingStr + "\n";
// }
// List<OrderCondition> conditions =
// query.getQueryModifiers().getSortConditions();
long limit = queryModifiers.getLimit();
long offset = queryModifiers.getOffset();
List<OrderCondition> conditions = queryModifiers.getSortConditions();
final String modifier;
if (!conditions.isEmpty()) {
modifier = sqladapter.sqlOrderByAndSlice(conditions, OUTER_VIEW_NAME, limit, offset) + "\n";
}
else if (limit != -1 || offset != -1) {
modifier = sqladapter.sqlSlice(limit, offset) + "\n";
}
else {
modifier = "";
}
resultingQuery = "SELECT *\n" +
"FROM " + inBrackets("\n" + queryString + "\n") + " " + OUTER_VIEW_NAME + "\n" +
modifier;
}
else {
resultingQuery = queryString;
}
return new SQLExecutableQuery(resultingQuery, signature);
} | java | SQLExecutableQuery generateSourceQuery(IntermediateQuery intermediateQuery)
throws OntopReformulationException {
IQ normalizedQuery = normalizeIQ(intermediateQuery);
DatalogProgram queryProgram = iq2DatalogTranslator.translate(normalizedQuery);
for (CQIE cq : queryProgram.getRules()) {
datalogNormalizer.addMinimalEqualityToLeftOrNestedInnerJoin(cq);
}
log.debug("Program normalized for SQL translation:\n" + queryProgram);
MutableQueryModifiers queryModifiers = queryProgram.getQueryModifiers();
isDistinct = queryModifiers.hasModifiers() && queryModifiers.isDistinct();
isOrderBy = queryModifiers.hasModifiers() && !queryModifiers.getSortConditions().isEmpty();
DatalogDependencyGraphGenerator depGraph = new DatalogDependencyGraphGenerator(queryProgram.getRules());
Multimap<Predicate, CQIE> ruleIndex = depGraph.getRuleIndex();
List<Predicate> predicatesInBottomUp = depGraph.getPredicatesInBottomUp();
List<Predicate> extensionalPredicates = depGraph.getExtensionalPredicates();
ImmutableList<String> signature = intermediateQuery.getProjectionAtom().getArguments().stream()
.map(Variable::getName)
.collect(ImmutableCollectors.toList());
final String resultingQuery;
String queryString = generateQuery(signature, ruleIndex, predicatesInBottomUp, extensionalPredicates);
if (queryModifiers.hasModifiers()) {
//List<Variable> groupby = queryProgram.getQueryModifiers().getGroupConditions();
// if (!groupby.isEmpty()) {
// subquery += "\n" + sqladapter.sqlGroupBy(groupby, "") + " " +
// havingStr + "\n";
// }
// List<OrderCondition> conditions =
// query.getQueryModifiers().getSortConditions();
long limit = queryModifiers.getLimit();
long offset = queryModifiers.getOffset();
List<OrderCondition> conditions = queryModifiers.getSortConditions();
final String modifier;
if (!conditions.isEmpty()) {
modifier = sqladapter.sqlOrderByAndSlice(conditions, OUTER_VIEW_NAME, limit, offset) + "\n";
}
else if (limit != -1 || offset != -1) {
modifier = sqladapter.sqlSlice(limit, offset) + "\n";
}
else {
modifier = "";
}
resultingQuery = "SELECT *\n" +
"FROM " + inBrackets("\n" + queryString + "\n") + " " + OUTER_VIEW_NAME + "\n" +
modifier;
}
else {
resultingQuery = queryString;
}
return new SQLExecutableQuery(resultingQuery, signature);
} | [
"SQLExecutableQuery",
"generateSourceQuery",
"(",
"IntermediateQuery",
"intermediateQuery",
")",
"throws",
"OntopReformulationException",
"{",
"IQ",
"normalizedQuery",
"=",
"normalizeIQ",
"(",
"intermediateQuery",
")",
";",
"DatalogProgram",
"queryProgram",
"=",
"iq2DatalogTr... | Generates and SQL query ready to be executed by Quest. Each query is a
SELECT FROM WHERE query. To know more about each of these see the inner
method descriptions.
Observe that the SQL is produced by {@link #generateQuery}
@param intermediateQuery | [
"Generates",
"and",
"SQL",
"query",
"ready",
"to",
"be",
"executed",
"by",
"Quest",
".",
"Each",
"query",
"is",
"a",
"SELECT",
"FROM",
"WHERE",
"query",
".",
"To",
"know",
"more",
"about",
"each",
"of",
"these",
"see",
"the",
"inner",
"method",
"descript... | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/engine/reformulation/sql/src/main/java/it/unibz/inf/ontop/answering/reformulation/generation/impl/OneShotSQLGeneratorEngine.java#L288-L347 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIViewRoot.java | UIViewRoot._getEvents | private Events _getEvents(PhaseId phaseId)
{
// Gather the events and purge the event list to prevent concurrent modification during broadcasting
int size = _events.size();
List<FacesEvent> anyPhase = new ArrayList<FacesEvent>(size);
List<FacesEvent> onPhase = new ArrayList<FacesEvent>(size);
for (int i = 0; i < size; i++)
{
FacesEvent event = _events.get(i);
if (event.getPhaseId().equals(PhaseId.ANY_PHASE))
{
anyPhase.add(event);
_events.remove(i);
size--;
i--;
}
else if (event.getPhaseId().equals(phaseId))
{
onPhase.add(event);
_events.remove(i);
size--;
i--;
}
}
return new Events(anyPhase, onPhase);
} | java | private Events _getEvents(PhaseId phaseId)
{
// Gather the events and purge the event list to prevent concurrent modification during broadcasting
int size = _events.size();
List<FacesEvent> anyPhase = new ArrayList<FacesEvent>(size);
List<FacesEvent> onPhase = new ArrayList<FacesEvent>(size);
for (int i = 0; i < size; i++)
{
FacesEvent event = _events.get(i);
if (event.getPhaseId().equals(PhaseId.ANY_PHASE))
{
anyPhase.add(event);
_events.remove(i);
size--;
i--;
}
else if (event.getPhaseId().equals(phaseId))
{
onPhase.add(event);
_events.remove(i);
size--;
i--;
}
}
return new Events(anyPhase, onPhase);
} | [
"private",
"Events",
"_getEvents",
"(",
"PhaseId",
"phaseId",
")",
"{",
"// Gather the events and purge the event list to prevent concurrent modification during broadcasting",
"int",
"size",
"=",
"_events",
".",
"size",
"(",
")",
";",
"List",
"<",
"FacesEvent",
">",
"anyP... | Gathers all event for current and ANY phase
@param phaseId current phase id | [
"Gathers",
"all",
"event",
"for",
"current",
"and",
"ANY",
"phase"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIViewRoot.java#L1706-L1733 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/version/SemanticVersion.java | SemanticVersion.isAtLeastMajorMinor | public static boolean isAtLeastMajorMinor(String version, int majorVersion, int minorVersion) {
SemanticVersion semanticVersion = new SemanticVersion(version);
return isAtLeastMajorMinorImpl(semanticVersion, majorVersion, minorVersion);
} | java | public static boolean isAtLeastMajorMinor(String version, int majorVersion, int minorVersion) {
SemanticVersion semanticVersion = new SemanticVersion(version);
return isAtLeastMajorMinorImpl(semanticVersion, majorVersion, minorVersion);
} | [
"public",
"static",
"boolean",
"isAtLeastMajorMinor",
"(",
"String",
"version",
",",
"int",
"majorVersion",
",",
"int",
"minorVersion",
")",
"{",
"SemanticVersion",
"semanticVersion",
"=",
"new",
"SemanticVersion",
"(",
"version",
")",
";",
"return",
"isAtLeastMajor... | Check whether the current version is at least the given major and minor version.
@param version The version to check
@param majorVersion The major version
@param minorVersion The minor version
@return True if it is | [
"Check",
"whether",
"the",
"current",
"version",
"is",
"at",
"least",
"the",
"given",
"major",
"and",
"minor",
"version",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/version/SemanticVersion.java#L99-L102 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java | GenericBoJdbcDao.updateOrCreate | protected DaoResult updateOrCreate(Connection conn, T bo) {
if (bo == null) {
return new DaoResult(DaoOperationStatus.NOT_FOUND);
}
DaoResult result = update(conn, bo);
DaoOperationStatus status = result.getStatus();
if (status == DaoOperationStatus.NOT_FOUND) {
result = create(conn, bo);
}
return result;
} | java | protected DaoResult updateOrCreate(Connection conn, T bo) {
if (bo == null) {
return new DaoResult(DaoOperationStatus.NOT_FOUND);
}
DaoResult result = update(conn, bo);
DaoOperationStatus status = result.getStatus();
if (status == DaoOperationStatus.NOT_FOUND) {
result = create(conn, bo);
}
return result;
} | [
"protected",
"DaoResult",
"updateOrCreate",
"(",
"Connection",
"conn",
",",
"T",
"bo",
")",
"{",
"if",
"(",
"bo",
"==",
"null",
")",
"{",
"return",
"new",
"DaoResult",
"(",
"DaoOperationStatus",
".",
"NOT_FOUND",
")",
";",
"}",
"DaoResult",
"result",
"=",
... | Update an existing BO or create a new one.
@param conn
@param bo
@return
@since 0.8.1 | [
"Update",
"an",
"existing",
"BO",
"or",
"create",
"a",
"new",
"one",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java#L730-L740 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDateField.java | WDateField.handleRequestValue | protected void handleRequestValue(final Date value, final boolean valid, final String text) {
// As setData() clears the text value (if valid), this must be called first so it can be set after
setData(value);
DateFieldModel model = getOrCreateComponentModel();
model.validDate = valid;
model.text = text;
} | java | protected void handleRequestValue(final Date value, final boolean valid, final String text) {
// As setData() clears the text value (if valid), this must be called first so it can be set after
setData(value);
DateFieldModel model = getOrCreateComponentModel();
model.validDate = valid;
model.text = text;
} | [
"protected",
"void",
"handleRequestValue",
"(",
"final",
"Date",
"value",
",",
"final",
"boolean",
"valid",
",",
"final",
"String",
"text",
")",
"{",
"// As setData() clears the text value (if valid), this must be called first so it can be set after",
"setData",
"(",
"value",... | Set the request value.
@param value the date value
@param valid true if valid value
@param text the user text | [
"Set",
"the",
"request",
"value",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDateField.java#L209-L215 |
lucee/Lucee | core/src/main/java/lucee/commons/io/SystemUtil.java | SystemUtil.getTempFile | public static Resource getTempFile(String extension, boolean touch) throws IOException {
String filename = CreateUniqueId.invoke();
if (!StringUtil.isEmpty(extension, true)) {
if (extension.startsWith(".")) filename += extension;
else filename += "." + extension;
}
Resource file = getTempDirectory().getRealResource(filename);
if (touch) ResourceUtil.touch(file);
return file;
} | java | public static Resource getTempFile(String extension, boolean touch) throws IOException {
String filename = CreateUniqueId.invoke();
if (!StringUtil.isEmpty(extension, true)) {
if (extension.startsWith(".")) filename += extension;
else filename += "." + extension;
}
Resource file = getTempDirectory().getRealResource(filename);
if (touch) ResourceUtil.touch(file);
return file;
} | [
"public",
"static",
"Resource",
"getTempFile",
"(",
"String",
"extension",
",",
"boolean",
"touch",
")",
"throws",
"IOException",
"{",
"String",
"filename",
"=",
"CreateUniqueId",
".",
"invoke",
"(",
")",
";",
"if",
"(",
"!",
"StringUtil",
".",
"isEmpty",
"(... | returns the a unique temp file (with no auto delete)
@param extension
@return temp directory
@throws IOException | [
"returns",
"the",
"a",
"unique",
"temp",
"file",
"(",
"with",
"no",
"auto",
"delete",
")"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/SystemUtil.java#L369-L378 |
Dempsy/dempsy | dempsy-framework.impl/src/main/java/net/dempsy/output/OutputQuartzHelper.java | OutputQuartzHelper.getSimpleTrigger | public Trigger getSimpleTrigger(TimeUnit timeUnit, int timeInterval) {
SimpleScheduleBuilder simpleScheduleBuilder = null;
simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule();
switch (timeUnit) {
case MILLISECONDS:
simpleScheduleBuilder.withIntervalInMilliseconds(timeInterval).repeatForever();
break;
case SECONDS:
simpleScheduleBuilder.withIntervalInSeconds(timeInterval).repeatForever();
break;
case MINUTES:
simpleScheduleBuilder.withIntervalInMinutes(timeInterval).repeatForever();
break;
case HOURS:
simpleScheduleBuilder.withIntervalInHours(timeInterval).repeatForever();
break;
case DAYS:
simpleScheduleBuilder.withIntervalInHours(timeInterval * 24).repeatForever();
break;
default:
simpleScheduleBuilder.withIntervalInSeconds(1).repeatForever(); //default 1 sec
}
Trigger simpleTrigger = TriggerBuilder.newTrigger().withSchedule(simpleScheduleBuilder).build();
return simpleTrigger;
} | java | public Trigger getSimpleTrigger(TimeUnit timeUnit, int timeInterval) {
SimpleScheduleBuilder simpleScheduleBuilder = null;
simpleScheduleBuilder = SimpleScheduleBuilder.simpleSchedule();
switch (timeUnit) {
case MILLISECONDS:
simpleScheduleBuilder.withIntervalInMilliseconds(timeInterval).repeatForever();
break;
case SECONDS:
simpleScheduleBuilder.withIntervalInSeconds(timeInterval).repeatForever();
break;
case MINUTES:
simpleScheduleBuilder.withIntervalInMinutes(timeInterval).repeatForever();
break;
case HOURS:
simpleScheduleBuilder.withIntervalInHours(timeInterval).repeatForever();
break;
case DAYS:
simpleScheduleBuilder.withIntervalInHours(timeInterval * 24).repeatForever();
break;
default:
simpleScheduleBuilder.withIntervalInSeconds(1).repeatForever(); //default 1 sec
}
Trigger simpleTrigger = TriggerBuilder.newTrigger().withSchedule(simpleScheduleBuilder).build();
return simpleTrigger;
} | [
"public",
"Trigger",
"getSimpleTrigger",
"(",
"TimeUnit",
"timeUnit",
",",
"int",
"timeInterval",
")",
"{",
"SimpleScheduleBuilder",
"simpleScheduleBuilder",
"=",
"null",
";",
"simpleScheduleBuilder",
"=",
"SimpleScheduleBuilder",
".",
"simpleSchedule",
"(",
")",
";",
... | Gets the simple trigger.
@param timeUnit the time unit
@param timeInterval the time interval
@return the simple trigger | [
"Gets",
"the",
"simple",
"trigger",
"."
] | train | https://github.com/Dempsy/dempsy/blob/cd3415b51b6787a6a9d9589b15f00ce674b6f113/dempsy-framework.impl/src/main/java/net/dempsy/output/OutputQuartzHelper.java#L62-L87 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java | AbstractTreeMap.put | public Object put(Object key, Token value) throws ObjectManagerException {
AbstractMapEntry entry = rbInsert(key);
Object result = entry.value;
entry.value = value;
return result;
} | java | public Object put(Object key, Token value) throws ObjectManagerException {
AbstractMapEntry entry = rbInsert(key);
Object result = entry.value;
entry.value = value;
return result;
} | [
"public",
"Object",
"put",
"(",
"Object",
"key",
",",
"Token",
"value",
")",
"throws",
"ObjectManagerException",
"{",
"AbstractMapEntry",
"entry",
"=",
"rbInsert",
"(",
"key",
")",
";",
"Object",
"result",
"=",
"entry",
".",
"value",
";",
"entry",
".",
"va... | Maps the specified key to the specified value.
@param key the key
@param value the value
@return the value of any previous mapping with the specified key or null
if there was no mapping
@exception ClassCastException
when the key cannot be compared with the keys in this
TreeMap
@exception NullPointerException
when the key is null and the comparator cannot handle null
@throws ObjectManagerException | [
"Maps",
"the",
"specified",
"key",
"to",
"the",
"specified",
"value",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/AbstractTreeMap.java#L951-L956 |
spring-cloud/spring-cloud-stream-app-starters | app-starters-common/app-starters-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileUtils.java | FileUtils.enhanceFlowForReadingMode | public static IntegrationFlowBuilder enhanceFlowForReadingMode(IntegrationFlowBuilder flowBuilder,
FileConsumerProperties fileConsumerProperties) {
switch (fileConsumerProperties.getMode()) {
case contents:
flowBuilder.enrichHeaders(Collections.<String, Object>singletonMap(MessageHeaders.CONTENT_TYPE,
"application/octet-stream"))
.transform(Transformers.fileToByteArray());
break;
case lines:
Boolean withMarkers = fileConsumerProperties.getWithMarkers();
if (withMarkers == null) {
withMarkers = false;
}
flowBuilder.enrichHeaders(Collections.<String, Object>singletonMap(MessageHeaders.CONTENT_TYPE,
"text/plain"))
.split(new FileSplitter(true, withMarkers, fileConsumerProperties.getMarkersJson()));
case ref:
break;
default:
throw new IllegalArgumentException(fileConsumerProperties.getMode().name() +
" is not a supported file reading mode.");
}
return flowBuilder;
} | java | public static IntegrationFlowBuilder enhanceFlowForReadingMode(IntegrationFlowBuilder flowBuilder,
FileConsumerProperties fileConsumerProperties) {
switch (fileConsumerProperties.getMode()) {
case contents:
flowBuilder.enrichHeaders(Collections.<String, Object>singletonMap(MessageHeaders.CONTENT_TYPE,
"application/octet-stream"))
.transform(Transformers.fileToByteArray());
break;
case lines:
Boolean withMarkers = fileConsumerProperties.getWithMarkers();
if (withMarkers == null) {
withMarkers = false;
}
flowBuilder.enrichHeaders(Collections.<String, Object>singletonMap(MessageHeaders.CONTENT_TYPE,
"text/plain"))
.split(new FileSplitter(true, withMarkers, fileConsumerProperties.getMarkersJson()));
case ref:
break;
default:
throw new IllegalArgumentException(fileConsumerProperties.getMode().name() +
" is not a supported file reading mode.");
}
return flowBuilder;
} | [
"public",
"static",
"IntegrationFlowBuilder",
"enhanceFlowForReadingMode",
"(",
"IntegrationFlowBuilder",
"flowBuilder",
",",
"FileConsumerProperties",
"fileConsumerProperties",
")",
"{",
"switch",
"(",
"fileConsumerProperties",
".",
"getMode",
"(",
")",
")",
"{",
"case",
... | Enhance an {@link IntegrationFlowBuilder} to add flow snippets, depending on
{@link FileConsumerProperties}.
@param flowBuilder the flow builder.
@param fileConsumerProperties the properties.
@return the updated flow builder. | [
"Enhance",
"an",
"{"
] | train | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/app-starters-common/app-starters-file-common/src/main/java/org/springframework/cloud/stream/app/file/FileUtils.java#L40-L63 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.onSetComparatorType | private void onSetComparatorType(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String comparatorType = cfProperties.getProperty(CassandraConstants.COMPARATOR_TYPE);
if (comparatorType != null)
{
if (builder != null)
{
// TODO:::nothing available.
}
else
{
cfDef.setComparator_type(comparatorType);
}
}
} | java | private void onSetComparatorType(CfDef cfDef, Properties cfProperties, StringBuilder builder)
{
String comparatorType = cfProperties.getProperty(CassandraConstants.COMPARATOR_TYPE);
if (comparatorType != null)
{
if (builder != null)
{
// TODO:::nothing available.
}
else
{
cfDef.setComparator_type(comparatorType);
}
}
} | [
"private",
"void",
"onSetComparatorType",
"(",
"CfDef",
"cfDef",
",",
"Properties",
"cfProperties",
",",
"StringBuilder",
"builder",
")",
"{",
"String",
"comparatorType",
"=",
"cfProperties",
".",
"getProperty",
"(",
"CassandraConstants",
".",
"COMPARATOR_TYPE",
")",
... | On set comparator type.
@param cfDef
the cf def
@param cfProperties
the cf properties
@param builder
the builder | [
"On",
"set",
"comparator",
"type",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2713-L2727 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/pagefactory/AjaxElementLocator.java | AjaxElementLocator.findElement | @Override
public WebElement findElement() {
SlowLoadingElement loadingElement = new SlowLoadingElement(clock, timeOutInSeconds);
try {
return loadingElement.get().getElement();
} catch (NoSuchElementError e) {
throw new NoSuchElementException(
String.format("Timed out after %d seconds. %s", timeOutInSeconds, e.getMessage()),
e.getCause());
}
} | java | @Override
public WebElement findElement() {
SlowLoadingElement loadingElement = new SlowLoadingElement(clock, timeOutInSeconds);
try {
return loadingElement.get().getElement();
} catch (NoSuchElementError e) {
throw new NoSuchElementException(
String.format("Timed out after %d seconds. %s", timeOutInSeconds, e.getMessage()),
e.getCause());
}
} | [
"@",
"Override",
"public",
"WebElement",
"findElement",
"(",
")",
"{",
"SlowLoadingElement",
"loadingElement",
"=",
"new",
"SlowLoadingElement",
"(",
"clock",
",",
"timeOutInSeconds",
")",
";",
"try",
"{",
"return",
"loadingElement",
".",
"get",
"(",
")",
".",
... | {@inheritDoc}
Will poll the interface on a regular basis until the element is present. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/pagefactory/AjaxElementLocator.java#L91-L101 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java | JPAIssues.reportExceptionMismatch | private void reportExceptionMismatch(Method method, Set<JavaClass> expectedExceptions, Set<JavaClass> actualExceptions, boolean checkByDirectionally,
BugType bugType) {
try {
for (JavaClass declEx : actualExceptions) {
boolean handled = false;
for (JavaClass annotEx : expectedExceptions) {
if (declEx.instanceOf(annotEx) || (checkByDirectionally && annotEx.instanceOf(declEx))) {
handled = true;
break;
}
}
if (!handled && !expectedExceptions.contains(declEx)) {
bugReporter.reportBug(new BugInstance(this, bugType.name(), NORMAL_PRIORITY).addClass(this).addMethod(cls, method)
.addString("Exception: " + declEx.getClassName()));
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
}
} | java | private void reportExceptionMismatch(Method method, Set<JavaClass> expectedExceptions, Set<JavaClass> actualExceptions, boolean checkByDirectionally,
BugType bugType) {
try {
for (JavaClass declEx : actualExceptions) {
boolean handled = false;
for (JavaClass annotEx : expectedExceptions) {
if (declEx.instanceOf(annotEx) || (checkByDirectionally && annotEx.instanceOf(declEx))) {
handled = true;
break;
}
}
if (!handled && !expectedExceptions.contains(declEx)) {
bugReporter.reportBug(new BugInstance(this, bugType.name(), NORMAL_PRIORITY).addClass(this).addMethod(cls, method)
.addString("Exception: " + declEx.getClassName()));
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
}
} | [
"private",
"void",
"reportExceptionMismatch",
"(",
"Method",
"method",
",",
"Set",
"<",
"JavaClass",
">",
"expectedExceptions",
",",
"Set",
"<",
"JavaClass",
">",
"actualExceptions",
",",
"boolean",
"checkByDirectionally",
",",
"BugType",
"bugType",
")",
"{",
"try... | compares the current methods exceptions to those declared in the spring-tx's @Transactional method, both rollbackFor and noRollbackFor. It looks both
ways, exceptions thrown that aren't handled by rollbacks/norollbacks, and Spring declarations that aren't actually thrown.
@param method
the currently parsed method
@param expectedExceptions
exceptions declared in the @Transactional annotation
@param actualExceptions
non-runtime exceptions that are thrown by the method
@param checkByDirectionally
whether to check both ways
@param bugType
what type of bug to report if found | [
"compares",
"the",
"current",
"methods",
"exceptions",
"to",
"those",
"declared",
"in",
"the",
"spring",
"-",
"tx",
"s",
"@Transactional",
"method",
"both",
"rollbackFor",
"and",
"noRollbackFor",
".",
"It",
"looks",
"both",
"ways",
"exceptions",
"thrown",
"that"... | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java#L372-L392 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/info/StorableIndex.java | StorableIndex.nextSep | private static int nextSep(String desc, int pos) {
int pos2 = desc.length(); // assume we'll find none
int candidate = desc.indexOf('+', pos);
if (candidate > 0) {
pos2=candidate;
}
candidate = desc.indexOf('-', pos);
if (candidate>0) {
pos2 = Math.min(candidate, pos2);
}
candidate = desc.indexOf('~', pos);
if (candidate>0) {
pos2 = Math.min(candidate, pos2);
}
return pos2;
} | java | private static int nextSep(String desc, int pos) {
int pos2 = desc.length(); // assume we'll find none
int candidate = desc.indexOf('+', pos);
if (candidate > 0) {
pos2=candidate;
}
candidate = desc.indexOf('-', pos);
if (candidate>0) {
pos2 = Math.min(candidate, pos2);
}
candidate = desc.indexOf('~', pos);
if (candidate>0) {
pos2 = Math.min(candidate, pos2);
}
return pos2;
} | [
"private",
"static",
"int",
"nextSep",
"(",
"String",
"desc",
",",
"int",
"pos",
")",
"{",
"int",
"pos2",
"=",
"desc",
".",
"length",
"(",
")",
";",
"// assume we'll find none\r",
"int",
"candidate",
"=",
"desc",
".",
"indexOf",
"(",
"'",
"'",
",",
"po... | Find the first subsequent occurrance of '+', '-', or '~' in the string
or the end of line if none are there
@param desc string to search
@param pos starting position in string
@return position of next separator, or end of string if none present | [
"Find",
"the",
"first",
"subsequent",
"occurrance",
"of",
"+",
"-",
"or",
"~",
"in",
"the",
"string",
"or",
"the",
"end",
"of",
"line",
"if",
"none",
"are",
"there"
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/info/StorableIndex.java#L135-L152 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java | ParameterBuilder.define | public void define(final ParameterItem<?> key, final Object forcedValue) {
this.overriddenParametersMap.put(key, forcedValue);
set(getParamKey(key), forcedValue);
} | java | public void define(final ParameterItem<?> key, final Object forcedValue) {
this.overriddenParametersMap.put(key, forcedValue);
set(getParamKey(key), forcedValue);
} | [
"public",
"void",
"define",
"(",
"final",
"ParameterItem",
"<",
"?",
">",
"key",
",",
"final",
"Object",
"forcedValue",
")",
"{",
"this",
".",
"overriddenParametersMap",
".",
"put",
"(",
"key",
",",
"forcedValue",
")",
";",
"set",
"(",
"getParamKey",
"(",
... | Override a parameter value.
@param key the parameter item key
@param forcedValue the overridden value | [
"Override",
"a",
"parameter",
"value",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java#L256-L259 |
RestComm/jdiameter | core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/MessageUtility.java | MessageUtility.addOriginAvps | public static void addOriginAvps(Message m, MetaData md) {
// FIXME: check for "userFqnAsUri" ?
AvpSet set = m.getAvps();
if (set.getAvp(Avp.ORIGIN_HOST) == null) {
m.getAvps().addAvp(Avp.ORIGIN_HOST, md.getLocalPeer().getUri().getFQDN(), true, false, true);
}
if (set.getAvp(Avp.ORIGIN_REALM) == null) {
m.getAvps().addAvp(Avp.ORIGIN_REALM, md.getLocalPeer().getRealmName(), true, false, true);
}
} | java | public static void addOriginAvps(Message m, MetaData md) {
// FIXME: check for "userFqnAsUri" ?
AvpSet set = m.getAvps();
if (set.getAvp(Avp.ORIGIN_HOST) == null) {
m.getAvps().addAvp(Avp.ORIGIN_HOST, md.getLocalPeer().getUri().getFQDN(), true, false, true);
}
if (set.getAvp(Avp.ORIGIN_REALM) == null) {
m.getAvps().addAvp(Avp.ORIGIN_REALM, md.getLocalPeer().getRealmName(), true, false, true);
}
} | [
"public",
"static",
"void",
"addOriginAvps",
"(",
"Message",
"m",
",",
"MetaData",
"md",
")",
"{",
"// FIXME: check for \"userFqnAsUri\" ?",
"AvpSet",
"set",
"=",
"m",
".",
"getAvps",
"(",
")",
";",
"if",
"(",
"set",
".",
"getAvp",
"(",
"Avp",
".",
"ORIGIN... | Used to set origin, previously done in MessageParser.
@param m
@param md | [
"Used",
"to",
"set",
"origin",
"previously",
"done",
"in",
"MessageParser",
"."
] | train | https://github.com/RestComm/jdiameter/blob/672134c378ea9704bf06dbe1985872ad4ebf4640/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/MessageUtility.java#L66-L75 |
jcuda/jcusolver | JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java | JCusolverSp.cusolverSpScsrlsvqrHost | public static int cusolverSpScsrlsvqrHost(
cusolverSpHandle handle,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrValA,
Pointer csrRowPtrA,
Pointer csrColIndA,
Pointer b,
float tol,
int reorder,
Pointer x,
int[] singularity)
{
return checkResult(cusolverSpScsrlsvqrHostNative(handle, m, nnz, descrA, csrValA, csrRowPtrA, csrColIndA, b, tol, reorder, x, singularity));
} | java | public static int cusolverSpScsrlsvqrHost(
cusolverSpHandle handle,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrValA,
Pointer csrRowPtrA,
Pointer csrColIndA,
Pointer b,
float tol,
int reorder,
Pointer x,
int[] singularity)
{
return checkResult(cusolverSpScsrlsvqrHostNative(handle, m, nnz, descrA, csrValA, csrRowPtrA, csrColIndA, b, tol, reorder, x, singularity));
} | [
"public",
"static",
"int",
"cusolverSpScsrlsvqrHost",
"(",
"cusolverSpHandle",
"handle",
",",
"int",
"m",
",",
"int",
"nnz",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrValA",
",",
"Pointer",
"csrRowPtrA",
",",
"Pointer",
"csrColIndA",
",",
"Pointer",
... | <pre>
-------- CPU linear solver by QR factorization
solve A*x = b, A can be singular
[ls] stands for linear solve
[v] stands for vector
[qr] stands for QR factorization
</pre> | [
"<pre",
">",
"--------",
"CPU",
"linear",
"solver",
"by",
"QR",
"factorization",
"solve",
"A",
"*",
"x",
"=",
"b",
"A",
"can",
"be",
"singular",
"[",
"ls",
"]",
"stands",
"for",
"linear",
"solve",
"[",
"v",
"]",
"stands",
"for",
"vector",
"[",
"qr",
... | train | https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java#L403-L418 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java | CommercePriceListPersistenceImpl.removeByG_S | @Override
public void removeByG_S(long groupId, int status) {
for (CommercePriceList commercePriceList : findByG_S(groupId, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commercePriceList);
}
} | java | @Override
public void removeByG_S(long groupId, int status) {
for (CommercePriceList commercePriceList : findByG_S(groupId, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commercePriceList);
}
} | [
"@",
"Override",
"public",
"void",
"removeByG_S",
"(",
"long",
"groupId",
",",
"int",
"status",
")",
"{",
"for",
"(",
"CommercePriceList",
"commercePriceList",
":",
"findByG_S",
"(",
"groupId",
",",
"status",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",... | Removes all the commerce price lists where groupId = ? and status = ? from the database.
@param groupId the group ID
@param status the status | [
"Removes",
"all",
"the",
"commerce",
"price",
"lists",
"where",
"groupId",
"=",
"?",
";",
"and",
"status",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L3741-L3747 |
virgo47/javasimon | core/src/main/java/org/javasimon/utils/bean/SimonBeanUtils.java | SimonBeanUtils.setProperty | public void setProperty(Object target, String property, Object value) {
NestedResolver resolver = new NestedResolver(target, property);
if (value instanceof String) {
convertStringValue(resolver.getNestedTarget(), resolver.getProperty(), (String) value);
} else {
setObjectValue(resolver.getNestedTarget(), resolver.getProperty(), value);
}
} | java | public void setProperty(Object target, String property, Object value) {
NestedResolver resolver = new NestedResolver(target, property);
if (value instanceof String) {
convertStringValue(resolver.getNestedTarget(), resolver.getProperty(), (String) value);
} else {
setObjectValue(resolver.getNestedTarget(), resolver.getProperty(), value);
}
} | [
"public",
"void",
"setProperty",
"(",
"Object",
"target",
",",
"String",
"property",
",",
"Object",
"value",
")",
"{",
"NestedResolver",
"resolver",
"=",
"new",
"NestedResolver",
"(",
"target",
",",
"property",
")",
";",
"if",
"(",
"value",
"instanceof",
"St... | Set property in object target. If values has type other than String setter method or field
with specified type will be used to set value. If value has String type value will be converted
using available converters. If conversion to all of the types accepted by setters fails, field
with corresponding name will be used
@param target Java bean where a property will be set
@param property property to be set
@param value value to be set | [
"Set",
"property",
"in",
"object",
"target",
".",
"If",
"values",
"has",
"type",
"other",
"than",
"String",
"setter",
"method",
"or",
"field",
"with",
"specified",
"type",
"will",
"be",
"used",
"to",
"set",
"value",
".",
"If",
"value",
"has",
"String",
"... | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/bean/SimonBeanUtils.java#L69-L77 |
j256/ormlite-jdbc | src/main/java/com/j256/ormlite/jdbc/TypeValMapper.java | TypeValMapper.getSqlTypeForTypeVal | public static SqlType getSqlTypeForTypeVal(int typeVal) {
// iterate through to save on the extra HashMap since only for errors
for (Map.Entry<SqlType, int[]> entry : typeToValMap.entrySet()) {
for (int val : entry.getValue()) {
if (val == typeVal) {
return entry.getKey();
}
}
}
return SqlType.UNKNOWN;
} | java | public static SqlType getSqlTypeForTypeVal(int typeVal) {
// iterate through to save on the extra HashMap since only for errors
for (Map.Entry<SqlType, int[]> entry : typeToValMap.entrySet()) {
for (int val : entry.getValue()) {
if (val == typeVal) {
return entry.getKey();
}
}
}
return SqlType.UNKNOWN;
} | [
"public",
"static",
"SqlType",
"getSqlTypeForTypeVal",
"(",
"int",
"typeVal",
")",
"{",
"// iterate through to save on the extra HashMap since only for errors",
"for",
"(",
"Map",
".",
"Entry",
"<",
"SqlType",
",",
"int",
"[",
"]",
">",
"entry",
":",
"typeToValMap",
... | Returns the SqlType value associated with the typeVal argument. Can be slow-er. | [
"Returns",
"the",
"SqlType",
"value",
"associated",
"with",
"the",
"typeVal",
"argument",
".",
"Can",
"be",
"slow",
"-",
"er",
"."
] | train | https://github.com/j256/ormlite-jdbc/blob/a5ce794ce34bce7000730ebe8e15f3fb3a8a5381/src/main/java/com/j256/ormlite/jdbc/TypeValMapper.java#L103-L113 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.readGroup | public CmsGroup readGroup(CmsRequestContext context, CmsProject project) {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsGroup result = null;
try {
result = m_driverManager.readGroup(dbc, project);
} finally {
dbc.clear();
}
return result;
} | java | public CmsGroup readGroup(CmsRequestContext context, CmsProject project) {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsGroup result = null;
try {
result = m_driverManager.readGroup(dbc, project);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"CmsGroup",
"readGroup",
"(",
"CmsRequestContext",
"context",
",",
"CmsProject",
"project",
")",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"CmsGroup",
"result",
"=",
"null",
";",
"try",
"{",
... | Reads the group of a project.<p>
@param context the current request context
@param project the project to read from
@return the group of a resource | [
"Reads",
"the",
"group",
"of",
"a",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4328-L4338 |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/InstanceManager.java | InstanceManager.preDestroy | protected void preDestroy(Object instance, final Class<?> clazz)
throws IllegalAccessException, InvocationTargetException {
Class<?> superClass = clazz.getSuperclass();
if (superClass != Object.class) {
preDestroy(instance, superClass);
}
// At the end the postconstruct annotated
// method is invoked
List<AnnotationCacheEntry> annotations = null;
synchronized (annotationCache) {
annotations = annotationCache.get(clazz);
}
if (annotations == null) {
// instance not created through the instance manager
return;
}
for (AnnotationCacheEntry entry : annotations) {
if (entry.getType() == AnnotationCacheEntryType.PRE_DESTROY) {
Method preDestroy = getMethod(clazz, entry);
synchronized (preDestroy) {
boolean accessibility = preDestroy.isAccessible();
preDestroy.setAccessible(true);
preDestroy.invoke(instance);
preDestroy.setAccessible(accessibility);
}
}
}
} | java | protected void preDestroy(Object instance, final Class<?> clazz)
throws IllegalAccessException, InvocationTargetException {
Class<?> superClass = clazz.getSuperclass();
if (superClass != Object.class) {
preDestroy(instance, superClass);
}
// At the end the postconstruct annotated
// method is invoked
List<AnnotationCacheEntry> annotations = null;
synchronized (annotationCache) {
annotations = annotationCache.get(clazz);
}
if (annotations == null) {
// instance not created through the instance manager
return;
}
for (AnnotationCacheEntry entry : annotations) {
if (entry.getType() == AnnotationCacheEntryType.PRE_DESTROY) {
Method preDestroy = getMethod(clazz, entry);
synchronized (preDestroy) {
boolean accessibility = preDestroy.isAccessible();
preDestroy.setAccessible(true);
preDestroy.invoke(instance);
preDestroy.setAccessible(accessibility);
}
}
}
} | [
"protected",
"void",
"preDestroy",
"(",
"Object",
"instance",
",",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"Class",
"<",
"?",
">",
"superClass",
"=",
"clazz",
".",
"getSuperclass",... | Call preDestroy method on the specified instance recursively from deepest
superclass to actual class.
@param instance object to call preDestroy methods on
@param clazz (super) class to examine for preDestroy annotation.
@throws IllegalAccessException if preDestroy method is inaccessible.
@throws java.lang.reflect.InvocationTargetException if call fails | [
"Call",
"preDestroy",
"method",
"on",
"the",
"specified",
"instance",
"recursively",
"from",
"deepest",
"superclass",
"to",
"actual",
"class",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/InstanceManager.java#L108-L136 |
SonarSource/sonarqube | server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/def/Validations.java | Validations.checkDbIdentifier | static String checkDbIdentifier(@Nullable String identifier, String identifierDesc, int maxSize) {
String res = checkNotNull(identifier, "%s can't be null", identifierDesc);
checkArgument(!res.isEmpty(), "%s, can't be empty", identifierDesc);
checkArgument(
identifier.length() <= maxSize,
"%s length can't be more than %s", identifierDesc, maxSize);
checkDbIdentifierCharacters(identifier, identifierDesc);
return res;
} | java | static String checkDbIdentifier(@Nullable String identifier, String identifierDesc, int maxSize) {
String res = checkNotNull(identifier, "%s can't be null", identifierDesc);
checkArgument(!res.isEmpty(), "%s, can't be empty", identifierDesc);
checkArgument(
identifier.length() <= maxSize,
"%s length can't be more than %s", identifierDesc, maxSize);
checkDbIdentifierCharacters(identifier, identifierDesc);
return res;
} | [
"static",
"String",
"checkDbIdentifier",
"(",
"@",
"Nullable",
"String",
"identifier",
",",
"String",
"identifierDesc",
",",
"int",
"maxSize",
")",
"{",
"String",
"res",
"=",
"checkNotNull",
"(",
"identifier",
",",
"\"%s can't be null\"",
",",
"identifierDesc",
")... | Ensure {@code identifier} is a valid DB identifier.
@throws NullPointerException if {@code identifier} is {@code null}
@throws IllegalArgumentException if {@code identifier} is empty
@throws IllegalArgumentException if {@code identifier} is longer than {@code maxSize}
@throws IllegalArgumentException if {@code identifier} is not lowercase
@throws IllegalArgumentException if {@code identifier} contains characters others than ASCII letters, ASCII numbers or {@code _}
@throws IllegalArgumentException if {@code identifier} starts with {@code _} or a number | [
"Ensure",
"{",
"@code",
"identifier",
"}",
"is",
"a",
"valid",
"DB",
"identifier",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/def/Validations.java#L107-L115 |
febit/wit | wit-core/src/main/java/org/febit/wit/InternalContext.java | InternalContext.createPeerContext | public InternalContext createPeerContext(Template template, VariantIndexer[] indexers, int varSize, Vars rootParams) {
InternalContext newContext = new InternalContext(template, this.out, rootParams,
indexers, varSize, null);
newContext.localContext = this;
return newContext;
} | java | public InternalContext createPeerContext(Template template, VariantIndexer[] indexers, int varSize, Vars rootParams) {
InternalContext newContext = new InternalContext(template, this.out, rootParams,
indexers, varSize, null);
newContext.localContext = this;
return newContext;
} | [
"public",
"InternalContext",
"createPeerContext",
"(",
"Template",
"template",
",",
"VariantIndexer",
"[",
"]",
"indexers",
",",
"int",
"varSize",
",",
"Vars",
"rootParams",
")",
"{",
"InternalContext",
"newContext",
"=",
"new",
"InternalContext",
"(",
"template",
... | Create a peer-context used by include/import.
<p>
Only share locals and out
@param template template
@param indexers indexers
@param varSize var size
@param rootParams root params
@return a new peer context | [
"Create",
"a",
"peer",
"-",
"context",
"used",
"by",
"include",
"/",
"import",
".",
"<p",
">",
"Only",
"share",
"locals",
"and",
"out"
] | train | https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit/InternalContext.java#L158-L163 |
3redronin/mu-server | src/main/java/io/muserver/rest/RestHandlerBuilder.java | RestHandlerBuilder.addCustomParamConverter | public <P> RestHandlerBuilder addCustomParamConverter(Class<P> paramClass, ParamConverter<P> converter) {
return addCustomParamConverterProvider(new ParamConverterProvider() {
@Override
public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) {
if (!rawType.equals(paramClass)) {
return null;
}
return (ParamConverter<T>) converter;
}
});
} | java | public <P> RestHandlerBuilder addCustomParamConverter(Class<P> paramClass, ParamConverter<P> converter) {
return addCustomParamConverterProvider(new ParamConverterProvider() {
@Override
public <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation[] annotations) {
if (!rawType.equals(paramClass)) {
return null;
}
return (ParamConverter<T>) converter;
}
});
} | [
"public",
"<",
"P",
">",
"RestHandlerBuilder",
"addCustomParamConverter",
"(",
"Class",
"<",
"P",
">",
"paramClass",
",",
"ParamConverter",
"<",
"P",
">",
"converter",
")",
"{",
"return",
"addCustomParamConverterProvider",
"(",
"new",
"ParamConverterProvider",
"(",
... | <p>Registers a parameter converter class that convert strings to and from a custom class.</p>
<p>This allows you to specify query string parameters, form values, header params and path params as custom classes.</p>
<p>For more functionality, {@link #addCustomParamConverterProvider(ParamConverterProvider)} is also available.</p>
@param paramClass The class that this converter is meant for.
@param converter The converter
@param <P> The type of the parameter
@return This builder | [
"<p",
">",
"Registers",
"a",
"parameter",
"converter",
"class",
"that",
"convert",
"strings",
"to",
"and",
"from",
"a",
"custom",
"class",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"allows",
"you",
"to",
"specify",
"query",
"string",
"parameters",
"for... | train | https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/rest/RestHandlerBuilder.java#L109-L119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.