repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
landawn/AbacusUtil | src/com/landawn/abacus/util/AnyDelete.java | AnyDelete.addColumns | public AnyDelete addColumns(String family, String qualifier) {
delete.addColumns(toFamilyQualifierBytes(family), toFamilyQualifierBytes(qualifier));
return this;
} | java | public AnyDelete addColumns(String family, String qualifier) {
delete.addColumns(toFamilyQualifierBytes(family), toFamilyQualifierBytes(qualifier));
return this;
} | [
"public",
"AnyDelete",
"addColumns",
"(",
"String",
"family",
",",
"String",
"qualifier",
")",
"{",
"delete",
".",
"addColumns",
"(",
"toFamilyQualifierBytes",
"(",
"family",
")",
",",
"toFamilyQualifierBytes",
"(",
"qualifier",
")",
")",
";",
"return",
"this",
... | Delete all versions of the specified column.
@param family
@param qualifier
@return | [
"Delete",
"all",
"versions",
"of",
"the",
"specified",
"column",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/AnyDelete.java#L167-L171 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newMappingException | public static MappingException newMappingException(String message, Object... args) {
return newMappingException(null, message, args);
} | java | public static MappingException newMappingException(String message, Object... args) {
return newMappingException(null, message, args);
} | [
"public",
"static",
"MappingException",
"newMappingException",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"newMappingException",
"(",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Constructs and initializes a new {@link MappingException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link MappingException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link MappingException} with the given {@link String message}.
@see #newMappingException(Throwable, String, Object...)
@see org.cp.elements.data.mapping.MappingException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"MappingException",
"}",
"with",
"the",
"given",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L183-L185 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.deleteCouponRedemption | public void deleteCouponRedemption(final String accountCode, final String redemptionUuid) {
doDELETE(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Redemption.REDEMPTIONS_RESOURCE + "/" + redemptionUuid);
} | java | public void deleteCouponRedemption(final String accountCode, final String redemptionUuid) {
doDELETE(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Redemption.REDEMPTIONS_RESOURCE + "/" + redemptionUuid);
} | [
"public",
"void",
"deleteCouponRedemption",
"(",
"final",
"String",
"accountCode",
",",
"final",
"String",
"redemptionUuid",
")",
"{",
"doDELETE",
"(",
"Accounts",
".",
"ACCOUNTS_RESOURCE",
"+",
"\"/\"",
"+",
"accountCode",
"+",
"Redemption",
".",
"REDEMPTIONS_RESOU... | Deletes a specific redemption.
@param accountCode recurly account id
@param redemptionUuid recurly coupon redemption uuid | [
"Deletes",
"a",
"specific",
"redemption",
"."
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1721-L1723 |
pvanassen/ns-api | src/main/java/nl/pvanassen/ns/HttpConnection.java | HttpConnection.getContent | InputStream getContent(String url) throws IOException, NsApiException {
Request request = new Request.Builder().url(url).get().build();
try {
Response response = client.newCall(request).execute();
if (response.body() == null) {
log.error("Error while calling the webservice, entity is null");
throw new NsApiException("Error while calling the webservice, entity is null");
}
return response.body().byteStream();
}
catch (RuntimeException e) {
log.error("Error while calling the webservice, entity is null");
throw new NsApiException("Error while calling the webservice, entity is null", e);
}
} | java | InputStream getContent(String url) throws IOException, NsApiException {
Request request = new Request.Builder().url(url).get().build();
try {
Response response = client.newCall(request).execute();
if (response.body() == null) {
log.error("Error while calling the webservice, entity is null");
throw new NsApiException("Error while calling the webservice, entity is null");
}
return response.body().byteStream();
}
catch (RuntimeException e) {
log.error("Error while calling the webservice, entity is null");
throw new NsApiException("Error while calling the webservice, entity is null", e);
}
} | [
"InputStream",
"getContent",
"(",
"String",
"url",
")",
"throws",
"IOException",
",",
"NsApiException",
"{",
"Request",
"request",
"=",
"new",
"Request",
".",
"Builder",
"(",
")",
".",
"url",
"(",
"url",
")",
".",
"get",
"(",
")",
".",
"build",
"(",
")... | Handling the webservice call
@param url URL to call
@return Input stream as a result, or an exception
@throws IOException In case of an IO error
@throws NsApiException In case of any other error | [
"Handling",
"the",
"webservice",
"call"
] | train | https://github.com/pvanassen/ns-api/blob/e90e01028a0eb24006e4fddd4c85e7a25c4fe0ae/src/main/java/nl/pvanassen/ns/HttpConnection.java#L49-L63 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/ImportHelpers.java | ImportHelpers.updateImports | public static void updateImports( Instance instance, Map<String,Collection<Import>> variablePrefixToImports ) {
instance.getImports().clear();
if( variablePrefixToImports != null )
instance.getImports().putAll( variablePrefixToImports );
} | java | public static void updateImports( Instance instance, Map<String,Collection<Import>> variablePrefixToImports ) {
instance.getImports().clear();
if( variablePrefixToImports != null )
instance.getImports().putAll( variablePrefixToImports );
} | [
"public",
"static",
"void",
"updateImports",
"(",
"Instance",
"instance",
",",
"Map",
"<",
"String",
",",
"Collection",
"<",
"Import",
">",
">",
"variablePrefixToImports",
")",
"{",
"instance",
".",
"getImports",
"(",
")",
".",
"clear",
"(",
")",
";",
"if"... | Updates the imports of an instance with new values.
@param instance the instance whose imports must be updated
@param variablePrefixToImports the new imports (can be null) | [
"Updates",
"the",
"imports",
"of",
"an",
"instance",
"with",
"new",
"values",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/ImportHelpers.java#L162-L166 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/internal/statistics/StatsUtils.java | StatsUtils.findTiers | public static String[] findTiers(Cache<?, ?> cache) {
// Here I'm randomly taking the eviction observer because it exists on all tiers
@SuppressWarnings("unchecked")
Query statQuery = queryBuilder()
.descendants()
.filter(context(attributes(Matchers.allOf(hasAttribute("name", "eviction"), hasAttribute("type", StoreOperationOutcomes.EvictionOutcome.class)))))
.build();
Set<TreeNode> statResult = statQuery.execute(Collections.singleton(ContextManager.nodeFor(cache)));
if (statResult.isEmpty()) {
throw new RuntimeException("Failed to find tiers using the eviction observer, valid result Set sizes must 1 or more");
}
String[] tiers = new String[statResult.size()];
int i = 0;
for (TreeNode treeNode : statResult) {
Set<?> tags = (Set<?>) treeNode.getContext().attributes().get("tags");
if (tags.size() != 1) {
throw new RuntimeException("We expect tiers to have only one tag");
}
String storeType = tags.iterator().next().toString();
tiers[i++] = storeType;
}
return tiers;
} | java | public static String[] findTiers(Cache<?, ?> cache) {
// Here I'm randomly taking the eviction observer because it exists on all tiers
@SuppressWarnings("unchecked")
Query statQuery = queryBuilder()
.descendants()
.filter(context(attributes(Matchers.allOf(hasAttribute("name", "eviction"), hasAttribute("type", StoreOperationOutcomes.EvictionOutcome.class)))))
.build();
Set<TreeNode> statResult = statQuery.execute(Collections.singleton(ContextManager.nodeFor(cache)));
if (statResult.isEmpty()) {
throw new RuntimeException("Failed to find tiers using the eviction observer, valid result Set sizes must 1 or more");
}
String[] tiers = new String[statResult.size()];
int i = 0;
for (TreeNode treeNode : statResult) {
Set<?> tags = (Set<?>) treeNode.getContext().attributes().get("tags");
if (tags.size() != 1) {
throw new RuntimeException("We expect tiers to have only one tag");
}
String storeType = tags.iterator().next().toString();
tiers[i++] = storeType;
}
return tiers;
} | [
"public",
"static",
"String",
"[",
"]",
"findTiers",
"(",
"Cache",
"<",
"?",
",",
"?",
">",
"cache",
")",
"{",
"// Here I'm randomly taking the eviction observer because it exists on all tiers",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Query",
"statQuery",
... | Find the list of tiers of a cache. We assume a lot of things here.
<ul>
<li>The "eviction" statistic is available on the tier</li>
<li>That the tiers have only one tag attribute</li>
<li>That this tag contains the tier name</li>
<li>That the only descendants having an "eviction" statistic are the tiers</li>
</ul>
@param cache the context for looking for tiers
@return an array of tier names
@throws RuntimeException if not tiers are found or if tiers have multiple tags | [
"Find",
"the",
"list",
"of",
"tiers",
"of",
"a",
"cache",
".",
"We",
"assume",
"a",
"lot",
"of",
"things",
"here",
".",
"<ul",
">",
"<li",
">",
"The",
"eviction",
"statistic",
"is",
"available",
"on",
"the",
"tier<",
"/",
"li",
">",
"<li",
">",
"Th... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/statistics/StatsUtils.java#L174-L201 |
rey5137/material | material/src/main/java/com/rey/material/widget/EditText.java | EditText.setShadowLayer | public void setShadowLayer (float radius, float dx, float dy, int color){
mInputView.setShadowLayer(radius, dx, dy, color);
} | java | public void setShadowLayer (float radius, float dx, float dy, int color){
mInputView.setShadowLayer(radius, dx, dy, color);
} | [
"public",
"void",
"setShadowLayer",
"(",
"float",
"radius",
",",
"float",
"dx",
",",
"float",
"dy",
",",
"int",
"color",
")",
"{",
"mInputView",
".",
"setShadowLayer",
"(",
"radius",
",",
"dx",
",",
"dy",
",",
"color",
")",
";",
"}"
] | Gives the text a shadow of the specified blur radius and color, the specified
distance from its drawn position.
<p>
The text shadow produced does not interact with the properties on view
that are responsible for real time shadows,
{@link View#getElevation() elevation} and
{@link View#getTranslationZ() translationZ}.
@see android.graphics.Paint#setShadowLayer(float, float, float, int)
@attr ref android.R.styleable#TextView_shadowColor
@attr ref android.R.styleable#TextView_shadowDx
@attr ref android.R.styleable#TextView_shadowDy
@attr ref android.R.styleable#TextView_shadowRadius | [
"Gives",
"the",
"text",
"a",
"shadow",
"of",
"the",
"specified",
"blur",
"radius",
"and",
"color",
"the",
"specified",
"distance",
"from",
"its",
"drawn",
"position",
".",
"<p",
">",
"The",
"text",
"shadow",
"produced",
"does",
"not",
"interact",
"with",
"... | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/EditText.java#L3393-L3395 |
twitter/cloudhopper-commons | ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java | SslContextFactory.loadKeyStore | protected KeyStore loadKeyStore() throws Exception {
return getKeyStore(keyStoreInputStream, sslConfig.getKeyStorePath(),
sslConfig.getKeyStoreType(), sslConfig.getKeyStoreProvider(),
sslConfig.getKeyStorePassword());
} | java | protected KeyStore loadKeyStore() throws Exception {
return getKeyStore(keyStoreInputStream, sslConfig.getKeyStorePath(),
sslConfig.getKeyStoreType(), sslConfig.getKeyStoreProvider(),
sslConfig.getKeyStorePassword());
} | [
"protected",
"KeyStore",
"loadKeyStore",
"(",
")",
"throws",
"Exception",
"{",
"return",
"getKeyStore",
"(",
"keyStoreInputStream",
",",
"sslConfig",
".",
"getKeyStorePath",
"(",
")",
",",
"sslConfig",
".",
"getKeyStoreType",
"(",
")",
",",
"sslConfig",
".",
"ge... | Override this method to provide alternate way to load a keystore.
@return the key store instance
@throws Exception | [
"Override",
"this",
"method",
"to",
"provide",
"alternate",
"way",
"to",
"load",
"a",
"keystore",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-ssl/src/main/java/com/cloudhopper/commons/ssl/SslContextFactory.java#L183-L187 |
jhy/jsoup | src/main/java/org/jsoup/select/Selector.java | Selector.filterOut | static Elements filterOut(Collection<Element> elements, Collection<Element> outs) {
Elements output = new Elements();
for (Element el : elements) {
boolean found = false;
for (Element out : outs) {
if (el.equals(out)) {
found = true;
break;
}
}
if (!found)
output.add(el);
}
return output;
} | java | static Elements filterOut(Collection<Element> elements, Collection<Element> outs) {
Elements output = new Elements();
for (Element el : elements) {
boolean found = false;
for (Element out : outs) {
if (el.equals(out)) {
found = true;
break;
}
}
if (!found)
output.add(el);
}
return output;
} | [
"static",
"Elements",
"filterOut",
"(",
"Collection",
"<",
"Element",
">",
"elements",
",",
"Collection",
"<",
"Element",
">",
"outs",
")",
"{",
"Elements",
"output",
"=",
"new",
"Elements",
"(",
")",
";",
"for",
"(",
"Element",
"el",
":",
"elements",
")... | exclude set. package open so that Elements can implement .not() selector. | [
"exclude",
"set",
".",
"package",
"open",
"so",
"that",
"Elements",
"can",
"implement",
".",
"not",
"()",
"selector",
"."
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/select/Selector.java#L135-L149 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/crdt/ReplicatedVectorClocks.java | ReplicatedVectorClocks.getReplicatedVectorClock | public Map<String, VectorClock> getReplicatedVectorClock(String serviceName, String memberUUID) {
final ReplicatedVectorClockId id = new ReplicatedVectorClockId(serviceName, memberUUID);
final Map<String, VectorClock> clocks = replicatedVectorClocks.get(id);
return clocks != null ? clocks : Collections.<String, VectorClock>emptyMap();
} | java | public Map<String, VectorClock> getReplicatedVectorClock(String serviceName, String memberUUID) {
final ReplicatedVectorClockId id = new ReplicatedVectorClockId(serviceName, memberUUID);
final Map<String, VectorClock> clocks = replicatedVectorClocks.get(id);
return clocks != null ? clocks : Collections.<String, VectorClock>emptyMap();
} | [
"public",
"Map",
"<",
"String",
",",
"VectorClock",
">",
"getReplicatedVectorClock",
"(",
"String",
"serviceName",
",",
"String",
"memberUUID",
")",
"{",
"final",
"ReplicatedVectorClockId",
"id",
"=",
"new",
"ReplicatedVectorClockId",
"(",
"serviceName",
",",
"membe... | Returns the vector clocks for the given {@code serviceName} and
{@code memberUUID}.
The vector clock map contains mappings from CRDT name to the last
successfully replicated CRDT vector clock. All CRDTs in this map should
be of the same type.
If there are no vector clocks for the given parameters, this method
returns an empty map.
@param serviceName the service name
@param memberUUID the target member UUID
@return the last successfully replicated CRDT vector clocks or an empty
map if the CRDTs have not yet been replicated to this member
@see CRDTReplicationAwareService | [
"Returns",
"the",
"vector",
"clocks",
"for",
"the",
"given",
"{",
"@code",
"serviceName",
"}",
"and",
"{",
"@code",
"memberUUID",
"}",
".",
"The",
"vector",
"clock",
"map",
"contains",
"mappings",
"from",
"CRDT",
"name",
"to",
"the",
"last",
"successfully",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/crdt/ReplicatedVectorClocks.java#L63-L67 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/cglib3_2_0/core/EmitUtils.java | EmitUtils.not_equals | public static void not_equals(final CodeEmitter e, Type type, final Label notEquals, final Customizer customizer) {
(new ProcessArrayCallback() {
public void processElement(Type type) {
not_equals_helper(e, type, notEquals, customizer, this);
}
}).processElement(type);
} | java | public static void not_equals(final CodeEmitter e, Type type, final Label notEquals, final Customizer customizer) {
(new ProcessArrayCallback() {
public void processElement(Type type) {
not_equals_helper(e, type, notEquals, customizer, this);
}
}).processElement(type);
} | [
"public",
"static",
"void",
"not_equals",
"(",
"final",
"CodeEmitter",
"e",
",",
"Type",
"type",
",",
"final",
"Label",
"notEquals",
",",
"final",
"Customizer",
"customizer",
")",
"{",
"(",
"new",
"ProcessArrayCallback",
"(",
")",
"{",
"public",
"void",
"pro... | Branches to the specified label if the top two items on the stack
are not equal. The items must both be of the specified
class. Equality is determined by comparing primitive values
directly and by invoking the <code>equals</code> method for
Objects. Arrays are recursively processed in the same manner. | [
"Branches",
"to",
"the",
"specified",
"label",
"if",
"the",
"top",
"two",
"items",
"on",
"the",
"stack",
"are",
"not",
"equal",
".",
"The",
"items",
"must",
"both",
"be",
"of",
"the",
"specified",
"class",
".",
"Equality",
"is",
"determined",
"by",
"comp... | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/cglib3_2_0/core/EmitUtils.java#L480-L486 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/domainquery/internal/QueryRecorder.java | QueryRecorder.recordStackedInvocation | public static void recordStackedInvocation(Object on, String method, Object result, Object... params) {
if (blockRecording.get())
return;
recordInvocation(false, true, false, on, method, result, params);
} | java | public static void recordStackedInvocation(Object on, String method, Object result, Object... params) {
if (blockRecording.get())
return;
recordInvocation(false, true, false, on, method, result, params);
} | [
"public",
"static",
"void",
"recordStackedInvocation",
"(",
"Object",
"on",
",",
"String",
"method",
",",
"Object",
"result",
",",
"Object",
"...",
"params",
")",
"{",
"if",
"(",
"blockRecording",
".",
"get",
"(",
")",
")",
"return",
";",
"recordInvocation",... | invocations on domainQuery (q)
but stacked within e.g. a SELECT_FROM(...).ELEMENTS(...) statement.
Must not be directly added to the root RecordedQuery
but must be encapsulated in a sub statement
@param on
@param method
@param result
@param params | [
"invocations",
"on",
"domainQuery",
"(",
"q",
")",
"but",
"stacked",
"within",
"e",
".",
"g",
".",
"a",
"SELECT_FROM",
"(",
"...",
")",
".",
"ELEMENTS",
"(",
"...",
")",
"statement",
".",
"Must",
"not",
"be",
"directly",
"added",
"to",
"the",
"root",
... | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/domainquery/internal/QueryRecorder.java#L65-L69 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java | SeaGlassInternalShadowEffect.getTopShadowGradient | public Paint getTopShadowGradient(Shape s) {
Rectangle2D bounds = s.getBounds2D();
float minY = (float) bounds.getMinY();
float maxY = (float) bounds.getMaxY();
float midX = (float) bounds.getCenterX();
return new LinearGradientPaint(midX, minY, midX, maxY, (new float[] { 0f, 1f }), new Color[] { innerShadow.top, transparentColor });
} | java | public Paint getTopShadowGradient(Shape s) {
Rectangle2D bounds = s.getBounds2D();
float minY = (float) bounds.getMinY();
float maxY = (float) bounds.getMaxY();
float midX = (float) bounds.getCenterX();
return new LinearGradientPaint(midX, minY, midX, maxY, (new float[] { 0f, 1f }), new Color[] { innerShadow.top, transparentColor });
} | [
"public",
"Paint",
"getTopShadowGradient",
"(",
"Shape",
"s",
")",
"{",
"Rectangle2D",
"bounds",
"=",
"s",
".",
"getBounds2D",
"(",
")",
";",
"float",
"minY",
"=",
"(",
"float",
")",
"bounds",
".",
"getMinY",
"(",
")",
";",
"float",
"maxY",
"=",
"(",
... | Create the gradient for the top of a rectangular shadow.
@param s the shape of the gradient. This is only used for its bounds.
@return the gradient. | [
"Create",
"the",
"gradient",
"for",
"the",
"top",
"of",
"a",
"rectangular",
"shadow",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/effect/SeaGlassInternalShadowEffect.java#L140-L147 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java | PhotosInterface.setPerms | public void setPerms(String photoId, Permissions permissions) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_PERMS);
parameters.put("photo_id", photoId);
parameters.put("is_public", permissions.isPublicFlag() ? "1" : "0");
parameters.put("is_friend", permissions.isFriendFlag() ? "1" : "0");
parameters.put("is_family", permissions.isFamilyFlag() ? "1" : "0");
parameters.put("perm_comment", Integer.toString(permissions.getComment()));
parameters.put("perm_addmeta", Integer.toString(permissions.getAddmeta()));
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void setPerms(String photoId, Permissions permissions) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_PERMS);
parameters.put("photo_id", photoId);
parameters.put("is_public", permissions.isPublicFlag() ? "1" : "0");
parameters.put("is_friend", permissions.isFriendFlag() ? "1" : "0");
parameters.put("is_family", permissions.isFamilyFlag() ? "1" : "0");
parameters.put("perm_comment", Integer.toString(permissions.getComment()));
parameters.put("perm_addmeta", Integer.toString(permissions.getAddmeta()));
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"setPerms",
"(",
"String",
"photoId",
",",
"Permissions",
"permissions",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";... | Set the permissions for the photo.
This method requires authentication with 'write' permission.
@param photoId
The photo ID
@param permissions
The permissions object
@throws FlickrException | [
"Set",
"the",
"permissions",
"for",
"the",
"photo",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/PhotosInterface.java#L1226-L1241 |
esigate/esigate | esigate-core/src/main/java/org/esigate/DriverFactory.java | DriverFactory.stripMappingPath | static String stripMappingPath(String url, UriMapping mapping) {
String relativeUrl = url;
// Uri mapping
String mappingPath;
if (mapping == null) {
mappingPath = null;
} else {
mappingPath = mapping.getPath();
}
// Remove mapping path
if (mappingPath != null && url.startsWith(mappingPath)) {
relativeUrl = relativeUrl.substring(mappingPath.length());
}
return relativeUrl;
} | java | static String stripMappingPath(String url, UriMapping mapping) {
String relativeUrl = url;
// Uri mapping
String mappingPath;
if (mapping == null) {
mappingPath = null;
} else {
mappingPath = mapping.getPath();
}
// Remove mapping path
if (mappingPath != null && url.startsWith(mappingPath)) {
relativeUrl = relativeUrl.substring(mappingPath.length());
}
return relativeUrl;
} | [
"static",
"String",
"stripMappingPath",
"(",
"String",
"url",
",",
"UriMapping",
"mapping",
")",
"{",
"String",
"relativeUrl",
"=",
"url",
";",
"// Uri mapping",
"String",
"mappingPath",
";",
"if",
"(",
"mapping",
"==",
"null",
")",
"{",
"mappingPath",
"=",
... | Get the relative url without the mapping url.
<p/>
Uses the url and remove the mapping path.
@param url
incoming relative url
@return the url, relative to the driver remote url. | [
"Get",
"the",
"relative",
"url",
"without",
"the",
"mapping",
"url",
".",
"<p",
"/",
">",
"Uses",
"the",
"url",
"and",
"remove",
"the",
"mapping",
"path",
"."
] | train | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/DriverFactory.java#L370-L385 |
dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/util/Slice.java | Slice.getBytes | public int getBytes(int index, GatheringByteChannel out, int length)
throws IOException
{
checkPositionIndexes(index, index + length, this.length);
index += offset;
return out.write(ByteBuffer.wrap(data, index, length));
} | java | public int getBytes(int index, GatheringByteChannel out, int length)
throws IOException
{
checkPositionIndexes(index, index + length, this.length);
index += offset;
return out.write(ByteBuffer.wrap(data, index, length));
} | [
"public",
"int",
"getBytes",
"(",
"int",
"index",
",",
"GatheringByteChannel",
"out",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"checkPositionIndexes",
"(",
"index",
",",
"index",
"+",
"length",
",",
"this",
".",
"length",
")",
";",
"index",
... | Transfers this buffer's data to the specified channel starting at the
specified absolute {@code index}.
@param length the maximum number of bytes to transfer
@return the actual number of bytes written out to the specified channel
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or
if {@code index + length} is greater than
{@code this.capacity}
@throws java.io.IOException if the specified channel threw an exception during I/O | [
"Transfers",
"this",
"buffer",
"s",
"data",
"to",
"the",
"specified",
"channel",
"starting",
"at",
"the",
"specified",
"absolute",
"{",
"@code",
"index",
"}",
"."
] | train | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L278-L284 |
alkacon/opencms-core | src/org/opencms/i18n/CmsEncoder.java | CmsEncoder.decodeHtmlEntities | public static String decodeHtmlEntities(String input, String encoding) {
Matcher matcher = ENTITIY_PATTERN.matcher(input);
StringBuffer result = new StringBuffer(input.length());
Charset charset = Charset.forName(encoding);
CharsetEncoder encoder = charset.newEncoder();
while (matcher.find()) {
String entity = matcher.group();
String value = entity.substring(2, entity.length() - 1);
int c = Integer.valueOf(value).intValue();
if (c < 128) {
// first 128 chars are contained in almost every charset
entity = new String(new char[] {(char)c});
// this is intended as performance improvement since
// the canEncode() operation appears quite CPU heavy
} else if (encoder.canEncode((char)c)) {
// encoder can encode this char
entity = new String(new char[] {(char)c});
}
matcher.appendReplacement(result, entity);
}
matcher.appendTail(result);
return result.toString();
} | java | public static String decodeHtmlEntities(String input, String encoding) {
Matcher matcher = ENTITIY_PATTERN.matcher(input);
StringBuffer result = new StringBuffer(input.length());
Charset charset = Charset.forName(encoding);
CharsetEncoder encoder = charset.newEncoder();
while (matcher.find()) {
String entity = matcher.group();
String value = entity.substring(2, entity.length() - 1);
int c = Integer.valueOf(value).intValue();
if (c < 128) {
// first 128 chars are contained in almost every charset
entity = new String(new char[] {(char)c});
// this is intended as performance improvement since
// the canEncode() operation appears quite CPU heavy
} else if (encoder.canEncode((char)c)) {
// encoder can encode this char
entity = new String(new char[] {(char)c});
}
matcher.appendReplacement(result, entity);
}
matcher.appendTail(result);
return result.toString();
} | [
"public",
"static",
"String",
"decodeHtmlEntities",
"(",
"String",
"input",
",",
"String",
"encoding",
")",
"{",
"Matcher",
"matcher",
"=",
"ENTITIY_PATTERN",
".",
"matcher",
"(",
"input",
")",
";",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"i... | Decodes HTML entity references like <code>&#8364;</code> that are contained in the
String to a regular character, but only if that character is contained in the given
encodings charset.<p>
@param input the input to decode the HTML entities in
@param encoding the charset to decode the input for
@return the input with the decoded HTML entities
@see #encodeHtmlEntities(String, String) | [
"Decodes",
"HTML",
"entity",
"references",
"like",
"<code",
">",
"&",
";",
"#8364",
";",
"<",
"/",
"code",
">",
"that",
"are",
"contained",
"in",
"the",
"String",
"to",
"a",
"regular",
"character",
"but",
"only",
"if",
"that",
"character",
"is",
"cont... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L300-L324 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.addEntityAsync | public Observable<UUID> addEntityAsync(UUID appId, String versionId, AddEntityOptionalParameter addEntityOptionalParameter) {
return addEntityWithServiceResponseAsync(appId, versionId, addEntityOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
} | java | public Observable<UUID> addEntityAsync(UUID appId, String versionId, AddEntityOptionalParameter addEntityOptionalParameter) {
return addEntityWithServiceResponseAsync(appId, versionId, addEntityOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"UUID",
">",
"addEntityAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"AddEntityOptionalParameter",
"addEntityOptionalParameter",
")",
"{",
"return",
"addEntityWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
... | Adds an entity extractor to the application.
@param appId The application ID.
@param versionId The version ID.
@param addEntityOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object | [
"Adds",
"an",
"entity",
"extractor",
"to",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L959-L966 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/problems/GenericProblem.java | GenericProblem.setRandomSolutionGenerator | public void setRandomSolutionGenerator(RandomSolutionGenerator<? extends SolutionType, ? super DataType> randomSolutionGenerator){
// check not null
if(randomSolutionGenerator == null){
throw new NullPointerException("Error while setting random solution generator: null is not allowed");
}
this.randomSolutionGenerator = randomSolutionGenerator;
} | java | public void setRandomSolutionGenerator(RandomSolutionGenerator<? extends SolutionType, ? super DataType> randomSolutionGenerator){
// check not null
if(randomSolutionGenerator == null){
throw new NullPointerException("Error while setting random solution generator: null is not allowed");
}
this.randomSolutionGenerator = randomSolutionGenerator;
} | [
"public",
"void",
"setRandomSolutionGenerator",
"(",
"RandomSolutionGenerator",
"<",
"?",
"extends",
"SolutionType",
",",
"?",
"super",
"DataType",
">",
"randomSolutionGenerator",
")",
"{",
"// check not null",
"if",
"(",
"randomSolutionGenerator",
"==",
"null",
")",
... | Set random solution generator. It is allowed for the generator to produce subtypes of the
problem's solution type, requiring any supertype of the problem's data type. The generator
can not be <code>null</code>.
@param randomSolutionGenerator random solution generator
@throws NullPointerException if <code>randomSolutionGenerator</code> is <code>null</code> | [
"Set",
"random",
"solution",
"generator",
".",
"It",
"is",
"allowed",
"for",
"the",
"generator",
"to",
"produce",
"subtypes",
"of",
"the",
"problem",
"s",
"solution",
"type",
"requiring",
"any",
"supertype",
"of",
"the",
"problem",
"s",
"data",
"type",
".",
... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/problems/GenericProblem.java#L171-L177 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/BaseFont.java | BaseFont.setCharAdvance | public boolean setCharAdvance(int c, int advance) {
byte b[] = convertToBytes(c);
if (b.length == 0)
return false;
widths[0xff & b[0]] = advance;
return true;
} | java | public boolean setCharAdvance(int c, int advance) {
byte b[] = convertToBytes(c);
if (b.length == 0)
return false;
widths[0xff & b[0]] = advance;
return true;
} | [
"public",
"boolean",
"setCharAdvance",
"(",
"int",
"c",
",",
"int",
"advance",
")",
"{",
"byte",
"b",
"[",
"]",
"=",
"convertToBytes",
"(",
"c",
")",
";",
"if",
"(",
"b",
".",
"length",
"==",
"0",
")",
"return",
"false",
";",
"widths",
"[",
"0xff",... | Sets the character advance.
@param c the character
@param advance the character advance normalized to 1000 units
@return <CODE>true</CODE> if the advance was set,
<CODE>false</CODE> otherwise | [
"Sets",
"the",
"character",
"advance",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BaseFont.java#L1416-L1422 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/Integration.java | Integration.withRequestTemplates | public Integration withRequestTemplates(java.util.Map<String, String> requestTemplates) {
setRequestTemplates(requestTemplates);
return this;
} | java | public Integration withRequestTemplates(java.util.Map<String, String> requestTemplates) {
setRequestTemplates(requestTemplates);
return this;
} | [
"public",
"Integration",
"withRequestTemplates",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"requestTemplates",
")",
"{",
"setRequestTemplates",
"(",
"requestTemplates",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Represents a map of Velocity templates that are applied on the request payload based on the value of the
Content-Type header sent by the client. The content type value is the key in this map, and the template (as a
String) is the value.
</p>
@param requestTemplates
Represents a map of Velocity templates that are applied on the request payload based on the value of the
Content-Type header sent by the client. The content type value is the key in this map, and the template
(as a String) is the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Represents",
"a",
"map",
"of",
"Velocity",
"templates",
"that",
"are",
"applied",
"on",
"the",
"request",
"payload",
"based",
"on",
"the",
"value",
"of",
"the",
"Content",
"-",
"Type",
"header",
"sent",
"by",
"the",
"client",
".",
"The",
"con... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/Integration.java#L1226-L1229 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java | AvroUtils.slowDeserializeGenericRecord | public static GenericRecord slowDeserializeGenericRecord(byte[] serializedRecord, Schema schema) throws IOException {
Decoder decoder = DecoderFactory.get().binaryDecoder(serializedRecord, null);
GenericDatumReader<GenericRecord> reader = new GenericDatumReader<>(schema);
return reader.read(null, decoder);
} | java | public static GenericRecord slowDeserializeGenericRecord(byte[] serializedRecord, Schema schema) throws IOException {
Decoder decoder = DecoderFactory.get().binaryDecoder(serializedRecord, null);
GenericDatumReader<GenericRecord> reader = new GenericDatumReader<>(schema);
return reader.read(null, decoder);
} | [
"public",
"static",
"GenericRecord",
"slowDeserializeGenericRecord",
"(",
"byte",
"[",
"]",
"serializedRecord",
",",
"Schema",
"schema",
")",
"throws",
"IOException",
"{",
"Decoder",
"decoder",
"=",
"DecoderFactory",
".",
"get",
"(",
")",
".",
"binaryDecoder",
"("... | Deserialize a {@link GenericRecord} from a byte array. This method is not intended for high performance. | [
"Deserialize",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java#L840-L844 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java | SqlExecutor.executeForGeneratedKey | public static Long executeForGeneratedKey(Connection conn, String sql, Map<String, Object> paramMap) throws SQLException {
final NamedSql namedSql = new NamedSql(sql, paramMap);
return executeForGeneratedKey(conn, namedSql.getSql(), namedSql.getParams());
} | java | public static Long executeForGeneratedKey(Connection conn, String sql, Map<String, Object> paramMap) throws SQLException {
final NamedSql namedSql = new NamedSql(sql, paramMap);
return executeForGeneratedKey(conn, namedSql.getSql(), namedSql.getParams());
} | [
"public",
"static",
"Long",
"executeForGeneratedKey",
"(",
"Connection",
"conn",
",",
"String",
"sql",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"paramMap",
")",
"throws",
"SQLException",
"{",
"final",
"NamedSql",
"namedSql",
"=",
"new",
"NamedSql",
"(",
... | 执行非查询语句,返回主键<br>
发查询语句包括 插入、更新、删除<br>
此方法不会关闭Connection
@param conn 数据库连接对象
@param sql SQL
@param paramMap 参数Map
@return 主键
@throws SQLException SQL执行异常
@since 4.0.10 | [
"执行非查询语句,返回主键<br",
">",
"发查询语句包括",
"插入、更新、删除<br",
">",
"此方法不会关闭Connection"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L116-L119 |
att/AAF | authz/authz-gui/src/main/java/com/att/authz/gui/Page.java | Page.browser | public static BROWSER browser(AuthzTrans trans, Slot slot) {
BROWSER br = trans.get(slot, null);
if(br==null) {
String agent = trans.agent();
int msie;
if(agent.contains("iPhone") /* other phones? */) {
br=BROWSER.iPhone;
} else if ((msie = agent.indexOf("MSIE"))>=0) {
msie+=5;
int end = agent.indexOf(";",msie);
float ver;
try {
ver = Float.valueOf(agent.substring(msie,end));
br = ver<8f?BROWSER.ieOld:BROWSER.ie;
} catch (Exception e) {
br = BROWSER.ie;
}
} else {
br = BROWSER.html5;
}
trans.put(slot,br);
}
return br;
} | java | public static BROWSER browser(AuthzTrans trans, Slot slot) {
BROWSER br = trans.get(slot, null);
if(br==null) {
String agent = trans.agent();
int msie;
if(agent.contains("iPhone") /* other phones? */) {
br=BROWSER.iPhone;
} else if ((msie = agent.indexOf("MSIE"))>=0) {
msie+=5;
int end = agent.indexOf(";",msie);
float ver;
try {
ver = Float.valueOf(agent.substring(msie,end));
br = ver<8f?BROWSER.ieOld:BROWSER.ie;
} catch (Exception e) {
br = BROWSER.ie;
}
} else {
br = BROWSER.html5;
}
trans.put(slot,br);
}
return br;
} | [
"public",
"static",
"BROWSER",
"browser",
"(",
"AuthzTrans",
"trans",
",",
"Slot",
"slot",
")",
"{",
"BROWSER",
"br",
"=",
"trans",
".",
"get",
"(",
"slot",
",",
"null",
")",
";",
"if",
"(",
"br",
"==",
"null",
")",
"{",
"String",
"agent",
"=",
"tr... | It's IE if int >=0
Use int found in "ieVersion"
Official IE 7
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322;
.NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Official IE 8
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2;
.NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; ATT)
IE 11 Compatibility
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727;
.NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; InfoPath.3; HVD; ATT)
IE 11 (not Compatiblity)
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727;
.NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; InfoPath.3; HVD; ATT)
@param trans
@return | [
"It",
"s",
"IE",
"if",
"int",
">",
"=",
"0"
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-gui/src/main/java/com/att/authz/gui/Page.java#L267-L290 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Solo.java | Solo.clickInRecyclerView | public void clickInRecyclerView(int itemIndex, int recyclerViewIndex, int id) {
if(config.commandLogging){
Log.d(config.commandLoggingTag, "clickInRecyclerView("+itemIndex+", "+recyclerViewIndex+", " + id +")");
}
clicker.clickInRecyclerView(itemIndex, recyclerViewIndex, id, false, 0);
} | java | public void clickInRecyclerView(int itemIndex, int recyclerViewIndex, int id) {
if(config.commandLogging){
Log.d(config.commandLoggingTag, "clickInRecyclerView("+itemIndex+", "+recyclerViewIndex+", " + id +")");
}
clicker.clickInRecyclerView(itemIndex, recyclerViewIndex, id, false, 0);
} | [
"public",
"void",
"clickInRecyclerView",
"(",
"int",
"itemIndex",
",",
"int",
"recyclerViewIndex",
",",
"int",
"id",
")",
"{",
"if",
"(",
"config",
".",
"commandLogging",
")",
"{",
"Log",
".",
"d",
"(",
"config",
".",
"commandLoggingTag",
",",
"\"clickInRecy... | Clicks a View with a specified resource id on the specified item index in the RecyclerView matching the specified RecyclerView index
@param itemIndex the line where the View exists
@param recyclerViewIndex the index of the RecyclerView. {@code 0} if only one is available
@param id the resource id of the View to click | [
"Clicks",
"a",
"View",
"with",
"a",
"specified",
"resource",
"id",
"on",
"the",
"specified",
"item",
"index",
"in",
"the",
"RecyclerView",
"matching",
"the",
"specified",
"RecyclerView",
"index"
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L1825-L1831 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/content/CmsElementRename.java | CmsElementRename.isEmptyElement | private boolean isEmptyElement(CmsXmlPage page, String element, Locale locale) {
CmsXmlHtmlValue xmlHtmlValue = (CmsXmlHtmlValue)page.getValue(element, locale);
if (CmsStringUtil.isNotEmpty(xmlHtmlValue.getPlainText(getCms()))) {
return false;
}
return true;
} | java | private boolean isEmptyElement(CmsXmlPage page, String element, Locale locale) {
CmsXmlHtmlValue xmlHtmlValue = (CmsXmlHtmlValue)page.getValue(element, locale);
if (CmsStringUtil.isNotEmpty(xmlHtmlValue.getPlainText(getCms()))) {
return false;
}
return true;
} | [
"private",
"boolean",
"isEmptyElement",
"(",
"CmsXmlPage",
"page",
",",
"String",
"element",
",",
"Locale",
"locale",
")",
"{",
"CmsXmlHtmlValue",
"xmlHtmlValue",
"=",
"(",
"CmsXmlHtmlValue",
")",
"page",
".",
"getValue",
"(",
"element",
",",
"locale",
")",
";... | Checks if the specified element/locale of the given page has a content.<p>
@param page the xml page
@param element the element name
@param locale the locale
@return false if the specified element/locale of the given page has a content; otherwise true | [
"Checks",
"if",
"the",
"specified",
"element",
"/",
"locale",
"of",
"the",
"given",
"page",
"has",
"a",
"content",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/content/CmsElementRename.java#L724-L732 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java | ApplicationSession.setSessionAttribute | public void setSessionAttribute(String key, Object newValue)
{
Object oldValue = sessionAttributes.put(key, newValue);
propertyChangeSupport.firePropertyChange(key, oldValue, newValue);
propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes);
} | java | public void setSessionAttribute(String key, Object newValue)
{
Object oldValue = sessionAttributes.put(key, newValue);
propertyChangeSupport.firePropertyChange(key, oldValue, newValue);
propertyChangeSupport.firePropertyChange(SESSION_ATTRIBUTES, null, sessionAttributes);
} | [
"public",
"void",
"setSessionAttribute",
"(",
"String",
"key",
",",
"Object",
"newValue",
")",
"{",
"Object",
"oldValue",
"=",
"sessionAttributes",
".",
"put",
"(",
"key",
",",
"newValue",
")",
";",
"propertyChangeSupport",
".",
"firePropertyChange",
"(",
"key",... | Add a key/value pair to the session attributes map.
@param key
a unique string code.
@param newValue
the associated value. | [
"Add",
"a",
"key",
"/",
"value",
"pair",
"to",
"the",
"session",
"attributes",
"map",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java#L280-L285 |
paypal/SeLion | client/src/main/java/com/paypal/selion/platform/asserts/SeLionAsserts.java | SeLionAsserts.verifyNotEquals | public static void verifyNotEquals(Object actual, Object expected, String msg) {
getSoftAssertInContext().assertNotEquals(actual, expected, msg);
} | java | public static void verifyNotEquals(Object actual, Object expected, String msg) {
getSoftAssertInContext().assertNotEquals(actual, expected, msg);
} | [
"public",
"static",
"void",
"verifyNotEquals",
"(",
"Object",
"actual",
",",
"Object",
"expected",
",",
"String",
"msg",
")",
"{",
"getSoftAssertInContext",
"(",
")",
".",
"assertNotEquals",
"(",
"actual",
",",
"expected",
",",
"msg",
")",
";",
"}"
] | verifyNotEquals method is used to assert based on actual and expected values and provide a Pass result for a
mismatch and continue to run the test.
@param actual
- Actual value obtained from executing a test
@param expected
- Expected value for the test to pass. <br>
@param msg
- A descriptive text narrating a validation being done Sample Usage<br>
<code>
SeLionAsserts.verifyNotEquals("OK","NOTOK", "My Assert message");
</code> | [
"verifyNotEquals",
"method",
"is",
"used",
"to",
"assert",
"based",
"on",
"actual",
"and",
"expected",
"values",
"and",
"provide",
"a",
"Pass",
"result",
"for",
"a",
"mismatch",
"and",
"continue",
"to",
"run",
"the",
"test",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/platform/asserts/SeLionAsserts.java#L308-L310 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java | PatternsImpl.addPattern | public PatternRuleInfo addPattern(UUID appId, String versionId, PatternRuleCreateObject pattern) {
return addPatternWithServiceResponseAsync(appId, versionId, pattern).toBlocking().single().body();
} | java | public PatternRuleInfo addPattern(UUID appId, String versionId, PatternRuleCreateObject pattern) {
return addPatternWithServiceResponseAsync(appId, versionId, pattern).toBlocking().single().body();
} | [
"public",
"PatternRuleInfo",
"addPattern",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"PatternRuleCreateObject",
"pattern",
")",
"{",
"return",
"addPatternWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"pattern",
")",
".",
"toBlocking",
... | Adds one pattern to the specified application.
@param appId The application ID.
@param versionId The version ID.
@param pattern The input pattern.
@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 PatternRuleInfo object if successful. | [
"Adds",
"one",
"pattern",
"to",
"the",
"specified",
"application",
"."
] | 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/PatternsImpl.java#L114-L116 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.socketTextStream | @PublicEvolving
public DataStreamSource<String> socketTextStream(String hostname, int port, String delimiter, long maxRetry) {
return addSource(new SocketTextStreamFunction(hostname, port, delimiter, maxRetry),
"Socket Stream");
} | java | @PublicEvolving
public DataStreamSource<String> socketTextStream(String hostname, int port, String delimiter, long maxRetry) {
return addSource(new SocketTextStreamFunction(hostname, port, delimiter, maxRetry),
"Socket Stream");
} | [
"@",
"PublicEvolving",
"public",
"DataStreamSource",
"<",
"String",
">",
"socketTextStream",
"(",
"String",
"hostname",
",",
"int",
"port",
",",
"String",
"delimiter",
",",
"long",
"maxRetry",
")",
"{",
"return",
"addSource",
"(",
"new",
"SocketTextStreamFunction"... | Creates a new data stream that contains the strings received infinitely from a socket. Received strings are
decoded by the system's default character set. On the termination of the socket server connection retries can be
initiated.
<p>Let us note that the socket itself does not report on abort and as a consequence retries are only initiated when
the socket was gracefully terminated.
@param hostname
The host name which a server socket binds
@param port
The port number which a server socket binds. A port number of 0 means that the port number is automatically
allocated.
@param delimiter
A string which splits received strings into records
@param maxRetry
The maximal retry interval in seconds while the program waits for a socket that is temporarily down.
Reconnection is initiated every second. A number of 0 means that the reader is immediately terminated,
while
a negative value ensures retrying forever.
@return A data stream containing the strings received from the socket | [
"Creates",
"a",
"new",
"data",
"stream",
"that",
"contains",
"the",
"strings",
"received",
"infinitely",
"from",
"a",
"socket",
".",
"Received",
"strings",
"are",
"decoded",
"by",
"the",
"system",
"s",
"default",
"character",
"set",
".",
"On",
"the",
"termin... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1214-L1218 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/IntStream.java | IntStream.rangeClosed | @NotNull
public static IntStream rangeClosed(final int startInclusive, final int endInclusive) {
if (startInclusive > endInclusive) {
return empty();
} else if (startInclusive == endInclusive) {
return of(startInclusive);
} else {
return new IntStream(new IntRangeClosed(startInclusive, endInclusive));
}
} | java | @NotNull
public static IntStream rangeClosed(final int startInclusive, final int endInclusive) {
if (startInclusive > endInclusive) {
return empty();
} else if (startInclusive == endInclusive) {
return of(startInclusive);
} else {
return new IntStream(new IntRangeClosed(startInclusive, endInclusive));
}
} | [
"@",
"NotNull",
"public",
"static",
"IntStream",
"rangeClosed",
"(",
"final",
"int",
"startInclusive",
",",
"final",
"int",
"endInclusive",
")",
"{",
"if",
"(",
"startInclusive",
">",
"endInclusive",
")",
"{",
"return",
"empty",
"(",
")",
";",
"}",
"else",
... | Returns a sequential ordered {@code IntStream} from {@code startInclusive}
(inclusive) to {@code endInclusive} (inclusive) by an incremental step of
{@code 1}.
@param startInclusive the (inclusive) initial value
@param endInclusive the inclusive upper bound
@return a sequential {@code IntStream} for the range of {@code int}
elements | [
"Returns",
"a",
"sequential",
"ordered",
"{",
"@code",
"IntStream",
"}",
"from",
"{",
"@code",
"startInclusive",
"}",
"(",
"inclusive",
")",
"to",
"{",
"@code",
"endInclusive",
"}",
"(",
"inclusive",
")",
"by",
"an",
"incremental",
"step",
"of",
"{",
"@cod... | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/IntStream.java#L132-L141 |
telly/groundy | library/src/main/java/com/telly/groundy/Groundy.java | Groundy.addStringArrayList | public Groundy addStringArrayList(String key, ArrayList<String> value) {
mArgs.putStringArrayList(key, value);
return this;
} | java | public Groundy addStringArrayList(String key, ArrayList<String> value) {
mArgs.putStringArrayList(key, value);
return this;
} | [
"public",
"Groundy",
"addStringArrayList",
"(",
"String",
"key",
",",
"ArrayList",
"<",
"String",
">",
"value",
")",
"{",
"mArgs",
".",
"putStringArrayList",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts an ArrayList<String> value into the mapping of this Bundle, replacing any existing
value for the given key. Either key or value may be null.
@param key a String, or null
@param value an ArrayList<String> object, or null | [
"Inserts",
"an",
"ArrayList<String",
">",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/Groundy.java#L572-L575 |
trellis-ldp/trellis | components/file/src/main/java/org/trellisldp/file/FileUtils.java | FileUtils.getNquadsFile | public static File getNquadsFile(final File dir, final Instant time) {
return new File(dir, Long.toString(time.getEpochSecond()) + ".nq");
} | java | public static File getNquadsFile(final File dir, final Instant time) {
return new File(dir, Long.toString(time.getEpochSecond()) + ".nq");
} | [
"public",
"static",
"File",
"getNquadsFile",
"(",
"final",
"File",
"dir",
",",
"final",
"Instant",
"time",
")",
"{",
"return",
"new",
"File",
"(",
"dir",
",",
"Long",
".",
"toString",
"(",
"time",
".",
"getEpochSecond",
"(",
")",
")",
"+",
"\".nq\"",
"... | Get the nquads file for a given moment in time.
@param dir the directory
@param time the time
@return the file | [
"Get",
"the",
"nquads",
"file",
"for",
"a",
"given",
"moment",
"in",
"time",
"."
] | train | https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/components/file/src/main/java/org/trellisldp/file/FileUtils.java#L200-L202 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java | MultiNormalizerHybrid.revertLabels | public void revertLabels(@NonNull INDArray[] labels, INDArray[] maskArrays, int output) {
NormalizerStrategy strategy = getStrategy(globalOutputStrategy, perOutputStrategies, output);
if (strategy != null) {
INDArray mask = (maskArrays == null ? null : maskArrays[output]);
//noinspection unchecked
strategy.revert(labels[output], mask, getOutputStats(output));
}
} | java | public void revertLabels(@NonNull INDArray[] labels, INDArray[] maskArrays, int output) {
NormalizerStrategy strategy = getStrategy(globalOutputStrategy, perOutputStrategies, output);
if (strategy != null) {
INDArray mask = (maskArrays == null ? null : maskArrays[output]);
//noinspection unchecked
strategy.revert(labels[output], mask, getOutputStats(output));
}
} | [
"public",
"void",
"revertLabels",
"(",
"@",
"NonNull",
"INDArray",
"[",
"]",
"labels",
",",
"INDArray",
"[",
"]",
"maskArrays",
",",
"int",
"output",
")",
"{",
"NormalizerStrategy",
"strategy",
"=",
"getStrategy",
"(",
"globalOutputStrategy",
",",
"perOutputStra... | Undo (revert) the normalization applied by this DataNormalization instance to the labels of a particular output
@param labels The normalized array of outputs
@param maskArrays Optional mask arrays belonging to the outputs
@param output the index of the output to revert normalization on | [
"Undo",
"(",
"revert",
")",
"the",
"normalization",
"applied",
"by",
"this",
"DataNormalization",
"instance",
"to",
"the",
"labels",
"of",
"a",
"particular",
"output"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java#L419-L426 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/LionEngineException.java | LionEngineException.getMessage | private static String getMessage(Media media, String message)
{
Check.notNull(message);
return new StringBuilder(getMessage(media)).append(message).toString();
} | java | private static String getMessage(Media media, String message)
{
Check.notNull(message);
return new StringBuilder(getMessage(media)).append(message).toString();
} | [
"private",
"static",
"String",
"getMessage",
"(",
"Media",
"media",
",",
"String",
"message",
")",
"{",
"Check",
".",
"notNull",
"(",
"message",
")",
";",
"return",
"new",
"StringBuilder",
"(",
"getMessage",
"(",
"media",
")",
")",
".",
"append",
"(",
"m... | Get formatted message with media.
@param media The media reference (must not be <code>null</code>).
@param message The message to concatenate (must not be <code>null</code>).
@return The formatted message.
@throws LionEngineException If invalid arguments. | [
"Get",
"formatted",
"message",
"with",
"media",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/LionEngineException.java#L54-L59 |
alkacon/opencms-core | src-modules/org/opencms/workplace/CmsFrameset.java | CmsFrameset.getSiteSelect | public String getSiteSelect(String htmlAttributes) {
List<String> options = new ArrayList<String>();
List<String> values = new ArrayList<String>();
int selectedIndex = 0;
List<CmsSite> sites = OpenCms.getSiteManager().getAvailableSites(getCms(), true);
Iterator<CmsSite> i = sites.iterator();
int pos = 0;
while (i.hasNext()) {
CmsSite site = i.next();
values.add(site.getSiteRoot());
options.add(substituteSiteTitle(site.getTitle()));
String siteRoot = CmsFileUtil.addTrailingSeparator(site.getSiteRoot());
String settingsSiteRoot = getSettings().getSite();
if (settingsSiteRoot != null) {
settingsSiteRoot = CmsFileUtil.addTrailingSeparator(settingsSiteRoot);
}
if (siteRoot.equals(settingsSiteRoot)) {
// this is the user's current site
selectedIndex = pos;
}
pos++;
}
return buildSelect(htmlAttributes, options, values, selectedIndex);
} | java | public String getSiteSelect(String htmlAttributes) {
List<String> options = new ArrayList<String>();
List<String> values = new ArrayList<String>();
int selectedIndex = 0;
List<CmsSite> sites = OpenCms.getSiteManager().getAvailableSites(getCms(), true);
Iterator<CmsSite> i = sites.iterator();
int pos = 0;
while (i.hasNext()) {
CmsSite site = i.next();
values.add(site.getSiteRoot());
options.add(substituteSiteTitle(site.getTitle()));
String siteRoot = CmsFileUtil.addTrailingSeparator(site.getSiteRoot());
String settingsSiteRoot = getSettings().getSite();
if (settingsSiteRoot != null) {
settingsSiteRoot = CmsFileUtil.addTrailingSeparator(settingsSiteRoot);
}
if (siteRoot.equals(settingsSiteRoot)) {
// this is the user's current site
selectedIndex = pos;
}
pos++;
}
return buildSelect(htmlAttributes, options, values, selectedIndex);
} | [
"public",
"String",
"getSiteSelect",
"(",
"String",
"htmlAttributes",
")",
"{",
"List",
"<",
"String",
">",
"options",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"String... | Returns a html select box filled with the current users accessible sites.<p>
@param htmlAttributes attributes that will be inserted into the generated html
@return a html select box filled with the current users accessible sites | [
"Returns",
"a",
"html",
"select",
"box",
"filled",
"with",
"the",
"current",
"users",
"accessible",
"sites",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsFrameset.java#L367-L394 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/styles/Style.java | Style.dashToString | public static String dashToString( float[] dash, Float shift ) {
StringBuilder sb = new StringBuilder();
if (shift != null)
sb.append(shift);
for( int i = 0; i < dash.length; i++ ) {
if (shift != null || i > 0) {
sb.append(",");
}
sb.append((int) dash[i]);
}
return sb.toString();
} | java | public static String dashToString( float[] dash, Float shift ) {
StringBuilder sb = new StringBuilder();
if (shift != null)
sb.append(shift);
for( int i = 0; i < dash.length; i++ ) {
if (shift != null || i > 0) {
sb.append(",");
}
sb.append((int) dash[i]);
}
return sb.toString();
} | [
"public",
"static",
"String",
"dashToString",
"(",
"float",
"[",
"]",
"dash",
",",
"Float",
"shift",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"shift",
"!=",
"null",
")",
"sb",
".",
"append",
"(",
"shift",
... | Convert a dash array to string.
@param dash the dash to convert.
@param shift the shift.
@return the string representation. | [
"Convert",
"a",
"dash",
"array",
"to",
"string",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/geopaparazzi/styles/Style.java#L206-L217 |
qiujuer/Genius-Android | caprice/kit-handler/src/main/java/net/qiujuer/genius/kit/handler/Run.java | Run.onBackground | public static Result onBackground(Action action) {
final HandlerPoster poster = getBackgroundPoster();
if (Looper.myLooper() == poster.getLooper()) {
action.call();
return new ActionAsyncTask(action, true);
}
ActionAsyncTask task = new ActionAsyncTask(action);
poster.async(task);
return task;
} | java | public static Result onBackground(Action action) {
final HandlerPoster poster = getBackgroundPoster();
if (Looper.myLooper() == poster.getLooper()) {
action.call();
return new ActionAsyncTask(action, true);
}
ActionAsyncTask task = new ActionAsyncTask(action);
poster.async(task);
return task;
} | [
"public",
"static",
"Result",
"onBackground",
"(",
"Action",
"action",
")",
"{",
"final",
"HandlerPoster",
"poster",
"=",
"getBackgroundPoster",
"(",
")",
";",
"if",
"(",
"Looper",
".",
"myLooper",
"(",
")",
"==",
"poster",
".",
"getLooper",
"(",
")",
")",... | Asynchronously
The current thread asynchronous run relative to the sub thread,
not blocking the current thread
@param action Action Interface, you can do something in this | [
"Asynchronously",
"The",
"current",
"thread",
"asynchronous",
"run",
"relative",
"to",
"the",
"sub",
"thread",
"not",
"blocking",
"the",
"current",
"thread"
] | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/kit-handler/src/main/java/net/qiujuer/genius/kit/handler/Run.java#L115-L124 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.linkMtoN | public void linkMtoN(Object obj, CollectionDescriptor cod, boolean insert)
{
Object referencedObjects = cod.getPersistentField().get(obj);
storeAndLinkMtoN(true, obj, cod, referencedObjects, insert);
} | java | public void linkMtoN(Object obj, CollectionDescriptor cod, boolean insert)
{
Object referencedObjects = cod.getPersistentField().get(obj);
storeAndLinkMtoN(true, obj, cod, referencedObjects, insert);
} | [
"public",
"void",
"linkMtoN",
"(",
"Object",
"obj",
",",
"CollectionDescriptor",
"cod",
",",
"boolean",
"insert",
")",
"{",
"Object",
"referencedObjects",
"=",
"cod",
".",
"getPersistentField",
"(",
")",
".",
"get",
"(",
"obj",
")",
";",
"storeAndLinkMtoN",
... | Assign FK values and store entries in indirection table
for all objects referenced by given object.
@param obj real object with 1:n reference
@param cod {@link CollectionDescriptor} of referenced 1:n objects
@param insert flag signal insert operation, false signals update operation | [
"Assign",
"FK",
"values",
"and",
"store",
"entries",
"in",
"indirection",
"table",
"for",
"all",
"objects",
"referenced",
"by",
"given",
"object",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1325-L1329 |
classgraph/classgraph | src/main/java/io/github/classgraph/ClassInfo.java | ClassInfo.getAllClasses | static ClassInfoList getAllClasses(final Collection<ClassInfo> classes, final ScanSpec scanSpec) {
return new ClassInfoList(
ClassInfo.filterClassInfo(classes, scanSpec, /* strictWhitelist = */ true, ClassType.ALL),
/* sortByName = */ true);
} | java | static ClassInfoList getAllClasses(final Collection<ClassInfo> classes, final ScanSpec scanSpec) {
return new ClassInfoList(
ClassInfo.filterClassInfo(classes, scanSpec, /* strictWhitelist = */ true, ClassType.ALL),
/* sortByName = */ true);
} | [
"static",
"ClassInfoList",
"getAllClasses",
"(",
"final",
"Collection",
"<",
"ClassInfo",
">",
"classes",
",",
"final",
"ScanSpec",
"scanSpec",
")",
"{",
"return",
"new",
"ClassInfoList",
"(",
"ClassInfo",
".",
"filterClassInfo",
"(",
"classes",
",",
"scanSpec",
... | Get all classes found during the scan.
@param classes
the classes
@param scanSpec
the scan spec
@return A list of all classes found during the scan, or the empty list if none. | [
"Get",
"all",
"classes",
"found",
"during",
"the",
"scan",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClassInfo.java#L825-L829 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/responder/responderpolicylabel_stats.java | responderpolicylabel_stats.get | public static responderpolicylabel_stats get(nitro_service service, String labelname) throws Exception{
responderpolicylabel_stats obj = new responderpolicylabel_stats();
obj.set_labelname(labelname);
responderpolicylabel_stats response = (responderpolicylabel_stats) obj.stat_resource(service);
return response;
} | java | public static responderpolicylabel_stats get(nitro_service service, String labelname) throws Exception{
responderpolicylabel_stats obj = new responderpolicylabel_stats();
obj.set_labelname(labelname);
responderpolicylabel_stats response = (responderpolicylabel_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"responderpolicylabel_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"responderpolicylabel_stats",
"obj",
"=",
"new",
"responderpolicylabel_stats",
"(",
")",
";",
"obj",
".",
"set_labeln... | Use this API to fetch statistics of responderpolicylabel_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"responderpolicylabel_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/responder/responderpolicylabel_stats.java#L149-L154 |
apollographql/apollo-android | apollo-gradle-plugin/src/main/java/com/apollographql/apollo/gradle/CodegenGenerationTaskCommandArgsBuilder.java | CodegenGenerationTaskCommandArgsBuilder.getSchemaFilesFrom | private List<File> getSchemaFilesFrom(Set<File> files) {
return FluentIterable.from(files).filter(new Predicate<File>() {
@Override public boolean apply(@Nullable File file) {
return file != null && file.getName().equals(GraphQLSourceDirectorySet.SCHEMA_FILE_NAME);
}
}).toSortedList(new Comparator<File>() {
@Override public int compare(File o1, File o2) {
String sourceSet1 = getSourceSetNameFromFile(o1);
String sourceSet2 = getSourceSetNameFromFile(o2);
// negative because the sourceSets list is in reverse order
return -(sourceSets.indexOf(sourceSet1) - sourceSets.indexOf(sourceSet2));
}
});
} | java | private List<File> getSchemaFilesFrom(Set<File> files) {
return FluentIterable.from(files).filter(new Predicate<File>() {
@Override public boolean apply(@Nullable File file) {
return file != null && file.getName().equals(GraphQLSourceDirectorySet.SCHEMA_FILE_NAME);
}
}).toSortedList(new Comparator<File>() {
@Override public int compare(File o1, File o2) {
String sourceSet1 = getSourceSetNameFromFile(o1);
String sourceSet2 = getSourceSetNameFromFile(o2);
// negative because the sourceSets list is in reverse order
return -(sourceSets.indexOf(sourceSet1) - sourceSets.indexOf(sourceSet2));
}
});
} | [
"private",
"List",
"<",
"File",
">",
"getSchemaFilesFrom",
"(",
"Set",
"<",
"File",
">",
"files",
")",
"{",
"return",
"FluentIterable",
".",
"from",
"(",
"files",
")",
".",
"filter",
"(",
"new",
"Predicate",
"<",
"File",
">",
"(",
")",
"{",
"@",
"Ove... | Returns "schema.json" files and sorts them based on their source set priorities.
@return - schema files sorted by priority based on source set priority | [
"Returns",
"schema",
".",
"json",
"files",
"and",
"sorts",
"them",
"based",
"on",
"their",
"source",
"set",
"priorities",
"."
] | train | https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-gradle-plugin/src/main/java/com/apollographql/apollo/gradle/CodegenGenerationTaskCommandArgsBuilder.java#L155-L168 |
BioPAX/Paxtools | paxtools-core/src/main/java/org/biopax/paxtools/converter/LevelUpgrader.java | LevelUpgrader.filter | public Model filter(Model model) {
if(model == null || model.getLevel() != BioPAXLevel.L2)
return model; // nothing to do
preparePep2PEIDMap(model);
final Model newModel = factory.createModel();
newModel.getNameSpacePrefixMap().putAll(model.getNameSpacePrefixMap());
newModel.setXmlBase(model.getXmlBase());
// facilitate the conversion
normalize(model);
// First, map classes (and only set ID) if possible (pre-processing)
for(BioPAXElement bpe : model.getObjects()) {
Level3Element l3element = mapClass(bpe);
if(l3element != null) {
newModel.add(l3element);
} else {
log.debug("Skipping " + bpe + " " + bpe.getModelInterface().getSimpleName());
}
}
/* process each L2 element (mapping properties),
* except for pEPs and oCVs that must be processed as values
* (anyway, we do not want dangling elements)
*/
for(BioPAXElement e : model.getObjects()) {
if(e instanceof physicalEntityParticipant
|| e instanceof openControlledVocabulary) {
continue;
}
// map properties
traverse((Level2Element) e, newModel);
}
log.info("Done: new L3 model contains " + newModel.getObjects().size() + " BioPAX individuals.");
// fix new model (e.g., add PathwayStep's processes to the pathway components ;))
normalize(newModel);
return newModel;
} | java | public Model filter(Model model) {
if(model == null || model.getLevel() != BioPAXLevel.L2)
return model; // nothing to do
preparePep2PEIDMap(model);
final Model newModel = factory.createModel();
newModel.getNameSpacePrefixMap().putAll(model.getNameSpacePrefixMap());
newModel.setXmlBase(model.getXmlBase());
// facilitate the conversion
normalize(model);
// First, map classes (and only set ID) if possible (pre-processing)
for(BioPAXElement bpe : model.getObjects()) {
Level3Element l3element = mapClass(bpe);
if(l3element != null) {
newModel.add(l3element);
} else {
log.debug("Skipping " + bpe + " " + bpe.getModelInterface().getSimpleName());
}
}
/* process each L2 element (mapping properties),
* except for pEPs and oCVs that must be processed as values
* (anyway, we do not want dangling elements)
*/
for(BioPAXElement e : model.getObjects()) {
if(e instanceof physicalEntityParticipant
|| e instanceof openControlledVocabulary) {
continue;
}
// map properties
traverse((Level2Element) e, newModel);
}
log.info("Done: new L3 model contains " + newModel.getObjects().size() + " BioPAX individuals.");
// fix new model (e.g., add PathwayStep's processes to the pathway components ;))
normalize(newModel);
return newModel;
} | [
"public",
"Model",
"filter",
"(",
"Model",
"model",
")",
"{",
"if",
"(",
"model",
"==",
"null",
"||",
"model",
".",
"getLevel",
"(",
")",
"!=",
"BioPAXLevel",
".",
"L2",
")",
"return",
"model",
";",
"// nothing to do",
"preparePep2PEIDMap",
"(",
"model",
... | Converts a BioPAX Model, Level 1 or 2, to the Level 3.
@param model BioPAX model to upgrade
@return new Level3 model | [
"Converts",
"a",
"BioPAX",
"Model",
"Level",
"1",
"or",
"2",
"to",
"the",
"Level",
"3",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/converter/LevelUpgrader.java#L106-L149 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Exceptions.java | Exceptions.RuntimeAssertion | public static RuntimeAssertion RuntimeAssertion(String pattern,
Object... parameters) {
return strip(new RuntimeAssertion(String.format(pattern, parameters)));
} | java | public static RuntimeAssertion RuntimeAssertion(String pattern,
Object... parameters) {
return strip(new RuntimeAssertion(String.format(pattern, parameters)));
} | [
"public",
"static",
"RuntimeAssertion",
"RuntimeAssertion",
"(",
"String",
"pattern",
",",
"Object",
"...",
"parameters",
")",
"{",
"return",
"strip",
"(",
"new",
"RuntimeAssertion",
"(",
"String",
".",
"format",
"(",
"pattern",
",",
"parameters",
")",
")",
")... | Generate a {@link RuntimeAssertion}
@param pattern
{@link String#format(String, Object...) String.format()}
pattern
@param parameters
{@code String.format()} parameters
@return A new {@code IllegalArgumentException} | [
"Generate",
"a",
"{",
"@link",
"RuntimeAssertion",
"}"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Exceptions.java#L71-L74 |
marklogic/marklogic-contentpump | mapreduce/src/main/java/com/marklogic/mapreduce/utilities/StatisticalAssignmentPolicy.java | StatisticalAssignmentPolicy.updateStats | public void updateStats(int fIdx, long count) {
synchronized (pq) {
frmtCount[fIdx] += count;
Stats tmp = new Stats(fIdx, frmtCount[fIdx]);
// remove the stats object with the same fIdx
pq.remove(tmp);
pq.offer(tmp);
}
if (LOG.isTraceEnabled()) {
LOG.trace("update forest " + fIdx);
}
} | java | public void updateStats(int fIdx, long count) {
synchronized (pq) {
frmtCount[fIdx] += count;
Stats tmp = new Stats(fIdx, frmtCount[fIdx]);
// remove the stats object with the same fIdx
pq.remove(tmp);
pq.offer(tmp);
}
if (LOG.isTraceEnabled()) {
LOG.trace("update forest " + fIdx);
}
} | [
"public",
"void",
"updateStats",
"(",
"int",
"fIdx",
",",
"long",
"count",
")",
"{",
"synchronized",
"(",
"pq",
")",
"{",
"frmtCount",
"[",
"fIdx",
"]",
"+=",
"count",
";",
"Stats",
"tmp",
"=",
"new",
"Stats",
"(",
"fIdx",
",",
"frmtCount",
"[",
"fId... | add count to forest with index fIdx, which may not be the forest with
minimum frmtCount. Used by fragment count rollback.
@param fIdx
@param count | [
"add",
"count",
"to",
"forest",
"with",
"index",
"fIdx",
"which",
"may",
"not",
"be",
"the",
"forest",
"with",
"minimum",
"frmtCount",
".",
"Used",
"by",
"fragment",
"count",
"rollback",
"."
] | train | https://github.com/marklogic/marklogic-contentpump/blob/4c41e4a953301f81a4c655efb2a847603dee8afc/mapreduce/src/main/java/com/marklogic/mapreduce/utilities/StatisticalAssignmentPolicy.java#L76-L87 |
nextreports/nextreports-server | src/ro/nextreports/server/api/StorageWebService.java | StorageWebService.getEntities | @GET
@Path("getEntities")
public List<EntityMetaData> getEntities(@QueryParam("path") String path) {
String absolutePath = StorageConstants.NEXT_SERVER_ROOT + path;
List<EntityMetaData> result = new ArrayList<EntityMetaData>();
Entity[] entities = new Entity[0];
try {
entities = storageService.getEntityChildren(absolutePath);
} catch (NotFoundException e) {
// TODO
e.printStackTrace();
}
List<Entity> list = Arrays.asList(entities);
Collections.sort(list, new Comparator<Entity>() {
public int compare(Entity e1, Entity e2) {
if (e1 instanceof Folder) {
if (e2 instanceof Folder) {
return Collator.getInstance().compare(e1.getName(), e2.getName());
} else {
return -1;
}
} else {
if (e2 instanceof Folder) {
return 1;
} else {
return Collator.getInstance().compare(e1.getName(), e2.getName());
}
}
}
});
for (Entity entity : list) {
result.add(createMetaData(entity));
}
return result;
} | java | @GET
@Path("getEntities")
public List<EntityMetaData> getEntities(@QueryParam("path") String path) {
String absolutePath = StorageConstants.NEXT_SERVER_ROOT + path;
List<EntityMetaData> result = new ArrayList<EntityMetaData>();
Entity[] entities = new Entity[0];
try {
entities = storageService.getEntityChildren(absolutePath);
} catch (NotFoundException e) {
// TODO
e.printStackTrace();
}
List<Entity> list = Arrays.asList(entities);
Collections.sort(list, new Comparator<Entity>() {
public int compare(Entity e1, Entity e2) {
if (e1 instanceof Folder) {
if (e2 instanceof Folder) {
return Collator.getInstance().compare(e1.getName(), e2.getName());
} else {
return -1;
}
} else {
if (e2 instanceof Folder) {
return 1;
} else {
return Collator.getInstance().compare(e1.getName(), e2.getName());
}
}
}
});
for (Entity entity : list) {
result.add(createMetaData(entity));
}
return result;
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"getEntities\"",
")",
"public",
"List",
"<",
"EntityMetaData",
">",
"getEntities",
"(",
"@",
"QueryParam",
"(",
"\"path\"",
")",
"String",
"path",
")",
"{",
"String",
"absolutePath",
"=",
"StorageConstants",
".",
"NEXT_SERVER_RO... | Path is relative to nextserver root ('/nextServer'). Ex: '/reports/test' <=> '/nextServer/reports/test'
@param path path
@return list of entities from path | [
"Path",
"is",
"relative",
"to",
"nextserver",
"root",
"(",
"/",
"nextServer",
")",
".",
"Ex",
":",
"/",
"reports",
"/",
"test",
"<",
"=",
">",
"/",
"nextServer",
"/",
"reports",
"/",
"test"
] | train | https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/api/StorageWebService.java#L262-L299 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/RuntimeExceptionsFactory.java | RuntimeExceptionsFactory.newIndexOutOfBoundsException | public static IndexOutOfBoundsException newIndexOutOfBoundsException(String message, Object... args) {
return newIndexOutOfBoundsException(null, message, args);
} | java | public static IndexOutOfBoundsException newIndexOutOfBoundsException(String message, Object... args) {
return newIndexOutOfBoundsException(null, message, args);
} | [
"public",
"static",
"IndexOutOfBoundsException",
"newIndexOutOfBoundsException",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"newIndexOutOfBoundsException",
"(",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Constructs and initializes a new {@link IndexOutOfBoundsException} with the given {@link String message}
formatted with the given {@link Object[] arguments}.
@param message {@link String} describing the {@link IndexOutOfBoundsException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link IndexOutOfBoundsException} with the given {@link String message}.
@see #newIndexOutOfBoundsException(Throwable, String, Object...)
@see java.lang.IndexOutOfBoundsException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"IndexOutOfBoundsException",
"}",
"with",
"the",
"given",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
"Object",
"[]",
"arguments",
"}",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RuntimeExceptionsFactory.java#L104-L106 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.addCookie | public final static void addCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds, String path, String domain) {
Cookie cookie = new Cookie(name, value);
if (domain != null) {
cookie.setDomain(domain);
}
cookie.setMaxAge(maxAgeInSeconds);
cookie.setPath(path);
addCookie(response, cookie);
} | java | public final static void addCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds, String path, String domain) {
Cookie cookie = new Cookie(name, value);
if (domain != null) {
cookie.setDomain(domain);
}
cookie.setMaxAge(maxAgeInSeconds);
cookie.setPath(path);
addCookie(response, cookie);
} | [
"public",
"final",
"static",
"void",
"addCookie",
"(",
"HttpServletResponse",
"response",
",",
"String",
"name",
",",
"String",
"value",
",",
"int",
"maxAgeInSeconds",
",",
"String",
"path",
",",
"String",
"domain",
")",
"{",
"Cookie",
"cookie",
"=",
"new",
... | 设定返回给客户端的Cookie
@param response 响应对象{@link HttpServletResponse}
@param name cookie名
@param value cookie值
@param maxAgeInSeconds -1: 关闭浏览器清除Cookie. 0: 立即清除Cookie. >0 : Cookie存在的秒数.
@param path Cookie的有效路径
@param domain the domain name within which this cookie is visible; form is according to RFC 2109 | [
"设定返回给客户端的Cookie"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L432-L440 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java | AbstractValidate.validIndex | public <T extends Collection<?>> T validIndex(final T collection, final int index) {
return validIndex(collection, index, DEFAULT_VALID_INDEX_COLLECTION_EX_MESSAGE, index);
} | java | public <T extends Collection<?>> T validIndex(final T collection, final int index) {
return validIndex(collection, index, DEFAULT_VALID_INDEX_COLLECTION_EX_MESSAGE, index);
} | [
"public",
"<",
"T",
"extends",
"Collection",
"<",
"?",
">",
">",
"T",
"validIndex",
"(",
"final",
"T",
"collection",
",",
"final",
"int",
"index",
")",
"{",
"return",
"validIndex",
"(",
"collection",
",",
"index",
",",
"DEFAULT_VALID_INDEX_COLLECTION_EX_MESSAG... | <p>Validates that the index is within the bounds of the argument collection; otherwise throwing an exception.</p>
<pre>Validate.validIndex(myCollection, 2);</pre>
<p>If the index is invalid, then the message of the exception is "The validated collection index is invalid: " followed by the index.</p>
@param <T>
the collection type
@param collection
the collection to check, validated not null by this method
@param index
the index to check
@return the validated collection (never {@code null} for method chaining)
@throws NullPointerValidationException
if the collection is {@code null}
@throws IndexOutOfBoundsException
if the index is invalid
@see #validIndex(java.util.Collection, int, String, Object...) | [
"<p",
">",
"Validates",
"that",
"the",
"index",
"is",
"within",
"the",
"bounds",
"of",
"the",
"argument",
"collection",
";",
"otherwise",
"throwing",
"an",
"exception",
".",
"<",
"/",
"p",
">",
"<pre",
">",
"Validate",
".",
"validIndex",
"(",
"myCollection... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L1040-L1042 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/email/MailConnectionFactoryImpl.java | MailConnectionFactoryImpl.createTransport | protected Transport createTransport(Session session)
{
Transport transport=null;
try
{
//get the transport
transport=session.getTransport(this.transportProtocol);
//connect
if(this.transportPort>0)
{
transport.connect(this.transportHost,this.transportPort,this.userName,this.password);
}
else
{
transport.connect(this.transportHost,this.userName,this.password);
}
}
catch(Exception exception)
{
throw new FaxException("Error while connecting to mail host: "+this.transportHost,exception);
}
return transport;
} | java | protected Transport createTransport(Session session)
{
Transport transport=null;
try
{
//get the transport
transport=session.getTransport(this.transportProtocol);
//connect
if(this.transportPort>0)
{
transport.connect(this.transportHost,this.transportPort,this.userName,this.password);
}
else
{
transport.connect(this.transportHost,this.userName,this.password);
}
}
catch(Exception exception)
{
throw new FaxException("Error while connecting to mail host: "+this.transportHost,exception);
}
return transport;
} | [
"protected",
"Transport",
"createTransport",
"(",
"Session",
"session",
")",
"{",
"Transport",
"transport",
"=",
"null",
";",
"try",
"{",
"//get the transport",
"transport",
"=",
"session",
".",
"getTransport",
"(",
"this",
".",
"transportProtocol",
")",
";",
"/... | This function returns a transport for the provided session.
@param session
The mail session
@return The mail transport | [
"This",
"function",
"returns",
"a",
"transport",
"for",
"the",
"provided",
"session",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/email/MailConnectionFactoryImpl.java#L59-L83 |
twilio/twilio-java | src/main/java/com/twilio/rest/accounts/v1/credential/AwsReader.java | AwsReader.nextPage | @Override
public Page<Aws> nextPage(final Page<Aws> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getNextPageUrl(
Domains.ACCOUNTS.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | java | @Override
public Page<Aws> nextPage(final Page<Aws> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getNextPageUrl(
Domains.ACCOUNTS.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | [
"@",
"Override",
"public",
"Page",
"<",
"Aws",
">",
"nextPage",
"(",
"final",
"Page",
"<",
"Aws",
">",
"page",
",",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
",",
"page",
... | Retrieve the next page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Next Page | [
"Retrieve",
"the",
"next",
"page",
"from",
"the",
"Twilio",
"API",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/accounts/v1/credential/AwsReader.java#L79-L90 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/DoubleStream.java | DoubleStream.scan | @NotNull
public DoubleStream scan(final double identity,
@NotNull final DoubleBinaryOperator accumulator) {
Objects.requireNonNull(accumulator);
return new DoubleStream(params, new DoubleScanIdentity(iterator, identity, accumulator));
} | java | @NotNull
public DoubleStream scan(final double identity,
@NotNull final DoubleBinaryOperator accumulator) {
Objects.requireNonNull(accumulator);
return new DoubleStream(params, new DoubleScanIdentity(iterator, identity, accumulator));
} | [
"@",
"NotNull",
"public",
"DoubleStream",
"scan",
"(",
"final",
"double",
"identity",
",",
"@",
"NotNull",
"final",
"DoubleBinaryOperator",
"accumulator",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"accumulator",
")",
";",
"return",
"new",
"DoubleStream",
... | Returns a {@code DoubleStream} produced by iterative application of a accumulation function
to an initial element {@code identity} and next element of the current stream.
Produces a {@code DoubleStream} consisting of {@code identity}, {@code acc(identity, value1)},
{@code acc(acc(identity, value1), value2)}, etc.
<p>This is an intermediate operation.
<p>Example:
<pre>
identity: 0
accumulator: (a, b) -> a + b
stream: [1, 2, 3, 4, 5]
result: [0, 1, 3, 6, 10, 15]
</pre>
@param identity the initial value
@param accumulator the accumulation function
@return the new stream
@throws NullPointerException if {@code accumulator} is null
@since 1.1.6 | [
"Returns",
"a",
"{",
"@code",
"DoubleStream",
"}",
"produced",
"by",
"iterative",
"application",
"of",
"a",
"accumulation",
"function",
"to",
"an",
"initial",
"element",
"{",
"@code",
"identity",
"}",
"and",
"next",
"element",
"of",
"the",
"current",
"stream",... | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/DoubleStream.java#L674-L679 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.globStatus | public FileStatus[] globStatus(Path pathPattern, PathFilter filter)
throws IOException {
String filename = pathPattern.toUri().getPath();
List<String> filePatterns = GlobExpander.expand(filename);
if (filePatterns.size() == 1) {
return globStatusInternal(pathPattern, filter);
} else {
List<FileStatus> results = new ArrayList<FileStatus>();
for (String filePattern : filePatterns) {
FileStatus[] files = globStatusInternal(new Path(filePattern), filter);
for (FileStatus file : files) {
results.add(file);
}
}
return results.toArray(new FileStatus[results.size()]);
}
} | java | public FileStatus[] globStatus(Path pathPattern, PathFilter filter)
throws IOException {
String filename = pathPattern.toUri().getPath();
List<String> filePatterns = GlobExpander.expand(filename);
if (filePatterns.size() == 1) {
return globStatusInternal(pathPattern, filter);
} else {
List<FileStatus> results = new ArrayList<FileStatus>();
for (String filePattern : filePatterns) {
FileStatus[] files = globStatusInternal(new Path(filePattern), filter);
for (FileStatus file : files) {
results.add(file);
}
}
return results.toArray(new FileStatus[results.size()]);
}
} | [
"public",
"FileStatus",
"[",
"]",
"globStatus",
"(",
"Path",
"pathPattern",
",",
"PathFilter",
"filter",
")",
"throws",
"IOException",
"{",
"String",
"filename",
"=",
"pathPattern",
".",
"toUri",
"(",
")",
".",
"getPath",
"(",
")",
";",
"List",
"<",
"Strin... | Return an array of FileStatus objects whose path names match pathPattern
and is accepted by the user-supplied path filter. Results are sorted by
their path names.
Return null if pathPattern has no glob and the path does not exist.
Return an empty array if pathPattern has a glob and no path matches it.
@param pathPattern
a regular expression specifying the path pattern
@param filter
a user-supplied path filter
@return an array of FileStatus objects
@throws IOException if any I/O error occurs when fetching file status | [
"Return",
"an",
"array",
"of",
"FileStatus",
"objects",
"whose",
"path",
"names",
"match",
"pathPattern",
"and",
"is",
"accepted",
"by",
"the",
"user",
"-",
"supplied",
"path",
"filter",
".",
"Results",
"are",
"sorted",
"by",
"their",
"path",
"names",
".",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1333-L1349 |
Impetus/Kundera | src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBObjectMapper.java | CouchDBObjectMapper.setFieldValue | private static void setFieldValue(Object entity, Attribute column, JsonElement value)
{
if (column.getJavaType().isAssignableFrom(byte[].class))
{
PropertyAccessorHelper.set(entity, (Field) column.getJavaMember(),
PropertyAccessorFactory.STRING.toBytes(value.getAsString()));
}
else
{
PropertyAccessorHelper.set(
entity,
(Field) column.getJavaMember(),
PropertyAccessorHelper.fromSourceToTargetClass(column.getJavaType(), String.class,
value.getAsString()));
}
} | java | private static void setFieldValue(Object entity, Attribute column, JsonElement value)
{
if (column.getJavaType().isAssignableFrom(byte[].class))
{
PropertyAccessorHelper.set(entity, (Field) column.getJavaMember(),
PropertyAccessorFactory.STRING.toBytes(value.getAsString()));
}
else
{
PropertyAccessorHelper.set(
entity,
(Field) column.getJavaMember(),
PropertyAccessorHelper.fromSourceToTargetClass(column.getJavaType(), String.class,
value.getAsString()));
}
} | [
"private",
"static",
"void",
"setFieldValue",
"(",
"Object",
"entity",
",",
"Attribute",
"column",
",",
"JsonElement",
"value",
")",
"{",
"if",
"(",
"column",
".",
"getJavaType",
"(",
")",
".",
"isAssignableFrom",
"(",
"byte",
"[",
"]",
".",
"class",
")",
... | Sets the field value.
@param entity
the entity
@param column
the column
@param value
the value | [
"Sets",
"the",
"field",
"value",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBObjectMapper.java#L361-L376 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java | ResourceManager.registerJobMasterInternal | private RegistrationResponse registerJobMasterInternal(
final JobMasterGateway jobMasterGateway,
JobID jobId,
String jobManagerAddress,
ResourceID jobManagerResourceId) {
if (jobManagerRegistrations.containsKey(jobId)) {
JobManagerRegistration oldJobManagerRegistration = jobManagerRegistrations.get(jobId);
if (Objects.equals(oldJobManagerRegistration.getJobMasterId(), jobMasterGateway.getFencingToken())) {
// same registration
log.debug("Job manager {}@{} was already registered.", jobMasterGateway.getFencingToken(), jobManagerAddress);
} else {
// tell old job manager that he is no longer the job leader
disconnectJobManager(
oldJobManagerRegistration.getJobID(),
new Exception("New job leader for job " + jobId + " found."));
JobManagerRegistration jobManagerRegistration = new JobManagerRegistration(
jobId,
jobManagerResourceId,
jobMasterGateway);
jobManagerRegistrations.put(jobId, jobManagerRegistration);
jmResourceIdRegistrations.put(jobManagerResourceId, jobManagerRegistration);
}
} else {
// new registration for the job
JobManagerRegistration jobManagerRegistration = new JobManagerRegistration(
jobId,
jobManagerResourceId,
jobMasterGateway);
jobManagerRegistrations.put(jobId, jobManagerRegistration);
jmResourceIdRegistrations.put(jobManagerResourceId, jobManagerRegistration);
}
log.info("Registered job manager {}@{} for job {}.", jobMasterGateway.getFencingToken(), jobManagerAddress, jobId);
jobManagerHeartbeatManager.monitorTarget(jobManagerResourceId, new HeartbeatTarget<Void>() {
@Override
public void receiveHeartbeat(ResourceID resourceID, Void payload) {
// the ResourceManager will always send heartbeat requests to the JobManager
}
@Override
public void requestHeartbeat(ResourceID resourceID, Void payload) {
jobMasterGateway.heartbeatFromResourceManager(resourceID);
}
});
return new JobMasterRegistrationSuccess(
getFencingToken(),
resourceId);
} | java | private RegistrationResponse registerJobMasterInternal(
final JobMasterGateway jobMasterGateway,
JobID jobId,
String jobManagerAddress,
ResourceID jobManagerResourceId) {
if (jobManagerRegistrations.containsKey(jobId)) {
JobManagerRegistration oldJobManagerRegistration = jobManagerRegistrations.get(jobId);
if (Objects.equals(oldJobManagerRegistration.getJobMasterId(), jobMasterGateway.getFencingToken())) {
// same registration
log.debug("Job manager {}@{} was already registered.", jobMasterGateway.getFencingToken(), jobManagerAddress);
} else {
// tell old job manager that he is no longer the job leader
disconnectJobManager(
oldJobManagerRegistration.getJobID(),
new Exception("New job leader for job " + jobId + " found."));
JobManagerRegistration jobManagerRegistration = new JobManagerRegistration(
jobId,
jobManagerResourceId,
jobMasterGateway);
jobManagerRegistrations.put(jobId, jobManagerRegistration);
jmResourceIdRegistrations.put(jobManagerResourceId, jobManagerRegistration);
}
} else {
// new registration for the job
JobManagerRegistration jobManagerRegistration = new JobManagerRegistration(
jobId,
jobManagerResourceId,
jobMasterGateway);
jobManagerRegistrations.put(jobId, jobManagerRegistration);
jmResourceIdRegistrations.put(jobManagerResourceId, jobManagerRegistration);
}
log.info("Registered job manager {}@{} for job {}.", jobMasterGateway.getFencingToken(), jobManagerAddress, jobId);
jobManagerHeartbeatManager.monitorTarget(jobManagerResourceId, new HeartbeatTarget<Void>() {
@Override
public void receiveHeartbeat(ResourceID resourceID, Void payload) {
// the ResourceManager will always send heartbeat requests to the JobManager
}
@Override
public void requestHeartbeat(ResourceID resourceID, Void payload) {
jobMasterGateway.heartbeatFromResourceManager(resourceID);
}
});
return new JobMasterRegistrationSuccess(
getFencingToken(),
resourceId);
} | [
"private",
"RegistrationResponse",
"registerJobMasterInternal",
"(",
"final",
"JobMasterGateway",
"jobMasterGateway",
",",
"JobID",
"jobId",
",",
"String",
"jobManagerAddress",
",",
"ResourceID",
"jobManagerResourceId",
")",
"{",
"if",
"(",
"jobManagerRegistrations",
".",
... | Registers a new JobMaster.
@param jobMasterGateway to communicate with the registering JobMaster
@param jobId of the job for which the JobMaster is responsible
@param jobManagerAddress address of the JobMaster
@param jobManagerResourceId ResourceID of the JobMaster
@return RegistrationResponse | [
"Registers",
"a",
"new",
"JobMaster",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/ResourceManager.java#L620-L671 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java | CPDefinitionOptionValueRelPersistenceImpl.findAll | @Override
public List<CPDefinitionOptionValueRel> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CPDefinitionOptionValueRel> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionOptionValueRel",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp definition option value rels.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionOptionValueRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of cp definition option value rels
@param end the upper bound of the range of cp definition option value rels (not inclusive)
@return the range of cp definition option value rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definition",
"option",
"value",
"rels",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java#L4654-L4657 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java | ClassesManager.mapperClassName | public static String mapperClassName(Class<?> destination, Class<?> source, String resource){
String className = destination.getName().replaceAll("\\.","") + source.getName().replaceAll("\\.","");
if(isEmpty(resource))
return className;
if(!isPath(resource))
return write(className, String.valueOf(resource.hashCode()));
String[]dep = resource.split("\\\\");
if(dep.length<=1)dep = resource.split("/");
String xml = dep[dep.length-1];
return write(className, xml.replaceAll("\\.","").replaceAll(" ",""));
} | java | public static String mapperClassName(Class<?> destination, Class<?> source, String resource){
String className = destination.getName().replaceAll("\\.","") + source.getName().replaceAll("\\.","");
if(isEmpty(resource))
return className;
if(!isPath(resource))
return write(className, String.valueOf(resource.hashCode()));
String[]dep = resource.split("\\\\");
if(dep.length<=1)dep = resource.split("/");
String xml = dep[dep.length-1];
return write(className, xml.replaceAll("\\.","").replaceAll(" ",""));
} | [
"public",
"static",
"String",
"mapperClassName",
"(",
"Class",
"<",
"?",
">",
"destination",
",",
"Class",
"<",
"?",
">",
"source",
",",
"String",
"resource",
")",
"{",
"String",
"className",
"=",
"destination",
".",
"getName",
"(",
")",
".",
"replaceAll",... | Returns the name of mapper that identifies the destination and source classes.
@param destination class of Destination
@param source class of Source
@param resource a resource that represents an xml path or a content
@return Returns a string containing the names of the classes passed as input | [
"Returns",
"the",
"name",
"of",
"mapper",
"that",
"identifies",
"the",
"destination",
"and",
"source",
"classes",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java#L371-L385 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/util/Hashcoder.java | Hashcoder.hash | public static int hash(int seed, Object o) {
int result = seed;
//If it was null then this is the result 0
if (o == null) {
result = hash(result, 0);
}
//If it wasn't an array then calculate the hashcode
else if (!o.getClass().isArray()) {
result = hash(result, o.hashCode());
}
//Otherwise loop &
else {
int length = Array.getLength(o);
for (int i = 0; i < length; i++) {
Object item = Array.get(o, i);
result = hash(result, item);// recursive call!
}
}
return result;
} | java | public static int hash(int seed, Object o) {
int result = seed;
//If it was null then this is the result 0
if (o == null) {
result = hash(result, 0);
}
//If it wasn't an array then calculate the hashcode
else if (!o.getClass().isArray()) {
result = hash(result, o.hashCode());
}
//Otherwise loop &
else {
int length = Array.getLength(o);
for (int i = 0; i < length; i++) {
Object item = Array.get(o, i);
result = hash(result, item);// recursive call!
}
}
return result;
} | [
"public",
"static",
"int",
"hash",
"(",
"int",
"seed",
",",
"Object",
"o",
")",
"{",
"int",
"result",
"=",
"seed",
";",
"//If it was null then this is the result 0",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"result",
"=",
"hash",
"(",
"result",
",",
"0",
... | <code>o</code> is a possibly-null object field, and possibly an
array.
If <code>o</code> is an array, then each element may be a primitive
or a possibly-null object. | [
"<code",
">",
"o<",
"/",
"code",
">",
"is",
"a",
"possibly",
"-",
"null",
"object",
"field",
"and",
"possibly",
"an",
"array",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/Hashcoder.java#L106-L125 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java | ParagraphBox.hitText | CharacterHit hitText(CaretOffsetX x, double y) {
return text.hit(x.value, y);
} | java | CharacterHit hitText(CaretOffsetX x, double y) {
return text.hit(x.value, y);
} | [
"CharacterHit",
"hitText",
"(",
"CaretOffsetX",
"x",
",",
"double",
"y",
")",
"{",
"return",
"text",
".",
"hit",
"(",
"x",
".",
"value",
",",
"y",
")",
";",
"}"
] | Hits the embedded TextFlow at the given x and y offset.
@return hit info for the given x and y coordinates | [
"Hits",
"the",
"embedded",
"TextFlow",
"at",
"the",
"given",
"x",
"and",
"y",
"offset",
"."
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java#L272-L274 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/MapHelper.java | MapHelper.addValueToIn | public void addValueToIn(Object value, String name, Map<String, Object> map) {
Object val = getValue(map, name);
if (val instanceof Collection) {
Object cleanValue = getCleanValue(value);
((Collection) val).add(cleanValue);
} else if (val == null) {
setValueForIn(value, name + "[0]", map);
} else {
throw new SlimFixtureException(false, "name is not a list but: " + val.getClass().getSimpleName());
}
} | java | public void addValueToIn(Object value, String name, Map<String, Object> map) {
Object val = getValue(map, name);
if (val instanceof Collection) {
Object cleanValue = getCleanValue(value);
((Collection) val).add(cleanValue);
} else if (val == null) {
setValueForIn(value, name + "[0]", map);
} else {
throw new SlimFixtureException(false, "name is not a list but: " + val.getClass().getSimpleName());
}
} | [
"public",
"void",
"addValueToIn",
"(",
"Object",
"value",
",",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"Object",
"val",
"=",
"getValue",
"(",
"map",
",",
"name",
")",
";",
"if",
"(",
"val",
"instanceof",
"Col... | Adds a value to the end of a list.
@param value value to be passed.
@param name name to use this value for.
@param map map to store value in. | [
"Adds",
"a",
"value",
"to",
"the",
"end",
"of",
"a",
"list",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/MapHelper.java#L107-L117 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java | ClassesManager.isAssignableFrom | public static boolean isAssignableFrom(Class<?> destination,Class<?> source){
return destination.isAssignableFrom(source) || isBoxing(destination,source) || isUnBoxing(destination,source);
} | java | public static boolean isAssignableFrom(Class<?> destination,Class<?> source){
return destination.isAssignableFrom(source) || isBoxing(destination,source) || isUnBoxing(destination,source);
} | [
"public",
"static",
"boolean",
"isAssignableFrom",
"(",
"Class",
"<",
"?",
">",
"destination",
",",
"Class",
"<",
"?",
">",
"source",
")",
"{",
"return",
"destination",
".",
"isAssignableFrom",
"(",
"source",
")",
"||",
"isBoxing",
"(",
"destination",
",",
... | Returns true if destination is assignable from source analyzing autoboxing also.
@param destination destination class
@param source source class
@return true if destination is assignable from source analyzing autoboxing also. | [
"Returns",
"true",
"if",
"destination",
"is",
"assignable",
"from",
"source",
"analyzing",
"autoboxing",
"also",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java#L125-L127 |
kotcrab/vis-ui | ui/src/main/java/com/kotcrab/vis/ui/util/form/FormValidator.java | FormValidator.fileExists | public FormInputValidator fileExists (VisValidatableTextField field, FileHandle relativeTo, String errorMsg) {
FileExistsValidator validator = new FileExistsValidator(relativeTo.file(), errorMsg);
field.addValidator(validator);
add(field);
return validator;
} | java | public FormInputValidator fileExists (VisValidatableTextField field, FileHandle relativeTo, String errorMsg) {
FileExistsValidator validator = new FileExistsValidator(relativeTo.file(), errorMsg);
field.addValidator(validator);
add(field);
return validator;
} | [
"public",
"FormInputValidator",
"fileExists",
"(",
"VisValidatableTextField",
"field",
",",
"FileHandle",
"relativeTo",
",",
"String",
"errorMsg",
")",
"{",
"FileExistsValidator",
"validator",
"=",
"new",
"FileExistsValidator",
"(",
"relativeTo",
".",
"file",
"(",
")"... | Validates if relative path entered in text field points to an existing file.
@param relativeTo path of this file is used to create absolute path from entered in field (see {@link FileExistsValidator}). | [
"Validates",
"if",
"relative",
"path",
"entered",
"in",
"text",
"field",
"points",
"to",
"an",
"existing",
"file",
"."
] | train | https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/form/FormValidator.java#L103-L109 |
sahan/ZombieLink | zombielink/src/main/java/com/lonepulse/zombielink/util/Components.java | Components.isDetached | public static boolean isDetached(InvocationContext context, Class<? extends Annotation> type) {
Method request = context.getRequest();
return request.isAnnotationPresent(Detach.class) &&
Arrays.asList(request.getAnnotation(Detach.class).value()).contains(type);
} | java | public static boolean isDetached(InvocationContext context, Class<? extends Annotation> type) {
Method request = context.getRequest();
return request.isAnnotationPresent(Detach.class) &&
Arrays.asList(request.getAnnotation(Detach.class).value()).contains(type);
} | [
"public",
"static",
"boolean",
"isDetached",
"(",
"InvocationContext",
"context",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"type",
")",
"{",
"Method",
"request",
"=",
"context",
".",
"getRequest",
"(",
")",
";",
"return",
"request",
".",
"isAnno... | <p>Determines whether the request definition has <i>detached</i> the given {@link Annotation} type.
This will mute any annotations of the given type which are defined on the endpoint.</p>
<p>See {@link Detach}.</p>
@param context
the {@link InvocationContext} which provides the request definition
<br><br>
@param type
the {@link Annotation} type whose detachment is to be determined
<br><br>
@return {@code true} if the given {@link Annotation} type has been detached from the request
<br><br>
@since 1.3.0 | [
"<p",
">",
"Determines",
"whether",
"the",
"request",
"definition",
"has",
"<i",
">",
"detached<",
"/",
"i",
">",
"the",
"given",
"{",
"@link",
"Annotation",
"}",
"type",
".",
"This",
"will",
"mute",
"any",
"annotations",
"of",
"the",
"given",
"type",
"w... | train | https://github.com/sahan/ZombieLink/blob/a9971add56d4f6919a4a5e84c78e9220011d8982/zombielink/src/main/java/com/lonepulse/zombielink/util/Components.java#L66-L72 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/swing/clipboard/ClipboardUtil.java | ClipboardUtil.get | public static Object get(Transferable content, DataFlavor flavor) {
if (null != content && content.isDataFlavorSupported(flavor)) {
try {
return content.getTransferData(flavor);
} catch (UnsupportedFlavorException | IOException e) {
throw new UtilException(e);
}
}
return null;
} | java | public static Object get(Transferable content, DataFlavor flavor) {
if (null != content && content.isDataFlavorSupported(flavor)) {
try {
return content.getTransferData(flavor);
} catch (UnsupportedFlavorException | IOException e) {
throw new UtilException(e);
}
}
return null;
} | [
"public",
"static",
"Object",
"get",
"(",
"Transferable",
"content",
",",
"DataFlavor",
"flavor",
")",
"{",
"if",
"(",
"null",
"!=",
"content",
"&&",
"content",
".",
"isDataFlavorSupported",
"(",
"flavor",
")",
")",
"{",
"try",
"{",
"return",
"content",
".... | 获取剪贴板内容
@param content {@link Transferable}
@param flavor 数据元信息,标识数据类型
@return 剪贴板内容,类型根据flavor不同而不同 | [
"获取剪贴板内容"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/swing/clipboard/ClipboardUtil.java#L68-L77 |
JohnPersano/SuperToasts | demo/src/main/java/com/github/johnpersano/supertoasts/demo/fragments/PagerFragment.java | PagerFragment.addFragment | @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public PagerFragment addFragment(String title, Fragment fragment) {
this.mFragmentTitles.add(title);
this.mFragments.add(fragment);
return this;
} | java | @SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public PagerFragment addFragment(String title, Fragment fragment) {
this.mFragmentTitles.add(title);
this.mFragments.add(fragment);
return this;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"UnusedReturnValue\"",
",",
"\"WeakerAccess\"",
"}",
")",
"public",
"PagerFragment",
"addFragment",
"(",
"String",
"title",
",",
"Fragment",
"fragment",
")",
"{",
"this",
".",
"mFragmentTitles",
".",
"add",
"(",
"title",
")",... | Add a Fragment to this PagerFragment.
@param title The title of the {@link android.app.Fragment} to be added
@param fragment The {@link android.app.Fragment} to be added
@return The current PagerFragmentInstance | [
"Add",
"a",
"Fragment",
"to",
"this",
"PagerFragment",
"."
] | train | https://github.com/JohnPersano/SuperToasts/blob/5394db6a2f5c38410586d5d001d61f731da1132a/demo/src/main/java/com/github/johnpersano/supertoasts/demo/fragments/PagerFragment.java#L74-L80 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.getNetworkConfigurationDiagnosticAsync | public Observable<NetworkConfigurationDiagnosticResponseInner> getNetworkConfigurationDiagnosticAsync(String resourceGroupName, String networkWatcherName, NetworkConfigurationDiagnosticParameters parameters) {
return getNetworkConfigurationDiagnosticWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NetworkConfigurationDiagnosticResponseInner>, NetworkConfigurationDiagnosticResponseInner>() {
@Override
public NetworkConfigurationDiagnosticResponseInner call(ServiceResponse<NetworkConfigurationDiagnosticResponseInner> response) {
return response.body();
}
});
} | java | public Observable<NetworkConfigurationDiagnosticResponseInner> getNetworkConfigurationDiagnosticAsync(String resourceGroupName, String networkWatcherName, NetworkConfigurationDiagnosticParameters parameters) {
return getNetworkConfigurationDiagnosticWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).map(new Func1<ServiceResponse<NetworkConfigurationDiagnosticResponseInner>, NetworkConfigurationDiagnosticResponseInner>() {
@Override
public NetworkConfigurationDiagnosticResponseInner call(ServiceResponse<NetworkConfigurationDiagnosticResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NetworkConfigurationDiagnosticResponseInner",
">",
"getNetworkConfigurationDiagnosticAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"NetworkConfigurationDiagnosticParameters",
"parameters",
")",
"{",
"return",
"... | Get network configuration diagnostic.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@param parameters Parameters to get network configuration diagnostic.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Get",
"network",
"configuration",
"diagnostic",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/NetworkWatchersInner.java#L2684-L2691 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/config/ServiceKernel.java | ServiceKernel.defineService | protected <T extends IService, Q extends T> void defineService(Class<? extends T> service, Q defaultImplementation)
{
if( !_definingServices )
{
throw new IllegalStateException( "Service definition must be done only in the defineServices() method." );
}
if( !service.isInterface() )
{
throw new IllegalArgumentException( "Services may only be defined as interfaces, and " +
service.getName() +
" is not an interface" );
}
IService existingServiceImpl = _services.get( service );
if( existingServiceImpl != null )
{
throw new IllegalStateException( "Service " + service.getName() + " has already been " +
"defined with the " + existingServiceImpl.getClass().getName() +
" default implementation");
}
_services.put( service, defaultImplementation );
} | java | protected <T extends IService, Q extends T> void defineService(Class<? extends T> service, Q defaultImplementation)
{
if( !_definingServices )
{
throw new IllegalStateException( "Service definition must be done only in the defineServices() method." );
}
if( !service.isInterface() )
{
throw new IllegalArgumentException( "Services may only be defined as interfaces, and " +
service.getName() +
" is not an interface" );
}
IService existingServiceImpl = _services.get( service );
if( existingServiceImpl != null )
{
throw new IllegalStateException( "Service " + service.getName() + " has already been " +
"defined with the " + existingServiceImpl.getClass().getName() +
" default implementation");
}
_services.put( service, defaultImplementation );
} | [
"protected",
"<",
"T",
"extends",
"IService",
",",
"Q",
"extends",
"T",
">",
"void",
"defineService",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"service",
",",
"Q",
"defaultImplementation",
")",
"{",
"if",
"(",
"!",
"_definingServices",
")",
"{",
"thr... | Defines a service provided by this ServiceKernel
@param service - the service to provide
@param defaultImplementation - the default implementation of this service | [
"Defines",
"a",
"service",
"provided",
"by",
"this",
"ServiceKernel"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/config/ServiceKernel.java#L123-L143 |
xqbase/util | util/src/main/java/com/xqbase/util/Numbers.java | Numbers.parseInt | public static int parseInt(String s, int i) {
if (s == null) {
return i;
}
try {
return Integer.parseInt(s.trim());
} catch (NumberFormatException e) {
return i;
}
} | java | public static int parseInt(String s, int i) {
if (s == null) {
return i;
}
try {
return Integer.parseInt(s.trim());
} catch (NumberFormatException e) {
return i;
}
} | [
"public",
"static",
"int",
"parseInt",
"(",
"String",
"s",
",",
"int",
"i",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"i",
";",
"}",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"s",
".",
"trim",
"(",
")",
")",
";",
... | Parse an <b>int</b> with a given default value <b>i</b>
@return default value if null or not parsable | [
"Parse",
"an",
"<b",
">",
"int<",
"/",
"b",
">",
"with",
"a",
"given",
"default",
"value",
"<b",
">",
"i<",
"/",
"b",
">"
] | train | https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Numbers.java#L29-L38 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java | DatabasesInner.beginExport | public ImportExportOperationResultInner beginExport(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) {
return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body();
} | java | public ImportExportOperationResultInner beginExport(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) {
return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body();
} | [
"public",
"ImportExportOperationResultInner",
"beginExport",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"ImportExportDatabaseDefinition",
"parameters",
")",
"{",
"return",
"beginExportWithServiceResponseAsync",
"(",
"r... | Exports a database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param parameters The database export request parameters.
@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 ImportExportOperationResultInner object if successful. | [
"Exports",
"a",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java#L997-L999 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java | InterceptorMetaDataFactory.addInterceptorProxy | private void addInterceptorProxy
(InterceptorMethodKind kind
, Method m
, int index
, Map<InterceptorMethodKind, InterceptorProxy> classProxies
, Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap) // F743-17763
{
InterceptorProxy proxy = new InterceptorProxy(m, index);
classProxies.put(kind, proxy);
List<InterceptorProxy> proxyList = proxyMap.get(kind);
if (proxyList == null)
{
proxyList = new ArrayList<InterceptorProxy>();
proxyMap.put(kind, proxyList);
}
proxyList.add(proxy);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "adding " + kind + ": " + proxy);
}
} | java | private void addInterceptorProxy
(InterceptorMethodKind kind
, Method m
, int index
, Map<InterceptorMethodKind, InterceptorProxy> classProxies
, Map<InterceptorMethodKind, List<InterceptorProxy>> proxyMap) // F743-17763
{
InterceptorProxy proxy = new InterceptorProxy(m, index);
classProxies.put(kind, proxy);
List<InterceptorProxy> proxyList = proxyMap.get(kind);
if (proxyList == null)
{
proxyList = new ArrayList<InterceptorProxy>();
proxyMap.put(kind, proxyList);
}
proxyList.add(proxy);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, "adding " + kind + ": " + proxy);
}
} | [
"private",
"void",
"addInterceptorProxy",
"(",
"InterceptorMethodKind",
"kind",
",",
"Method",
"m",
",",
"int",
"index",
",",
"Map",
"<",
"InterceptorMethodKind",
",",
"InterceptorProxy",
">",
"classProxies",
",",
"Map",
"<",
"InterceptorMethodKind",
",",
"List",
... | Adds a new interceptor proxy to:
<ul>
<li>the interceptor map for the class currently being processed
<li>the list of all interceptors for the bean
<li>the bean lifecycle methods (if needed)
</ul>
@param kind the interceptor kind
@param m the interceptor method
@param index is the interceptor index into InterceptorMetaData.ivInterceptors array
for locating the instance of interceptorClass that is created for an EJB instance.
Note, a value < 0 must be passed for the EJB class itself
@param classProxies the map of proxies for the class that is currently being processed.
@param proxyMap the map of proxies for the class hierarchy currently being processed. | [
"Adds",
"a",
"new",
"interceptor",
"proxy",
"to",
":",
"<ul",
">",
"<li",
">",
"the",
"interceptor",
"map",
"for",
"the",
"class",
"currently",
"being",
"processed",
"<li",
">",
"the",
"list",
"of",
"all",
"interceptors",
"for",
"the",
"bean",
"<li",
">"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/InterceptorMetaDataFactory.java#L1892-L1914 |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java | RaftServiceContext.keepAlive | public boolean keepAlive(long index, long timestamp, RaftSession session, long commandSequence, long eventIndex) {
// If the service has been deleted, just return false to ignore the keep-alive.
if (deleted) {
return false;
}
// Update the state machine index/timestamp.
tick(index, timestamp);
// The session may have been closed by the time this update was executed on the service thread.
if (session.getState() != Session.State.CLOSED) {
// Update the session's timestamp to prevent it from being expired.
session.setLastUpdated(timestamp);
// Clear results cached in the session.
session.clearResults(commandSequence);
// Resend missing events starting from the last received event index.
session.resendEvents(eventIndex);
// Update the session's request sequence number. The command sequence number will be applied
// iff the existing request sequence number is less than the command sequence number. This must
// be applied to ensure that request sequence numbers are reset after a leader change since leaders
// track request sequence numbers in local memory.
session.resetRequestSequence(commandSequence);
// Update the sessions' command sequence number. The command sequence number will be applied
// iff the existing sequence number is less than the keep-alive command sequence number. This should
// not be the case under normal operation since the command sequence number in keep-alive requests
// represents the highest sequence for which a client has received a response (the command has already
// been completed), but since the log compaction algorithm can exclude individual entries from replication,
// the command sequence number must be applied for keep-alive requests to reset the sequence number in
// the event the last command for the session was cleaned/compacted from the log.
session.setCommandSequence(commandSequence);
// Complete the future.
return true;
} else {
return false;
}
} | java | public boolean keepAlive(long index, long timestamp, RaftSession session, long commandSequence, long eventIndex) {
// If the service has been deleted, just return false to ignore the keep-alive.
if (deleted) {
return false;
}
// Update the state machine index/timestamp.
tick(index, timestamp);
// The session may have been closed by the time this update was executed on the service thread.
if (session.getState() != Session.State.CLOSED) {
// Update the session's timestamp to prevent it from being expired.
session.setLastUpdated(timestamp);
// Clear results cached in the session.
session.clearResults(commandSequence);
// Resend missing events starting from the last received event index.
session.resendEvents(eventIndex);
// Update the session's request sequence number. The command sequence number will be applied
// iff the existing request sequence number is less than the command sequence number. This must
// be applied to ensure that request sequence numbers are reset after a leader change since leaders
// track request sequence numbers in local memory.
session.resetRequestSequence(commandSequence);
// Update the sessions' command sequence number. The command sequence number will be applied
// iff the existing sequence number is less than the keep-alive command sequence number. This should
// not be the case under normal operation since the command sequence number in keep-alive requests
// represents the highest sequence for which a client has received a response (the command has already
// been completed), but since the log compaction algorithm can exclude individual entries from replication,
// the command sequence number must be applied for keep-alive requests to reset the sequence number in
// the event the last command for the session was cleaned/compacted from the log.
session.setCommandSequence(commandSequence);
// Complete the future.
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"keepAlive",
"(",
"long",
"index",
",",
"long",
"timestamp",
",",
"RaftSession",
"session",
",",
"long",
"commandSequence",
",",
"long",
"eventIndex",
")",
"{",
"// If the service has been deleted, just return false to ignore the keep-alive.",
"if",
"... | Keeps the given session alive.
@param index The index of the keep-alive.
@param timestamp The timestamp of the keep-alive.
@param session The session to keep-alive.
@param commandSequence The session command sequence number.
@param eventIndex The session event index. | [
"Keeps",
"the",
"given",
"session",
"alive",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java#L358-L398 |
lucee/Lucee | core/src/main/java/lucee/transformer/util/SourceCode.java | SourceCode.isCurrentBetween | public boolean isCurrentBetween(char left, char right) {
if (!isValidIndex()) return false;
return lcText[pos] >= left && lcText[pos] <= right;
} | java | public boolean isCurrentBetween(char left, char right) {
if (!isValidIndex()) return false;
return lcText[pos] >= left && lcText[pos] <= right;
} | [
"public",
"boolean",
"isCurrentBetween",
"(",
"char",
"left",
",",
"char",
"right",
")",
"{",
"if",
"(",
"!",
"isValidIndex",
"(",
")",
")",
"return",
"false",
";",
"return",
"lcText",
"[",
"pos",
"]",
">=",
"left",
"&&",
"lcText",
"[",
"pos",
"]",
"... | is the character at the current position (internal pointer) in the range of the given input
characters?
@param left lower value.
@param right upper value. | [
"is",
"the",
"character",
"at",
"the",
"current",
"position",
"(",
"internal",
"pointer",
")",
"in",
"the",
"range",
"of",
"the",
"given",
"input",
"characters?"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/util/SourceCode.java#L158-L161 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/BaseJsonBo.java | BaseJsonBo.getSubAttr | public <T> T getSubAttr(String attrName, String dPath, Class<T> clazz) {
Lock lock = lockForRead();
try {
return JacksonUtils.getValue(getAttribute(attrName), dPath, clazz);
} finally {
lock.unlock();
}
} | java | public <T> T getSubAttr(String attrName, String dPath, Class<T> clazz) {
Lock lock = lockForRead();
try {
return JacksonUtils.getValue(getAttribute(attrName), dPath, clazz);
} finally {
lock.unlock();
}
} | [
"public",
"<",
"T",
">",
"T",
"getSubAttr",
"(",
"String",
"attrName",
",",
"String",
"dPath",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"Lock",
"lock",
"=",
"lockForRead",
"(",
")",
";",
"try",
"{",
"return",
"JacksonUtils",
".",
"getValue",
"... | Get a sub-attribute using d-path.
@param attrName
@param dPath
@param clazz
@return
@see DPathUtils | [
"Get",
"a",
"sub",
"-",
"attribute",
"using",
"d",
"-",
"path",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseJsonBo.java#L154-L161 |
mgormley/prim | src/main/java/edu/jhu/prim/sample/PairSampler.java | PairSampler.countUnorderedPairs | public static long countUnorderedPairs(int minI, int maxI, int minJ, int maxJ) {
long maxPairs = 0;
int min = Math.min(minI, minJ);
int max = Math.max(maxI, maxJ);
for (int i=min; i<max; i++) {
for (int j=i; j<max; j++) {
if ((minI <= i && i < maxI && minJ <= j && j < maxJ) ||
(minJ <= i && i < maxJ && minI <= j && j < maxI)) {
maxPairs++;
}
}
}
return maxPairs;
} | java | public static long countUnorderedPairs(int minI, int maxI, int minJ, int maxJ) {
long maxPairs = 0;
int min = Math.min(minI, minJ);
int max = Math.max(maxI, maxJ);
for (int i=min; i<max; i++) {
for (int j=i; j<max; j++) {
if ((minI <= i && i < maxI && minJ <= j && j < maxJ) ||
(minJ <= i && i < maxJ && minI <= j && j < maxI)) {
maxPairs++;
}
}
}
return maxPairs;
} | [
"public",
"static",
"long",
"countUnorderedPairs",
"(",
"int",
"minI",
",",
"int",
"maxI",
",",
"int",
"minJ",
",",
"int",
"maxJ",
")",
"{",
"long",
"maxPairs",
"=",
"0",
";",
"int",
"min",
"=",
"Math",
".",
"min",
"(",
"minI",
",",
"minJ",
")",
";... | Count the number of unordered pairs that satisfy the constraint the
constraints: minI <= i < maxI and minJ <= j < maxJ.
Note that since these are unordered pairs. We can think of this as being
the count of ordered pairs (i,j) s.t. i<=j and either of the following
two conditions holds:
minI <= i < maxI and minJ <= j < maxJ.
minI <= j < maxI and minJ <= i < maxJ.
@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).
@return The number of unordered pairs. | [
"Count",
"the",
"number",
"of",
"unordered",
"pairs",
"that",
"satisfy",
"the",
"constraint",
"the",
"constraints",
":",
"minI",
"<",
"=",
"i",
"<",
"maxI",
"and",
"minJ",
"<",
"=",
"j",
"<",
"maxJ",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/sample/PairSampler.java#L128-L142 |
naver/android-utilset | UtilSet/src/com/navercorp/utilset/ui/ActivityUtils.java | ActivityUtils.isPackageInstalled | public static boolean isPackageInstalled(Context context, String packageName) {
try {
context.getPackageManager().getApplicationInfo(packageName, 0);
return true;
} catch (Exception e) {
return false;
}
} | java | public static boolean isPackageInstalled(Context context, String packageName) {
try {
context.getPackageManager().getApplicationInfo(packageName, 0);
return true;
} catch (Exception e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isPackageInstalled",
"(",
"Context",
"context",
",",
"String",
"packageName",
")",
"{",
"try",
"{",
"context",
".",
"getPackageManager",
"(",
")",
".",
"getApplicationInfo",
"(",
"packageName",
",",
"0",
")",
";",
"return",
"tru... | Checks if a package is installed.
@param context Context to be used to verify the existence of the package.
@param packageName Package name to be searched.
@return true if the package is discovered; false otherwise | [
"Checks",
"if",
"a",
"package",
"is",
"installed",
"."
] | train | https://github.com/naver/android-utilset/blob/4af5f821466bc5bec4ea221ca6d87e0ac9b87e0b/UtilSet/src/com/navercorp/utilset/ui/ActivityUtils.java#L26-L33 |
kohsuke/com4j | runtime/src/main/java/com4j/COM4J.java | COM4J.createInstance | public static<T extends Com4jObject>
T createInstance( Class<T> primaryInterface, String clsid, int clsctx ) throws ComException {
// create instance
return new CreateInstanceTask<T>(clsid,clsctx,primaryInterface).execute();
} | java | public static<T extends Com4jObject>
T createInstance( Class<T> primaryInterface, String clsid, int clsctx ) throws ComException {
// create instance
return new CreateInstanceTask<T>(clsid,clsctx,primaryInterface).execute();
} | [
"public",
"static",
"<",
"T",
"extends",
"Com4jObject",
">",
"T",
"createInstance",
"(",
"Class",
"<",
"T",
">",
"primaryInterface",
",",
"String",
"clsid",
",",
"int",
"clsctx",
")",
"throws",
"ComException",
"{",
"// create instance",
"return",
"new",
"Creat... | Creates a new COM object of the given CLSID and returns
it in a wrapped interface.
<p>
Compared to {@link #createInstance(Class,String)},
this method allows the caller to specify <tt>CLSCTX_XXX</tt>
constants to control the server instantiation.
@param primaryInterface type parameter of the primaryInterface type
@param clsid a string representation of the class id
@param clsctx Normally this is {@link CLSCTX#ALL}, but can be any combination of {@link CLSCTX} constants.
@param <T> the type of the return value and the type parameter of the class object of primaryInterface
@return the new instance of the COM object
@throws ComException if an error occurred in the native COM part
@see CLSCTX | [
"Creates",
"a",
"new",
"COM",
"object",
"of",
"the",
"given",
"CLSID",
"and",
"returns",
"it",
"in",
"a",
"wrapped",
"interface",
"."
] | train | https://github.com/kohsuke/com4j/blob/1e690b805fb0e4e9ef61560e20a56335aecb0b24/runtime/src/main/java/com4j/COM4J.java#L95-L100 |
Bedework/bw-util | bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java | ReqUtil.getReqPar | public String getReqPar(final String name, final String def) {
final String s = Util.checkNull(request.getParameter(name));
if (s != null) {
return s;
}
return def;
} | java | public String getReqPar(final String name, final String def) {
final String s = Util.checkNull(request.getParameter(name));
if (s != null) {
return s;
}
return def;
} | [
"public",
"String",
"getReqPar",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"def",
")",
"{",
"final",
"String",
"s",
"=",
"Util",
".",
"checkNull",
"(",
"request",
".",
"getParameter",
"(",
"name",
")",
")",
";",
"if",
"(",
"s",
"!=",
"n... | Get a request parameter stripped of white space. Return default for null
or zero length.
@param name name of parameter
@param def default value
@return String value | [
"Get",
"a",
"request",
"parameter",
"stripped",
"of",
"white",
"space",
".",
"Return",
"default",
"for",
"null",
"or",
"zero",
"length",
"."
] | train | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet/src/main/java/org/bedework/util/servlet/ReqUtil.java#L98-L106 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java | SftpClient.chown | public void chown(String uid, String path) throws SftpStatusException,
SshException {
String actual = resolveRemotePath(path);
SftpFileAttributes attrs = sftp.getAttributes(actual);
attrs.setUID(uid);
sftp.setAttributes(actual, attrs);
} | java | public void chown(String uid, String path) throws SftpStatusException,
SshException {
String actual = resolveRemotePath(path);
SftpFileAttributes attrs = sftp.getAttributes(actual);
attrs.setUID(uid);
sftp.setAttributes(actual, attrs);
} | [
"public",
"void",
"chown",
"(",
"String",
"uid",
",",
"String",
"path",
")",
"throws",
"SftpStatusException",
",",
"SshException",
"{",
"String",
"actual",
"=",
"resolveRemotePath",
"(",
"path",
")",
";",
"SftpFileAttributes",
"attrs",
"=",
"sftp",
".",
"getAt... | <p>
Sets the user ID to owner for the file or directory.
</p>
@param uid
numeric user id of the new owner
@param path
the path to the remote file/directory
@throws SftpStatusException
@throws SshException
@throws TransferCancelledException | [
"<p",
">",
"Sets",
"the",
"user",
"ID",
"to",
"owner",
"for",
"the",
"file",
"or",
"directory",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L2001-L2009 |
jenkinsci/jenkins | core/src/main/java/hudson/FilePath.java | FilePath.untarFrom | public void untarFrom(InputStream _in, final TarCompression compression) throws IOException, InterruptedException {
try {
final InputStream in = new RemoteInputStream(_in, Flag.GREEDY);
act(new UntarFrom(compression, in));
} finally {
_in.close();
}
} | java | public void untarFrom(InputStream _in, final TarCompression compression) throws IOException, InterruptedException {
try {
final InputStream in = new RemoteInputStream(_in, Flag.GREEDY);
act(new UntarFrom(compression, in));
} finally {
_in.close();
}
} | [
"public",
"void",
"untarFrom",
"(",
"InputStream",
"_in",
",",
"final",
"TarCompression",
"compression",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"try",
"{",
"final",
"InputStream",
"in",
"=",
"new",
"RemoteInputStream",
"(",
"_in",
",",
"... | Reads the given InputStream as a tar file and extracts it into this directory.
@param _in
The stream will be closed by this method after it's fully read.
@param compression
The compression method in use.
@since 1.292 | [
"Reads",
"the",
"given",
"InputStream",
"as",
"a",
"tar",
"file",
"and",
"extracts",
"it",
"into",
"this",
"directory",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L794-L801 |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryChainLogPathHelper.java | RepositoryChainLogPathHelper.getRelativePath | public static String getRelativePath(String path, String backupDirCanonicalPath) throws MalformedURLException
{
URL urlPath = new URL(resolveFileURL("file:" + path));
URL urlBackupDir = new URL(resolveFileURL("file:" + backupDirCanonicalPath));
return urlPath.toString().replace(urlBackupDir.toString() + "/", "");
} | java | public static String getRelativePath(String path, String backupDirCanonicalPath) throws MalformedURLException
{
URL urlPath = new URL(resolveFileURL("file:" + path));
URL urlBackupDir = new URL(resolveFileURL("file:" + backupDirCanonicalPath));
return urlPath.toString().replace(urlBackupDir.toString() + "/", "");
} | [
"public",
"static",
"String",
"getRelativePath",
"(",
"String",
"path",
",",
"String",
"backupDirCanonicalPath",
")",
"throws",
"MalformedURLException",
"{",
"URL",
"urlPath",
"=",
"new",
"URL",
"(",
"resolveFileURL",
"(",
"\"file:\"",
"+",
"path",
")",
")",
";"... | Will be returned relative path {name}/{name}.xml for all OS.
@param path
String, path to
@param backupDirCanonicalPath
String, path to backup dir
@return String
Will be returned relative path {name}/{name}.xml for all OS
@throws MalformedURLException | [
"Will",
"be",
"returned",
"relative",
"path",
"{",
"name",
"}",
"/",
"{",
"name",
"}",
".",
"xml",
"for",
"all",
"OS",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/RepositoryChainLogPathHelper.java#L49-L55 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java | ExtendedSwidProcessor.setProductId | public ExtendedSwidProcessor setProductId(final String... productIdList) {
if (productIdList.length > 0) {
for (String productId : productIdList) {
swidTag.getProductId().add(new Token(productId, idGenerator.nextId()));
}
}
return this;
} | java | public ExtendedSwidProcessor setProductId(final String... productIdList) {
if (productIdList.length > 0) {
for (String productId : productIdList) {
swidTag.getProductId().add(new Token(productId, idGenerator.nextId()));
}
}
return this;
} | [
"public",
"ExtendedSwidProcessor",
"setProductId",
"(",
"final",
"String",
"...",
"productIdList",
")",
"{",
"if",
"(",
"productIdList",
".",
"length",
">",
"0",
")",
"{",
"for",
"(",
"String",
"productId",
":",
"productIdList",
")",
"{",
"swidTag",
".",
"ge... | Defines product identifiers (tag: product_id).
@param productIdList
product identifiers
@return a reference to this object. | [
"Defines",
"product",
"identifiers",
"(",
"tag",
":",
"product_id",
")",
"."
] | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java#L113-L120 |
Qkyrie/Markdown2Pdf | src/main/java/com/qkyrie/markdown2pdf/internal/converting/HtmlCleaner.java | HtmlCleaner.cleanWithOutputEncoding | public String cleanWithOutputEncoding(String input, String outputEncoding) throws ConversionException {
return clean(input, null, outputEncoding);
} | java | public String cleanWithOutputEncoding(String input, String outputEncoding) throws ConversionException {
return clean(input, null, outputEncoding);
} | [
"public",
"String",
"cleanWithOutputEncoding",
"(",
"String",
"input",
",",
"String",
"outputEncoding",
")",
"throws",
"ConversionException",
"{",
"return",
"clean",
"(",
"input",
",",
"null",
",",
"outputEncoding",
")",
";",
"}"
] | Clean-up HTML code with specified output encoding, asumes UTF-8 as input encoding.
@param input
@param outputEncoding
@return
@throws ConversionException | [
"Clean",
"-",
"up",
"HTML",
"code",
"with",
"specified",
"output",
"encoding",
"asumes",
"UTF",
"-",
"8",
"as",
"input",
"encoding",
"."
] | train | https://github.com/Qkyrie/Markdown2Pdf/blob/f89167ddcfad96c64b3371a6dfb1cd11c5bb1b5a/src/main/java/com/qkyrie/markdown2pdf/internal/converting/HtmlCleaner.java#L38-L40 |
mockito/mockito | src/main/java/org/mockito/internal/invocation/InvocationsFinder.java | InvocationsFinder.findMatchingChunk | public static List<Invocation> findMatchingChunk(List<Invocation> invocations, MatchableInvocation wanted, int wantedCount, InOrderContext context) {
List<Invocation> unverified = removeVerifiedInOrder(invocations, context);
List<Invocation> firstChunk = getFirstMatchingChunk(wanted, unverified);
if (wantedCount != firstChunk.size()) {
return findAllMatchingUnverifiedChunks(invocations, wanted, context);
} else {
return firstChunk;
}
} | java | public static List<Invocation> findMatchingChunk(List<Invocation> invocations, MatchableInvocation wanted, int wantedCount, InOrderContext context) {
List<Invocation> unverified = removeVerifiedInOrder(invocations, context);
List<Invocation> firstChunk = getFirstMatchingChunk(wanted, unverified);
if (wantedCount != firstChunk.size()) {
return findAllMatchingUnverifiedChunks(invocations, wanted, context);
} else {
return firstChunk;
}
} | [
"public",
"static",
"List",
"<",
"Invocation",
">",
"findMatchingChunk",
"(",
"List",
"<",
"Invocation",
">",
"invocations",
",",
"MatchableInvocation",
"wanted",
",",
"int",
"wantedCount",
",",
"InOrderContext",
"context",
")",
"{",
"List",
"<",
"Invocation",
"... | some examples how it works:
Given invocations sequence:
1,1,2,1
if wanted is 1 and mode is times(2) then returns
1,1
if wanted is 1 and mode is atLeast() then returns
1,1,1
if wanted is 1 and mode is times(x), where x != 2 then returns
1,1,1 | [
"some",
"examples",
"how",
"it",
"works",
":"
] | train | https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/invocation/InvocationsFinder.java#L47-L56 |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/EntityDocumentBuilder.java | EntityDocumentBuilder.withDescription | public T withDescription(String text, String languageCode) {
withDescription(factory.getMonolingualTextValue(text, languageCode));
return getThis();
} | java | public T withDescription(String text, String languageCode) {
withDescription(factory.getMonolingualTextValue(text, languageCode));
return getThis();
} | [
"public",
"T",
"withDescription",
"(",
"String",
"text",
",",
"String",
"languageCode",
")",
"{",
"withDescription",
"(",
"factory",
".",
"getMonolingualTextValue",
"(",
"text",
",",
"languageCode",
")",
")",
";",
"return",
"getThis",
"(",
")",
";",
"}"
] | Adds an additional description to the constructed document.
@param text
the text of the description
@param languageCode
the language code of the description
@return builder object to continue construction | [
"Adds",
"an",
"additional",
"description",
"to",
"the",
"constructed",
"document",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/EntityDocumentBuilder.java#L149-L152 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/SchemaManager.java | SchemaManager.getTable | public Table getTable(Session session, String name, String schema) {
Table t = null;
if (schema == null) {
t = findSessionTable(session, name, schema);
}
if (t == null) {
schema = session.getSchemaName(schema);
t = findUserTable(session, name, schema);
}
if (t == null) {
if (SqlInvariants.INFORMATION_SCHEMA.equals(schema)
&& database.dbInfo != null) {
t = database.dbInfo.getSystemTable(session, name);
}
}
if (t == null) {
throw Error.error(ErrorCode.X_42501, name);
}
return t;
} | java | public Table getTable(Session session, String name, String schema) {
Table t = null;
if (schema == null) {
t = findSessionTable(session, name, schema);
}
if (t == null) {
schema = session.getSchemaName(schema);
t = findUserTable(session, name, schema);
}
if (t == null) {
if (SqlInvariants.INFORMATION_SCHEMA.equals(schema)
&& database.dbInfo != null) {
t = database.dbInfo.getSystemTable(session, name);
}
}
if (t == null) {
throw Error.error(ErrorCode.X_42501, name);
}
return t;
} | [
"public",
"Table",
"getTable",
"(",
"Session",
"session",
",",
"String",
"name",
",",
"String",
"schema",
")",
"{",
"Table",
"t",
"=",
"null",
";",
"if",
"(",
"schema",
"==",
"null",
")",
"{",
"t",
"=",
"findSessionTable",
"(",
"session",
",",
"name",
... | Returns the specified user-defined table or view visible within the
context of the specified Session, or any system table of the given
name. It excludes any temp tables created in other Sessions.
Throws if the table does not exist in the context. | [
"Returns",
"the",
"specified",
"user",
"-",
"defined",
"table",
"or",
"view",
"visible",
"within",
"the",
"context",
"of",
"the",
"specified",
"Session",
"or",
"any",
"system",
"table",
"of",
"the",
"given",
"name",
".",
"It",
"excludes",
"any",
"temp",
"t... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/SchemaManager.java#L470-L495 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/utils/URIBuilder.java | URIBuilder.queryParameters | public URIBuilder queryParameters( Map<String, String> queryParams )
{
this.queryParams.clear();
this.queryParams.putAll( queryParams );
return this;
} | java | public URIBuilder queryParameters( Map<String, String> queryParams )
{
this.queryParams.clear();
this.queryParams.putAll( queryParams );
return this;
} | [
"public",
"URIBuilder",
"queryParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
")",
"{",
"this",
".",
"queryParams",
".",
"clear",
"(",
")",
";",
"this",
".",
"queryParams",
".",
"putAll",
"(",
"queryParams",
")",
";",
"return",
... | Set the query parameters
@param queryParams The parameters to use in the URI (not url encoded)
@return The builder | [
"Set",
"the",
"query",
"parameters"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/utils/URIBuilder.java#L86-L91 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/collections/TableUtils.java | TableUtils.toColumnKeyFunction | public static <R, C, V> Function<Table.Cell<R, C, V>, C> toColumnKeyFunction() {
return new Function<Table.Cell<R, C, V>, C>() {
@Override
public C apply(final Table.Cell<R, C, V> input) {
return input.getColumnKey();
}
};
} | java | public static <R, C, V> Function<Table.Cell<R, C, V>, C> toColumnKeyFunction() {
return new Function<Table.Cell<R, C, V>, C>() {
@Override
public C apply(final Table.Cell<R, C, V> input) {
return input.getColumnKey();
}
};
} | [
"public",
"static",
"<",
"R",
",",
"C",
",",
"V",
">",
"Function",
"<",
"Table",
".",
"Cell",
"<",
"R",
",",
"C",
",",
"V",
">",
",",
"C",
">",
"toColumnKeyFunction",
"(",
")",
"{",
"return",
"new",
"Function",
"<",
"Table",
".",
"Cell",
"<",
"... | Guava {@link Function} to transform a cell to its column key. | [
"Guava",
"{"
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/TableUtils.java#L120-L127 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/AbstractPropertyReader.java | AbstractPropertyReader.onParseXML | private ClientProperties onParseXML(String propertyFileName, PersistenceUnitMetadata puMetadata)
{
InputStream inStream = puMetadata.getClassLoader().getResourceAsStream(propertyFileName);
if (inStream == null)
{
propertyFileName = KunderaCoreUtils.resolvePath(propertyFileName);
try
{
inStream = new FileInputStream(new File(propertyFileName));
}
catch (FileNotFoundException e)
{
log.warn("File {} not found, Caused by ", propertyFileName);
return null;
}
}
if (inStream != null)
{
xStream = getXStreamObject();
Object o = xStream.fromXML(inStream);
return (ClientProperties) o;
}
return null;
} | java | private ClientProperties onParseXML(String propertyFileName, PersistenceUnitMetadata puMetadata)
{
InputStream inStream = puMetadata.getClassLoader().getResourceAsStream(propertyFileName);
if (inStream == null)
{
propertyFileName = KunderaCoreUtils.resolvePath(propertyFileName);
try
{
inStream = new FileInputStream(new File(propertyFileName));
}
catch (FileNotFoundException e)
{
log.warn("File {} not found, Caused by ", propertyFileName);
return null;
}
}
if (inStream != null)
{
xStream = getXStreamObject();
Object o = xStream.fromXML(inStream);
return (ClientProperties) o;
}
return null;
} | [
"private",
"ClientProperties",
"onParseXML",
"(",
"String",
"propertyFileName",
",",
"PersistenceUnitMetadata",
"puMetadata",
")",
"{",
"InputStream",
"inStream",
"=",
"puMetadata",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"propertyFileName",
")... | If property file is xml.
@param propertyFileName
@param puMetadata
@return | [
"If",
"property",
"file",
"is",
"xml",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/AbstractPropertyReader.java#L96-L122 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java | PackageManagerUtils.getServicePackageInfo | public static PackageInfo getServicePackageInfo(Context context, String targetPackage) throws NameNotFoundException {
PackageManager manager = context.getPackageManager();
return manager.getPackageInfo(targetPackage, PackageManager.GET_SERVICES);
} | java | public static PackageInfo getServicePackageInfo(Context context, String targetPackage) throws NameNotFoundException {
PackageManager manager = context.getPackageManager();
return manager.getPackageInfo(targetPackage, PackageManager.GET_SERVICES);
} | [
"public",
"static",
"PackageInfo",
"getServicePackageInfo",
"(",
"Context",
"context",
",",
"String",
"targetPackage",
")",
"throws",
"NameNotFoundException",
"{",
"PackageManager",
"manager",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"return",
"manager... | Get the {@link android.content.pm.PackageInfo} that contains all service declaration for the context.
@param context the context.
@param targetPackage the target package name.
@return the {@link android.content.pm.PackageInfo}.
@throws NameNotFoundException if no package found. | [
"Get",
"the",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/PackageManagerUtils.java#L176-L179 |
vladmihalcea/flexy-pool | flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java | ReflectionUtils.handleException | private static ReflectionException handleException(String methodName, InvocationTargetException e) {
LOGGER.error("Couldn't invoke method " + methodName, e);
return new ReflectionException(e);
} | java | private static ReflectionException handleException(String methodName, InvocationTargetException e) {
LOGGER.error("Couldn't invoke method " + methodName, e);
return new ReflectionException(e);
} | [
"private",
"static",
"ReflectionException",
"handleException",
"(",
"String",
"methodName",
",",
"InvocationTargetException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Couldn't invoke method \"",
"+",
"methodName",
",",
"e",
")",
";",
"return",
"new",
"Reflecti... | Handle {@link InvocationTargetException} by logging it and rethrown it as a {@link ReflectionException}
@param methodName method name
@param e exception
@return wrapped exception | [
"Handle",
"{",
"@link",
"InvocationTargetException",
"}",
"by",
"logging",
"it",
"and",
"rethrown",
"it",
"as",
"a",
"{",
"@link",
"ReflectionException",
"}"
] | train | https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java#L196-L199 |
grpc/grpc-java | api/src/main/java/io/grpc/InternalLogId.java | InternalLogId.allocate | public static InternalLogId allocate(Class<?> type, @Nullable String details) {
return allocate(getClassName(type), details);
} | java | public static InternalLogId allocate(Class<?> type, @Nullable String details) {
return allocate(getClassName(type), details);
} | [
"public",
"static",
"InternalLogId",
"allocate",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"@",
"Nullable",
"String",
"details",
")",
"{",
"return",
"allocate",
"(",
"getClassName",
"(",
"type",
")",
",",
"details",
")",
";",
"}"
] | Creates a log id.
@param type the "Type" to be used when logging this id. The short name of this class will be
used, or else a default if the class is anonymous.
@param details a short, human readable string that describes the object the id is attached to.
Typically this will be an address or target. | [
"Creates",
"a",
"log",
"id",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/InternalLogId.java#L43-L45 |
carewebframework/carewebframework-core | org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/controller/FrameworkController.java | FrameworkController.getController | @SuppressWarnings("unchecked")
public static <T> T getController(BaseComponent comp, Class<T> type) {
while (comp != null) {
Object controller = getController(comp);
if (type.isInstance(controller)) {
return (T) controller;
}
comp = comp.getParent();
}
return null;
} | java | @SuppressWarnings("unchecked")
public static <T> T getController(BaseComponent comp, Class<T> type) {
while (comp != null) {
Object controller = getController(comp);
if (type.isInstance(controller)) {
return (T) controller;
}
comp = comp.getParent();
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getController",
"(",
"BaseComponent",
"comp",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"while",
"(",
"comp",
"!=",
"null",
")",
"{",
"Object",
"controller"... | Locates and returns a controller of the given type by searching up the component tree
starting at the specified component.
@param <T> The type of controller sought.
@param comp Component for start of search.
@param type The type of controller sought.
@return The controller instance, or null if not found. | [
"Locates",
"and",
"returns",
"a",
"controller",
"of",
"the",
"given",
"type",
"by",
"searching",
"up",
"the",
"component",
"tree",
"starting",
"at",
"the",
"specified",
"component",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/controller/FrameworkController.java#L127-L140 |
google/closure-templates | java/src/com/google/template/soy/passes/PluginResolver.java | PluginResolver.lookupPrintDirective | public SoyPrintDirective lookupPrintDirective(String name, int numArgs, SourceLocation location) {
SoyPrintDirective soyPrintDirective = printDirectives.get(name);
if (soyPrintDirective == null) {
reportMissing(location, "print directive", name, printDirectives.keySet());
soyPrintDirective = createPlaceholderPrintDirective(name, numArgs);
}
checkNumArgs("print directive", soyPrintDirective.getValidArgsSizes(), numArgs, location);
warnIfDeprecated(name, soyPrintDirective, location);
return soyPrintDirective;
} | java | public SoyPrintDirective lookupPrintDirective(String name, int numArgs, SourceLocation location) {
SoyPrintDirective soyPrintDirective = printDirectives.get(name);
if (soyPrintDirective == null) {
reportMissing(location, "print directive", name, printDirectives.keySet());
soyPrintDirective = createPlaceholderPrintDirective(name, numArgs);
}
checkNumArgs("print directive", soyPrintDirective.getValidArgsSizes(), numArgs, location);
warnIfDeprecated(name, soyPrintDirective, location);
return soyPrintDirective;
} | [
"public",
"SoyPrintDirective",
"lookupPrintDirective",
"(",
"String",
"name",
",",
"int",
"numArgs",
",",
"SourceLocation",
"location",
")",
"{",
"SoyPrintDirective",
"soyPrintDirective",
"=",
"printDirectives",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"soyPr... | Returns a print directive with the given name and arity.
<p>An error will be reported according to the current {@link Mode} and a placeholder function
will be returned if it cannot be found. | [
"Returns",
"a",
"print",
"directive",
"with",
"the",
"given",
"name",
"and",
"arity",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/PluginResolver.java#L177-L186 |
phax/ph-oton | ph-oton-security/src/main/java/com/helger/photon/security/usergroup/UserGroupManager.java | UserGroupManager.createNewUserGroup | @Nonnull
public IUserGroup createNewUserGroup (@Nonnull @Nonempty final String sName,
@Nullable final String sDescription,
@Nullable final Map <String, String> aCustomAttrs)
{
// Create user group
final UserGroup aUserGroup = new UserGroup (sName, sDescription, aCustomAttrs);
m_aRWLock.writeLocked ( () -> {
// Store
internalCreateItem (aUserGroup);
});
AuditHelper.onAuditCreateSuccess (UserGroup.OT, aUserGroup.getID (), sName, sDescription, aCustomAttrs);
// Execute callback as the very last action
m_aCallbacks.forEach (aCB -> aCB.onUserGroupCreated (aUserGroup, false));
return aUserGroup;
} | java | @Nonnull
public IUserGroup createNewUserGroup (@Nonnull @Nonempty final String sName,
@Nullable final String sDescription,
@Nullable final Map <String, String> aCustomAttrs)
{
// Create user group
final UserGroup aUserGroup = new UserGroup (sName, sDescription, aCustomAttrs);
m_aRWLock.writeLocked ( () -> {
// Store
internalCreateItem (aUserGroup);
});
AuditHelper.onAuditCreateSuccess (UserGroup.OT, aUserGroup.getID (), sName, sDescription, aCustomAttrs);
// Execute callback as the very last action
m_aCallbacks.forEach (aCB -> aCB.onUserGroupCreated (aUserGroup, false));
return aUserGroup;
} | [
"@",
"Nonnull",
"public",
"IUserGroup",
"createNewUserGroup",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"@",
"Nullable",
"final",
"String",
"sDescription",
",",
"@",
"Nullable",
"final",
"Map",
"<",
"String",
",",
"String",
">",
... | Create a new user group.
@param sName
The name of the user group to create. May neither be
<code>null</code> nor empty.
@param sDescription
The optional description of the user group. May be <code>null</code>
.
@param aCustomAttrs
A set of custom attributes. May be <code>null</code>.
@return The created user group. | [
"Create",
"a",
"new",
"user",
"group",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/usergroup/UserGroupManager.java#L135-L154 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java | ApplicationSession.getSessionAttribute | public Object getSessionAttribute(String key, Object defaultValue)
{
Object attributeValue = this.sessionAttributes.get(key);
if (attributeValue == null)
attributeValue = defaultValue;
return attributeValue;
} | java | public Object getSessionAttribute(String key, Object defaultValue)
{
Object attributeValue = this.sessionAttributes.get(key);
if (attributeValue == null)
attributeValue = defaultValue;
return attributeValue;
} | [
"public",
"Object",
"getSessionAttribute",
"(",
"String",
"key",
",",
"Object",
"defaultValue",
")",
"{",
"Object",
"attributeValue",
"=",
"this",
".",
"sessionAttributes",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"attributeValue",
"==",
"null",
")",
"at... | Get a value from the session attributes map.
@param key a unique string code
@param defaultValue the default value if not found
@return The session attibute or the default value if not found | [
"Get",
"a",
"value",
"from",
"the",
"session",
"attributes",
"map",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java#L264-L270 |
xqbase/util | util-jdk17/src/main/java/com/xqbase/util/Time.java | Time.nextMidnightPlus | public static long nextMidnightPlus(long now, long plus) {
long next = (now + timeZoneOffset) / DAY * DAY - timeZoneOffset;
next += plus;
if (next < now) {
next += DAY;
}
return next;
} | java | public static long nextMidnightPlus(long now, long plus) {
long next = (now + timeZoneOffset) / DAY * DAY - timeZoneOffset;
next += plus;
if (next < now) {
next += DAY;
}
return next;
} | [
"public",
"static",
"long",
"nextMidnightPlus",
"(",
"long",
"now",
",",
"long",
"plus",
")",
"{",
"long",
"next",
"=",
"(",
"now",
"+",
"timeZoneOffset",
")",
"/",
"DAY",
"*",
"DAY",
"-",
"timeZoneOffset",
";",
"next",
"+=",
"plus",
";",
"if",
"(",
... | Get next time (Unix time in milliseconds) in a day<p>
E.g. xqbase.com will backup data every 4:00am, so the next backup will happen at:<p>
<code>nextMidnightPlus(now, 4 * HOUR)</code>
@param now current time (Unix time in milliseconds)
@param plus milliseconds after midnight (12:00am) | [
"Get",
"next",
"time",
"(",
"Unix",
"time",
"in",
"milliseconds",
")",
"in",
"a",
"day<p",
">",
"E",
".",
"g",
".",
"xqbase",
".",
"com",
"will",
"backup",
"data",
"every",
"4",
":",
"00am",
"so",
"the",
"next",
"backup",
"will",
"happen",
"at",
":... | train | https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util-jdk17/src/main/java/com/xqbase/util/Time.java#L133-L140 |
CODAIT/stocator | src/main/java/com/ibm/stocator/fs/common/Utils.java | Utils.closeAll | public static void closeAll(Logger log, java.io.Closeable... closeables) {
for (java.io.Closeable c : closeables) {
if (c != null) {
try {
if (log != null) {
log.debug("Closing {}", c);
}
c.close();
} catch (Exception e) {
if (log != null && log.isDebugEnabled()) {
log.debug("Exception in closing {}", c, e);
}
}
}
}
} | java | public static void closeAll(Logger log, java.io.Closeable... closeables) {
for (java.io.Closeable c : closeables) {
if (c != null) {
try {
if (log != null) {
log.debug("Closing {}", c);
}
c.close();
} catch (Exception e) {
if (log != null && log.isDebugEnabled()) {
log.debug("Exception in closing {}", c, e);
}
}
}
}
} | [
"public",
"static",
"void",
"closeAll",
"(",
"Logger",
"log",
",",
"java",
".",
"io",
".",
"Closeable",
"...",
"closeables",
")",
"{",
"for",
"(",
"java",
".",
"io",
".",
"Closeable",
"c",
":",
"closeables",
")",
"{",
"if",
"(",
"c",
"!=",
"null",
... | Close the Closeable objects and <b>ignore</b> any Exception or null
pointers. (This is the SLF4J equivalent of that in {@code IOUtils}).
@param log the log to log at debug level. Can be null
@param closeables the objects to close | [
"Close",
"the",
"Closeable",
"objects",
"and",
"<b",
">",
"ignore<",
"/",
"b",
">",
"any",
"Exception",
"or",
"null",
"pointers",
".",
"(",
"This",
"is",
"the",
"SLF4J",
"equivalent",
"of",
"that",
"in",
"{",
"@code",
"IOUtils",
"}",
")",
"."
] | train | https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/common/Utils.java#L516-L531 |
dihedron/dihedron-commons | src/main/java/org/dihedron/core/reflection/Types.java | Types.getAsString | public static String getAsString(Type type) {
String result = null;
if(isSimple(type)) {
result = ((Class<?>)type).getCanonicalName();
} else if(isGeneric(type)) {
StringBuilder buffer = new StringBuilder();
// grab the name of the container class (e.g. List, Map...)
ParameterizedType container = (ParameterizedType)type ;
String containerType = ((Class<?>)container.getRawType()).getCanonicalName();
buffer.append(containerType).append("<");
// now grab the names of all generic types (those within <...>)
Type[] generics = container.getActualTypeArguments();
boolean first = true;
for(Type generic : generics) {
String genericType = getAsString(generic);
buffer.append(first ? "" : ", ").append(genericType);
first = false;
}
buffer.append(">");
result = buffer.toString();
}
return result;
} | java | public static String getAsString(Type type) {
String result = null;
if(isSimple(type)) {
result = ((Class<?>)type).getCanonicalName();
} else if(isGeneric(type)) {
StringBuilder buffer = new StringBuilder();
// grab the name of the container class (e.g. List, Map...)
ParameterizedType container = (ParameterizedType)type ;
String containerType = ((Class<?>)container.getRawType()).getCanonicalName();
buffer.append(containerType).append("<");
// now grab the names of all generic types (those within <...>)
Type[] generics = container.getActualTypeArguments();
boolean first = true;
for(Type generic : generics) {
String genericType = getAsString(generic);
buffer.append(first ? "" : ", ").append(genericType);
first = false;
}
buffer.append(">");
result = buffer.toString();
}
return result;
} | [
"public",
"static",
"String",
"getAsString",
"(",
"Type",
"type",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"isSimple",
"(",
"type",
")",
")",
"{",
"result",
"=",
"(",
"(",
"Class",
"<",
"?",
">",
")",
"type",
")",
".",
"getCanonic... | Returns the string representation of a type; all class names are fully
qualified, and generics are properly resolved, including their parameter
types (e.g. Map<String, String>).
@param type
the type to describe.
@return
a textual description of the type (e.g. Map<String, String>). | [
"Returns",
"the",
"string",
"representation",
"of",
"a",
"type",
";",
"all",
"class",
"names",
"are",
"fully",
"qualified",
"and",
"generics",
"are",
"properly",
"resolved",
"including",
"their",
"parameter",
"types",
"(",
"e",
".",
"g",
".",
"Map<",
";",
... | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/reflection/Types.java#L44-L68 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplace.java | CmsWorkplace.updateUserPreferences | public static void updateUserPreferences(CmsObject cms, HttpServletRequest req) {
HttpSession session = req.getSession(false);
if (session == null) {
return;
}
CmsWorkplaceSettings settings = (CmsWorkplaceSettings)session.getAttribute(
CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
if (settings == null) {
return;
}
// keep old synchronize settings
CmsSynchronizeSettings synchronizeSettings = settings.getUserSettings().getSynchronizeSettings();
settings = CmsWorkplace.initWorkplaceSettings(cms, settings, true);
settings.getUserSettings().setSynchronizeSettings(synchronizeSettings);
} | java | public static void updateUserPreferences(CmsObject cms, HttpServletRequest req) {
HttpSession session = req.getSession(false);
if (session == null) {
return;
}
CmsWorkplaceSettings settings = (CmsWorkplaceSettings)session.getAttribute(
CmsWorkplaceManager.SESSION_WORKPLACE_SETTINGS);
if (settings == null) {
return;
}
// keep old synchronize settings
CmsSynchronizeSettings synchronizeSettings = settings.getUserSettings().getSynchronizeSettings();
settings = CmsWorkplace.initWorkplaceSettings(cms, settings, true);
settings.getUserSettings().setSynchronizeSettings(synchronizeSettings);
} | [
"public",
"static",
"void",
"updateUserPreferences",
"(",
"CmsObject",
"cms",
",",
"HttpServletRequest",
"req",
")",
"{",
"HttpSession",
"session",
"=",
"req",
".",
"getSession",
"(",
"false",
")",
";",
"if",
"(",
"session",
"==",
"null",
")",
"{",
"return",... | Updates the user preferences after changes have been made.<p>
@param cms the current cms context
@param req the current http request | [
"Updates",
"the",
"user",
"preferences",
"after",
"changes",
"have",
"been",
"made",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L989-L1004 |
Intel-HLS/GKL | src/main/java/com/intel/gkl/compression/IntelDeflaterFactory.java | IntelDeflaterFactory.makeDeflater | public Deflater makeDeflater(final int compressionLevel, final boolean gzipCompatible) {
if (intelDeflaterSupported) {
if ((compressionLevel == 1 && gzipCompatible) || compressionLevel != 1) {
return new IntelDeflater(compressionLevel, gzipCompatible);
}
}
logger.warn("IntelDeflater is not supported, using Java.util.zip.Deflater");
return new Deflater(compressionLevel, gzipCompatible);
} | java | public Deflater makeDeflater(final int compressionLevel, final boolean gzipCompatible) {
if (intelDeflaterSupported) {
if ((compressionLevel == 1 && gzipCompatible) || compressionLevel != 1) {
return new IntelDeflater(compressionLevel, gzipCompatible);
}
}
logger.warn("IntelDeflater is not supported, using Java.util.zip.Deflater");
return new Deflater(compressionLevel, gzipCompatible);
} | [
"public",
"Deflater",
"makeDeflater",
"(",
"final",
"int",
"compressionLevel",
",",
"final",
"boolean",
"gzipCompatible",
")",
"{",
"if",
"(",
"intelDeflaterSupported",
")",
"{",
"if",
"(",
"(",
"compressionLevel",
"==",
"1",
"&&",
"gzipCompatible",
")",
"||",
... | Returns an IntelDeflater if supported on the platform, otherwise returns a Java Deflater
@param compressionLevel the compression level (0-9)
@param gzipCompatible if true the use GZIP compatible compression
@return a Deflater object | [
"Returns",
"an",
"IntelDeflater",
"if",
"supported",
"on",
"the",
"platform",
"otherwise",
"returns",
"a",
"Java",
"Deflater"
] | train | https://github.com/Intel-HLS/GKL/blob/c071276633f01d8198198fb40df468a0dffb0d41/src/main/java/com/intel/gkl/compression/IntelDeflaterFactory.java#L32-L40 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.