repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/TcpIpConfig.java | TcpIpConfig.addMember | public TcpIpConfig addMember(String member) {
"""
Adds a 'well known' member.
<p>
Each HazelcastInstance will try to connect to at least one of the members, to find all other members,
and create a cluster.
<p>
A member can be a comma separated string, e..g '10.11.12.1,10.11.12.2' which indicates multiple members
are going to be added.
@param member the member to add
@return the updated configuration
@throws IllegalArgumentException if member is {@code null} or empty
@see #getMembers()
"""
String memberText = checkHasText(member, "member must contain text");
StringTokenizer tokenizer = new StringTokenizer(memberText, ",");
while (tokenizer.hasMoreTokens()) {
String s = tokenizer.nextToken();
this.members.add(s.trim());
}
return this;
} | java | public TcpIpConfig addMember(String member) {
String memberText = checkHasText(member, "member must contain text");
StringTokenizer tokenizer = new StringTokenizer(memberText, ",");
while (tokenizer.hasMoreTokens()) {
String s = tokenizer.nextToken();
this.members.add(s.trim());
}
return this;
} | [
"public",
"TcpIpConfig",
"addMember",
"(",
"String",
"member",
")",
"{",
"String",
"memberText",
"=",
"checkHasText",
"(",
"member",
",",
"\"member must contain text\"",
")",
";",
"StringTokenizer",
"tokenizer",
"=",
"new",
"StringTokenizer",
"(",
"memberText",
",",... | Adds a 'well known' member.
<p>
Each HazelcastInstance will try to connect to at least one of the members, to find all other members,
and create a cluster.
<p>
A member can be a comma separated string, e..g '10.11.12.1,10.11.12.2' which indicates multiple members
are going to be added.
@param member the member to add
@return the updated configuration
@throws IllegalArgumentException if member is {@code null} or empty
@see #getMembers() | [
"Adds",
"a",
"well",
"known",
"member",
".",
"<p",
">",
"Each",
"HazelcastInstance",
"will",
"try",
"to",
"connect",
"to",
"at",
"least",
"one",
"of",
"the",
"members",
"to",
"find",
"all",
"other",
"members",
"and",
"create",
"a",
"cluster",
".",
"<p",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/TcpIpConfig.java#L145-L155 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java | JdbcCpoAdapter.getWriteConnection | protected Connection getWriteConnection() throws CpoException {
"""
DOCUMENT ME!
@return DOCUMENT ME!
@throws CpoException DOCUMENT ME!
"""
Connection connection;
try {
connection = getWriteDataSource().getConnection();
connection.setAutoCommit(false);
} catch (SQLException e) {
String msg = "getWriteConnection(): failed";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return connection;
} | java | protected Connection getWriteConnection() throws CpoException {
Connection connection;
try {
connection = getWriteDataSource().getConnection();
connection.setAutoCommit(false);
} catch (SQLException e) {
String msg = "getWriteConnection(): failed";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return connection;
} | [
"protected",
"Connection",
"getWriteConnection",
"(",
")",
"throws",
"CpoException",
"{",
"Connection",
"connection",
";",
"try",
"{",
"connection",
"=",
"getWriteDataSource",
"(",
")",
".",
"getConnection",
"(",
")",
";",
"connection",
".",
"setAutoCommit",
"(",
... | DOCUMENT ME!
@return DOCUMENT ME!
@throws CpoException DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L2079-L2092 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/BooleanUtils.java | BooleanUtils.toInteger | public static int toInteger(final Boolean bool, final int trueValue, final int falseValue, final int nullValue) {
"""
<p>Converts a Boolean to an int specifying the conversion values.</p>
<pre>
BooleanUtils.toInteger(Boolean.TRUE, 1, 0, 2) = 1
BooleanUtils.toInteger(Boolean.FALSE, 1, 0, 2) = 0
BooleanUtils.toInteger(null, 1, 0, 2) = 2
</pre>
@param bool the Boolean to convert
@param trueValue the value to return if {@code true}
@param falseValue the value to return if {@code false}
@param nullValue the value to return if {@code null}
@return the appropriate value
"""
if (bool == null) {
return nullValue;
}
return bool.booleanValue() ? trueValue : falseValue;
} | java | public static int toInteger(final Boolean bool, final int trueValue, final int falseValue, final int nullValue) {
if (bool == null) {
return nullValue;
}
return bool.booleanValue() ? trueValue : falseValue;
} | [
"public",
"static",
"int",
"toInteger",
"(",
"final",
"Boolean",
"bool",
",",
"final",
"int",
"trueValue",
",",
"final",
"int",
"falseValue",
",",
"final",
"int",
"nullValue",
")",
"{",
"if",
"(",
"bool",
"==",
"null",
")",
"{",
"return",
"nullValue",
";... | <p>Converts a Boolean to an int specifying the conversion values.</p>
<pre>
BooleanUtils.toInteger(Boolean.TRUE, 1, 0, 2) = 1
BooleanUtils.toInteger(Boolean.FALSE, 1, 0, 2) = 0
BooleanUtils.toInteger(null, 1, 0, 2) = 2
</pre>
@param bool the Boolean to convert
@param trueValue the value to return if {@code true}
@param falseValue the value to return if {@code false}
@param nullValue the value to return if {@code null}
@return the appropriate value | [
"<p",
">",
"Converts",
"a",
"Boolean",
"to",
"an",
"int",
"specifying",
"the",
"conversion",
"values",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/BooleanUtils.java#L464-L469 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.getEnclosingType | public static Node getEnclosingType(Node n, final Token type) {
"""
Gets the closest ancestor to the given node of the provided type.
"""
return getEnclosingNode(
n,
new Predicate<Node>() {
@Override
public boolean apply(Node n) {
return n.getToken() == type;
}
});
} | java | public static Node getEnclosingType(Node n, final Token type) {
return getEnclosingNode(
n,
new Predicate<Node>() {
@Override
public boolean apply(Node n) {
return n.getToken() == type;
}
});
} | [
"public",
"static",
"Node",
"getEnclosingType",
"(",
"Node",
"n",
",",
"final",
"Token",
"type",
")",
"{",
"return",
"getEnclosingNode",
"(",
"n",
",",
"new",
"Predicate",
"<",
"Node",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(... | Gets the closest ancestor to the given node of the provided type. | [
"Gets",
"the",
"closest",
"ancestor",
"to",
"the",
"given",
"node",
"of",
"the",
"provided",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L2230-L2239 |
alkacon/opencms-core | src/org/opencms/relations/CmsCategoryService.java | CmsCategoryService.removeResourceFromCategory | public void removeResourceFromCategory(CmsObject cms, String resourceName, CmsCategory category)
throws CmsException {
"""
Removes a resource identified by the given resource name from the given category.<p>
The resource has to be previously locked.<p>
@param cms the current cms context
@param resourceName the site relative path to the resource to remove
@param category the category to remove the resource from
@throws CmsException if something goes wrong
"""
// remove the resource just from this category
CmsRelationFilter filter = CmsRelationFilter.TARGETS;
filter = filter.filterType(CmsRelationType.CATEGORY);
filter = filter.filterResource(
cms.readResource(cms.getRequestContext().removeSiteRoot(category.getRootPath())));
filter = filter.filterIncludeChildren();
cms.deleteRelationsFromResource(resourceName, filter);
} | java | public void removeResourceFromCategory(CmsObject cms, String resourceName, CmsCategory category)
throws CmsException {
// remove the resource just from this category
CmsRelationFilter filter = CmsRelationFilter.TARGETS;
filter = filter.filterType(CmsRelationType.CATEGORY);
filter = filter.filterResource(
cms.readResource(cms.getRequestContext().removeSiteRoot(category.getRootPath())));
filter = filter.filterIncludeChildren();
cms.deleteRelationsFromResource(resourceName, filter);
} | [
"public",
"void",
"removeResourceFromCategory",
"(",
"CmsObject",
"cms",
",",
"String",
"resourceName",
",",
"CmsCategory",
"category",
")",
"throws",
"CmsException",
"{",
"// remove the resource just from this category",
"CmsRelationFilter",
"filter",
"=",
"CmsRelationFilter... | Removes a resource identified by the given resource name from the given category.<p>
The resource has to be previously locked.<p>
@param cms the current cms context
@param resourceName the site relative path to the resource to remove
@param category the category to remove the resource from
@throws CmsException if something goes wrong | [
"Removes",
"a",
"resource",
"identified",
"by",
"the",
"given",
"resource",
"name",
"from",
"the",
"given",
"category",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L680-L690 |
Bedework/bw-util | bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java | XmlUtil.fromNode | public static QName fromNode(final Node nd) {
"""
Return a QName for the node
@param nd
@return boolean true for match
"""
String ns = nd.getNamespaceURI();
if (ns == null) {
/* It appears a node can have a NULL namespace but a QName has a zero length
*/
ns = "";
}
return new QName(ns, nd.getLocalName());
} | java | public static QName fromNode(final Node nd) {
String ns = nd.getNamespaceURI();
if (ns == null) {
/* It appears a node can have a NULL namespace but a QName has a zero length
*/
ns = "";
}
return new QName(ns, nd.getLocalName());
} | [
"public",
"static",
"QName",
"fromNode",
"(",
"final",
"Node",
"nd",
")",
"{",
"String",
"ns",
"=",
"nd",
".",
"getNamespaceURI",
"(",
")",
";",
"if",
"(",
"ns",
"==",
"null",
")",
"{",
"/* It appears a node can have a NULL namespace but a QName has a zero length\... | Return a QName for the node
@param nd
@return boolean true for match | [
"Return",
"a",
"QName",
"for",
"the",
"node"
] | train | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L509-L519 |
Bernardo-MG/maven-site-fixer | src/main/java/com/bernardomg/velocity/tool/HtmlTool.java | HtmlTool.removeAttribute | public final void removeAttribute(final Element root, final String selector,
final String attribute) {
"""
Finds a set of elements through a CSS selector and removes the received
attribute from them, if they have it.
@param root
root element for the selection
@param selector
CSS selector for the elements with the attribute to remove
@param attribute
attribute to remove
"""
final Iterable<Element> elements; // Elements selected
checkNotNull(root, "Received a null pointer as root element");
checkNotNull(selector, "Received a null pointer as selector");
checkNotNull(attribute, "Received a null pointer as attribute");
// Selects and iterates over the elements
elements = root.select(selector);
for (final Element element : elements) {
element.removeAttr(attribute);
}
} | java | public final void removeAttribute(final Element root, final String selector,
final String attribute) {
final Iterable<Element> elements; // Elements selected
checkNotNull(root, "Received a null pointer as root element");
checkNotNull(selector, "Received a null pointer as selector");
checkNotNull(attribute, "Received a null pointer as attribute");
// Selects and iterates over the elements
elements = root.select(selector);
for (final Element element : elements) {
element.removeAttr(attribute);
}
} | [
"public",
"final",
"void",
"removeAttribute",
"(",
"final",
"Element",
"root",
",",
"final",
"String",
"selector",
",",
"final",
"String",
"attribute",
")",
"{",
"final",
"Iterable",
"<",
"Element",
">",
"elements",
";",
"// Elements selected",
"checkNotNull",
"... | Finds a set of elements through a CSS selector and removes the received
attribute from them, if they have it.
@param root
root element for the selection
@param selector
CSS selector for the elements with the attribute to remove
@param attribute
attribute to remove | [
"Finds",
"a",
"set",
"of",
"elements",
"through",
"a",
"CSS",
"selector",
"and",
"removes",
"the",
"received",
"attribute",
"from",
"them",
"if",
"they",
"have",
"it",
"."
] | train | https://github.com/Bernardo-MG/maven-site-fixer/blob/e064472faa7edb0fca11647a22d90ad72089baa3/src/main/java/com/bernardomg/velocity/tool/HtmlTool.java#L84-L97 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java | PaymentProtocol.createPaymentMessage | public static Protos.Payment createPaymentMessage(List<Transaction> transactions,
@Nullable Coin refundAmount, @Nullable Address refundAddress, @Nullable String memo,
@Nullable byte[] merchantData) {
"""
Create a payment message with one standard pay to address output.
@param transactions one or more transactions that satisfy the requested outputs.
@param refundAmount amount of coins to request as a refund, or null if no refund.
@param refundAddress address to refund coins to
@param memo arbitrary, user readable memo, or null if none
@param merchantData arbitrary merchant data, or null if none
@return created payment message
"""
if (refundAddress != null) {
if (refundAmount == null)
throw new IllegalArgumentException("Specify refund amount if refund address is specified.");
return createPaymentMessage(transactions,
ImmutableList.of(createPayToAddressOutput(refundAmount, refundAddress)), memo, merchantData);
} else {
return createPaymentMessage(transactions, null, memo, merchantData);
}
} | java | public static Protos.Payment createPaymentMessage(List<Transaction> transactions,
@Nullable Coin refundAmount, @Nullable Address refundAddress, @Nullable String memo,
@Nullable byte[] merchantData) {
if (refundAddress != null) {
if (refundAmount == null)
throw new IllegalArgumentException("Specify refund amount if refund address is specified.");
return createPaymentMessage(transactions,
ImmutableList.of(createPayToAddressOutput(refundAmount, refundAddress)), memo, merchantData);
} else {
return createPaymentMessage(transactions, null, memo, merchantData);
}
} | [
"public",
"static",
"Protos",
".",
"Payment",
"createPaymentMessage",
"(",
"List",
"<",
"Transaction",
">",
"transactions",
",",
"@",
"Nullable",
"Coin",
"refundAmount",
",",
"@",
"Nullable",
"Address",
"refundAddress",
",",
"@",
"Nullable",
"String",
"memo",
",... | Create a payment message with one standard pay to address output.
@param transactions one or more transactions that satisfy the requested outputs.
@param refundAmount amount of coins to request as a refund, or null if no refund.
@param refundAddress address to refund coins to
@param memo arbitrary, user readable memo, or null if none
@param merchantData arbitrary merchant data, or null if none
@return created payment message | [
"Create",
"a",
"payment",
"message",
"with",
"one",
"standard",
"pay",
"to",
"address",
"output",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/payments/PaymentProtocol.java#L294-L305 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWComponent.java | AbstractWComponent.getIndexOfChild | private static int getIndexOfChild(final Container parent, final WComponent childComponent) {
"""
Internal utility method to find the index of a child within a container. This method makes use of the additional
methods offered by the AbstractWComponent implementation (if available), otherwise it falls back the methods
declared in the {@link WComponent} interface.
@param parent the container to search for the child in
@param childComponent the component to search for.
@return the index of the <code>childComponent</code> in <code>parent</code>, or -1 if <code>childComponent</code>
is not a child of <code>parent</code>.
"""
if (parent instanceof AbstractWComponent) {
return ((AbstractWComponent) parent).getIndexOfChild(childComponent);
} else {
// We have to do this the hard way...
for (int i = 0; i < parent.getChildCount(); i++) {
if (childComponent == parent.getChildAt(i)) {
return i;
}
}
}
return -1;
} | java | private static int getIndexOfChild(final Container parent, final WComponent childComponent) {
if (parent instanceof AbstractWComponent) {
return ((AbstractWComponent) parent).getIndexOfChild(childComponent);
} else {
// We have to do this the hard way...
for (int i = 0; i < parent.getChildCount(); i++) {
if (childComponent == parent.getChildAt(i)) {
return i;
}
}
}
return -1;
} | [
"private",
"static",
"int",
"getIndexOfChild",
"(",
"final",
"Container",
"parent",
",",
"final",
"WComponent",
"childComponent",
")",
"{",
"if",
"(",
"parent",
"instanceof",
"AbstractWComponent",
")",
"{",
"return",
"(",
"(",
"AbstractWComponent",
")",
"parent",
... | Internal utility method to find the index of a child within a container. This method makes use of the additional
methods offered by the AbstractWComponent implementation (if available), otherwise it falls back the methods
declared in the {@link WComponent} interface.
@param parent the container to search for the child in
@param childComponent the component to search for.
@return the index of the <code>childComponent</code> in <code>parent</code>, or -1 if <code>childComponent</code>
is not a child of <code>parent</code>. | [
"Internal",
"utility",
"method",
"to",
"find",
"the",
"index",
"of",
"a",
"child",
"within",
"a",
"container",
".",
"This",
"method",
"makes",
"use",
"of",
"the",
"additional",
"methods",
"offered",
"by",
"the",
"AbstractWComponent",
"implementation",
"(",
"if... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWComponent.java#L1344-L1357 |
Coveros/selenified | src/main/java/com/coveros/selenified/Selenified.java | Selenified.getVersion | private String getVersion(String clazz, ITestContext context) {
"""
Obtains the version of the current test suite being executed. If no
version was set, null will be returned
@param clazz - the test suite class, used for making threadsafe storage of
application, allowing suites to have independent applications
under test, run at the same time
@param context - the TestNG context associated with the test suite, used for
storing app url information
@return String: the version of the current test being executed
"""
return (String) context.getAttribute(clazz + "Version");
} | java | private String getVersion(String clazz, ITestContext context) {
return (String) context.getAttribute(clazz + "Version");
} | [
"private",
"String",
"getVersion",
"(",
"String",
"clazz",
",",
"ITestContext",
"context",
")",
"{",
"return",
"(",
"String",
")",
"context",
".",
"getAttribute",
"(",
"clazz",
"+",
"\"Version\"",
")",
";",
"}"
] | Obtains the version of the current test suite being executed. If no
version was set, null will be returned
@param clazz - the test suite class, used for making threadsafe storage of
application, allowing suites to have independent applications
under test, run at the same time
@param context - the TestNG context associated with the test suite, used for
storing app url information
@return String: the version of the current test being executed | [
"Obtains",
"the",
"version",
"of",
"the",
"current",
"test",
"suite",
"being",
"executed",
".",
"If",
"no",
"version",
"was",
"set",
"null",
"will",
"be",
"returned"
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/Selenified.java#L121-L123 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceClient.java | TranslationServiceClient.formatLocationName | @Deprecated
public static final String formatLocationName(String project, String location) {
"""
Formats a string containing the fully-qualified path to represent a location resource.
@deprecated Use the {@link LocationName} class instead.
"""
return LOCATION_PATH_TEMPLATE.instantiate(
"project", project,
"location", location);
} | java | @Deprecated
public static final String formatLocationName(String project, String location) {
return LOCATION_PATH_TEMPLATE.instantiate(
"project", project,
"location", location);
} | [
"@",
"Deprecated",
"public",
"static",
"final",
"String",
"formatLocationName",
"(",
"String",
"project",
",",
"String",
"location",
")",
"{",
"return",
"LOCATION_PATH_TEMPLATE",
".",
"instantiate",
"(",
"\"project\"",
",",
"project",
",",
"\"location\"",
",",
"lo... | Formats a string containing the fully-qualified path to represent a location resource.
@deprecated Use the {@link LocationName} class instead. | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"location",
"resource",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceClient.java#L142-L147 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java | AccessPoint.timestampMatch | private static boolean timestampMatch(CaptureSearchResult closest, WaybackRequest wbRequest) {
"""
return {@code true} if capture's timestamp matches exactly what's requested.
If requested timestamp is less specific (i.e. less digits) than capture's
timestamp, it is considered non-matching. On the other hand, capture's
timestamp being prefix of requested timestamp is considered a match (this is
to support captures with timestamp shorter than 14-digits. this may change).
@param closest capture to check
@param wbRequest request object
@return {@code true} if match
"""
String replayTimestamp = wbRequest.getReplayTimestamp();
String captureTimestamp = closest.getCaptureTimestamp();
if (replayTimestamp.length() < captureTimestamp.length())
return false;
if (replayTimestamp.startsWith(captureTimestamp))
return true;
// if looking for latest date, consider it a tentative match, until
// checking if it's replay-able.
if (wbRequest.isBestLatestReplayRequest())
return true;
return false;
} | java | private static boolean timestampMatch(CaptureSearchResult closest, WaybackRequest wbRequest) {
String replayTimestamp = wbRequest.getReplayTimestamp();
String captureTimestamp = closest.getCaptureTimestamp();
if (replayTimestamp.length() < captureTimestamp.length())
return false;
if (replayTimestamp.startsWith(captureTimestamp))
return true;
// if looking for latest date, consider it a tentative match, until
// checking if it's replay-able.
if (wbRequest.isBestLatestReplayRequest())
return true;
return false;
} | [
"private",
"static",
"boolean",
"timestampMatch",
"(",
"CaptureSearchResult",
"closest",
",",
"WaybackRequest",
"wbRequest",
")",
"{",
"String",
"replayTimestamp",
"=",
"wbRequest",
".",
"getReplayTimestamp",
"(",
")",
";",
"String",
"captureTimestamp",
"=",
"closest"... | return {@code true} if capture's timestamp matches exactly what's requested.
If requested timestamp is less specific (i.e. less digits) than capture's
timestamp, it is considered non-matching. On the other hand, capture's
timestamp being prefix of requested timestamp is considered a match (this is
to support captures with timestamp shorter than 14-digits. this may change).
@param closest capture to check
@param wbRequest request object
@return {@code true} if match | [
"return",
"{"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java#L730-L743 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/AWSRequestMetricsFullSupport.java | AWSRequestMetricsFullSupport.addProperty | @Override
public void addProperty(String propertyName, Object value) {
"""
Add a property. If you add the same property more than once, it stores
all values a list.
This feature is enabled if the system property
"com.amazonaws.sdk.enableRuntimeProfiling" is set, or if a
{@link RequestMetricCollector} is in use either at the request, web service
client, or AWS SDK level.
@param propertyName
The name of the property
@param value
The property value
"""
List<Object> propertyList = properties.get(propertyName);
if (propertyList == null) {
propertyList = new ArrayList<Object>();
properties.put(propertyName, propertyList);
}
propertyList.add(value);
} | java | @Override
public void addProperty(String propertyName, Object value) {
List<Object> propertyList = properties.get(propertyName);
if (propertyList == null) {
propertyList = new ArrayList<Object>();
properties.put(propertyName, propertyList);
}
propertyList.add(value);
} | [
"@",
"Override",
"public",
"void",
"addProperty",
"(",
"String",
"propertyName",
",",
"Object",
"value",
")",
"{",
"List",
"<",
"Object",
">",
"propertyList",
"=",
"properties",
".",
"get",
"(",
"propertyName",
")",
";",
"if",
"(",
"propertyList",
"==",
"n... | Add a property. If you add the same property more than once, it stores
all values a list.
This feature is enabled if the system property
"com.amazonaws.sdk.enableRuntimeProfiling" is set, or if a
{@link RequestMetricCollector} is in use either at the request, web service
client, or AWS SDK level.
@param propertyName
The name of the property
@param value
The property value | [
"Add",
"a",
"property",
".",
"If",
"you",
"add",
"the",
"same",
"property",
"more",
"than",
"once",
"it",
"stores",
"all",
"values",
"a",
"list",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/AWSRequestMetricsFullSupport.java#L171-L180 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java | SerializedFormBuilder.buildDeprecatedMethodInfo | public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) {
"""
Build the deprecated method description.
@param node the XML element that specifies which components to document
@param methodsContentTree content tree to which the documentation will be added
"""
methodWriter.addDeprecatedMemberInfo((ExecutableElement)currentMember, methodsContentTree);
} | java | public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) {
methodWriter.addDeprecatedMemberInfo((ExecutableElement)currentMember, methodsContentTree);
} | [
"public",
"void",
"buildDeprecatedMethodInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"methodsContentTree",
")",
"{",
"methodWriter",
".",
"addDeprecatedMemberInfo",
"(",
"(",
"ExecutableElement",
")",
"currentMember",
",",
"methodsContentTree",
")",
";",
"}"
] | Build the deprecated method description.
@param node the XML element that specifies which components to document
@param methodsContentTree content tree to which the documentation will be added | [
"Build",
"the",
"deprecated",
"method",
"description",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L332-L334 |
devnied/EMV-NFC-Paycard-Enrollment | library/src/main/java/com/github/devnied/emvnfccard/utils/TlvUtil.java | TlvUtil.parseTagAndLength | public static List<TagAndLength> parseTagAndLength(final byte[] data) {
"""
Method used to parser Tag and length
@param data
data to parse
@return tag and length
"""
List<TagAndLength> tagAndLengthList = new ArrayList<TagAndLength>();
if (data != null) {
TLVInputStream stream = new TLVInputStream(new ByteArrayInputStream(data));
try {
while (stream.available() > 0) {
if (stream.available() < 2) {
throw new TlvException("Data length < 2 : " + stream.available());
}
ITag tag = searchTagById(stream.readTag());
int tagValueLength = stream.readLength();
tagAndLengthList.add(new TagAndLength(tag, tagValueLength));
}
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(stream);
}
}
return tagAndLengthList;
} | java | public static List<TagAndLength> parseTagAndLength(final byte[] data) {
List<TagAndLength> tagAndLengthList = new ArrayList<TagAndLength>();
if (data != null) {
TLVInputStream stream = new TLVInputStream(new ByteArrayInputStream(data));
try {
while (stream.available() > 0) {
if (stream.available() < 2) {
throw new TlvException("Data length < 2 : " + stream.available());
}
ITag tag = searchTagById(stream.readTag());
int tagValueLength = stream.readLength();
tagAndLengthList.add(new TagAndLength(tag, tagValueLength));
}
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(stream);
}
}
return tagAndLengthList;
} | [
"public",
"static",
"List",
"<",
"TagAndLength",
">",
"parseTagAndLength",
"(",
"final",
"byte",
"[",
"]",
"data",
")",
"{",
"List",
"<",
"TagAndLength",
">",
"tagAndLengthList",
"=",
"new",
"ArrayList",
"<",
"TagAndLength",
">",
"(",
")",
";",
"if",
"(",
... | Method used to parser Tag and length
@param data
data to parse
@return tag and length | [
"Method",
"used",
"to",
"parser",
"Tag",
"and",
"length"
] | train | https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/utils/TlvUtil.java#L162-L185 |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/security/KeyProvider.java | KeyProvider.getSecretKey | public SecretKey getSecretKey(String alias, String password) {
"""
Gets a symmetric encryption secret key from the key store
@param alias key alias
@param password key password
@return the secret key
"""
Key key = getKey(alias, password);
if (key instanceof PrivateKey) {
return (SecretKey) key;
} else {
throw new IllegalStateException(format("Key with alias '%s' was not a secret key, but was: %s",
alias, key.getClass().getSimpleName()));
}
} | java | public SecretKey getSecretKey(String alias, String password) {
Key key = getKey(alias, password);
if (key instanceof PrivateKey) {
return (SecretKey) key;
} else {
throw new IllegalStateException(format("Key with alias '%s' was not a secret key, but was: %s",
alias, key.getClass().getSimpleName()));
}
} | [
"public",
"SecretKey",
"getSecretKey",
"(",
"String",
"alias",
",",
"String",
"password",
")",
"{",
"Key",
"key",
"=",
"getKey",
"(",
"alias",
",",
"password",
")",
";",
"if",
"(",
"key",
"instanceof",
"PrivateKey",
")",
"{",
"return",
"(",
"SecretKey",
... | Gets a symmetric encryption secret key from the key store
@param alias key alias
@param password key password
@return the secret key | [
"Gets",
"a",
"symmetric",
"encryption",
"secret",
"key",
"from",
"the",
"key",
"store"
] | train | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/security/KeyProvider.java#L71-L79 |
MenoData/Time4J | base/src/main/java/net/time4j/history/EraPreference.java | EraPreference.hispanicBetween | public static EraPreference hispanicBetween(
PlainDate start,
PlainDate end
) {
"""
/*[deutsch]
<p>Legt fest, daß die spanische Ära innerhalb der angegebenen Datumsspanne bevorzugt wird. </p>
@param start first date when the hispanic era shall be used (inclusive)
@param end last date when the hispanic era shall be used (inclusive)
@return EraPreference
@see HistoricEra#HISPANIC
@since 3.14/4.11
"""
return new EraPreference(HistoricEra.HISPANIC, start, end);
} | java | public static EraPreference hispanicBetween(
PlainDate start,
PlainDate end
) {
return new EraPreference(HistoricEra.HISPANIC, start, end);
} | [
"public",
"static",
"EraPreference",
"hispanicBetween",
"(",
"PlainDate",
"start",
",",
"PlainDate",
"end",
")",
"{",
"return",
"new",
"EraPreference",
"(",
"HistoricEra",
".",
"HISPANIC",
",",
"start",
",",
"end",
")",
";",
"}"
] | /*[deutsch]
<p>Legt fest, daß die spanische Ära innerhalb der angegebenen Datumsspanne bevorzugt wird. </p>
@param start first date when the hispanic era shall be used (inclusive)
@param end last date when the hispanic era shall be used (inclusive)
@return EraPreference
@see HistoricEra#HISPANIC
@since 3.14/4.11 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Legt",
"fest",
"daß",
";",
"die",
"spanische",
"Ä",
";",
"ra",
"innerhalb",
"der",
"angegebenen",
"Datumsspanne",
"bevorzugt",
"wird",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/history/EraPreference.java#L135-L142 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | FSDirectory.setQuota | void setQuota(String src, long nsQuota, long dsQuota)
throws FileNotFoundException, QuotaExceededException {
"""
See {@link ClientProtocol#setQuota(String, long, long)} for the
contract.
@see #unprotectedSetQuota(String, long, long)
"""
writeLock();
try {
INodeDirectory dir = unprotectedSetQuota(src, nsQuota, dsQuota);
if (dir != null) {
fsImage.getEditLog().logSetQuota(src, dir.getNsQuota(),
dir.getDsQuota());
}
} finally {
writeUnlock();
}
} | java | void setQuota(String src, long nsQuota, long dsQuota)
throws FileNotFoundException, QuotaExceededException {
writeLock();
try {
INodeDirectory dir = unprotectedSetQuota(src, nsQuota, dsQuota);
if (dir != null) {
fsImage.getEditLog().logSetQuota(src, dir.getNsQuota(),
dir.getDsQuota());
}
} finally {
writeUnlock();
}
} | [
"void",
"setQuota",
"(",
"String",
"src",
",",
"long",
"nsQuota",
",",
"long",
"dsQuota",
")",
"throws",
"FileNotFoundException",
",",
"QuotaExceededException",
"{",
"writeLock",
"(",
")",
";",
"try",
"{",
"INodeDirectory",
"dir",
"=",
"unprotectedSetQuota",
"("... | See {@link ClientProtocol#setQuota(String, long, long)} for the
contract.
@see #unprotectedSetQuota(String, long, long) | [
"See",
"{"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L2772-L2784 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.beginCreateOrUpdateAsync | public Observable<NetworkInterfaceInner> beginCreateOrUpdateAsync(String resourceGroupName, String networkInterfaceName, NetworkInterfaceInner parameters) {
"""
Creates or updates a network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@param parameters Parameters supplied to the create or update network interface operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NetworkInterfaceInner object
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, parameters).map(new Func1<ServiceResponse<NetworkInterfaceInner>, NetworkInterfaceInner>() {
@Override
public NetworkInterfaceInner call(ServiceResponse<NetworkInterfaceInner> response) {
return response.body();
}
});
} | java | public Observable<NetworkInterfaceInner> beginCreateOrUpdateAsync(String resourceGroupName, String networkInterfaceName, NetworkInterfaceInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkInterfaceName, parameters).map(new Func1<ServiceResponse<NetworkInterfaceInner>, NetworkInterfaceInner>() {
@Override
public NetworkInterfaceInner call(ServiceResponse<NetworkInterfaceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NetworkInterfaceInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
",",
"NetworkInterfaceInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
... | Creates or updates a network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@param parameters Parameters supplied to the create or update network interface operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NetworkInterfaceInner object | [
"Creates",
"or",
"updates",
"a",
"network",
"interface",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L595-L602 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.addCookie | public final static void addCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
"""
设定返回给客户端的Cookie<br>
Path: "/"<br>
No Domain
@param response 响应对象{@link HttpServletResponse}
@param name cookie名
@param value cookie值
@param maxAgeInSeconds -1: 关闭浏览器清除Cookie. 0: 立即清除Cookie. >0 : Cookie存在的秒数.
"""
addCookie(response, name, value, maxAgeInSeconds, "/", null);
} | java | public final static void addCookie(HttpServletResponse response, String name, String value, int maxAgeInSeconds) {
addCookie(response, name, value, maxAgeInSeconds, "/", null);
} | [
"public",
"final",
"static",
"void",
"addCookie",
"(",
"HttpServletResponse",
"response",
",",
"String",
"name",
",",
"String",
"value",
",",
"int",
"maxAgeInSeconds",
")",
"{",
"addCookie",
"(",
"response",
",",
"name",
",",
"value",
",",
"maxAgeInSeconds",
"... | 设定返回给客户端的Cookie<br>
Path: "/"<br>
No Domain
@param response 响应对象{@link HttpServletResponse}
@param name cookie名
@param value cookie值
@param maxAgeInSeconds -1: 关闭浏览器清除Cookie. 0: 立即清除Cookie. >0 : Cookie存在的秒数. | [
"设定返回给客户端的Cookie<br",
">",
"Path",
":",
"/",
"<br",
">",
"No",
"Domain"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L452-L454 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java | Schema.unionOf | public static Schema unionOf(Iterable<Schema> schemas) {
"""
Creates a {@link Type#UNION UNION} {@link Schema} which represents a union of all the given schemas.
The ordering of the schemas inside the union would be the same as the {@link Iterable#iterator()} order.
@param schemas All the {@link Schema Schemas} constitutes the union.
@return A {@link Schema} of {@link Type#UNION UNION} type.
"""
List<Schema> schemaList = ImmutableList.copyOf(schemas);
Preconditions.checkArgument(schemaList.size() > 0, "No union schema provided.");
return new Schema(Type.UNION, null, null, null, null, null, null, schemaList);
} | java | public static Schema unionOf(Iterable<Schema> schemas) {
List<Schema> schemaList = ImmutableList.copyOf(schemas);
Preconditions.checkArgument(schemaList.size() > 0, "No union schema provided.");
return new Schema(Type.UNION, null, null, null, null, null, null, schemaList);
} | [
"public",
"static",
"Schema",
"unionOf",
"(",
"Iterable",
"<",
"Schema",
">",
"schemas",
")",
"{",
"List",
"<",
"Schema",
">",
"schemaList",
"=",
"ImmutableList",
".",
"copyOf",
"(",
"schemas",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"schemaLis... | Creates a {@link Type#UNION UNION} {@link Schema} which represents a union of all the given schemas.
The ordering of the schemas inside the union would be the same as the {@link Iterable#iterator()} order.
@param schemas All the {@link Schema Schemas} constitutes the union.
@return A {@link Schema} of {@link Type#UNION UNION} type. | [
"Creates",
"a",
"{",
"@link",
"Type#UNION",
"UNION",
"}",
"{",
"@link",
"Schema",
"}",
"which",
"represents",
"a",
"union",
"of",
"all",
"the",
"given",
"schemas",
".",
"The",
"ordering",
"of",
"the",
"schemas",
"inside",
"the",
"union",
"would",
"be",
"... | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java#L251-L255 |
real-logic/agrona | agrona/src/main/java/org/agrona/generation/CompilerUtil.java | CompilerUtil.compileOnDisk | public static Class<?> compileOnDisk(final String className, final Map<String, CharSequence> sources)
throws ClassNotFoundException, IOException {
"""
Compile a {@link Map} of source files on disk resulting in a {@link Class} which is named.
@param className to return after compilation.
@param sources to be compiled.
@return the named class that is the result of the compilation.
@throws ClassNotFoundException of the named class cannot be found.
@throws IOException if an error occurs when writing to disk.
"""
final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
if (null == compiler)
{
throw new IllegalStateException("JDK required to run tests. JRE is not sufficient.");
}
final DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null))
{
final ArrayList<String> options = new ArrayList<>(Arrays.asList(
"-classpath", System.getProperty("java.class.path") + File.pathSeparator + TEMP_DIR_NAME));
final Collection<File> files = persist(sources);
final Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(files);
final JavaCompiler.CompilationTask task = compiler.getTask(
null, fileManager, diagnostics, options, null, compilationUnits);
return compileAndLoad(className, diagnostics, fileManager, task);
}
} | java | public static Class<?> compileOnDisk(final String className, final Map<String, CharSequence> sources)
throws ClassNotFoundException, IOException
{
final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
if (null == compiler)
{
throw new IllegalStateException("JDK required to run tests. JRE is not sufficient.");
}
final DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null))
{
final ArrayList<String> options = new ArrayList<>(Arrays.asList(
"-classpath", System.getProperty("java.class.path") + File.pathSeparator + TEMP_DIR_NAME));
final Collection<File> files = persist(sources);
final Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(files);
final JavaCompiler.CompilationTask task = compiler.getTask(
null, fileManager, diagnostics, options, null, compilationUnits);
return compileAndLoad(className, diagnostics, fileManager, task);
}
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"compileOnDisk",
"(",
"final",
"String",
"className",
",",
"final",
"Map",
"<",
"String",
",",
"CharSequence",
">",
"sources",
")",
"throws",
"ClassNotFoundException",
",",
"IOException",
"{",
"final",
"JavaCompiler",
... | Compile a {@link Map} of source files on disk resulting in a {@link Class} which is named.
@param className to return after compilation.
@param sources to be compiled.
@return the named class that is the result of the compilation.
@throws ClassNotFoundException of the named class cannot be found.
@throws IOException if an error occurs when writing to disk. | [
"Compile",
"a",
"{",
"@link",
"Map",
"}",
"of",
"source",
"files",
"on",
"disk",
"resulting",
"in",
"a",
"{",
"@link",
"Class",
"}",
"which",
"is",
"named",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/generation/CompilerUtil.java#L77-L99 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/StatementManager.java | StatementManager.bindInsert | public void bindInsert(PreparedStatement stmt, ClassDescriptor cld, Object obj) throws java.sql.SQLException {
"""
binds the values of the object obj to the statements parameters
"""
ValueContainer[] values;
cld.updateLockingValues(obj); // BRJ : provide useful defaults for locking fields
if (cld.getInsertProcedure() != null)
{
this.bindProcedure(stmt, cld, obj, cld.getInsertProcedure());
}
else
{
values = getAllValues(cld, obj);
for (int i = 0; i < values.length; i++)
{
setObjectForStatement(stmt, i + 1, values[i].getValue(), values[i].getJdbcType().getType());
}
}
} | java | public void bindInsert(PreparedStatement stmt, ClassDescriptor cld, Object obj) throws java.sql.SQLException
{
ValueContainer[] values;
cld.updateLockingValues(obj); // BRJ : provide useful defaults for locking fields
if (cld.getInsertProcedure() != null)
{
this.bindProcedure(stmt, cld, obj, cld.getInsertProcedure());
}
else
{
values = getAllValues(cld, obj);
for (int i = 0; i < values.length; i++)
{
setObjectForStatement(stmt, i + 1, values[i].getValue(), values[i].getJdbcType().getType());
}
}
} | [
"public",
"void",
"bindInsert",
"(",
"PreparedStatement",
"stmt",
",",
"ClassDescriptor",
"cld",
",",
"Object",
"obj",
")",
"throws",
"java",
".",
"sql",
".",
"SQLException",
"{",
"ValueContainer",
"[",
"]",
"values",
";",
"cld",
".",
"updateLockingValues",
"(... | binds the values of the object obj to the statements parameters | [
"binds",
"the",
"values",
"of",
"the",
"object",
"obj",
"to",
"the",
"statements",
"parameters"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java#L432-L449 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.createCustomField | public CustomFields createCustomField(String accountId, CustomField customField) throws ApiException {
"""
Creates an acount custom field.
@param accountId The external account number (int) or account ID Guid. (required)
@param customField (optional)
@return CustomFields
"""
return createCustomField(accountId, customField, null);
} | java | public CustomFields createCustomField(String accountId, CustomField customField) throws ApiException {
return createCustomField(accountId, customField, null);
} | [
"public",
"CustomFields",
"createCustomField",
"(",
"String",
"accountId",
",",
"CustomField",
"customField",
")",
"throws",
"ApiException",
"{",
"return",
"createCustomField",
"(",
"accountId",
",",
"customField",
",",
"null",
")",
";",
"}"
] | Creates an acount custom field.
@param accountId The external account number (int) or account ID Guid. (required)
@param customField (optional)
@return CustomFields | [
"Creates",
"an",
"acount",
"custom",
"field",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L199-L201 |
KyoriPowered/text | api/src/main/java/net/kyori/text/TranslatableComponent.java | TranslatableComponent.of | public static TranslatableComponent of(final @NonNull String key, final @Nullable TextColor color, final @NonNull Set<TextDecoration> decorations, final @NonNull Component... args) {
"""
Creates a translatable component with a translation key and arguments.
@param key the translation key
@param color the color
@param decorations the decorations
@param args the translation arguments
@return the translatable component
"""
return of(key, color, decorations, Arrays.asList(args));
} | java | public static TranslatableComponent of(final @NonNull String key, final @Nullable TextColor color, final @NonNull Set<TextDecoration> decorations, final @NonNull Component... args) {
return of(key, color, decorations, Arrays.asList(args));
} | [
"public",
"static",
"TranslatableComponent",
"of",
"(",
"final",
"@",
"NonNull",
"String",
"key",
",",
"final",
"@",
"Nullable",
"TextColor",
"color",
",",
"final",
"@",
"NonNull",
"Set",
"<",
"TextDecoration",
">",
"decorations",
",",
"final",
"@",
"NonNull",... | Creates a translatable component with a translation key and arguments.
@param key the translation key
@param color the color
@param decorations the decorations
@param args the translation arguments
@return the translatable component | [
"Creates",
"a",
"translatable",
"component",
"with",
"a",
"translation",
"key",
"and",
"arguments",
"."
] | train | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TranslatableComponent.java#L146-L148 |
aboutsip/pkts | pkts-core/src/main/java/io/pkts/Pcap.java | Pcap.openStream | public static Pcap openStream(final InputStream is) throws IOException {
"""
Capture packets from the input stream
@param is
@return
@throws IOException
"""
final Buffer stream = Buffers.wrap(is);
final PcapGlobalHeader header = PcapGlobalHeader.parse(stream);
return new Pcap(header, stream);
} | java | public static Pcap openStream(final InputStream is) throws IOException {
final Buffer stream = Buffers.wrap(is);
final PcapGlobalHeader header = PcapGlobalHeader.parse(stream);
return new Pcap(header, stream);
} | [
"public",
"static",
"Pcap",
"openStream",
"(",
"final",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"final",
"Buffer",
"stream",
"=",
"Buffers",
".",
"wrap",
"(",
"is",
")",
";",
"final",
"PcapGlobalHeader",
"header",
"=",
"PcapGlobalHeader",
".",
... | Capture packets from the input stream
@param is
@return
@throws IOException | [
"Capture",
"packets",
"from",
"the",
"input",
"stream"
] | train | https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-core/src/main/java/io/pkts/Pcap.java#L121-L125 |
rnorth/visible-assertions | src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java | VisibleAssertions.assertFalse | public static void assertFalse(String message, boolean value) {
"""
Assert that a value is false.
<p>
If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown.
@param message message to display alongside the assertion outcome
@param value value to test
"""
if (!value) {
pass(message);
} else {
fail(message, null);
}
} | java | public static void assertFalse(String message, boolean value) {
if (!value) {
pass(message);
} else {
fail(message, null);
}
} | [
"public",
"static",
"void",
"assertFalse",
"(",
"String",
"message",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"!",
"value",
")",
"{",
"pass",
"(",
"message",
")",
";",
"}",
"else",
"{",
"fail",
"(",
"message",
",",
"null",
")",
";",
"}",
"}"
] | Assert that a value is false.
<p>
If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown.
@param message message to display alongside the assertion outcome
@param value value to test | [
"Assert",
"that",
"a",
"value",
"is",
"false",
".",
"<p",
">",
"If",
"the",
"assertion",
"passes",
"a",
"green",
"tick",
"will",
"be",
"shown",
".",
"If",
"the",
"assertion",
"fails",
"a",
"red",
"cross",
"will",
"be",
"shown",
"."
] | train | https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L141-L147 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersInner.java | ServersInner.beginCreateOrUpdateAsync | public Observable<ServerInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters) {
"""
Creates or updates a server.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param parameters The requested server resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerInner object
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerInner>, ServerInner>() {
@Override
public ServerInner call(ServiceResponse<ServerInner> response) {
return response.body();
}
});
} | java | public Observable<ServerInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerInner>, ServerInner>() {
@Override
public ServerInner call(ServiceResponse<ServerInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"ServerInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Creates or updates a server.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param parameters The requested server resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerInner object | [
"Creates",
"or",
"updates",
"a",
"server",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersInner.java#L538-L545 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/ChoiceFormat.java | ChoiceFormat.setChoices | public void setChoices(double[] limits, String formats[]) {
"""
Set the choices to be used in formatting.
@param limits contains the top value that you want
parsed with that format,and should be in ascending sorted order. When
formatting X, the choice will be the i, where
limit[i] <= X < limit[i+1].
If the limit array is not in ascending order, the results of formatting
will be incorrect.
@param formats are the formats you want to use for each limit.
They can be either Format objects or Strings.
When formatting with object Y,
if the object is a NumberFormat, then ((NumberFormat) Y).format(X)
is called. Otherwise Y.toString() is called.
"""
if (limits.length != formats.length) {
throw new IllegalArgumentException(
"Array and limit arrays must be of the same length.");
}
choiceLimits = limits;
choiceFormats = formats;
} | java | public void setChoices(double[] limits, String formats[]) {
if (limits.length != formats.length) {
throw new IllegalArgumentException(
"Array and limit arrays must be of the same length.");
}
choiceLimits = limits;
choiceFormats = formats;
} | [
"public",
"void",
"setChoices",
"(",
"double",
"[",
"]",
"limits",
",",
"String",
"formats",
"[",
"]",
")",
"{",
"if",
"(",
"limits",
".",
"length",
"!=",
"formats",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Array and lim... | Set the choices to be used in formatting.
@param limits contains the top value that you want
parsed with that format,and should be in ascending sorted order. When
formatting X, the choice will be the i, where
limit[i] <= X < limit[i+1].
If the limit array is not in ascending order, the results of formatting
will be incorrect.
@param formats are the formats you want to use for each limit.
They can be either Format objects or Strings.
When formatting with object Y,
if the object is a NumberFormat, then ((NumberFormat) Y).format(X)
is called. Otherwise Y.toString() is called. | [
"Set",
"the",
"choices",
"to",
"be",
"used",
"in",
"formatting",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/ChoiceFormat.java#L336-L343 |
opentok/Opentok-Java-SDK | src/main/java/com/opentok/OpenTok.java | OpenTok.dial | public Sip dial(String sessionId, String token, SipProperties properties) throws OpenTokException {
"""
Gets a list of {@link Stream} object for the given session ID.
@param sessionId The session ID.
@param token The token.
@param properties The SipProperties.
@return The {@link Sip} object.
"""
if((StringUtils.isEmpty(sessionId) || StringUtils.isEmpty(token) || properties == null || StringUtils.isEmpty(properties.sipUri()))) {
throw new InvalidArgumentException ("Session id or token is null or empty or sip properties is null or sip uri empty or null.");
}
String sip = this.client.sipDial(sessionId,token,properties);
try {
return sipReader.readValue(sip);
} catch (JsonProcessingException e) {
throw new RequestException("Exception mapping json: " + e.getMessage());
} catch (IOException e) {
throw new RequestException("Exception mapping json: " + e.getMessage());
}
} | java | public Sip dial(String sessionId, String token, SipProperties properties) throws OpenTokException {
if((StringUtils.isEmpty(sessionId) || StringUtils.isEmpty(token) || properties == null || StringUtils.isEmpty(properties.sipUri()))) {
throw new InvalidArgumentException ("Session id or token is null or empty or sip properties is null or sip uri empty or null.");
}
String sip = this.client.sipDial(sessionId,token,properties);
try {
return sipReader.readValue(sip);
} catch (JsonProcessingException e) {
throw new RequestException("Exception mapping json: " + e.getMessage());
} catch (IOException e) {
throw new RequestException("Exception mapping json: " + e.getMessage());
}
} | [
"public",
"Sip",
"dial",
"(",
"String",
"sessionId",
",",
"String",
"token",
",",
"SipProperties",
"properties",
")",
"throws",
"OpenTokException",
"{",
"if",
"(",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"sessionId",
")",
"||",
"StringUtils",
".",
"isEmpty",
... | Gets a list of {@link Stream} object for the given session ID.
@param sessionId The session ID.
@param token The token.
@param properties The SipProperties.
@return The {@link Sip} object. | [
"Gets",
"a",
"list",
"of",
"{",
"@link",
"Stream",
"}",
"object",
"for",
"the",
"given",
"session",
"ID",
"."
] | train | https://github.com/opentok/Opentok-Java-SDK/blob/d71b7999facc3131c415aebea874ea55776d477f/src/main/java/com/opentok/OpenTok.java#L689-L701 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VpnSitesConfigurationsInner.java | VpnSitesConfigurationsInner.downloadAsync | public Observable<Void> downloadAsync(String resourceGroupName, String virtualWANName, GetVpnSitesConfigurationRequest request) {
"""
Gives the sas-url to download the configurations for vpn-sites in a resource group.
@param resourceGroupName The resource group name.
@param virtualWANName The name of the VirtualWAN for which configuration of all vpn-sites is needed.
@param request Parameters supplied to download vpn-sites configuration.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return downloadWithServiceResponseAsync(resourceGroupName, virtualWANName, request).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> downloadAsync(String resourceGroupName, String virtualWANName, GetVpnSitesConfigurationRequest request) {
return downloadWithServiceResponseAsync(resourceGroupName, virtualWANName, request).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"downloadAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualWANName",
",",
"GetVpnSitesConfigurationRequest",
"request",
")",
"{",
"return",
"downloadWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtu... | Gives the sas-url to download the configurations for vpn-sites in a resource group.
@param resourceGroupName The resource group name.
@param virtualWANName The name of the VirtualWAN for which configuration of all vpn-sites is needed.
@param request Parameters supplied to download vpn-sites configuration.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Gives",
"the",
"sas",
"-",
"url",
"to",
"download",
"the",
"configurations",
"for",
"vpn",
"-",
"sites",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VpnSitesConfigurationsInner.java#L104-L111 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/lang/Strings.java | Strings.mergeSeq | public static String mergeSeq(final String first, final String second, final String delimiter) {
"""
将两个用delimiter串起来的字符串,合并成新的串,重复的"单词"只出现一次.
如果第一个字符串以delimiter开头,第二个字符串以delimiter结尾,<br>
合并后的字符串仍以delimiter开头和结尾.<br>
<p>
<blockquote>
<pre>
mergeSeq(",1,2,", "") = ",1,2,";
mergeSeq(",1,2,", null) = ",1,2,";
mergeSeq("1,2", "3") = "1,2,3";
mergeSeq("1,2", "3,") = "1,2,3,";
mergeSeq(",1,2", "3,") = ",1,2,3,";
mergeSeq(",1,2,", ",3,") = ",1,2,3,";
</pre>
</blockquote>
<p>
@param first
a {@link java.lang.String} object.
@param second
a {@link java.lang.String} object.
@param delimiter
a {@link java.lang.String} object.
@return a {@link java.lang.String} object.
"""
if (isNotEmpty(second) && isNotEmpty(first)) {
List<String> firstSeq = Arrays.asList(split(first, delimiter));
List<String> secondSeq = Arrays.asList(split(second, delimiter));
Collection<String> rs = CollectUtils.union(firstSeq, secondSeq);
StringBuilder buf = new StringBuilder();
for (final String ele : rs)
buf.append(delimiter).append(ele);
if (buf.length() > 0) buf.append(delimiter);
return buf.toString();
} else {
return ((first == null) ? "" : first) + ((second == null) ? "" : second);
}
} | java | public static String mergeSeq(final String first, final String second, final String delimiter) {
if (isNotEmpty(second) && isNotEmpty(first)) {
List<String> firstSeq = Arrays.asList(split(first, delimiter));
List<String> secondSeq = Arrays.asList(split(second, delimiter));
Collection<String> rs = CollectUtils.union(firstSeq, secondSeq);
StringBuilder buf = new StringBuilder();
for (final String ele : rs)
buf.append(delimiter).append(ele);
if (buf.length() > 0) buf.append(delimiter);
return buf.toString();
} else {
return ((first == null) ? "" : first) + ((second == null) ? "" : second);
}
} | [
"public",
"static",
"String",
"mergeSeq",
"(",
"final",
"String",
"first",
",",
"final",
"String",
"second",
",",
"final",
"String",
"delimiter",
")",
"{",
"if",
"(",
"isNotEmpty",
"(",
"second",
")",
"&&",
"isNotEmpty",
"(",
"first",
")",
")",
"{",
"Lis... | 将两个用delimiter串起来的字符串,合并成新的串,重复的"单词"只出现一次.
如果第一个字符串以delimiter开头,第二个字符串以delimiter结尾,<br>
合并后的字符串仍以delimiter开头和结尾.<br>
<p>
<blockquote>
<pre>
mergeSeq(",1,2,", "") = ",1,2,";
mergeSeq(",1,2,", null) = ",1,2,";
mergeSeq("1,2", "3") = "1,2,3";
mergeSeq("1,2", "3,") = "1,2,3,";
mergeSeq(",1,2", "3,") = ",1,2,3,";
mergeSeq(",1,2,", ",3,") = ",1,2,3,";
</pre>
</blockquote>
<p>
@param first
a {@link java.lang.String} object.
@param second
a {@link java.lang.String} object.
@param delimiter
a {@link java.lang.String} object.
@return a {@link java.lang.String} object. | [
"将两个用delimiter串起来的字符串,合并成新的串,重复的",
"单词",
"只出现一次",
".",
"如果第一个字符串以delimiter开头,第二个字符串以delimiter结尾,<br",
">",
"合并后的字符串仍以delimiter开头和结尾",
".",
"<br",
">",
"<p",
">",
"<blockquote",
">"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L604-L617 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/TimeoutMap.java | TimeoutMap.put | public V put(K pKey, V pValue) {
"""
Associates the specified pValue with the specified pKey in this map
(optional operation). If the map previously contained a mapping for
this pKey, the old pValue is replaced.
@param pKey pKey with which the specified pValue is to be associated.
@param pValue pValue to be associated with the specified pKey.
@return previous pValue associated with specified pKey, or {@code null}
if there was no mapping for pKey. A {@code null} return can
also indicate that the map previously associated {@code null}
with the specified pKey, if the implementation supports
{@code null} values.
"""
TimedEntry<K, V> entry = (TimedEntry<K, V>) entries.get(pKey);
V oldValue;
if (entry == null) {
oldValue = null;
entry = createEntry(pKey, pValue);
entries.put(pKey, entry);
}
else {
oldValue = entry.mValue;
entry.setValue(pValue);
entry.recordAccess(this);
}
// Need to remove expired objects every now and then
// We do it in the put method, to avoid resource leaks over time.
removeExpiredEntries();
modCount++;
return oldValue;
} | java | public V put(K pKey, V pValue) {
TimedEntry<K, V> entry = (TimedEntry<K, V>) entries.get(pKey);
V oldValue;
if (entry == null) {
oldValue = null;
entry = createEntry(pKey, pValue);
entries.put(pKey, entry);
}
else {
oldValue = entry.mValue;
entry.setValue(pValue);
entry.recordAccess(this);
}
// Need to remove expired objects every now and then
// We do it in the put method, to avoid resource leaks over time.
removeExpiredEntries();
modCount++;
return oldValue;
} | [
"public",
"V",
"put",
"(",
"K",
"pKey",
",",
"V",
"pValue",
")",
"{",
"TimedEntry",
"<",
"K",
",",
"V",
">",
"entry",
"=",
"(",
"TimedEntry",
"<",
"K",
",",
"V",
">",
")",
"entries",
".",
"get",
"(",
"pKey",
")",
";",
"V",
"oldValue",
";",
"i... | Associates the specified pValue with the specified pKey in this map
(optional operation). If the map previously contained a mapping for
this pKey, the old pValue is replaced.
@param pKey pKey with which the specified pValue is to be associated.
@param pValue pValue to be associated with the specified pKey.
@return previous pValue associated with specified pKey, or {@code null}
if there was no mapping for pKey. A {@code null} return can
also indicate that the map previously associated {@code null}
with the specified pKey, if the implementation supports
{@code null} values. | [
"Associates",
"the",
"specified",
"pValue",
"with",
"the",
"specified",
"pKey",
"in",
"this",
"map",
"(",
"optional",
"operation",
")",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"this",
"pKey",
"the",
"old",
"pValue",
"is",
... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/TimeoutMap.java#L235-L258 |
EdwardRaff/JSAT | JSAT/src/jsat/math/Complex.java | Complex.cDiv | public static void cDiv(double a, double b, double c, double d, double[] results) {
"""
Performs a complex division operation. <br>
The standard complex division performs a set of operations that is
suseptible to both overflow and underflow. This method is more
numerically stable while still being relatively fast to execute.
@param a the real part of the first number
@param b the imaginary part of the first number
@param c the real part of the second number
@param d the imaginary part of the second number
@param results an array to store the real and imaginary results in. First
index is the real, 2nd is the imaginary.
"""
/**
* Douglas M. Priest. Efficient scaling for complex division. ACM Trans.
* Math. Softw., 30(4):389–401, 2004
*/
long aa, bb, cc, dd, ss;
double t;
int ha, hb, hc, hd, hz, hw, hs;
/*extract high-order 32 bits to estimate |z| and |w| */
aa = Double.doubleToRawLongBits(a);
bb = Double.doubleToRawLongBits(b);
ha = (int) ((aa >> 32) & 0x7fffffff);
hb = (int) ((bb >> 32) & 0x7fffffff);
hz = (ha > hb)? ha : hb;
cc = Double.doubleToRawLongBits(c);
dd = Double.doubleToRawLongBits(d);
hc = (int) ((cc >> 32) & 0x7fffffff);
hd = (int) ((dd >> 32) & 0x7fffffff);
hw = (hc > hd)? hc : hd;
/* compute the scale factor */
if (hz < 0x07200000 && hw >= 0x32800000 && hw < 0x47100000)
{
/* |z| < 2^-909 and 2^-215 <= |w| < 2^114 */
hs = (((0x47100000 - hw) >> 1) & 0xfff00000) + 0x3ff00000;
}
else
hs = (((hw >> 2) - hw) + 0x6fd7ffff) & 0xfff00000;
ss = ((long) hs) << 32;
/* scale c and d, and compute the quotient */
double ssd = Double.longBitsToDouble(ss);
c *= ssd;
d *= ssd;
t = 1.0 / (c * c + d * d);
c *= ssd;
d *= ssd;
results[0] = (a * c + b * d) * t;
results[1] = (b * c - a * d) * t;
} | java | public static void cDiv(double a, double b, double c, double d, double[] results)
{
/**
* Douglas M. Priest. Efficient scaling for complex division. ACM Trans.
* Math. Softw., 30(4):389–401, 2004
*/
long aa, bb, cc, dd, ss;
double t;
int ha, hb, hc, hd, hz, hw, hs;
/*extract high-order 32 bits to estimate |z| and |w| */
aa = Double.doubleToRawLongBits(a);
bb = Double.doubleToRawLongBits(b);
ha = (int) ((aa >> 32) & 0x7fffffff);
hb = (int) ((bb >> 32) & 0x7fffffff);
hz = (ha > hb)? ha : hb;
cc = Double.doubleToRawLongBits(c);
dd = Double.doubleToRawLongBits(d);
hc = (int) ((cc >> 32) & 0x7fffffff);
hd = (int) ((dd >> 32) & 0x7fffffff);
hw = (hc > hd)? hc : hd;
/* compute the scale factor */
if (hz < 0x07200000 && hw >= 0x32800000 && hw < 0x47100000)
{
/* |z| < 2^-909 and 2^-215 <= |w| < 2^114 */
hs = (((0x47100000 - hw) >> 1) & 0xfff00000) + 0x3ff00000;
}
else
hs = (((hw >> 2) - hw) + 0x6fd7ffff) & 0xfff00000;
ss = ((long) hs) << 32;
/* scale c and d, and compute the quotient */
double ssd = Double.longBitsToDouble(ss);
c *= ssd;
d *= ssd;
t = 1.0 / (c * c + d * d);
c *= ssd;
d *= ssd;
results[0] = (a * c + b * d) * t;
results[1] = (b * c - a * d) * t;
} | [
"public",
"static",
"void",
"cDiv",
"(",
"double",
"a",
",",
"double",
"b",
",",
"double",
"c",
",",
"double",
"d",
",",
"double",
"[",
"]",
"results",
")",
"{",
"/**\n * Douglas M. Priest. Efficient scaling for complex division. ACM Trans. \n * Math. So... | Performs a complex division operation. <br>
The standard complex division performs a set of operations that is
suseptible to both overflow and underflow. This method is more
numerically stable while still being relatively fast to execute.
@param a the real part of the first number
@param b the imaginary part of the first number
@param c the real part of the second number
@param d the imaginary part of the second number
@param results an array to store the real and imaginary results in. First
index is the real, 2nd is the imaginary. | [
"Performs",
"a",
"complex",
"division",
"operation",
".",
"<br",
">",
"The",
"standard",
"complex",
"division",
"performs",
"a",
"set",
"of",
"operations",
"that",
"is",
"suseptible",
"to",
"both",
"overflow",
"and",
"underflow",
".",
"This",
"method",
"is",
... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/Complex.java#L198-L242 |
danieldk/dictomaton | src/main/java/eu/danieldk/dictomaton/PerfectHashDictionaryStateCard.java | PerfectHashDictionaryStateCard.computeStateSuffixesTopological | private void computeStateSuffixesTopological(final int initialState, final int magicMarker) {
"""
Iteratively computes the number of suffixes by topological order
@param initialState the root of the graph
@param magicMarker the value in d_stateNSuffixes indicating that the value has not yet been computed
"""
for (Iterator<Integer> iterator = sortStatesTopological(initialState).iterator(); iterator.hasNext(); ) {
Integer currentState = iterator.next();
int currentSuffixes = d_stateNSuffixes.get(currentState);
if (currentSuffixes == magicMarker) { // is not yet computed
int trans = d_stateOffsets.get(currentState);
int transUpperBound = transitionsUpperBound(currentState);
if (trans < transUpperBound) { // has children
int suffixes = d_finalStates.get(currentState) ? 1 : 0; // add one if current state is final
for (; trans < transUpperBound; ++trans) { // add known number of suffixes of children
int childState = d_transitionTo.get(trans);
assert d_stateNSuffixes.get(childState) != magicMarker : "suffxies should have been calculated for state " + childState;
suffixes += d_stateNSuffixes.get(childState);
}
d_stateNSuffixes.set(currentState, suffixes);
} else {
d_stateNSuffixes.set(currentState, d_finalStates.get(currentState) ? 1 : 0);
}
} // else already computed from a different path in the DAG
}
} | java | private void computeStateSuffixesTopological(final int initialState, final int magicMarker) {
for (Iterator<Integer> iterator = sortStatesTopological(initialState).iterator(); iterator.hasNext(); ) {
Integer currentState = iterator.next();
int currentSuffixes = d_stateNSuffixes.get(currentState);
if (currentSuffixes == magicMarker) { // is not yet computed
int trans = d_stateOffsets.get(currentState);
int transUpperBound = transitionsUpperBound(currentState);
if (trans < transUpperBound) { // has children
int suffixes = d_finalStates.get(currentState) ? 1 : 0; // add one if current state is final
for (; trans < transUpperBound; ++trans) { // add known number of suffixes of children
int childState = d_transitionTo.get(trans);
assert d_stateNSuffixes.get(childState) != magicMarker : "suffxies should have been calculated for state " + childState;
suffixes += d_stateNSuffixes.get(childState);
}
d_stateNSuffixes.set(currentState, suffixes);
} else {
d_stateNSuffixes.set(currentState, d_finalStates.get(currentState) ? 1 : 0);
}
} // else already computed from a different path in the DAG
}
} | [
"private",
"void",
"computeStateSuffixesTopological",
"(",
"final",
"int",
"initialState",
",",
"final",
"int",
"magicMarker",
")",
"{",
"for",
"(",
"Iterator",
"<",
"Integer",
">",
"iterator",
"=",
"sortStatesTopological",
"(",
"initialState",
")",
".",
"iterator... | Iteratively computes the number of suffixes by topological order
@param initialState the root of the graph
@param magicMarker the value in d_stateNSuffixes indicating that the value has not yet been computed | [
"Iteratively",
"computes",
"the",
"number",
"of",
"suffixes",
"by",
"topological",
"order"
] | train | https://github.com/danieldk/dictomaton/blob/c0a3ae2d407ebd88023ea2d0f02a4882b0492df0/src/main/java/eu/danieldk/dictomaton/PerfectHashDictionaryStateCard.java#L199-L220 |
hibernate/hibernate-ogm | neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java | EmbeddedNeo4jEntityQueries.updateEmbeddedColumn | public void updateEmbeddedColumn(GraphDatabaseService executionEngine, Object[] keyValues, String embeddedColumn, Object value) {
"""
Update the value of an embedded node property.
@param executionEngine the {@link GraphDatabaseService} used to run the query
@param keyValues the columns representing the identifier in the entity owning the embedded
@param embeddedColumn the column on the embedded node (dot-separated properties)
@param value the new value for the property
"""
String query = getUpdateEmbeddedColumnQuery( keyValues, embeddedColumn );
Map<String, Object> params = params( ArrayHelper.concat( keyValues, value, value ) );
executionEngine.execute( query, params );
} | java | public void updateEmbeddedColumn(GraphDatabaseService executionEngine, Object[] keyValues, String embeddedColumn, Object value) {
String query = getUpdateEmbeddedColumnQuery( keyValues, embeddedColumn );
Map<String, Object> params = params( ArrayHelper.concat( keyValues, value, value ) );
executionEngine.execute( query, params );
} | [
"public",
"void",
"updateEmbeddedColumn",
"(",
"GraphDatabaseService",
"executionEngine",
",",
"Object",
"[",
"]",
"keyValues",
",",
"String",
"embeddedColumn",
",",
"Object",
"value",
")",
"{",
"String",
"query",
"=",
"getUpdateEmbeddedColumnQuery",
"(",
"keyValues",... | Update the value of an embedded node property.
@param executionEngine the {@link GraphDatabaseService} used to run the query
@param keyValues the columns representing the identifier in the entity owning the embedded
@param embeddedColumn the column on the embedded node (dot-separated properties)
@param value the new value for the property | [
"Update",
"the",
"value",
"of",
"an",
"embedded",
"node",
"property",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java#L167-L171 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java | State.getPropAsShort | public short getPropAsShort(String key, short def) {
"""
Get the value of a property as an short, using the given default value if the property is not set.
@param key property key
@param def default value
@return short value associated with the key or the default value if the property is not set
"""
return Short.parseShort(getProp(key, String.valueOf(def)));
} | java | public short getPropAsShort(String key, short def) {
return Short.parseShort(getProp(key, String.valueOf(def)));
} | [
"public",
"short",
"getPropAsShort",
"(",
"String",
"key",
",",
"short",
"def",
")",
"{",
"return",
"Short",
".",
"parseShort",
"(",
"getProp",
"(",
"key",
",",
"String",
".",
"valueOf",
"(",
"def",
")",
")",
")",
";",
"}"
] | Get the value of a property as an short, using the given default value if the property is not set.
@param key property key
@param def default value
@return short value associated with the key or the default value if the property is not set | [
"Get",
"the",
"value",
"of",
"a",
"property",
"as",
"an",
"short",
"using",
"the",
"given",
"default",
"value",
"if",
"the",
"property",
"is",
"not",
"set",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java#L416-L418 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/forms/layout/LayoutMap.java | LayoutMap.rowPut | public String rowPut(String key, RowSpec value) {
"""
Associates the specified ColumnSpec with the specified key in this map. If the map previously
contained a mapping for this key, the old value is replaced by the specified value. The
RowSpec set in this map override an association - if any - in the chain of parent
LayoutMaps.<p>
The RowSpec must not be {@code null}. To remove an association from this map use
{@link #rowRemove(String)}.
@param key key with which the specified value is to be associated.
@param value ColumnSpec to be associated with the specified key.
@return previous ColumnSpec associated with specified key, or {@code null} if there was no
mapping for key.
@throws NullPointerException if the {@code key} or {@code value} is {@code null}.
@see Map#put(Object, Object)
"""
return rowPut(key, value.encode());
} | java | public String rowPut(String key, RowSpec value) {
return rowPut(key, value.encode());
} | [
"public",
"String",
"rowPut",
"(",
"String",
"key",
",",
"RowSpec",
"value",
")",
"{",
"return",
"rowPut",
"(",
"key",
",",
"value",
".",
"encode",
"(",
")",
")",
";",
"}"
] | Associates the specified ColumnSpec with the specified key in this map. If the map previously
contained a mapping for this key, the old value is replaced by the specified value. The
RowSpec set in this map override an association - if any - in the chain of parent
LayoutMaps.<p>
The RowSpec must not be {@code null}. To remove an association from this map use
{@link #rowRemove(String)}.
@param key key with which the specified value is to be associated.
@param value ColumnSpec to be associated with the specified key.
@return previous ColumnSpec associated with specified key, or {@code null} if there was no
mapping for key.
@throws NullPointerException if the {@code key} or {@code value} is {@code null}.
@see Map#put(Object, Object) | [
"Associates",
"the",
"specified",
"ColumnSpec",
"with",
"the",
"specified",
"key",
"in",
"this",
"map",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"this",
"key",
"the",
"old",
"value",
"is",
"replaced",
"by",
"the",
"specified... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/LayoutMap.java#L393-L395 |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java | ObjectUtil.equalsValue | public static boolean equalsValue(final Integer i1, final Integer i2) {
"""
Return true if i1 equals (according to {@link Integer#equals(Object)}) 12.
Also returns true if 11 is null and 12 is null! Is safe on either 11 or 12 being null.
"""
if (i1 == null) {
return i2 == null;
}
return i1.equals(i2);
} | java | public static boolean equalsValue(final Integer i1, final Integer i2) {
if (i1 == null) {
return i2 == null;
}
return i1.equals(i2);
} | [
"public",
"static",
"boolean",
"equalsValue",
"(",
"final",
"Integer",
"i1",
",",
"final",
"Integer",
"i2",
")",
"{",
"if",
"(",
"i1",
"==",
"null",
")",
"{",
"return",
"i2",
"==",
"null",
";",
"}",
"return",
"i1",
".",
"equals",
"(",
"i2",
")",
";... | Return true if i1 equals (according to {@link Integer#equals(Object)}) 12.
Also returns true if 11 is null and 12 is null! Is safe on either 11 or 12 being null. | [
"Return",
"true",
"if",
"i1",
"equals",
"(",
"according",
"to",
"{"
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/ObjectUtil.java#L45-L50 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/SMILES.java | SMILES.convertMolToSMILESWithAtomMapping | public static String convertMolToSMILESWithAtomMapping(String molfile, List<Attachment> attachments)
throws CTKException, ChemistryException {
"""
Converts molfile with the given attachments in smiles with atom mapping
@param molfile
given molfile
@param attachments
given attachments of the molfile
@return smiles with atom mapping
@throws CTKException
if the molfile can not be converted to smiles
@throws ChemistryException
if the Chemistry Engine can not be initialized
"""
String smiles = Chemistry.getInstance().getManipulator().convertMolIntoSmilesWithAtomMapping(molfile);
for (Attachment attachment : attachments) {
int r = Integer.valueOf(attachment.getLabel().replaceAll("\\D+", ""));
smiles = smiles.replace("[*:" + r + "]", "[" + attachment.getCapGroupName() + ":" + r + "]");
}
return smiles;
} | java | public static String convertMolToSMILESWithAtomMapping(String molfile, List<Attachment> attachments)
throws CTKException, ChemistryException {
String smiles = Chemistry.getInstance().getManipulator().convertMolIntoSmilesWithAtomMapping(molfile);
for (Attachment attachment : attachments) {
int r = Integer.valueOf(attachment.getLabel().replaceAll("\\D+", ""));
smiles = smiles.replace("[*:" + r + "]", "[" + attachment.getCapGroupName() + ":" + r + "]");
}
return smiles;
} | [
"public",
"static",
"String",
"convertMolToSMILESWithAtomMapping",
"(",
"String",
"molfile",
",",
"List",
"<",
"Attachment",
">",
"attachments",
")",
"throws",
"CTKException",
",",
"ChemistryException",
"{",
"String",
"smiles",
"=",
"Chemistry",
".",
"getInstance",
... | Converts molfile with the given attachments in smiles with atom mapping
@param molfile
given molfile
@param attachments
given attachments of the molfile
@return smiles with atom mapping
@throws CTKException
if the molfile can not be converted to smiles
@throws ChemistryException
if the Chemistry Engine can not be initialized | [
"Converts",
"molfile",
"with",
"the",
"given",
"attachments",
"in",
"smiles",
"with",
"atom",
"mapping"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/SMILES.java#L245-L257 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateTime.java | DateTime.parse | private static Date parse(String dateStr, DateFormat dateFormat) {
"""
转换字符串为Date
@param dateStr 日期字符串
@param dateFormat {@link SimpleDateFormat}
@return {@link Date}
"""
try {
return dateFormat.parse(dateStr);
} catch (Exception e) {
String pattern;
if (dateFormat instanceof SimpleDateFormat) {
pattern = ((SimpleDateFormat) dateFormat).toPattern();
} else {
pattern = dateFormat.toString();
}
throw new DateException(StrUtil.format("Parse [{}] with format [{}] error!", dateStr, pattern), e);
}
} | java | private static Date parse(String dateStr, DateFormat dateFormat) {
try {
return dateFormat.parse(dateStr);
} catch (Exception e) {
String pattern;
if (dateFormat instanceof SimpleDateFormat) {
pattern = ((SimpleDateFormat) dateFormat).toPattern();
} else {
pattern = dateFormat.toString();
}
throw new DateException(StrUtil.format("Parse [{}] with format [{}] error!", dateStr, pattern), e);
}
} | [
"private",
"static",
"Date",
"parse",
"(",
"String",
"dateStr",
",",
"DateFormat",
"dateFormat",
")",
"{",
"try",
"{",
"return",
"dateFormat",
".",
"parse",
"(",
"dateStr",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"pattern",
";"... | 转换字符串为Date
@param dateStr 日期字符串
@param dateFormat {@link SimpleDateFormat}
@return {@link Date} | [
"转换字符串为Date"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L875-L887 |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/EncodingUtils.java | EncodingUtils.encodeHtml | @Deprecated
public static void encodeHtml(Object value, Appendable out) throws IOException {
"""
Escapes for use in a (X)HTML document and writes to the provided <code>Appendable</code>.
In addition to the standard XML Body encoding, it turns newlines into <br />, tabs to &#x9;, and spaces to &#160;
@param value the object to be escaped. If value is <code>null</code>, nothing is written.
@deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property.
@see TextInXhtmlEncoder
"""
encodeHtml(value, true, true, out);
} | java | @Deprecated
public static void encodeHtml(Object value, Appendable out) throws IOException {
encodeHtml(value, true, true, out);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"encodeHtml",
"(",
"Object",
"value",
",",
"Appendable",
"out",
")",
"throws",
"IOException",
"{",
"encodeHtml",
"(",
"value",
",",
"true",
",",
"true",
",",
"out",
")",
";",
"}"
] | Escapes for use in a (X)HTML document and writes to the provided <code>Appendable</code>.
In addition to the standard XML Body encoding, it turns newlines into <br />, tabs to &#x9;, and spaces to &#160;
@param value the object to be escaped. If value is <code>null</code>, nothing is written.
@deprecated the effects of makeBr and makeNbsp should be handled by CSS white-space property.
@see TextInXhtmlEncoder | [
"Escapes",
"for",
"use",
"in",
"a",
"(",
"X",
")",
"HTML",
"document",
"and",
"writes",
"to",
"the",
"provided",
"<code",
">",
"Appendable<",
"/",
"code",
">",
".",
"In",
"addition",
"to",
"the",
"standard",
"XML",
"Body",
"encoding",
"it",
"turns",
"n... | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/EncodingUtils.java#L98-L101 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/producers/JobScheduler.java | JobScheduler.updateJob | public boolean updateJob(EncodedImage encodedImage, @Consumer.Status int status) {
"""
Updates the job.
<p> This just updates the job, but it doesn't schedule it. In order to be executed, the job has
to be scheduled after being set. In case there was a previous job scheduled that has not yet
started, this new job will be executed instead.
@return whether the job was successfully updated.
"""
if (!shouldProcess(encodedImage, status)) {
return false;
}
EncodedImage oldEncodedImage;
synchronized (this) {
oldEncodedImage = mEncodedImage;
mEncodedImage = EncodedImage.cloneOrNull(encodedImage);
mStatus = status;
}
EncodedImage.closeSafely(oldEncodedImage);
return true;
} | java | public boolean updateJob(EncodedImage encodedImage, @Consumer.Status int status) {
if (!shouldProcess(encodedImage, status)) {
return false;
}
EncodedImage oldEncodedImage;
synchronized (this) {
oldEncodedImage = mEncodedImage;
mEncodedImage = EncodedImage.cloneOrNull(encodedImage);
mStatus = status;
}
EncodedImage.closeSafely(oldEncodedImage);
return true;
} | [
"public",
"boolean",
"updateJob",
"(",
"EncodedImage",
"encodedImage",
",",
"@",
"Consumer",
".",
"Status",
"int",
"status",
")",
"{",
"if",
"(",
"!",
"shouldProcess",
"(",
"encodedImage",
",",
"status",
")",
")",
"{",
"return",
"false",
";",
"}",
"Encoded... | Updates the job.
<p> This just updates the job, but it doesn't schedule it. In order to be executed, the job has
to be scheduled after being set. In case there was a previous job scheduled that has not yet
started, this new job will be executed instead.
@return whether the job was successfully updated. | [
"Updates",
"the",
"job",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/JobScheduler.java#L114-L126 |
symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/entityjson/EntityJsonParser.java | EntityJsonParser.parseStructuredObject | public StructuredObject parseStructuredObject(URL instanceUrl) throws SchemaValidationException, InvalidInstanceException {
"""
Parse a single StructuredObject instance from the given URL.
Callers may prefer to catch EntityJSONException and treat all failures in the same way.
@param instanceUrl A URL pointing to the JSON representation of a StructuredObject instance.
@return A StructuredObject instance.
@throws SchemaValidationException If the given instance does not meet the general EntityJSON schema.
@throws InvalidInstanceException If the given instance is structurally invalid.
"""
try
{
return new StructuredObject(validate(STRUCTURED_OBJECT_SCHEMA_URL, instanceUrl));
}
catch (NoSchemaException | InvalidSchemaException e)
{
// In theory this cannot happen
throw new RuntimeException(e);
}
} | java | public StructuredObject parseStructuredObject(URL instanceUrl) throws SchemaValidationException, InvalidInstanceException
{
try
{
return new StructuredObject(validate(STRUCTURED_OBJECT_SCHEMA_URL, instanceUrl));
}
catch (NoSchemaException | InvalidSchemaException e)
{
// In theory this cannot happen
throw new RuntimeException(e);
}
} | [
"public",
"StructuredObject",
"parseStructuredObject",
"(",
"URL",
"instanceUrl",
")",
"throws",
"SchemaValidationException",
",",
"InvalidInstanceException",
"{",
"try",
"{",
"return",
"new",
"StructuredObject",
"(",
"validate",
"(",
"STRUCTURED_OBJECT_SCHEMA_URL",
",",
... | Parse a single StructuredObject instance from the given URL.
Callers may prefer to catch EntityJSONException and treat all failures in the same way.
@param instanceUrl A URL pointing to the JSON representation of a StructuredObject instance.
@return A StructuredObject instance.
@throws SchemaValidationException If the given instance does not meet the general EntityJSON schema.
@throws InvalidInstanceException If the given instance is structurally invalid. | [
"Parse",
"a",
"single",
"StructuredObject",
"instance",
"from",
"the",
"given",
"URL",
"."
] | train | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/entityjson/EntityJsonParser.java#L187-L198 |
drinkjava2/jBeanBox | jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBox.java | BeanBox.addMethodAop | public synchronized BeanBox addMethodAop(Object aop, Method method) {
"""
This is Java configuration method equal to put a AOP annotation on method. a
AOP annotation is a kind of annotation be binded to an AOP alliance
interceptor like ctx.bind(Tx.class, MyInterceptor.class); then you can put
a @Tx annotation on method. But this method allow aop can be annotation class
or interceptor class for both
"""
checkOrCreateMethodAops();
List<Object> aops = methodAops.get(method);
if (aops == null) {
aops = new ArrayList<Object>();
methodAops.put(method, aops);
}
aops.add(BeanBoxUtils.checkAOP(aop));
return this;
} | java | public synchronized BeanBox addMethodAop(Object aop, Method method) {
checkOrCreateMethodAops();
List<Object> aops = methodAops.get(method);
if (aops == null) {
aops = new ArrayList<Object>();
methodAops.put(method, aops);
}
aops.add(BeanBoxUtils.checkAOP(aop));
return this;
} | [
"public",
"synchronized",
"BeanBox",
"addMethodAop",
"(",
"Object",
"aop",
",",
"Method",
"method",
")",
"{",
"checkOrCreateMethodAops",
"(",
")",
";",
"List",
"<",
"Object",
">",
"aops",
"=",
"methodAops",
".",
"get",
"(",
"method",
")",
";",
"if",
"(",
... | This is Java configuration method equal to put a AOP annotation on method. a
AOP annotation is a kind of annotation be binded to an AOP alliance
interceptor like ctx.bind(Tx.class, MyInterceptor.class); then you can put
a @Tx annotation on method. But this method allow aop can be annotation class
or interceptor class for both | [
"This",
"is",
"Java",
"configuration",
"method",
"equal",
"to",
"put",
"a",
"AOP",
"annotation",
"on",
"method",
".",
"a",
"AOP",
"annotation",
"is",
"a",
"kind",
"of",
"annotation",
"be",
"binded",
"to",
"an",
"AOP",
"alliance",
"interceptor",
"like",
"ct... | train | https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBox.java#L233-L242 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ProcessorUtils.java | ProcessorUtils.createLooseArchiveEntryConfig | public static ArchiveEntryConfig createLooseArchiveEntryConfig(LooseConfig looseConfig, File looseFile, BootstrapConfig bootProps,
String archiveEntryPrefix, boolean isUsr) throws IOException {
"""
Using the method to create Loose config's Archive entry config
@param looseConfig
@param looseFile
@param bootProps
@return
@throws IOException
"""
File usrRoot = bootProps.getUserRoot();
int len = usrRoot.getAbsolutePath().length();
String entryPath = null;
if (archiveEntryPrefix.equalsIgnoreCase(PackageProcessor.PACKAGE_ARCHIVE_PREFIX) || !isUsr) {
entryPath = archiveEntryPrefix + BootstrapConstants.LOC_AREA_NAME_USR + looseFile.getAbsolutePath().substring(len);
} else {
entryPath = archiveEntryPrefix + looseFile.getAbsolutePath().substring(len);
}
entryPath = entryPath.replace("\\", "/");
entryPath = entryPath.replace("//", "/");
entryPath = entryPath.substring(0, entryPath.length() - 4); // trim the .xml
File archiveFile = processArchive(looseFile.getName(), looseConfig, true, bootProps);
return new FileEntryConfig(entryPath, archiveFile);
} | java | public static ArchiveEntryConfig createLooseArchiveEntryConfig(LooseConfig looseConfig, File looseFile, BootstrapConfig bootProps,
String archiveEntryPrefix, boolean isUsr) throws IOException {
File usrRoot = bootProps.getUserRoot();
int len = usrRoot.getAbsolutePath().length();
String entryPath = null;
if (archiveEntryPrefix.equalsIgnoreCase(PackageProcessor.PACKAGE_ARCHIVE_PREFIX) || !isUsr) {
entryPath = archiveEntryPrefix + BootstrapConstants.LOC_AREA_NAME_USR + looseFile.getAbsolutePath().substring(len);
} else {
entryPath = archiveEntryPrefix + looseFile.getAbsolutePath().substring(len);
}
entryPath = entryPath.replace("\\", "/");
entryPath = entryPath.replace("//", "/");
entryPath = entryPath.substring(0, entryPath.length() - 4); // trim the .xml
File archiveFile = processArchive(looseFile.getName(), looseConfig, true, bootProps);
return new FileEntryConfig(entryPath, archiveFile);
} | [
"public",
"static",
"ArchiveEntryConfig",
"createLooseArchiveEntryConfig",
"(",
"LooseConfig",
"looseConfig",
",",
"File",
"looseFile",
",",
"BootstrapConfig",
"bootProps",
",",
"String",
"archiveEntryPrefix",
",",
"boolean",
"isUsr",
")",
"throws",
"IOException",
"{",
... | Using the method to create Loose config's Archive entry config
@param looseConfig
@param looseFile
@param bootProps
@return
@throws IOException | [
"Using",
"the",
"method",
"to",
"create",
"Loose",
"config",
"s",
"Archive",
"entry",
"config"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ProcessorUtils.java#L188-L206 |
icode/ameba | src/main/java/ameba/message/internal/BeanPathProperties.java | BeanPathProperties.addToPath | public void addToPath(String path, String property) {
"""
<p>addToPath.</p>
@param path a {@link java.lang.String} object.
@param property a {@link java.lang.String} object.
"""
Props props = pathMap.computeIfAbsent(path, k -> new Props(this, null, path));
props.getProperties().add(property);
} | java | public void addToPath(String path, String property) {
Props props = pathMap.computeIfAbsent(path, k -> new Props(this, null, path));
props.getProperties().add(property);
} | [
"public",
"void",
"addToPath",
"(",
"String",
"path",
",",
"String",
"property",
")",
"{",
"Props",
"props",
"=",
"pathMap",
".",
"computeIfAbsent",
"(",
"path",
",",
"k",
"->",
"new",
"Props",
"(",
"this",
",",
"null",
",",
"path",
")",
")",
";",
"p... | <p>addToPath.</p>
@param path a {@link java.lang.String} object.
@param property a {@link java.lang.String} object. | [
"<p",
">",
"addToPath",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/message/internal/BeanPathProperties.java#L119-L122 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/config/IsotopeFactory.java | IsotopeFactory.getIsotope | public IIsotope getIsotope(String symbol, int massNumber) {
"""
Get isotope based on element symbol and mass number.
@param symbol the element symbol
@param massNumber the mass number
@return the corresponding isotope
"""
int elem = Elements.ofString(symbol).number();
List<IIsotope> isotopes = this.isotopes[elem];
if (isotopes == null)
return null;
for (IIsotope isotope : isotopes) {
if (isotope.getSymbol().equals(symbol) && isotope.getMassNumber() == massNumber) {
return clone(isotope);
}
}
return null;
} | java | public IIsotope getIsotope(String symbol, int massNumber) {
int elem = Elements.ofString(symbol).number();
List<IIsotope> isotopes = this.isotopes[elem];
if (isotopes == null)
return null;
for (IIsotope isotope : isotopes) {
if (isotope.getSymbol().equals(symbol) && isotope.getMassNumber() == massNumber) {
return clone(isotope);
}
}
return null;
} | [
"public",
"IIsotope",
"getIsotope",
"(",
"String",
"symbol",
",",
"int",
"massNumber",
")",
"{",
"int",
"elem",
"=",
"Elements",
".",
"ofString",
"(",
"symbol",
")",
".",
"number",
"(",
")",
";",
"List",
"<",
"IIsotope",
">",
"isotopes",
"=",
"this",
"... | Get isotope based on element symbol and mass number.
@param symbol the element symbol
@param massNumber the mass number
@return the corresponding isotope | [
"Get",
"isotope",
"based",
"on",
"element",
"symbol",
"and",
"mass",
"number",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/config/IsotopeFactory.java#L152-L163 |
citrusframework/citrus | modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/FtpClient.java | FtpClient.addFileNameToTargetPath | protected static String addFileNameToTargetPath(String sourcePath, String targetPath) {
"""
If the target path is a directory (ends with "/"), add the file name from the source path to the target path.
Otherwise, don't do anything
Example:
<p>
sourcePath="/some/dir/file.pdf"<br>
targetPath="/other/dir/"<br>
returns: "/other/dir/file.pdf"
</p>
"""
if (targetPath.endsWith("/")) {
String filename = Paths.get(sourcePath).getFileName().toString();
return targetPath + filename;
}
return targetPath;
} | java | protected static String addFileNameToTargetPath(String sourcePath, String targetPath) {
if (targetPath.endsWith("/")) {
String filename = Paths.get(sourcePath).getFileName().toString();
return targetPath + filename;
}
return targetPath;
} | [
"protected",
"static",
"String",
"addFileNameToTargetPath",
"(",
"String",
"sourcePath",
",",
"String",
"targetPath",
")",
"{",
"if",
"(",
"targetPath",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"String",
"filename",
"=",
"Paths",
".",
"get",
"(",
"sourc... | If the target path is a directory (ends with "/"), add the file name from the source path to the target path.
Otherwise, don't do anything
Example:
<p>
sourcePath="/some/dir/file.pdf"<br>
targetPath="/other/dir/"<br>
returns: "/other/dir/file.pdf"
</p> | [
"If",
"the",
"target",
"path",
"is",
"a",
"directory",
"(",
"ends",
"with",
"/",
")",
"add",
"the",
"file",
"name",
"from",
"the",
"source",
"path",
"to",
"the",
"target",
"path",
".",
"Otherwise",
"don",
"t",
"do",
"anything"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/FtpClient.java#L376-L382 |
jfinal/jfinal | src/main/java/com/jfinal/template/expr/ExprParser.java | ExprParser.greaterLess | Expr greaterLess() {
"""
compare expr ('<=' | '>=' | '>' | '<') expr
不支持无限连: > >= < <=
"""
Expr expr = addSub();
Tok tok = peek();
if (tok.sym == Sym.LT || tok.sym == Sym.LE || tok.sym == Sym.GT || tok.sym == Sym.GE) {
move();
return new Compare(tok.sym, expr, addSub(), location);
}
return expr;
} | java | Expr greaterLess() {
Expr expr = addSub();
Tok tok = peek();
if (tok.sym == Sym.LT || tok.sym == Sym.LE || tok.sym == Sym.GT || tok.sym == Sym.GE) {
move();
return new Compare(tok.sym, expr, addSub(), location);
}
return expr;
} | [
"Expr",
"greaterLess",
"(",
")",
"{",
"Expr",
"expr",
"=",
"addSub",
"(",
")",
";",
"Tok",
"tok",
"=",
"peek",
"(",
")",
";",
"if",
"(",
"tok",
".",
"sym",
"==",
"Sym",
".",
"LT",
"||",
"tok",
".",
"sym",
"==",
"Sym",
".",
"LE",
"||",
"tok",
... | compare expr ('<=' | '>=' | '>' | '<') expr
不支持无限连: > >= < <= | [
"compare",
"expr",
"(",
"<",
"=",
"|",
">",
"=",
"|",
">",
"|",
"<",
")",
"expr",
"不支持无限连:",
">",
">",
"=",
"<",
"<",
"="
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/template/expr/ExprParser.java#L216-L224 |
Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/file/FileSystemUtils.java | FileSystemUtils.persistAndWait | public static void persistAndWait(final FileSystem fs, final AlluxioURI uri, int timeoutMs)
throws FileDoesNotExistException, IOException, AlluxioException, TimeoutException,
InterruptedException {
"""
Persists the given path to the under file system and returns once the persist is complete.
Note that if this method times out, the persist may still occur after the timeout period.
@param fs {@link FileSystem} to carry out Alluxio operations
@param uri the uri of the file to persist
@param timeoutMs max amount of time to wait for persist in milliseconds. -1 to wait
indefinitely
@throws TimeoutException if the persist takes longer than the timeout
"""
fs.persist(uri);
CommonUtils.waitFor(String.format("%s to be persisted", uri) , () -> {
try {
return fs.getStatus(uri).isPersisted();
} catch (Exception e) {
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}, WaitForOptions.defaults().setTimeoutMs(timeoutMs)
.setInterval(Constants.SECOND_MS));
} | java | public static void persistAndWait(final FileSystem fs, final AlluxioURI uri, int timeoutMs)
throws FileDoesNotExistException, IOException, AlluxioException, TimeoutException,
InterruptedException {
fs.persist(uri);
CommonUtils.waitFor(String.format("%s to be persisted", uri) , () -> {
try {
return fs.getStatus(uri).isPersisted();
} catch (Exception e) {
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}, WaitForOptions.defaults().setTimeoutMs(timeoutMs)
.setInterval(Constants.SECOND_MS));
} | [
"public",
"static",
"void",
"persistAndWait",
"(",
"final",
"FileSystem",
"fs",
",",
"final",
"AlluxioURI",
"uri",
",",
"int",
"timeoutMs",
")",
"throws",
"FileDoesNotExistException",
",",
"IOException",
",",
"AlluxioException",
",",
"TimeoutException",
",",
"Interr... | Persists the given path to the under file system and returns once the persist is complete.
Note that if this method times out, the persist may still occur after the timeout period.
@param fs {@link FileSystem} to carry out Alluxio operations
@param uri the uri of the file to persist
@param timeoutMs max amount of time to wait for persist in milliseconds. -1 to wait
indefinitely
@throws TimeoutException if the persist takes longer than the timeout | [
"Persists",
"the",
"given",
"path",
"to",
"the",
"under",
"file",
"system",
"and",
"returns",
"once",
"the",
"persist",
"is",
"complete",
".",
"Note",
"that",
"if",
"this",
"method",
"times",
"out",
"the",
"persist",
"may",
"still",
"occur",
"after",
"the"... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/file/FileSystemUtils.java#L150-L163 |
graphql-java/graphql-java | src/main/java/graphql/schema/DataFetcherFactories.java | DataFetcherFactories.wrapDataFetcher | public static DataFetcher wrapDataFetcher(DataFetcher delegateDataFetcher, BiFunction<DataFetchingEnvironment, Object, Object> mapFunction) {
"""
This helper function allows you to wrap an existing data fetcher and map the value once it completes. It helps you handle
values that might be {@link java.util.concurrent.CompletionStage} returned values as well as plain old objects.
@param delegateDataFetcher the original data fetcher that is present on a {@link graphql.schema.GraphQLFieldDefinition} say
@param mapFunction the bi function to apply to the original value
@return a new data fetcher that wraps the provided data fetcher
"""
return environment -> {
Object value = delegateDataFetcher.get(environment);
if (value instanceof CompletionStage) {
//noinspection unchecked
return ((CompletionStage<Object>) value).thenApply(v -> mapFunction.apply(environment, v));
} else {
return mapFunction.apply(environment, value);
}
};
} | java | public static DataFetcher wrapDataFetcher(DataFetcher delegateDataFetcher, BiFunction<DataFetchingEnvironment, Object, Object> mapFunction) {
return environment -> {
Object value = delegateDataFetcher.get(environment);
if (value instanceof CompletionStage) {
//noinspection unchecked
return ((CompletionStage<Object>) value).thenApply(v -> mapFunction.apply(environment, v));
} else {
return mapFunction.apply(environment, value);
}
};
} | [
"public",
"static",
"DataFetcher",
"wrapDataFetcher",
"(",
"DataFetcher",
"delegateDataFetcher",
",",
"BiFunction",
"<",
"DataFetchingEnvironment",
",",
"Object",
",",
"Object",
">",
"mapFunction",
")",
"{",
"return",
"environment",
"->",
"{",
"Object",
"value",
"="... | This helper function allows you to wrap an existing data fetcher and map the value once it completes. It helps you handle
values that might be {@link java.util.concurrent.CompletionStage} returned values as well as plain old objects.
@param delegateDataFetcher the original data fetcher that is present on a {@link graphql.schema.GraphQLFieldDefinition} say
@param mapFunction the bi function to apply to the original value
@return a new data fetcher that wraps the provided data fetcher | [
"This",
"helper",
"function",
"allows",
"you",
"to",
"wrap",
"an",
"existing",
"data",
"fetcher",
"and",
"map",
"the",
"value",
"once",
"it",
"completes",
".",
"It",
"helps",
"you",
"handle",
"values",
"that",
"might",
"be",
"{",
"@link",
"java",
".",
"u... | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/DataFetcherFactories.java#L35-L45 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/validation/PatchHistoryValidations.java | PatchHistoryValidations.validateRollbackState | public static void validateRollbackState(final String patchID, final InstalledIdentity identity) throws PatchingException {
"""
Validate the consistency of patches to the point we rollback.
@param patchID the patch id which gets rolled back
@param identity the installed identity
@throws PatchingException
"""
final Set<String> validHistory = processRollbackState(patchID, identity);
if (patchID != null && !validHistory.contains(patchID)) {
throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(patchID);
}
} | java | public static void validateRollbackState(final String patchID, final InstalledIdentity identity) throws PatchingException {
final Set<String> validHistory = processRollbackState(patchID, identity);
if (patchID != null && !validHistory.contains(patchID)) {
throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(patchID);
}
} | [
"public",
"static",
"void",
"validateRollbackState",
"(",
"final",
"String",
"patchID",
",",
"final",
"InstalledIdentity",
"identity",
")",
"throws",
"PatchingException",
"{",
"final",
"Set",
"<",
"String",
">",
"validHistory",
"=",
"processRollbackState",
"(",
"pat... | Validate the consistency of patches to the point we rollback.
@param patchID the patch id which gets rolled back
@param identity the installed identity
@throws PatchingException | [
"Validate",
"the",
"consistency",
"of",
"patches",
"to",
"the",
"point",
"we",
"rollback",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/validation/PatchHistoryValidations.java#L54-L59 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java | ParserDDL.compileCreateIndex | StatementSchema compileCreateIndex(boolean unique, boolean assumeUnique, boolean migrating) {
"""
A VoltDB extension to support indexed expressions and the assume unique attribute
"""
/* disable 1 line ...
StatementSchema compileCreateIndex(boolean unique) {
... disabled 1 line */
// End of VoltDB extension
Table table;
HsqlName indexHsqlName;
read();
indexHsqlName = readNewSchemaObjectName(SchemaObject.INDEX);
readThis(Tokens.ON);
table = readTableName();
HsqlName tableSchema = table.getSchemaName();
indexHsqlName.setSchemaIfNull(tableSchema);
indexHsqlName.parent = table.getName();
if (indexHsqlName.schema != tableSchema) {
throw Error.error(ErrorCode.X_42505);
}
indexHsqlName.schema = table.getSchemaName();
// A VoltDB extension to support indexed expressions and the assume unique attribute
java.util.List<Boolean> ascDesc = new java.util.ArrayList<Boolean>();
// A VoltDB extension to "readColumnList(table, true)" to support indexed expressions.
java.util.List<Expression> indexExprs = XreadExpressions(ascDesc, migrating);
OrderedHashSet set = getSimpleColumnNames(indexExprs);
int[] indexColumns = null;
if (set == null) {
// A VoltDB extension to support indexed expressions.
// Not just indexing columns.
// The meaning of set and indexColumns shifts here to be
// the set of unique base columns for the indexed expressions.
set = getBaseColumnNames(indexExprs);
} else {
// Just indexing columns -- by-pass extended support for generalized index expressions.
indexExprs = null;
}
// A VoltDB extension to support partial index
Expression predicate = null;
if (readIfThis(Tokens.WHERE)) {
predicate = XreadBooleanValueExpression();
}
indexColumns = getColumnList(set, table);
String sql = getLastPart();
Object[] args = new Object[] {
table, indexColumns, indexHsqlName, unique, migrating, indexExprs, assumeUnique, predicate
/* disable 4 lines ...
int[] indexColumns = readColumnList(table, true);
String sql = getLastPart();
Object[] args = new Object[] {
table, indexColumns, indexHsqlName, Boolean.valueOf(unique)
... disabled 4 lines */
// End of VoltDB extension
};
return new StatementSchema(sql, StatementTypes.CREATE_INDEX, args,
null, table.getName());
} | java | StatementSchema compileCreateIndex(boolean unique, boolean assumeUnique, boolean migrating) {
/* disable 1 line ...
StatementSchema compileCreateIndex(boolean unique) {
... disabled 1 line */
// End of VoltDB extension
Table table;
HsqlName indexHsqlName;
read();
indexHsqlName = readNewSchemaObjectName(SchemaObject.INDEX);
readThis(Tokens.ON);
table = readTableName();
HsqlName tableSchema = table.getSchemaName();
indexHsqlName.setSchemaIfNull(tableSchema);
indexHsqlName.parent = table.getName();
if (indexHsqlName.schema != tableSchema) {
throw Error.error(ErrorCode.X_42505);
}
indexHsqlName.schema = table.getSchemaName();
// A VoltDB extension to support indexed expressions and the assume unique attribute
java.util.List<Boolean> ascDesc = new java.util.ArrayList<Boolean>();
// A VoltDB extension to "readColumnList(table, true)" to support indexed expressions.
java.util.List<Expression> indexExprs = XreadExpressions(ascDesc, migrating);
OrderedHashSet set = getSimpleColumnNames(indexExprs);
int[] indexColumns = null;
if (set == null) {
// A VoltDB extension to support indexed expressions.
// Not just indexing columns.
// The meaning of set and indexColumns shifts here to be
// the set of unique base columns for the indexed expressions.
set = getBaseColumnNames(indexExprs);
} else {
// Just indexing columns -- by-pass extended support for generalized index expressions.
indexExprs = null;
}
// A VoltDB extension to support partial index
Expression predicate = null;
if (readIfThis(Tokens.WHERE)) {
predicate = XreadBooleanValueExpression();
}
indexColumns = getColumnList(set, table);
String sql = getLastPart();
Object[] args = new Object[] {
table, indexColumns, indexHsqlName, unique, migrating, indexExprs, assumeUnique, predicate
/* disable 4 lines ...
int[] indexColumns = readColumnList(table, true);
String sql = getLastPart();
Object[] args = new Object[] {
table, indexColumns, indexHsqlName, Boolean.valueOf(unique)
... disabled 4 lines */
// End of VoltDB extension
};
return new StatementSchema(sql, StatementTypes.CREATE_INDEX, args,
null, table.getName());
} | [
"StatementSchema",
"compileCreateIndex",
"(",
"boolean",
"unique",
",",
"boolean",
"assumeUnique",
",",
"boolean",
"migrating",
")",
"{",
"/* disable 1 line ...\n StatementSchema compileCreateIndex(boolean unique) {\n ... disabled 1 line */",
"// End of VoltDB extension",
"Table"... | A VoltDB extension to support indexed expressions and the assume unique attribute | [
"A",
"VoltDB",
"extension",
"to",
"support",
"indexed",
"expressions",
"and",
"the",
"assume",
"unique",
"attribute"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L3511-L3578 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.resolveMethodIndex | int resolveMethodIndex(ExecutableElement method) {
"""
Returns the constant map index to method
If entry doesn't exist it is created.
@param method
@return
"""
int size = 0;
int index = 0;
constantReadLock.lock();
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
String declaringClassname = declaringClass.getQualifiedName().toString();
String descriptor = Descriptor.getDesriptor(method);
String name = method.getSimpleName().toString();
try
{
size = getConstantPoolSize();
index = getRefIndex(Methodref.class, declaringClassname, name, descriptor);
}
finally
{
constantReadLock.unlock();
}
if (index == -1)
{
// add entry to constant pool
int ci = resolveClassIndex(declaringClass);
int nati = resolveNameAndTypeIndex(name, descriptor);
index = addConstantInfo(new Methodref(ci, nati), size);
}
addIndexedElement(index, method);
return index;
} | java | int resolveMethodIndex(ExecutableElement method)
{
int size = 0;
int index = 0;
constantReadLock.lock();
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
String declaringClassname = declaringClass.getQualifiedName().toString();
String descriptor = Descriptor.getDesriptor(method);
String name = method.getSimpleName().toString();
try
{
size = getConstantPoolSize();
index = getRefIndex(Methodref.class, declaringClassname, name, descriptor);
}
finally
{
constantReadLock.unlock();
}
if (index == -1)
{
// add entry to constant pool
int ci = resolveClassIndex(declaringClass);
int nati = resolveNameAndTypeIndex(name, descriptor);
index = addConstantInfo(new Methodref(ci, nati), size);
}
addIndexedElement(index, method);
return index;
} | [
"int",
"resolveMethodIndex",
"(",
"ExecutableElement",
"method",
")",
"{",
"int",
"size",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"constantReadLock",
".",
"lock",
"(",
")",
";",
"TypeElement",
"declaringClass",
"=",
"(",
"TypeElement",
")",
"method",
... | Returns the constant map index to method
If entry doesn't exist it is created.
@param method
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"method",
"If",
"entry",
"doesn",
"t",
"exist",
"it",
"is",
"created",
"."
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L224-L251 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java | Calc.vectorProduct | public static final Atom vectorProduct(Atom a , Atom b) {
"""
Vector product (cross product).
@param a
an Atom object
@param b
an Atom object
@return an Atom object
"""
Atom c = new AtomImpl();
c.setX( a.getY() * b.getZ() - a.getZ() * b.getY() ) ;
c.setY( a.getZ() * b.getX() - a.getX() * b.getZ() ) ;
c.setZ( a.getX() * b.getY() - a.getY() * b.getX() ) ;
return c ;
} | java | public static final Atom vectorProduct(Atom a , Atom b){
Atom c = new AtomImpl();
c.setX( a.getY() * b.getZ() - a.getZ() * b.getY() ) ;
c.setY( a.getZ() * b.getX() - a.getX() * b.getZ() ) ;
c.setZ( a.getX() * b.getY() - a.getY() * b.getX() ) ;
return c ;
} | [
"public",
"static",
"final",
"Atom",
"vectorProduct",
"(",
"Atom",
"a",
",",
"Atom",
"b",
")",
"{",
"Atom",
"c",
"=",
"new",
"AtomImpl",
"(",
")",
";",
"c",
".",
"setX",
"(",
"a",
".",
"getY",
"(",
")",
"*",
"b",
".",
"getZ",
"(",
")",
"-",
"... | Vector product (cross product).
@param a
an Atom object
@param b
an Atom object
@return an Atom object | [
"Vector",
"product",
"(",
"cross",
"product",
")",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L151-L159 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/data/struct/SimpleBloomFilter.java | SimpleBloomFilter.computeOptimalNumberOfHashFunctions | protected static int computeOptimalNumberOfHashFunctions(double approximateNumberOfElements, double requiredNumberOfBits) {
"""
Computes the optimal number of hash functions to apply to each element added to the Bloom Filter as a factor
of the approximate (estimated) number of elements that will be added to the filter along with
the required number of bits needed by the filter, which was computed from the probability of false positives.
k = m/n * log 2
m is the required number of bits needed for the bloom filter
n is the approximate number of elements to be added to the bloom filter
k is the optimal number of hash functions to apply to the element added to the bloom filter
@param approximateNumberOfElements integer value indicating the approximate, estimated number of elements
the user expects will be added to the Bloom Filter.
@param requiredNumberOfBits the required number of bits needed by the Bloom Filter to satify the probability
of false positives.
@return the optimal number of hash functions used by the Bloom Filter.
"""
double numberOfHashFunctions = (requiredNumberOfBits / approximateNumberOfElements) * Math.log(2.0d);
return Double.valueOf(Math.ceil(numberOfHashFunctions)).intValue();
} | java | protected static int computeOptimalNumberOfHashFunctions(double approximateNumberOfElements, double requiredNumberOfBits) {
double numberOfHashFunctions = (requiredNumberOfBits / approximateNumberOfElements) * Math.log(2.0d);
return Double.valueOf(Math.ceil(numberOfHashFunctions)).intValue();
} | [
"protected",
"static",
"int",
"computeOptimalNumberOfHashFunctions",
"(",
"double",
"approximateNumberOfElements",
",",
"double",
"requiredNumberOfBits",
")",
"{",
"double",
"numberOfHashFunctions",
"=",
"(",
"requiredNumberOfBits",
"/",
"approximateNumberOfElements",
")",
"*... | Computes the optimal number of hash functions to apply to each element added to the Bloom Filter as a factor
of the approximate (estimated) number of elements that will be added to the filter along with
the required number of bits needed by the filter, which was computed from the probability of false positives.
k = m/n * log 2
m is the required number of bits needed for the bloom filter
n is the approximate number of elements to be added to the bloom filter
k is the optimal number of hash functions to apply to the element added to the bloom filter
@param approximateNumberOfElements integer value indicating the approximate, estimated number of elements
the user expects will be added to the Bloom Filter.
@param requiredNumberOfBits the required number of bits needed by the Bloom Filter to satify the probability
of false positives.
@return the optimal number of hash functions used by the Bloom Filter. | [
"Computes",
"the",
"optimal",
"number",
"of",
"hash",
"functions",
"to",
"apply",
"to",
"each",
"element",
"added",
"to",
"the",
"Bloom",
"Filter",
"as",
"a",
"factor",
"of",
"the",
"approximate",
"(",
"estimated",
")",
"number",
"of",
"elements",
"that",
... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/struct/SimpleBloomFilter.java#L210-L215 |
RestComm/media-core | component/src/main/java/org/restcomm/media/core/component/audio/GoertzelFilter.java | GoertzelFilter.getPower | public double getPower(double f, double[] signal, int offset, int len, double scale) {
"""
Calculates power of the specified frequence of the specified signal.
@param f the frequence value.
@param signal sampled signal.
@param offset index of the first sample of the signal.
@param len the length of signal in samples
@param scale the length of signal in seconds
@return the power of the specified frequency
"""
int N = len;
int M = N + offset;
double o = 2* Math.PI / N;
//hamming window
for (int i = offset; i < M; i++) {
signal[i] *= (0.54-0.46 * Math.cos(o* i));
}
//Goertzel filter
double realW = 2.0 * Math.cos(o* scale* f);
double imagW = Math.sin(o * scale* f);
double d1 = 0.0;
double d2 = 0.0;
double y = 0;
for (int n = offset; n < M; ++n) {
y = signal[n] + realW*d1 - d2;
d2 = d1;
d1 = y;
}
double resultr = 0.5*realW*d1 - d2;
double resulti = imagW*d1;
return Math.sqrt( (resultr * resultr) + (resulti * resulti));
} | java | public double getPower(double f, double[] signal, int offset, int len, double scale) {
int N = len;
int M = N + offset;
double o = 2* Math.PI / N;
//hamming window
for (int i = offset; i < M; i++) {
signal[i] *= (0.54-0.46 * Math.cos(o* i));
}
//Goertzel filter
double realW = 2.0 * Math.cos(o* scale* f);
double imagW = Math.sin(o * scale* f);
double d1 = 0.0;
double d2 = 0.0;
double y = 0;
for (int n = offset; n < M; ++n) {
y = signal[n] + realW*d1 - d2;
d2 = d1;
d1 = y;
}
double resultr = 0.5*realW*d1 - d2;
double resulti = imagW*d1;
return Math.sqrt( (resultr * resultr) + (resulti * resulti));
} | [
"public",
"double",
"getPower",
"(",
"double",
"f",
",",
"double",
"[",
"]",
"signal",
",",
"int",
"offset",
",",
"int",
"len",
",",
"double",
"scale",
")",
"{",
"int",
"N",
"=",
"len",
";",
"int",
"M",
"=",
"N",
"+",
"offset",
";",
"double",
"o"... | Calculates power of the specified frequence of the specified signal.
@param f the frequence value.
@param signal sampled signal.
@param offset index of the first sample of the signal.
@param len the length of signal in samples
@param scale the length of signal in seconds
@return the power of the specified frequency | [
"Calculates",
"power",
"of",
"the",
"specified",
"frequence",
"of",
"the",
"specified",
"signal",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/component/src/main/java/org/restcomm/media/core/component/audio/GoertzelFilter.java#L68-L97 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java | AttributeDefinition.addAllowedValuesToDescription | protected void addAllowedValuesToDescription(ModelNode result, ParameterValidator validator) {
"""
Adds the allowed values. Override for attributes who should not use the allowed values.
@param result the node to add the allowed values to
@param validator the validator to get the allowed values from
"""
if (allowedValues != null) {
for (ModelNode allowedValue : allowedValues) {
result.get(ModelDescriptionConstants.ALLOWED).add(allowedValue);
}
} else if (validator instanceof AllowedValuesValidator) {
AllowedValuesValidator avv = (AllowedValuesValidator) validator;
List<ModelNode> allowed = avv.getAllowedValues();
if (allowed != null) {
for (ModelNode ok : allowed) {
result.get(ModelDescriptionConstants.ALLOWED).add(ok);
}
}
}
} | java | protected void addAllowedValuesToDescription(ModelNode result, ParameterValidator validator) {
if (allowedValues != null) {
for (ModelNode allowedValue : allowedValues) {
result.get(ModelDescriptionConstants.ALLOWED).add(allowedValue);
}
} else if (validator instanceof AllowedValuesValidator) {
AllowedValuesValidator avv = (AllowedValuesValidator) validator;
List<ModelNode> allowed = avv.getAllowedValues();
if (allowed != null) {
for (ModelNode ok : allowed) {
result.get(ModelDescriptionConstants.ALLOWED).add(ok);
}
}
}
} | [
"protected",
"void",
"addAllowedValuesToDescription",
"(",
"ModelNode",
"result",
",",
"ParameterValidator",
"validator",
")",
"{",
"if",
"(",
"allowedValues",
"!=",
"null",
")",
"{",
"for",
"(",
"ModelNode",
"allowedValue",
":",
"allowedValues",
")",
"{",
"result... | Adds the allowed values. Override for attributes who should not use the allowed values.
@param result the node to add the allowed values to
@param validator the validator to get the allowed values from | [
"Adds",
"the",
"allowed",
"values",
".",
"Override",
"for",
"attributes",
"who",
"should",
"not",
"use",
"the",
"allowed",
"values",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L1136-L1150 |
VoltDB/voltdb | src/frontend/org/voltcore/zk/BabySitter.java | BabySitter.blockingFactory | public static Pair<BabySitter, List<String>> blockingFactory(ZooKeeper zk, String dir, Callback cb,
ExecutorService es)
throws InterruptedException, ExecutionException {
"""
Create a new BabySitter and block on reading the initial children list.
Use the provided ExecutorService to queue events to, rather than
creating a private ExecutorService. The initial set of children will be retrieved
in the current thread and not the ExecutorService because it is assumed
this is being called from the ExecutorService
"""
BabySitter bs = new BabySitter(zk, dir, cb, es);
List<String> initialChildren;
try {
initialChildren = bs.m_eventHandler.call();
} catch (Exception e) {
throw new ExecutionException(e);
}
return new Pair<BabySitter, List<String>>(bs, initialChildren);
} | java | public static Pair<BabySitter, List<String>> blockingFactory(ZooKeeper zk, String dir, Callback cb,
ExecutorService es)
throws InterruptedException, ExecutionException
{
BabySitter bs = new BabySitter(zk, dir, cb, es);
List<String> initialChildren;
try {
initialChildren = bs.m_eventHandler.call();
} catch (Exception e) {
throw new ExecutionException(e);
}
return new Pair<BabySitter, List<String>>(bs, initialChildren);
} | [
"public",
"static",
"Pair",
"<",
"BabySitter",
",",
"List",
"<",
"String",
">",
">",
"blockingFactory",
"(",
"ZooKeeper",
"zk",
",",
"String",
"dir",
",",
"Callback",
"cb",
",",
"ExecutorService",
"es",
")",
"throws",
"InterruptedException",
",",
"ExecutionExc... | Create a new BabySitter and block on reading the initial children list.
Use the provided ExecutorService to queue events to, rather than
creating a private ExecutorService. The initial set of children will be retrieved
in the current thread and not the ExecutorService because it is assumed
this is being called from the ExecutorService | [
"Create",
"a",
"new",
"BabySitter",
"and",
"block",
"on",
"reading",
"the",
"initial",
"children",
"list",
".",
"Use",
"the",
"provided",
"ExecutorService",
"to",
"queue",
"events",
"to",
"rather",
"than",
"creating",
"a",
"private",
"ExecutorService",
".",
"T... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/zk/BabySitter.java#L131-L143 |
thorntail/thorntail | arquillian/gradle-adapter/src/main/java/org/wildfly/swarm/arquillian/adapter/gradle/GradleDependencyAdapter.java | GradleDependencyAdapter.computeProjectDependencies | @SuppressWarnings("UnstableApiUsage")
private void computeProjectDependencies(IdeaModule module) {
"""
Compute the dependencies of a given {@code IdeaModule} and group them by their scope.
Note: This method does not follow project->project dependencies. It just makes a note of them in a separate collection.
@param module the IdeaModule reference.
"""
ARTIFACT_DEPS_OF_PRJ.computeIfAbsent(module.getName(), moduleName -> {
Map<String, Set<ArtifactSpec>> dependencies = new HashMap<>();
module.getDependencies().forEach(dep -> {
if (dep instanceof IdeaModuleDependency) {
// Add the dependency to the list.
String name = ((IdeaModuleDependency) dep).getTargetModuleName();
PRJ_DEPS_OF_PRJ.computeIfAbsent(moduleName, key -> new HashSet<>()).add(name);
} else if (dep instanceof ExternalDependency) {
ExternalDependency extDep = (ExternalDependency) dep;
GradleModuleVersion gav = extDep.getGradleModuleVersion();
ArtifactSpec spec = new ArtifactSpec("compile", gav.getGroup(), gav.getName(), gav.getVersion(),
"jar", null, extDep.getFile());
String depScope = dep.getScope().getScope();
dependencies.computeIfAbsent(depScope, s -> new HashSet<>()).add(spec);
}
});
return dependencies;
});
} | java | @SuppressWarnings("UnstableApiUsage")
private void computeProjectDependencies(IdeaModule module) {
ARTIFACT_DEPS_OF_PRJ.computeIfAbsent(module.getName(), moduleName -> {
Map<String, Set<ArtifactSpec>> dependencies = new HashMap<>();
module.getDependencies().forEach(dep -> {
if (dep instanceof IdeaModuleDependency) {
// Add the dependency to the list.
String name = ((IdeaModuleDependency) dep).getTargetModuleName();
PRJ_DEPS_OF_PRJ.computeIfAbsent(moduleName, key -> new HashSet<>()).add(name);
} else if (dep instanceof ExternalDependency) {
ExternalDependency extDep = (ExternalDependency) dep;
GradleModuleVersion gav = extDep.getGradleModuleVersion();
ArtifactSpec spec = new ArtifactSpec("compile", gav.getGroup(), gav.getName(), gav.getVersion(),
"jar", null, extDep.getFile());
String depScope = dep.getScope().getScope();
dependencies.computeIfAbsent(depScope, s -> new HashSet<>()).add(spec);
}
});
return dependencies;
});
} | [
"@",
"SuppressWarnings",
"(",
"\"UnstableApiUsage\"",
")",
"private",
"void",
"computeProjectDependencies",
"(",
"IdeaModule",
"module",
")",
"{",
"ARTIFACT_DEPS_OF_PRJ",
".",
"computeIfAbsent",
"(",
"module",
".",
"getName",
"(",
")",
",",
"moduleName",
"->",
"{",
... | Compute the dependencies of a given {@code IdeaModule} and group them by their scope.
Note: This method does not follow project->project dependencies. It just makes a note of them in a separate collection.
@param module the IdeaModule reference. | [
"Compute",
"the",
"dependencies",
"of",
"a",
"given",
"{",
"@code",
"IdeaModule",
"}",
"and",
"group",
"them",
"by",
"their",
"scope",
"."
] | train | https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/arquillian/gradle-adapter/src/main/java/org/wildfly/swarm/arquillian/adapter/gradle/GradleDependencyAdapter.java#L148-L168 |
google/Accessibility-Test-Framework-for-Android | src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoRef.java | AccessibilityNodeInfoRef.unOwned | public static AccessibilityNodeInfoRef unOwned(
AccessibilityNodeInfoCompat node) {
"""
Creates a new instance of this class without assuming ownership of
{@code node}.
"""
return node != null ? new AccessibilityNodeInfoRef(node, false) : null;
} | java | public static AccessibilityNodeInfoRef unOwned(
AccessibilityNodeInfoCompat node) {
return node != null ? new AccessibilityNodeInfoRef(node, false) : null;
} | [
"public",
"static",
"AccessibilityNodeInfoRef",
"unOwned",
"(",
"AccessibilityNodeInfoCompat",
"node",
")",
"{",
"return",
"node",
"!=",
"null",
"?",
"new",
"AccessibilityNodeInfoRef",
"(",
"node",
",",
"false",
")",
":",
"null",
";",
"}"
] | Creates a new instance of this class without assuming ownership of
{@code node}. | [
"Creates",
"a",
"new",
"instance",
"of",
"this",
"class",
"without",
"assuming",
"ownership",
"of",
"{"
] | train | https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/AccessibilityNodeInfoRef.java#L100-L103 |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/rest/OrientDBHttpAPIResource.java | OrientDBHttpAPIResource.mountOrientDbRestApi | @SuppressWarnings("restriction")
public static void mountOrientDbRestApi(OrientDBHttpAPIResource resource, WebApplication app) {
"""
Mounts OrientDB REST API Bridge to an app
@param resource {@link OrientDBHttpAPIResource} to mount
@param app {@link WebApplication} to mount to
"""
mountOrientDbRestApi(resource, app, MOUNT_PATH);
} | java | @SuppressWarnings("restriction")
public static void mountOrientDbRestApi(OrientDBHttpAPIResource resource, WebApplication app) {
mountOrientDbRestApi(resource, app, MOUNT_PATH);
} | [
"@",
"SuppressWarnings",
"(",
"\"restriction\"",
")",
"public",
"static",
"void",
"mountOrientDbRestApi",
"(",
"OrientDBHttpAPIResource",
"resource",
",",
"WebApplication",
"app",
")",
"{",
"mountOrientDbRestApi",
"(",
"resource",
",",
"app",
",",
"MOUNT_PATH",
")",
... | Mounts OrientDB REST API Bridge to an app
@param resource {@link OrientDBHttpAPIResource} to mount
@param app {@link WebApplication} to mount to | [
"Mounts",
"OrientDB",
"REST",
"API",
"Bridge",
"to",
"an",
"app"
] | train | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/rest/OrientDBHttpAPIResource.java#L176-L179 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java | DatePicker.initComponents | private void initComponents() {
"""
initComponents, This initializes the components of the JFormDesigner panel. This function is
automatically generated by JFormDesigner from the JFD form design file, and should not be
modified by hand. This function can be modified, if needed, by using JFormDesigner.
Implementation notes regarding JTextField: This class uses a JTextField instead of a
JFormattedTextField as its text input component, because a date-formatted JFormattedTextField
stores its value as a java.util.Date (Date) object, which is not ideal for this project. Date
objects represent a specific instant in time instead of a "local date" value. Date objects
also require time zone calculations to convert them to a java.time.LocalDate. This class
displays and stores "local dates" only, and is designed to function independently of any time
zone differences. See java.time.LocalDate for details on the meaning of a LocalDate. To gain
the validation functionality of a JFormattedTextField, this class implements a similar
"commit" and "revert" capability as the JFormattedTextField class.
"""
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
dateTextField = new JTextField();
toggleCalendarButton = new JButton();
//======== this ========
setLayout(new FormLayout(
"pref:grow, [3px,pref], [26px,pref]",
"fill:pref:grow"));
//---- dateTextField ----
dateTextField.setMargin(new Insets(1, 3, 2, 2));
dateTextField.setBorder(new CompoundBorder(
new MatteBorder(1, 1, 1, 1, new Color(122, 138, 153)),
new EmptyBorder(1, 3, 2, 2)));
dateTextField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
setTextFieldToValidStateIfNeeded();
}
});
add(dateTextField, CC.xy(1, 1));
//---- toggleCalendarButton ----
toggleCalendarButton.setText("...");
toggleCalendarButton.setFocusPainted(false);
toggleCalendarButton.setFocusable(false);
toggleCalendarButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
zEventToggleCalendarButtonMousePressed(e);
}
});
add(toggleCalendarButton, CC.xy(3, 1));
// JFormDesigner - End of component initialization //GEN-END:initComponents
} | java | private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
dateTextField = new JTextField();
toggleCalendarButton = new JButton();
//======== this ========
setLayout(new FormLayout(
"pref:grow, [3px,pref], [26px,pref]",
"fill:pref:grow"));
//---- dateTextField ----
dateTextField.setMargin(new Insets(1, 3, 2, 2));
dateTextField.setBorder(new CompoundBorder(
new MatteBorder(1, 1, 1, 1, new Color(122, 138, 153)),
new EmptyBorder(1, 3, 2, 2)));
dateTextField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
setTextFieldToValidStateIfNeeded();
}
});
add(dateTextField, CC.xy(1, 1));
//---- toggleCalendarButton ----
toggleCalendarButton.setText("...");
toggleCalendarButton.setFocusPainted(false);
toggleCalendarButton.setFocusable(false);
toggleCalendarButton.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
zEventToggleCalendarButtonMousePressed(e);
}
});
add(toggleCalendarButton, CC.xy(3, 1));
// JFormDesigner - End of component initialization //GEN-END:initComponents
} | [
"private",
"void",
"initComponents",
"(",
")",
"{",
"// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents",
"dateTextField",
"=",
"new",
"JTextField",
"(",
")",
";",
"toggleCalendarButton",
"=",
"new",
"JButton",
"(",
")",
";",
"//========... | initComponents, This initializes the components of the JFormDesigner panel. This function is
automatically generated by JFormDesigner from the JFD form design file, and should not be
modified by hand. This function can be modified, if needed, by using JFormDesigner.
Implementation notes regarding JTextField: This class uses a JTextField instead of a
JFormattedTextField as its text input component, because a date-formatted JFormattedTextField
stores its value as a java.util.Date (Date) object, which is not ideal for this project. Date
objects represent a specific instant in time instead of a "local date" value. Date objects
also require time zone calculations to convert them to a java.time.LocalDate. This class
displays and stores "local dates" only, and is designed to function independently of any time
zone differences. See java.time.LocalDate for details on the meaning of a LocalDate. To gain
the validation functionality of a JFormattedTextField, this class implements a similar
"commit" and "revert" capability as the JFormattedTextField class. | [
"initComponents",
"This",
"initializes",
"the",
"components",
"of",
"the",
"JFormDesigner",
"panel",
".",
"This",
"function",
"is",
"automatically",
"generated",
"by",
"JFormDesigner",
"from",
"the",
"JFD",
"form",
"design",
"file",
"and",
"should",
"not",
"be",
... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java#L919-L954 |
future-architect/uroborosql | src/main/java/jp/co/future/uroborosql/client/completer/AbstractCompleter.java | AbstractCompleter.accept | protected boolean accept(final int startArgNo, final String buffer, final int len) {
"""
コード補完対象かどうかを判定する
@param startArgNo 開始引数No
@param buffer 入力文字列
@param len partsのlength
@return コード補完対象の場合<code>true</code>
"""
// 対象引数が-1、または開始引数にlenが満たない場合は該当なしなのでコード補完しない
return startArgNo != -1 && (buffer.endsWith(" ") && startArgNo <= len
|| !buffer.endsWith(" ") && startArgNo + 1 <= len);
} | java | protected boolean accept(final int startArgNo, final String buffer, final int len) {
// 対象引数が-1、または開始引数にlenが満たない場合は該当なしなのでコード補完しない
return startArgNo != -1 && (buffer.endsWith(" ") && startArgNo <= len
|| !buffer.endsWith(" ") && startArgNo + 1 <= len);
} | [
"protected",
"boolean",
"accept",
"(",
"final",
"int",
"startArgNo",
",",
"final",
"String",
"buffer",
",",
"final",
"int",
"len",
")",
"{",
"// 対象引数が-1、または開始引数にlenが満たない場合は該当なしなのでコード補完しない",
"return",
"startArgNo",
"!=",
"-",
"1",
"&&",
"(",
"buffer",
".",
"endsW... | コード補完対象かどうかを判定する
@param startArgNo 開始引数No
@param buffer 入力文字列
@param len partsのlength
@return コード補完対象の場合<code>true</code> | [
"コード補完対象かどうかを判定する"
] | train | https://github.com/future-architect/uroborosql/blob/4c26db51defdac3c6ed16866e33ab45e190e2e0c/src/main/java/jp/co/future/uroborosql/client/completer/AbstractCompleter.java#L51-L55 |
kkopacz/agiso-core | bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/DateUtils.java | DateUtils.getRandomDate | public static Date getRandomDate(Date begin, Date end) {
"""
Pobiera pseudolosową datę z określonego przedziału czasowego.
@param begin Data początkowa.
@param end Data końcowa.
@return Losowo wygenerowana data.
"""
return getRandomDate(begin, end, r);
} | java | public static Date getRandomDate(Date begin, Date end) {
return getRandomDate(begin, end, r);
} | [
"public",
"static",
"Date",
"getRandomDate",
"(",
"Date",
"begin",
",",
"Date",
"end",
")",
"{",
"return",
"getRandomDate",
"(",
"begin",
",",
"end",
",",
"r",
")",
";",
"}"
] | Pobiera pseudolosową datę z określonego przedziału czasowego.
@param begin Data początkowa.
@param end Data końcowa.
@return Losowo wygenerowana data. | [
"Pobiera",
"pseudolosową",
"datę",
"z",
"określonego",
"przedziału",
"czasowego",
"."
] | train | https://github.com/kkopacz/agiso-core/blob/b994ec0146be1fe3f10829d69cd719bdbdebe1c5/bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/DateUtils.java#L195-L197 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java | OAuthActivity.createOAuthActivityIntent | public static Intent createOAuthActivityIntent(final Context context, BoxSession session, boolean loginViaBoxApp) {
"""
Create intent to launch OAuthActivity using information from the given session.
@param context
context
@param session the BoxSession to use to get parameters required to authenticate via this activity.
@param loginViaBoxApp Whether login should be handled by the installed box android app. Set this to true only when you are sure or want
to make sure user installed box android app and want to use box android app to login.
@return intent to launch OAuthActivity.
"""
Intent intent = createOAuthActivityIntent(context, session.getClientId(), session.getClientSecret(), session.getRedirectUrl(), loginViaBoxApp);
intent.putExtra(EXTRA_SESSION, session);
if (!SdkUtils.isEmptyString(session.getUserId())) {
intent.putExtra(EXTRA_USER_ID_RESTRICTION, session.getUserId());
}
return intent;
} | java | public static Intent createOAuthActivityIntent(final Context context, BoxSession session, boolean loginViaBoxApp){
Intent intent = createOAuthActivityIntent(context, session.getClientId(), session.getClientSecret(), session.getRedirectUrl(), loginViaBoxApp);
intent.putExtra(EXTRA_SESSION, session);
if (!SdkUtils.isEmptyString(session.getUserId())) {
intent.putExtra(EXTRA_USER_ID_RESTRICTION, session.getUserId());
}
return intent;
} | [
"public",
"static",
"Intent",
"createOAuthActivityIntent",
"(",
"final",
"Context",
"context",
",",
"BoxSession",
"session",
",",
"boolean",
"loginViaBoxApp",
")",
"{",
"Intent",
"intent",
"=",
"createOAuthActivityIntent",
"(",
"context",
",",
"session",
".",
"getCl... | Create intent to launch OAuthActivity using information from the given session.
@param context
context
@param session the BoxSession to use to get parameters required to authenticate via this activity.
@param loginViaBoxApp Whether login should be handled by the installed box android app. Set this to true only when you are sure or want
to make sure user installed box android app and want to use box android app to login.
@return intent to launch OAuthActivity. | [
"Create",
"intent",
"to",
"launch",
"OAuthActivity",
"using",
"information",
"from",
"the",
"given",
"session",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/OAuthActivity.java#L539-L546 |
GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java | MaterialPathAnimator.animate | public static void animate(Widget source, final Widget target) {
"""
Helper method to apply the path animator.
@param source Source widget to apply the Path Animator
@param target Target widget to apply the Path Animator
"""
animate(source.getElement(), target.getElement());
} | java | public static void animate(Widget source, final Widget target) {
animate(source.getElement(), target.getElement());
} | [
"public",
"static",
"void",
"animate",
"(",
"Widget",
"source",
",",
"final",
"Widget",
"target",
")",
"{",
"animate",
"(",
"source",
".",
"getElement",
"(",
")",
",",
"target",
".",
"getElement",
"(",
")",
")",
";",
"}"
] | Helper method to apply the path animator.
@param source Source widget to apply the Path Animator
@param target Target widget to apply the Path Animator | [
"Helper",
"method",
"to",
"apply",
"the",
"path",
"animator",
"."
] | train | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java#L110-L112 |
apache/incubator-gobblin | gobblin-modules/gobblin-crypto/src/main/java/org/apache/gobblin/crypto/GPGFileEncryptor.java | GPGFileEncryptor.symmetricKeyAlgorithmNameToTag | private static int symmetricKeyAlgorithmNameToTag(String cipherName) {
"""
Convert a string cipher name to the integer tag used by GPG
@param cipherName the cipher name
@return integer tag for the cipher
"""
// Use CAST5 if no cipher specified
if (StringUtils.isEmpty(cipherName)) {
return PGPEncryptedData.CAST5;
}
Set<Field> fields = ReflectionUtils.getAllFields(PGPEncryptedData.class, ReflectionUtils.withName(cipherName));
if (fields.isEmpty()) {
throw new RuntimeException("Could not find tag for cipher name " + cipherName);
}
try {
return fields.iterator().next().getInt(null);
} catch (IllegalAccessException e) {
throw new RuntimeException("Could not access field " + cipherName, e);
}
} | java | private static int symmetricKeyAlgorithmNameToTag(String cipherName) {
// Use CAST5 if no cipher specified
if (StringUtils.isEmpty(cipherName)) {
return PGPEncryptedData.CAST5;
}
Set<Field> fields = ReflectionUtils.getAllFields(PGPEncryptedData.class, ReflectionUtils.withName(cipherName));
if (fields.isEmpty()) {
throw new RuntimeException("Could not find tag for cipher name " + cipherName);
}
try {
return fields.iterator().next().getInt(null);
} catch (IllegalAccessException e) {
throw new RuntimeException("Could not access field " + cipherName, e);
}
} | [
"private",
"static",
"int",
"symmetricKeyAlgorithmNameToTag",
"(",
"String",
"cipherName",
")",
"{",
"// Use CAST5 if no cipher specified",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"cipherName",
")",
")",
"{",
"return",
"PGPEncryptedData",
".",
"CAST5",
";",
"... | Convert a string cipher name to the integer tag used by GPG
@param cipherName the cipher name
@return integer tag for the cipher | [
"Convert",
"a",
"string",
"cipher",
"name",
"to",
"the",
"integer",
"tag",
"used",
"by",
"GPG"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-crypto/src/main/java/org/apache/gobblin/crypto/GPGFileEncryptor.java#L143-L160 |
datacleaner/DataCleaner | desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java | ComboButton.addButton | public AbstractButton addButton(final String text, final boolean toggleButton) {
"""
Adds a button to the {@link ComboButton}.
@param text
the text of the button
@param toggleButton
whether or not this button should be a toggle button (true) or
a regular button (false)
@return
"""
return addButton(text, (Icon) null, toggleButton);
} | java | public AbstractButton addButton(final String text, final boolean toggleButton) {
return addButton(text, (Icon) null, toggleButton);
} | [
"public",
"AbstractButton",
"addButton",
"(",
"final",
"String",
"text",
",",
"final",
"boolean",
"toggleButton",
")",
"{",
"return",
"addButton",
"(",
"text",
",",
"(",
"Icon",
")",
"null",
",",
"toggleButton",
")",
";",
"}"
] | Adds a button to the {@link ComboButton}.
@param text
the text of the button
@param toggleButton
whether or not this button should be a toggle button (true) or
a regular button (false)
@return | [
"Adds",
"a",
"button",
"to",
"the",
"{",
"@link",
"ComboButton",
"}",
"."
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/api/src/main/java/org/datacleaner/widgets/ComboButton.java#L89-L91 |
jbundle/osgi | obr/src/main/java/org/jbundle/util/osgi/obr/ObrClassFinderService.java | ObrClassFinderService.deployResources | public void deployResources(Resource[] resources, int options) {
"""
Deploy this list of resources.
@param resources
@param options
"""
if (resources != null)
{
for (Resource resource : resources)
{
this.deployResource(resource, options);
}
}
} | java | public void deployResources(Resource[] resources, int options)
{
if (resources != null)
{
for (Resource resource : resources)
{
this.deployResource(resource, options);
}
}
} | [
"public",
"void",
"deployResources",
"(",
"Resource",
"[",
"]",
"resources",
",",
"int",
"options",
")",
"{",
"if",
"(",
"resources",
"!=",
"null",
")",
"{",
"for",
"(",
"Resource",
"resource",
":",
"resources",
")",
"{",
"this",
".",
"deployResource",
"... | Deploy this list of resources.
@param resources
@param options | [
"Deploy",
"this",
"list",
"of",
"resources",
"."
] | train | https://github.com/jbundle/osgi/blob/beb02aef78736a4f799aaac001c8f0327bf0536c/obr/src/main/java/org/jbundle/util/osgi/obr/ObrClassFinderService.java#L248-L257 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java | JdbcCpoXaAdapter.existsObject | @Override
public <T> long existsObject(String name, T obj, Collection<CpoWhere> wheres) throws CpoException {
"""
The CpoAdapter will check to see if this object exists in the datasource.
<p>
<pre>Example:
<code>
<p>
class SomeObject so = new SomeObject();
long count = 0;
class CpoAdapter cpo = null;
<p>
<p>
try {
<p>
cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
} catch (CpoException ce) {
// Handle the error
cpo = null;
}
<p>
if (cpo!=null) {
so.setId(1);
so.setName("SomeName");
try{
CpoWhere where = cpo.newCpoWhere(CpoWhere.LOGIC_NONE, id, CpoWhere.COMP_EQ);
count = cpo.existsObject("SomeExistCheck",so, where);
if (count>0) {
// object exists
} else {
// object does not exist
}
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The String name of the EXISTS Function Group that will be used to create the object in the datasource.
null signifies that the default rules will be used.
@param obj This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. This object will be searched for inside the datasource.
@param wheres A collection of CpoWhere objects that pass in run-time constraints to the function that performs the the
exist
@return The number of objects that exist in the datasource that match the specified object
@throws CpoException Thrown if there are errors accessing the datasource
"""
return getCurrentResource().existsObject( name, obj, wheres);
} | java | @Override
public <T> long existsObject(String name, T obj, Collection<CpoWhere> wheres) throws CpoException {
return getCurrentResource().existsObject( name, obj, wheres);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"long",
"existsObject",
"(",
"String",
"name",
",",
"T",
"obj",
",",
"Collection",
"<",
"CpoWhere",
">",
"wheres",
")",
"throws",
"CpoException",
"{",
"return",
"getCurrentResource",
"(",
")",
".",
"existsObject",
... | The CpoAdapter will check to see if this object exists in the datasource.
<p>
<pre>Example:
<code>
<p>
class SomeObject so = new SomeObject();
long count = 0;
class CpoAdapter cpo = null;
<p>
<p>
try {
<p>
cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
} catch (CpoException ce) {
// Handle the error
cpo = null;
}
<p>
if (cpo!=null) {
so.setId(1);
so.setName("SomeName");
try{
CpoWhere where = cpo.newCpoWhere(CpoWhere.LOGIC_NONE, id, CpoWhere.COMP_EQ);
count = cpo.existsObject("SomeExistCheck",so, where);
if (count>0) {
// object exists
} else {
// object does not exist
}
} catch (CpoException ce) {
// Handle the error
}
}
</code>
</pre>
@param name The String name of the EXISTS Function Group that will be used to create the object in the datasource.
null signifies that the default rules will be used.
@param obj This is an object that has been defined within the metadata of the datasource. If the class is not
defined an exception will be thrown. This object will be searched for inside the datasource.
@param wheres A collection of CpoWhere objects that pass in run-time constraints to the function that performs the the
exist
@return The number of objects that exist in the datasource that match the specified object
@throws CpoException Thrown if there are errors accessing the datasource | [
"The",
"CpoAdapter",
"will",
"check",
"to",
"see",
"if",
"this",
"object",
"exists",
"in",
"the",
"datasource",
".",
"<p",
">",
"<pre",
">",
"Example",
":",
"<code",
">",
"<p",
">",
"class",
"SomeObject",
"so",
"=",
"new",
"SomeObject",
"()",
";",
"lon... | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L961-L964 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/ImportHelpers.java | ImportHelpers.addImport | public static void addImport( Instance instance, String componentOrFacetName, Import imp ) {
"""
Adds an import to an instance (provided this import was not already set).
@param instance the instance whose imports must be updated
@param componentOrFacetName the component or facet name associated with the import
@param imp the import to add
"""
Collection<Import> imports = instance.getImports().get( componentOrFacetName );
if(imports == null) {
imports = new LinkedHashSet<Import> ();
instance.getImports().put( componentOrFacetName, imports );
}
if( ! imports.contains( imp ))
imports.add( imp );
} | java | public static void addImport( Instance instance, String componentOrFacetName, Import imp ) {
Collection<Import> imports = instance.getImports().get( componentOrFacetName );
if(imports == null) {
imports = new LinkedHashSet<Import> ();
instance.getImports().put( componentOrFacetName, imports );
}
if( ! imports.contains( imp ))
imports.add( imp );
} | [
"public",
"static",
"void",
"addImport",
"(",
"Instance",
"instance",
",",
"String",
"componentOrFacetName",
",",
"Import",
"imp",
")",
"{",
"Collection",
"<",
"Import",
">",
"imports",
"=",
"instance",
".",
"getImports",
"(",
")",
".",
"get",
"(",
"componen... | Adds an import to an instance (provided this import was not already set).
@param instance the instance whose imports must be updated
@param componentOrFacetName the component or facet name associated with the import
@param imp the import to add | [
"Adds",
"an",
"import",
"to",
"an",
"instance",
"(",
"provided",
"this",
"import",
"was",
"not",
"already",
"set",
")",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/ImportHelpers.java#L144-L154 |
dwdyer/watchmaker | framework/src/java/main/org/uncommons/util/concurrent/ConfigurableThreadFactory.java | ConfigurableThreadFactory.newThread | public Thread newThread(Runnable runnable) {
"""
Creates a new thread configured according to this factory's parameters.
@param runnable The runnable to be executed by the new thread.
@return The created thread.
"""
Thread thread = new Thread(runnable, nameGenerator.nextID());
thread.setPriority(priority);
thread.setDaemon(daemon);
thread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
return thread;
} | java | public Thread newThread(Runnable runnable)
{
Thread thread = new Thread(runnable, nameGenerator.nextID());
thread.setPriority(priority);
thread.setDaemon(daemon);
thread.setUncaughtExceptionHandler(uncaughtExceptionHandler);
return thread;
} | [
"public",
"Thread",
"newThread",
"(",
"Runnable",
"runnable",
")",
"{",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"runnable",
",",
"nameGenerator",
".",
"nextID",
"(",
")",
")",
";",
"thread",
".",
"setPriority",
"(",
"priority",
")",
";",
"thread",
... | Creates a new thread configured according to this factory's parameters.
@param runnable The runnable to be executed by the new thread.
@return The created thread. | [
"Creates",
"a",
"new",
"thread",
"configured",
"according",
"to",
"this",
"factory",
"s",
"parameters",
"."
] | train | https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/framework/src/java/main/org/uncommons/util/concurrent/ConfigurableThreadFactory.java#L89-L96 |
radkovo/Pdf2Dom | src/main/java/org/fit/pdfdom/PDFDomTree.java | PDFDomTree.writeText | @Override
public void writeText(PDDocument doc, Writer outputStream) throws IOException {
"""
Parses a PDF document and serializes the resulting DOM tree to an output. This requires
a DOM Level 3 capable implementation to be available.
"""
try
{
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
LSSerializer writer = impl.createLSSerializer();
LSOutput output = impl.createLSOutput();
writer.getDomConfig().setParameter("format-pretty-print", true);
output.setCharacterStream(outputStream);
createDOM(doc);
writer.write(getDocument(), output);
} catch (ClassCastException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (ClassNotFoundException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (InstantiationException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (IllegalAccessException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
}
} | java | @Override
public void writeText(PDDocument doc, Writer outputStream) throws IOException
{
try
{
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
DOMImplementationLS impl = (DOMImplementationLS)registry.getDOMImplementation("LS");
LSSerializer writer = impl.createLSSerializer();
LSOutput output = impl.createLSOutput();
writer.getDomConfig().setParameter("format-pretty-print", true);
output.setCharacterStream(outputStream);
createDOM(doc);
writer.write(getDocument(), output);
} catch (ClassCastException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (ClassNotFoundException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (InstantiationException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
} catch (IllegalAccessException e) {
throw new IOException("Error: cannot initialize the DOM serializer", e);
}
} | [
"@",
"Override",
"public",
"void",
"writeText",
"(",
"PDDocument",
"doc",
",",
"Writer",
"outputStream",
")",
"throws",
"IOException",
"{",
"try",
"{",
"DOMImplementationRegistry",
"registry",
"=",
"DOMImplementationRegistry",
".",
"newInstance",
"(",
")",
";",
"D... | Parses a PDF document and serializes the resulting DOM tree to an output. This requires
a DOM Level 3 capable implementation to be available. | [
"Parses",
"a",
"PDF",
"document",
"and",
"serializes",
"the",
"resulting",
"DOM",
"tree",
"to",
"an",
"output",
".",
"This",
"requires",
"a",
"DOM",
"Level",
"3",
"capable",
"implementation",
"to",
"be",
"available",
"."
] | train | https://github.com/radkovo/Pdf2Dom/blob/12e52b80eca7f57fc41e6ed895bf1db72c38da53/src/main/java/org/fit/pdfdom/PDFDomTree.java#L183-L205 |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/BasicCacheEntry.java | BasicCacheEntry.checkFixity | @Override
public Collection<URI> checkFixity(final Collection<String> algorithms) throws UnsupportedAlgorithmException {
"""
Calculate fixity with list of digest algorithms of a CacheEntry by piping it through
a simple fixity-calculating InputStream
@param algorithms the digest algorithms to be used
@return the checksums for the digest algorithms
@throws UnsupportedAlgorithmException exception
"""
try (InputStream binaryStream = this.getInputStream()) {
final Map<String, DigestInputStream> digestInputStreams = new HashMap<>();
InputStream digestStream = binaryStream;
for (String digestAlg : algorithms) {
try {
digestStream = new DigestInputStream(digestStream, MessageDigest.getInstance(digestAlg));
digestInputStreams.put(digestAlg, (DigestInputStream)digestStream);
} catch (NoSuchAlgorithmException e) {
throw new UnsupportedAlgorithmException("Unsupported digest algorithm: " + digestAlg);
}
}
// calculate the digest by consuming the stream
while (digestStream.read(devNull) != -1) { }
return digestInputStreams.entrySet().stream()
.map(entry -> ContentDigest.asURI(entry.getKey(), entry.getValue().getMessageDigest().digest()))
.collect(Collectors.toSet());
} catch (final IOException e) {
LOGGER.debug("Got error closing input stream: {}", e);
throw new RepositoryRuntimeException(e);
}
} | java | @Override
public Collection<URI> checkFixity(final Collection<String> algorithms) throws UnsupportedAlgorithmException {
try (InputStream binaryStream = this.getInputStream()) {
final Map<String, DigestInputStream> digestInputStreams = new HashMap<>();
InputStream digestStream = binaryStream;
for (String digestAlg : algorithms) {
try {
digestStream = new DigestInputStream(digestStream, MessageDigest.getInstance(digestAlg));
digestInputStreams.put(digestAlg, (DigestInputStream)digestStream);
} catch (NoSuchAlgorithmException e) {
throw new UnsupportedAlgorithmException("Unsupported digest algorithm: " + digestAlg);
}
}
// calculate the digest by consuming the stream
while (digestStream.read(devNull) != -1) { }
return digestInputStreams.entrySet().stream()
.map(entry -> ContentDigest.asURI(entry.getKey(), entry.getValue().getMessageDigest().digest()))
.collect(Collectors.toSet());
} catch (final IOException e) {
LOGGER.debug("Got error closing input stream: {}", e);
throw new RepositoryRuntimeException(e);
}
} | [
"@",
"Override",
"public",
"Collection",
"<",
"URI",
">",
"checkFixity",
"(",
"final",
"Collection",
"<",
"String",
">",
"algorithms",
")",
"throws",
"UnsupportedAlgorithmException",
"{",
"try",
"(",
"InputStream",
"binaryStream",
"=",
"this",
".",
"getInputStream... | Calculate fixity with list of digest algorithms of a CacheEntry by piping it through
a simple fixity-calculating InputStream
@param algorithms the digest algorithms to be used
@return the checksums for the digest algorithms
@throws UnsupportedAlgorithmException exception | [
"Calculate",
"fixity",
"with",
"list",
"of",
"digest",
"algorithms",
"of",
"a",
"CacheEntry",
"by",
"piping",
"it",
"through",
"a",
"simple",
"fixity",
"-",
"calculating",
"InputStream"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/BasicCacheEntry.java#L98-L125 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/EditManager.java | EditManager.removeEditDirective | public static void removeEditDirective(String elementId, String attributeName, IPerson person) {
"""
Searches for a dlm:edit command which indicates that a node attribute was reset to the value
in the fragment and if found removes it from the user's PLF.
"""
removeDirective(elementId, attributeName, Constants.ELM_EDIT, person);
} | java | public static void removeEditDirective(String elementId, String attributeName, IPerson person) {
removeDirective(elementId, attributeName, Constants.ELM_EDIT, person);
} | [
"public",
"static",
"void",
"removeEditDirective",
"(",
"String",
"elementId",
",",
"String",
"attributeName",
",",
"IPerson",
"person",
")",
"{",
"removeDirective",
"(",
"elementId",
",",
"attributeName",
",",
"Constants",
".",
"ELM_EDIT",
",",
"person",
")",
"... | Searches for a dlm:edit command which indicates that a node attribute was reset to the value
in the fragment and if found removes it from the user's PLF. | [
"Searches",
"for",
"a",
"dlm",
":",
"edit",
"command",
"which",
"indicates",
"that",
"a",
"node",
"attribute",
"was",
"reset",
"to",
"the",
"value",
"in",
"the",
"fragment",
"and",
"if",
"found",
"removes",
"it",
"from",
"the",
"user",
"s",
"PLF",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/EditManager.java#L227-L229 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/RestClient.java | RestClient.createService | private void createService(@NonNull OkHttpClient client, String baseUrl) {
"""
Create Retrofit service for Comapi Network REST APIs.
@param client REST service.
"""
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create(createGson()))
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.client(client)
.build();
service = retrofit.create(RestApi.class);
} | java | private void createService(@NonNull OkHttpClient client, String baseUrl) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(GsonConverterFactory.create(createGson()))
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.client(client)
.build();
service = retrofit.create(RestApi.class);
} | [
"private",
"void",
"createService",
"(",
"@",
"NonNull",
"OkHttpClient",
"client",
",",
"String",
"baseUrl",
")",
"{",
"Retrofit",
"retrofit",
"=",
"new",
"Retrofit",
".",
"Builder",
"(",
")",
".",
"baseUrl",
"(",
"baseUrl",
")",
".",
"addConverterFactory",
... | Create Retrofit service for Comapi Network REST APIs.
@param client REST service. | [
"Create",
"Retrofit",
"service",
"for",
"Comapi",
"Network",
"REST",
"APIs",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/RestClient.java#L137-L147 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java | AptControlInterface.getExternalClassLoader | public ClassLoader getExternalClassLoader() {
"""
Returns a classloader that can be used to load external classes
"""
Map<String,String> opts = _ap.getAnnotationProcessorEnvironment().getOptions();
String classpath = opts.get("-classpath");
if ( classpath != null )
{
String [] cpEntries = classpath.split( File.pathSeparator );
ArrayList a = new ArrayList();
for ( String e : cpEntries )
{
try
{
File f = (new File(e)).getCanonicalFile();
URL u = f.toURL();
a.add(u);
}
catch (Exception ex)
{
System.err.println( "getExternalClassLoader(): bad cp entry=" + e );
System.err.println( "Exception processing e=" + ex );
}
}
URL [] urls = new URL[a.size()];
urls = (URL[]) a.toArray(urls);
return new URLClassLoader( urls, ControlChecker.class.getClassLoader() );
}
return null;
} | java | public ClassLoader getExternalClassLoader()
{
Map<String,String> opts = _ap.getAnnotationProcessorEnvironment().getOptions();
String classpath = opts.get("-classpath");
if ( classpath != null )
{
String [] cpEntries = classpath.split( File.pathSeparator );
ArrayList a = new ArrayList();
for ( String e : cpEntries )
{
try
{
File f = (new File(e)).getCanonicalFile();
URL u = f.toURL();
a.add(u);
}
catch (Exception ex)
{
System.err.println( "getExternalClassLoader(): bad cp entry=" + e );
System.err.println( "Exception processing e=" + ex );
}
}
URL [] urls = new URL[a.size()];
urls = (URL[]) a.toArray(urls);
return new URLClassLoader( urls, ControlChecker.class.getClassLoader() );
}
return null;
} | [
"public",
"ClassLoader",
"getExternalClassLoader",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"opts",
"=",
"_ap",
".",
"getAnnotationProcessorEnvironment",
"(",
")",
".",
"getOptions",
"(",
")",
";",
"String",
"classpath",
"=",
"opts",
".",
"ge... | Returns a classloader that can be used to load external classes | [
"Returns",
"a",
"classloader",
"that",
"can",
"be",
"used",
"to",
"load",
"external",
"classes"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlInterface.java#L705-L735 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.enterOfflinePayment | @Deprecated
public Transaction enterOfflinePayment(final Integer invoiceId, final Transaction payment) {
"""
Enter an offline payment for a manual invoice (beta) - Recurly Enterprise Feature
@deprecated Prefer using Invoice#getId() as the id param (which is a String)
@param invoiceId Recurly Invoice ID
@param payment The external payment
"""
return enterOfflinePayment(invoiceId.toString(), payment);
} | java | @Deprecated
public Transaction enterOfflinePayment(final Integer invoiceId, final Transaction payment) {
return enterOfflinePayment(invoiceId.toString(), payment);
} | [
"@",
"Deprecated",
"public",
"Transaction",
"enterOfflinePayment",
"(",
"final",
"Integer",
"invoiceId",
",",
"final",
"Transaction",
"payment",
")",
"{",
"return",
"enterOfflinePayment",
"(",
"invoiceId",
".",
"toString",
"(",
")",
",",
"payment",
")",
";",
"}"... | Enter an offline payment for a manual invoice (beta) - Recurly Enterprise Feature
@deprecated Prefer using Invoice#getId() as the id param (which is a String)
@param invoiceId Recurly Invoice ID
@param payment The external payment | [
"Enter",
"an",
"offline",
"payment",
"for",
"a",
"manual",
"invoice",
"(",
"beta",
")",
"-",
"Recurly",
"Enterprise",
"Feature"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1331-L1334 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/cache/CacheManager.java | CacheManager.processCacheAnnotations | public long processCacheAnnotations(Method nonProxiedMethod, List<String> parameters) {
"""
Process annotations JsCacheResult, JsCacheRemove and JsCacheRemoves
@param nonProxiedMethod
@param parameters
@return
"""
if (isJsCached(nonProxiedMethod)) {
return jsCacheAnnotationServices.getJsCacheResultDeadline(nonProxiedMethod.getAnnotation(JsCacheResult.class));
}
return 0L;
} | java | public long processCacheAnnotations(Method nonProxiedMethod, List<String> parameters) {
if (isJsCached(nonProxiedMethod)) {
return jsCacheAnnotationServices.getJsCacheResultDeadline(nonProxiedMethod.getAnnotation(JsCacheResult.class));
}
return 0L;
} | [
"public",
"long",
"processCacheAnnotations",
"(",
"Method",
"nonProxiedMethod",
",",
"List",
"<",
"String",
">",
"parameters",
")",
"{",
"if",
"(",
"isJsCached",
"(",
"nonProxiedMethod",
")",
")",
"{",
"return",
"jsCacheAnnotationServices",
".",
"getJsCacheResultDea... | Process annotations JsCacheResult, JsCacheRemove and JsCacheRemoves
@param nonProxiedMethod
@param parameters
@return | [
"Process",
"annotations",
"JsCacheResult",
"JsCacheRemove",
"and",
"JsCacheRemoves"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/cache/CacheManager.java#L33-L38 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserHandlerImpl.java | UserHandlerImpl.writeUser | private void writeUser(User user, Node node) throws Exception {
"""
Write user properties from the node to the storage.
@param node
the node where user properties are stored
@return {@link User}
"""
node.setProperty(UserProperties.JOS_EMAIL, user.getEmail());
node.setProperty(UserProperties.JOS_FIRST_NAME, user.getFirstName());
node.setProperty(UserProperties.JOS_LAST_NAME, user.getLastName());
node.setProperty(UserProperties.JOS_PASSWORD, user.getPassword());
node.setProperty(UserProperties.JOS_DISPLAY_NAME, user.getDisplayName());
node.setProperty(UserProperties.JOS_USER_NAME, node.getName());
Calendar calendar = Calendar.getInstance();
calendar.setTime(user.getCreatedDate());
node.setProperty(UserProperties.JOS_CREATED_DATE, calendar);
} | java | private void writeUser(User user, Node node) throws Exception
{
node.setProperty(UserProperties.JOS_EMAIL, user.getEmail());
node.setProperty(UserProperties.JOS_FIRST_NAME, user.getFirstName());
node.setProperty(UserProperties.JOS_LAST_NAME, user.getLastName());
node.setProperty(UserProperties.JOS_PASSWORD, user.getPassword());
node.setProperty(UserProperties.JOS_DISPLAY_NAME, user.getDisplayName());
node.setProperty(UserProperties.JOS_USER_NAME, node.getName());
Calendar calendar = Calendar.getInstance();
calendar.setTime(user.getCreatedDate());
node.setProperty(UserProperties.JOS_CREATED_DATE, calendar);
} | [
"private",
"void",
"writeUser",
"(",
"User",
"user",
",",
"Node",
"node",
")",
"throws",
"Exception",
"{",
"node",
".",
"setProperty",
"(",
"UserProperties",
".",
"JOS_EMAIL",
",",
"user",
".",
"getEmail",
"(",
")",
")",
";",
"node",
".",
"setProperty",
... | Write user properties from the node to the storage.
@param node
the node where user properties are stored
@return {@link User} | [
"Write",
"user",
"properties",
"from",
"the",
"node",
"to",
"the",
"storage",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserHandlerImpl.java#L605-L617 |
Alexey1Gavrilov/ExpectIt | expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java | Matchers.allOf | public static Matcher<MultiResult> allOf(final Matcher<?>... matchers) {
"""
Creates a matcher that matches if the examined input matches <b>all</b> of the specified
matchers. This method
evaluates all the matchers regardless intermediate results.
<p/>
The match result represents a combination of all match operations. If succeeded,
the match result with the
greatest end position is selected to implement the result {@link Result} instance returned
by this method.
If the result is negative, then the one which fails first is returned.
<p/>
If several matchers the have same end position, then the result from the one with the
smaller argument index is
returned.
@param matchers the vararg array of the matchers
@return the multi match result
"""
checkNotEmpty(matchers);
return new MultiMatcher(true, matchers);
} | java | public static Matcher<MultiResult> allOf(final Matcher<?>... matchers) {
checkNotEmpty(matchers);
return new MultiMatcher(true, matchers);
} | [
"public",
"static",
"Matcher",
"<",
"MultiResult",
">",
"allOf",
"(",
"final",
"Matcher",
"<",
"?",
">",
"...",
"matchers",
")",
"{",
"checkNotEmpty",
"(",
"matchers",
")",
";",
"return",
"new",
"MultiMatcher",
"(",
"true",
",",
"matchers",
")",
";",
"}"... | Creates a matcher that matches if the examined input matches <b>all</b> of the specified
matchers. This method
evaluates all the matchers regardless intermediate results.
<p/>
The match result represents a combination of all match operations. If succeeded,
the match result with the
greatest end position is selected to implement the result {@link Result} instance returned
by this method.
If the result is negative, then the one which fails first is returned.
<p/>
If several matchers the have same end position, then the result from the one with the
smaller argument index is
returned.
@param matchers the vararg array of the matchers
@return the multi match result | [
"Creates",
"a",
"matcher",
"that",
"matches",
"if",
"the",
"examined",
"input",
"matches",
"<b",
">",
"all<",
"/",
"b",
">",
"of",
"the",
"specified",
"matchers",
".",
"This",
"method",
"evaluates",
"all",
"the",
"matchers",
"regardless",
"intermediate",
"re... | train | https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/matcher/Matchers.java#L171-L174 |
fcrepo4/fcrepo4 | fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java | ViewHelpers.getNumChildren | public int getNumChildren(final Graph graph, final Node subject) {
"""
Get the number of child resources associated with the arg 'subject' as specified by the triple found in the arg
'graph' with the predicate RdfLexicon.HAS_CHILD_COUNT.
@param graph of triples
@param subject for which child resources is sought
@return number of child resources
"""
LOGGER.trace("Getting number of children: s:{}, g:{}", subject, graph);
return (int) asStream(listObjects(graph, subject, CONTAINS.asNode())).count();
} | java | public int getNumChildren(final Graph graph, final Node subject) {
LOGGER.trace("Getting number of children: s:{}, g:{}", subject, graph);
return (int) asStream(listObjects(graph, subject, CONTAINS.asNode())).count();
} | [
"public",
"int",
"getNumChildren",
"(",
"final",
"Graph",
"graph",
",",
"final",
"Node",
"subject",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Getting number of children: s:{}, g:{}\"",
",",
"subject",
",",
"graph",
")",
";",
"return",
"(",
"int",
")",
"asStrea... | Get the number of child resources associated with the arg 'subject' as specified by the triple found in the arg
'graph' with the predicate RdfLexicon.HAS_CHILD_COUNT.
@param graph of triples
@param subject for which child resources is sought
@return number of child resources | [
"Get",
"the",
"number",
"of",
"child",
"resources",
"associated",
"with",
"the",
"arg",
"subject",
"as",
"specified",
"by",
"the",
"triple",
"found",
"in",
"the",
"arg",
"graph",
"with",
"the",
"predicate",
"RdfLexicon",
".",
"HAS_CHILD_COUNT",
"."
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L282-L285 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java | CommonOps_DDF5.addEquals | public static void addEquals( DMatrix5x5 a , DMatrix5x5 b ) {
"""
<p>Performs the following operation:<br>
<br>
a = a + b <br>
a<sub>ij</sub> = a<sub>ij</sub> + b<sub>ij</sub> <br>
</p>
@param a A Matrix. Modified.
@param b A Matrix. Not modified.
"""
a.a11 += b.a11;
a.a12 += b.a12;
a.a13 += b.a13;
a.a14 += b.a14;
a.a15 += b.a15;
a.a21 += b.a21;
a.a22 += b.a22;
a.a23 += b.a23;
a.a24 += b.a24;
a.a25 += b.a25;
a.a31 += b.a31;
a.a32 += b.a32;
a.a33 += b.a33;
a.a34 += b.a34;
a.a35 += b.a35;
a.a41 += b.a41;
a.a42 += b.a42;
a.a43 += b.a43;
a.a44 += b.a44;
a.a45 += b.a45;
a.a51 += b.a51;
a.a52 += b.a52;
a.a53 += b.a53;
a.a54 += b.a54;
a.a55 += b.a55;
} | java | public static void addEquals( DMatrix5x5 a , DMatrix5x5 b ) {
a.a11 += b.a11;
a.a12 += b.a12;
a.a13 += b.a13;
a.a14 += b.a14;
a.a15 += b.a15;
a.a21 += b.a21;
a.a22 += b.a22;
a.a23 += b.a23;
a.a24 += b.a24;
a.a25 += b.a25;
a.a31 += b.a31;
a.a32 += b.a32;
a.a33 += b.a33;
a.a34 += b.a34;
a.a35 += b.a35;
a.a41 += b.a41;
a.a42 += b.a42;
a.a43 += b.a43;
a.a44 += b.a44;
a.a45 += b.a45;
a.a51 += b.a51;
a.a52 += b.a52;
a.a53 += b.a53;
a.a54 += b.a54;
a.a55 += b.a55;
} | [
"public",
"static",
"void",
"addEquals",
"(",
"DMatrix5x5",
"a",
",",
"DMatrix5x5",
"b",
")",
"{",
"a",
".",
"a11",
"+=",
"b",
".",
"a11",
";",
"a",
".",
"a12",
"+=",
"b",
".",
"a12",
";",
"a",
".",
"a13",
"+=",
"b",
".",
"a13",
";",
"a",
"."... | <p>Performs the following operation:<br>
<br>
a = a + b <br>
a<sub>ij</sub> = a<sub>ij</sub> + b<sub>ij</sub> <br>
</p>
@param a A Matrix. Modified.
@param b A Matrix. Not modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"a",
"=",
"a",
"+",
"b",
"<br",
">",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"+",
"b<sub",
">",
"ij<",
"/",
"sub",
"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java#L108-L134 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java | LoaderUtil.newCheckedInstanceOfProperty | public static <T> T newCheckedInstanceOfProperty(final String propertyName, final Class<T> clazz)
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException,
IllegalAccessException {
"""
Loads and instantiates a class given by a property name.
@param propertyName The property name to look up a class name for.
@param clazz The class to cast it to.
@param <T> The type to cast it to.
@return new instance of the class given in the property or {@code null} if the property was unset.
@throws ClassNotFoundException if the class isn't available to the usual ClassLoaders
@throws IllegalAccessException if the class can't be instantiated through a public constructor
@throws InstantiationException if there was an exception whilst instantiating the class
@throws NoSuchMethodException if there isn't a no-args constructor on the class
@throws InvocationTargetException if there was an exception whilst constructing the class
@throws ClassCastException if the constructed object isn't type compatible with {@code T}
@since 2.5
"""
final String className = PropertiesUtil.getProperties().getStringProperty(propertyName);
if (className == null) {
return null;
}
return newCheckedInstanceOf(className, clazz);
} | java | public static <T> T newCheckedInstanceOfProperty(final String propertyName, final Class<T> clazz)
throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException,
IllegalAccessException {
final String className = PropertiesUtil.getProperties().getStringProperty(propertyName);
if (className == null) {
return null;
}
return newCheckedInstanceOf(className, clazz);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newCheckedInstanceOfProperty",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"ClassNotFoundException",
",",
"NoSuchMethodException",
",",
"InvocationTargetException",
",... | Loads and instantiates a class given by a property name.
@param propertyName The property name to look up a class name for.
@param clazz The class to cast it to.
@param <T> The type to cast it to.
@return new instance of the class given in the property or {@code null} if the property was unset.
@throws ClassNotFoundException if the class isn't available to the usual ClassLoaders
@throws IllegalAccessException if the class can't be instantiated through a public constructor
@throws InstantiationException if there was an exception whilst instantiating the class
@throws NoSuchMethodException if there isn't a no-args constructor on the class
@throws InvocationTargetException if there was an exception whilst constructing the class
@throws ClassCastException if the constructed object isn't type compatible with {@code T}
@since 2.5 | [
"Loads",
"and",
"instantiates",
"a",
"class",
"given",
"by",
"a",
"property",
"name",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/LoaderUtil.java#L219-L227 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java | MapApi.getOptional | public static <T> Optional<Optional<T>> getOptional(final Map map, final Class<T> clazz, final Object... path) {
"""
Get optional value by path.
@param <T> optional value type
@param clazz type of value
@param map subject
@param path nodes to walk in map
@return value
"""
return get(map, Optional.class, path).map(opt -> (Optional<T>) opt);
} | java | public static <T> Optional<Optional<T>> getOptional(final Map map, final Class<T> clazz, final Object... path) {
return get(map, Optional.class, path).map(opt -> (Optional<T>) opt);
} | [
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"Optional",
"<",
"T",
">",
">",
"getOptional",
"(",
"final",
"Map",
"map",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Object",
"...",
"path",
")",
"{",
"return",
"get",
"(",
"ma... | Get optional value by path.
@param <T> optional value type
@param clazz type of value
@param map subject
@param path nodes to walk in map
@return value | [
"Get",
"optional",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java#L271-L273 |
pravega/pravega | controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java | TransactionMetrics.reportOpenTransactions | public static void reportOpenTransactions(String scope, String streamName, int ongoingTransactions) {
"""
This method reports the current number of open Transactions for a Stream.
@param scope Scope.
@param streamName Name of the Stream.
@param ongoingTransactions Number of open Transactions in the Stream.
"""
DYNAMIC_LOGGER.reportGaugeValue(OPEN_TRANSACTIONS, ongoingTransactions, streamTags(scope, streamName));
} | java | public static void reportOpenTransactions(String scope, String streamName, int ongoingTransactions) {
DYNAMIC_LOGGER.reportGaugeValue(OPEN_TRANSACTIONS, ongoingTransactions, streamTags(scope, streamName));
} | [
"public",
"static",
"void",
"reportOpenTransactions",
"(",
"String",
"scope",
",",
"String",
"streamName",
",",
"int",
"ongoingTransactions",
")",
"{",
"DYNAMIC_LOGGER",
".",
"reportGaugeValue",
"(",
"OPEN_TRANSACTIONS",
",",
"ongoingTransactions",
",",
"streamTags",
... | This method reports the current number of open Transactions for a Stream.
@param scope Scope.
@param streamName Name of the Stream.
@param ongoingTransactions Number of open Transactions in the Stream. | [
"This",
"method",
"reports",
"the",
"current",
"number",
"of",
"open",
"Transactions",
"for",
"a",
"Stream",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/metrics/TransactionMetrics.java#L124-L126 |
jboss/jboss-saaj-api_spec | src/main/java/javax/xml/soap/MimeHeaders.java | MimeHeaders.addHeader | public void addHeader(String name, String value) {
"""
Adds a <code>MimeHeader</code> object with the specified name and value
to this <code>MimeHeaders</code> object's list of headers.
<P>
Note that RFC822 headers can contain only US-ASCII characters.
@param name a <code>String</code> with the name of the header to
be added
@param value a <code>String</code> with the value of the header to
be added
@exception IllegalArgumentException if there was a problem in the
mime header name or value being added
"""
if ((name == null) || name.equals(""))
throw new IllegalArgumentException("Illegal MimeHeader name");
int pos = headers.size();
for(int i = pos - 1 ; i >= 0; i--) {
MimeHeader hdr = (MimeHeader) headers.elementAt(i);
if (hdr.getName().equalsIgnoreCase(name)) {
headers.insertElementAt(new MimeHeader(name, value),
i+1);
return;
}
}
headers.addElement(new MimeHeader(name, value));
} | java | public void addHeader(String name, String value)
{
if ((name == null) || name.equals(""))
throw new IllegalArgumentException("Illegal MimeHeader name");
int pos = headers.size();
for(int i = pos - 1 ; i >= 0; i--) {
MimeHeader hdr = (MimeHeader) headers.elementAt(i);
if (hdr.getName().equalsIgnoreCase(name)) {
headers.insertElementAt(new MimeHeader(name, value),
i+1);
return;
}
}
headers.addElement(new MimeHeader(name, value));
} | [
"public",
"void",
"addHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"(",
"name",
"==",
"null",
")",
"||",
"name",
".",
"equals",
"(",
"\"\"",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal MimeHeader na... | Adds a <code>MimeHeader</code> object with the specified name and value
to this <code>MimeHeaders</code> object's list of headers.
<P>
Note that RFC822 headers can contain only US-ASCII characters.
@param name a <code>String</code> with the name of the header to
be added
@param value a <code>String</code> with the value of the header to
be added
@exception IllegalArgumentException if there was a problem in the
mime header name or value being added | [
"Adds",
"a",
"<code",
">",
"MimeHeader<",
"/",
"code",
">",
"object",
"with",
"the",
"specified",
"name",
"and",
"value",
"to",
"this",
"<code",
">",
"MimeHeaders<",
"/",
"code",
">",
"object",
"s",
"list",
"of",
"headers",
".",
"<P",
">",
"Note",
"tha... | train | https://github.com/jboss/jboss-saaj-api_spec/blob/2dda4e662e4f99b289f3a8d944a68cf537c78dd4/src/main/java/javax/xml/soap/MimeHeaders.java#L137-L153 |
GerdHolz/TOVAL | src/de/invation/code/toval/types/HashList.java | HashList.set | @Override
public E set(int index, E element) {
"""
Replaces the element at the specified position in this list with
the specified element.
@param index index of element to replace.
@param element element to be stored at the specified position.
@return the element previously at the specified position.
@throws IndexOutOfBoundsException if index out of range
<tt>(index < 0 || index >= size())</tt>.
"""
if(element!=null && !contains(element)){
return super.set(index, element);
}
return get(index);
} | java | @Override
public E set(int index, E element) {
if(element!=null && !contains(element)){
return super.set(index, element);
}
return get(index);
} | [
"@",
"Override",
"public",
"E",
"set",
"(",
"int",
"index",
",",
"E",
"element",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
"&&",
"!",
"contains",
"(",
"element",
")",
")",
"{",
"return",
"super",
".",
"set",
"(",
"index",
",",
"element",
")",
... | Replaces the element at the specified position in this list with
the specified element.
@param index index of element to replace.
@param element element to be stored at the specified position.
@return the element previously at the specified position.
@throws IndexOutOfBoundsException if index out of range
<tt>(index < 0 || index >= size())</tt>. | [
"Replaces",
"the",
"element",
"at",
"the",
"specified",
"position",
"in",
"this",
"list",
"with",
"the",
"specified",
"element",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/HashList.java#L35-L41 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/ImageUtils.java | ImageUtils.writeImage | public static void writeImage(final BufferedImage im, final String formatName, final File output)
throws IOException {
"""
Equivalent to {@link ImageIO#write}, but handle errors.
@param im a <code>RenderedImage</code> to be written.
@param formatName a <code>String</code> containing the informal name of the format.
@param output a <code>File</code> to be written to.
@throws IOException if an error occurs during writing.
"""
if (!ImageIO.write(im, formatName, output)) {
throw new RuntimeException("Image format not supported: " + formatName);
}
} | java | public static void writeImage(final BufferedImage im, final String formatName, final File output)
throws IOException {
if (!ImageIO.write(im, formatName, output)) {
throw new RuntimeException("Image format not supported: " + formatName);
}
} | [
"public",
"static",
"void",
"writeImage",
"(",
"final",
"BufferedImage",
"im",
",",
"final",
"String",
"formatName",
",",
"final",
"File",
"output",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"ImageIO",
".",
"write",
"(",
"im",
",",
"formatName",
"... | Equivalent to {@link ImageIO#write}, but handle errors.
@param im a <code>RenderedImage</code> to be written.
@param formatName a <code>String</code> containing the informal name of the format.
@param output a <code>File</code> to be written to.
@throws IOException if an error occurs during writing. | [
"Equivalent",
"to",
"{",
"@link",
"ImageIO#write",
"}",
"but",
"handle",
"errors",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/ImageUtils.java#L25-L30 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.resolveNameAndTypeIndex | int resolveNameAndTypeIndex(String name, String descriptor) {
"""
Returns the constant map index to name and type
If entry doesn't exist it is created.
@param name
@param descriptor
@return
"""
int size = 0;
int index = 0;
constantReadLock.lock();
try
{
size = getConstantPoolSize();
index = getNameAndTypeIndex(name, descriptor);
}
finally
{
constantReadLock.unlock();
}
if (index != -1)
{
return index;
}
else
{
int nameIndex = resolveNameIndex(name);
int typeIndex = resolveNameIndex(descriptor);
return addConstantInfo(new NameAndType(nameIndex, typeIndex), size);
}
} | java | int resolveNameAndTypeIndex(String name, String descriptor)
{
int size = 0;
int index = 0;
constantReadLock.lock();
try
{
size = getConstantPoolSize();
index = getNameAndTypeIndex(name, descriptor);
}
finally
{
constantReadLock.unlock();
}
if (index != -1)
{
return index;
}
else
{
int nameIndex = resolveNameIndex(name);
int typeIndex = resolveNameIndex(descriptor);
return addConstantInfo(new NameAndType(nameIndex, typeIndex), size);
}
} | [
"int",
"resolveNameAndTypeIndex",
"(",
"String",
"name",
",",
"String",
"descriptor",
")",
"{",
"int",
"size",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"constantReadLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"size",
"=",
"getConstantPoolSize",
"... | Returns the constant map index to name and type
If entry doesn't exist it is created.
@param name
@param descriptor
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"name",
"and",
"type",
"If",
"entry",
"doesn",
"t",
"exist",
"it",
"is",
"created",
"."
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L322-L346 |
fernandospr/javapns-jdk16 | src/main/java/javapns/notification/Payload.java | Payload.isEstimatedPayloadSizeAllowedAfterAdding | public boolean isEstimatedPayloadSizeAllowedAfterAdding(String propertyName, Object propertyValue) {
"""
Validate if the estimated payload size after adding a given property will be allowed.
For performance reasons, this estimate is not as reliable as actually adding
the property and checking the payload size afterwards.
@param propertyName the name of the property to use for calculating the estimation
@param propertyValue the value of the property to use for calculating the estimation
@return true if the payload size is not expected to exceed the maximum allowed, false if it might be too big
"""
int maximumPayloadSize = getMaximumPayloadSize();
int estimatedPayloadSize = estimatePayloadSizeAfterAdding(propertyName, propertyValue);
boolean estimatedToBeAllowed = estimatedPayloadSize <= maximumPayloadSize;
return estimatedToBeAllowed;
} | java | public boolean isEstimatedPayloadSizeAllowedAfterAdding(String propertyName, Object propertyValue) {
int maximumPayloadSize = getMaximumPayloadSize();
int estimatedPayloadSize = estimatePayloadSizeAfterAdding(propertyName, propertyValue);
boolean estimatedToBeAllowed = estimatedPayloadSize <= maximumPayloadSize;
return estimatedToBeAllowed;
} | [
"public",
"boolean",
"isEstimatedPayloadSizeAllowedAfterAdding",
"(",
"String",
"propertyName",
",",
"Object",
"propertyValue",
")",
"{",
"int",
"maximumPayloadSize",
"=",
"getMaximumPayloadSize",
"(",
")",
";",
"int",
"estimatedPayloadSize",
"=",
"estimatePayloadSizeAfterA... | Validate if the estimated payload size after adding a given property will be allowed.
For performance reasons, this estimate is not as reliable as actually adding
the property and checking the payload size afterwards.
@param propertyName the name of the property to use for calculating the estimation
@param propertyValue the value of the property to use for calculating the estimation
@return true if the payload size is not expected to exceed the maximum allowed, false if it might be too big | [
"Validate",
"if",
"the",
"estimated",
"payload",
"size",
"after",
"adding",
"a",
"given",
"property",
"will",
"be",
"allowed",
".",
"For",
"performance",
"reasons",
"this",
"estimate",
"is",
"not",
"as",
"reliable",
"as",
"actually",
"adding",
"the",
"property... | train | https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/notification/Payload.java#L234-L239 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/Session.java | Session.executeCompiledStatement | private Result executeCompiledStatement(Result cmd) {
"""
Retrieves the result of executing the prepared statement whose csid
and parameter values/types are encapsulated by the cmd argument.
@return the result of executing the statement
"""
Statement cs = cmd.getStatement();
if (!cs.isValid()) {
long csid = cmd.getStatementID();
cs = database.compiledStatementManager.getStatement(this, csid);
if (cs == null) {
// invalid sql has been removed already
return Result.newErrorResult(Error.error(ErrorCode.X_07502));
}
}
Object[] pvals = cmd.getParameterData();
return executeCompiledStatement(cs, pvals);
} | java | private Result executeCompiledStatement(Result cmd) {
Statement cs = cmd.getStatement();
if (!cs.isValid()) {
long csid = cmd.getStatementID();
cs = database.compiledStatementManager.getStatement(this, csid);
if (cs == null) {
// invalid sql has been removed already
return Result.newErrorResult(Error.error(ErrorCode.X_07502));
}
}
Object[] pvals = cmd.getParameterData();
return executeCompiledStatement(cs, pvals);
} | [
"private",
"Result",
"executeCompiledStatement",
"(",
"Result",
"cmd",
")",
"{",
"Statement",
"cs",
"=",
"cmd",
".",
"getStatement",
"(",
")",
";",
"if",
"(",
"!",
"cs",
".",
"isValid",
"(",
")",
")",
"{",
"long",
"csid",
"=",
"cmd",
".",
"getStatement... | Retrieves the result of executing the prepared statement whose csid
and parameter values/types are encapsulated by the cmd argument.
@return the result of executing the statement | [
"Retrieves",
"the",
"result",
"of",
"executing",
"the",
"prepared",
"statement",
"whose",
"csid",
"and",
"parameter",
"values",
"/",
"types",
"are",
"encapsulated",
"by",
"the",
"cmd",
"argument",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Session.java#L1392-L1411 |
xerial/larray | larray-buffer/src/main/java/xerial/larray/buffer/UnsafeUtil.java | UnsafeUtil.newDirectByteBuffer | public static ByteBuffer newDirectByteBuffer(long addr, int size, Object att) {
"""
Create a new DirectByteBuffer from a given address and size.
The returned DirectByteBuffer does not release the memory by itself.
@param addr
@param size
@param att object holding the underlying memory to attach to the buffer.
This will prevent the garbage collection of the memory area that's
associated with the new <code>DirectByteBuffer</code>
@return
"""
dbbCC.setAccessible(true);
Object b = null;
try {
b = dbbCC.newInstance(new Long(addr), new Integer(size), att);
return ByteBuffer.class.cast(b);
}
catch(Exception e) {
throw new IllegalStateException(String.format("Failed to create DirectByteBuffer: %s", e.getMessage()));
}
} | java | public static ByteBuffer newDirectByteBuffer(long addr, int size, Object att) {
dbbCC.setAccessible(true);
Object b = null;
try {
b = dbbCC.newInstance(new Long(addr), new Integer(size), att);
return ByteBuffer.class.cast(b);
}
catch(Exception e) {
throw new IllegalStateException(String.format("Failed to create DirectByteBuffer: %s", e.getMessage()));
}
} | [
"public",
"static",
"ByteBuffer",
"newDirectByteBuffer",
"(",
"long",
"addr",
",",
"int",
"size",
",",
"Object",
"att",
")",
"{",
"dbbCC",
".",
"setAccessible",
"(",
"true",
")",
";",
"Object",
"b",
"=",
"null",
";",
"try",
"{",
"b",
"=",
"dbbCC",
".",... | Create a new DirectByteBuffer from a given address and size.
The returned DirectByteBuffer does not release the memory by itself.
@param addr
@param size
@param att object holding the underlying memory to attach to the buffer.
This will prevent the garbage collection of the memory area that's
associated with the new <code>DirectByteBuffer</code>
@return | [
"Create",
"a",
"new",
"DirectByteBuffer",
"from",
"a",
"given",
"address",
"and",
"size",
".",
"The",
"returned",
"DirectByteBuffer",
"does",
"not",
"release",
"the",
"memory",
"by",
"itself",
"."
] | train | https://github.com/xerial/larray/blob/9a1462623c0e56ca67c5341ea29832963c29479f/larray-buffer/src/main/java/xerial/larray/buffer/UnsafeUtil.java#L57-L67 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.hasAnnotation | @ArgumentsChecked
@Throws( {
"""
Ensures that a passed class has an annotation of a specific type
@param clazz
the class that must have a required annotation
@param annotation
the type of annotation that is required on the class
@return the given annotation which is present on the checked class
@throws IllegalMissingAnnotationException
if the passed annotation is not annotated at the given class
""" IllegalNullArgumentException.class, IllegalMissingAnnotationException.class })
public static Annotation hasAnnotation(@Nonnull final Class<?> clazz, @Nonnull final Class<? extends Annotation> annotation) {
Check.notNull(clazz, "clazz");
Check.notNull(annotation, "annotation");
if (!clazz.isAnnotationPresent(annotation)) {
throw new IllegalMissingAnnotationException(annotation, clazz);
}
return clazz.getAnnotation(annotation);
} | java | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalMissingAnnotationException.class })
public static Annotation hasAnnotation(@Nonnull final Class<?> clazz, @Nonnull final Class<? extends Annotation> annotation) {
Check.notNull(clazz, "clazz");
Check.notNull(annotation, "annotation");
if (!clazz.isAnnotationPresent(annotation)) {
throw new IllegalMissingAnnotationException(annotation, clazz);
}
return clazz.getAnnotation(annotation);
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"{",
"IllegalNullArgumentException",
".",
"class",
",",
"IllegalMissingAnnotationException",
".",
"class",
"}",
")",
"public",
"static",
"Annotation",
"hasAnnotation",
"(",
"@",
"Nonnull",
"final",
"Class",
"<",
"?",
">... | Ensures that a passed class has an annotation of a specific type
@param clazz
the class that must have a required annotation
@param annotation
the type of annotation that is required on the class
@return the given annotation which is present on the checked class
@throws IllegalMissingAnnotationException
if the passed annotation is not annotated at the given class | [
"Ensures",
"that",
"a",
"passed",
"class",
"has",
"an",
"annotation",
"of",
"a",
"specific",
"type"
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1117-L1127 |
JDBDT/jdbdt | src/main/java/org/jdbdt/JDBDT.java | JDBDT.assertTableExists | public static void assertTableExists(DB db, String tableName) throws DBAssertionError {
"""
Assert that table exists in the database.
@param db Database.
@param tableName Table name.
@throws DBAssertionError If the assertion fails.
@see #assertTableDoesNotExist(DB, String)
@see #drop(Table)
"""
DBAssert.assertTableExistence(CallInfo.create(), db, tableName, true);
} | java | public static void assertTableExists(DB db, String tableName) throws DBAssertionError {
DBAssert.assertTableExistence(CallInfo.create(), db, tableName, true);
} | [
"public",
"static",
"void",
"assertTableExists",
"(",
"DB",
"db",
",",
"String",
"tableName",
")",
"throws",
"DBAssertionError",
"{",
"DBAssert",
".",
"assertTableExistence",
"(",
"CallInfo",
".",
"create",
"(",
")",
",",
"db",
",",
"tableName",
",",
"true",
... | Assert that table exists in the database.
@param db Database.
@param tableName Table name.
@throws DBAssertionError If the assertion fails.
@see #assertTableDoesNotExist(DB, String)
@see #drop(Table) | [
"Assert",
"that",
"table",
"exists",
"in",
"the",
"database",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/JDBDT.java#L739-L741 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java | SequenceManagerHighLowImpl.addSequence | private void addSequence(String sequenceName, HighLowSequence seq) {
"""
Put new sequence object for given sequence name.
@param sequenceName Name of the sequence.
@param seq The sequence object to add.
"""
// lookup the sequence map for calling DB
String jcdAlias = getBrokerForClass()
.serviceConnectionManager().getConnectionDescriptor().getJcdAlias();
Map mapForDB = (Map) sequencesDBMap.get(jcdAlias);
if(mapForDB == null)
{
mapForDB = new HashMap();
}
mapForDB.put(sequenceName, seq);
sequencesDBMap.put(jcdAlias, mapForDB);
} | java | private void addSequence(String sequenceName, HighLowSequence seq)
{
// lookup the sequence map for calling DB
String jcdAlias = getBrokerForClass()
.serviceConnectionManager().getConnectionDescriptor().getJcdAlias();
Map mapForDB = (Map) sequencesDBMap.get(jcdAlias);
if(mapForDB == null)
{
mapForDB = new HashMap();
}
mapForDB.put(sequenceName, seq);
sequencesDBMap.put(jcdAlias, mapForDB);
} | [
"private",
"void",
"addSequence",
"(",
"String",
"sequenceName",
",",
"HighLowSequence",
"seq",
")",
"{",
"// lookup the sequence map for calling DB\r",
"String",
"jcdAlias",
"=",
"getBrokerForClass",
"(",
")",
".",
"serviceConnectionManager",
"(",
")",
".",
"getConnect... | Put new sequence object for given sequence name.
@param sequenceName Name of the sequence.
@param seq The sequence object to add. | [
"Put",
"new",
"sequence",
"object",
"for",
"given",
"sequence",
"name",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java#L214-L226 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java | VariantMetadataManager.removeCohort | public void removeCohort(String cohortId, String studyId) {
"""
Remove a cohort (from cohort ID) of a given variant study metadata (from study ID).
@param cohortId Cohort ID
@param studyId Study ID
"""
// Sanity check
if (StringUtils.isEmpty(cohortId)) {
logger.error("Cohort ID {} is null or empty.", cohortId);
return;
}
VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId);
if (variantStudyMetadata == null) {
logger.error("Study not found. Check your study ID: '{}'", studyId);
return;
}
if (variantStudyMetadata.getCohorts() != null) {
for (int i = 0; i < variantStudyMetadata.getCohorts().size(); i++) {
if (cohortId.equals(variantStudyMetadata.getCohorts().get(i).getId())) {
variantStudyMetadata.getCohorts().remove(i);
return;
}
}
}
} | java | public void removeCohort(String cohortId, String studyId) {
// Sanity check
if (StringUtils.isEmpty(cohortId)) {
logger.error("Cohort ID {} is null or empty.", cohortId);
return;
}
VariantStudyMetadata variantStudyMetadata = getVariantStudyMetadata(studyId);
if (variantStudyMetadata == null) {
logger.error("Study not found. Check your study ID: '{}'", studyId);
return;
}
if (variantStudyMetadata.getCohorts() != null) {
for (int i = 0; i < variantStudyMetadata.getCohorts().size(); i++) {
if (cohortId.equals(variantStudyMetadata.getCohorts().get(i).getId())) {
variantStudyMetadata.getCohorts().remove(i);
return;
}
}
}
} | [
"public",
"void",
"removeCohort",
"(",
"String",
"cohortId",
",",
"String",
"studyId",
")",
"{",
"// Sanity check",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"cohortId",
")",
")",
"{",
"logger",
".",
"error",
"(",
"\"Cohort ID {} is null or empty.\"",
",",
... | Remove a cohort (from cohort ID) of a given variant study metadata (from study ID).
@param cohortId Cohort ID
@param studyId Study ID | [
"Remove",
"a",
"cohort",
"(",
"from",
"cohort",
"ID",
")",
"of",
"a",
"given",
"variant",
"study",
"metadata",
"(",
"from",
"study",
"ID",
")",
"."
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java#L446-L466 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Document.java | Document.addSubject | public boolean addSubject(String subject) {
"""
Adds the subject to a Document.
@param subject
the subject
@return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
"""
try {
return add(new Meta(Element.SUBJECT, subject));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | java | public boolean addSubject(String subject) {
try {
return add(new Meta(Element.SUBJECT, subject));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | [
"public",
"boolean",
"addSubject",
"(",
"String",
"subject",
")",
"{",
"try",
"{",
"return",
"add",
"(",
"new",
"Meta",
"(",
"Element",
".",
"SUBJECT",
",",
"subject",
")",
")",
";",
"}",
"catch",
"(",
"DocumentException",
"de",
")",
"{",
"throw",
"new... | Adds the subject to a Document.
@param subject
the subject
@return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise | [
"Adds",
"the",
"subject",
"to",
"a",
"Document",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Document.java#L544-L550 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.