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 |
|---|---|---|---|---|---|---|---|---|---|---|
lamydev/Android-Notification | core/src/zemin/notification/NotificationBoard.java | NotificationBoard.setHeaderMargin | public void setHeaderMargin(int l, int t, int r, int b) {
mHeader.setMargin(l, t, r, b);
} | java | public void setHeaderMargin(int l, int t, int r, int b) {
mHeader.setMargin(l, t, r, b);
} | [
"public",
"void",
"setHeaderMargin",
"(",
"int",
"l",
",",
"int",
"t",
",",
"int",
"r",
",",
"int",
"b",
")",
"{",
"mHeader",
".",
"setMargin",
"(",
"l",
",",
"t",
",",
"r",
",",
"b",
")",
";",
"}"
] | Set the margin of the header.
@param l
@param t
@param r
@param b | [
"Set",
"the",
"margin",
"of",
"the",
"header",
"."
] | train | https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationBoard.java#L556-L558 |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.validateClusterNodeCounts | public static void validateClusterNodeCounts(final Cluster lhs, final Cluster rhs) {
if(!lhs.getNodeIds().equals(rhs.getNodeIds())) {
throw new VoldemortException("Node ids are not the same [ lhs cluster node ids ("
+ lhs.getNodeIds()
+ ") not equal to rhs cluster node ids ("
+ rhs.getNodeIds() + ") ]");
}
} | java | public static void validateClusterNodeCounts(final Cluster lhs, final Cluster rhs) {
if(!lhs.getNodeIds().equals(rhs.getNodeIds())) {
throw new VoldemortException("Node ids are not the same [ lhs cluster node ids ("
+ lhs.getNodeIds()
+ ") not equal to rhs cluster node ids ("
+ rhs.getNodeIds() + ") ]");
}
} | [
"public",
"static",
"void",
"validateClusterNodeCounts",
"(",
"final",
"Cluster",
"lhs",
",",
"final",
"Cluster",
"rhs",
")",
"{",
"if",
"(",
"!",
"lhs",
".",
"getNodeIds",
"(",
")",
".",
"equals",
"(",
"rhs",
".",
"getNodeIds",
"(",
")",
")",
")",
"{"... | Confirms that both clusters have the same number of nodes by comparing
set of node Ids between clusters.
@param lhs
@param rhs | [
"Confirms",
"that",
"both",
"clusters",
"have",
"the",
"same",
"number",
"of",
"nodes",
"by",
"comparing",
"set",
"of",
"node",
"Ids",
"between",
"clusters",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L221-L228 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/GetIntegrationResult.java | GetIntegrationResult.withRequestTemplates | public GetIntegrationResult withRequestTemplates(java.util.Map<String, String> requestTemplates) {
setRequestTemplates(requestTemplates);
return this;
} | java | public GetIntegrationResult withRequestTemplates(java.util.Map<String, String> requestTemplates) {
setRequestTemplates(requestTemplates);
return this;
} | [
"public",
"GetIntegrationResult",
"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/GetIntegrationResult.java#L1219-L1222 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.buildKeyStore | static KeyStore buildKeyStore(X509Certificate[] certChain, PrivateKey key, char[] keyPasswordChars)
throws KeyStoreException, NoSuchAlgorithmException,
CertificateException, IOException {
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null, null);
ks.setKeyEntry(ALIAS, key, keyPasswordChars, certChain);
return ks;
} | java | static KeyStore buildKeyStore(X509Certificate[] certChain, PrivateKey key, char[] keyPasswordChars)
throws KeyStoreException, NoSuchAlgorithmException,
CertificateException, IOException {
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null, null);
ks.setKeyEntry(ALIAS, key, keyPasswordChars, certChain);
return ks;
} | [
"static",
"KeyStore",
"buildKeyStore",
"(",
"X509Certificate",
"[",
"]",
"certChain",
",",
"PrivateKey",
"key",
",",
"char",
"[",
"]",
"keyPasswordChars",
")",
"throws",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
"CertificateException",
",",
"IOExcepti... | Generates a new {@link KeyStore}.
@param certChain a X.509 certificate chain
@param key a PKCS#8 private key
@param keyPasswordChars the password of the {@code keyFile}.
{@code null} if it's not password-protected.
@return generated {@link KeyStore}. | [
"Generates",
"a",
"new",
"{",
"@link",
"KeyStore",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L1035-L1042 |
ModeShape/modeshape | modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/JcrTools.java | JcrTools.printQuery | public QueryResult printQuery( Session session,
String jcrSql2 ) throws RepositoryException {
return printQuery(session, jcrSql2, Query.JCR_SQL2, -1, null);
} | java | public QueryResult printQuery( Session session,
String jcrSql2 ) throws RepositoryException {
return printQuery(session, jcrSql2, Query.JCR_SQL2, -1, null);
} | [
"public",
"QueryResult",
"printQuery",
"(",
"Session",
"session",
",",
"String",
"jcrSql2",
")",
"throws",
"RepositoryException",
"{",
"return",
"printQuery",
"(",
"session",
",",
"jcrSql2",
",",
"Query",
".",
"JCR_SQL2",
",",
"-",
"1",
",",
"null",
")",
";"... | Execute the supplied JCR-SQL2 query and, if printing is enabled, print out the results.
@param session the session
@param jcrSql2 the JCR-SQL2 query
@return the results
@throws RepositoryException | [
"Execute",
"the",
"supplied",
"JCR",
"-",
"SQL2",
"query",
"and",
"if",
"printing",
"is",
"enabled",
"print",
"out",
"the",
"results",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/JcrTools.java#L627-L630 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/ExtendedPropertyUrl.java | ExtendedPropertyUrl.deleteExtendedPropertyUrl | public static MozuUrl deleteExtendedPropertyUrl(String key, String orderId, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/extendedproperties/{key}?updatemode={updateMode}&version={version}");
formatter.formatUrl("key", key);
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteExtendedPropertyUrl(String key, String orderId, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/extendedproperties/{key}?updatemode={updateMode}&version={version}");
formatter.formatUrl("key", key);
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteExtendedPropertyUrl",
"(",
"String",
"key",
",",
"String",
"orderId",
",",
"String",
"updateMode",
",",
"String",
"version",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/orders/{orderId}... | Get Resource Url for DeleteExtendedProperty
@param key The extended property key.
@param orderId Unique identifier of the order.
@param updateMode Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."
@param version Determines whether or not to check versioning of items for concurrency purposes.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteExtendedProperty"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/ExtendedPropertyUrl.java#L96-L104 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/xml/xpath/XPathUtils.java | XPathUtils.buildExpression | private static XPathExpression buildExpression(String xPathExpression, NamespaceContext nsContext)
throws XPathExpressionException {
XPath xpath = createXPathFactory().newXPath();
if (nsContext != null) {
xpath.setNamespaceContext(nsContext);
}
return xpath.compile(xPathExpression);
} | java | private static XPathExpression buildExpression(String xPathExpression, NamespaceContext nsContext)
throws XPathExpressionException {
XPath xpath = createXPathFactory().newXPath();
if (nsContext != null) {
xpath.setNamespaceContext(nsContext);
}
return xpath.compile(xPathExpression);
} | [
"private",
"static",
"XPathExpression",
"buildExpression",
"(",
"String",
"xPathExpression",
",",
"NamespaceContext",
"nsContext",
")",
"throws",
"XPathExpressionException",
"{",
"XPath",
"xpath",
"=",
"createXPathFactory",
"(",
")",
".",
"newXPath",
"(",
")",
";",
... | Construct a xPath expression instance with given expression string and namespace context.
If namespace context is not specified a default context is built from the XML node
that is evaluated against.
@param xPathExpression
@param nsContext
@return
@throws XPathExpressionException | [
"Construct",
"a",
"xPath",
"expression",
"instance",
"with",
"given",
"expression",
"string",
"and",
"namespace",
"context",
".",
"If",
"namespace",
"context",
"is",
"not",
"specified",
"a",
"default",
"context",
"is",
"built",
"from",
"the",
"XML",
"node",
"t... | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/xpath/XPathUtils.java#L269-L278 |
samskivert/samskivert | src/main/java/com/samskivert/util/PropertiesUtil.java | PropertiesUtil.loadAndGet | public static String loadAndGet (String loaderPath, String key)
{
try {
Properties props = ConfigUtil.loadProperties(loaderPath);
return props.getProperty(key);
} catch (IOException ioe) {
return null;
}
} | java | public static String loadAndGet (String loaderPath, String key)
{
try {
Properties props = ConfigUtil.loadProperties(loaderPath);
return props.getProperty(key);
} catch (IOException ioe) {
return null;
}
} | [
"public",
"static",
"String",
"loadAndGet",
"(",
"String",
"loaderPath",
",",
"String",
"key",
")",
"{",
"try",
"{",
"Properties",
"props",
"=",
"ConfigUtil",
".",
"loadProperties",
"(",
"loaderPath",
")",
";",
"return",
"props",
".",
"getProperty",
"(",
"ke... | Like {@link #loadAndGet(File,String)} but obtains the properties data via the classloader.
@return the value of the key in question or null if no such key exists or an error occurred
loading the properties file. | [
"Like",
"{",
"@link",
"#loadAndGet",
"(",
"File",
"String",
")",
"}",
"but",
"obtains",
"the",
"properties",
"data",
"via",
"the",
"classloader",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PropertiesUtil.java#L197-L205 |
derari/cthul | xml/src/main/java/org/cthul/resolve/ResolvingException.java | ResolvingException.throwIf | public <T1 extends Throwable, T2 extends Throwable>
RuntimeException throwIf(Class<T1> t1, Class<T2> t2)
throws T1, T2 {
return throwIf(t1, t2, NULL_EX, NULL_EX);
} | java | public <T1 extends Throwable, T2 extends Throwable>
RuntimeException throwIf(Class<T1> t1, Class<T2> t2)
throws T1, T2 {
return throwIf(t1, t2, NULL_EX, NULL_EX);
} | [
"public",
"<",
"T1",
"extends",
"Throwable",
",",
"T2",
"extends",
"Throwable",
">",
"RuntimeException",
"throwIf",
"(",
"Class",
"<",
"T1",
">",
"t1",
",",
"Class",
"<",
"T2",
">",
"t2",
")",
"throws",
"T1",
",",
"T2",
"{",
"return",
"throwIf",
"(",
... | Throws the {@linkplain #getResolvingCause() cause} if it is one of the
specified types, otherwise returns a
{@linkplain #asRuntimeException() runtime exception}.
@param <T1>
@param <T2>
@param t1
@param t2
@return runtime exception
@throws T1
@throws T2 | [
"Throws",
"the",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/xml/src/main/java/org/cthul/resolve/ResolvingException.java#L245-L249 |
rimerosolutions/ant-git-tasks | src/main/java/com/rimerosolutions/ant/git/GitSettings.java | GitSettings.setIdentity | public void setIdentity(String name, String email) {
if (GitTaskUtils.isNullOrBlankString(name) || GitTaskUtils.isNullOrBlankString(email)) {
throw new IllegalArgumentException("Both the username and password must be provided.");
}
identity = new PersonIdent(name, email);
} | java | public void setIdentity(String name, String email) {
if (GitTaskUtils.isNullOrBlankString(name) || GitTaskUtils.isNullOrBlankString(email)) {
throw new IllegalArgumentException("Both the username and password must be provided.");
}
identity = new PersonIdent(name, email);
} | [
"public",
"void",
"setIdentity",
"(",
"String",
"name",
",",
"String",
"email",
")",
"{",
"if",
"(",
"GitTaskUtils",
".",
"isNullOrBlankString",
"(",
"name",
")",
"||",
"GitTaskUtils",
".",
"isNullOrBlankString",
"(",
"email",
")",
")",
"{",
"throw",
"new",
... | Sets the name and email for the Git commands user
@param name The Git user's name
@param email The Git user's email | [
"Sets",
"the",
"name",
"and",
"email",
"for",
"the",
"Git",
"commands",
"user"
] | train | https://github.com/rimerosolutions/ant-git-tasks/blob/bfb32fe68afe6b9dcfd0a5194497d748ef3e8a6f/src/main/java/com/rimerosolutions/ant/git/GitSettings.java#L52-L58 |
alkacon/opencms-core | src/org/opencms/workflow/CmsDefaultPublishResourceFormatter.java | CmsDefaultPublishResourceFormatter.getOuAwareName | public static String getOuAwareName(CmsObject cms, String name) {
String ou = CmsOrganizationalUnit.getParentFqn(name);
if (ou.equals(cms.getRequestContext().getCurrentUser().getOuFqn())) {
return CmsOrganizationalUnit.getSimpleName(name);
}
return CmsOrganizationalUnit.SEPARATOR + name;
} | java | public static String getOuAwareName(CmsObject cms, String name) {
String ou = CmsOrganizationalUnit.getParentFqn(name);
if (ou.equals(cms.getRequestContext().getCurrentUser().getOuFqn())) {
return CmsOrganizationalUnit.getSimpleName(name);
}
return CmsOrganizationalUnit.SEPARATOR + name;
} | [
"public",
"static",
"String",
"getOuAwareName",
"(",
"CmsObject",
"cms",
",",
"String",
"name",
")",
"{",
"String",
"ou",
"=",
"CmsOrganizationalUnit",
".",
"getParentFqn",
"(",
"name",
")",
";",
"if",
"(",
"ou",
".",
"equals",
"(",
"cms",
".",
"getRequest... | Returns the simple name if the ou is the same as the current user's ou.<p>
@param cms the CMS context
@param name the fully qualified name to check
@return the simple name if the ou is the same as the current user's ou | [
"Returns",
"the",
"simple",
"name",
"if",
"the",
"ou",
"is",
"the",
"same",
"as",
"the",
"current",
"user",
"s",
"ou",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/CmsDefaultPublishResourceFormatter.java#L324-L331 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java | JsonObject.getString | public String getString(String name, String defaultValue) {
JsonValue value = get(name);
return value != null ? value.asString() : defaultValue;
} | java | public String getString(String name, String defaultValue) {
JsonValue value = get(name);
return value != null ? value.asString() : defaultValue;
} | [
"public",
"String",
"getString",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"JsonValue",
"value",
"=",
"get",
"(",
"name",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"value",
".",
"asString",
"(",
")",
":",
"defaultValue",
";",
... | Returns the <code>String</code> value of the member with the specified name in this object. If
this object does not contain a member with this name, the given default value is returned. If
this object contains multiple members with the given name, the last one is picked. If this
member's value does not represent a JSON string, an exception is thrown.
@param name
the name of the member whose value is to be returned
@param defaultValue
the value to be returned if the requested member is missing
@return the value of the last member with the specified name, or the given default value if
this object does not contain a member with that name | [
"Returns",
"the",
"<code",
">",
"String<",
"/",
"code",
">",
"value",
"of",
"the",
"member",
"with",
"the",
"specified",
"name",
"in",
"this",
"object",
".",
"If",
"this",
"object",
"does",
"not",
"contain",
"a",
"member",
"with",
"this",
"name",
"the",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java#L675-L678 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java | MapExtensions.operator_minus | @Pure
public static <K, V> Map<K, V> operator_minus(Map<K, V> left, final Pair<? extends K, ? extends V> right) {
return Maps.filterEntries(left, new Predicate<Entry<K, V>>() {
@Override
public boolean apply(Entry<K, V> input) {
return !Objects.equal(input.getKey(), right.getKey()) || !Objects.equal(input.getValue(), right.getValue());
}
});
} | java | @Pure
public static <K, V> Map<K, V> operator_minus(Map<K, V> left, final Pair<? extends K, ? extends V> right) {
return Maps.filterEntries(left, new Predicate<Entry<K, V>>() {
@Override
public boolean apply(Entry<K, V> input) {
return !Objects.equal(input.getKey(), right.getKey()) || !Objects.equal(input.getValue(), right.getValue());
}
});
} | [
"@",
"Pure",
"public",
"static",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"operator_minus",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"left",
",",
"final",
"Pair",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"right",
"... | Remove the given pair from a given map for obtaining a new map.
<p>
If the given key is inside the map, but is not mapped to the given value, the
map will not be changed.
</p>
<p>
The replied map is a view on the given map. It means that any change
in the original map is reflected to the result of this operation.
</p>
@param <K> type of the map keys.
@param <V> type of the map values.
@param left the map to consider.
@param right the entry (key, value) to remove from the map.
@return an immutable map with the content of the map and with the given entry.
@throws IllegalArgumentException - when the right operand key exists in the left operand.
@since 2.15 | [
"Remove",
"the",
"given",
"pair",
"from",
"a",
"given",
"map",
"for",
"obtaining",
"a",
"new",
"map",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/MapExtensions.java#L275-L283 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.putValue | public void putValue(String name, Token[] tokens) {
if (type == null) {
type = ItemType.MAP;
}
if (!isMappableType()) {
throw new IllegalArgumentException("The type of this item must be 'map' or 'properties'");
}
if (tokensMap == null) {
tokensMap = new LinkedHashMap<>();
}
tokensMap.put(name, tokens);
} | java | public void putValue(String name, Token[] tokens) {
if (type == null) {
type = ItemType.MAP;
}
if (!isMappableType()) {
throw new IllegalArgumentException("The type of this item must be 'map' or 'properties'");
}
if (tokensMap == null) {
tokensMap = new LinkedHashMap<>();
}
tokensMap.put(name, tokens);
} | [
"public",
"void",
"putValue",
"(",
"String",
"name",
",",
"Token",
"[",
"]",
"tokens",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"type",
"=",
"ItemType",
".",
"MAP",
";",
"}",
"if",
"(",
"!",
"isMappableType",
"(",
")",
")",
"{",
"thro... | Puts the specified value with the specified key to this Map type item.
@param name the value name; may be null
@param tokens an array of tokens | [
"Puts",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"to",
"this",
"Map",
"type",
"item",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L250-L261 |
EdwardRaff/JSAT | JSAT/src/jsat/driftdetectors/DDM.java | DDM.setWarningThreshold | public void setWarningThreshold(double warningThreshold)
{
if(warningThreshold <= 0 || Double.isNaN(warningThreshold) || Double.isInfinite(warningThreshold))
throw new IllegalArgumentException("warning threshold must be positive, not " + warningThreshold);
this.warningThreshold = warningThreshold;
} | java | public void setWarningThreshold(double warningThreshold)
{
if(warningThreshold <= 0 || Double.isNaN(warningThreshold) || Double.isInfinite(warningThreshold))
throw new IllegalArgumentException("warning threshold must be positive, not " + warningThreshold);
this.warningThreshold = warningThreshold;
} | [
"public",
"void",
"setWarningThreshold",
"(",
"double",
"warningThreshold",
")",
"{",
"if",
"(",
"warningThreshold",
"<=",
"0",
"||",
"Double",
".",
"isNaN",
"(",
"warningThreshold",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"warningThreshold",
")",
")",
"t... | Sets the multiplier on the standard deviation that must be exceeded to
initiate a warning state. Once in the warning state, DDM will begin to
collect a history of the inputs <br>
Increasing the warning threshold makes it take longer to start detecting
a change, but reduces false positives. <br>
If the warning threshold is set above the
{@link #setDriftThreshold(double) }, the drift state will not occur until
the warning state is reached, and the warning state will be skipped.
@param warningThreshold the positive multiplier threshold for starting a
warning state | [
"Sets",
"the",
"multiplier",
"on",
"the",
"standard",
"deviation",
"that",
"must",
"be",
"exceeded",
"to",
"initiate",
"a",
"warning",
"state",
".",
"Once",
"in",
"the",
"warning",
"state",
"DDM",
"will",
"begin",
"to",
"collect",
"a",
"history",
"of",
"th... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/driftdetectors/DDM.java#L152-L157 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java | MethodFinder.findMatchingMethod | public static Method findMatchingMethod(Method originalMethod, String methodName) {
Class<?> originalClass = originalMethod.getDeclaringClass();
return AccessController.doPrivileged(new PrivilegedAction<Method>() {
@Override
public Method run() {
return findMatchingMethod(originalMethod, methodName, originalClass, new ResolutionContext(), originalClass);
}
});
} | java | public static Method findMatchingMethod(Method originalMethod, String methodName) {
Class<?> originalClass = originalMethod.getDeclaringClass();
return AccessController.doPrivileged(new PrivilegedAction<Method>() {
@Override
public Method run() {
return findMatchingMethod(originalMethod, methodName, originalClass, new ResolutionContext(), originalClass);
}
});
} | [
"public",
"static",
"Method",
"findMatchingMethod",
"(",
"Method",
"originalMethod",
",",
"String",
"methodName",
")",
"{",
"Class",
"<",
"?",
">",
"originalClass",
"=",
"originalMethod",
".",
"getDeclaringClass",
"(",
")",
";",
"return",
"AccessController",
".",
... | Recursively search the class hierarchy of the class which declares {@code originalMethod} to find a method named {@code methodName} with the same signature as
{@code originalMethod}
@return The matching method, or {@code null} if one could not be found | [
"Recursively",
"search",
"the",
"class",
"hierarchy",
"of",
"the",
"class",
"which",
"declares",
"{",
"@code",
"originalMethod",
"}",
"to",
"find",
"a",
"method",
"named",
"{",
"@code",
"methodName",
"}",
"with",
"the",
"same",
"signature",
"as",
"{",
"@code... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java#L40-L49 |
playn/playn | scene/src/playn/scene/LayerUtil.java | LayerUtil.layerToParent | public static Point layerToParent(Layer layer, Layer parent, XY point, Point into) {
into.set(point);
while (layer != parent) {
if (layer == null) {
throw new IllegalArgumentException(
"Failed to find parent, perhaps you passed parent, layer instead of "
+ "layer, parent?");
}
into.x -= layer.originX();
into.y -= layer.originY();
layer.transform().transform(into, into);
layer = layer.parent();
}
return into;
} | java | public static Point layerToParent(Layer layer, Layer parent, XY point, Point into) {
into.set(point);
while (layer != parent) {
if (layer == null) {
throw new IllegalArgumentException(
"Failed to find parent, perhaps you passed parent, layer instead of "
+ "layer, parent?");
}
into.x -= layer.originX();
into.y -= layer.originY();
layer.transform().transform(into, into);
layer = layer.parent();
}
return into;
} | [
"public",
"static",
"Point",
"layerToParent",
"(",
"Layer",
"layer",
",",
"Layer",
"parent",
",",
"XY",
"point",
",",
"Point",
"into",
")",
"{",
"into",
".",
"set",
"(",
"point",
")",
";",
"while",
"(",
"layer",
"!=",
"parent",
")",
"{",
"if",
"(",
... | Converts the supplied point from coordinates relative to the specified
child layer to coordinates relative to the specified parent layer. The
results are stored into {@code into}, which is returned for convenience. | [
"Converts",
"the",
"supplied",
"point",
"from",
"coordinates",
"relative",
"to",
"the",
"specified",
"child",
"layer",
"to",
"coordinates",
"relative",
"to",
"the",
"specified",
"parent",
"layer",
".",
"The",
"results",
"are",
"stored",
"into",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L54-L68 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/CommitsApi.java | CommitsApi.addComment | public Comment addComment(Object projectIdOrPath, String sha, String note, String path, Integer line, LineType lineType) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("note", note, true)
.withParam("path", path)
.withParam("line", line)
.withParam("line_type", lineType);
Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha, "comments");
return (response.readEntity(Comment.class));
} | java | public Comment addComment(Object projectIdOrPath, String sha, String note, String path, Integer line, LineType lineType) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("note", note, true)
.withParam("path", path)
.withParam("line", line)
.withParam("line_type", lineType);
Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha, "comments");
return (response.readEntity(Comment.class));
} | [
"public",
"Comment",
"addComment",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"sha",
",",
"String",
"note",
",",
"String",
"path",
",",
"Integer",
"line",
",",
"LineType",
"lineType",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"... | Add a comment to a commit. In order to post a comment in a particular line of a particular file,
you must specify the full commit SHA, the path, the line and lineType should be NEW.
<pre><code>GitLab Endpoint: POST /projects/:id/repository/commits/:sha/comments</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param sha a commit hash or name of a branch or tag
@param note the text of the comment, required
@param path the file path relative to the repository, optional
@param line the line number where the comment should be placed, optional
@param lineType the line type, optional
@return a Comment instance for the posted comment
@throws GitLabApiException GitLabApiException if any exception occurs during execution | [
"Add",
"a",
"comment",
"to",
"a",
"commit",
".",
"In",
"order",
"to",
"post",
"a",
"comment",
"in",
"a",
"particular",
"line",
"of",
"a",
"particular",
"file",
"you",
"must",
"specify",
"the",
"full",
"commit",
"SHA",
"the",
"path",
"the",
"line",
"and... | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/CommitsApi.java#L526-L534 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cdn_dedicated_serviceName_cacheRule_duration_POST | public OvhOrder cdn_dedicated_serviceName_cacheRule_duration_POST(String serviceName, String duration, OvhOrderCacheRuleEnum cacheRule) throws IOException {
String qPath = "/order/cdn/dedicated/{serviceName}/cacheRule/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cacheRule", cacheRule);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder cdn_dedicated_serviceName_cacheRule_duration_POST(String serviceName, String duration, OvhOrderCacheRuleEnum cacheRule) throws IOException {
String qPath = "/order/cdn/dedicated/{serviceName}/cacheRule/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cacheRule", cacheRule);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"cdn_dedicated_serviceName_cacheRule_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhOrderCacheRuleEnum",
"cacheRule",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cdn/dedicated/{serviceName}/cacheR... | Create order
REST: POST /order/cdn/dedicated/{serviceName}/cacheRule/{duration}
@param cacheRule [required] cache rule upgrade option to 100 or 1000
@param serviceName [required] The internal name of your CDN offer
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5293-L5300 |
nutzam/nutzboot | nutzboot-starter/nutzboot-starter-fastdfs/src/main/java/org/nutz/boot/starter/fastdfs/FastdfsService.java | FastdfsService.getFileName | private String getFileName(int type, String tokenFilename) {
StringBuilder sb = new StringBuilder();
String filename = tokenFilename.substring(0, tokenFilename.indexOf(EXT_SEPERATOR));
String ext = tokenFilename.substring(tokenFilename.indexOf(EXT_SEPERATOR));
sb.append(filename);
switch (type) {
case 1:
sb.append(IMAGE_WATERMARK_SUFFIX);
break;
case 2:
sb.append(IMAGE_THUMB_SUFFIX);
break;
}
sb.append(ext);
return sb.toString();
} | java | private String getFileName(int type, String tokenFilename) {
StringBuilder sb = new StringBuilder();
String filename = tokenFilename.substring(0, tokenFilename.indexOf(EXT_SEPERATOR));
String ext = tokenFilename.substring(tokenFilename.indexOf(EXT_SEPERATOR));
sb.append(filename);
switch (type) {
case 1:
sb.append(IMAGE_WATERMARK_SUFFIX);
break;
case 2:
sb.append(IMAGE_THUMB_SUFFIX);
break;
}
sb.append(ext);
return sb.toString();
} | [
"private",
"String",
"getFileName",
"(",
"int",
"type",
",",
"String",
"tokenFilename",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"filename",
"=",
"tokenFilename",
".",
"substring",
"(",
"0",
",",
"tokenFilename",
... | 获取文件名
@param type 0-原图 1水印图 2缩略图
@param tokenFilename 文件名
@return | [
"获取文件名"
] | train | https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-starter/nutzboot-starter-fastdfs/src/main/java/org/nutz/boot/starter/fastdfs/FastdfsService.java#L174-L189 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.getAvailEntry | private static AvailEntry getAvailEntry(String key, ClassLoader loader) {
return GET_AVAILABLE_CACHE.getInstance(key, loader);
} | java | private static AvailEntry getAvailEntry(String key, ClassLoader loader) {
return GET_AVAILABLE_CACHE.getInstance(key, loader);
} | [
"private",
"static",
"AvailEntry",
"getAvailEntry",
"(",
"String",
"key",
",",
"ClassLoader",
"loader",
")",
"{",
"return",
"GET_AVAILABLE_CACHE",
".",
"getInstance",
"(",
"key",
",",
"loader",
")",
";",
"}"
] | Stores the locale information in a cache accessed by key (bundle prefix).
The cached objects are AvailEntries. The cache is implemented by SoftCache
so it can be GC'd. | [
"Stores",
"the",
"locale",
"information",
"in",
"a",
"cache",
"accessed",
"by",
"key",
"(",
"bundle",
"prefix",
")",
".",
"The",
"cached",
"objects",
"are",
"AvailEntries",
".",
"The",
"cache",
"is",
"implemented",
"by",
"SoftCache",
"so",
"it",
"can",
"be... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L798-L800 |
jnr/jnr-x86asm | src/main/java/jnr/x86asm/SerializerIntrinsics.java | SerializerIntrinsics.pcmpistri | public final void pcmpistri(XMMRegister dst, XMMRegister src, Immediate imm8)
{
emitX86(INST_PCMPISTRI, dst, src, imm8);
} | java | public final void pcmpistri(XMMRegister dst, XMMRegister src, Immediate imm8)
{
emitX86(INST_PCMPISTRI, dst, src, imm8);
} | [
"public",
"final",
"void",
"pcmpistri",
"(",
"XMMRegister",
"dst",
",",
"XMMRegister",
"src",
",",
"Immediate",
"imm8",
")",
"{",
"emitX86",
"(",
"INST_PCMPISTRI",
",",
"dst",
",",
"src",
",",
"imm8",
")",
";",
"}"
] | Packed Compare Implicit Length Strings, Return Index (SSE4.2). | [
"Packed",
"Compare",
"Implicit",
"Length",
"Strings",
"Return",
"Index",
"(",
"SSE4",
".",
"2",
")",
"."
] | train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/SerializerIntrinsics.java#L6551-L6554 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/JobHistory.java | JobHistory.parseHistoryFromFS | public static void parseHistoryFromFS(String path, Listener l, FileSystem fs)
throws IOException{
FSDataInputStream in = fs.open(new Path(path));
BufferedReader reader = new BufferedReader(new InputStreamReader (in));
try {
String line = null;
StringBuffer buf = new StringBuffer();
// Read the meta-info line. Note that this might a jobinfo line for files
// written with older format
line = reader.readLine();
// Check if the file is empty
if (line == null) {
return;
}
// Get the information required for further processing
MetaInfoManager mgr = new MetaInfoManager(line);
boolean isEscaped = mgr.isValueEscaped();
String lineDelim = String.valueOf(mgr.getLineDelim());
String escapedLineDelim =
StringUtils.escapeString(lineDelim, StringUtils.ESCAPE_CHAR,
mgr.getLineDelim());
do {
buf.append(line);
if (!line.trim().endsWith(lineDelim)
|| line.trim().endsWith(escapedLineDelim)) {
buf.append("\n");
continue;
}
parseLine(buf.toString(), l, isEscaped);
buf = new StringBuffer();
} while ((line = reader.readLine())!= null);
} finally {
try { reader.close(); } catch (IOException ex) {}
}
} | java | public static void parseHistoryFromFS(String path, Listener l, FileSystem fs)
throws IOException{
FSDataInputStream in = fs.open(new Path(path));
BufferedReader reader = new BufferedReader(new InputStreamReader (in));
try {
String line = null;
StringBuffer buf = new StringBuffer();
// Read the meta-info line. Note that this might a jobinfo line for files
// written with older format
line = reader.readLine();
// Check if the file is empty
if (line == null) {
return;
}
// Get the information required for further processing
MetaInfoManager mgr = new MetaInfoManager(line);
boolean isEscaped = mgr.isValueEscaped();
String lineDelim = String.valueOf(mgr.getLineDelim());
String escapedLineDelim =
StringUtils.escapeString(lineDelim, StringUtils.ESCAPE_CHAR,
mgr.getLineDelim());
do {
buf.append(line);
if (!line.trim().endsWith(lineDelim)
|| line.trim().endsWith(escapedLineDelim)) {
buf.append("\n");
continue;
}
parseLine(buf.toString(), l, isEscaped);
buf = new StringBuffer();
} while ((line = reader.readLine())!= null);
} finally {
try { reader.close(); } catch (IOException ex) {}
}
} | [
"public",
"static",
"void",
"parseHistoryFromFS",
"(",
"String",
"path",
",",
"Listener",
"l",
",",
"FileSystem",
"fs",
")",
"throws",
"IOException",
"{",
"FSDataInputStream",
"in",
"=",
"fs",
".",
"open",
"(",
"new",
"Path",
"(",
"path",
")",
")",
";",
... | Parses history file and invokes Listener.handle() for
each line of history. It can be used for looking through history
files for specific items without having to keep whole history in memory.
@param path path to history file
@param l Listener for history events
@param fs FileSystem where history file is present
@throws IOException | [
"Parses",
"history",
"file",
"and",
"invokes",
"Listener",
".",
"handle",
"()",
"for",
"each",
"line",
"of",
"history",
".",
"It",
"can",
"be",
"used",
"for",
"looking",
"through",
"history",
"files",
"for",
"specific",
"items",
"without",
"having",
"to",
... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobHistory.java#L573-L611 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.getAccountTransactions | public Transactions getAccountTransactions(final String accountCode, final TransactionState state, final TransactionType type, final QueryParams params) {
if (state != null) params.put("state", state.getType());
if (type != null) params.put("type", type.getType());
return doGET(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Transactions.TRANSACTIONS_RESOURCE,
Transactions.class, params);
} | java | public Transactions getAccountTransactions(final String accountCode, final TransactionState state, final TransactionType type, final QueryParams params) {
if (state != null) params.put("state", state.getType());
if (type != null) params.put("type", type.getType());
return doGET(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Transactions.TRANSACTIONS_RESOURCE,
Transactions.class, params);
} | [
"public",
"Transactions",
"getAccountTransactions",
"(",
"final",
"String",
"accountCode",
",",
"final",
"TransactionState",
"state",
",",
"final",
"TransactionType",
"type",
",",
"final",
"QueryParams",
"params",
")",
"{",
"if",
"(",
"state",
"!=",
"null",
")",
... | Lookup an account's transactions history given query params
<p>
Returns the account's transaction history
@param accountCode recurly account id
@param state {@link TransactionState}
@param type {@link TransactionType}
@param params {@link QueryParams}
@return the transaction history associated with this account on success, null otherwise | [
"Lookup",
"an",
"account",
"s",
"transactions",
"history",
"given",
"query",
"params",
"<p",
">",
"Returns",
"the",
"account",
"s",
"transaction",
"history"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L879-L885 |
Erudika/para | para-core/src/main/java/com/erudika/para/utils/Utils.java | Utils.abbreviateInt | public static String abbreviateInt(Number number, int decPlaces) {
if (number == null) {
return "";
}
String abbrevn = number.toString();
// 2 decimal places => 100, 3 => 1000, etc
decPlaces = (int) Math.pow(10, decPlaces);
// Enumerate number abbreviations
String[] abbrev = {"K", "M", "B", "T"};
boolean done = false;
// Go through the array backwards, so we do the largest first
for (int i = abbrev.length - 1; i >= 0 && !done; i--) {
// Convert array index to "1000", "1000000", etc
int size = (int) Math.pow(10, (double) (i + 1) * 3);
// If the number is bigger or equal do the abbreviation
if (size <= number.intValue()) {
// Here, we multiply by decPlaces, round, and then divide by decPlaces.
// This gives us nice rounding to a particular decimal place.
number = Math.round(number.intValue() * decPlaces / (float) size) / decPlaces;
// Add the letter for the abbreviation
abbrevn = number + abbrev[i];
// We are done... stop
done = true;
}
}
return abbrevn;
} | java | public static String abbreviateInt(Number number, int decPlaces) {
if (number == null) {
return "";
}
String abbrevn = number.toString();
// 2 decimal places => 100, 3 => 1000, etc
decPlaces = (int) Math.pow(10, decPlaces);
// Enumerate number abbreviations
String[] abbrev = {"K", "M", "B", "T"};
boolean done = false;
// Go through the array backwards, so we do the largest first
for (int i = abbrev.length - 1; i >= 0 && !done; i--) {
// Convert array index to "1000", "1000000", etc
int size = (int) Math.pow(10, (double) (i + 1) * 3);
// If the number is bigger or equal do the abbreviation
if (size <= number.intValue()) {
// Here, we multiply by decPlaces, round, and then divide by decPlaces.
// This gives us nice rounding to a particular decimal place.
number = Math.round(number.intValue() * decPlaces / (float) size) / decPlaces;
// Add the letter for the abbreviation
abbrevn = number + abbrev[i];
// We are done... stop
done = true;
}
}
return abbrevn;
} | [
"public",
"static",
"String",
"abbreviateInt",
"(",
"Number",
"number",
",",
"int",
"decPlaces",
")",
"{",
"if",
"(",
"number",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"String",
"abbrevn",
"=",
"number",
".",
"toString",
"(",
")",
";",
"// ... | Abbreviates an integer by adding a letter suffix at the end.
E.g. "M" for millions, "K" for thousands, etc.
@param number a big integer
@param decPlaces decimal places
@return the rounded integer as a string | [
"Abbreviates",
"an",
"integer",
"by",
"adding",
"a",
"letter",
"suffix",
"at",
"the",
"end",
".",
"E",
".",
"g",
".",
"M",
"for",
"millions",
"K",
"for",
"thousands",
"etc",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/utils/Utils.java#L561-L587 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/XMLUtils.java | XMLUtils.escapeXML | public static String escapeXML(final char[] chars, final int offset, final int length) {
final StringBuilder escaped = new StringBuilder();
final int end = offset + length;
for (int i = offset; i < end; ++i) {
final char c = chars[i];
switch (c) {
case '\'':
escaped.append("'");
break;
case '\"':
escaped.append(""");
break;
case '<':
escaped.append("<");
break;
case '>':
escaped.append(">");
break;
case '&':
escaped.append("&");
break;
default:
escaped.append(c);
}
}
return escaped.toString();
} | java | public static String escapeXML(final char[] chars, final int offset, final int length) {
final StringBuilder escaped = new StringBuilder();
final int end = offset + length;
for (int i = offset; i < end; ++i) {
final char c = chars[i];
switch (c) {
case '\'':
escaped.append("'");
break;
case '\"':
escaped.append(""");
break;
case '<':
escaped.append("<");
break;
case '>':
escaped.append(">");
break;
case '&':
escaped.append("&");
break;
default:
escaped.append(c);
}
}
return escaped.toString();
} | [
"public",
"static",
"String",
"escapeXML",
"(",
"final",
"char",
"[",
"]",
"chars",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"length",
")",
"{",
"final",
"StringBuilder",
"escaped",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"int",
"... | Escape XML characters.
@param chars char arrays
@param offset start position
@param length arrays lenth
@return escaped value | [
"Escape",
"XML",
"characters",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/XMLUtils.java#L650-L679 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/helper/BaseAdsServiceClientFactoryHelper.java | BaseAdsServiceClientFactoryHelper.createAdsServiceClient | @Override
public C createAdsServiceClient(D adsServiceDescriptor, S adsSession) throws ServiceException {
Object soapClient = createSoapClient(adsServiceDescriptor);
C adsServiceClient = createServiceClient(soapClient, adsServiceDescriptor, adsSession);
try {
adsServiceClient.setEndpointAddress(adsServiceDescriptor.getEndpointAddress(adsSession
.getEndpoint()));
} catch (MalformedURLException e) {
throw new ServiceException("Unexpected exception", e);
}
return adsServiceClient;
} | java | @Override
public C createAdsServiceClient(D adsServiceDescriptor, S adsSession) throws ServiceException {
Object soapClient = createSoapClient(adsServiceDescriptor);
C adsServiceClient = createServiceClient(soapClient, adsServiceDescriptor, adsSession);
try {
adsServiceClient.setEndpointAddress(adsServiceDescriptor.getEndpointAddress(adsSession
.getEndpoint()));
} catch (MalformedURLException e) {
throw new ServiceException("Unexpected exception", e);
}
return adsServiceClient;
} | [
"@",
"Override",
"public",
"C",
"createAdsServiceClient",
"(",
"D",
"adsServiceDescriptor",
",",
"S",
"adsSession",
")",
"throws",
"ServiceException",
"{",
"Object",
"soapClient",
"=",
"createSoapClient",
"(",
"adsServiceDescriptor",
")",
";",
"C",
"adsServiceClient",... | Creates an {@link AdsServiceClient} given an {@link AdsServiceDescriptor}
descriptor and an {@link AdsSession}.
@param adsServiceDescriptor descriptor with information on ads service
@param adsSession the session associated with the desired
client
@return the created {@link AdsServiceClient}
@throws ServiceException if the ads service client could not be created | [
"Creates",
"an",
"{",
"@link",
"AdsServiceClient",
"}",
"given",
"an",
"{",
"@link",
"AdsServiceDescriptor",
"}",
"descriptor",
"and",
"an",
"{",
"@link",
"AdsSession",
"}",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/factory/helper/BaseAdsServiceClientFactoryHelper.java#L68-L79 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.removeAttachment | public ApiSuccessResponse removeAttachment(String mediatype, String id, String documentId, RemoveAttachmentData removeAttachmentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = removeAttachmentWithHttpInfo(mediatype, id, documentId, removeAttachmentData);
return resp.getData();
} | java | public ApiSuccessResponse removeAttachment(String mediatype, String id, String documentId, RemoveAttachmentData removeAttachmentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = removeAttachmentWithHttpInfo(mediatype, id, documentId, removeAttachmentData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"removeAttachment",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"String",
"documentId",
",",
"RemoveAttachmentData",
"removeAttachmentData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"res... | Remove the attachment of the open-media interaction
Remove the attachment of the interaction specified in the documentId path parameter
@param mediatype media-type of interaction to remove attachment (required)
@param id id of interaction (required)
@param documentId id of document to remove (required)
@param removeAttachmentData (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Remove",
"the",
"attachment",
"of",
"the",
"open",
"-",
"media",
"interaction",
"Remove",
"the",
"attachment",
"of",
"the",
"interaction",
"specified",
"in",
"the",
"documentId",
"path",
"parameter"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L3781-L3784 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/backend/executor/AbstractMBeanServerExecutor.java | AbstractMBeanServerExecutor.registerForMBeanNotifications | protected void registerForMBeanNotifications() {
Set<MBeanServerConnection> servers = getMBeanServers();
Exception lastExp = null;
StringBuilder errors = new StringBuilder();
for (MBeanServerConnection server : servers) {
try {
JmxUtil.addMBeanRegistrationListener(server,this,null);
} catch (IllegalStateException e) {
lastExp = updateErrorMsg(errors,e);
}
}
if (lastExp != null) {
throw new IllegalStateException(errors.substring(0,errors.length()-1),lastExp);
}
} | java | protected void registerForMBeanNotifications() {
Set<MBeanServerConnection> servers = getMBeanServers();
Exception lastExp = null;
StringBuilder errors = new StringBuilder();
for (MBeanServerConnection server : servers) {
try {
JmxUtil.addMBeanRegistrationListener(server,this,null);
} catch (IllegalStateException e) {
lastExp = updateErrorMsg(errors,e);
}
}
if (lastExp != null) {
throw new IllegalStateException(errors.substring(0,errors.length()-1),lastExp);
}
} | [
"protected",
"void",
"registerForMBeanNotifications",
"(",
")",
"{",
"Set",
"<",
"MBeanServerConnection",
">",
"servers",
"=",
"getMBeanServers",
"(",
")",
";",
"Exception",
"lastExp",
"=",
"null",
";",
"StringBuilder",
"errors",
"=",
"new",
"StringBuilder",
"(",
... | Add this executor as listener for MBeanServer notification so that we can update
the local timestamp for when the set of registered MBeans has changed last. | [
"Add",
"this",
"executor",
"as",
"listener",
"for",
"MBeanServer",
"notification",
"so",
"that",
"we",
"can",
"update",
"the",
"local",
"timestamp",
"for",
"when",
"the",
"set",
"of",
"registered",
"MBeans",
"has",
"changed",
"last",
"."
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/backend/executor/AbstractMBeanServerExecutor.java#L122-L136 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_number_serviceName_PUT | public void billingAccount_number_serviceName_PUT(String billingAccount, String serviceName, OvhNumber body) throws IOException {
String qPath = "/telephony/{billingAccount}/number/{serviceName}";
StringBuilder sb = path(qPath, billingAccount, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_number_serviceName_PUT(String billingAccount, String serviceName, OvhNumber body) throws IOException {
String qPath = "/telephony/{billingAccount}/number/{serviceName}";
StringBuilder sb = path(qPath, billingAccount, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_number_serviceName_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"OvhNumber",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/number/{serviceName}\"",
";",
"Strin... | Alter this object properties
REST: PUT /telephony/{billingAccount}/number/{serviceName}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] Name of the service | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5666-L5670 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.naturalTime | @Expose
public static String naturalTime(final Date duration, final Locale locale)
{
return naturalTime(new Date(), duration, locale);
} | java | @Expose
public static String naturalTime(final Date duration, final Locale locale)
{
return naturalTime(new Date(), duration, locale);
} | [
"@",
"Expose",
"public",
"static",
"String",
"naturalTime",
"(",
"final",
"Date",
"duration",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"naturalTime",
"(",
"new",
"Date",
"(",
")",
",",
"duration",
",",
"locale",
")",
";",
"}"
] | Same as {@link #naturalTime(Date)} for the specified locale.
@param duration
The duration
@param locale
The locale
@return String representing the relative date | [
"Same",
"as",
"{",
"@link",
"#naturalTime",
"(",
"Date",
")",
"}",
"for",
"the",
"specified",
"locale",
"."
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L1666-L1670 |
haifengl/smile | core/src/main/java/smile/association/TotalSupportTree.java | TotalSupportTree.getSupport | private int getSupport(int[] itemset, int index, Node node) {
int item = order[itemset[index]];
Node child = node.children[item];
if (child != null) {
// If the index is 0, then this is the last element (i.e the
// input is a 1 itemset) and therefore item set found
if (index == 0) {
return child.support;
} else {
if (child.children != null) {
return getSupport(itemset, index - 1, child);
}
}
}
return 0;
} | java | private int getSupport(int[] itemset, int index, Node node) {
int item = order[itemset[index]];
Node child = node.children[item];
if (child != null) {
// If the index is 0, then this is the last element (i.e the
// input is a 1 itemset) and therefore item set found
if (index == 0) {
return child.support;
} else {
if (child.children != null) {
return getSupport(itemset, index - 1, child);
}
}
}
return 0;
} | [
"private",
"int",
"getSupport",
"(",
"int",
"[",
"]",
"itemset",
",",
"int",
"index",
",",
"Node",
"node",
")",
"{",
"int",
"item",
"=",
"order",
"[",
"itemset",
"[",
"index",
"]",
"]",
";",
"Node",
"child",
"=",
"node",
".",
"children",
"[",
"item... | Returns the support value for the given item set if found in the T-tree
and 0 otherwise.
@param itemset the given item set.
@param index the current index in the given item set.
@param nodes the nodes of the current T-tree level.
@return the support value (0 if not found) | [
"Returns",
"the",
"support",
"value",
"for",
"the",
"given",
"item",
"set",
"if",
"found",
"in",
"the",
"T",
"-",
"tree",
"and",
"0",
"otherwise",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/association/TotalSupportTree.java#L147-L163 |
openengsb/openengsb | components/services/src/main/java/org/openengsb/core/services/internal/security/ldap/EntryFactory.java | EntryFactory.addDescription | private static void addDescription(Entry entry, String description) {
try {
entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, SchemaConstants.DESCRIPTIVE_OBJECT_OC);
if (description == null) {
entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(false)); // case 1
} else if (description.isEmpty()) {
entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(true)); // case 2
} else {
entry.add(SchemaConstants.STRING_ATTRIBUTE, description); // case 3
}
} catch (LdapException e) {
throw new LdapRuntimeException(e);
}
} | java | private static void addDescription(Entry entry, String description) {
try {
entry.add(SchemaConstants.OBJECT_CLASS_ATTRIBUTE, SchemaConstants.DESCRIPTIVE_OBJECT_OC);
if (description == null) {
entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(false)); // case 1
} else if (description.isEmpty()) {
entry.add(SchemaConstants.EMPTY_FLAG_ATTRIBUTE, String.valueOf(true)); // case 2
} else {
entry.add(SchemaConstants.STRING_ATTRIBUTE, description); // case 3
}
} catch (LdapException e) {
throw new LdapRuntimeException(e);
}
} | [
"private",
"static",
"void",
"addDescription",
"(",
"Entry",
"entry",
",",
"String",
"description",
")",
"{",
"try",
"{",
"entry",
".",
"add",
"(",
"SchemaConstants",
".",
"OBJECT_CLASS_ATTRIBUTE",
",",
"SchemaConstants",
".",
"DESCRIPTIVE_OBJECT_OC",
")",
";",
... | 3 possibilities:<br>
1) description is null -> emptyFlag = false, no description attribute <br>
2) description is empty -> emptyFlag = true, no description attribute <br>
3) description exists -> no emptyFlag, description attribute exists and has a value | [
"3",
"possibilities",
":",
"<br",
">",
"1",
")",
"description",
"is",
"null",
"-",
">",
"emptyFlag",
"=",
"false",
"no",
"description",
"attribute",
"<br",
">",
"2",
")",
"description",
"is",
"empty",
"-",
">",
"emptyFlag",
"=",
"true",
"no",
"descriptio... | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/services/src/main/java/org/openengsb/core/services/internal/security/ldap/EntryFactory.java#L160-L173 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/Message.java | Message.setMetadata | public void setMetadata(String key, Object value) {
if (value != null) {
getMetadata().put(key, value);
}
} | java | public void setMetadata(String key, Object value) {
if (value != null) {
getMetadata().put(key, value);
}
} | [
"public",
"void",
"setMetadata",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"getMetadata",
"(",
")",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"}"
] | Sets a metadata value.
@param key The key.
@param value The value. | [
"Sets",
"a",
"metadata",
"value",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/messaging/Message.java#L146-L150 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java | VirtualMachineScaleSetVMsInner.getInstanceViewAsync | public Observable<VirtualMachineScaleSetVMInstanceViewInner> getInstanceViewAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return getInstanceViewWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1<ServiceResponse<VirtualMachineScaleSetVMInstanceViewInner>, VirtualMachineScaleSetVMInstanceViewInner>() {
@Override
public VirtualMachineScaleSetVMInstanceViewInner call(ServiceResponse<VirtualMachineScaleSetVMInstanceViewInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualMachineScaleSetVMInstanceViewInner> getInstanceViewAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return getInstanceViewWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1<ServiceResponse<VirtualMachineScaleSetVMInstanceViewInner>, VirtualMachineScaleSetVMInstanceViewInner>() {
@Override
public VirtualMachineScaleSetVMInstanceViewInner call(ServiceResponse<VirtualMachineScaleSetVMInstanceViewInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualMachineScaleSetVMInstanceViewInner",
">",
"getInstanceViewAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"String",
"instanceId",
")",
"{",
"return",
"getInstanceViewWithServiceResponseAsync",
"(",
"resour... | Gets the status of a virtual machine from a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@param instanceId The instance ID of the virtual machine.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualMachineScaleSetVMInstanceViewInner object | [
"Gets",
"the",
"status",
"of",
"a",
"virtual",
"machine",
"from",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java#L1161-L1168 |
JodaOrg/joda-time | src/main/java/org/joda/time/Days.java | Days.daysBetween | public static Days daysBetween(ReadableInstant start, ReadableInstant end) {
int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.days());
return Days.days(amount);
} | java | public static Days daysBetween(ReadableInstant start, ReadableInstant end) {
int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.days());
return Days.days(amount);
} | [
"public",
"static",
"Days",
"daysBetween",
"(",
"ReadableInstant",
"start",
",",
"ReadableInstant",
"end",
")",
"{",
"int",
"amount",
"=",
"BaseSingleFieldPeriod",
".",
"between",
"(",
"start",
",",
"end",
",",
"DurationFieldType",
".",
"days",
"(",
")",
")",
... | Creates a <code>Days</code> representing the number of whole days
between the two specified datetimes. This method correctly handles
any daylight savings time changes that may occur during the interval.
@param start the start instant, must not be null
@param end the end instant, must not be null
@return the period in days
@throws IllegalArgumentException if the instants are null or invalid | [
"Creates",
"a",
"<code",
">",
"Days<",
"/",
"code",
">",
"representing",
"the",
"number",
"of",
"whole",
"days",
"between",
"the",
"two",
"specified",
"datetimes",
".",
"This",
"method",
"correctly",
"handles",
"any",
"daylight",
"savings",
"time",
"changes",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Days.java#L117-L120 |
hypercube1024/firefly | firefly/src/main/java/com/firefly/codec/websocket/stream/IOState.java | IOState.onReadFailure | public void onReadFailure(Throwable t) {
ConnectionState event = null;
synchronized (this) {
if (this.state == ConnectionState.CLOSED) {
// already closed
return;
}
// Build out Close Reason
String reason = "WebSocket Read Failure";
if (t instanceof EOFException) {
reason = "WebSocket Read EOF";
Throwable cause = t.getCause();
if ((cause != null) && (StringUtils.hasText(cause.getMessage()))) {
reason = "EOF: " + cause.getMessage();
}
} else {
if (StringUtils.hasText(t.getMessage())) {
reason = t.getMessage();
}
}
CloseInfo close = new CloseInfo(StatusCode.ABNORMAL, reason);
finalClose.compareAndSet(null, close);
this.cleanClose = false;
this.state = ConnectionState.CLOSED;
this.closeInfo = close;
this.inputAvailable = false;
this.outputAvailable = false;
this.closeHandshakeSource = CloseHandshakeSource.ABNORMAL;
event = this.state;
}
notifyStateListeners(event);
} | java | public void onReadFailure(Throwable t) {
ConnectionState event = null;
synchronized (this) {
if (this.state == ConnectionState.CLOSED) {
// already closed
return;
}
// Build out Close Reason
String reason = "WebSocket Read Failure";
if (t instanceof EOFException) {
reason = "WebSocket Read EOF";
Throwable cause = t.getCause();
if ((cause != null) && (StringUtils.hasText(cause.getMessage()))) {
reason = "EOF: " + cause.getMessage();
}
} else {
if (StringUtils.hasText(t.getMessage())) {
reason = t.getMessage();
}
}
CloseInfo close = new CloseInfo(StatusCode.ABNORMAL, reason);
finalClose.compareAndSet(null, close);
this.cleanClose = false;
this.state = ConnectionState.CLOSED;
this.closeInfo = close;
this.inputAvailable = false;
this.outputAvailable = false;
this.closeHandshakeSource = CloseHandshakeSource.ABNORMAL;
event = this.state;
}
notifyStateListeners(event);
} | [
"public",
"void",
"onReadFailure",
"(",
"Throwable",
"t",
")",
"{",
"ConnectionState",
"event",
"=",
"null",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"this",
".",
"state",
"==",
"ConnectionState",
".",
"CLOSED",
")",
"{",
"// already closed",
... | The local endpoint has reached a read failure.
<p>
This could be a normal result after a proper close handshake, or even a premature close due to a connection disconnect.
@param t the read failure | [
"The",
"local",
"endpoint",
"has",
"reached",
"a",
"read",
"failure",
".",
"<p",
">",
"This",
"could",
"be",
"a",
"normal",
"result",
"after",
"a",
"proper",
"close",
"handshake",
"or",
"even",
"a",
"premature",
"close",
"due",
"to",
"a",
"connection",
"... | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/websocket/stream/IOState.java#L395-L430 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/util/ChartModelProvider.java | ChartModelProvider.translateMarkerToRange | private static Double translateMarkerToRange(double size, Double min, Double max, Double value) {
if (value != null && min != null && max != null) {
return (size / (max - min)) * (value - min);
}
return value;
} | java | private static Double translateMarkerToRange(double size, Double min, Double max, Double value) {
if (value != null && min != null && max != null) {
return (size / (max - min)) * (value - min);
}
return value;
} | [
"private",
"static",
"Double",
"translateMarkerToRange",
"(",
"double",
"size",
",",
"Double",
"min",
",",
"Double",
"max",
",",
"Double",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"min",
"!=",
"null",
"&&",
"max",
"!=",
"null",
")",
"... | Translates marker value to be correct in given range
@param size size of the range
@param min min value
@param max max value
@param value original value
@return translated value | [
"Translates",
"marker",
"value",
"to",
"be",
"correct",
"in",
"given",
"range"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/util/ChartModelProvider.java#L781-L787 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.listQueryResultsForResourceGroup | public PolicyStatesQueryResultsInner listQueryResultsForResourceGroup(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions) {
return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body();
} | java | public PolicyStatesQueryResultsInner listQueryResultsForResourceGroup(PolicyStatesResource policyStatesResource, String subscriptionId, String resourceGroupName, QueryOptions queryOptions) {
return listQueryResultsForResourceGroupWithServiceResponseAsync(policyStatesResource, subscriptionId, resourceGroupName, queryOptions).toBlocking().single().body();
} | [
"public",
"PolicyStatesQueryResultsInner",
"listQueryResultsForResourceGroup",
"(",
"PolicyStatesResource",
"policyStatesResource",
",",
"String",
"subscriptionId",
",",
"String",
"resourceGroupName",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"listQueryResultsForRe... | Queries policy states for the resources under the resource group.
@param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest'
@param subscriptionId Microsoft Azure subscription ID.
@param resourceGroupName Resource group name.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@throws QueryFailureException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PolicyStatesQueryResultsInner object if successful. | [
"Queries",
"policy",
"states",
"for",
"the",
"resources",
"under",
"the",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L982-L984 |
infinispan/infinispan | core/src/main/java/org/infinispan/distribution/LocalizedCacheTopology.java | LocalizedCacheTopology.makeSegmentedSingletonTopology | public static LocalizedCacheTopology makeSegmentedSingletonTopology(KeyPartitioner keyPartitioner, int numSegments,
Address localAddress) {
return new LocalizedCacheTopology(keyPartitioner, numSegments, localAddress);
} | java | public static LocalizedCacheTopology makeSegmentedSingletonTopology(KeyPartitioner keyPartitioner, int numSegments,
Address localAddress) {
return new LocalizedCacheTopology(keyPartitioner, numSegments, localAddress);
} | [
"public",
"static",
"LocalizedCacheTopology",
"makeSegmentedSingletonTopology",
"(",
"KeyPartitioner",
"keyPartitioner",
",",
"int",
"numSegments",
",",
"Address",
"localAddress",
")",
"{",
"return",
"new",
"LocalizedCacheTopology",
"(",
"keyPartitioner",
",",
"numSegments"... | Creates a new local topology that has a single address but multiple segments. This is useful when the data
storage is segmented in some way (ie. segmented store)
@param keyPartitioner partitioner to decide which segment a given key maps to
@param numSegments how many segments there are
@param localAddress the address of this node
@return segmented topology | [
"Creates",
"a",
"new",
"local",
"topology",
"that",
"has",
"a",
"single",
"address",
"but",
"multiple",
"segments",
".",
"This",
"is",
"useful",
"when",
"the",
"data",
"storage",
"is",
"segmented",
"in",
"some",
"way",
"(",
"ie",
".",
"segmented",
"store",... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/distribution/LocalizedCacheTopology.java#L61-L64 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/RTreeIndexCoreExtension.java | RTreeIndexCoreExtension.dropAllTriggers | public void dropAllTriggers(String tableName, String geometryColumnName) {
dropInsertTrigger(tableName, geometryColumnName);
dropUpdate1Trigger(tableName, geometryColumnName);
dropUpdate2Trigger(tableName, geometryColumnName);
dropUpdate3Trigger(tableName, geometryColumnName);
dropUpdate4Trigger(tableName, geometryColumnName);
dropDeleteTrigger(tableName, geometryColumnName);
} | java | public void dropAllTriggers(String tableName, String geometryColumnName) {
dropInsertTrigger(tableName, geometryColumnName);
dropUpdate1Trigger(tableName, geometryColumnName);
dropUpdate2Trigger(tableName, geometryColumnName);
dropUpdate3Trigger(tableName, geometryColumnName);
dropUpdate4Trigger(tableName, geometryColumnName);
dropDeleteTrigger(tableName, geometryColumnName);
} | [
"public",
"void",
"dropAllTriggers",
"(",
"String",
"tableName",
",",
"String",
"geometryColumnName",
")",
"{",
"dropInsertTrigger",
"(",
"tableName",
",",
"geometryColumnName",
")",
";",
"dropUpdate1Trigger",
"(",
"tableName",
",",
"geometryColumnName",
")",
";",
"... | Drop Triggers that Maintain Spatial Index Values
@param tableName
table name
@param geometryColumnName
geometry column name | [
"Drop",
"Triggers",
"that",
"Maintain",
"Spatial",
"Index",
"Values"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/RTreeIndexCoreExtension.java#L876-L885 |
eclipse/xtext-core | org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java | OnChangeEvictingCache.execWithTemporaryCaching | public <Result, Param extends Resource> Result execWithTemporaryCaching(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException {
CacheAdapter cacheAdapter = getOrCreate(resource);
IgnoreValuesMemento memento = cacheAdapter.ignoreNewValues();
try {
return transaction.exec(resource);
} catch (Exception e) {
throw new WrappedException(e);
} finally {
memento.done();
}
} | java | public <Result, Param extends Resource> Result execWithTemporaryCaching(Param resource, IUnitOfWork<Result, Param> transaction) throws WrappedException {
CacheAdapter cacheAdapter = getOrCreate(resource);
IgnoreValuesMemento memento = cacheAdapter.ignoreNewValues();
try {
return transaction.exec(resource);
} catch (Exception e) {
throw new WrappedException(e);
} finally {
memento.done();
}
} | [
"public",
"<",
"Result",
",",
"Param",
"extends",
"Resource",
">",
"Result",
"execWithTemporaryCaching",
"(",
"Param",
"resource",
",",
"IUnitOfWork",
"<",
"Result",
",",
"Param",
">",
"transaction",
")",
"throws",
"WrappedException",
"{",
"CacheAdapter",
"cacheAd... | The transaction will be executed with caching enabled. However, all newly cached values will be discarded as soon
as the transaction is over.
@since 2.1 | [
"The",
"transaction",
"will",
"be",
"executed",
"with",
"caching",
"enabled",
".",
"However",
"all",
"newly",
"cached",
"values",
"will",
"be",
"discarded",
"as",
"soon",
"as",
"the",
"transaction",
"is",
"over",
"."
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/OnChangeEvictingCache.java#L143-L153 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java | CommerceNotificationQueueEntryPersistenceImpl.findByGroupId | @Override
public List<CommerceNotificationQueueEntry> findByGroupId(long groupId,
int start, int end) {
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CommerceNotificationQueueEntry> findByGroupId(long groupId,
int start, int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationQueueEntry",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
... | Returns a range of all the commerce notification queue entries where groupId = ?.
<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 CommerceNotificationQueueEntryModelImpl}. 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 groupId the group ID
@param start the lower bound of the range of commerce notification queue entries
@param end the upper bound of the range of commerce notification queue entries (not inclusive)
@return the range of matching commerce notification queue entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"notification",
"queue",
"entries",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java#L145-L149 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/replication/ConfigBasedDatasetsFinder.java | ConfigBasedDatasetsFinder.getValidDatasetURIs | protected Set<URI> getValidDatasetURIs(Path datasetCommonRoot) {
Collection<URI> allDatasetURIs;
Set<URI> disabledURISet = new HashSet();
// This try block basically populate the Valid dataset URI set.
try {
allDatasetURIs = configClient.getImportedBy(new URI(whitelistTag.toString()), true);
enhanceDisabledURIsWithBlackListTag(disabledURISet);
} catch ( ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException
| URISyntaxException e) {
log.error("Caught error while getting all the datasets URIs " + e.getMessage());
throw new RuntimeException(e);
}
return getValidDatasetURIsHelper(allDatasetURIs, disabledURISet, datasetCommonRoot);
} | java | protected Set<URI> getValidDatasetURIs(Path datasetCommonRoot) {
Collection<URI> allDatasetURIs;
Set<URI> disabledURISet = new HashSet();
// This try block basically populate the Valid dataset URI set.
try {
allDatasetURIs = configClient.getImportedBy(new URI(whitelistTag.toString()), true);
enhanceDisabledURIsWithBlackListTag(disabledURISet);
} catch ( ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException
| URISyntaxException e) {
log.error("Caught error while getting all the datasets URIs " + e.getMessage());
throw new RuntimeException(e);
}
return getValidDatasetURIsHelper(allDatasetURIs, disabledURISet, datasetCommonRoot);
} | [
"protected",
"Set",
"<",
"URI",
">",
"getValidDatasetURIs",
"(",
"Path",
"datasetCommonRoot",
")",
"{",
"Collection",
"<",
"URI",
">",
"allDatasetURIs",
";",
"Set",
"<",
"URI",
">",
"disabledURISet",
"=",
"new",
"HashSet",
"(",
")",
";",
"// This try block bas... | Semantic of black/whitelist:
- Whitelist always respect blacklist.
- Job-level blacklist is reponsible for dataset filtering instead of dataset discovery. i.e.
There's no implementation of job-level whitelist currently. | [
"Semantic",
"of",
"black",
"/",
"whitelist",
":",
"-",
"Whitelist",
"always",
"respect",
"blacklist",
".",
"-",
"Job",
"-",
"level",
"blacklist",
"is",
"reponsible",
"for",
"dataset",
"filtering",
"instead",
"of",
"dataset",
"discovery",
".",
"i",
".",
"e",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/replication/ConfigBasedDatasetsFinder.java#L168-L182 |
molgenis/molgenis | molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java | IndexJobService.performAction | private boolean performAction(Progress progress, int progressCount, IndexAction indexAction) {
requireNonNull(indexAction);
String entityTypeId = indexAction.getEntityTypeId();
updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.STARTED);
try {
if (dataService.hasEntityType(entityTypeId)) {
EntityType entityType = dataService.getEntityType(entityTypeId);
if (indexAction.getEntityId() != null) {
progress.progress(
progressCount,
format("Indexing {0}.{1}", entityType.getId(), indexAction.getEntityId()));
rebuildIndexOneEntity(entityTypeId, indexAction.getEntityId());
} else {
progress.progress(progressCount, format("Indexing {0}", entityType.getId()));
final Repository<Entity> repository = dataService.getRepository(entityType.getId());
indexService.rebuildIndex(repository);
}
} else {
EntityType entityType = getEntityType(indexAction);
if (indexService.hasIndex(entityType)) {
progress.progress(
progressCount, format("Dropping entityType with id: {0}", entityType.getId()));
indexService.deleteIndex(entityType);
} else {
// Index Job is finished, here we concluded that we don't have enough info to continue the
// index job
progress.progress(
progressCount,
format("Skip index entity {0}.{1}", entityType.getId(), indexAction.getEntityId()));
}
}
updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FINISHED);
return true;
} catch (Exception ex) {
LOG.error("Index job failed", ex);
updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FAILED);
return false;
}
} | java | private boolean performAction(Progress progress, int progressCount, IndexAction indexAction) {
requireNonNull(indexAction);
String entityTypeId = indexAction.getEntityTypeId();
updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.STARTED);
try {
if (dataService.hasEntityType(entityTypeId)) {
EntityType entityType = dataService.getEntityType(entityTypeId);
if (indexAction.getEntityId() != null) {
progress.progress(
progressCount,
format("Indexing {0}.{1}", entityType.getId(), indexAction.getEntityId()));
rebuildIndexOneEntity(entityTypeId, indexAction.getEntityId());
} else {
progress.progress(progressCount, format("Indexing {0}", entityType.getId()));
final Repository<Entity> repository = dataService.getRepository(entityType.getId());
indexService.rebuildIndex(repository);
}
} else {
EntityType entityType = getEntityType(indexAction);
if (indexService.hasIndex(entityType)) {
progress.progress(
progressCount, format("Dropping entityType with id: {0}", entityType.getId()));
indexService.deleteIndex(entityType);
} else {
// Index Job is finished, here we concluded that we don't have enough info to continue the
// index job
progress.progress(
progressCount,
format("Skip index entity {0}.{1}", entityType.getId(), indexAction.getEntityId()));
}
}
updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FINISHED);
return true;
} catch (Exception ex) {
LOG.error("Index job failed", ex);
updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.FAILED);
return false;
}
} | [
"private",
"boolean",
"performAction",
"(",
"Progress",
"progress",
",",
"int",
"progressCount",
",",
"IndexAction",
"indexAction",
")",
"{",
"requireNonNull",
"(",
"indexAction",
")",
";",
"String",
"entityTypeId",
"=",
"indexAction",
".",
"getEntityTypeId",
"(",
... | Performs a single IndexAction
@param progress {@link Progress} to report progress to
@param progressCount the progress count for this IndexAction
@param indexAction Entity of type IndexActionMetaData
@return boolean indicating success or failure | [
"Performs",
"a",
"single",
"IndexAction"
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java#L107-L145 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java | Bytes.toShort | public static short toShort(byte[] bytes, int offset, final int length) {
if (length != SIZEOF_SHORT || offset + length > bytes.length) {
throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_SHORT);
}
short n = 0;
n ^= bytes[offset] & 0xFF;
n <<= 8;
n ^= bytes[offset + 1] & 0xFF;
return n;
} | java | public static short toShort(byte[] bytes, int offset, final int length) {
if (length != SIZEOF_SHORT || offset + length > bytes.length) {
throw explainWrongLengthOrOffset(bytes, offset, length, SIZEOF_SHORT);
}
short n = 0;
n ^= bytes[offset] & 0xFF;
n <<= 8;
n ^= bytes[offset + 1] & 0xFF;
return n;
} | [
"public",
"static",
"short",
"toShort",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"final",
"int",
"length",
")",
"{",
"if",
"(",
"length",
"!=",
"SIZEOF_SHORT",
"||",
"offset",
"+",
"length",
">",
"bytes",
".",
"length",
")",
"{",
"t... | Converts a byte array to a short value.
@param bytes byte array
@param offset offset into array
@param length length, has to be {@link #SIZEOF_SHORT}
@return the short value
@throws IllegalArgumentException if length is not {@link #SIZEOF_SHORT}
or if there's not enough room in the array at the offset indicated. | [
"Converts",
"a",
"byte",
"array",
"to",
"a",
"short",
"value",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L642-L651 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/AbstractBundleLinkRenderer.java | AbstractBundleLinkRenderer.renderGlobalBundleLinks | protected void renderGlobalBundleLinks(BundleRendererContext ctx, Writer out, boolean debugOn) throws IOException {
if (debugOn) {
addComment("Start adding global members.", out);
}
performGlobalBundleLinksRendering(ctx, out, debugOn);
ctx.setGlobalBundleAdded(true);
if (debugOn) {
addComment("Finished adding global members.", out);
}
} | java | protected void renderGlobalBundleLinks(BundleRendererContext ctx, Writer out, boolean debugOn) throws IOException {
if (debugOn) {
addComment("Start adding global members.", out);
}
performGlobalBundleLinksRendering(ctx, out, debugOn);
ctx.setGlobalBundleAdded(true);
if (debugOn) {
addComment("Finished adding global members.", out);
}
} | [
"protected",
"void",
"renderGlobalBundleLinks",
"(",
"BundleRendererContext",
"ctx",
",",
"Writer",
"out",
",",
"boolean",
"debugOn",
")",
"throws",
"IOException",
"{",
"if",
"(",
"debugOn",
")",
"{",
"addComment",
"(",
"\"Start adding global members.\"",
",",
"out"... | Renders the links for the global bundles
@param ctx
the context
@param out
the writer
@param debugOn
the debug flag
@throws IOException
if an IOException occurs. | [
"Renders",
"the",
"links",
"for",
"the",
"global",
"bundles"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/renderer/AbstractBundleLinkRenderer.java#L195-L207 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/KafkaSpec.java | KafkaSpec.sendAMessage | @When("^I send a message '(.+?)' to the kafka topic named '(.+?)'")
public void sendAMessage(String message, String topic_name) throws Exception {
commonspec.getKafkaUtils().sendMessage(message, topic_name);
} | java | @When("^I send a message '(.+?)' to the kafka topic named '(.+?)'")
public void sendAMessage(String message, String topic_name) throws Exception {
commonspec.getKafkaUtils().sendMessage(message, topic_name);
} | [
"@",
"When",
"(",
"\"^I send a message '(.+?)' to the kafka topic named '(.+?)'\"",
")",
"public",
"void",
"sendAMessage",
"(",
"String",
"message",
",",
"String",
"topic_name",
")",
"throws",
"Exception",
"{",
"commonspec",
".",
"getKafkaUtils",
"(",
")",
".",
"sendM... | Sending a message in a Kafka topic.
@param topic_name topic name
@param message string that you send to topic | [
"Sending",
"a",
"message",
"in",
"a",
"Kafka",
"topic",
"."
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/KafkaSpec.java#L108-L111 |
openengsb/openengsb | components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EDBModelObject.java | EDBModelObject.getCorrespondingModel | public OpenEngSBModel getCorrespondingModel() throws EKBException {
ModelDescription description = getModelDescription();
try {
Class<?> modelClass = modelRegistry.loadModel(description);
return (OpenEngSBModel) edbConverter.convertEDBObjectToModel(modelClass, object);
} catch (ClassNotFoundException e) {
throw new EKBException(String.format("Unable to load model of type %s", description), e);
}
} | java | public OpenEngSBModel getCorrespondingModel() throws EKBException {
ModelDescription description = getModelDescription();
try {
Class<?> modelClass = modelRegistry.loadModel(description);
return (OpenEngSBModel) edbConverter.convertEDBObjectToModel(modelClass, object);
} catch (ClassNotFoundException e) {
throw new EKBException(String.format("Unable to load model of type %s", description), e);
}
} | [
"public",
"OpenEngSBModel",
"getCorrespondingModel",
"(",
")",
"throws",
"EKBException",
"{",
"ModelDescription",
"description",
"=",
"getModelDescription",
"(",
")",
";",
"try",
"{",
"Class",
"<",
"?",
">",
"modelClass",
"=",
"modelRegistry",
".",
"loadModel",
"(... | Returns the corresponding model object for the EDBModelObject | [
"Returns",
"the",
"corresponding",
"model",
"object",
"for",
"the",
"EDBModelObject"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EDBModelObject.java#L55-L63 |
alkacon/opencms-core | src-setup/org/opencms/setup/db/CmsUpdateDBManager.java | CmsUpdateDBManager.getOracleTablespaces | protected void getOracleTablespaces(Map<String, String> dbPoolData) {
String dataTablespace = "users";
String indexTablespace = "users";
CmsSetupDb setupDb = new CmsSetupDb(null);
try {
setupDb.setConnection(
dbPoolData.get("driver"),
dbPoolData.get("url"),
dbPoolData.get("params"),
dbPoolData.get("user"),
dbPoolData.get("pwd"));
// read tablespace for data
CmsSetupDBWrapper db = null;
try {
db = setupDb.executeSqlStatement("SELECT DISTINCT tablespace_name FROM user_tables", null);
if (db.getResultSet().next()) {
dataTablespace = db.getResultSet().getString(1).toLowerCase();
}
} finally {
if (db != null) {
db.close();
}
}
// read tablespace for indexes
try {
db = setupDb.executeSqlStatement("SELECT DISTINCT tablespace_name FROM user_indexes", null);
if (db.getResultSet().next()) {
indexTablespace = db.getResultSet().getString(1).toLowerCase();
}
} finally {
if (db != null) {
db.close();
}
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
setupDb.closeConnection();
}
dbPoolData.put("indexTablespace", indexTablespace);
System.out.println("Index Tablespace: " + indexTablespace);
dbPoolData.put("dataTablespace", dataTablespace);
System.out.println("Data Tablespace: " + dataTablespace);
} | java | protected void getOracleTablespaces(Map<String, String> dbPoolData) {
String dataTablespace = "users";
String indexTablespace = "users";
CmsSetupDb setupDb = new CmsSetupDb(null);
try {
setupDb.setConnection(
dbPoolData.get("driver"),
dbPoolData.get("url"),
dbPoolData.get("params"),
dbPoolData.get("user"),
dbPoolData.get("pwd"));
// read tablespace for data
CmsSetupDBWrapper db = null;
try {
db = setupDb.executeSqlStatement("SELECT DISTINCT tablespace_name FROM user_tables", null);
if (db.getResultSet().next()) {
dataTablespace = db.getResultSet().getString(1).toLowerCase();
}
} finally {
if (db != null) {
db.close();
}
}
// read tablespace for indexes
try {
db = setupDb.executeSqlStatement("SELECT DISTINCT tablespace_name FROM user_indexes", null);
if (db.getResultSet().next()) {
indexTablespace = db.getResultSet().getString(1).toLowerCase();
}
} finally {
if (db != null) {
db.close();
}
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
setupDb.closeConnection();
}
dbPoolData.put("indexTablespace", indexTablespace);
System.out.println("Index Tablespace: " + indexTablespace);
dbPoolData.put("dataTablespace", dataTablespace);
System.out.println("Data Tablespace: " + dataTablespace);
} | [
"protected",
"void",
"getOracleTablespaces",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"dbPoolData",
")",
"{",
"String",
"dataTablespace",
"=",
"\"users\"",
";",
"String",
"indexTablespace",
"=",
"\"users\"",
";",
"CmsSetupDb",
"setupDb",
"=",
"new",
"CmsSe... | Retrieves the oracle tablespace names.<p>
@param dbPoolData the database pool data | [
"Retrieves",
"the",
"oracle",
"tablespace",
"names",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/CmsUpdateDBManager.java#L424-L472 |
JOML-CI/JOML | src/org/joml/Matrix3f.java | Matrix3f.rotateLocalZ | public Matrix3f rotateLocalZ(float ang, Matrix3f dest) {
float sin = (float) Math.sin(ang);
float cos = (float) Math.cosFromSin(sin, ang);
float nm00 = cos * m00 - sin * m01;
float nm01 = sin * m00 + cos * m01;
float nm10 = cos * m10 - sin * m11;
float nm11 = sin * m10 + cos * m11;
float nm20 = cos * m20 - sin * m21;
float nm21 = sin * m20 + cos * m21;
dest.m00 = nm00;
dest.m01 = nm01;
dest.m02 = m02;
dest.m10 = nm10;
dest.m11 = nm11;
dest.m12 = m12;
dest.m20 = nm20;
dest.m21 = nm21;
dest.m22 = m22;
return dest;
} | java | public Matrix3f rotateLocalZ(float ang, Matrix3f dest) {
float sin = (float) Math.sin(ang);
float cos = (float) Math.cosFromSin(sin, ang);
float nm00 = cos * m00 - sin * m01;
float nm01 = sin * m00 + cos * m01;
float nm10 = cos * m10 - sin * m11;
float nm11 = sin * m10 + cos * m11;
float nm20 = cos * m20 - sin * m21;
float nm21 = sin * m20 + cos * m21;
dest.m00 = nm00;
dest.m01 = nm01;
dest.m02 = m02;
dest.m10 = nm10;
dest.m11 = nm11;
dest.m12 = m12;
dest.m20 = nm20;
dest.m21 = nm21;
dest.m22 = m22;
return dest;
} | [
"public",
"Matrix3f",
"rotateLocalZ",
"(",
"float",
"ang",
",",
"Matrix3f",
"dest",
")",
"{",
"float",
"sin",
"=",
"(",
"float",
")",
"Math",
".",
"sin",
"(",
"ang",
")",
";",
"float",
"cos",
"=",
"(",
"float",
")",
"Math",
".",
"cosFromSin",
"(",
... | Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians
about the Z axis and store the result in <code>dest</code>.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>R * M</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the
rotation will be applied last!
<p>
In order to set the matrix to a rotation matrix without pre-multiplying the rotation
transformation, use {@link #rotationZ(float) rotationZ()}.
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a>
@see #rotationZ(float)
@param ang
the angle in radians to rotate about the Z axis
@param dest
will hold the result
@return dest | [
"Pre",
"-",
"multiply",
"a",
"rotation",
"around",
"the",
"Z",
"axis",
"to",
"this",
"matrix",
"by",
"rotating",
"the",
"given",
"amount",
"of",
"radians",
"about",
"the",
"Z",
"axis",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L2621-L2640 |
Red5/red5-server-common | src/main/java/org/red5/server/stream/StreamService.java | StreamService.sendNetStreamStatus | public static void sendNetStreamStatus(IConnection conn, String statusCode, String description, String name, String status, Number streamId) {
if (conn instanceof RTMPConnection) {
Status s = new Status(statusCode);
s.setClientid(streamId);
s.setDesciption(description);
s.setDetails(name);
s.setLevel(status);
// get the channel
RTMPConnection rtmpConn = (RTMPConnection) conn;
Channel channel = rtmpConn.getChannel(rtmpConn.getChannelIdForStreamId(streamId));
channel.sendStatus(s);
} else {
throw new RuntimeException("Connection is not RTMPConnection: " + conn);
}
} | java | public static void sendNetStreamStatus(IConnection conn, String statusCode, String description, String name, String status, Number streamId) {
if (conn instanceof RTMPConnection) {
Status s = new Status(statusCode);
s.setClientid(streamId);
s.setDesciption(description);
s.setDetails(name);
s.setLevel(status);
// get the channel
RTMPConnection rtmpConn = (RTMPConnection) conn;
Channel channel = rtmpConn.getChannel(rtmpConn.getChannelIdForStreamId(streamId));
channel.sendStatus(s);
} else {
throw new RuntimeException("Connection is not RTMPConnection: " + conn);
}
} | [
"public",
"static",
"void",
"sendNetStreamStatus",
"(",
"IConnection",
"conn",
",",
"String",
"statusCode",
",",
"String",
"description",
",",
"String",
"name",
",",
"String",
"status",
",",
"Number",
"streamId",
")",
"{",
"if",
"(",
"conn",
"instanceof",
"RTM... | Send NetStream.Status to the client.
@param conn
connection
@param statusCode
NetStream status code
@param description
description
@param name
name
@param status
The status - error, warning, or status
@param streamId
stream id | [
"Send",
"NetStream",
".",
"Status",
"to",
"the",
"client",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/stream/StreamService.java#L834-L848 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/FullMappingPropertiesBasedBundlesHandlerFactory.java | FullMappingPropertiesBasedBundlesHandlerFactory.getResourceBundles | public List<JoinableResourceBundle> getResourceBundles(Properties properties) {
PropertiesConfigHelper props = new PropertiesConfigHelper(properties, resourceType);
String fileExtension = "." + resourceType;
// Initialize custom bundles
List<JoinableResourceBundle> customBundles = new ArrayList<>();
// Check if we should use the bundle names property or
// find the bundle name using the bundle id declaration :
// jawr.<type>.bundle.<name>.id
if (null != props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES)) {
StringTokenizer tk = new StringTokenizer(
props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES), ",");
while (tk.hasMoreTokens()) {
customBundles
.add(buildJoinableResourceBundle(props, tk.nextToken().trim(), fileExtension, rsReaderHandler));
}
} else {
Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator();
while (bundleNames.hasNext()) {
customBundles
.add(buildJoinableResourceBundle(props, bundleNames.next(), fileExtension, rsReaderHandler));
}
}
// Initialize the bundles dependencies
Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator();
while (bundleNames.hasNext()) {
String bundleName = (String) bundleNames.next();
List<String> bundleNameDependencies = props.getCustomBundlePropertyAsList(bundleName,
PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_DEPENDENCIES);
if (!bundleNameDependencies.isEmpty()) {
JoinableResourceBundle bundle = getBundleFromName(bundleName, customBundles);
List<JoinableResourceBundle> bundleDependencies = getBundlesFromName(bundleNameDependencies,
customBundles);
bundle.setDependencies(bundleDependencies);
}
}
return customBundles;
} | java | public List<JoinableResourceBundle> getResourceBundles(Properties properties) {
PropertiesConfigHelper props = new PropertiesConfigHelper(properties, resourceType);
String fileExtension = "." + resourceType;
// Initialize custom bundles
List<JoinableResourceBundle> customBundles = new ArrayList<>();
// Check if we should use the bundle names property or
// find the bundle name using the bundle id declaration :
// jawr.<type>.bundle.<name>.id
if (null != props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES)) {
StringTokenizer tk = new StringTokenizer(
props.getProperty(PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_NAMES), ",");
while (tk.hasMoreTokens()) {
customBundles
.add(buildJoinableResourceBundle(props, tk.nextToken().trim(), fileExtension, rsReaderHandler));
}
} else {
Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator();
while (bundleNames.hasNext()) {
customBundles
.add(buildJoinableResourceBundle(props, bundleNames.next(), fileExtension, rsReaderHandler));
}
}
// Initialize the bundles dependencies
Iterator<String> bundleNames = props.getPropertyBundleNameSet().iterator();
while (bundleNames.hasNext()) {
String bundleName = (String) bundleNames.next();
List<String> bundleNameDependencies = props.getCustomBundlePropertyAsList(bundleName,
PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_DEPENDENCIES);
if (!bundleNameDependencies.isEmpty()) {
JoinableResourceBundle bundle = getBundleFromName(bundleName, customBundles);
List<JoinableResourceBundle> bundleDependencies = getBundlesFromName(bundleNameDependencies,
customBundles);
bundle.setDependencies(bundleDependencies);
}
}
return customBundles;
} | [
"public",
"List",
"<",
"JoinableResourceBundle",
">",
"getResourceBundles",
"(",
"Properties",
"properties",
")",
"{",
"PropertiesConfigHelper",
"props",
"=",
"new",
"PropertiesConfigHelper",
"(",
"properties",
",",
"resourceType",
")",
";",
"String",
"fileExtension",
... | Returns the list of joinable resource bundle
@param properties
the properties
@return the list of joinable resource bundle | [
"Returns",
"the",
"list",
"of",
"joinable",
"resource",
"bundle"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/FullMappingPropertiesBasedBundlesHandlerFactory.java#L97-L137 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_udp_farm_POST | public OvhBackendUdp serviceName_udp_farm_POST(String serviceName, String displayName, Long port, Long vrackNetworkId, String zone) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/udp/farm";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "displayName", displayName);
addBody(o, "port", port);
addBody(o, "vrackNetworkId", vrackNetworkId);
addBody(o, "zone", zone);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhBackendUdp.class);
} | java | public OvhBackendUdp serviceName_udp_farm_POST(String serviceName, String displayName, Long port, Long vrackNetworkId, String zone) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/udp/farm";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "displayName", displayName);
addBody(o, "port", port);
addBody(o, "vrackNetworkId", vrackNetworkId);
addBody(o, "zone", zone);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhBackendUdp.class);
} | [
"public",
"OvhBackendUdp",
"serviceName_udp_farm_POST",
"(",
"String",
"serviceName",
",",
"String",
"displayName",
",",
"Long",
"port",
",",
"Long",
"vrackNetworkId",
",",
"String",
"zone",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalanc... | Add a new UDP Farm on your IP Load Balancing
REST: POST /ipLoadbalancing/{serviceName}/udp/farm
@param zone [required] Zone of your farm
@param vrackNetworkId [required] Internal Load Balancer identifier of the vRack private network to attach to your farm, mandatory when your Load Balancer is attached to a vRack
@param displayName [required] Human readable name for your backend, this field is for you
@param port [required] Port attached to your farm ([1..49151]). Inherited from frontend if null
@param serviceName [required] The internal name of your IP load balancing
API beta | [
"Add",
"a",
"new",
"UDP",
"Farm",
"on",
"your",
"IP",
"Load",
"Balancing"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L874-L884 |
kmi/iserve | iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java | Util.generateSuperclassPattern | public static String generateSuperclassPattern(URI origin, String matchVariable) {
return new StringBuilder()
.append(sparqlWrapUri(origin)).append(" ")
.append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ")
.append("?").append(matchVariable).append(" .")
.toString();
} | java | public static String generateSuperclassPattern(URI origin, String matchVariable) {
return new StringBuilder()
.append(sparqlWrapUri(origin)).append(" ")
.append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ")
.append("?").append(matchVariable).append(" .")
.toString();
} | [
"public",
"static",
"String",
"generateSuperclassPattern",
"(",
"URI",
"origin",
",",
"String",
"matchVariable",
")",
"{",
"return",
"new",
"StringBuilder",
"(",
")",
".",
"append",
"(",
"sparqlWrapUri",
"(",
"origin",
")",
")",
".",
"append",
"(",
"\" \"",
... | Generate a pattern for matching var to the superclasses of clazz
@param origin
@param matchVariable
@return | [
"Generate",
"a",
"pattern",
"for",
"matching",
"var",
"to",
"the",
"superclasses",
"of",
"clazz"
] | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L248-L254 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java | PixelMath.boundImage | public static void boundImage( GrayF64 img , double min , double max ) {
ImplPixelMath.boundImage(img,min,max);
} | java | public static void boundImage( GrayF64 img , double min , double max ) {
ImplPixelMath.boundImage(img,min,max);
} | [
"public",
"static",
"void",
"boundImage",
"(",
"GrayF64",
"img",
",",
"double",
"min",
",",
"double",
"max",
")",
"{",
"ImplPixelMath",
".",
"boundImage",
"(",
"img",
",",
"min",
",",
"max",
")",
";",
"}"
] | Bounds image pixels to be between these two values
@param img Image
@param min minimum value.
@param max maximum value. | [
"Bounds",
"image",
"pixels",
"to",
"be",
"between",
"these",
"two",
"values"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java#L4515-L4517 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.rotate | public static BufferedImage rotate(Image image, int degree) {
return Img.from(image).rotate(degree).getImg();
} | java | public static BufferedImage rotate(Image image, int degree) {
return Img.from(image).rotate(degree).getImg();
} | [
"public",
"static",
"BufferedImage",
"rotate",
"(",
"Image",
"image",
",",
"int",
"degree",
")",
"{",
"return",
"Img",
".",
"from",
"(",
"image",
")",
".",
"rotate",
"(",
"degree",
")",
".",
"getImg",
"(",
")",
";",
"}"
] | 旋转图片为指定角度<br>
来自:http://blog.51cto.com/cping1982/130066
@param image 目标图像
@param degree 旋转角度
@return 旋转后的图片
@since 3.2.2 | [
"旋转图片为指定角度<br",
">",
"来自:http",
":",
"//",
"blog",
".",
"51cto",
".",
"com",
"/",
"cping1982",
"/",
"130066"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1057-L1059 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java | SubscriptionAdminClient.modifyPushConfig | public final void modifyPushConfig(ProjectSubscriptionName subscription, PushConfig pushConfig) {
ModifyPushConfigRequest request =
ModifyPushConfigRequest.newBuilder()
.setSubscription(subscription == null ? null : subscription.toString())
.setPushConfig(pushConfig)
.build();
modifyPushConfig(request);
} | java | public final void modifyPushConfig(ProjectSubscriptionName subscription, PushConfig pushConfig) {
ModifyPushConfigRequest request =
ModifyPushConfigRequest.newBuilder()
.setSubscription(subscription == null ? null : subscription.toString())
.setPushConfig(pushConfig)
.build();
modifyPushConfig(request);
} | [
"public",
"final",
"void",
"modifyPushConfig",
"(",
"ProjectSubscriptionName",
"subscription",
",",
"PushConfig",
"pushConfig",
")",
"{",
"ModifyPushConfigRequest",
"request",
"=",
"ModifyPushConfigRequest",
".",
"newBuilder",
"(",
")",
".",
"setSubscription",
"(",
"sub... | Modifies the `PushConfig` for a specified subscription.
<p>This may be used to change a push subscription to a pull one (signified by an empty
`PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push
subscription. Messages will accumulate for delivery continuously through the call regardless of
changes to the `PushConfig`.
<p>Sample code:
<pre><code>
try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
PushConfig pushConfig = PushConfig.newBuilder().build();
subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
}
</code></pre>
@param subscription The name of the subscription. Format is
`projects/{project}/subscriptions/{sub}`.
@param pushConfig The push configuration for future deliveries.
<p>An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages
from the given subscription and allow messages to be pulled and acknowledged - effectively
pausing the subscription if `Pull` or `StreamingPull` is not called.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Modifies",
"the",
"PushConfig",
"for",
"a",
"specified",
"subscription",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java#L1254-L1262 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRRenderData.java | GVRRenderData.setMaterial | public void setMaterial(GVRMaterial material, int passIndex)
{
if (passIndex < mRenderPassList.size())
{
mRenderPassList.get(passIndex).setMaterial(material);
}
else
{
Log.e(TAG, "Trying to set material from invalid pass. Pass " + passIndex + " was not created.");
}
} | java | public void setMaterial(GVRMaterial material, int passIndex)
{
if (passIndex < mRenderPassList.size())
{
mRenderPassList.get(passIndex).setMaterial(material);
}
else
{
Log.e(TAG, "Trying to set material from invalid pass. Pass " + passIndex + " was not created.");
}
} | [
"public",
"void",
"setMaterial",
"(",
"GVRMaterial",
"material",
",",
"int",
"passIndex",
")",
"{",
"if",
"(",
"passIndex",
"<",
"mRenderPassList",
".",
"size",
"(",
")",
")",
"{",
"mRenderPassList",
".",
"get",
"(",
"passIndex",
")",
".",
"setMaterial",
"... | Set the {@link GVRMaterial material} this pass will be rendered with.
@param material
The {@link GVRMaterial material} for rendering.
@param passIndex
The rendering pass this material will be assigned to. | [
"Set",
"the",
"{",
"@link",
"GVRMaterial",
"material",
"}",
"this",
"pass",
"will",
"be",
"rendered",
"with",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRRenderData.java#L233-L243 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java | EventServiceImpl.executeLocal | private void executeLocal(String serviceName, Object event, EventRegistration registration, int orderKey) {
if (!nodeEngine.isRunning()) {
return;
}
Registration reg = (Registration) registration;
try {
if (reg.getListener() != null) {
eventExecutor.execute(new LocalEventDispatcher(this, serviceName, event, reg.getListener()
, orderKey, eventQueueTimeoutMs));
} else {
logger.warning("Something seems wrong! Listener instance is null! -> " + reg);
}
} catch (RejectedExecutionException e) {
rejectedCount.inc();
if (eventExecutor.isLive()) {
logFailure("EventQueue overloaded! %s failed to publish to %s:%s",
event, reg.getServiceName(), reg.getTopic());
}
}
} | java | private void executeLocal(String serviceName, Object event, EventRegistration registration, int orderKey) {
if (!nodeEngine.isRunning()) {
return;
}
Registration reg = (Registration) registration;
try {
if (reg.getListener() != null) {
eventExecutor.execute(new LocalEventDispatcher(this, serviceName, event, reg.getListener()
, orderKey, eventQueueTimeoutMs));
} else {
logger.warning("Something seems wrong! Listener instance is null! -> " + reg);
}
} catch (RejectedExecutionException e) {
rejectedCount.inc();
if (eventExecutor.isLive()) {
logFailure("EventQueue overloaded! %s failed to publish to %s:%s",
event, reg.getServiceName(), reg.getTopic());
}
}
} | [
"private",
"void",
"executeLocal",
"(",
"String",
"serviceName",
",",
"Object",
"event",
",",
"EventRegistration",
"registration",
",",
"int",
"orderKey",
")",
"{",
"if",
"(",
"!",
"nodeEngine",
".",
"isRunning",
"(",
")",
")",
"{",
"return",
";",
"}",
"Re... | Processes the {@code event} on this node. If the event is not accepted to the executor
in {@link #eventQueueTimeoutMs}, it will be rejected and not processed. This means that we increase the
rejected count and log the failure.
@param serviceName the name of the service responsible for this event
@param event the event
@param registration the listener registration responsible for this event
@param orderKey the key defining the thread on which the event is processed. Events with the same key maintain order.
@see LocalEventDispatcher | [
"Processes",
"the",
"{",
"@code",
"event",
"}",
"on",
"this",
"node",
".",
"If",
"the",
"event",
"is",
"not",
"accepted",
"to",
"the",
"executor",
"in",
"{",
"@link",
"#eventQueueTimeoutMs",
"}",
"it",
"will",
"be",
"rejected",
"and",
"not",
"processed",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java#L468-L489 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java | P2sVpnServerConfigurationsInner.createOrUpdate | public P2SVpnServerConfigurationInner createOrUpdate(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName, P2SVpnServerConfigurationInner p2SVpnServerConfigurationParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName, p2SVpnServerConfigurationParameters).toBlocking().last().body();
} | java | public P2SVpnServerConfigurationInner createOrUpdate(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName, P2SVpnServerConfigurationInner p2SVpnServerConfigurationParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName, p2SVpnServerConfigurationParameters).toBlocking().last().body();
} | [
"public",
"P2SVpnServerConfigurationInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualWanName",
",",
"String",
"p2SVpnServerConfigurationName",
",",
"P2SVpnServerConfigurationInner",
"p2SVpnServerConfigurationParameters",
")",
"{",
"return",
"cr... | Creates a P2SVpnServerConfiguration to associate with a VirtualWan if it doesn't exist else updates the existing P2SVpnServerConfiguration.
@param resourceGroupName The resource group name of the VirtualWan.
@param virtualWanName The name of the VirtualWan.
@param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration.
@param p2SVpnServerConfigurationParameters Parameters supplied to create or Update a P2SVpnServerConfiguration.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the P2SVpnServerConfigurationInner object if successful. | [
"Creates",
"a",
"P2SVpnServerConfiguration",
"to",
"associate",
"with",
"a",
"VirtualWan",
"if",
"it",
"doesn",
"t",
"exist",
"else",
"updates",
"the",
"existing",
"P2SVpnServerConfiguration",
"."
] | 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/P2sVpnServerConfigurationsInner.java#L197-L199 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java | CalendarPanel.labelIndicatorMouseEntered | private void labelIndicatorMouseEntered(MouseEvent e) {
// Skip this function if the settings have not been applied.
if (settings == null) {
return;
}
JLabel label = ((JLabel) e.getSource());
// Do not highlight the today label if today is vetoed.
if (label == labelSetDateToToday) {
DateVetoPolicy vetoPolicy = settings.getVetoPolicy();
boolean todayIsVetoed = InternalUtilities.isDateVetoed(vetoPolicy, LocalDate.now());
if (todayIsVetoed) {
return;
}
}
// Do not highlight the month label if the month menu is disabled.
if ((label == labelMonth) && (settings.getEnableMonthMenu() == false)) {
return;
}
// Do not highlight the year label if the year menu is disabled.
if ((label == labelYear) && (settings.getEnableYearMenu() == false)) {
return;
}
// Highlight the label.
label.setBackground(new Color(184, 207, 229));
label.setBorder(new CompoundBorder(
new LineBorder(Color.GRAY), labelIndicatorEmptyBorder));
} | java | private void labelIndicatorMouseEntered(MouseEvent e) {
// Skip this function if the settings have not been applied.
if (settings == null) {
return;
}
JLabel label = ((JLabel) e.getSource());
// Do not highlight the today label if today is vetoed.
if (label == labelSetDateToToday) {
DateVetoPolicy vetoPolicy = settings.getVetoPolicy();
boolean todayIsVetoed = InternalUtilities.isDateVetoed(vetoPolicy, LocalDate.now());
if (todayIsVetoed) {
return;
}
}
// Do not highlight the month label if the month menu is disabled.
if ((label == labelMonth) && (settings.getEnableMonthMenu() == false)) {
return;
}
// Do not highlight the year label if the year menu is disabled.
if ((label == labelYear) && (settings.getEnableYearMenu() == false)) {
return;
}
// Highlight the label.
label.setBackground(new Color(184, 207, 229));
label.setBorder(new CompoundBorder(
new LineBorder(Color.GRAY), labelIndicatorEmptyBorder));
} | [
"private",
"void",
"labelIndicatorMouseEntered",
"(",
"MouseEvent",
"e",
")",
"{",
"// Skip this function if the settings have not been applied.",
"if",
"(",
"settings",
"==",
"null",
")",
"{",
"return",
";",
"}",
"JLabel",
"label",
"=",
"(",
"(",
"JLabel",
")",
"... | labelIndicatorMouseEntered, This event is called when the user move the mouse inside a
monitored label. This is used to generate mouse over effects for the calendar panel. | [
"labelIndicatorMouseEntered",
"This",
"event",
"is",
"called",
"when",
"the",
"user",
"move",
"the",
"mouse",
"inside",
"a",
"monitored",
"label",
".",
"This",
"is",
"used",
"to",
"generate",
"mouse",
"over",
"effects",
"for",
"the",
"calendar",
"panel",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java#L920-L946 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.L3_WSG84 | @Pure
public static GeodesicPosition L3_WSG84(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_3_N,
LAMBERT_3_C,
LAMBERT_3_XS,
LAMBERT_3_YS);
return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY());
} | java | @Pure
public static GeodesicPosition L3_WSG84(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_3_N,
LAMBERT_3_C,
LAMBERT_3_XS,
LAMBERT_3_YS);
return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY());
} | [
"@",
"Pure",
"public",
"static",
"GeodesicPosition",
"L3_WSG84",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"NTFLambert_NTFLambdaPhi",
"(",
"x",
",",
"y",
",",
"LAMBERT_3_N",
",",
"LAMBERT_3_C",
",",
"LAMBERT_3_X... | This function convert France Lambert III coordinate to geographic WSG84 Data.
@param x is the coordinate in France Lambert III
@param y is the coordinate in France Lambert III
@return lambda and phi in geographic WSG84 in degrees. | [
"This",
"function",
"convert",
"France",
"Lambert",
"III",
"coordinate",
"to",
"geographic",
"WSG84",
"Data",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L541-L549 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/routing/ch/NodeBasedNodeContractor.java | NodeBasedNodeContractor.calculatePriority | @Override
public float calculatePriority(int node) {
CalcShortcutsResult calcShortcutsResult = calcShortcutCount(node);
// # huge influence: the bigger the less shortcuts gets created and the faster is the preparation
//
// every adjNode has an 'original edge' number associated. initially it is r=1
// when a new shortcut is introduced then r of the associated edges is summed up:
// r(u,w)=r(u,v)+r(v,w) now we can define
// originalEdgesCount = σ(v) := sum_{ (u,w) ∈ shortcuts(v) } of r(u, w)
int originalEdgesCount = calcShortcutsResult.originalEdgesCount;
// # lowest influence on preparation speed or shortcut creation count
// (but according to paper should speed up queries)
//
// number of already contracted neighbors of v
int contractedNeighbors = 0;
int degree = 0;
CHEdgeIterator iter = remainingEdgeExplorer.setBaseNode(node);
while (iter.next()) {
degree++;
if (iter.isShortcut())
contractedNeighbors++;
}
// from shortcuts we can compute the edgeDifference
// # low influence: with it the shortcut creation is slightly faster
//
// |shortcuts(v)| − |{(u, v) | v uncontracted}| − |{(v, w) | v uncontracted}|
// meanDegree is used instead of outDegree+inDegree as if one adjNode is in both directions
// only one bucket memory is used. Additionally one shortcut could also stand for two directions.
int edgeDifference = calcShortcutsResult.shortcutsCount - degree;
// according to the paper do a simple linear combination of the properties to get the priority.
return params.edgeDifferenceWeight * edgeDifference +
params.originalEdgesCountWeight * originalEdgesCount +
params.contractedNeighborsWeight * contractedNeighbors;
} | java | @Override
public float calculatePriority(int node) {
CalcShortcutsResult calcShortcutsResult = calcShortcutCount(node);
// # huge influence: the bigger the less shortcuts gets created and the faster is the preparation
//
// every adjNode has an 'original edge' number associated. initially it is r=1
// when a new shortcut is introduced then r of the associated edges is summed up:
// r(u,w)=r(u,v)+r(v,w) now we can define
// originalEdgesCount = σ(v) := sum_{ (u,w) ∈ shortcuts(v) } of r(u, w)
int originalEdgesCount = calcShortcutsResult.originalEdgesCount;
// # lowest influence on preparation speed or shortcut creation count
// (but according to paper should speed up queries)
//
// number of already contracted neighbors of v
int contractedNeighbors = 0;
int degree = 0;
CHEdgeIterator iter = remainingEdgeExplorer.setBaseNode(node);
while (iter.next()) {
degree++;
if (iter.isShortcut())
contractedNeighbors++;
}
// from shortcuts we can compute the edgeDifference
// # low influence: with it the shortcut creation is slightly faster
//
// |shortcuts(v)| − |{(u, v) | v uncontracted}| − |{(v, w) | v uncontracted}|
// meanDegree is used instead of outDegree+inDegree as if one adjNode is in both directions
// only one bucket memory is used. Additionally one shortcut could also stand for two directions.
int edgeDifference = calcShortcutsResult.shortcutsCount - degree;
// according to the paper do a simple linear combination of the properties to get the priority.
return params.edgeDifferenceWeight * edgeDifference +
params.originalEdgesCountWeight * originalEdgesCount +
params.contractedNeighborsWeight * contractedNeighbors;
} | [
"@",
"Override",
"public",
"float",
"calculatePriority",
"(",
"int",
"node",
")",
"{",
"CalcShortcutsResult",
"calcShortcutsResult",
"=",
"calcShortcutCount",
"(",
"node",
")",
";",
"// # huge influence: the bigger the less shortcuts gets created and the faster is the preparation... | Warning: the calculated priority must NOT depend on priority(v) and therefore findShortcuts should also not
depend on the priority(v). Otherwise updating the priority before contracting in contractNodes() could lead to
a slowish or even endless loop. | [
"Warning",
":",
"the",
"calculated",
"priority",
"must",
"NOT",
"depend",
"on",
"priority",
"(",
"v",
")",
"and",
"therefore",
"findShortcuts",
"should",
"also",
"not",
"depend",
"on",
"the",
"priority",
"(",
"v",
")",
".",
"Otherwise",
"updating",
"the",
... | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/ch/NodeBasedNodeContractor.java#L98-L135 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java | PropertyBuilder.getInstance | public static PropertyBuilder getInstance(Context context,
ClassDoc classDoc,
PropertyWriter writer) {
return new PropertyBuilder(context, classDoc, writer);
} | java | public static PropertyBuilder getInstance(Context context,
ClassDoc classDoc,
PropertyWriter writer) {
return new PropertyBuilder(context, classDoc, writer);
} | [
"public",
"static",
"PropertyBuilder",
"getInstance",
"(",
"Context",
"context",
",",
"ClassDoc",
"classDoc",
",",
"PropertyWriter",
"writer",
")",
"{",
"return",
"new",
"PropertyBuilder",
"(",
"context",
",",
"classDoc",
",",
"writer",
")",
";",
"}"
] | Construct a new PropertyBuilder.
@param context the build context.
@param classDoc the class whoses members are being documented.
@param writer the doclet specific writer. | [
"Construct",
"a",
"new",
"PropertyBuilder",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java#L107-L111 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/view/LockableHorizontalScrollView.java | LockableHorizontalScrollView.wrappedSmoothScrollBy | void wrappedSmoothScrollBy(int dx, int dy) {
if (!mScrollable) {
return;
}
smoothScrollBy(dx, dy);
if (mLockableScrollChangedListener != null) {
mLockableScrollChangedListener.onSmoothScrollBy(dx, dy);
}
} | java | void wrappedSmoothScrollBy(int dx, int dy) {
if (!mScrollable) {
return;
}
smoothScrollBy(dx, dy);
if (mLockableScrollChangedListener != null) {
mLockableScrollChangedListener.onSmoothScrollBy(dx, dy);
}
} | [
"void",
"wrappedSmoothScrollBy",
"(",
"int",
"dx",
",",
"int",
"dy",
")",
"{",
"if",
"(",
"!",
"mScrollable",
")",
"{",
"return",
";",
"}",
"smoothScrollBy",
"(",
"dx",
",",
"dy",
")",
";",
"if",
"(",
"mLockableScrollChangedListener",
"!=",
"null",
")",
... | Wrapping the {@link HorizontalScrollView#smoothScrollBy(int, int)} function to increase
testability.
@param dx the number of pixels to scroll by on the X axis
@param dy the number of pixels to scroll by on the Y axis | [
"Wrapping",
"the",
"{",
"@link",
"HorizontalScrollView#smoothScrollBy",
"(",
"int",
"int",
")",
"}",
"function",
"to",
"increase",
"testability",
"."
] | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/view/LockableHorizontalScrollView.java#L90-L99 |
PunchThrough/bean-sdk-android | sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/Chunk.java | Chunk.chunkCountFrom | public static <T extends Chunkable> int chunkCountFrom(T chunkable, int chunkLength) {
byte[] data = chunkable.getChunkableData();
return (int) Math.ceil(data.length * 1.0 / chunkLength);
} | java | public static <T extends Chunkable> int chunkCountFrom(T chunkable, int chunkLength) {
byte[] data = chunkable.getChunkableData();
return (int) Math.ceil(data.length * 1.0 / chunkLength);
} | [
"public",
"static",
"<",
"T",
"extends",
"Chunkable",
">",
"int",
"chunkCountFrom",
"(",
"T",
"chunkable",
",",
"int",
"chunkLength",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"chunkable",
".",
"getChunkableData",
"(",
")",
";",
"return",
"(",
"int",
")",... | Retrieve the count of chunks for a given chunk length.
@param chunkLength The length of each chunk
@return The number of chunks generated for a given chunk length | [
"Retrieve",
"the",
"count",
"of",
"chunks",
"for",
"a",
"given",
"chunk",
"length",
"."
] | train | https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/Chunk.java#L65-L68 |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java | AccountsEndpoint.switchAccountStatusTree | private void switchAccountStatusTree(Account parentAccount,
UserIdentityContext userIdentityContext) {
logger.debug("Status transition requested");
// transition child accounts
List<String> subAccountsToSwitch = accountsDao.getSubAccountSidsRecursive(parentAccount.getSid());
if (subAccountsToSwitch != null && !subAccountsToSwitch.isEmpty()) {
int i = subAccountsToSwitch.size(); // is is the count of accounts left to process
// we iterate backwards to handle child accounts first, parent accounts next
while (i > 0) {
i --;
String removedSid = subAccountsToSwitch.get(i);
try {
Account subAccount = accountsDao.getAccount(new Sid(removedSid));
switchAccountStatus(subAccount, parentAccount.getStatus(), userIdentityContext);
} catch (Exception e) {
// if anything bad happens, log the error and continue removing the rest of the accounts.
logger.error("Failed switching status (child) account '" + removedSid + "'");
}
}
}
// switch parent account too
switchAccountStatus(parentAccount, parentAccount.getStatus(), userIdentityContext);
} | java | private void switchAccountStatusTree(Account parentAccount,
UserIdentityContext userIdentityContext) {
logger.debug("Status transition requested");
// transition child accounts
List<String> subAccountsToSwitch = accountsDao.getSubAccountSidsRecursive(parentAccount.getSid());
if (subAccountsToSwitch != null && !subAccountsToSwitch.isEmpty()) {
int i = subAccountsToSwitch.size(); // is is the count of accounts left to process
// we iterate backwards to handle child accounts first, parent accounts next
while (i > 0) {
i --;
String removedSid = subAccountsToSwitch.get(i);
try {
Account subAccount = accountsDao.getAccount(new Sid(removedSid));
switchAccountStatus(subAccount, parentAccount.getStatus(), userIdentityContext);
} catch (Exception e) {
// if anything bad happens, log the error and continue removing the rest of the accounts.
logger.error("Failed switching status (child) account '" + removedSid + "'");
}
}
}
// switch parent account too
switchAccountStatus(parentAccount, parentAccount.getStatus(), userIdentityContext);
} | [
"private",
"void",
"switchAccountStatusTree",
"(",
"Account",
"parentAccount",
",",
"UserIdentityContext",
"userIdentityContext",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Status transition requested\"",
")",
";",
"// transition child accounts",
"List",
"<",
"String",
">"... | Switches status of account along with all its children (the whole tree).
@param parentAccount | [
"Switches",
"status",
"of",
"account",
"along",
"with",
"all",
"its",
"children",
"(",
"the",
"whole",
"tree",
")",
"."
] | train | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java#L806-L828 |
rabbitmq/hop | src/main/java/com/rabbitmq/http/client/Client.java | Client.declareShovel | public void declareShovel(String vhost, ShovelInfo info) {
Map<String, Object> props = info.getDetails().getPublishProperties();
if(props != null && props.isEmpty()) {
throw new IllegalArgumentException("Shovel publish properties must be a non-empty map or null");
}
final URI uri = uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(info.getName()));
this.rt.put(uri, info);
} | java | public void declareShovel(String vhost, ShovelInfo info) {
Map<String, Object> props = info.getDetails().getPublishProperties();
if(props != null && props.isEmpty()) {
throw new IllegalArgumentException("Shovel publish properties must be a non-empty map or null");
}
final URI uri = uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(info.getName()));
this.rt.put(uri, info);
} | [
"public",
"void",
"declareShovel",
"(",
"String",
"vhost",
",",
"ShovelInfo",
"info",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"props",
"=",
"info",
".",
"getDetails",
"(",
")",
".",
"getPublishProperties",
"(",
")",
";",
"if",
"(",
"props",
... | Declares a shovel.
@param vhost virtual host where to declare the shovel
@param info Shovel info. | [
"Declares",
"a",
"shovel",
"."
] | train | https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L768-L775 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsVfsSitemapService.java | CmsVfsSitemapService.ensureSingleLocale | void ensureSingleLocale(CmsXmlContainerPage containerPage, CmsResource localeRes) throws CmsException {
CmsObject cms = getCmsObject();
Locale mainLocale = CmsLocaleManager.getMainLocale(cms, localeRes);
OpenCms.getLocaleManager();
Locale defaultLocale = CmsLocaleManager.getDefaultLocale();
if (containerPage.hasLocale(mainLocale)) {
removeAllLocalesExcept(containerPage, mainLocale);
// remove other locales
} else if (containerPage.hasLocale(defaultLocale)) {
containerPage.copyLocale(defaultLocale, mainLocale);
removeAllLocalesExcept(containerPage, mainLocale);
} else if (containerPage.getLocales().size() > 0) {
containerPage.copyLocale(containerPage.getLocales().get(0), mainLocale);
removeAllLocalesExcept(containerPage, mainLocale);
} else {
containerPage.addLocale(cms, mainLocale);
}
} | java | void ensureSingleLocale(CmsXmlContainerPage containerPage, CmsResource localeRes) throws CmsException {
CmsObject cms = getCmsObject();
Locale mainLocale = CmsLocaleManager.getMainLocale(cms, localeRes);
OpenCms.getLocaleManager();
Locale defaultLocale = CmsLocaleManager.getDefaultLocale();
if (containerPage.hasLocale(mainLocale)) {
removeAllLocalesExcept(containerPage, mainLocale);
// remove other locales
} else if (containerPage.hasLocale(defaultLocale)) {
containerPage.copyLocale(defaultLocale, mainLocale);
removeAllLocalesExcept(containerPage, mainLocale);
} else if (containerPage.getLocales().size() > 0) {
containerPage.copyLocale(containerPage.getLocales().get(0), mainLocale);
removeAllLocalesExcept(containerPage, mainLocale);
} else {
containerPage.addLocale(cms, mainLocale);
}
} | [
"void",
"ensureSingleLocale",
"(",
"CmsXmlContainerPage",
"containerPage",
",",
"CmsResource",
"localeRes",
")",
"throws",
"CmsException",
"{",
"CmsObject",
"cms",
"=",
"getCmsObject",
"(",
")",
";",
"Locale",
"mainLocale",
"=",
"CmsLocaleManager",
".",
"getMainLocale... | Removes unnecessary locales from a container page.<p>
@param containerPage the container page which should be changed
@param localeRes the resource used to determine the locale
@throws CmsException if something goes wrong | [
"Removes",
"unnecessary",
"locales",
"from",
"a",
"container",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L1262-L1280 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.setDateHeader | @Deprecated
public static void setDateHeader(HttpMessage message, CharSequence name, Date value) {
if (value != null) {
message.headers().set(name, DateFormatter.format(value));
} else {
message.headers().set(name, null);
}
} | java | @Deprecated
public static void setDateHeader(HttpMessage message, CharSequence name, Date value) {
if (value != null) {
message.headers().set(name, DateFormatter.format(value));
} else {
message.headers().set(name, null);
}
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setDateHeader",
"(",
"HttpMessage",
"message",
",",
"CharSequence",
"name",
",",
"Date",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
... | @deprecated Use {@link #set(CharSequence, Object)} instead.
Sets a new date header with the specified name and value. If there
is an existing header with the same name, the existing header is removed.
The specified value is formatted as defined in
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1">RFC2616</a> | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Object",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L900-L907 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/spout/CheckpointSpout.java | CheckpointSpout.loadCheckpointState | private KeyValueState<String, CheckPointState> loadCheckpointState(Map conf, TopologyContext ctx) {
String namespace = ctx.getThisComponentId() + "-" + ctx.getThisTaskId();
KeyValueState<String, CheckPointState> state =
(KeyValueState<String, CheckPointState>) StateFactory.getState(namespace, conf, ctx);
if (state.get(TX_STATE_KEY) == null) {
CheckPointState txState = new CheckPointState(-1, CheckPointState.State.COMMITTED);
state.put(TX_STATE_KEY, txState);
state.commit();
LOG.debug("Initialized checkpoint spout state with txState {}", txState);
} else {
LOG.debug("Got checkpoint spout state {}", state.get(TX_STATE_KEY));
}
return state;
} | java | private KeyValueState<String, CheckPointState> loadCheckpointState(Map conf, TopologyContext ctx) {
String namespace = ctx.getThisComponentId() + "-" + ctx.getThisTaskId();
KeyValueState<String, CheckPointState> state =
(KeyValueState<String, CheckPointState>) StateFactory.getState(namespace, conf, ctx);
if (state.get(TX_STATE_KEY) == null) {
CheckPointState txState = new CheckPointState(-1, CheckPointState.State.COMMITTED);
state.put(TX_STATE_KEY, txState);
state.commit();
LOG.debug("Initialized checkpoint spout state with txState {}", txState);
} else {
LOG.debug("Got checkpoint spout state {}", state.get(TX_STATE_KEY));
}
return state;
} | [
"private",
"KeyValueState",
"<",
"String",
",",
"CheckPointState",
">",
"loadCheckpointState",
"(",
"Map",
"conf",
",",
"TopologyContext",
"ctx",
")",
"{",
"String",
"namespace",
"=",
"ctx",
".",
"getThisComponentId",
"(",
")",
"+",
"\"-\"",
"+",
"ctx",
".",
... | Loads the last saved checkpoint state the from persistent storage. | [
"Loads",
"the",
"last",
"saved",
"checkpoint",
"state",
"the",
"from",
"persistent",
"storage",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/spout/CheckpointSpout.java#L134-L147 |
bwkimmel/java-util | src/main/java/ca/eandb/util/io/StreamUtil.java | StreamUtil.writeBytes | public static void writeBytes(ByteBuffer bytes, OutputStream out) throws IOException {
final int BUFFER_LENGTH = 1024;
byte[] buffer;
if (bytes.remaining() >= BUFFER_LENGTH) {
buffer = new byte[BUFFER_LENGTH];
do {
bytes.get(buffer);
out.write(buffer);
} while (bytes.remaining() >= BUFFER_LENGTH);
} else {
buffer = new byte[bytes.remaining()];
}
int remaining = bytes.remaining();
if (remaining > 0) {
bytes.get(buffer, 0, remaining);
out.write(buffer, 0, remaining);
}
} | java | public static void writeBytes(ByteBuffer bytes, OutputStream out) throws IOException {
final int BUFFER_LENGTH = 1024;
byte[] buffer;
if (bytes.remaining() >= BUFFER_LENGTH) {
buffer = new byte[BUFFER_LENGTH];
do {
bytes.get(buffer);
out.write(buffer);
} while (bytes.remaining() >= BUFFER_LENGTH);
} else {
buffer = new byte[bytes.remaining()];
}
int remaining = bytes.remaining();
if (remaining > 0) {
bytes.get(buffer, 0, remaining);
out.write(buffer, 0, remaining);
}
} | [
"public",
"static",
"void",
"writeBytes",
"(",
"ByteBuffer",
"bytes",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"final",
"int",
"BUFFER_LENGTH",
"=",
"1024",
";",
"byte",
"[",
"]",
"buffer",
";",
"if",
"(",
"bytes",
".",
"remaining",
"... | Writes the contents of a <code>ByteBuffer</code> to the provided
<code>OutputStream</code>.
@param bytes The <code>ByteBuffer</code> containing the bytes to
write.
@param out The <code>OutputStream</code> to write to.
@throws IOException If unable to write to the
<code>OutputStream</code>. | [
"Writes",
"the",
"contents",
"of",
"a",
"<code",
">",
"ByteBuffer<",
"/",
"code",
">",
"to",
"the",
"provided",
"<code",
">",
"OutputStream<",
"/",
"code",
">",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/io/StreamUtil.java#L98-L117 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/view/ViewUtils.java | ViewUtils.findViewById | @SuppressWarnings("unchecked") // we know that return value type is a child of view, and V is bound to a child of view.
public static <V extends View> V findViewById(View view, int id) {
return (V) view.findViewById(id);
} | java | @SuppressWarnings("unchecked") // we know that return value type is a child of view, and V is bound to a child of view.
public static <V extends View> V findViewById(View view, int id) {
return (V) view.findViewById(id);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// we know that return value type is a child of view, and V is bound to a child of view.",
"public",
"static",
"<",
"V",
"extends",
"View",
">",
"V",
"findViewById",
"(",
"View",
"view",
",",
"int",
"id",
")",
"{",
"r... | Find the specific view from the view as traversal root.
Returning value type is bound to your variable type.
@param view the root view to find the view.
@param id the view id.
@param <V> the view class type parameter.
@return the view, null if not found. | [
"Find",
"the",
"specific",
"view",
"from",
"the",
"view",
"as",
"traversal",
"root",
".",
"Returning",
"value",
"type",
"is",
"bound",
"to",
"your",
"variable",
"type",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/ViewUtils.java#L137-L140 |
killbill/killbill | invoice/src/main/java/org/killbill/billing/invoice/dao/CBADao.java | CBADao.computeCBAComplexity | public InvoiceItemModelDao computeCBAComplexity(final InvoiceModelDao invoice,
@Nullable final BigDecimal accountCBAOrNull,
@Nullable final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory,
final InternalCallContext context) throws EntityPersistenceException, InvoiceApiException {
final BigDecimal balance = getInvoiceBalance(invoice);
if (balance.compareTo(BigDecimal.ZERO) < 0) {
// Current balance is negative, we need to generate a credit (positive CBA amount)
return buildCBAItem(invoice, balance, context);
} else if (balance.compareTo(BigDecimal.ZERO) > 0 && invoice.getStatus() == InvoiceStatus.COMMITTED && !invoice.isWrittenOff()) {
// Current balance is positive and the invoice is COMMITTED, we need to use some of the existing if available (negative CBA amount)
// PERF: in some codepaths, the CBA maybe have already been computed
BigDecimal accountCBA = accountCBAOrNull;
if (accountCBAOrNull == null) {
accountCBA = getAccountCBAFromTransaction(entitySqlDaoWrapperFactory, context);
}
if (accountCBA.compareTo(BigDecimal.ZERO) <= 0) {
return null;
}
final BigDecimal positiveCreditAmount = accountCBA.compareTo(balance) > 0 ? balance : accountCBA;
return buildCBAItem(invoice, positiveCreditAmount, context);
} else {
// 0 balance, nothing to do.
return null;
}
} | java | public InvoiceItemModelDao computeCBAComplexity(final InvoiceModelDao invoice,
@Nullable final BigDecimal accountCBAOrNull,
@Nullable final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory,
final InternalCallContext context) throws EntityPersistenceException, InvoiceApiException {
final BigDecimal balance = getInvoiceBalance(invoice);
if (balance.compareTo(BigDecimal.ZERO) < 0) {
// Current balance is negative, we need to generate a credit (positive CBA amount)
return buildCBAItem(invoice, balance, context);
} else if (balance.compareTo(BigDecimal.ZERO) > 0 && invoice.getStatus() == InvoiceStatus.COMMITTED && !invoice.isWrittenOff()) {
// Current balance is positive and the invoice is COMMITTED, we need to use some of the existing if available (negative CBA amount)
// PERF: in some codepaths, the CBA maybe have already been computed
BigDecimal accountCBA = accountCBAOrNull;
if (accountCBAOrNull == null) {
accountCBA = getAccountCBAFromTransaction(entitySqlDaoWrapperFactory, context);
}
if (accountCBA.compareTo(BigDecimal.ZERO) <= 0) {
return null;
}
final BigDecimal positiveCreditAmount = accountCBA.compareTo(balance) > 0 ? balance : accountCBA;
return buildCBAItem(invoice, positiveCreditAmount, context);
} else {
// 0 balance, nothing to do.
return null;
}
} | [
"public",
"InvoiceItemModelDao",
"computeCBAComplexity",
"(",
"final",
"InvoiceModelDao",
"invoice",
",",
"@",
"Nullable",
"final",
"BigDecimal",
"accountCBAOrNull",
",",
"@",
"Nullable",
"final",
"EntitySqlDaoWrapperFactory",
"entitySqlDaoWrapperFactory",
",",
"final",
"In... | We expect a clean up to date invoice, with all the items except the cba, that we will compute in that method | [
"We",
"expect",
"a",
"clean",
"up",
"to",
"date",
"invoice",
"with",
"all",
"the",
"items",
"except",
"the",
"cba",
"that",
"we",
"will",
"compute",
"in",
"that",
"method"
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/dao/CBADao.java#L58-L84 |
openengsb/openengsb | components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java | AbstractEDBService.runErrorHooks | private Long runErrorHooks(EDBCommit commit, EDBException exception) throws EDBException {
for (EDBErrorHook hook : errorHooks) {
try {
EDBCommit newCommit = hook.onError(commit, exception);
if (newCommit != null) {
return commit(newCommit);
}
} catch (ServiceUnavailableException e) {
// Ignore
} catch (EDBException e) {
exception = e;
break;
} catch (Exception e) {
logger.error("Error while performing EDBErrorHook", e);
}
}
throw exception;
} | java | private Long runErrorHooks(EDBCommit commit, EDBException exception) throws EDBException {
for (EDBErrorHook hook : errorHooks) {
try {
EDBCommit newCommit = hook.onError(commit, exception);
if (newCommit != null) {
return commit(newCommit);
}
} catch (ServiceUnavailableException e) {
// Ignore
} catch (EDBException e) {
exception = e;
break;
} catch (Exception e) {
logger.error("Error while performing EDBErrorHook", e);
}
}
throw exception;
} | [
"private",
"Long",
"runErrorHooks",
"(",
"EDBCommit",
"commit",
",",
"EDBException",
"exception",
")",
"throws",
"EDBException",
"{",
"for",
"(",
"EDBErrorHook",
"hook",
":",
"errorHooks",
")",
"{",
"try",
"{",
"EDBCommit",
"newCommit",
"=",
"hook",
".",
"onEr... | Runs all registered error hooks on the EDBCommit object. Logs exceptions which occurs in the hooks, except for
ServiceUnavailableExceptions and EDBExceptions. If an EDBException occurs, the function overrides the cause of
the error with the new Exception. If an error hook returns a new EDBCommit, the EDB tries to persist this commit
instead. | [
"Runs",
"all",
"registered",
"error",
"hooks",
"on",
"the",
"EDBCommit",
"object",
".",
"Logs",
"exceptions",
"which",
"occurs",
"in",
"the",
"hooks",
"except",
"for",
"ServiceUnavailableExceptions",
"and",
"EDBExceptions",
".",
"If",
"an",
"EDBException",
"occurs... | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java#L192-L209 |
opendigitaleducation/web-utils | src/main/java/org/vertx/java/core/http/RouteMatcher.java | RouteMatcher.optionsWithRegEx | public RouteMatcher optionsWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, optionsBindings);
return this;
} | java | public RouteMatcher optionsWithRegEx(String regex, Handler<HttpServerRequest> handler) {
addRegEx(regex, handler, optionsBindings);
return this;
} | [
"public",
"RouteMatcher",
"optionsWithRegEx",
"(",
"String",
"regex",
",",
"Handler",
"<",
"HttpServerRequest",
">",
"handler",
")",
"{",
"addRegEx",
"(",
"regex",
",",
"handler",
",",
"optionsBindings",
")",
";",
"return",
"this",
";",
"}"
] | Specify a handler that will be called for a matching HTTP OPTIONS
@param regex A regular expression
@param handler The handler to call | [
"Specify",
"a",
"handler",
"that",
"will",
"be",
"called",
"for",
"a",
"matching",
"HTTP",
"OPTIONS"
] | train | https://github.com/opendigitaleducation/web-utils/blob/5c12f7e8781a9a0fbbe7b8d9fb741627aa97a1e3/src/main/java/org/vertx/java/core/http/RouteMatcher.java#L249-L252 |
apache/incubator-gobblin | gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/ingestion/google/webmaster/GoogleWebmasterDataFetcherImpl.java | GoogleWebmasterDataFetcherImpl.getAllPages | @Override
public Collection<ProducerJob> getAllPages(String startDate, String endDate, String country, int rowLimit)
throws IOException {
log.info("Requested row limit: " + rowLimit);
if (!_jobs.isEmpty()) {
log.info("Service got hot started.");
return _jobs;
}
ApiDimensionFilter countryFilter = GoogleWebmasterFilter.countryEqFilter(country);
List<GoogleWebmasterFilter.Dimension> requestedDimensions = new ArrayList<>();
requestedDimensions.add(GoogleWebmasterFilter.Dimension.PAGE);
int expectedSize = -1;
if (rowLimit >= GoogleWebmasterClient.API_ROW_LIMIT) {
//expected size only makes sense when the data set size is larger than GoogleWebmasterClient.API_ROW_LIMIT
expectedSize = getPagesSize(startDate, endDate, country, requestedDimensions, Arrays.asList(countryFilter));
log.info(String.format("Expected number of pages is %d for market-%s from %s to %s", expectedSize,
GoogleWebmasterFilter.countryFilterToString(countryFilter), startDate, endDate));
}
Queue<Pair<String, FilterOperator>> jobs = new ArrayDeque<>();
jobs.add(Pair.of(_siteProperty, FilterOperator.CONTAINS));
Collection<String> allPages = getPages(startDate, endDate, requestedDimensions, countryFilter, jobs,
Math.min(rowLimit, GoogleWebmasterClient.API_ROW_LIMIT));
int actualSize = allPages.size();
log.info(String.format("A total of %d pages fetched for property %s at country-%s from %s to %s", actualSize,
_siteProperty, country, startDate, endDate));
if (expectedSize != -1 && actualSize != expectedSize) {
log.warn(String.format("Expected page size is %d, but only able to get %d", expectedSize, actualSize));
}
ArrayDeque<ProducerJob> producerJobs = new ArrayDeque<>(actualSize);
for (String page : allPages) {
producerJobs.add(new SimpleProducerJob(page, startDate, endDate));
}
return producerJobs;
} | java | @Override
public Collection<ProducerJob> getAllPages(String startDate, String endDate, String country, int rowLimit)
throws IOException {
log.info("Requested row limit: " + rowLimit);
if (!_jobs.isEmpty()) {
log.info("Service got hot started.");
return _jobs;
}
ApiDimensionFilter countryFilter = GoogleWebmasterFilter.countryEqFilter(country);
List<GoogleWebmasterFilter.Dimension> requestedDimensions = new ArrayList<>();
requestedDimensions.add(GoogleWebmasterFilter.Dimension.PAGE);
int expectedSize = -1;
if (rowLimit >= GoogleWebmasterClient.API_ROW_LIMIT) {
//expected size only makes sense when the data set size is larger than GoogleWebmasterClient.API_ROW_LIMIT
expectedSize = getPagesSize(startDate, endDate, country, requestedDimensions, Arrays.asList(countryFilter));
log.info(String.format("Expected number of pages is %d for market-%s from %s to %s", expectedSize,
GoogleWebmasterFilter.countryFilterToString(countryFilter), startDate, endDate));
}
Queue<Pair<String, FilterOperator>> jobs = new ArrayDeque<>();
jobs.add(Pair.of(_siteProperty, FilterOperator.CONTAINS));
Collection<String> allPages = getPages(startDate, endDate, requestedDimensions, countryFilter, jobs,
Math.min(rowLimit, GoogleWebmasterClient.API_ROW_LIMIT));
int actualSize = allPages.size();
log.info(String.format("A total of %d pages fetched for property %s at country-%s from %s to %s", actualSize,
_siteProperty, country, startDate, endDate));
if (expectedSize != -1 && actualSize != expectedSize) {
log.warn(String.format("Expected page size is %d, but only able to get %d", expectedSize, actualSize));
}
ArrayDeque<ProducerJob> producerJobs = new ArrayDeque<>(actualSize);
for (String page : allPages) {
producerJobs.add(new SimpleProducerJob(page, startDate, endDate));
}
return producerJobs;
} | [
"@",
"Override",
"public",
"Collection",
"<",
"ProducerJob",
">",
"getAllPages",
"(",
"String",
"startDate",
",",
"String",
"endDate",
",",
"String",
"country",
",",
"int",
"rowLimit",
")",
"throws",
"IOException",
"{",
"log",
".",
"info",
"(",
"\"Requested ro... | Due to the limitation of the API, we can get a maximum of 5000 rows at a time. Another limitation is that, results are sorted by click count descending. If two rows have the same click count, they are sorted in an arbitrary way. (Read more at https://developers.google.com/webmaster-tools/v3/searchanalytics). So we try to get all pages by partitions, if a partition has 5000 rows returned. We try partition current partition into more granular levels. | [
"Due",
"to",
"the",
"limitation",
"of",
"the",
"API",
"we",
"can",
"get",
"a",
"maximum",
"of",
"5000",
"rows",
"at",
"a",
"time",
".",
"Another",
"limitation",
"is",
"that",
"results",
"are",
"sorted",
"by",
"click",
"count",
"descending",
".",
"If",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/ingestion/google/webmaster/GoogleWebmasterDataFetcherImpl.java#L86-L124 |
groupon/odo | examples/api-usage/src/main/java/com/groupon/odo/sample/SampleClient.java | SampleClient.getHistory | public static void getHistory() throws Exception{
Client client = new Client("ProfileName", false);
// Obtain the 100 history entries starting from offset 0
History[] history = client.refreshHistory(100, 0);
client.clearHistory();
} | java | public static void getHistory() throws Exception{
Client client = new Client("ProfileName", false);
// Obtain the 100 history entries starting from offset 0
History[] history = client.refreshHistory(100, 0);
client.clearHistory();
} | [
"public",
"static",
"void",
"getHistory",
"(",
")",
"throws",
"Exception",
"{",
"Client",
"client",
"=",
"new",
"Client",
"(",
"\"ProfileName\"",
",",
"false",
")",
";",
"// Obtain the 100 history entries starting from offset 0",
"History",
"[",
"]",
"history",
"=",... | Demonstrates obtaining the request history data from a test run | [
"Demonstrates",
"obtaining",
"the",
"request",
"history",
"data",
"from",
"a",
"test",
"run"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/examples/api-usage/src/main/java/com/groupon/odo/sample/SampleClient.java#L99-L106 |
alipay/sofa-rpc | extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistry.java | SofaRegistry.doRegister | protected void doRegister(String appName, String serviceName, String serviceData, String group) {
PublisherRegistration publisherRegistration;
// 生成注册对象,并添加额外属性
publisherRegistration = new PublisherRegistration(serviceName);
publisherRegistration.setGroup(group);
addAttributes(publisherRegistration, group);
// 去注册
SofaRegistryClient.getRegistryClient(appName, registryConfig).register(publisherRegistration, serviceData);
} | java | protected void doRegister(String appName, String serviceName, String serviceData, String group) {
PublisherRegistration publisherRegistration;
// 生成注册对象,并添加额外属性
publisherRegistration = new PublisherRegistration(serviceName);
publisherRegistration.setGroup(group);
addAttributes(publisherRegistration, group);
// 去注册
SofaRegistryClient.getRegistryClient(appName, registryConfig).register(publisherRegistration, serviceData);
} | [
"protected",
"void",
"doRegister",
"(",
"String",
"appName",
",",
"String",
"serviceName",
",",
"String",
"serviceData",
",",
"String",
"group",
")",
"{",
"PublisherRegistration",
"publisherRegistration",
";",
"// 生成注册对象,并添加额外属性",
"publisherRegistration",
"=",
"new",
... | 注册单条服务信息
@param appName 应用
@param serviceName 服务关键字
@param serviceData 服务提供者数据
@param group 服务分组 | [
"注册单条服务信息"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-sofa/src/main/java/com/alipay/sofa/rpc/registry/sofa/SofaRegistry.java#L131-L141 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java | WebConfigParamUtils.getLongInitParameter | public static long getLongInitParameter(ExternalContext context, String name, long defaultValue)
{
if (name == null)
{
throw new NullPointerException();
}
String param = getStringInitParameter(context, name);
if (param == null)
{
return defaultValue;
}
else
{
return Long.parseLong(param.toLowerCase());
}
} | java | public static long getLongInitParameter(ExternalContext context, String name, long defaultValue)
{
if (name == null)
{
throw new NullPointerException();
}
String param = getStringInitParameter(context, name);
if (param == null)
{
return defaultValue;
}
else
{
return Long.parseLong(param.toLowerCase());
}
} | [
"public",
"static",
"long",
"getLongInitParameter",
"(",
"ExternalContext",
"context",
",",
"String",
"name",
",",
"long",
"defaultValue",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"Strin... | Gets the long init parameter value from the specified context. If the parameter was not specified, the default
value is used instead.
@param context
the application's external context
@param name
the init parameter's name
@param deprecatedName
the init parameter's deprecated name.
@param defaultValue
the default value to return in case the parameter was not set
@return the init parameter value as a long
@throws NullPointerException
if context or name is <code>null</code> | [
"Gets",
"the",
"long",
"init",
"parameter",
"value",
"from",
"the",
"specified",
"context",
".",
"If",
"the",
"parameter",
"was",
"not",
"specified",
"the",
"default",
"value",
"is",
"used",
"instead",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java#L583-L599 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/internal/specification/PropertyFieldExtractor.java | PropertyFieldExtractor.getStringValue | private String getStringValue(Object instance, Field field) throws IllegalAccessException {
Class<?> fieldType = field.getType();
// Only support primitive type, boxed type, String and Enum
Preconditions.checkArgument(
fieldType.isPrimitive() || Primitives.isWrapperType(fieldType) ||
String.class.equals(fieldType) || fieldType.isEnum(),
"Unsupported property type %s of field %s in class %s.",
fieldType.getName(), field.getName(), field.getDeclaringClass().getName()
);
if (!field.isAccessible()) {
field.setAccessible(true);
}
Object value = field.get(instance);
if (value == null) {
return null;
}
// Key name is "className.fieldName".
return fieldType.isEnum() ? ((Enum<?>) value).name() : value.toString();
} | java | private String getStringValue(Object instance, Field field) throws IllegalAccessException {
Class<?> fieldType = field.getType();
// Only support primitive type, boxed type, String and Enum
Preconditions.checkArgument(
fieldType.isPrimitive() || Primitives.isWrapperType(fieldType) ||
String.class.equals(fieldType) || fieldType.isEnum(),
"Unsupported property type %s of field %s in class %s.",
fieldType.getName(), field.getName(), field.getDeclaringClass().getName()
);
if (!field.isAccessible()) {
field.setAccessible(true);
}
Object value = field.get(instance);
if (value == null) {
return null;
}
// Key name is "className.fieldName".
return fieldType.isEnum() ? ((Enum<?>) value).name() : value.toString();
} | [
"private",
"String",
"getStringValue",
"(",
"Object",
"instance",
",",
"Field",
"field",
")",
"throws",
"IllegalAccessException",
"{",
"Class",
"<",
"?",
">",
"fieldType",
"=",
"field",
".",
"getType",
"(",
")",
";",
"// Only support primitive type, boxed type, Stri... | Gets the value of the field in the given instance as String.
Currently only allows primitive types, boxed types, String and Enum. | [
"Gets",
"the",
"value",
"of",
"the",
"field",
"in",
"the",
"given",
"instance",
"as",
"String",
".",
"Currently",
"only",
"allows",
"primitive",
"types",
"boxed",
"types",
"String",
"and",
"Enum",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/specification/PropertyFieldExtractor.java#L64-L85 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRBitmapImage.java | GVRBitmapImage.setBuffer | public void setBuffer(final int width, final int height, final int format, final int type, final Buffer pixels)
{
NativeBitmapImage.updateFromBuffer(getNative(), 0, 0, width, height, format, type, pixels);
} | java | public void setBuffer(final int width, final int height, final int format, final int type, final Buffer pixels)
{
NativeBitmapImage.updateFromBuffer(getNative(), 0, 0, width, height, format, type, pixels);
} | [
"public",
"void",
"setBuffer",
"(",
"final",
"int",
"width",
",",
"final",
"int",
"height",
",",
"final",
"int",
"format",
",",
"final",
"int",
"type",
",",
"final",
"Buffer",
"pixels",
")",
"{",
"NativeBitmapImage",
".",
"updateFromBuffer",
"(",
"getNative"... | Copy a new texture from a {@link Buffer} to the GPU texture. This one is also safe even
in a non-GL thread. An updateGPU request on a non-GL thread will
be forwarded to the GL thread and be executed before main rendering happens.
Creating a new {@link GVRImage} is pretty cheap, but it's still not a
totally trivial operation: it does involve some memory management and
some GL hardware handshaking. Reusing the texture reduces this overhead
(primarily by delaying garbage collection). Do be aware that updating a
texture will affect any and all {@linkplain GVRMaterial materials}
(and/or post effects that use the texture!
@param width
Texture width, in texels
@param height
Texture height, in texels
@param format
Texture format
@param type
Texture type
@param pixels
A NIO Buffer with the texture | [
"Copy",
"a",
"new",
"texture",
"from",
"a",
"{",
"@link",
"Buffer",
"}",
"to",
"the",
"GPU",
"texture",
".",
"This",
"one",
"is",
"also",
"safe",
"even",
"in",
"a",
"non",
"-",
"GL",
"thread",
".",
"An",
"updateGPU",
"request",
"on",
"a",
"non",
"-... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRBitmapImage.java#L176-L179 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java | GrailsDomainBinder.linkBidirectionalOneToMany | protected void linkBidirectionalOneToMany(Collection collection, PersistentClass associatedClass, DependantValue key, PersistentProperty otherSide) {
collection.setInverse(true);
// Iterator mappedByColumns = associatedClass.getProperty(otherSide.getName()).getValue().getColumnIterator();
Iterator<?> mappedByColumns = getProperty(associatedClass, otherSide.getName()).getValue().getColumnIterator();
while (mappedByColumns.hasNext()) {
Column column = (Column) mappedByColumns.next();
linkValueUsingAColumnCopy(otherSide, column, key);
}
} | java | protected void linkBidirectionalOneToMany(Collection collection, PersistentClass associatedClass, DependantValue key, PersistentProperty otherSide) {
collection.setInverse(true);
// Iterator mappedByColumns = associatedClass.getProperty(otherSide.getName()).getValue().getColumnIterator();
Iterator<?> mappedByColumns = getProperty(associatedClass, otherSide.getName()).getValue().getColumnIterator();
while (mappedByColumns.hasNext()) {
Column column = (Column) mappedByColumns.next();
linkValueUsingAColumnCopy(otherSide, column, key);
}
} | [
"protected",
"void",
"linkBidirectionalOneToMany",
"(",
"Collection",
"collection",
",",
"PersistentClass",
"associatedClass",
",",
"DependantValue",
"key",
",",
"PersistentProperty",
"otherSide",
")",
"{",
"collection",
".",
"setInverse",
"(",
"true",
")",
";",
"// I... | Links a bidirectional one-to-many, configuring the inverse side and using a column copy to perform the link
@param collection The collection one-to-many
@param associatedClass The associated class
@param key The key
@param otherSide The other side of the relationship | [
"Links",
"a",
"bidirectional",
"one",
"-",
"to",
"-",
"many",
"configuring",
"the",
"inverse",
"side",
"and",
"using",
"a",
"column",
"copy",
"to",
"perform",
"the",
"link"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L964-L973 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Sheet.java | Sheet.swapColumns | public void swapColumns(Object columnKeyA, Object columnKeyB) {
checkFrozen();
final int columnIndexA = this.getColumnIndex(columnKeyA);
final int columnIndexB = this.getColumnIndex(columnKeyB);
final List<C> tmp = new ArrayList<>(rowLength());
tmp.addAll(_columnKeySet);
final C tmpColumnKeyA = tmp.get(columnIndexA);
tmp.set(columnIndexA, tmp.get(columnIndexB));
tmp.set(columnIndexB, tmpColumnKeyA);
_columnKeySet.clear();
_columnKeySet.addAll(tmp);
_columnKeyIndexMap.forcePut(tmp.get(columnIndexA), columnIndexA);
_columnKeyIndexMap.forcePut(tmp.get(columnIndexB), columnIndexB);
if (_initialized && _columnList.size() > 0) {
final List<E> tmpColumnA = _columnList.get(columnIndexA);
_columnList.set(columnIndexA, _columnList.get(columnIndexB));
_columnList.set(columnIndexB, tmpColumnA);
}
} | java | public void swapColumns(Object columnKeyA, Object columnKeyB) {
checkFrozen();
final int columnIndexA = this.getColumnIndex(columnKeyA);
final int columnIndexB = this.getColumnIndex(columnKeyB);
final List<C> tmp = new ArrayList<>(rowLength());
tmp.addAll(_columnKeySet);
final C tmpColumnKeyA = tmp.get(columnIndexA);
tmp.set(columnIndexA, tmp.get(columnIndexB));
tmp.set(columnIndexB, tmpColumnKeyA);
_columnKeySet.clear();
_columnKeySet.addAll(tmp);
_columnKeyIndexMap.forcePut(tmp.get(columnIndexA), columnIndexA);
_columnKeyIndexMap.forcePut(tmp.get(columnIndexB), columnIndexB);
if (_initialized && _columnList.size() > 0) {
final List<E> tmpColumnA = _columnList.get(columnIndexA);
_columnList.set(columnIndexA, _columnList.get(columnIndexB));
_columnList.set(columnIndexB, tmpColumnA);
}
} | [
"public",
"void",
"swapColumns",
"(",
"Object",
"columnKeyA",
",",
"Object",
"columnKeyB",
")",
"{",
"checkFrozen",
"(",
")",
";",
"final",
"int",
"columnIndexA",
"=",
"this",
".",
"getColumnIndex",
"(",
"columnKeyA",
")",
";",
"final",
"int",
"columnIndexB",
... | Swap the positions of the two specified columns.
@param columnKeyA
@param columnKeyB | [
"Swap",
"the",
"positions",
"of",
"the",
"two",
"specified",
"columns",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Sheet.java#L849-L873 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java | GVRAssetLoader.loadModel | public void loadModel(final GVRSceneObject model, final GVRResourceVolume volume, final EnumSet<GVRImportSettings> settings, final GVRScene scene)
{
Threads.spawn(new Runnable()
{
public void run()
{
String filePath = volume.getFileName();
AssetRequest assetRequest = new AssetRequest(model, volume, scene, null, false);
String ext = filePath.substring(filePath.length() - 3).toLowerCase();
model.setName(assetRequest.getBaseName());
assetRequest.setImportSettings(settings);
try
{
if (ext.equals("x3d"))
{
loadX3DModel(assetRequest, model);
}
else
{
loadJassimpModel(assetRequest, model);
}
}
catch (IOException ex)
{
// onModelError is generated in this case.
}
}
});
} | java | public void loadModel(final GVRSceneObject model, final GVRResourceVolume volume, final EnumSet<GVRImportSettings> settings, final GVRScene scene)
{
Threads.spawn(new Runnable()
{
public void run()
{
String filePath = volume.getFileName();
AssetRequest assetRequest = new AssetRequest(model, volume, scene, null, false);
String ext = filePath.substring(filePath.length() - 3).toLowerCase();
model.setName(assetRequest.getBaseName());
assetRequest.setImportSettings(settings);
try
{
if (ext.equals("x3d"))
{
loadX3DModel(assetRequest, model);
}
else
{
loadJassimpModel(assetRequest, model);
}
}
catch (IOException ex)
{
// onModelError is generated in this case.
}
}
});
} | [
"public",
"void",
"loadModel",
"(",
"final",
"GVRSceneObject",
"model",
",",
"final",
"GVRResourceVolume",
"volume",
",",
"final",
"EnumSet",
"<",
"GVRImportSettings",
">",
"settings",
",",
"final",
"GVRScene",
"scene",
")",
"{",
"Threads",
".",
"spawn",
"(",
... | Loads a hierarchy of scene objects {@link GVRSceneObject} asymchronously from a 3D model
on the volume provided and adds it to the specified scene.
<p>
and will return before the model is loaded.
IAssetEvents are emitted to event listeners attached to the context.
The resource volume may reference res/raw in which case all textures
and other referenced assets must also come from res/raw. The asset loader
cannot load textures from the drawable directory.
@param model
A GVRSceneObject to become the root of the loaded model.
@param volume
A GVRResourceVolume based on the asset path to load.
This volume will be used as the base for loading textures
and other models contained within the model.
You can subclass GVRResourceVolume to provide custom IO.
@param settings
Import settings controlling how assets are imported
@param scene
If present, this asset loader will wait until all of the textures have been
loaded and then it will add the model to the scene.
@see #loadMesh(GVRAndroidResource.MeshCallback, GVRAndroidResource, int)
@see #loadScene(GVRSceneObject, GVRResourceVolume, EnumSet, GVRScene, IAssetEvents) | [
"Loads",
"a",
"hierarchy",
"of",
"scene",
"objects",
"{",
"@link",
"GVRSceneObject",
"}",
"asymchronously",
"from",
"a",
"3D",
"model",
"on",
"the",
"volume",
"provided",
"and",
"adds",
"it",
"to",
"the",
"specified",
"scene",
".",
"<p",
">",
"and",
"will"... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRAssetLoader.java#L1343-L1372 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java | StringBuilders.appendDqValue | public static StringBuilder appendDqValue(final StringBuilder sb, final Object value) {
return sb.append(Chars.DQUOTE).append(value).append(Chars.DQUOTE);
} | java | public static StringBuilder appendDqValue(final StringBuilder sb, final Object value) {
return sb.append(Chars.DQUOTE).append(value).append(Chars.DQUOTE);
} | [
"public",
"static",
"StringBuilder",
"appendDqValue",
"(",
"final",
"StringBuilder",
"sb",
",",
"final",
"Object",
"value",
")",
"{",
"return",
"sb",
".",
"append",
"(",
"Chars",
".",
"DQUOTE",
")",
".",
"append",
"(",
"value",
")",
".",
"append",
"(",
"... | Appends in the following format: double quoted value.
@param sb a string builder
@param value a value
@return {@code "value"} | [
"Appends",
"in",
"the",
"following",
"format",
":",
"double",
"quoted",
"value",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java#L37-L39 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java | DOMHelper.isNodeTheSame | public static boolean isNodeTheSame(Node node1, Node node2)
{
if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy)
return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2);
else
return (node1 == node2);
} | java | public static boolean isNodeTheSame(Node node1, Node node2)
{
if (node1 instanceof DTMNodeProxy && node2 instanceof DTMNodeProxy)
return ((DTMNodeProxy)node1).equals((DTMNodeProxy)node2);
else
return (node1 == node2);
} | [
"public",
"static",
"boolean",
"isNodeTheSame",
"(",
"Node",
"node1",
",",
"Node",
"node2",
")",
"{",
"if",
"(",
"node1",
"instanceof",
"DTMNodeProxy",
"&&",
"node2",
"instanceof",
"DTMNodeProxy",
")",
"return",
"(",
"(",
"DTMNodeProxy",
")",
"node1",
")",
"... | Use DTMNodeProxy to determine whether two nodes are the same.
@param node1 The first DOM node to compare.
@param node2 The second DOM node to compare.
@return true if the two nodes are the same. | [
"Use",
"DTMNodeProxy",
"to",
"determine",
"whether",
"two",
"nodes",
"are",
"the",
"same",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java#L339-L345 |
atomix/atomix | utils/src/main/java/io/atomix/utils/concurrent/AbstractAccumulator.java | AbstractAccumulator.rescheduleTask | private void rescheduleTask(AtomicReference<TimerTask> taskRef, long millis) {
ProcessorTask newTask = new ProcessorTask();
timer.schedule(newTask, millis);
swapAndCancelTask(taskRef, newTask);
} | java | private void rescheduleTask(AtomicReference<TimerTask> taskRef, long millis) {
ProcessorTask newTask = new ProcessorTask();
timer.schedule(newTask, millis);
swapAndCancelTask(taskRef, newTask);
} | [
"private",
"void",
"rescheduleTask",
"(",
"AtomicReference",
"<",
"TimerTask",
">",
"taskRef",
",",
"long",
"millis",
")",
"{",
"ProcessorTask",
"newTask",
"=",
"new",
"ProcessorTask",
"(",
")",
";",
"timer",
".",
"schedule",
"(",
"newTask",
",",
"millis",
"... | Reschedules the specified task, cancelling existing one if applicable.
@param taskRef task reference
@param millis delay in milliseconds | [
"Reschedules",
"the",
"specified",
"task",
"cancelling",
"existing",
"one",
"if",
"applicable",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/utils/src/main/java/io/atomix/utils/concurrent/AbstractAccumulator.java#L124-L128 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/config/LaunchConfigurationConfigurator.java | LaunchConfigurationConfigurator.setMainJavaClass | protected static void setMainJavaClass(ILaunchConfigurationWorkingCopy wc, String name) {
wc.setAttribute(
IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
name);
} | java | protected static void setMainJavaClass(ILaunchConfigurationWorkingCopy wc, String name) {
wc.setAttribute(
IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
name);
} | [
"protected",
"static",
"void",
"setMainJavaClass",
"(",
"ILaunchConfigurationWorkingCopy",
"wc",
",",
"String",
"name",
")",
"{",
"wc",
".",
"setAttribute",
"(",
"IJavaLaunchConfigurationConstants",
".",
"ATTR_MAIN_TYPE_NAME",
",",
"name",
")",
";",
"}"
] | Change the main java class within the given configuration.
@param wc the configuration to change.
@param name the qualified name of the main Java class.
@since 0.7 | [
"Change",
"the",
"main",
"java",
"class",
"within",
"the",
"given",
"configuration",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/config/LaunchConfigurationConfigurator.java#L201-L205 |
apache/incubator-gobblin | gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/MRCompactorJobRunner.java | MRCompactorJobRunner.getCompactionTimestamp | private DateTime getCompactionTimestamp() throws IOException {
DateTimeZone timeZone = DateTimeZone.forID(
this.dataset.jobProps().getProp(MRCompactor.COMPACTION_TIMEZONE, MRCompactor.DEFAULT_COMPACTION_TIMEZONE));
if (!this.recompactFromDestPaths) {
return new DateTime(timeZone);
}
Set<Path> inputPaths = getInputPaths();
long maxTimestamp = Long.MIN_VALUE;
for (FileStatus status : FileListUtils.listFilesRecursively(this.fs, inputPaths)) {
maxTimestamp = Math.max(maxTimestamp, status.getModificationTime());
}
return maxTimestamp == Long.MIN_VALUE ? new DateTime(timeZone) : new DateTime(maxTimestamp, timeZone);
} | java | private DateTime getCompactionTimestamp() throws IOException {
DateTimeZone timeZone = DateTimeZone.forID(
this.dataset.jobProps().getProp(MRCompactor.COMPACTION_TIMEZONE, MRCompactor.DEFAULT_COMPACTION_TIMEZONE));
if (!this.recompactFromDestPaths) {
return new DateTime(timeZone);
}
Set<Path> inputPaths = getInputPaths();
long maxTimestamp = Long.MIN_VALUE;
for (FileStatus status : FileListUtils.listFilesRecursively(this.fs, inputPaths)) {
maxTimestamp = Math.max(maxTimestamp, status.getModificationTime());
}
return maxTimestamp == Long.MIN_VALUE ? new DateTime(timeZone) : new DateTime(maxTimestamp, timeZone);
} | [
"private",
"DateTime",
"getCompactionTimestamp",
"(",
")",
"throws",
"IOException",
"{",
"DateTimeZone",
"timeZone",
"=",
"DateTimeZone",
".",
"forID",
"(",
"this",
".",
"dataset",
".",
"jobProps",
"(",
")",
".",
"getProp",
"(",
"MRCompactor",
".",
"COMPACTION_T... | For regular compactions, compaction timestamp is the time the compaction job starts.
If this is a recompaction from output paths, the compaction timestamp will remain the same as previously
persisted compaction time. This is because such a recompaction doesn't consume input data, so next time,
whether a file in the input folder is considered late file should still be based on the previous compaction
timestamp. | [
"For",
"regular",
"compactions",
"compaction",
"timestamp",
"is",
"the",
"time",
"the",
"compaction",
"job",
"starts",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/mapreduce/MRCompactorJobRunner.java#L372-L386 |
marklogic/marklogic-contentpump | mlcp/src/main/java/com/marklogic/contentpump/ContentPump.java | ContentPump.setClassLoader | private static void setClassLoader(File hdConfDir, Configuration conf)
throws Exception {
ClassLoader parent = conf.getClassLoader();
URL url = hdConfDir.toURI().toURL();
URL[] urls = new URL[1];
urls[0] = url;
ClassLoader classLoader = new URLClassLoader(urls, parent);
Thread.currentThread().setContextClassLoader(classLoader);
conf.setClassLoader(classLoader);
} | java | private static void setClassLoader(File hdConfDir, Configuration conf)
throws Exception {
ClassLoader parent = conf.getClassLoader();
URL url = hdConfDir.toURI().toURL();
URL[] urls = new URL[1];
urls[0] = url;
ClassLoader classLoader = new URLClassLoader(urls, parent);
Thread.currentThread().setContextClassLoader(classLoader);
conf.setClassLoader(classLoader);
} | [
"private",
"static",
"void",
"setClassLoader",
"(",
"File",
"hdConfDir",
",",
"Configuration",
"conf",
")",
"throws",
"Exception",
"{",
"ClassLoader",
"parent",
"=",
"conf",
".",
"getClassLoader",
"(",
")",
";",
"URL",
"url",
"=",
"hdConfDir",
".",
"toURI",
... | Set class loader for current thread and for Confifguration based on
Hadoop home.
@param hdConfDir Hadoop home directory
@param conf Hadoop configuration
@throws MalformedURLException | [
"Set",
"class",
"loader",
"for",
"current",
"thread",
"and",
"for",
"Confifguration",
"based",
"on",
"Hadoop",
"home",
"."
] | train | https://github.com/marklogic/marklogic-contentpump/blob/4c41e4a953301f81a4c655efb2a847603dee8afc/mlcp/src/main/java/com/marklogic/contentpump/ContentPump.java#L261-L270 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java | Download.toFile | public static void toFile(final HttpConfig config, final File file) {
toFile(config, ContentTypes.ANY.getAt(0), file);
} | java | public static void toFile(final HttpConfig config, final File file) {
toFile(config, ContentTypes.ANY.getAt(0), file);
} | [
"public",
"static",
"void",
"toFile",
"(",
"final",
"HttpConfig",
"config",
",",
"final",
"File",
"file",
")",
"{",
"toFile",
"(",
"config",
",",
"ContentTypes",
".",
"ANY",
".",
"getAt",
"(",
"0",
")",
",",
"file",
")",
";",
"}"
] | Downloads the content to a specified file.
@param config the `HttpConfig` instance
@param file the file where content will be downloaded | [
"Downloads",
"the",
"content",
"to",
"a",
"specified",
"file",
"."
] | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java#L81-L83 |
Clivern/Racter | src/main/java/com/clivern/racter/senders/templates/GenericTemplate.java | GenericTemplate.setElementDefaultAction | public void setElementDefaultAction(Integer index, String type, String url, Boolean messenger_extensions, String webview_height_ratio, String fallback_url)
{
this.elements.get(index).put("default_action_type", type);
this.elements.get(index).put("default_action_url", url);
this.elements.get(index).put("default_action_messenger_extensions", String.valueOf(messenger_extensions));
this.elements.get(index).put("default_action_webview_height_ratio", webview_height_ratio);
this.elements.get(index).put("default_action_fallback_url", fallback_url);
} | java | public void setElementDefaultAction(Integer index, String type, String url, Boolean messenger_extensions, String webview_height_ratio, String fallback_url)
{
this.elements.get(index).put("default_action_type", type);
this.elements.get(index).put("default_action_url", url);
this.elements.get(index).put("default_action_messenger_extensions", String.valueOf(messenger_extensions));
this.elements.get(index).put("default_action_webview_height_ratio", webview_height_ratio);
this.elements.get(index).put("default_action_fallback_url", fallback_url);
} | [
"public",
"void",
"setElementDefaultAction",
"(",
"Integer",
"index",
",",
"String",
"type",
",",
"String",
"url",
",",
"Boolean",
"messenger_extensions",
",",
"String",
"webview_height_ratio",
",",
"String",
"fallback_url",
")",
"{",
"this",
".",
"elements",
".",... | Set Element Default Action
@param index the element index
@param type the element type
@param url the element url
@param messenger_extensions the messenger extensions
@param webview_height_ratio the webview height ratio
@param fallback_url the fallback url | [
"Set",
"Element",
"Default",
"Action"
] | train | https://github.com/Clivern/Racter/blob/bbde02f0c2a8a80653ad6b1607376d8408acd71c/src/main/java/com/clivern/racter/senders/templates/GenericTemplate.java#L84-L91 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201902/activitygroupservice/GetActiveActivityGroups.java | GetActiveActivityGroups.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
ActivityGroupServiceInterface activityGroupService =
adManagerServices.get(session, ActivityGroupServiceInterface.class);
// Create a statement to select activity groups.
StatementBuilder statementBuilder =
new StatementBuilder()
.where("status = :status")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", ActivityGroupStatus.ACTIVE.toString());
// Retrieve a small amount of activity groups at a time, paging through
// until all activity groups have been retrieved.
int totalResultSetSize = 0;
do {
ActivityGroupPage page =
activityGroupService.getActivityGroupsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each activity group.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (ActivityGroup activityGroup : page.getResults()) {
System.out.printf(
"%d) Activity group with ID %d and name '%s' was found.%n",
i++, activityGroup.getId(), activityGroup.getName());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
ActivityGroupServiceInterface activityGroupService =
adManagerServices.get(session, ActivityGroupServiceInterface.class);
// Create a statement to select activity groups.
StatementBuilder statementBuilder =
new StatementBuilder()
.where("status = :status")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", ActivityGroupStatus.ACTIVE.toString());
// Retrieve a small amount of activity groups at a time, paging through
// until all activity groups have been retrieved.
int totalResultSetSize = 0;
do {
ActivityGroupPage page =
activityGroupService.getActivityGroupsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each activity group.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (ActivityGroup activityGroup : page.getResults()) {
System.out.printf(
"%d) Activity group with ID %d and name '%s' was found.%n",
i++, activityGroup.getId(), activityGroup.getName());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"ActivityGroupServiceInterface",
"activityGroupService",
"=",
"adManagerServices",
".",
"get",
"(",
"session",... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/activitygroupservice/GetActiveActivityGroups.java#L52-L87 |
zaproxy/zaproxy | src/org/zaproxy/zap/view/StandardFieldsDialog.java | StandardFieldsDialog.setContextValue | public void setContextValue(String fieldLabel, Context context) {
Component c = this.fieldMap.get(fieldLabel);
if (c != null) {
if (c instanceof ContextSelectComboBox) {
((ContextSelectComboBox) c).setSelectedItem(context);
} else {
handleUnexpectedFieldClass(fieldLabel, c);
}
}
} | java | public void setContextValue(String fieldLabel, Context context) {
Component c = this.fieldMap.get(fieldLabel);
if (c != null) {
if (c instanceof ContextSelectComboBox) {
((ContextSelectComboBox) c).setSelectedItem(context);
} else {
handleUnexpectedFieldClass(fieldLabel, c);
}
}
} | [
"public",
"void",
"setContextValue",
"(",
"String",
"fieldLabel",
",",
"Context",
"context",
")",
"{",
"Component",
"c",
"=",
"this",
".",
"fieldMap",
".",
"get",
"(",
"fieldLabel",
")",
";",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"if",
"(",
"c",
"i... | Sets the (selected) context of a {@link ContextSelectComboBox} field.
<p>
The call to this method has no effect it the context is not present in the combo box.
@param fieldLabel the label of the field
@param context the context to be set/selected, {@code null} to clear the selection.
@since 2.6.0
@see #getContextValue(String)
@see #addContextSelectField(String, Context) | [
"Sets",
"the",
"(",
"selected",
")",
"context",
"of",
"a",
"{",
"@link",
"ContextSelectComboBox",
"}",
"field",
".",
"<p",
">",
"The",
"call",
"to",
"this",
"method",
"has",
"no",
"effect",
"it",
"the",
"context",
"is",
"not",
"present",
"in",
"the",
"... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/view/StandardFieldsDialog.java#L1569-L1578 |
deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.clientMessageHandler | protected void clientMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming messages here are supposed to be "just messages", only unicast communication
* All of them should implement MeaningfulMessage interface
*/
// TODO: to be implemented
// log.info("clientMessageHandler message request incoming");
byte[] data = new byte[length];
buffer.getBytes(offset, data);
MeaningfulMessage message = (MeaningfulMessage) VoidMessage.fromBytes(data);
completed.put(message.getTaskId(), message);
} | java | protected void clientMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming messages here are supposed to be "just messages", only unicast communication
* All of them should implement MeaningfulMessage interface
*/
// TODO: to be implemented
// log.info("clientMessageHandler message request incoming");
byte[] data = new byte[length];
buffer.getBytes(offset, data);
MeaningfulMessage message = (MeaningfulMessage) VoidMessage.fromBytes(data);
completed.put(message.getTaskId(), message);
} | [
"protected",
"void",
"clientMessageHandler",
"(",
"DirectBuffer",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Header",
"header",
")",
"{",
"/**\n * All incoming messages here are supposed to be \"just messages\", only unicast communication\n * All ... | This message handler is responsible for receiving messages on Client side
@param buffer
@param offset
@param length
@param header | [
"This",
"message",
"handler",
"is",
"responsible",
"for",
"receiving",
"messages",
"on",
"Client",
"side"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L269-L282 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContextProperties.java | ProcessContextProperties.getDataUsageNameIndexes | private Set<Integer> getDataUsageNameIndexes() throws PropertyException {
Set<Integer> result = new HashSet<>();
Set<String> dataUsageNames = getDataUsageNameList();
if (dataUsageNames.isEmpty()) {
return result;
}
for (String dataUsageName : dataUsageNames) {
int separatorIndex = dataUsageName.lastIndexOf("_");
if (separatorIndex == -1 || (dataUsageName.length() == separatorIndex + 1)) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "Corrupted property file (invalid data usage name)");
}
Integer index = null;
try {
index = Integer.parseInt(dataUsageName.substring(separatorIndex + 1));
} catch (Exception e) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "Corrupted property file (invalid data usage name)");
}
result.add(index);
}
return result;
} | java | private Set<Integer> getDataUsageNameIndexes() throws PropertyException {
Set<Integer> result = new HashSet<>();
Set<String> dataUsageNames = getDataUsageNameList();
if (dataUsageNames.isEmpty()) {
return result;
}
for (String dataUsageName : dataUsageNames) {
int separatorIndex = dataUsageName.lastIndexOf("_");
if (separatorIndex == -1 || (dataUsageName.length() == separatorIndex + 1)) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "Corrupted property file (invalid data usage name)");
}
Integer index = null;
try {
index = Integer.parseInt(dataUsageName.substring(separatorIndex + 1));
} catch (Exception e) {
throw new PropertyException(ProcessContextProperty.DATA_USAGE, dataUsageName, "Corrupted property file (invalid data usage name)");
}
result.add(index);
}
return result;
} | [
"private",
"Set",
"<",
"Integer",
">",
"getDataUsageNameIndexes",
"(",
")",
"throws",
"PropertyException",
"{",
"Set",
"<",
"Integer",
">",
"result",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"Set",
"<",
"String",
">",
"dataUsageNames",
"=",
"getDataUsageN... | Returns all used indexes for data usage property names.<br>
Constraint names are enumerated (DATA_USAGE_1, DATA_USAGE_2, ...).<br>
When new data usages are added, the lowest unused index is used within
the new property name.
@return The set of indexes in use.
@throws PropertyException if existing constraint names are invalid (e.g.
due to external file manipulation). | [
"Returns",
"all",
"used",
"indexes",
"for",
"data",
"usage",
"property",
"names",
".",
"<br",
">",
"Constraint",
"names",
"are",
"enumerated",
"(",
"DATA_USAGE_1",
"DATA_USAGE_2",
"...",
")",
".",
"<br",
">",
"When",
"new",
"data",
"usages",
"are",
"added",
... | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContextProperties.java#L234-L254 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/EncodingGroovyMethods.java | EncodingGroovyMethods.encodeBase64Url | public static Writable encodeBase64Url(Byte[] data, boolean pad) {
return encodeBase64Url(DefaultTypeTransformation.convertToByteArray(data), pad);
} | java | public static Writable encodeBase64Url(Byte[] data, boolean pad) {
return encodeBase64Url(DefaultTypeTransformation.convertToByteArray(data), pad);
} | [
"public",
"static",
"Writable",
"encodeBase64Url",
"(",
"Byte",
"[",
"]",
"data",
",",
"boolean",
"pad",
")",
"{",
"return",
"encodeBase64Url",
"(",
"DefaultTypeTransformation",
".",
"convertToByteArray",
"(",
"data",
")",
",",
"pad",
")",
";",
"}"
] | Produce a Writable object which writes the Base64 URL and Filename Safe encoding of the byte array.
Calling toString() on the result returns the encoding as a String. For more
information on Base64 URL and Filename Safe encoding see <code>RFC 4648 - Section 5
Base 64 Encoding with URL and Filename Safe Alphabet</code>.
@param data Byte array to be encoded
@param pad whether or not the encoded data should be padded
@return object which will write the Base64 URL and Filename Safe encoding of the byte array
@since 2.5.0 | [
"Produce",
"a",
"Writable",
"object",
"which",
"writes",
"the",
"Base64",
"URL",
"and",
"Filename",
"Safe",
"encoding",
"of",
"the",
"byte",
"array",
".",
"Calling",
"toString",
"()",
"on",
"the",
"result",
"returns",
"the",
"encoding",
"as",
"a",
"String",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/EncodingGroovyMethods.java#L193-L195 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java | ArrayUtil.endsWith | public static int endsWith(String str, String[] arr)
{
if ( arr == null ) {
return -1;
}
for ( int i = 0; i < arr.length; i++ ) {
if ( arr[i].endsWith(str) ) {
return i;
}
}
return -1;
} | java | public static int endsWith(String str, String[] arr)
{
if ( arr == null ) {
return -1;
}
for ( int i = 0; i < arr.length; i++ ) {
if ( arr[i].endsWith(str) ) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"endsWith",
"(",
"String",
"str",
",",
"String",
"[",
"]",
"arr",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arr",
".",
"lengt... | check if there is an element that ends with the specified string
@param str
@return int | [
"check",
"if",
"there",
"is",
"an",
"element",
"that",
"ends",
"with",
"the",
"specified",
"string"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/ArrayUtil.java#L84-L97 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.