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 |
|---|---|---|---|---|---|---|---|---|---|---|
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java | LocaleFormatter.getFormatted | @Nonnull
public static String getFormatted (final double dValue, @Nonnull final Locale aDisplayLocale) {
"""
Format the passed value according to the rules specified by the given
locale. All calls to {@link Double#toString(double)} that are displayed to
the user should instead use this method.
@param dValue
The value to be formatted.
@param aDisplayLocale
The locale to be used. May not be <code>null</code>.
@return The formatted string.
"""
ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale");
return NumberFormat.getNumberInstance (aDisplayLocale).format (dValue);
} | java | @Nonnull
public static String getFormatted (final double dValue, @Nonnull final Locale aDisplayLocale)
{
ValueEnforcer.notNull (aDisplayLocale, "DisplayLocale");
return NumberFormat.getNumberInstance (aDisplayLocale).format (dValue);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getFormatted",
"(",
"final",
"double",
"dValue",
",",
"@",
"Nonnull",
"final",
"Locale",
"aDisplayLocale",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aDisplayLocale",
",",
"\"DisplayLocale\"",
")",
";",
"retur... | Format the passed value according to the rules specified by the given
locale. All calls to {@link Double#toString(double)} that are displayed to
the user should instead use this method.
@param dValue
The value to be formatted.
@param aDisplayLocale
The locale to be used. May not be <code>null</code>.
@return The formatted string. | [
"Format",
"the",
"passed",
"value",
"according",
"to",
"the",
"rules",
"specified",
"by",
"the",
"given",
"locale",
".",
"All",
"calls",
"to",
"{",
"@link",
"Double#toString",
"(",
"double",
")",
"}",
"that",
"are",
"displayed",
"to",
"the",
"user",
"shoul... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/locale/LocaleFormatter.java#L56-L62 |
RobertStewart/privateer | src/main/java/com/wombatnation/privateer/Privateer.java | Privateer.findSupertypeMethod | private Method findSupertypeMethod(Object o, String methodName, Class<?>[] types) {
"""
Examines each argument to see if a param in the same position is a supertype. This method is
needed because getDeclaredMethod() does a formal type match. For example, if the method takes
a java.util.List as a parameter, getDeclaredMethod() will never match, since the formal type
of whatever you pass will be a concrete class.
@param o
@param methodName
@param types
@return A matching Method or null
"""
Method matchingMethod = null;
Method[] methods = o.getClass().getDeclaredMethods();
methodloop:
for (Method method : methods) {
if (methodName.equals(method.getName())) {
Class<?>[] params = method.getParameterTypes();
if (params.length == types.length) {
for (int i = 0; i < params.length; i++) {
// Check if param is supertype of arg in the same position
if (!params[i].isAssignableFrom(types[i])) {
break methodloop;
}
}
}
// If we reach here, then all params and args were compatible
matchingMethod = method;
break;
}
}
return matchingMethod;
} | java | private Method findSupertypeMethod(Object o, String methodName, Class<?>[] types) {
Method matchingMethod = null;
Method[] methods = o.getClass().getDeclaredMethods();
methodloop:
for (Method method : methods) {
if (methodName.equals(method.getName())) {
Class<?>[] params = method.getParameterTypes();
if (params.length == types.length) {
for (int i = 0; i < params.length; i++) {
// Check if param is supertype of arg in the same position
if (!params[i].isAssignableFrom(types[i])) {
break methodloop;
}
}
}
// If we reach here, then all params and args were compatible
matchingMethod = method;
break;
}
}
return matchingMethod;
} | [
"private",
"Method",
"findSupertypeMethod",
"(",
"Object",
"o",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
")",
"{",
"Method",
"matchingMethod",
"=",
"null",
";",
"Method",
"[",
"]",
"methods",
"=",
"o",
".",
"getClass",... | Examines each argument to see if a param in the same position is a supertype. This method is
needed because getDeclaredMethod() does a formal type match. For example, if the method takes
a java.util.List as a parameter, getDeclaredMethod() will never match, since the formal type
of whatever you pass will be a concrete class.
@param o
@param methodName
@param types
@return A matching Method or null | [
"Examines",
"each",
"argument",
"to",
"see",
"if",
"a",
"param",
"in",
"the",
"same",
"position",
"is",
"a",
"supertype",
".",
"This",
"method",
"is",
"needed",
"because",
"getDeclaredMethod",
"()",
"does",
"a",
"formal",
"type",
"match",
".",
"For",
"exam... | train | https://github.com/RobertStewart/privateer/blob/766603021ff406c950e798ce3fb259c9f1f460c7/src/main/java/com/wombatnation/privateer/Privateer.java#L163-L187 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/EasterHoliday.java | EasterRule.firstBetween | @Override
public Date firstBetween(Date start, Date end) {
"""
Return the first occurrence of this rule on or after
the given start date and before the given end date.
"""
return doFirstBetween(start, end);
} | java | @Override
public Date firstBetween(Date start, Date end)
{
return doFirstBetween(start, end);
} | [
"@",
"Override",
"public",
"Date",
"firstBetween",
"(",
"Date",
"start",
",",
"Date",
"end",
")",
"{",
"return",
"doFirstBetween",
"(",
"start",
",",
"end",
")",
";",
"}"
] | Return the first occurrence of this rule on or after
the given start date and before the given end date. | [
"Return",
"the",
"first",
"occurrence",
"of",
"this",
"rule",
"on",
"or",
"after",
"the",
"given",
"start",
"date",
"and",
"before",
"the",
"given",
"end",
"date",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/EasterHoliday.java#L161-L165 |
mongodb/stitch-android-sdk | core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java | DataSynchronizer.insertOne | void insertOne(final MongoNamespace namespace, final BsonDocument document) {
"""
Inserts a single document locally and being to synchronize it based on its _id. Inserting
a document with the same _id twice will result in a duplicate key exception.
@param namespace the namespace to put the document in.
@param document the document to insert.
"""
this.waitUntilInitialized();
try {
ongoingOperationsGroup.enter();
// Remove forbidden fields from the document before inserting it into the local collection.
final BsonDocument docForStorage = sanitizeDocument(document);
final NamespaceSynchronizationConfig nsConfig =
this.syncConfig.getNamespaceConfig(namespace);
final Lock lock = nsConfig.getLock().writeLock();
lock.lock();
final ChangeEvent<BsonDocument> event;
final BsonValue documentId;
try {
getLocalCollection(namespace).insertOne(docForStorage);
documentId = BsonUtils.getDocumentId(docForStorage);
event = ChangeEvents.changeEventForLocalInsert(namespace, docForStorage, true);
final CoreDocumentSynchronizationConfig config = syncConfig.addAndGetSynchronizedDocument(
namespace,
documentId
);
config.setSomePendingWritesAndSave(logicalT, event);
} finally {
lock.unlock();
}
checkAndInsertNamespaceListener(namespace);
eventDispatcher.emitEvent(nsConfig, event);
} finally {
ongoingOperationsGroup.exit();
}
} | java | void insertOne(final MongoNamespace namespace, final BsonDocument document) {
this.waitUntilInitialized();
try {
ongoingOperationsGroup.enter();
// Remove forbidden fields from the document before inserting it into the local collection.
final BsonDocument docForStorage = sanitizeDocument(document);
final NamespaceSynchronizationConfig nsConfig =
this.syncConfig.getNamespaceConfig(namespace);
final Lock lock = nsConfig.getLock().writeLock();
lock.lock();
final ChangeEvent<BsonDocument> event;
final BsonValue documentId;
try {
getLocalCollection(namespace).insertOne(docForStorage);
documentId = BsonUtils.getDocumentId(docForStorage);
event = ChangeEvents.changeEventForLocalInsert(namespace, docForStorage, true);
final CoreDocumentSynchronizationConfig config = syncConfig.addAndGetSynchronizedDocument(
namespace,
documentId
);
config.setSomePendingWritesAndSave(logicalT, event);
} finally {
lock.unlock();
}
checkAndInsertNamespaceListener(namespace);
eventDispatcher.emitEvent(nsConfig, event);
} finally {
ongoingOperationsGroup.exit();
}
} | [
"void",
"insertOne",
"(",
"final",
"MongoNamespace",
"namespace",
",",
"final",
"BsonDocument",
"document",
")",
"{",
"this",
".",
"waitUntilInitialized",
"(",
")",
";",
"try",
"{",
"ongoingOperationsGroup",
".",
"enter",
"(",
")",
";",
"// Remove forbidden fields... | Inserts a single document locally and being to synchronize it based on its _id. Inserting
a document with the same _id twice will result in a duplicate key exception.
@param namespace the namespace to put the document in.
@param document the document to insert. | [
"Inserts",
"a",
"single",
"document",
"locally",
"and",
"being",
"to",
"synchronize",
"it",
"based",
"on",
"its",
"_id",
".",
"Inserting",
"a",
"document",
"with",
"the",
"same",
"_id",
"twice",
"will",
"result",
"in",
"a",
"duplicate",
"key",
"exception",
... | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/DataSynchronizer.java#L2247-L2278 |
cucumber/cucumber-jvm | java/src/main/java/cucumber/runtime/java/JavaBackend.java | JavaBackend.loadGlue | public void loadGlue(Glue glue, Method method, Class<?> glueCodeClass) {
"""
Convenience method for frameworks that wish to load glue from methods explicitly (possibly
found with a different mechanism than Cucumber's built-in classpath scanning).
@param glue where stepdefs and hooks will be added.
@param method a candidate method.
@param glueCodeClass the class implementing the method. Must not be a subclass of the class implementing the method.
"""
this.glue = glue;
methodScanner.scan(this, method, glueCodeClass);
} | java | public void loadGlue(Glue glue, Method method, Class<?> glueCodeClass) {
this.glue = glue;
methodScanner.scan(this, method, glueCodeClass);
} | [
"public",
"void",
"loadGlue",
"(",
"Glue",
"glue",
",",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"glueCodeClass",
")",
"{",
"this",
".",
"glue",
"=",
"glue",
";",
"methodScanner",
".",
"scan",
"(",
"this",
",",
"method",
",",
"glueCodeClass",
"... | Convenience method for frameworks that wish to load glue from methods explicitly (possibly
found with a different mechanism than Cucumber's built-in classpath scanning).
@param glue where stepdefs and hooks will be added.
@param method a candidate method.
@param glueCodeClass the class implementing the method. Must not be a subclass of the class implementing the method. | [
"Convenience",
"method",
"for",
"frameworks",
"that",
"wish",
"to",
"load",
"glue",
"from",
"methods",
"explicitly",
"(",
"possibly",
"found",
"with",
"a",
"different",
"mechanism",
"than",
"Cucumber",
"s",
"built",
"-",
"in",
"classpath",
"scanning",
")",
"."... | train | https://github.com/cucumber/cucumber-jvm/blob/437bb3a1f1d91b56f44059c835765b395eefc777/java/src/main/java/cucumber/runtime/java/JavaBackend.java#L107-L110 |
alkacon/opencms-core | src-modules/org/opencms/workplace/list/A_CmsListDialog.java | A_CmsListDialog.setSearchAction | protected void setSearchAction(CmsListMetadata metadata, String columnId) {
"""
Creates the default search action.<p>
Can be overridden for more sophisticated search.<p>
@param metadata the metadata of the list to do searchable
@param columnId the if of the column to search into
"""
CmsListColumnDefinition col = metadata.getColumnDefinition(columnId);
if ((columnId != null) && (col != null)) {
if (metadata.getSearchAction() == null) {
// makes the list searchable
CmsListSearchAction searchAction = new CmsListSearchAction(col);
searchAction.useDefaultShowAllAction();
metadata.setSearchAction(searchAction);
}
}
} | java | protected void setSearchAction(CmsListMetadata metadata, String columnId) {
CmsListColumnDefinition col = metadata.getColumnDefinition(columnId);
if ((columnId != null) && (col != null)) {
if (metadata.getSearchAction() == null) {
// makes the list searchable
CmsListSearchAction searchAction = new CmsListSearchAction(col);
searchAction.useDefaultShowAllAction();
metadata.setSearchAction(searchAction);
}
}
} | [
"protected",
"void",
"setSearchAction",
"(",
"CmsListMetadata",
"metadata",
",",
"String",
"columnId",
")",
"{",
"CmsListColumnDefinition",
"col",
"=",
"metadata",
".",
"getColumnDefinition",
"(",
"columnId",
")",
";",
"if",
"(",
"(",
"columnId",
"!=",
"null",
"... | Creates the default search action.<p>
Can be overridden for more sophisticated search.<p>
@param metadata the metadata of the list to do searchable
@param columnId the if of the column to search into | [
"Creates",
"the",
"default",
"search",
"action",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/A_CmsListDialog.java#L1117-L1128 |
Impetus/Kundera | src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java | ESClient.addDiscriminator | private void addDiscriminator(Map<String, Object> values, EntityType entityType) {
"""
Adds the discriminator.
@param values
the values
@param entityType
the entity type
"""
String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue();
// No need to check for empty or blank, as considering it as valid name
// for nosql!
if (discrColumn != null && discrValue != null)
{
values.put(discrColumn, discrValue);
}
} | java | private void addDiscriminator(Map<String, Object> values, EntityType entityType)
{
String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue();
// No need to check for empty or blank, as considering it as valid name
// for nosql!
if (discrColumn != null && discrValue != null)
{
values.put(discrColumn, discrValue);
}
} | [
"private",
"void",
"addDiscriminator",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"values",
",",
"EntityType",
"entityType",
")",
"{",
"String",
"discrColumn",
"=",
"(",
"(",
"AbstractManagedType",
")",
"entityType",
")",
".",
"getDiscriminatorColumn",
"(",
... | Adds the discriminator.
@param values
the values
@param entityType
the entity type | [
"Adds",
"the",
"discriminator",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java#L193-L204 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java | XpathUtils.asBoolean | public static Boolean asBoolean(String expression, Node node)
throws XPathExpressionException {
"""
Evaluates the specified XPath expression and returns the result as a
Boolean.
<p>
This method can be expensive as a new xpath is instantiated per
invocation. Consider passing in the xpath explicitly via {
{@link #asDouble(String, Node, XPath)} instead. Note {@link XPath} is
not thread-safe and not reentrant.
@param expression
The XPath expression to evaluate.
@param node
The node to run the expression on.
@return The Boolean result.
@throws XPathExpressionException
If there was a problem processing the specified XPath
expression.
"""
return asBoolean(expression, node, xpath());
} | java | public static Boolean asBoolean(String expression, Node node)
throws XPathExpressionException {
return asBoolean(expression, node, xpath());
} | [
"public",
"static",
"Boolean",
"asBoolean",
"(",
"String",
"expression",
",",
"Node",
"node",
")",
"throws",
"XPathExpressionException",
"{",
"return",
"asBoolean",
"(",
"expression",
",",
"node",
",",
"xpath",
"(",
")",
")",
";",
"}"
] | Evaluates the specified XPath expression and returns the result as a
Boolean.
<p>
This method can be expensive as a new xpath is instantiated per
invocation. Consider passing in the xpath explicitly via {
{@link #asDouble(String, Node, XPath)} instead. Note {@link XPath} is
not thread-safe and not reentrant.
@param expression
The XPath expression to evaluate.
@param node
The node to run the expression on.
@return The Boolean result.
@throws XPathExpressionException
If there was a problem processing the specified XPath
expression. | [
"Evaluates",
"the",
"specified",
"XPath",
"expression",
"and",
"returns",
"the",
"result",
"as",
"a",
"Boolean",
".",
"<p",
">",
"This",
"method",
"can",
"be",
"expensive",
"as",
"a",
"new",
"xpath",
"is",
"instantiated",
"per",
"invocation",
".",
"Consider"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L312-L315 |
geomajas/geomajas-project-client-gwt | common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java | HtmlBuilder.openTag | public static String openTag(String tag, String clazz, String style, String... content) {
"""
Build a String containing a HTML opening tag with given CSS class and/or style and concatenates the given
content. Content should contain no HTML, because it is prepared with {@link #htmlEncode(String)}.
@param tag String name of HTML tag
@param clazz CSS class of the tag
@param style style for tag (plain CSS)
@param content content string
@return HTML tag element as string
"""
return openTag(tag, clazz, style, false, content);
} | java | public static String openTag(String tag, String clazz, String style, String... content) {
return openTag(tag, clazz, style, false, content);
} | [
"public",
"static",
"String",
"openTag",
"(",
"String",
"tag",
",",
"String",
"clazz",
",",
"String",
"style",
",",
"String",
"...",
"content",
")",
"{",
"return",
"openTag",
"(",
"tag",
",",
"clazz",
",",
"style",
",",
"false",
",",
"content",
")",
";... | Build a String containing a HTML opening tag with given CSS class and/or style and concatenates the given
content. Content should contain no HTML, because it is prepared with {@link #htmlEncode(String)}.
@param tag String name of HTML tag
@param clazz CSS class of the tag
@param style style for tag (plain CSS)
@param content content string
@return HTML tag element as string | [
"Build",
"a",
"String",
"containing",
"a",
"HTML",
"opening",
"tag",
"with",
"given",
"CSS",
"class",
"and",
"/",
"or",
"style",
"and",
"concatenates",
"the",
"given",
"content",
".",
"Content",
"should",
"contain",
"no",
"HTML",
"because",
"it",
"is",
"pr... | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L390-L392 |
BioPAX/Paxtools | sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java | L3ToSBGNPDConverter.addComplexAsMember | private void addComplexAsMember(Complex cx, Glyph container) {
"""
/*
Recursive method for creating the content of a complex. A complex may contain other complexes
(bad practice), but SBGN needs them flattened. If an inner complex is empty, then we
represent it using a glyph. Otherwise we represent only the members of this inner complex,
merging them with the most outer complex.
@param cx inner complex to add as member
@param container glyph for most outer complex
"""
// Create a glyph for the inner complex
Glyph inner = createComplexMember(cx, container);
for (PhysicalEntity mem : cx.getComponent())
{
if (mem instanceof Complex)
{
// Recursive call for inner complexes
addComplexAsMember((Complex) mem, inner);
}
else
{
createComplexMember(mem, inner);
}
}
} | java | private void addComplexAsMember(Complex cx, Glyph container) {
// Create a glyph for the inner complex
Glyph inner = createComplexMember(cx, container);
for (PhysicalEntity mem : cx.getComponent())
{
if (mem instanceof Complex)
{
// Recursive call for inner complexes
addComplexAsMember((Complex) mem, inner);
}
else
{
createComplexMember(mem, inner);
}
}
} | [
"private",
"void",
"addComplexAsMember",
"(",
"Complex",
"cx",
",",
"Glyph",
"container",
")",
"{",
"// Create a glyph for the inner complex",
"Glyph",
"inner",
"=",
"createComplexMember",
"(",
"cx",
",",
"container",
")",
";",
"for",
"(",
"PhysicalEntity",
"mem",
... | /*
Recursive method for creating the content of a complex. A complex may contain other complexes
(bad practice), but SBGN needs them flattened. If an inner complex is empty, then we
represent it using a glyph. Otherwise we represent only the members of this inner complex,
merging them with the most outer complex.
@param cx inner complex to add as member
@param container glyph for most outer complex | [
"/",
"*",
"Recursive",
"method",
"for",
"creating",
"the",
"content",
"of",
"a",
"complex",
".",
"A",
"complex",
"may",
"contain",
"other",
"complexes",
"(",
"bad",
"practice",
")",
"but",
"SBGN",
"needs",
"them",
"flattened",
".",
"If",
"an",
"inner",
"... | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L592-L608 |
javagl/ND | nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/i/IntTupleIterators.java | IntTupleIterators.clampingIterator | public static Iterator<MutableIntTuple> clampingIterator(
IntTuple min, IntTuple max,
Iterator<? extends MutableIntTuple> delegate) {
"""
Returns an iterator that returns the {@link MutableIntTuple}s from the
given delegate that are contained in the given bounds.<br>
@param min The minimum, inclusive. A copy of this tuple will be
stored internally.
@param max The maximum, exclusive. A copy of this tuple will be
stored internally.
@param delegate The delegate iterator
@return The iterator
@throws IllegalArgumentException If the given tuples do not
have the same {@link Tuple#getSize() size}
"""
Utils.checkForEqualSize(min, max);
IntTuple localMin = IntTuples.copy(min);
IntTuple localMax = IntTuples.copy(max);
return clampingIteratorInternal(localMin, localMax, delegate);
} | java | public static Iterator<MutableIntTuple> clampingIterator(
IntTuple min, IntTuple max,
Iterator<? extends MutableIntTuple> delegate)
{
Utils.checkForEqualSize(min, max);
IntTuple localMin = IntTuples.copy(min);
IntTuple localMax = IntTuples.copy(max);
return clampingIteratorInternal(localMin, localMax, delegate);
} | [
"public",
"static",
"Iterator",
"<",
"MutableIntTuple",
">",
"clampingIterator",
"(",
"IntTuple",
"min",
",",
"IntTuple",
"max",
",",
"Iterator",
"<",
"?",
"extends",
"MutableIntTuple",
">",
"delegate",
")",
"{",
"Utils",
".",
"checkForEqualSize",
"(",
"min",
... | Returns an iterator that returns the {@link MutableIntTuple}s from the
given delegate that are contained in the given bounds.<br>
@param min The minimum, inclusive. A copy of this tuple will be
stored internally.
@param max The maximum, exclusive. A copy of this tuple will be
stored internally.
@param delegate The delegate iterator
@return The iterator
@throws IllegalArgumentException If the given tuples do not
have the same {@link Tuple#getSize() size} | [
"Returns",
"an",
"iterator",
"that",
"returns",
"the",
"{",
"@link",
"MutableIntTuple",
"}",
"s",
"from",
"the",
"given",
"delegate",
"that",
"are",
"contained",
"in",
"the",
"given",
"bounds",
".",
"<br",
">"
] | train | https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/i/IntTupleIterators.java#L197-L205 |
groupon/monsoon | intf/src/main/java/com/groupon/lex/metrics/timeseries/TimeSeriesMetricDeltaSet.java | TimeSeriesMetricDeltaSet.mapOptional | public TimeSeriesMetricDeltaSet mapOptional(Function<? super MetricValue, Optional<? extends MetricValue>> fn) {
"""
Apply a single-argument function to the set.
@param fn A function that takes a TimeSeriesMetricDelta and returns a TimeSeriesMetricDelta.
@return The mapped TimeSeriesMetricDelta from this set.
"""
return values_
.map(
fn,
(x) -> x.entrySet().stream()
.map((entry) -> apply_fn_optional_(entry, fn))
)
.mapCombine(
opt_scalar -> opt_scalar.map(TimeSeriesMetricDeltaSet::new).orElseGet(() -> new TimeSeriesMetricDeltaSet(MetricValue.EMPTY)),
TimeSeriesMetricDeltaSet::new
);
} | java | public TimeSeriesMetricDeltaSet mapOptional(Function<? super MetricValue, Optional<? extends MetricValue>> fn) {
return values_
.map(
fn,
(x) -> x.entrySet().stream()
.map((entry) -> apply_fn_optional_(entry, fn))
)
.mapCombine(
opt_scalar -> opt_scalar.map(TimeSeriesMetricDeltaSet::new).orElseGet(() -> new TimeSeriesMetricDeltaSet(MetricValue.EMPTY)),
TimeSeriesMetricDeltaSet::new
);
} | [
"public",
"TimeSeriesMetricDeltaSet",
"mapOptional",
"(",
"Function",
"<",
"?",
"super",
"MetricValue",
",",
"Optional",
"<",
"?",
"extends",
"MetricValue",
">",
">",
"fn",
")",
"{",
"return",
"values_",
".",
"map",
"(",
"fn",
",",
"(",
"x",
")",
"-",
">... | Apply a single-argument function to the set.
@param fn A function that takes a TimeSeriesMetricDelta and returns a TimeSeriesMetricDelta.
@return The mapped TimeSeriesMetricDelta from this set. | [
"Apply",
"a",
"single",
"-",
"argument",
"function",
"to",
"the",
"set",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/timeseries/TimeSeriesMetricDeltaSet.java#L173-L184 |
Cornutum/tcases | tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java | TupleCombiner.assertApplicable | private void assertApplicable( FunctionInputDef inputDef, VarNamePattern varNamePattern) throws IllegalArgumentException {
"""
Throws an exception if the given variable pattern is not applicable to the given input definition.
"""
if( !varNamePattern.isApplicable( inputDef))
{
throw new IllegalArgumentException( "Can't find variable matching pattern=" + varNamePattern);
}
} | java | private void assertApplicable( FunctionInputDef inputDef, VarNamePattern varNamePattern) throws IllegalArgumentException
{
if( !varNamePattern.isApplicable( inputDef))
{
throw new IllegalArgumentException( "Can't find variable matching pattern=" + varNamePattern);
}
} | [
"private",
"void",
"assertApplicable",
"(",
"FunctionInputDef",
"inputDef",
",",
"VarNamePattern",
"varNamePattern",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"!",
"varNamePattern",
".",
"isApplicable",
"(",
"inputDef",
")",
")",
"{",
"throw",
"new"... | Throws an exception if the given variable pattern is not applicable to the given input definition. | [
"Throws",
"an",
"exception",
"if",
"the",
"given",
"variable",
"pattern",
"is",
"not",
"applicable",
"to",
"the",
"given",
"input",
"definition",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/TupleCombiner.java#L494-L500 |
dbracewell/hermes | hermes-core/src/main/java/com/davidbracewell/hermes/Document.java | Document.create | public static Document create(@NonNull String text, @NonNull Map<AttributeType, ?> attributes) {
"""
Convenience method for creating a document using the default document factory.
@param text the text content making up the document
@param attributes the attributes, i.e. metadata, associated with the document
@return the document
"""
return DocumentFactory.getInstance().create(text, Hermes.defaultLanguage(), attributes);
} | java | public static Document create(@NonNull String text, @NonNull Map<AttributeType, ?> attributes) {
return DocumentFactory.getInstance().create(text, Hermes.defaultLanguage(), attributes);
} | [
"public",
"static",
"Document",
"create",
"(",
"@",
"NonNull",
"String",
"text",
",",
"@",
"NonNull",
"Map",
"<",
"AttributeType",
",",
"?",
">",
"attributes",
")",
"{",
"return",
"DocumentFactory",
".",
"getInstance",
"(",
")",
".",
"create",
"(",
"text",... | Convenience method for creating a document using the default document factory.
@param text the text content making up the document
@param attributes the attributes, i.e. metadata, associated with the document
@return the document | [
"Convenience",
"method",
"for",
"creating",
"a",
"document",
"using",
"the",
"default",
"document",
"factory",
"."
] | train | https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/Document.java#L138-L140 |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.forceNegativeIfTrue | public static BigDecimal forceNegativeIfTrue(final boolean condition, final BigDecimal amount) {
"""
Return a negative amount based on amount if true, otherwise return the ABS.
"""
return condition ? BigDecimalUtil.negate(BigDecimalUtil.abs(amount)) : BigDecimalUtil.abs(amount);
} | java | public static BigDecimal forceNegativeIfTrue(final boolean condition, final BigDecimal amount) {
return condition ? BigDecimalUtil.negate(BigDecimalUtil.abs(amount)) : BigDecimalUtil.abs(amount);
} | [
"public",
"static",
"BigDecimal",
"forceNegativeIfTrue",
"(",
"final",
"boolean",
"condition",
",",
"final",
"BigDecimal",
"amount",
")",
"{",
"return",
"condition",
"?",
"BigDecimalUtil",
".",
"negate",
"(",
"BigDecimalUtil",
".",
"abs",
"(",
"amount",
")",
")"... | Return a negative amount based on amount if true, otherwise return the ABS. | [
"Return",
"a",
"negative",
"amount",
"based",
"on",
"amount",
"if",
"true",
"otherwise",
"return",
"the",
"ABS",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L708-L710 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceGetter.java | V1InstanceGetter.buildRuns | public Collection<BuildRun> buildRuns(BuildRunFilter filter) {
"""
Get Build Runs filtered by the criteria specified in the passed in
filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter.
"""
return get(BuildRun.class, (filter != null) ? filter : new BuildRunFilter());
} | java | public Collection<BuildRun> buildRuns(BuildRunFilter filter) {
return get(BuildRun.class, (filter != null) ? filter : new BuildRunFilter());
} | [
"public",
"Collection",
"<",
"BuildRun",
">",
"buildRuns",
"(",
"BuildRunFilter",
"filter",
")",
"{",
"return",
"get",
"(",
"BuildRun",
".",
"class",
",",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"BuildRunFilter",
"(",
")",
")",
";",
... | Get Build Runs filtered by the criteria specified in the passed in
filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter. | [
"Get",
"Build",
"Runs",
"filtered",
"by",
"the",
"criteria",
"specified",
"in",
"the",
"passed",
"in",
"filter",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L294-L296 |
Netflix/Hystrix | hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/GetUserAccountCommand.java | GetUserAccountCommand.getFallback | @Override
protected UserAccount getFallback() {
"""
Fallback that will use data from the UserCookie and stubbed defaults
to create a UserAccount if the network call failed.
"""
/*
* first 3 come from the HttpCookie
* next 3 are stubbed defaults
*/
return new UserAccount(userCookie.userId, userCookie.name, userCookie.accountType, true, true, true);
} | java | @Override
protected UserAccount getFallback() {
/*
* first 3 come from the HttpCookie
* next 3 are stubbed defaults
*/
return new UserAccount(userCookie.userId, userCookie.name, userCookie.accountType, true, true, true);
} | [
"@",
"Override",
"protected",
"UserAccount",
"getFallback",
"(",
")",
"{",
"/*\n * first 3 come from the HttpCookie\n * next 3 are stubbed defaults\n */",
"return",
"new",
"UserAccount",
"(",
"userCookie",
".",
"userId",
",",
"userCookie",
".",
"name",
... | Fallback that will use data from the UserCookie and stubbed defaults
to create a UserAccount if the network call failed. | [
"Fallback",
"that",
"will",
"use",
"data",
"from",
"the",
"UserCookie",
"and",
"stubbed",
"defaults",
"to",
"create",
"a",
"UserAccount",
"if",
"the",
"network",
"call",
"failed",
"."
] | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/GetUserAccountCommand.java#L87-L94 |
line/armeria | saml/src/main/java/com/linecorp/armeria/server/saml/SamlServiceProvider.java | SamlServiceProvider.newSamlDecorator | public Function<Service<HttpRequest, HttpResponse>,
Service<HttpRequest, HttpResponse>> newSamlDecorator() {
"""
Creates a decorator which initiates a SAML authentication if a request is not authenticated.
"""
return delegate -> new SamlDecorator(this, delegate);
} | java | public Function<Service<HttpRequest, HttpResponse>,
Service<HttpRequest, HttpResponse>> newSamlDecorator() {
return delegate -> new SamlDecorator(this, delegate);
} | [
"public",
"Function",
"<",
"Service",
"<",
"HttpRequest",
",",
"HttpResponse",
">",
",",
"Service",
"<",
"HttpRequest",
",",
"HttpResponse",
">",
">",
"newSamlDecorator",
"(",
")",
"{",
"return",
"delegate",
"->",
"new",
"SamlDecorator",
"(",
"this",
",",
"d... | Creates a decorator which initiates a SAML authentication if a request is not authenticated. | [
"Creates",
"a",
"decorator",
"which",
"initiates",
"a",
"SAML",
"authentication",
"if",
"a",
"request",
"is",
"not",
"authenticated",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/saml/src/main/java/com/linecorp/armeria/server/saml/SamlServiceProvider.java#L245-L248 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/LongShapeDescriptor.java | LongShapeDescriptor.asDataType | public LongShapeDescriptor asDataType(DataType dataType) {
"""
Return a new LongShapeDescriptor with the same shape, strides, order etc but with the specified datatype instead
@param dataType Datatype of the returned descriptor
"""
long extras = 0L;
extras = ArrayOptionsHelper.setOptionBit(extras, dataType);
if(isEmpty()){
extras = ArrayOptionsHelper.setOptionBit(extras, ArrayType.EMPTY);
}
return new LongShapeDescriptor(shape, stride, offset, ews, order, extras);
} | java | public LongShapeDescriptor asDataType(DataType dataType){
long extras = 0L;
extras = ArrayOptionsHelper.setOptionBit(extras, dataType);
if(isEmpty()){
extras = ArrayOptionsHelper.setOptionBit(extras, ArrayType.EMPTY);
}
return new LongShapeDescriptor(shape, stride, offset, ews, order, extras);
} | [
"public",
"LongShapeDescriptor",
"asDataType",
"(",
"DataType",
"dataType",
")",
"{",
"long",
"extras",
"=",
"0L",
";",
"extras",
"=",
"ArrayOptionsHelper",
".",
"setOptionBit",
"(",
"extras",
",",
"dataType",
")",
";",
"if",
"(",
"isEmpty",
"(",
")",
")",
... | Return a new LongShapeDescriptor with the same shape, strides, order etc but with the specified datatype instead
@param dataType Datatype of the returned descriptor | [
"Return",
"a",
"new",
"LongShapeDescriptor",
"with",
"the",
"same",
"shape",
"strides",
"order",
"etc",
"but",
"with",
"the",
"specified",
"datatype",
"instead"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/LongShapeDescriptor.java#L164-L171 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Primitives.java | Primitives.box | @SafeVarargs
public static Short[] box(final short... a) {
"""
<p>
Converts an array of primitive shorts to objects.
</p>
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param a
a {@code short} array
@return a {@code Short} array, {@code null} if null array input
"""
if (a == null) {
return null;
}
return box(a, 0, a.length);
} | java | @SafeVarargs
public static Short[] box(final short... a) {
if (a == null) {
return null;
}
return box(a, 0, a.length);
} | [
"@",
"SafeVarargs",
"public",
"static",
"Short",
"[",
"]",
"box",
"(",
"final",
"short",
"...",
"a",
")",
"{",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"box",
"(",
"a",
",",
"0",
",",
"a",
".",
"length",
")"... | <p>
Converts an array of primitive shorts to objects.
</p>
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param a
a {@code short} array
@return a {@code Short} array, {@code null} if null array input | [
"<p",
">",
"Converts",
"an",
"array",
"of",
"primitive",
"shorts",
"to",
"objects",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Primitives.java#L237-L244 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java | PyExpressionGenerator._generate | protected XExpression _generate(XSynchronizedExpression synchronizedStatement, IAppendable it, IExtraLanguageGeneratorContext context) {
"""
Generate the given object.
@param synchronizedStatement the synchronized statement.
@param it the target for the generated content.
@param context the context.
@return the statement.
"""
return generate(synchronizedStatement.getExpression(), context.getExpectedExpressionType(), it, context);
} | java | protected XExpression _generate(XSynchronizedExpression synchronizedStatement, IAppendable it, IExtraLanguageGeneratorContext context) {
return generate(synchronizedStatement.getExpression(), context.getExpectedExpressionType(), it, context);
} | [
"protected",
"XExpression",
"_generate",
"(",
"XSynchronizedExpression",
"synchronizedStatement",
",",
"IAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"return",
"generate",
"(",
"synchronizedStatement",
".",
"getExpression",
"(",
")",
",",... | Generate the given object.
@param synchronizedStatement the synchronized statement.
@param it the target for the generated content.
@param context the context.
@return the statement. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L905-L907 |
operasoftware/operaprestodriver | src/com/opera/core/systems/scope/stp/services/desktop/ScopeDesktopWindowManager.java | ScopeDesktopWindowManager.getQuickWindow | public QuickWindow getQuickWindow(QuickWidgetSearchType property, String value) {
"""
Note: This grabs the first window with a matching name, there might be more
"""
QuickWindow lastFound = null;
List<QuickWindow> windows = getQuickWindowList();
for (QuickWindow window : windows) {
if (property.equals(QuickWidgetSearchType.NAME)) {
if (window.getName().equals(value)) {
if (window.isOnScreen()) {
return window;
} else {
lastFound = window;
}
}
}
}
return lastFound;
} | java | public QuickWindow getQuickWindow(QuickWidgetSearchType property, String value) {
QuickWindow lastFound = null;
List<QuickWindow> windows = getQuickWindowList();
for (QuickWindow window : windows) {
if (property.equals(QuickWidgetSearchType.NAME)) {
if (window.getName().equals(value)) {
if (window.isOnScreen()) {
return window;
} else {
lastFound = window;
}
}
}
}
return lastFound;
} | [
"public",
"QuickWindow",
"getQuickWindow",
"(",
"QuickWidgetSearchType",
"property",
",",
"String",
"value",
")",
"{",
"QuickWindow",
"lastFound",
"=",
"null",
";",
"List",
"<",
"QuickWindow",
">",
"windows",
"=",
"getQuickWindowList",
"(",
")",
";",
"for",
"(",... | Note: This grabs the first window with a matching name, there might be more | [
"Note",
":",
"This",
"grabs",
"the",
"first",
"window",
"with",
"a",
"matching",
"name",
"there",
"might",
"be",
"more"
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/scope/stp/services/desktop/ScopeDesktopWindowManager.java#L78-L94 |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java | HDInsightInstance.submitApplication | public void submitApplication(final ApplicationSubmission applicationSubmission) throws IOException {
"""
Submits an application for execution.
@param applicationSubmission
@throws IOException
"""
final String url = "ws/v1/cluster/apps";
final HttpPost post = preparePost(url);
final StringWriter writer = new StringWriter();
try {
this.objectMapper.writeValue(writer, applicationSubmission);
} catch (final IOException e) {
throw new RuntimeException(e);
}
final String message = writer.toString();
LOG.log(Level.FINE, "Sending:\n{0}", message.replace("\n", "\n\t"));
post.setEntity(new StringEntity(message, ContentType.APPLICATION_JSON));
try (final CloseableHttpResponse response = this.httpClient.execute(post, this.httpClientContext)) {
final String responseMessage = IOUtils.toString(response.getEntity().getContent());
LOG.log(Level.FINE, "Response: {0}", responseMessage.replace("\n", "\n\t"));
}
} | java | public void submitApplication(final ApplicationSubmission applicationSubmission) throws IOException {
final String url = "ws/v1/cluster/apps";
final HttpPost post = preparePost(url);
final StringWriter writer = new StringWriter();
try {
this.objectMapper.writeValue(writer, applicationSubmission);
} catch (final IOException e) {
throw new RuntimeException(e);
}
final String message = writer.toString();
LOG.log(Level.FINE, "Sending:\n{0}", message.replace("\n", "\n\t"));
post.setEntity(new StringEntity(message, ContentType.APPLICATION_JSON));
try (final CloseableHttpResponse response = this.httpClient.execute(post, this.httpClientContext)) {
final String responseMessage = IOUtils.toString(response.getEntity().getContent());
LOG.log(Level.FINE, "Response: {0}", responseMessage.replace("\n", "\n\t"));
}
} | [
"public",
"void",
"submitApplication",
"(",
"final",
"ApplicationSubmission",
"applicationSubmission",
")",
"throws",
"IOException",
"{",
"final",
"String",
"url",
"=",
"\"ws/v1/cluster/apps\"",
";",
"final",
"HttpPost",
"post",
"=",
"preparePost",
"(",
"url",
")",
... | Submits an application for execution.
@param applicationSubmission
@throws IOException | [
"Submits",
"an",
"application",
"for",
"execution",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/client/yarnrest/HDInsightInstance.java#L106-L124 |
Azure/autorest-clientruntime-for-java | azure-client-authentication/src/main/java/com/microsoft/azure/credentials/UserTokenCredentials.java | UserTokenCredentials.acquireAccessTokenFromRefreshToken | AuthenticationResult acquireAccessTokenFromRefreshToken(String resource, String refreshToken, boolean isMultipleResourceRefreshToken) throws IOException {
"""
Refresh tokens are currently not used since we don't know if the refresh token has expired
"""
ExecutorService executor = Executors.newSingleThreadExecutor();
try {
return refreshTokenClient.refreshToken(domain(), clientId(), resource, refreshToken, isMultipleResourceRefreshToken);
} catch (Exception e) {
return null;
} finally {
executor.shutdown();
}
} | java | AuthenticationResult acquireAccessTokenFromRefreshToken(String resource, String refreshToken, boolean isMultipleResourceRefreshToken) throws IOException {
ExecutorService executor = Executors.newSingleThreadExecutor();
try {
return refreshTokenClient.refreshToken(domain(), clientId(), resource, refreshToken, isMultipleResourceRefreshToken);
} catch (Exception e) {
return null;
} finally {
executor.shutdown();
}
} | [
"AuthenticationResult",
"acquireAccessTokenFromRefreshToken",
"(",
"String",
"resource",
",",
"String",
"refreshToken",
",",
"boolean",
"isMultipleResourceRefreshToken",
")",
"throws",
"IOException",
"{",
"ExecutorService",
"executor",
"=",
"Executors",
".",
"newSingleThreadE... | Refresh tokens are currently not used since we don't know if the refresh token has expired | [
"Refresh",
"tokens",
"are",
"currently",
"not",
"used",
"since",
"we",
"don",
"t",
"know",
"if",
"the",
"refresh",
"token",
"has",
"expired"
] | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-authentication/src/main/java/com/microsoft/azure/credentials/UserTokenCredentials.java#L122-L131 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java | Http2Exception.closedStreamError | public static Http2Exception closedStreamError(Http2Error error, String fmt, Object... args) {
"""
Use if an error has occurred which can not be isolated to a single stream, but instead applies
to the entire connection.
@param error The type of error as defined by the HTTP/2 specification.
@param fmt String with the content and format for the additional debug data.
@param args Objects which fit into the format defined by {@code fmt}.
@return An exception which can be translated into a HTTP/2 error.
"""
return new ClosedStreamCreationException(error, String.format(fmt, args));
} | java | public static Http2Exception closedStreamError(Http2Error error, String fmt, Object... args) {
return new ClosedStreamCreationException(error, String.format(fmt, args));
} | [
"public",
"static",
"Http2Exception",
"closedStreamError",
"(",
"Http2Error",
"error",
",",
"String",
"fmt",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"ClosedStreamCreationException",
"(",
"error",
",",
"String",
".",
"format",
"(",
"fmt",
",",
... | Use if an error has occurred which can not be isolated to a single stream, but instead applies
to the entire connection.
@param error The type of error as defined by the HTTP/2 specification.
@param fmt String with the content and format for the additional debug data.
@param args Objects which fit into the format defined by {@code fmt}.
@return An exception which can be translated into a HTTP/2 error. | [
"Use",
"if",
"an",
"error",
"has",
"occurred",
"which",
"can",
"not",
"be",
"isolated",
"to",
"a",
"single",
"stream",
"but",
"instead",
"applies",
"to",
"the",
"entire",
"connection",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2Exception.java#L110-L112 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java | SparkComputationGraph.calculateScore | public double calculateScore(JavaRDD<DataSet> data, boolean average, int minibatchSize) {
"""
Calculate the score for all examples in the provided {@code JavaRDD<DataSet>}, either by summing
or averaging over the entire data set. To calculate a score for each example individually, use {@link #scoreExamples(JavaPairRDD, boolean)}
or one of the similar methods
@param data Data to score
@param average Whether to sum the scores, or average them
@param minibatchSize The number of examples to use in each minibatch when scoring. If more examples are in a partition than
this, multiple scoring operations will be done (to avoid using too much memory by doing the whole partition
in one go)
"""
JavaRDD<Tuple2<Integer, Double>> rdd = data.mapPartitions(new ScoreFlatMapFunctionCGDataSet(conf.toJson(),
sc.broadcast(network.params(false)), minibatchSize));
//Reduce to a single tuple, with example count + sum of scores
Tuple2<Integer, Double> countAndSumScores = rdd.reduce(new IntDoubleReduceFunction());
if (average) {
return countAndSumScores._2() / countAndSumScores._1();
} else {
return countAndSumScores._2();
}
} | java | public double calculateScore(JavaRDD<DataSet> data, boolean average, int minibatchSize) {
JavaRDD<Tuple2<Integer, Double>> rdd = data.mapPartitions(new ScoreFlatMapFunctionCGDataSet(conf.toJson(),
sc.broadcast(network.params(false)), minibatchSize));
//Reduce to a single tuple, with example count + sum of scores
Tuple2<Integer, Double> countAndSumScores = rdd.reduce(new IntDoubleReduceFunction());
if (average) {
return countAndSumScores._2() / countAndSumScores._1();
} else {
return countAndSumScores._2();
}
} | [
"public",
"double",
"calculateScore",
"(",
"JavaRDD",
"<",
"DataSet",
">",
"data",
",",
"boolean",
"average",
",",
"int",
"minibatchSize",
")",
"{",
"JavaRDD",
"<",
"Tuple2",
"<",
"Integer",
",",
"Double",
">",
">",
"rdd",
"=",
"data",
".",
"mapPartitions"... | Calculate the score for all examples in the provided {@code JavaRDD<DataSet>}, either by summing
or averaging over the entire data set. To calculate a score for each example individually, use {@link #scoreExamples(JavaPairRDD, boolean)}
or one of the similar methods
@param data Data to score
@param average Whether to sum the scores, or average them
@param minibatchSize The number of examples to use in each minibatch when scoring. If more examples are in a partition than
this, multiple scoring operations will be done (to avoid using too much memory by doing the whole partition
in one go) | [
"Calculate",
"the",
"score",
"for",
"all",
"examples",
"in",
"the",
"provided",
"{",
"@code",
"JavaRDD<DataSet",
">",
"}",
"either",
"by",
"summing",
"or",
"averaging",
"over",
"the",
"entire",
"data",
"set",
".",
"To",
"calculate",
"a",
"score",
"for",
"e... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L376-L387 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java | GraphEncoder.decode | public static Graph decode(String encodedGraph, boolean noMonth)
throws GraphEncodingException {
"""
convert a String-encoded graph into a usable Graph object, using
default GraphConfiguration
@param encodedGraph String encoded graph, as returned by getEncoded()
@param noMonth if true, disable the month highlight color
@return a Graph, ready to use
@throws GraphEncodingException if there were problems with the encoded
data
"""
GraphConfiguration config = new GraphConfiguration();
if(noMonth) {
config.valueHighlightColor = config.valueColor;
}
return decode(encodedGraph, config);
} | java | public static Graph decode(String encodedGraph, boolean noMonth)
throws GraphEncodingException {
GraphConfiguration config = new GraphConfiguration();
if(noMonth) {
config.valueHighlightColor = config.valueColor;
}
return decode(encodedGraph, config);
} | [
"public",
"static",
"Graph",
"decode",
"(",
"String",
"encodedGraph",
",",
"boolean",
"noMonth",
")",
"throws",
"GraphEncodingException",
"{",
"GraphConfiguration",
"config",
"=",
"new",
"GraphConfiguration",
"(",
")",
";",
"if",
"(",
"noMonth",
")",
"{",
"confi... | convert a String-encoded graph into a usable Graph object, using
default GraphConfiguration
@param encodedGraph String encoded graph, as returned by getEncoded()
@param noMonth if true, disable the month highlight color
@return a Graph, ready to use
@throws GraphEncodingException if there were problems with the encoded
data | [
"convert",
"a",
"String",
"-",
"encoded",
"graph",
"into",
"a",
"usable",
"Graph",
"object",
"using",
"default",
"GraphConfiguration"
] | train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java#L39-L46 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionAffinityManager.java | SessionAffinityManager.encodeURL | @Override
public String encodeURL(ServletRequest request, String uri, SessionAffinityContext affinityContext) {
"""
Method encodeURL
<p>
@param request
@param uri
@param affinityContext
@return String encoded URI
@see com.ibm.wsspi.session.ISessionAffinityManager#encodeURL(javax.servlet.ServletRequest, java.lang.String, SessionAffinityContext)
"""
return encodeURL(null, request, uri, affinityContext);
} | java | @Override
public String encodeURL(ServletRequest request, String uri, SessionAffinityContext affinityContext) {
return encodeURL(null, request, uri, affinityContext);
} | [
"@",
"Override",
"public",
"String",
"encodeURL",
"(",
"ServletRequest",
"request",
",",
"String",
"uri",
",",
"SessionAffinityContext",
"affinityContext",
")",
"{",
"return",
"encodeURL",
"(",
"null",
",",
"request",
",",
"uri",
",",
"affinityContext",
")",
";"... | Method encodeURL
<p>
@param request
@param uri
@param affinityContext
@return String encoded URI
@see com.ibm.wsspi.session.ISessionAffinityManager#encodeURL(javax.servlet.ServletRequest, java.lang.String, SessionAffinityContext) | [
"Method",
"encodeURL",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionAffinityManager.java#L349-L352 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/KeyEncoder.java | KeyEncoder.encodeDesc | public static void encodeDesc(float value, byte[] dst, int dstOffset) {
"""
Encodes the given float into exactly 4 bytes for descending order.
@param value float value to encode
@param dst destination for encoded bytes
@param dstOffset offset into destination array
"""
int bits = Float.floatToIntBits(value);
if (bits >= 0) {
bits ^= 0x7fffffff;
}
dst[dstOffset ] = (byte)(bits >> 24);
dst[dstOffset + 1] = (byte)(bits >> 16);
dst[dstOffset + 2] = (byte)(bits >> 8);
dst[dstOffset + 3] = (byte)bits;
} | java | public static void encodeDesc(float value, byte[] dst, int dstOffset) {
int bits = Float.floatToIntBits(value);
if (bits >= 0) {
bits ^= 0x7fffffff;
}
dst[dstOffset ] = (byte)(bits >> 24);
dst[dstOffset + 1] = (byte)(bits >> 16);
dst[dstOffset + 2] = (byte)(bits >> 8);
dst[dstOffset + 3] = (byte)bits;
} | [
"public",
"static",
"void",
"encodeDesc",
"(",
"float",
"value",
",",
"byte",
"[",
"]",
"dst",
",",
"int",
"dstOffset",
")",
"{",
"int",
"bits",
"=",
"Float",
".",
"floatToIntBits",
"(",
"value",
")",
";",
"if",
"(",
"bits",
">=",
"0",
")",
"{",
"b... | Encodes the given float into exactly 4 bytes for descending order.
@param value float value to encode
@param dst destination for encoded bytes
@param dstOffset offset into destination array | [
"Encodes",
"the",
"given",
"float",
"into",
"exactly",
"4",
"bytes",
"for",
"descending",
"order",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java#L236-L245 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java | ServerBuilder.gracefulShutdownTimeout | public ServerBuilder gracefulShutdownTimeout(Duration quietPeriod, Duration timeout) {
"""
Sets the amount of time to wait after calling {@link Server#stop()} for
requests to go away before actually shutting down.
@param quietPeriod the number of milliseconds to wait for active
requests to go end before shutting down. {@link Duration#ZERO} means
the server will stop right away without waiting.
@param timeout the number of milliseconds to wait before shutting
down the server regardless of active requests. This should be set to
a time greater than {@code quietPeriod} to ensure the server shuts
down even if there is a stuck request.
"""
requireNonNull(quietPeriod, "quietPeriod");
requireNonNull(timeout, "timeout");
gracefulShutdownQuietPeriod = validateNonNegative(quietPeriod, "quietPeriod");
gracefulShutdownTimeout = validateNonNegative(timeout, "timeout");
ServerConfig.validateGreaterThanOrEqual(gracefulShutdownTimeout, "quietPeriod",
gracefulShutdownQuietPeriod, "timeout");
return this;
} | java | public ServerBuilder gracefulShutdownTimeout(Duration quietPeriod, Duration timeout) {
requireNonNull(quietPeriod, "quietPeriod");
requireNonNull(timeout, "timeout");
gracefulShutdownQuietPeriod = validateNonNegative(quietPeriod, "quietPeriod");
gracefulShutdownTimeout = validateNonNegative(timeout, "timeout");
ServerConfig.validateGreaterThanOrEqual(gracefulShutdownTimeout, "quietPeriod",
gracefulShutdownQuietPeriod, "timeout");
return this;
} | [
"public",
"ServerBuilder",
"gracefulShutdownTimeout",
"(",
"Duration",
"quietPeriod",
",",
"Duration",
"timeout",
")",
"{",
"requireNonNull",
"(",
"quietPeriod",
",",
"\"quietPeriod\"",
")",
";",
"requireNonNull",
"(",
"timeout",
",",
"\"timeout\"",
")",
";",
"grace... | Sets the amount of time to wait after calling {@link Server#stop()} for
requests to go away before actually shutting down.
@param quietPeriod the number of milliseconds to wait for active
requests to go end before shutting down. {@link Duration#ZERO} means
the server will stop right away without waiting.
@param timeout the number of milliseconds to wait before shutting
down the server regardless of active requests. This should be set to
a time greater than {@code quietPeriod} to ensure the server shuts
down even if there is a stuck request. | [
"Sets",
"the",
"amount",
"of",
"time",
"to",
"wait",
"after",
"calling",
"{",
"@link",
"Server#stop",
"()",
"}",
"for",
"requests",
"to",
"go",
"away",
"before",
"actually",
"shutting",
"down",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L639-L647 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java | Error.classNotMapped | public static void classNotMapped(Class<?> aClass) {
"""
Thrown if the class isn't mapped.
@param aClass class to analyze
"""
throw new ClassNotMappedException(MSG.INSTANCE.message(classNotMappedException1,aClass.getSimpleName()));
} | java | public static void classNotMapped(Class<?> aClass){
throw new ClassNotMappedException(MSG.INSTANCE.message(classNotMappedException1,aClass.getSimpleName()));
} | [
"public",
"static",
"void",
"classNotMapped",
"(",
"Class",
"<",
"?",
">",
"aClass",
")",
"{",
"throw",
"new",
"ClassNotMappedException",
"(",
"MSG",
".",
"INSTANCE",
".",
"message",
"(",
"classNotMappedException1",
",",
"aClass",
".",
"getSimpleName",
"(",
")... | Thrown if the class isn't mapped.
@param aClass class to analyze | [
"Thrown",
"if",
"the",
"class",
"isn",
"t",
"mapped",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L565-L567 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/data/codec/BitWriter.java | BitWriter.writeValue | public void writeValue(final int length, final int value)
throws EncodingException {
"""
Writes a positive integer to the buffer.
@param length
the number of bits to write
@param value
an integer value
@throws EncodingException
if the length of the input is more than 31 bits.
"""
if (length > 31) {
throw ErrorFactory.createEncodingException(
ErrorKeys.DIFFTOOL_ENCODING_VALUE_OUT_OF_RANGE,
"more than maximum length: " + value);
}
for (int i = length - 1; i >= 0; i--) {
writeBit((value >> i) & 1);
}
} | java | public void writeValue(final int length, final int value)
throws EncodingException
{
if (length > 31) {
throw ErrorFactory.createEncodingException(
ErrorKeys.DIFFTOOL_ENCODING_VALUE_OUT_OF_RANGE,
"more than maximum length: " + value);
}
for (int i = length - 1; i >= 0; i--) {
writeBit((value >> i) & 1);
}
} | [
"public",
"void",
"writeValue",
"(",
"final",
"int",
"length",
",",
"final",
"int",
"value",
")",
"throws",
"EncodingException",
"{",
"if",
"(",
"length",
">",
"31",
")",
"{",
"throw",
"ErrorFactory",
".",
"createEncodingException",
"(",
"ErrorKeys",
".",
"D... | Writes a positive integer to the buffer.
@param length
the number of bits to write
@param value
an integer value
@throws EncodingException
if the length of the input is more than 31 bits. | [
"Writes",
"a",
"positive",
"integer",
"to",
"the",
"buffer",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/data/codec/BitWriter.java#L127-L139 |
xm-online/xm-commons | xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/repository/PermittedRepository.java | PermittedRepository.findByCondition | public <T> Page<T> findByCondition(String whereCondition,
Map<String, Object> conditionParams,
Pageable pageable,
Class<T> entityClass,
String privilegeKey) {
"""
Find permitted entities by parameters.
@param whereCondition the parameters condition
@param conditionParams the parameters map
@param pageable the page info
@param entityClass the entity class to get
@param privilegeKey the privilege key for permission lookup
@param <T> the type of entity
@return page of permitted entities
"""
return findByCondition(whereCondition, conditionParams, null, pageable, entityClass, privilegeKey);
} | java | public <T> Page<T> findByCondition(String whereCondition,
Map<String, Object> conditionParams,
Pageable pageable,
Class<T> entityClass,
String privilegeKey) {
return findByCondition(whereCondition, conditionParams, null, pageable, entityClass, privilegeKey);
} | [
"public",
"<",
"T",
">",
"Page",
"<",
"T",
">",
"findByCondition",
"(",
"String",
"whereCondition",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"conditionParams",
",",
"Pageable",
"pageable",
",",
"Class",
"<",
"T",
">",
"entityClass",
",",
"String",
... | Find permitted entities by parameters.
@param whereCondition the parameters condition
@param conditionParams the parameters map
@param pageable the page info
@param entityClass the entity class to get
@param privilegeKey the privilege key for permission lookup
@param <T> the type of entity
@return page of permitted entities | [
"Find",
"permitted",
"entities",
"by",
"parameters",
"."
] | train | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/repository/PermittedRepository.java#L113-L119 |
alkacon/opencms-core | src/org/opencms/cache/CmsMemoryObjectCache.java | CmsMemoryObjectCache.putCachedObject | public void putCachedObject(Class<?> owner, String key, Object value) {
"""
Puts an object into the cache.<p>
@param owner the owner class of the cached object (used to ensure keys don't overlap)
@param key the key to store the object at
@param value the object to store
"""
key = owner.getName().concat(key);
OpenCms.getMemoryMonitor().cacheMemObject(key, value);
} | java | public void putCachedObject(Class<?> owner, String key, Object value) {
key = owner.getName().concat(key);
OpenCms.getMemoryMonitor().cacheMemObject(key, value);
} | [
"public",
"void",
"putCachedObject",
"(",
"Class",
"<",
"?",
">",
"owner",
",",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"key",
"=",
"owner",
".",
"getName",
"(",
")",
".",
"concat",
"(",
"key",
")",
";",
"OpenCms",
".",
"getMemoryMonitor",
... | Puts an object into the cache.<p>
@param owner the owner class of the cached object (used to ensure keys don't overlap)
@param key the key to store the object at
@param value the object to store | [
"Puts",
"an",
"object",
"into",
"the",
"cache",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsMemoryObjectCache.java#L116-L120 |
rey5137/material | material/src/main/java/com/rey/material/widget/FloatingActionButton.java | FloatingActionButton.setLineMorphingState | public void setLineMorphingState(int state, boolean animation) {
"""
Set the line state of LineMorphingDrawable that is used as this button's icon.
@param state The line state.
@param animation Indicate should show animation when switch line state or not.
"""
if(mIcon != null && mIcon instanceof LineMorphingDrawable)
((LineMorphingDrawable)mIcon).switchLineState(state, animation);
} | java | public void setLineMorphingState(int state, boolean animation){
if(mIcon != null && mIcon instanceof LineMorphingDrawable)
((LineMorphingDrawable)mIcon).switchLineState(state, animation);
} | [
"public",
"void",
"setLineMorphingState",
"(",
"int",
"state",
",",
"boolean",
"animation",
")",
"{",
"if",
"(",
"mIcon",
"!=",
"null",
"&&",
"mIcon",
"instanceof",
"LineMorphingDrawable",
")",
"(",
"(",
"LineMorphingDrawable",
")",
"mIcon",
")",
".",
"switchL... | Set the line state of LineMorphingDrawable that is used as this button's icon.
@param state The line state.
@param animation Indicate should show animation when switch line state or not. | [
"Set",
"the",
"line",
"state",
"of",
"LineMorphingDrawable",
"that",
"is",
"used",
"as",
"this",
"button",
"s",
"icon",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/FloatingActionButton.java#L253-L256 |
gresrun/jesque | src/main/java/net/greghaines/jesque/utils/ReflectionUtils.java | ReflectionUtils.createObject | public static <T> T createObject(final Class<T> clazz, final Object[] args, final Map<String,Object> vars)
throws NoSuchConstructorException, AmbiguousConstructorException, ReflectiveOperationException {
"""
Create an object of the given type using a constructor that matches the
supplied arguments and invoke the setters with the supplied variables.
@param <T> the object type
@param clazz
the type to create
@param args
the arguments to the constructor
@param vars
the named arguments for setters
@return a new object of the given type, initialized with the given
arguments
@throws NoSuchConstructorException
if there is not a constructor that matches the given
arguments
@throws AmbiguousConstructorException
if there is more than one constructor that matches the given
arguments
@throws ReflectiveOperationException
if any of the reflective operations throw an exception
"""
return invokeSetters(findConstructor(clazz, args).newInstance(args), vars);
} | java | public static <T> T createObject(final Class<T> clazz, final Object[] args, final Map<String,Object> vars)
throws NoSuchConstructorException, AmbiguousConstructorException, ReflectiveOperationException {
return invokeSetters(findConstructor(clazz, args).newInstance(args), vars);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createObject",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Object",
"[",
"]",
"args",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"vars",
")",
"throws",
"NoSuchConstructorException",
... | Create an object of the given type using a constructor that matches the
supplied arguments and invoke the setters with the supplied variables.
@param <T> the object type
@param clazz
the type to create
@param args
the arguments to the constructor
@param vars
the named arguments for setters
@return a new object of the given type, initialized with the given
arguments
@throws NoSuchConstructorException
if there is not a constructor that matches the given
arguments
@throws AmbiguousConstructorException
if there is more than one constructor that matches the given
arguments
@throws ReflectiveOperationException
if any of the reflective operations throw an exception | [
"Create",
"an",
"object",
"of",
"the",
"given",
"type",
"using",
"a",
"constructor",
"that",
"matches",
"the",
"supplied",
"arguments",
"and",
"invoke",
"the",
"setters",
"with",
"the",
"supplied",
"variables",
"."
] | train | https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/ReflectionUtils.java#L145-L148 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/AbstractAggregatorImpl.java | AbstractAggregatorImpl.callExtensionInitializers | protected void callExtensionInitializers(Iterable<IAggregatorExtension> extensions, ExtensionRegistrar reg) {
"""
For each extension specified, call the extension's
{@link IExtensionInitializer#initialize} method. Note that this
can cause additional extensions to be registered though the
{@link ExtensionRegistrar}.
@param extensions The list of extensions to initialize
@param reg The extension registrar.
"""
final String sourceMethod = "callextensionInitializers"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(AbstractAggregatorImpl.class.getName(), sourceMethod, new Object[]{extensions, reg});
}
for (IAggregatorExtension extension : extensions) {
Object instance = extension.getInstance();
if (instance instanceof IExtensionInitializer) {
((IExtensionInitializer)instance).initialize(this, extension, reg);
}
}
if (isTraceLogging) {
log.exiting(AbstractAggregatorImpl.class.getName(), sourceMethod);
}
} | java | protected void callExtensionInitializers(Iterable<IAggregatorExtension> extensions, ExtensionRegistrar reg) {
final String sourceMethod = "callextensionInitializers"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(AbstractAggregatorImpl.class.getName(), sourceMethod, new Object[]{extensions, reg});
}
for (IAggregatorExtension extension : extensions) {
Object instance = extension.getInstance();
if (instance instanceof IExtensionInitializer) {
((IExtensionInitializer)instance).initialize(this, extension, reg);
}
}
if (isTraceLogging) {
log.exiting(AbstractAggregatorImpl.class.getName(), sourceMethod);
}
} | [
"protected",
"void",
"callExtensionInitializers",
"(",
"Iterable",
"<",
"IAggregatorExtension",
">",
"extensions",
",",
"ExtensionRegistrar",
"reg",
")",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"callextensionInitializers\"",
";",
"//$NON-NLS-1$\r",
"boolean",
"isTr... | For each extension specified, call the extension's
{@link IExtensionInitializer#initialize} method. Note that this
can cause additional extensions to be registered though the
{@link ExtensionRegistrar}.
@param extensions The list of extensions to initialize
@param reg The extension registrar. | [
"For",
"each",
"extension",
"specified",
"call",
"the",
"extension",
"s",
"{",
"@link",
"IExtensionInitializer#initialize",
"}",
"method",
".",
"Note",
"that",
"this",
"can",
"cause",
"additional",
"extensions",
"to",
"be",
"registered",
"though",
"the",
"{",
"@... | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/AbstractAggregatorImpl.java#L1329-L1344 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/Gabor.java | Gabor.Function1D | public static double Function1D(double x, double mean, double amplitude, double position, double width, double phase, double frequency) {
"""
1-D Gabor function.
@param x Value.
@param mean Mean.
@param amplitude Amplitude.
@param position Position.
@param width Width.
@param phase Phase.
@param frequency Frequency.
@return Gabor response.
"""
double envelope = mean + amplitude * Math.exp(-Math.pow((x - position), 2) / Math.pow((2 * width), 2));
double carry = Math.cos(2 * Math.PI * frequency * (x - position) + phase);
return envelope * carry;
} | java | public static double Function1D(double x, double mean, double amplitude, double position, double width, double phase, double frequency) {
double envelope = mean + amplitude * Math.exp(-Math.pow((x - position), 2) / Math.pow((2 * width), 2));
double carry = Math.cos(2 * Math.PI * frequency * (x - position) + phase);
return envelope * carry;
} | [
"public",
"static",
"double",
"Function1D",
"(",
"double",
"x",
",",
"double",
"mean",
",",
"double",
"amplitude",
",",
"double",
"position",
",",
"double",
"width",
",",
"double",
"phase",
",",
"double",
"frequency",
")",
"{",
"double",
"envelope",
"=",
"... | 1-D Gabor function.
@param x Value.
@param mean Mean.
@param amplitude Amplitude.
@param position Position.
@param width Width.
@param phase Phase.
@param frequency Frequency.
@return Gabor response. | [
"1",
"-",
"D",
"Gabor",
"function",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/Gabor.java#L78-L82 |
heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.renameApp | public String renameApp(String appName, String newName) {
"""
Rename an existing app.
@param appName Existing app name. See {@link #listApps()} for names that can be used.
@param newName New name to give the existing app.
@return the new name of the object
"""
return connection.execute(new AppRename(appName, newName), apiKey).getName();
} | java | public String renameApp(String appName, String newName) {
return connection.execute(new AppRename(appName, newName), apiKey).getName();
} | [
"public",
"String",
"renameApp",
"(",
"String",
"appName",
",",
"String",
"newName",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"AppRename",
"(",
"appName",
",",
"newName",
")",
",",
"apiKey",
")",
".",
"getName",
"(",
")",
";",
"}"
] | Rename an existing app.
@param appName Existing app name. See {@link #listApps()} for names that can be used.
@param newName New name to give the existing app.
@return the new name of the object | [
"Rename",
"an",
"existing",
"app",
"."
] | train | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L196-L198 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java | PoolsImpl.listUsageMetricsNextWithServiceResponseAsync | public Observable<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>> listUsageMetricsNextWithServiceResponseAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions) {
"""
Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account.
If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param poolListUsageMetricsNextOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<PoolUsageMetrics> object
"""
return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>, Observable<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>> call(ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listUsageMetricsNextWithServiceResponseAsync(nextPageLink, poolListUsageMetricsNextOptions));
}
});
} | java | public Observable<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>> listUsageMetricsNextWithServiceResponseAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions) {
return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>, Observable<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>> call(ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listUsageMetricsNextWithServiceResponseAsync(nextPageLink, poolListUsageMetricsNextOptions));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"PoolUsageMetrics",
">",
",",
"PoolListUsageMetricsHeaders",
">",
">",
"listUsageMetricsNextWithServiceResponseAsync",
"(",
"final",
"String",
"nextPageLink",
",",
"final",
"PoolListUsageMetricsNextO... | Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account.
If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param poolListUsageMetricsNextOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<PoolUsageMetrics> object | [
"Lists",
"the",
"usage",
"metrics",
"aggregated",
"by",
"pool",
"across",
"individual",
"time",
"intervals",
"for",
"the",
"specified",
"account",
".",
"If",
"you",
"do",
"not",
"specify",
"a",
"$filter",
"clause",
"including",
"a",
"poolId",
"the",
"response"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L3828-L3840 |
quattor/pan | panc/src/main/java/org/quattor/pan/Compiler.java | Compiler.run | public static CompilerResults run(CompilerOptions options, List<String> objectNames, Collection<File> tplFiles) {
"""
This is a convenience method which creates a compiler and then invokes the <code>process</code> method.
@param options compiler options to use for the created compiler
@param objectNames object template names to compile/build; these will be looked-up on the load path
@param tplFiles absolute file names of templates to process
@return results from the compilation/build
"""
return (new Compiler(options, objectNames, tplFiles)).process();
} | java | public static CompilerResults run(CompilerOptions options, List<String> objectNames, Collection<File> tplFiles) {
return (new Compiler(options, objectNames, tplFiles)).process();
} | [
"public",
"static",
"CompilerResults",
"run",
"(",
"CompilerOptions",
"options",
",",
"List",
"<",
"String",
">",
"objectNames",
",",
"Collection",
"<",
"File",
">",
"tplFiles",
")",
"{",
"return",
"(",
"new",
"Compiler",
"(",
"options",
",",
"objectNames",
... | This is a convenience method which creates a compiler and then invokes the <code>process</code> method.
@param options compiler options to use for the created compiler
@param objectNames object template names to compile/build; these will be looked-up on the load path
@param tplFiles absolute file names of templates to process
@return results from the compilation/build | [
"This",
"is",
"a",
"convenience",
"method",
"which",
"creates",
"a",
"compiler",
"and",
"then",
"invokes",
"the",
"<code",
">",
"process<",
"/",
"code",
">",
"method",
"."
] | train | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/Compiler.java#L201-L203 |
spring-cloud/spring-cloud-sleuth | spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationUtils.java | SleuthAnnotationUtils.findAnnotation | static <T extends Annotation> T findAnnotation(Method method, Class<T> clazz) {
"""
Searches for an annotation either on a method or inside the method parameters.
@param <T> - annotation
@param clazz - class with annotation
@param method - annotated method
@return annotation
"""
T annotation = AnnotationUtils.findAnnotation(method, clazz);
if (annotation == null) {
try {
annotation = AnnotationUtils.findAnnotation(method.getDeclaringClass()
.getMethod(method.getName(), method.getParameterTypes()), clazz);
}
catch (NoSuchMethodException | SecurityException ex) {
if (log.isDebugEnabled()) {
log.debug("Exception occurred while tyring to find the annotation",
ex);
}
}
}
return annotation;
} | java | static <T extends Annotation> T findAnnotation(Method method, Class<T> clazz) {
T annotation = AnnotationUtils.findAnnotation(method, clazz);
if (annotation == null) {
try {
annotation = AnnotationUtils.findAnnotation(method.getDeclaringClass()
.getMethod(method.getName(), method.getParameterTypes()), clazz);
}
catch (NoSuchMethodException | SecurityException ex) {
if (log.isDebugEnabled()) {
log.debug("Exception occurred while tyring to find the annotation",
ex);
}
}
}
return annotation;
} | [
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"findAnnotation",
"(",
"Method",
"method",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"T",
"annotation",
"=",
"AnnotationUtils",
".",
"findAnnotation",
"(",
"method",
",",
"clazz",
")",
";",
"if... | Searches for an annotation either on a method or inside the method parameters.
@param <T> - annotation
@param clazz - class with annotation
@param method - annotated method
@return annotation | [
"Searches",
"for",
"an",
"annotation",
"either",
"on",
"a",
"method",
"or",
"inside",
"the",
"method",
"parameters",
"."
] | train | https://github.com/spring-cloud/spring-cloud-sleuth/blob/f29c05fb8fba33e23aa21bb13aeb13ab8d27b485/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationUtils.java#L77-L92 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/util/concurrent/ConcurrentConveyor.java | ConcurrentConveyor.drainTo | public final int drainTo(int queueIndex, Collection<? super E> drain, int limit) {
"""
Drains no more than {@code limit} items from the queue at the supplied
index into the supplied collection.
@return the number of items drained
"""
return drain(queues[queueIndex], drain, limit);
} | java | public final int drainTo(int queueIndex, Collection<? super E> drain, int limit) {
return drain(queues[queueIndex], drain, limit);
} | [
"public",
"final",
"int",
"drainTo",
"(",
"int",
"queueIndex",
",",
"Collection",
"<",
"?",
"super",
"E",
">",
"drain",
",",
"int",
"limit",
")",
"{",
"return",
"drain",
"(",
"queues",
"[",
"queueIndex",
"]",
",",
"drain",
",",
"limit",
")",
";",
"}"... | Drains no more than {@code limit} items from the queue at the supplied
index into the supplied collection.
@return the number of items drained | [
"Drains",
"no",
"more",
"than",
"{",
"@code",
"limit",
"}",
"items",
"from",
"the",
"queue",
"at",
"the",
"supplied",
"index",
"into",
"the",
"supplied",
"collection",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/util/concurrent/ConcurrentConveyor.java#L318-L320 |
spotify/apollo | examples/spotify-api-example/src/main/java/com/spotify/apollo/example/AlbumResource.java | AlbumResource.parseAlbumData | private ArrayList<Album> parseAlbumData(String json) {
"""
Parses an album response from a
<a href="https://developer.spotify.com/web-api/album-endpoints/">Spotify API album query</a>.
@param json The json response
@return A list of albums with artist information
"""
ArrayList<Album> albums = new ArrayList<>();
try {
JsonNode jsonNode = this.objectMapper.readTree(json);
for (JsonNode albumNode : jsonNode.get("albums")) {
JsonNode artistsNode = albumNode.get("artists");
// Exclude albums with 0 artists
if (artistsNode.size() >= 1) {
// Only keeping the first artist for simplicity
Artist artist = new Artist(artistsNode.get(0).get("name").asText());
Album album = new Album(albumNode.get("name").asText(), artist);
albums.add(album);
}
}
} catch (IOException e) {
throw new RuntimeException("Failed to parse JSON", e);
}
return albums;
} | java | private ArrayList<Album> parseAlbumData(String json) {
ArrayList<Album> albums = new ArrayList<>();
try {
JsonNode jsonNode = this.objectMapper.readTree(json);
for (JsonNode albumNode : jsonNode.get("albums")) {
JsonNode artistsNode = albumNode.get("artists");
// Exclude albums with 0 artists
if (artistsNode.size() >= 1) {
// Only keeping the first artist for simplicity
Artist artist = new Artist(artistsNode.get(0).get("name").asText());
Album album = new Album(albumNode.get("name").asText(), artist);
albums.add(album);
}
}
} catch (IOException e) {
throw new RuntimeException("Failed to parse JSON", e);
}
return albums;
} | [
"private",
"ArrayList",
"<",
"Album",
">",
"parseAlbumData",
"(",
"String",
"json",
")",
"{",
"ArrayList",
"<",
"Album",
">",
"albums",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"JsonNode",
"jsonNode",
"=",
"this",
".",
"objectMapper",
".... | Parses an album response from a
<a href="https://developer.spotify.com/web-api/album-endpoints/">Spotify API album query</a>.
@param json The json response
@return A list of albums with artist information | [
"Parses",
"an",
"album",
"response",
"from",
"a",
"<a",
"href",
"=",
"https",
":",
"//",
"developer",
".",
"spotify",
".",
"com",
"/",
"web",
"-",
"api",
"/",
"album",
"-",
"endpoints",
"/",
">",
"Spotify",
"API",
"album",
"query<",
"/",
"a",
">",
... | train | https://github.com/spotify/apollo/blob/3aba09840538a2aff9cdac5be42cc114dd276c70/examples/spotify-api-example/src/main/java/com/spotify/apollo/example/AlbumResource.java#L74-L92 |
vladmihalcea/flexy-pool | flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java | ReflectionUtils.handleException | private static ReflectionException handleException(String methodName, NoSuchMethodException e) {
"""
Handle {@link NoSuchMethodException} by logging it and rethrown it as a {@link ReflectionException}
@param methodName method name
@param e exception
@return wrapped exception
"""
LOGGER.error("Couldn't find method " + methodName, e);
return new ReflectionException(e);
} | java | private static ReflectionException handleException(String methodName, NoSuchMethodException e) {
LOGGER.error("Couldn't find method " + methodName, e);
return new ReflectionException(e);
} | [
"private",
"static",
"ReflectionException",
"handleException",
"(",
"String",
"methodName",
",",
"NoSuchMethodException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Couldn't find method \"",
"+",
"methodName",
",",
"e",
")",
";",
"return",
"new",
"ReflectionExce... | Handle {@link NoSuchMethodException} by logging it and rethrown it as a {@link ReflectionException}
@param methodName method name
@param e exception
@return wrapped exception | [
"Handle",
"{",
"@link",
"NoSuchMethodException",
"}",
"by",
"logging",
"it",
"and",
"rethrown",
"it",
"as",
"a",
"{",
"@link",
"ReflectionException",
"}"
] | train | https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java#L172-L175 |
rometools/rome | rome-opml/src/main/java/com/rometools/opml/feed/synd/impl/ConverterForOPML10.java | ConverterForOPML10.copyInto | @Override
public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {
"""
Makes a deep copy/conversion of the values of a real feed into a SyndFeedImpl.
<p>
It assumes the given SyndFeedImpl has no properties set.
<p>
@param feed real feed to copy/convert.
@param syndFeed the SyndFeedImpl that will contain the copied/converted values of the real feed.
"""
final Opml opml = (Opml) feed;
syndFeed.setTitle(opml.getTitle());
addOwner(opml, syndFeed);
syndFeed.setPublishedDate(opml.getModified() != null ? opml.getModified() : opml.getCreated());
syndFeed.setFeedType(opml.getFeedType());
syndFeed.setModules(opml.getModules());
syndFeed.setFeedType(getType());
createEntries(new Stack<Integer>(), syndFeed.getEntries(), opml.getOutlines());
} | java | @Override
public void copyInto(final WireFeed feed, final SyndFeed syndFeed) {
final Opml opml = (Opml) feed;
syndFeed.setTitle(opml.getTitle());
addOwner(opml, syndFeed);
syndFeed.setPublishedDate(opml.getModified() != null ? opml.getModified() : opml.getCreated());
syndFeed.setFeedType(opml.getFeedType());
syndFeed.setModules(opml.getModules());
syndFeed.setFeedType(getType());
createEntries(new Stack<Integer>(), syndFeed.getEntries(), opml.getOutlines());
} | [
"@",
"Override",
"public",
"void",
"copyInto",
"(",
"final",
"WireFeed",
"feed",
",",
"final",
"SyndFeed",
"syndFeed",
")",
"{",
"final",
"Opml",
"opml",
"=",
"(",
"Opml",
")",
"feed",
";",
"syndFeed",
".",
"setTitle",
"(",
"opml",
".",
"getTitle",
"(",
... | Makes a deep copy/conversion of the values of a real feed into a SyndFeedImpl.
<p>
It assumes the given SyndFeedImpl has no properties set.
<p>
@param feed real feed to copy/convert.
@param syndFeed the SyndFeedImpl that will contain the copied/converted values of the real feed. | [
"Makes",
"a",
"deep",
"copy",
"/",
"conversion",
"of",
"the",
"values",
"of",
"a",
"real",
"feed",
"into",
"a",
"SyndFeedImpl",
".",
"<p",
">",
"It",
"assumes",
"the",
"given",
"SyndFeedImpl",
"has",
"no",
"properties",
"set",
".",
"<p",
">"
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-opml/src/main/java/com/rometools/opml/feed/synd/impl/ConverterForOPML10.java#L73-L84 |
lucee/Lucee | core/src/main/java/lucee/runtime/tag/Mail.java | Mail.setType | public void setType(String type) throws ApplicationException {
"""
set the value type Specifies extended type attributes for the message.
@param type value to set
@throws ApplicationException
"""
type = type.toLowerCase().trim();
if (type.equals("text/plain") || type.equals("plain") || type.equals("text")) getPart().isHTML(false);
// mail.setType(lucee.runtime.mail.Mail.TYPE_TEXT);
else if (type.equals("text/html") || type.equals("html") || type.equals("htm")) getPart().isHTML(true);
else throw new ApplicationException("attribute type of tag mail has an invalid values", "valid values are [plain,text,html] but value is now [" + type + "]");
// throw new ApplicationException(("invalid type "+type);
} | java | public void setType(String type) throws ApplicationException {
type = type.toLowerCase().trim();
if (type.equals("text/plain") || type.equals("plain") || type.equals("text")) getPart().isHTML(false);
// mail.setType(lucee.runtime.mail.Mail.TYPE_TEXT);
else if (type.equals("text/html") || type.equals("html") || type.equals("htm")) getPart().isHTML(true);
else throw new ApplicationException("attribute type of tag mail has an invalid values", "valid values are [plain,text,html] but value is now [" + type + "]");
// throw new ApplicationException(("invalid type "+type);
} | [
"public",
"void",
"setType",
"(",
"String",
"type",
")",
"throws",
"ApplicationException",
"{",
"type",
"=",
"type",
".",
"toLowerCase",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"type",
".",
"equals",
"(",
"\"text/plain\"",
")",
"||",
"type",
"... | set the value type Specifies extended type attributes for the message.
@param type value to set
@throws ApplicationException | [
"set",
"the",
"value",
"type",
"Specifies",
"extended",
"type",
"attributes",
"for",
"the",
"message",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Mail.java#L279-L286 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QRDecompositionHouseholderTran_ZDRM.java | QRDecompositionHouseholderTran_ZDRM.getR | @Override
public ZMatrixRMaj getR(ZMatrixRMaj R, boolean compact) {
"""
Returns an upper triangular matrix which is the R in the QR decomposition.
@param R An upper triangular matrix.
@param compact
"""
if( compact )
R = UtilDecompositons_ZDRM.checkZerosLT(R,minLength,numCols);
else
R = UtilDecompositons_ZDRM.checkZerosLT(R,numRows,numCols);
for( int i = 0; i < R.numRows; i++ ) {
for( int j = i; j < R.numCols; j++ ) {
int index = QR.getIndex(j,i);
R.set(i,j,QR.data[index],QR.data[index+1]);
}
}
return R;
} | java | @Override
public ZMatrixRMaj getR(ZMatrixRMaj R, boolean compact) {
if( compact )
R = UtilDecompositons_ZDRM.checkZerosLT(R,minLength,numCols);
else
R = UtilDecompositons_ZDRM.checkZerosLT(R,numRows,numCols);
for( int i = 0; i < R.numRows; i++ ) {
for( int j = i; j < R.numCols; j++ ) {
int index = QR.getIndex(j,i);
R.set(i,j,QR.data[index],QR.data[index+1]);
}
}
return R;
} | [
"@",
"Override",
"public",
"ZMatrixRMaj",
"getR",
"(",
"ZMatrixRMaj",
"R",
",",
"boolean",
"compact",
")",
"{",
"if",
"(",
"compact",
")",
"R",
"=",
"UtilDecompositons_ZDRM",
".",
"checkZerosLT",
"(",
"R",
",",
"minLength",
",",
"numCols",
")",
";",
"else"... | Returns an upper triangular matrix which is the R in the QR decomposition.
@param R An upper triangular matrix.
@param compact | [
"Returns",
"an",
"upper",
"triangular",
"matrix",
"which",
"is",
"the",
"R",
"in",
"the",
"QR",
"decomposition",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QRDecompositionHouseholderTran_ZDRM.java#L177-L192 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java | JsonModelCoder.encodeListNullToBlank | public void encodeListNullToBlank(Writer writer, List<? extends T> list) throws IOException {
"""
Encodes the given {@link List} of values into the JSON format, and writes it using the given writer.<br>
Writes "[]" if null is given.
@param writer {@link Writer} to be used for writing value
@param list {@link List} of values to be encoded
@throws IOException
"""
if (list == null) {
writer.write("[]");
writer.flush();
return;
}
encodeListNullToNull(writer, list);
} | java | public void encodeListNullToBlank(Writer writer, List<? extends T> list) throws IOException {
if (list == null) {
writer.write("[]");
writer.flush();
return;
}
encodeListNullToNull(writer, list);
} | [
"public",
"void",
"encodeListNullToBlank",
"(",
"Writer",
"writer",
",",
"List",
"<",
"?",
"extends",
"T",
">",
"list",
")",
"throws",
"IOException",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"writer",
".",
"write",
"(",
"\"[]\"",
")",
";",
"writ... | Encodes the given {@link List} of values into the JSON format, and writes it using the given writer.<br>
Writes "[]" if null is given.
@param writer {@link Writer} to be used for writing value
@param list {@link List} of values to be encoded
@throws IOException | [
"Encodes",
"the",
"given",
"{",
"@link",
"List",
"}",
"of",
"values",
"into",
"the",
"JSON",
"format",
"and",
"writes",
"it",
"using",
"the",
"given",
"writer",
".",
"<br",
">",
"Writes",
"[]",
"if",
"null",
"is",
"given",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L337-L345 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/BosClient.java | BosClient.getObject | public BosObject getObject(String bucketName, String key) {
"""
Gets the object stored in Bos under the specified bucket and key.
@param bucketName The name of the bucket containing the desired object.
@param key The key under which the desired object is stored.
@return The object stored in Bos in the specified bucket and key.
"""
return this.getObject(new GetObjectRequest(bucketName, key));
} | java | public BosObject getObject(String bucketName, String key) {
return this.getObject(new GetObjectRequest(bucketName, key));
} | [
"public",
"BosObject",
"getObject",
"(",
"String",
"bucketName",
",",
"String",
"key",
")",
"{",
"return",
"this",
".",
"getObject",
"(",
"new",
"GetObjectRequest",
"(",
"bucketName",
",",
"key",
")",
")",
";",
"}"
] | Gets the object stored in Bos under the specified bucket and key.
@param bucketName The name of the bucket containing the desired object.
@param key The key under which the desired object is stored.
@return The object stored in Bos in the specified bucket and key. | [
"Gets",
"the",
"object",
"stored",
"in",
"Bos",
"under",
"the",
"specified",
"bucket",
"and",
"key",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L643-L645 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/international/pennchinese/CTBTreeReaderFactory.java | CTBTreeReaderFactory.newTreeReader | public TreeReader newTreeReader(Reader in) {
"""
Create a new <code>TreeReader</code> using the provided
<code>Reader</code>.
@param in The <code>Reader</code> to build on
@return The new TreeReader
"""
if (discardFrags) {
return new FragDiscardingPennTreeReader(in, new LabeledScoredTreeFactory(), tn, new CHTBTokenizer(in));
} else {
return new PennTreeReader(in, new LabeledScoredTreeFactory(), tn, new CHTBTokenizer(in));
}
} | java | public TreeReader newTreeReader(Reader in) {
if (discardFrags) {
return new FragDiscardingPennTreeReader(in, new LabeledScoredTreeFactory(), tn, new CHTBTokenizer(in));
} else {
return new PennTreeReader(in, new LabeledScoredTreeFactory(), tn, new CHTBTokenizer(in));
}
} | [
"public",
"TreeReader",
"newTreeReader",
"(",
"Reader",
"in",
")",
"{",
"if",
"(",
"discardFrags",
")",
"{",
"return",
"new",
"FragDiscardingPennTreeReader",
"(",
"in",
",",
"new",
"LabeledScoredTreeFactory",
"(",
")",
",",
"tn",
",",
"new",
"CHTBTokenizer",
"... | Create a new <code>TreeReader</code> using the provided
<code>Reader</code>.
@param in The <code>Reader</code> to build on
@return The new TreeReader | [
"Create",
"a",
"new",
"<code",
">",
"TreeReader<",
"/",
"code",
">",
"using",
"the",
"provided",
"<code",
">",
"Reader<",
"/",
"code",
">",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/international/pennchinese/CTBTreeReaderFactory.java#L39-L45 |
cdk/cdk | tool/group/src/main/java/org/openscience/cdk/group/AtomContainerDiscretePartitionRefinerImpl.java | AtomContainerDiscretePartitionRefinerImpl.getAutomorphismGroup | public PermutationGroup getAutomorphismGroup(IAtomContainer atomContainer, Partition initialPartition) {
"""
Get the automorphism group of the molecule given an initial partition.
@param atomContainer the atom container to use
@param initialPartition an initial partition of the atoms
@return the automorphism group starting with this partition
"""
setup(atomContainer);
super.refine(initialPartition);
return super.getAutomorphismGroup();
} | java | public PermutationGroup getAutomorphismGroup(IAtomContainer atomContainer, Partition initialPartition) {
setup(atomContainer);
super.refine(initialPartition);
return super.getAutomorphismGroup();
} | [
"public",
"PermutationGroup",
"getAutomorphismGroup",
"(",
"IAtomContainer",
"atomContainer",
",",
"Partition",
"initialPartition",
")",
"{",
"setup",
"(",
"atomContainer",
")",
";",
"super",
".",
"refine",
"(",
"initialPartition",
")",
";",
"return",
"super",
".",
... | Get the automorphism group of the molecule given an initial partition.
@param atomContainer the atom container to use
@param initialPartition an initial partition of the atoms
@return the automorphism group starting with this partition | [
"Get",
"the",
"automorphism",
"group",
"of",
"the",
"molecule",
"given",
"an",
"initial",
"partition",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/group/src/main/java/org/openscience/cdk/group/AtomContainerDiscretePartitionRefinerImpl.java#L115-L119 |
banq/jdonframework | JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java | PageIteratorSolver.getPageIterator | public PageIterator getPageIterator(String sqlqueryAllCount, String sqlquery, String queryParam, int start, int count) {
"""
same as getDatas the parameters sort is different from the getDatas
method
@param sqlqueryAllCount
the sql sentence for "select count(1) .."
@param sqlquery
the sql sentence for "select id from xxxx";
@param queryParam
the parameter of String type for the sqlquery.
@param start
the starting number of a page in allCount;
@param count
the display number of a page
@return
"""
if (UtilValidate.isEmpty(sqlqueryAllCount)) {
Debug.logError(" the parameter sqlqueryAllCount is null", module);
return new PageIterator();
}
if (UtilValidate.isEmpty(sqlquery)) {
Debug.logError(" the parameter sqlquery is null", module);
return new PageIterator();
}
return getDatas(queryParam, sqlqueryAllCount, sqlquery, start, count);
} | java | public PageIterator getPageIterator(String sqlqueryAllCount, String sqlquery, String queryParam, int start, int count) {
if (UtilValidate.isEmpty(sqlqueryAllCount)) {
Debug.logError(" the parameter sqlqueryAllCount is null", module);
return new PageIterator();
}
if (UtilValidate.isEmpty(sqlquery)) {
Debug.logError(" the parameter sqlquery is null", module);
return new PageIterator();
}
return getDatas(queryParam, sqlqueryAllCount, sqlquery, start, count);
} | [
"public",
"PageIterator",
"getPageIterator",
"(",
"String",
"sqlqueryAllCount",
",",
"String",
"sqlquery",
",",
"String",
"queryParam",
",",
"int",
"start",
",",
"int",
"count",
")",
"{",
"if",
"(",
"UtilValidate",
".",
"isEmpty",
"(",
"sqlqueryAllCount",
")",
... | same as getDatas the parameters sort is different from the getDatas
method
@param sqlqueryAllCount
the sql sentence for "select count(1) .."
@param sqlquery
the sql sentence for "select id from xxxx";
@param queryParam
the parameter of String type for the sqlquery.
@param start
the starting number of a page in allCount;
@param count
the display number of a page
@return | [
"same",
"as",
"getDatas",
"the",
"parameters",
"sort",
"is",
"different",
"from",
"the",
"getDatas",
"method"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-jdbc/src/main/java/com/jdon/model/query/PageIteratorSolver.java#L201-L211 |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java | WsAddressingHeaders.setFaultTo | public void setFaultTo(String faultTo) {
"""
Sets the fault to endpoint reference by string.
@param faultTo the faultTo to set
"""
try {
this.faultTo = new EndpointReference(new URI(faultTo));
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid faultTo uri", e);
}
} | java | public void setFaultTo(String faultTo) {
try {
this.faultTo = new EndpointReference(new URI(faultTo));
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid faultTo uri", e);
}
} | [
"public",
"void",
"setFaultTo",
"(",
"String",
"faultTo",
")",
"{",
"try",
"{",
"this",
".",
"faultTo",
"=",
"new",
"EndpointReference",
"(",
"new",
"URI",
"(",
"faultTo",
")",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
... | Sets the fault to endpoint reference by string.
@param faultTo the faultTo to set | [
"Sets",
"the",
"fault",
"to",
"endpoint",
"reference",
"by",
"string",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java#L230-L236 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java | SymSpell.loadDictionary | public boolean loadDictionary(InputStream corpus, int termIndex, int countIndex) {
"""
/ <returns>True if file loaded, or false if file not found.</returns>
"""
if (corpus == null) {
return false;
}
BufferedReader br = new BufferedReader(new InputStreamReader(corpus, StandardCharsets.UTF_8));
return loadDictionary(br, termIndex, countIndex);
} | java | public boolean loadDictionary(InputStream corpus, int termIndex, int countIndex) {
if (corpus == null) {
return false;
}
BufferedReader br = new BufferedReader(new InputStreamReader(corpus, StandardCharsets.UTF_8));
return loadDictionary(br, termIndex, countIndex);
} | [
"public",
"boolean",
"loadDictionary",
"(",
"InputStream",
"corpus",
",",
"int",
"termIndex",
",",
"int",
"countIndex",
")",
"{",
"if",
"(",
"corpus",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
... | / <returns>True if file loaded, or false if file not found.</returns> | [
"/",
"<returns",
">",
"True",
"if",
"file",
"loaded",
"or",
"false",
"if",
"file",
"not",
"found",
".",
"<",
"/",
"returns",
">"
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/spelling/symspell/implementation/SymSpell.java#L210-L216 |
graphql-java/graphql-java | src/main/java/graphql/execution/ExecutionStrategy.java | ExecutionStrategy.completeValueForScalar | protected CompletableFuture<ExecutionResult> completeValueForScalar(ExecutionContext executionContext, ExecutionStrategyParameters parameters, GraphQLScalarType scalarType, Object result) {
"""
Called to turn an object into a scalar value according to the {@link GraphQLScalarType} by asking that scalar type to coerce the object
into a valid value
@param executionContext contains the top level execution parameters
@param parameters contains the parameters holding the fields to be executed and source object
@param scalarType the type of the scalar
@param result the result to be coerced
@return a promise to an {@link ExecutionResult}
"""
Object serialized;
try {
serialized = scalarType.getCoercing().serialize(result);
} catch (CoercingSerializeException e) {
serialized = handleCoercionProblem(executionContext, parameters, e);
}
// TODO: fix that: this should not be handled here
//6.6.1 http://facebook.github.io/graphql/#sec-Field-entries
if (serialized instanceof Double && ((Double) serialized).isNaN()) {
serialized = null;
}
try {
serialized = parameters.getNonNullFieldValidator().validate(parameters.getPath(), serialized);
} catch (NonNullableFieldWasNullException e) {
return exceptionallyCompletedFuture(e);
}
return completedFuture(new ExecutionResultImpl(serialized, null));
} | java | protected CompletableFuture<ExecutionResult> completeValueForScalar(ExecutionContext executionContext, ExecutionStrategyParameters parameters, GraphQLScalarType scalarType, Object result) {
Object serialized;
try {
serialized = scalarType.getCoercing().serialize(result);
} catch (CoercingSerializeException e) {
serialized = handleCoercionProblem(executionContext, parameters, e);
}
// TODO: fix that: this should not be handled here
//6.6.1 http://facebook.github.io/graphql/#sec-Field-entries
if (serialized instanceof Double && ((Double) serialized).isNaN()) {
serialized = null;
}
try {
serialized = parameters.getNonNullFieldValidator().validate(parameters.getPath(), serialized);
} catch (NonNullableFieldWasNullException e) {
return exceptionallyCompletedFuture(e);
}
return completedFuture(new ExecutionResultImpl(serialized, null));
} | [
"protected",
"CompletableFuture",
"<",
"ExecutionResult",
">",
"completeValueForScalar",
"(",
"ExecutionContext",
"executionContext",
",",
"ExecutionStrategyParameters",
"parameters",
",",
"GraphQLScalarType",
"scalarType",
",",
"Object",
"result",
")",
"{",
"Object",
"seri... | Called to turn an object into a scalar value according to the {@link GraphQLScalarType} by asking that scalar type to coerce the object
into a valid value
@param executionContext contains the top level execution parameters
@param parameters contains the parameters holding the fields to be executed and source object
@param scalarType the type of the scalar
@param result the result to be coerced
@return a promise to an {@link ExecutionResult} | [
"Called",
"to",
"turn",
"an",
"object",
"into",
"a",
"scalar",
"value",
"according",
"to",
"the",
"{",
"@link",
"GraphQLScalarType",
"}",
"by",
"asking",
"that",
"scalar",
"type",
"to",
"coerce",
"the",
"object",
"into",
"a",
"valid",
"value"
] | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/ExecutionStrategy.java#L558-L577 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CertificatesInner.java | CertificatesInner.createOrUpdateAsync | public Observable<CertificateInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String certificateName, CertificateCreateOrUpdateParameters parameters) {
"""
Create a certificate.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param certificateName The parameters supplied to the create or update certificate operation.
@param parameters The parameters supplied to the create or update certificate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CertificateInner object
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, certificateName, parameters).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() {
@Override
public CertificateInner call(ServiceResponse<CertificateInner> response) {
return response.body();
}
});
} | java | public Observable<CertificateInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String certificateName, CertificateCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, certificateName, parameters).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() {
@Override
public CertificateInner call(ServiceResponse<CertificateInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CertificateInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"certificateName",
",",
"CertificateCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOr... | Create a certificate.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param certificateName The parameters supplied to the create or update certificate operation.
@param parameters The parameters supplied to the create or update certificate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CertificateInner object | [
"Create",
"a",
"certificate",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CertificatesInner.java#L315-L322 |
livetribe/livetribe-slp | core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java | StandardDirectoryAgentServer.handleTCPSrvRqst | protected void handleTCPSrvRqst(SrvRqst srvRqst, Socket socket) {
"""
Handles a unicast TCP SrvRqst message arrived to this directory agent.
<br />
This directory agent will reply with a list of matching services.
@param srvRqst the SrvRqst message to handle
@param socket the socket connected to th client where to write the reply
@see #handleUDPSrvRqst(SrvRqst, InetSocketAddress, InetSocketAddress)
@see #matchServices(ServiceType, String, Scopes, String)
"""
// Match scopes, RFC 2608, 11.1
if (!scopes.weakMatch(srvRqst.getScopes()))
{
tcpSrvRply.perform(socket, srvRqst, SLPError.SCOPE_NOT_SUPPORTED);
return;
}
ServiceType serviceType = srvRqst.getServiceType();
List<ServiceInfo> matchingServices = matchServices(serviceType, srvRqst.getLanguage(), srvRqst.getScopes(), srvRqst.getFilter());
tcpSrvRply.perform(socket, srvRqst, matchingServices);
if (logger.isLoggable(Level.FINE))
logger.fine("DirectoryAgent " + this + " returning " + matchingServices.size() + " services of type " + serviceType);
} | java | protected void handleTCPSrvRqst(SrvRqst srvRqst, Socket socket)
{
// Match scopes, RFC 2608, 11.1
if (!scopes.weakMatch(srvRqst.getScopes()))
{
tcpSrvRply.perform(socket, srvRqst, SLPError.SCOPE_NOT_SUPPORTED);
return;
}
ServiceType serviceType = srvRqst.getServiceType();
List<ServiceInfo> matchingServices = matchServices(serviceType, srvRqst.getLanguage(), srvRqst.getScopes(), srvRqst.getFilter());
tcpSrvRply.perform(socket, srvRqst, matchingServices);
if (logger.isLoggable(Level.FINE))
logger.fine("DirectoryAgent " + this + " returning " + matchingServices.size() + " services of type " + serviceType);
} | [
"protected",
"void",
"handleTCPSrvRqst",
"(",
"SrvRqst",
"srvRqst",
",",
"Socket",
"socket",
")",
"{",
"// Match scopes, RFC 2608, 11.1",
"if",
"(",
"!",
"scopes",
".",
"weakMatch",
"(",
"srvRqst",
".",
"getScopes",
"(",
")",
")",
")",
"{",
"tcpSrvRply",
".",
... | Handles a unicast TCP SrvRqst message arrived to this directory agent.
<br />
This directory agent will reply with a list of matching services.
@param srvRqst the SrvRqst message to handle
@param socket the socket connected to th client where to write the reply
@see #handleUDPSrvRqst(SrvRqst, InetSocketAddress, InetSocketAddress)
@see #matchServices(ServiceType, String, Scopes, String) | [
"Handles",
"a",
"unicast",
"TCP",
"SrvRqst",
"message",
"arrived",
"to",
"this",
"directory",
"agent",
".",
"<br",
"/",
">",
"This",
"directory",
"agent",
"will",
"reply",
"with",
"a",
"list",
"of",
"matching",
"services",
"."
] | train | https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java#L483-L497 |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/jaxb/loader/RuleDefinitionFileConstant.java | RuleDefinitionFileConstant.getExtractorRuleDefinitionFileName | public static String getExtractorRuleDefinitionFileName(final String rootDir, final DatabaseType databaseType) {
"""
Get extractor rule definition file name.
@param rootDir root dir
@param databaseType database type
@return extractor rule definition file name
"""
return Joiner.on('/').join(rootDir, databaseType.name().toLowerCase(), EXTRACTOR_RULE_DEFINITION_FILE_NAME);
} | java | public static String getExtractorRuleDefinitionFileName(final String rootDir, final DatabaseType databaseType) {
return Joiner.on('/').join(rootDir, databaseType.name().toLowerCase(), EXTRACTOR_RULE_DEFINITION_FILE_NAME);
} | [
"public",
"static",
"String",
"getExtractorRuleDefinitionFileName",
"(",
"final",
"String",
"rootDir",
",",
"final",
"DatabaseType",
"databaseType",
")",
"{",
"return",
"Joiner",
".",
"on",
"(",
"'",
"'",
")",
".",
"join",
"(",
"rootDir",
",",
"databaseType",
... | Get extractor rule definition file name.
@param rootDir root dir
@param databaseType database type
@return extractor rule definition file name | [
"Get",
"extractor",
"rule",
"definition",
"file",
"name",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/rule/jaxb/loader/RuleDefinitionFileConstant.java#L65-L67 |
structr/structr | structr-core/src/main/java/org/structr/common/ValidationHelper.java | ValidationHelper.isValidStringMinLength | public static boolean isValidStringMinLength(final GraphObject node, final PropertyKey<String> key, final int minLength, final ErrorBuffer errorBuffer) {
"""
Checks whether the value for the given property key of the given node
has at least the given length.
@param node the node
@param key the property key whose value should be checked
@param minLength the min length
@param errorBuffer the error buffer
@return true if the condition is valid
"""
String value = node.getProperty(key);
String type = node.getType();
if (StringUtils.isNotBlank(value)) {
if (value.length() >= minLength) {
return true;
}
errorBuffer.add(new TooShortToken(type, key, minLength));
return false;
}
errorBuffer.add(new EmptyPropertyToken(type, key));
return false;
} | java | public static boolean isValidStringMinLength(final GraphObject node, final PropertyKey<String> key, final int minLength, final ErrorBuffer errorBuffer) {
String value = node.getProperty(key);
String type = node.getType();
if (StringUtils.isNotBlank(value)) {
if (value.length() >= minLength) {
return true;
}
errorBuffer.add(new TooShortToken(type, key, minLength));
return false;
}
errorBuffer.add(new EmptyPropertyToken(type, key));
return false;
} | [
"public",
"static",
"boolean",
"isValidStringMinLength",
"(",
"final",
"GraphObject",
"node",
",",
"final",
"PropertyKey",
"<",
"String",
">",
"key",
",",
"final",
"int",
"minLength",
",",
"final",
"ErrorBuffer",
"errorBuffer",
")",
"{",
"String",
"value",
"=",
... | Checks whether the value for the given property key of the given node
has at least the given length.
@param node the node
@param key the property key whose value should be checked
@param minLength the min length
@param errorBuffer the error buffer
@return true if the condition is valid | [
"Checks",
"whether",
"the",
"value",
"for",
"the",
"given",
"property",
"key",
"of",
"the",
"given",
"node",
"has",
"at",
"least",
"the",
"given",
"length",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/ValidationHelper.java#L70-L90 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getGuildMemberInfo | public void getGuildMemberInfo(String id, String api, Callback<List<GuildMember>> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on guild member API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/:id/members">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions<br/>
@param id guild id
@param api Guild leader's Guild Wars 2 API key
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see GuildMember guild member info
"""
isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api));
gw2API.getGuildMemberInfo(id, api).enqueue(callback);
} | java | public void getGuildMemberInfo(String id, String api, Callback<List<GuildMember>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api));
gw2API.getGuildMemberInfo(id, api).enqueue(callback);
} | [
"public",
"void",
"getGuildMemberInfo",
"(",
"String",
"id",
",",
"String",
"api",
",",
"Callback",
"<",
"List",
"<",
"GuildMember",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamC... | For more info on guild member API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/:id/members">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions<br/>
@param id guild id
@param api Guild leader's Guild Wars 2 API key
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws NullPointerException if given {@link Callback} is empty
@see GuildMember guild member info | [
"For",
"more",
"info",
"on",
"guild",
"member",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"guild",
"/",
":",
"id",
"/",
"members",
">",
"here<",
"/",
"a",
... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1501-L1504 |
aspectran/aspectran | shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java | DefaultOptionParser.isShortOption | private boolean isShortOption(String token) {
"""
Tells if the token looks like a short option.
@param token the command line token to handle
@return true if the token like a short option
"""
// short options (-S, -SV, -S=V, -SV1=V2, -S1S2)
if (!token.startsWith("-") || token.length() == 1) {
return false;
}
// remove leading "-" and "=value"
int pos = token.indexOf("=");
String name = (pos == -1 ? token.substring(1) : token.substring(1, pos));
if (options.hasShortOption(name)) {
return true;
}
// check for several concatenated short options
return (name.length() > 0 && options.hasShortOption(String.valueOf(name.charAt(0))));
} | java | private boolean isShortOption(String token) {
// short options (-S, -SV, -S=V, -SV1=V2, -S1S2)
if (!token.startsWith("-") || token.length() == 1) {
return false;
}
// remove leading "-" and "=value"
int pos = token.indexOf("=");
String name = (pos == -1 ? token.substring(1) : token.substring(1, pos));
if (options.hasShortOption(name)) {
return true;
}
// check for several concatenated short options
return (name.length() > 0 && options.hasShortOption(String.valueOf(name.charAt(0))));
} | [
"private",
"boolean",
"isShortOption",
"(",
"String",
"token",
")",
"{",
"// short options (-S, -SV, -S=V, -SV1=V2, -S1S2)",
"if",
"(",
"!",
"token",
".",
"startsWith",
"(",
"\"-\"",
")",
"||",
"token",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"return",
... | Tells if the token looks like a short option.
@param token the command line token to handle
@return true if the token like a short option | [
"Tells",
"if",
"the",
"token",
"looks",
"like",
"a",
"short",
"option",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java#L493-L506 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/ResourceHealthMetadatasInner.java | ResourceHealthMetadatasInner.getBySiteSlot | public ResourceHealthMetadataInner getBySiteSlot(String resourceGroupName, String name, String slot) {
"""
Gets the category of ResourceHealthMetadata to use for the given site.
Gets the category of ResourceHealthMetadata to use for the given site.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of web app
@param slot Name of web app slot. If not specified then will default to production slot.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ResourceHealthMetadataInner object if successful.
"""
return getBySiteSlotWithServiceResponseAsync(resourceGroupName, name, slot).toBlocking().single().body();
} | java | public ResourceHealthMetadataInner getBySiteSlot(String resourceGroupName, String name, String slot) {
return getBySiteSlotWithServiceResponseAsync(resourceGroupName, name, slot).toBlocking().single().body();
} | [
"public",
"ResourceHealthMetadataInner",
"getBySiteSlot",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"slot",
")",
"{",
"return",
"getBySiteSlotWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"slot",
")",
".",
"toBl... | Gets the category of ResourceHealthMetadata to use for the given site.
Gets the category of ResourceHealthMetadata to use for the given site.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of web app
@param slot Name of web app slot. If not specified then will default to production slot.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ResourceHealthMetadataInner object if successful. | [
"Gets",
"the",
"category",
"of",
"ResourceHealthMetadata",
"to",
"use",
"for",
"the",
"given",
"site",
".",
"Gets",
"the",
"category",
"of",
"ResourceHealthMetadata",
"to",
"use",
"for",
"the",
"given",
"site",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/ResourceHealthMetadatasInner.java#L701-L703 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionHandle.java | ConnectionHandle.getConnectionHandle | public static ConnectionHandle getConnectionHandle(VirtualConnection vc) {
"""
Get ConnectionHandle stored in VirtualConnection state map (if one isn't
there already, assign one).
@param vc
@return ConnectionHandle
"""
if (vc == null) {
return null;
}
ConnectionHandle connHandle = (ConnectionHandle) vc.getStateMap().get(CONNECTION_HANDLE_VC_KEY);
// We can be here for two reasons:
// a) We have one, just needed to find it in VC state map
if (connHandle != null)
return connHandle;
// b) We want a new one
connHandle = factory.createConnectionHandle();
// For some connections (outbound, most notably), the connection type
// will be set on the VC before connect... in which case, read it
// and set it on the connection handle at the earliest point
// possible.
if (connHandle != null) {
connHandle.setConnectionType(vc);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getConnectionHandle - created new connection handle: " + connHandle);
}
setConnectionHandle(vc, connHandle);
return connHandle;
} | java | public static ConnectionHandle getConnectionHandle(VirtualConnection vc) {
if (vc == null) {
return null;
}
ConnectionHandle connHandle = (ConnectionHandle) vc.getStateMap().get(CONNECTION_HANDLE_VC_KEY);
// We can be here for two reasons:
// a) We have one, just needed to find it in VC state map
if (connHandle != null)
return connHandle;
// b) We want a new one
connHandle = factory.createConnectionHandle();
// For some connections (outbound, most notably), the connection type
// will be set on the VC before connect... in which case, read it
// and set it on the connection handle at the earliest point
// possible.
if (connHandle != null) {
connHandle.setConnectionType(vc);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "getConnectionHandle - created new connection handle: " + connHandle);
}
setConnectionHandle(vc, connHandle);
return connHandle;
} | [
"public",
"static",
"ConnectionHandle",
"getConnectionHandle",
"(",
"VirtualConnection",
"vc",
")",
"{",
"if",
"(",
"vc",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ConnectionHandle",
"connHandle",
"=",
"(",
"ConnectionHandle",
")",
"vc",
".",
"getSt... | Get ConnectionHandle stored in VirtualConnection state map (if one isn't
there already, assign one).
@param vc
@return ConnectionHandle | [
"Get",
"ConnectionHandle",
"stored",
"in",
"VirtualConnection",
"state",
"map",
"(",
"if",
"one",
"isn",
"t",
"there",
"already",
"assign",
"one",
")",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/connmgmt/ConnectionHandle.java#L68-L97 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java | ZooKeeperUtils.createCheckpointIDCounter | public static ZooKeeperCheckpointIDCounter createCheckpointIDCounter(
CuratorFramework client,
Configuration configuration,
JobID jobId) {
"""
Creates a {@link ZooKeeperCheckpointIDCounter} instance.
@param client The {@link CuratorFramework} ZooKeeper client to use
@param configuration {@link Configuration} object
@param jobId ID of job to create the instance for
@return {@link ZooKeeperCheckpointIDCounter} instance
"""
String checkpointIdCounterPath = configuration.getString(
HighAvailabilityOptions.HA_ZOOKEEPER_CHECKPOINT_COUNTER_PATH);
checkpointIdCounterPath += ZooKeeperSubmittedJobGraphStore.getPathForJob(jobId);
return new ZooKeeperCheckpointIDCounter(client, checkpointIdCounterPath);
} | java | public static ZooKeeperCheckpointIDCounter createCheckpointIDCounter(
CuratorFramework client,
Configuration configuration,
JobID jobId) {
String checkpointIdCounterPath = configuration.getString(
HighAvailabilityOptions.HA_ZOOKEEPER_CHECKPOINT_COUNTER_PATH);
checkpointIdCounterPath += ZooKeeperSubmittedJobGraphStore.getPathForJob(jobId);
return new ZooKeeperCheckpointIDCounter(client, checkpointIdCounterPath);
} | [
"public",
"static",
"ZooKeeperCheckpointIDCounter",
"createCheckpointIDCounter",
"(",
"CuratorFramework",
"client",
",",
"Configuration",
"configuration",
",",
"JobID",
"jobId",
")",
"{",
"String",
"checkpointIdCounterPath",
"=",
"configuration",
".",
"getString",
"(",
"H... | Creates a {@link ZooKeeperCheckpointIDCounter} instance.
@param client The {@link CuratorFramework} ZooKeeper client to use
@param configuration {@link Configuration} object
@param jobId ID of job to create the instance for
@return {@link ZooKeeperCheckpointIDCounter} instance | [
"Creates",
"a",
"{",
"@link",
"ZooKeeperCheckpointIDCounter",
"}",
"instance",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java#L331-L342 |
lets-blade/blade | src/main/java/com/blade/kit/PatternKit.java | PatternKit.isImage | public static boolean isImage(String suffix) {
"""
Verify that the suffix is a picture format.
@param suffix filename suffix
@return verify that success returns true, and the failure returns false.
"""
if (null != suffix && !"".equals(suffix) && suffix.contains(".")) {
String regex = "(.*?)(?i)(jpg|jpeg|png|gif|bmp|webp)";
return isMatch(regex, suffix);
}
return false;
} | java | public static boolean isImage(String suffix) {
if (null != suffix && !"".equals(suffix) && suffix.contains(".")) {
String regex = "(.*?)(?i)(jpg|jpeg|png|gif|bmp|webp)";
return isMatch(regex, suffix);
}
return false;
} | [
"public",
"static",
"boolean",
"isImage",
"(",
"String",
"suffix",
")",
"{",
"if",
"(",
"null",
"!=",
"suffix",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"suffix",
")",
"&&",
"suffix",
".",
"contains",
"(",
"\".\"",
")",
")",
"{",
"String",
"regex",
"="... | Verify that the suffix is a picture format.
@param suffix filename suffix
@return verify that success returns true, and the failure returns false. | [
"Verify",
"that",
"the",
"suffix",
"is",
"a",
"picture",
"format",
"."
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/PatternKit.java#L61-L67 |
hypercube1024/firefly | firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java | ScriptUtils.containsSqlScriptDelimiters | public static boolean containsSqlScriptDelimiters(String script, String delim) {
"""
Does the provided SQL script contain the specified delimiter?
@param script the SQL script
@param delim String delimiting each statement - typically a ';' character
"""
boolean inLiteral = false;
char[] content = script.toCharArray();
for (int i = 0; i < script.length(); i++) {
if (content[i] == '\'') {
inLiteral = !inLiteral;
}
if (!inLiteral && script.startsWith(delim, i)) {
return true;
}
}
return false;
} | java | public static boolean containsSqlScriptDelimiters(String script, String delim) {
boolean inLiteral = false;
char[] content = script.toCharArray();
for (int i = 0; i < script.length(); i++) {
if (content[i] == '\'') {
inLiteral = !inLiteral;
}
if (!inLiteral && script.startsWith(delim, i)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"containsSqlScriptDelimiters",
"(",
"String",
"script",
",",
"String",
"delim",
")",
"{",
"boolean",
"inLiteral",
"=",
"false",
";",
"char",
"[",
"]",
"content",
"=",
"script",
".",
"toCharArray",
"(",
")",
";",
"for",
"(",
"... | Does the provided SQL script contain the specified delimiter?
@param script the SQL script
@param delim String delimiting each statement - typically a ';' character | [
"Does",
"the",
"provided",
"SQL",
"script",
"contain",
"the",
"specified",
"delimiter?"
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java#L335-L347 |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java | AStar.addToPath | protected boolean addToPath(GP path, ST segment) {
"""
Add the given segment into the given path.
<p>By default this function invokes the path factory
passed as parameter of the constructor.
@param path is the path to build.
@param segment is the segment to add.
@return <code>true</code> if the segment was added;
otherwise <code>false</code>.
"""
if (this.pathFactory != null) {
return this.pathFactory.addToPath(path, segment);
}
assert path != null;
assert segment != null;
try {
return path.add(segment);
} catch (Throwable e) {
throw new IllegalStateException(e);
}
} | java | protected boolean addToPath(GP path, ST segment) {
if (this.pathFactory != null) {
return this.pathFactory.addToPath(path, segment);
}
assert path != null;
assert segment != null;
try {
return path.add(segment);
} catch (Throwable e) {
throw new IllegalStateException(e);
}
} | [
"protected",
"boolean",
"addToPath",
"(",
"GP",
"path",
",",
"ST",
"segment",
")",
"{",
"if",
"(",
"this",
".",
"pathFactory",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"pathFactory",
".",
"addToPath",
"(",
"path",
",",
"segment",
")",
";",
"}",
... | Add the given segment into the given path.
<p>By default this function invokes the path factory
passed as parameter of the constructor.
@param path is the path to build.
@param segment is the segment to add.
@return <code>true</code> if the segment was added;
otherwise <code>false</code>. | [
"Add",
"the",
"given",
"segment",
"into",
"the",
"given",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L391-L402 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/jumbotron/JumbotronRenderer.java | JumbotronRenderer.encodeEnd | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
"""
This methods generates the HTML code of the current b:jumbotron.
<code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:jumbotron.
@throws IOException thrown if something goes wrong when writing the HTML code.
"""
if (!component.isRendered()) {
return;
}
Jumbotron jumbotron = (Jumbotron) component;
ResponseWriter rw = context.getResponseWriter();
endDisabledFieldset(jumbotron, rw);
rw.endElement("div");
Tooltip.activateTooltips(context, jumbotron);
} | java | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Jumbotron jumbotron = (Jumbotron) component;
ResponseWriter rw = context.getResponseWriter();
endDisabledFieldset(jumbotron, rw);
rw.endElement("div");
Tooltip.activateTooltips(context, jumbotron);
} | [
"@",
"Override",
"public",
"void",
"encodeEnd",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Jumbotron",
"jumbotro... | This methods generates the HTML code of the current b:jumbotron.
<code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:jumbotron.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"jumbotron",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framework"... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/jumbotron/JumbotronRenderer.java#L81-L91 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/style/sld/RequestUtils.java | RequestUtils.getBufferedXMLReader | public static BufferedReader getBufferedXMLReader(Reader reader, int xmlLookahead)
throws IOException {
"""
Wraps an xml reader in a buffered reader specifying a lookahead that can be used to preparse
some of the xml document, resetting it back to its original state for actual parsing.
@param reader The original xml reader.
@param xmlLookahead The number of bytes to support for parse. If more than this number of
bytes are preparsed the stream can not be properly reset.
@return The buffered reader.
"""
// ensure the reader is a buffered reader
if (!(reader instanceof BufferedReader)) {
reader = new BufferedReader(reader);
}
// mark the input stream
reader.mark(xmlLookahead);
return (BufferedReader) reader;
} | java | public static BufferedReader getBufferedXMLReader(Reader reader, int xmlLookahead)
throws IOException {
// ensure the reader is a buffered reader
if (!(reader instanceof BufferedReader)) {
reader = new BufferedReader(reader);
}
// mark the input stream
reader.mark(xmlLookahead);
return (BufferedReader) reader;
} | [
"public",
"static",
"BufferedReader",
"getBufferedXMLReader",
"(",
"Reader",
"reader",
",",
"int",
"xmlLookahead",
")",
"throws",
"IOException",
"{",
"// ensure the reader is a buffered reader",
"if",
"(",
"!",
"(",
"reader",
"instanceof",
"BufferedReader",
")",
")",
... | Wraps an xml reader in a buffered reader specifying a lookahead that can be used to preparse
some of the xml document, resetting it back to its original state for actual parsing.
@param reader The original xml reader.
@param xmlLookahead The number of bytes to support for parse. If more than this number of
bytes are preparsed the stream can not be properly reset.
@return The buffered reader. | [
"Wraps",
"an",
"xml",
"reader",
"in",
"a",
"buffered",
"reader",
"specifying",
"a",
"lookahead",
"that",
"can",
"be",
"used",
"to",
"preparse",
"some",
"of",
"the",
"xml",
"document",
"resetting",
"it",
"back",
"to",
"its",
"original",
"state",
"for",
"act... | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/style/sld/RequestUtils.java#L243-L255 |
Netflix/ndbench | ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java | DynoJedisUtils.nonpipelineWrite | public String nonpipelineWrite(String key, DataGenerator dataGenerator) {
"""
a simple write without a pipeline
@param key
@return the result of write (i.e. "OK" if it was successful
"""
String value = key + "__" + dataGenerator.getRandomValue() + "__" + key;
String result = this.jedisClient.get().set(key, value);
if (!"OK".equals(result)) {
logger.error("SET_ERROR: GOT " + result + " for SET operation");
throw new RuntimeException(String.format("DynoJedis: value %s for SET operation is NOT VALID", value, key));
}
return result;
} | java | public String nonpipelineWrite(String key, DataGenerator dataGenerator) {
String value = key + "__" + dataGenerator.getRandomValue() + "__" + key;
String result = this.jedisClient.get().set(key, value);
if (!"OK".equals(result)) {
logger.error("SET_ERROR: GOT " + result + " for SET operation");
throw new RuntimeException(String.format("DynoJedis: value %s for SET operation is NOT VALID", value, key));
}
return result;
} | [
"public",
"String",
"nonpipelineWrite",
"(",
"String",
"key",
",",
"DataGenerator",
"dataGenerator",
")",
"{",
"String",
"value",
"=",
"key",
"+",
"\"__\"",
"+",
"dataGenerator",
".",
"getRandomValue",
"(",
")",
"+",
"\"__\"",
"+",
"key",
";",
"String",
"res... | a simple write without a pipeline
@param key
@return the result of write (i.e. "OK" if it was successful | [
"a",
"simple",
"write",
"without",
"a",
"pipeline"
] | train | https://github.com/Netflix/ndbench/blob/8d664244b5f9d01395248a296b86a3c822e6d764/ndbench-dyno-plugins/src/main/java/com/netflix/ndbench/plugin/dyno/DynoJedisUtils.java#L162-L173 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java | CommercePriceEntryPersistenceImpl.findByCompanyId | @Override
public List<CommercePriceEntry> findByCompanyId(long companyId, int start,
int end, OrderByComparator<CommercePriceEntry> orderByComparator) {
"""
Returns an ordered range of all the commerce price entries where companyId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePriceEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param companyId the company ID
@param start the lower bound of the range of commerce price entries
@param end the upper bound of the range of commerce price entries (not inclusive)
@param orderByComparator the comparator to order the results by (optionally <code>null</code>)
@return the ordered range of matching commerce price entries
"""
return findByCompanyId(companyId, start, end, orderByComparator, true);
} | java | @Override
public List<CommercePriceEntry> findByCompanyId(long companyId, int start,
int end, OrderByComparator<CommercePriceEntry> orderByComparator) {
return findByCompanyId(companyId, start, end, orderByComparator, true);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommercePriceEntry",
">",
"findByCompanyId",
"(",
"long",
"companyId",
",",
"int",
"start",
",",
"int",
"end",
",",
"OrderByComparator",
"<",
"CommercePriceEntry",
">",
"orderByComparator",
")",
"{",
"return",
"findByCompan... | Returns an ordered range of all the commerce price entries where companyId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePriceEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param companyId the company ID
@param start the lower bound of the range of commerce price entries
@param end the upper bound of the range of commerce price entries (not inclusive)
@param orderByComparator the comparator to order the results by (optionally <code>null</code>)
@return the ordered range of matching commerce price entries | [
"Returns",
"an",
"ordered",
"range",
"of",
"all",
"the",
"commerce",
"price",
"entries",
"where",
"companyId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java#L2065-L2069 |
apereo/cas | support/cas-server-support-x509-core/src/main/java/org/apereo/cas/adaptors/x509/authentication/revocation/checker/CRLDistributionPointRevocationChecker.java | CRLDistributionPointRevocationChecker.addURL | private static void addURL(final List<URI> list, final String uriString) {
"""
Adds the url to the list.
Build URI by components to facilitate proper encoding of querystring.
e.g. http://example.com:8085/ca?action=crl&issuer=CN=CAS Test User CA
<p>
<p>If {@code uriString} is encoded, it will be decoded with {@code UTF-8}
first before it's added to the list.</p>
@param list the list
@param uriString the uri string
"""
try {
try {
val url = new URL(URLDecoder.decode(uriString, StandardCharsets.UTF_8.name()));
list.add(new URI(url.getProtocol(), url.getAuthority(), url.getPath(), url.getQuery(), null));
} catch (final MalformedURLException e) {
list.add(new URI(uriString));
}
} catch (final Exception e) {
LOGGER.warn("[{}] is not a valid distribution point URI.", uriString);
}
} | java | private static void addURL(final List<URI> list, final String uriString) {
try {
try {
val url = new URL(URLDecoder.decode(uriString, StandardCharsets.UTF_8.name()));
list.add(new URI(url.getProtocol(), url.getAuthority(), url.getPath(), url.getQuery(), null));
} catch (final MalformedURLException e) {
list.add(new URI(uriString));
}
} catch (final Exception e) {
LOGGER.warn("[{}] is not a valid distribution point URI.", uriString);
}
} | [
"private",
"static",
"void",
"addURL",
"(",
"final",
"List",
"<",
"URI",
">",
"list",
",",
"final",
"String",
"uriString",
")",
"{",
"try",
"{",
"try",
"{",
"val",
"url",
"=",
"new",
"URL",
"(",
"URLDecoder",
".",
"decode",
"(",
"uriString",
",",
"St... | Adds the url to the list.
Build URI by components to facilitate proper encoding of querystring.
e.g. http://example.com:8085/ca?action=crl&issuer=CN=CAS Test User CA
<p>
<p>If {@code uriString} is encoded, it will be decoded with {@code UTF-8}
first before it's added to the list.</p>
@param list the list
@param uriString the uri string | [
"Adds",
"the",
"url",
"to",
"the",
"list",
".",
"Build",
"URI",
"by",
"components",
"to",
"facilitate",
"proper",
"encoding",
"of",
"querystring",
".",
"e",
".",
"g",
".",
"http",
":",
"//",
"example",
".",
"com",
":",
"8085",
"/",
"ca?action",
"=",
... | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-x509-core/src/main/java/org/apereo/cas/adaptors/x509/authentication/revocation/checker/CRLDistributionPointRevocationChecker.java#L151-L162 |
molgenis/molgenis | molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/OneClickImporterServiceImpl.java | OneClickImporterServiceImpl.createColumnFromCell | private Column createColumnFromCell(Sheet sheet, Cell cell) {
"""
Specific columntypes are permitted in the import. The supported columntypes are specified in
the method.
@param sheet worksheet
@param cell cell on worksheet
@return Column
"""
if (cell.getCellTypeEnum() == CellType.STRING) {
return Column.create(
cell.getStringCellValue(),
cell.getColumnIndex(),
getColumnDataFromSheet(sheet, cell.getColumnIndex()));
} else {
throw new MolgenisDataException(
String.format(
"Celltype [%s] is not supported for columnheaders", cell.getCellTypeEnum()));
}
} | java | private Column createColumnFromCell(Sheet sheet, Cell cell) {
if (cell.getCellTypeEnum() == CellType.STRING) {
return Column.create(
cell.getStringCellValue(),
cell.getColumnIndex(),
getColumnDataFromSheet(sheet, cell.getColumnIndex()));
} else {
throw new MolgenisDataException(
String.format(
"Celltype [%s] is not supported for columnheaders", cell.getCellTypeEnum()));
}
} | [
"private",
"Column",
"createColumnFromCell",
"(",
"Sheet",
"sheet",
",",
"Cell",
"cell",
")",
"{",
"if",
"(",
"cell",
".",
"getCellTypeEnum",
"(",
")",
"==",
"CellType",
".",
"STRING",
")",
"{",
"return",
"Column",
".",
"create",
"(",
"cell",
".",
"getSt... | Specific columntypes are permitted in the import. The supported columntypes are specified in
the method.
@param sheet worksheet
@param cell cell on worksheet
@return Column | [
"Specific",
"columntypes",
"are",
"permitted",
"in",
"the",
"import",
".",
"The",
"supported",
"columntypes",
"are",
"specified",
"in",
"the",
"method",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-one-click-importer/src/main/java/org/molgenis/oneclickimporter/service/impl/OneClickImporterServiceImpl.java#L171-L182 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/internal/DatabaseURIHelper.java | DatabaseURIHelper.documentUri | public URI documentUri(String documentId, Params params) {
"""
Returns URI for {@code documentId} with {@code query} key and value.
"""
return this.documentId(documentId).query(params).build();
} | java | public URI documentUri(String documentId, Params params) {
return this.documentId(documentId).query(params).build();
} | [
"public",
"URI",
"documentUri",
"(",
"String",
"documentId",
",",
"Params",
"params",
")",
"{",
"return",
"this",
".",
"documentId",
"(",
"documentId",
")",
".",
"query",
"(",
"params",
")",
".",
"build",
"(",
")",
";",
"}"
] | Returns URI for {@code documentId} with {@code query} key and value. | [
"Returns",
"URI",
"for",
"{"
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/internal/DatabaseURIHelper.java#L141-L143 |
apereo/cas | core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CollectionUtils.java | CollectionUtils.asMultiValueMap | public static MultiValueMap asMultiValueMap(final String key, final Object value) {
"""
As multi value map.
@param key the key
@param value the value
@return the multi value map
"""
return org.springframework.util.CollectionUtils.toMultiValueMap(wrap(key, value));
} | java | public static MultiValueMap asMultiValueMap(final String key, final Object value) {
return org.springframework.util.CollectionUtils.toMultiValueMap(wrap(key, value));
} | [
"public",
"static",
"MultiValueMap",
"asMultiValueMap",
"(",
"final",
"String",
"key",
",",
"final",
"Object",
"value",
")",
"{",
"return",
"org",
".",
"springframework",
".",
"util",
".",
"CollectionUtils",
".",
"toMultiValueMap",
"(",
"wrap",
"(",
"key",
","... | As multi value map.
@param key the key
@param value the value
@return the multi value map | [
"As",
"multi",
"value",
"map",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/CollectionUtils.java#L458-L460 |
bignerdranch/expandable-recycler-view | expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java | ExpandableRecyclerAdapter.onBindViewHolder | @Override
@SuppressWarnings("unchecked")
@UiThread
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int flatPosition) {
"""
Implementation of Adapter.onBindViewHolder(RecyclerView.ViewHolder, int)
that determines if the list item is a parent or a child and calls through
to the appropriate implementation of either
{@link #onBindParentViewHolder(ParentViewHolder, int, Parent)} or
{@link #onBindChildViewHolder(ChildViewHolder, int, int, Object)}.
@param holder The RecyclerView.ViewHolder to bind data to
@param flatPosition The index in the merged list of children and parents at which to bind
"""
if (flatPosition > mFlatItemList.size()) {
throw new IllegalStateException("Trying to bind item out of bounds, size " + mFlatItemList.size()
+ " flatPosition " + flatPosition + ". Was the data changed without a call to notify...()?");
}
ExpandableWrapper<P, C> listItem = mFlatItemList.get(flatPosition);
if (listItem.isParent()) {
PVH parentViewHolder = (PVH) holder;
if (parentViewHolder.shouldItemViewClickToggleExpansion()) {
parentViewHolder.setMainItemClickToExpand();
}
parentViewHolder.setExpanded(listItem.isExpanded());
parentViewHolder.mParent = listItem.getParent();
onBindParentViewHolder(parentViewHolder, getNearestParentPosition(flatPosition), listItem.getParent());
} else {
CVH childViewHolder = (CVH) holder;
childViewHolder.mChild = listItem.getChild();
onBindChildViewHolder(childViewHolder, getNearestParentPosition(flatPosition), getChildPosition(flatPosition), listItem.getChild());
}
} | java | @Override
@SuppressWarnings("unchecked")
@UiThread
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int flatPosition) {
if (flatPosition > mFlatItemList.size()) {
throw new IllegalStateException("Trying to bind item out of bounds, size " + mFlatItemList.size()
+ " flatPosition " + flatPosition + ". Was the data changed without a call to notify...()?");
}
ExpandableWrapper<P, C> listItem = mFlatItemList.get(flatPosition);
if (listItem.isParent()) {
PVH parentViewHolder = (PVH) holder;
if (parentViewHolder.shouldItemViewClickToggleExpansion()) {
parentViewHolder.setMainItemClickToExpand();
}
parentViewHolder.setExpanded(listItem.isExpanded());
parentViewHolder.mParent = listItem.getParent();
onBindParentViewHolder(parentViewHolder, getNearestParentPosition(flatPosition), listItem.getParent());
} else {
CVH childViewHolder = (CVH) holder;
childViewHolder.mChild = listItem.getChild();
onBindChildViewHolder(childViewHolder, getNearestParentPosition(flatPosition), getChildPosition(flatPosition), listItem.getChild());
}
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"UiThread",
"public",
"void",
"onBindViewHolder",
"(",
"@",
"NonNull",
"RecyclerView",
".",
"ViewHolder",
"holder",
",",
"int",
"flatPosition",
")",
"{",
"if",
"(",
"flatPosition",
">",
... | Implementation of Adapter.onBindViewHolder(RecyclerView.ViewHolder, int)
that determines if the list item is a parent or a child and calls through
to the appropriate implementation of either
{@link #onBindParentViewHolder(ParentViewHolder, int, Parent)} or
{@link #onBindChildViewHolder(ChildViewHolder, int, int, Object)}.
@param holder The RecyclerView.ViewHolder to bind data to
@param flatPosition The index in the merged list of children and parents at which to bind | [
"Implementation",
"of",
"Adapter",
".",
"onBindViewHolder",
"(",
"RecyclerView",
".",
"ViewHolder",
"int",
")",
"that",
"determines",
"if",
"the",
"list",
"item",
"is",
"a",
"parent",
"or",
"a",
"child",
"and",
"calls",
"through",
"to",
"the",
"appropriate",
... | train | https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L163-L188 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java | SerializedFormWriterImpl.getClassHeader | public Content getClassHeader(ClassDoc classDoc) {
"""
Get the serializable class heading.
@param classDoc the class being processed
@return a content tree for the class header
"""
Content classLink = (classDoc.isPublic() || classDoc.isProtected()) ?
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, classDoc)
.label(configuration.getClassName(classDoc))) :
new StringContent(classDoc.qualifiedName());
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
classDoc.qualifiedName()));
Content superClassLink =
classDoc.superclassType() != null ?
getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.SERIALIZED_FORM,
classDoc.superclassType())) :
null;
//Print the heading.
Content className = superClassLink == null ?
configuration.getResource(
"doclet.Class_0_implements_serializable", classLink) :
configuration.getResource(
"doclet.Class_0_extends_implements_serializable", classLink,
superClassLink);
li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
className));
return li;
} | java | public Content getClassHeader(ClassDoc classDoc) {
Content classLink = (classDoc.isPublic() || classDoc.isProtected()) ?
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, classDoc)
.label(configuration.getClassName(classDoc))) :
new StringContent(classDoc.qualifiedName());
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(
classDoc.qualifiedName()));
Content superClassLink =
classDoc.superclassType() != null ?
getLink(new LinkInfoImpl(configuration,
LinkInfoImpl.Kind.SERIALIZED_FORM,
classDoc.superclassType())) :
null;
//Print the heading.
Content className = superClassLink == null ?
configuration.getResource(
"doclet.Class_0_implements_serializable", classLink) :
configuration.getResource(
"doclet.Class_0_extends_implements_serializable", classLink,
superClassLink);
li.addContent(HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
className));
return li;
} | [
"public",
"Content",
"getClassHeader",
"(",
"ClassDoc",
"classDoc",
")",
"{",
"Content",
"classLink",
"=",
"(",
"classDoc",
".",
"isPublic",
"(",
")",
"||",
"classDoc",
".",
"isProtected",
"(",
")",
")",
"?",
"getLink",
"(",
"new",
"LinkInfoImpl",
"(",
"co... | Get the serializable class heading.
@param classDoc the class being processed
@return a content tree for the class header | [
"Get",
"the",
"serializable",
"class",
"heading",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/SerializedFormWriterImpl.java#L129-L153 |
phax/ph-commons | ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java | AbstractMapBasedWALDAO._addItem | @MustBeLocked (ELockType.WRITE)
private void _addItem (@Nonnull final IMPLTYPE aItem, @Nonnull final EDAOActionType eActionType) {
"""
Add or update an item. Must only be invoked inside a write-lock.
@param aItem
The item to be added or updated
@param eActionType
The action type. Must be CREATE or UPDATE!
@throws IllegalArgumentException
If on CREATE an item with the same ID is already contained. If on
UPDATE an item with the provided ID does NOT exist.
"""
ValueEnforcer.notNull (aItem, "Item");
ValueEnforcer.isTrue (eActionType == EDAOActionType.CREATE || eActionType == EDAOActionType.UPDATE,
"Invalid action type provided!");
final String sID = aItem.getID ();
final IMPLTYPE aOldItem = m_aMap.get (sID);
if (eActionType == EDAOActionType.CREATE)
{
if (aOldItem != null)
throw new IllegalArgumentException (ClassHelper.getClassLocalName (getDataTypeClass ()) +
" with ID '" +
sID +
"' is already in use and can therefore not be created again. Old item = " +
aOldItem +
"; New item = " +
aItem);
}
else
{
// Update
if (aOldItem == null)
throw new IllegalArgumentException (ClassHelper.getClassLocalName (getDataTypeClass ()) +
" with ID '" +
sID +
"' is not yet in use and can therefore not be updated! Updated item = " +
aItem);
}
m_aMap.put (sID, aItem);
} | java | @MustBeLocked (ELockType.WRITE)
private void _addItem (@Nonnull final IMPLTYPE aItem, @Nonnull final EDAOActionType eActionType)
{
ValueEnforcer.notNull (aItem, "Item");
ValueEnforcer.isTrue (eActionType == EDAOActionType.CREATE || eActionType == EDAOActionType.UPDATE,
"Invalid action type provided!");
final String sID = aItem.getID ();
final IMPLTYPE aOldItem = m_aMap.get (sID);
if (eActionType == EDAOActionType.CREATE)
{
if (aOldItem != null)
throw new IllegalArgumentException (ClassHelper.getClassLocalName (getDataTypeClass ()) +
" with ID '" +
sID +
"' is already in use and can therefore not be created again. Old item = " +
aOldItem +
"; New item = " +
aItem);
}
else
{
// Update
if (aOldItem == null)
throw new IllegalArgumentException (ClassHelper.getClassLocalName (getDataTypeClass ()) +
" with ID '" +
sID +
"' is not yet in use and can therefore not be updated! Updated item = " +
aItem);
}
m_aMap.put (sID, aItem);
} | [
"@",
"MustBeLocked",
"(",
"ELockType",
".",
"WRITE",
")",
"private",
"void",
"_addItem",
"(",
"@",
"Nonnull",
"final",
"IMPLTYPE",
"aItem",
",",
"@",
"Nonnull",
"final",
"EDAOActionType",
"eActionType",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aItem",
... | Add or update an item. Must only be invoked inside a write-lock.
@param aItem
The item to be added or updated
@param eActionType
The action type. Must be CREATE or UPDATE!
@throws IllegalArgumentException
If on CREATE an item with the same ID is already contained. If on
UPDATE an item with the provided ID does NOT exist. | [
"Add",
"or",
"update",
"an",
"item",
".",
"Must",
"only",
"be",
"invoked",
"inside",
"a",
"write",
"-",
"lock",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java#L240-L272 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/SelectionImpl.java | SelectionImpl.selectRange | @Override
public void selectRange(int startParagraphIndex, int startColPosition, int endParagraphIndex, int endColPosition) {
"""
/* ********************************************************************** *
*
Actions *
*
Actions change the state of this control. They typically cause a *
change of one or more observables and/or produce an event. *
*
**********************************************************************
"""
selectRange(textPosition(startParagraphIndex, startColPosition), textPosition(endParagraphIndex, endColPosition));
} | java | @Override
public void selectRange(int startParagraphIndex, int startColPosition, int endParagraphIndex, int endColPosition) {
selectRange(textPosition(startParagraphIndex, startColPosition), textPosition(endParagraphIndex, endColPosition));
} | [
"@",
"Override",
"public",
"void",
"selectRange",
"(",
"int",
"startParagraphIndex",
",",
"int",
"startColPosition",
",",
"int",
"endParagraphIndex",
",",
"int",
"endColPosition",
")",
"{",
"selectRange",
"(",
"textPosition",
"(",
"startParagraphIndex",
",",
"startC... | /* ********************************************************************** *
*
Actions *
*
Actions change the state of this control. They typically cause a *
change of one or more observables and/or produce an event. *
*
********************************************************************** | [
"/",
"*",
"**********************************************************************",
"*",
"*",
"Actions",
"*",
"*",
"Actions",
"change",
"the",
"state",
"of",
"this",
"control",
".",
"They",
"typically",
"cause",
"a",
"*",
"change",
"of",
"one",
"or",
"more",
"obse... | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/SelectionImpl.java#L308-L311 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java | PlacesApi.findByLatLon | public Places findByLatLon(Float latitude, Float longitude, Integer accuracy) throws JinxException {
"""
Return a place ID for a latitude, longitude and accuracy triple.
<p>
The flickr.places.findByLatLon method is not meant to be a (reverse) geocoder in the
traditional sense. It is designed to allow users to find photos for "places" and will
round up to the nearest place type to which corresponding place IDs apply.
<p>
For example, if you pass it a street level coordinate it will return the city that contains
the point rather than the street, or building, itself.
<p>
It will also truncate latitudes and longitudes to three decimal points.
Authentication
<p>
This method does not require authentication.
@param latitude the latitude whose valid range is -90 to 90. Anything more than 4 decimal
places will be truncated. (Required)
@param longitude the longitude whose valid range is -180 to 180. Anything more than 4 decimal
places will be truncated. (Required)
@param accuracy Recorded accuracy level of the location information.
World level is 1, Country is ~3, Region ~6, City ~11, Street ~16.
Current range is 1-16. The default is 16. (Optional)
@return places that match the location criteria.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.places.findByLatLon.html">flickr.places.findByLatLon</a>
"""
JinxUtils.validateParams(latitude, longitude);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.places.findByLatLon");
params.put("lat", latitude.toString());
params.put("lon", longitude.toString());
if (accuracy != null) {
params.put("accuracy", accuracy.toString());
}
return jinx.flickrGet(params, Places.class, false);
} | java | public Places findByLatLon(Float latitude, Float longitude, Integer accuracy) throws JinxException {
JinxUtils.validateParams(latitude, longitude);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.places.findByLatLon");
params.put("lat", latitude.toString());
params.put("lon", longitude.toString());
if (accuracy != null) {
params.put("accuracy", accuracy.toString());
}
return jinx.flickrGet(params, Places.class, false);
} | [
"public",
"Places",
"findByLatLon",
"(",
"Float",
"latitude",
",",
"Float",
"longitude",
",",
"Integer",
"accuracy",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"latitude",
",",
"longitude",
")",
";",
"Map",
"<",
"String",
","... | Return a place ID for a latitude, longitude and accuracy triple.
<p>
The flickr.places.findByLatLon method is not meant to be a (reverse) geocoder in the
traditional sense. It is designed to allow users to find photos for "places" and will
round up to the nearest place type to which corresponding place IDs apply.
<p>
For example, if you pass it a street level coordinate it will return the city that contains
the point rather than the street, or building, itself.
<p>
It will also truncate latitudes and longitudes to three decimal points.
Authentication
<p>
This method does not require authentication.
@param latitude the latitude whose valid range is -90 to 90. Anything more than 4 decimal
places will be truncated. (Required)
@param longitude the longitude whose valid range is -180 to 180. Anything more than 4 decimal
places will be truncated. (Required)
@param accuracy Recorded accuracy level of the location information.
World level is 1, Country is ~3, Region ~6, City ~11, Street ~16.
Current range is 1-16. The default is 16. (Optional)
@return places that match the location criteria.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.places.findByLatLon.html">flickr.places.findByLatLon</a> | [
"Return",
"a",
"place",
"ID",
"for",
"a",
"latitude",
"longitude",
"and",
"accuracy",
"triple",
".",
"<p",
">",
"The",
"flickr",
".",
"places",
".",
"findByLatLon",
"method",
"is",
"not",
"meant",
"to",
"be",
"a",
"(",
"reverse",
")",
"geocoder",
"in",
... | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PlacesApi.java#L101-L111 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java | InternalUtils.ensureModuleConfig | public static ModuleConfig ensureModuleConfig( String modulePath, ServletContext context ) {
"""
Get the Struts ModuleConfig for the given module path. If there is none registered,
and if it is possible to register one automatically, do so.
"""
try
{
ModuleConfig ret = getModuleConfig( modulePath, context );
if ( ret != null )
{
return ret;
}
else
{
ActionServlet as = getActionServlet( context );
if ( as instanceof AutoRegisterActionServlet )
{
return ( ( AutoRegisterActionServlet ) as ).ensureModuleRegistered( modulePath );
}
}
}
catch ( IOException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
catch ( ServletException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
return null;
} | java | public static ModuleConfig ensureModuleConfig( String modulePath, ServletContext context )
{
try
{
ModuleConfig ret = getModuleConfig( modulePath, context );
if ( ret != null )
{
return ret;
}
else
{
ActionServlet as = getActionServlet( context );
if ( as instanceof AutoRegisterActionServlet )
{
return ( ( AutoRegisterActionServlet ) as ).ensureModuleRegistered( modulePath );
}
}
}
catch ( IOException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
catch ( ServletException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
return null;
} | [
"public",
"static",
"ModuleConfig",
"ensureModuleConfig",
"(",
"String",
"modulePath",
",",
"ServletContext",
"context",
")",
"{",
"try",
"{",
"ModuleConfig",
"ret",
"=",
"getModuleConfig",
"(",
"modulePath",
",",
"context",
")",
";",
"if",
"(",
"ret",
"!=",
"... | Get the Struts ModuleConfig for the given module path. If there is none registered,
and if it is possible to register one automatically, do so. | [
"Get",
"the",
"Struts",
"ModuleConfig",
"for",
"the",
"given",
"module",
"path",
".",
"If",
"there",
"is",
"none",
"registered",
"and",
"if",
"it",
"is",
"possible",
"to",
"register",
"one",
"automatically",
"do",
"so",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L473-L503 |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/util/BrowserUtils.java | BrowserUtils.makeIECachingSafeUrl | public static String makeIECachingSafeUrl(String url, long unique) {
"""
Makes new unique URL to avoid IE caching.
@param url
@param unique
@return
"""
if (url.contains("timestamp=")) {
return url.replaceFirst("(.*)(timestamp=)(.*)([&#].*)", "$1$2" + unique + "$4")
.replaceFirst("(.*)(timestamp=)(.*)$", "$1$2" + unique);
} else {
return url.contains("?")
? url + "×tamp=" + unique
: url + "?timestamp=" + unique;
}
} | java | public static String makeIECachingSafeUrl(String url, long unique) {
if (url.contains("timestamp=")) {
return url.replaceFirst("(.*)(timestamp=)(.*)([&#].*)", "$1$2" + unique + "$4")
.replaceFirst("(.*)(timestamp=)(.*)$", "$1$2" + unique);
} else {
return url.contains("?")
? url + "×tamp=" + unique
: url + "?timestamp=" + unique;
}
} | [
"public",
"static",
"String",
"makeIECachingSafeUrl",
"(",
"String",
"url",
",",
"long",
"unique",
")",
"{",
"if",
"(",
"url",
".",
"contains",
"(",
"\"timestamp=\"",
")",
")",
"{",
"return",
"url",
".",
"replaceFirst",
"(",
"\"(.*)(timestamp=)(.*)([&#].*)\"",
... | Makes new unique URL to avoid IE caching.
@param url
@param unique
@return | [
"Makes",
"new",
"unique",
"URL",
"to",
"avoid",
"IE",
"caching",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/util/BrowserUtils.java#L38-L47 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/network/vlan_stats.java | vlan_stats.get | public static vlan_stats get(nitro_service service, Long id) throws Exception {
"""
Use this API to fetch statistics of vlan_stats resource of given name .
"""
vlan_stats obj = new vlan_stats();
obj.set_id(id);
vlan_stats response = (vlan_stats) obj.stat_resource(service);
return response;
} | java | public static vlan_stats get(nitro_service service, Long id) throws Exception{
vlan_stats obj = new vlan_stats();
obj.set_id(id);
vlan_stats response = (vlan_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"vlan_stats",
"get",
"(",
"nitro_service",
"service",
",",
"Long",
"id",
")",
"throws",
"Exception",
"{",
"vlan_stats",
"obj",
"=",
"new",
"vlan_stats",
"(",
")",
";",
"obj",
".",
"set_id",
"(",
"id",
")",
";",
"vlan_stats",
"response",... | Use this API to fetch statistics of vlan_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"vlan_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/network/vlan_stats.java#L241-L246 |
jbundle/jbundle | thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java | JDescTextField.init | public void init(int cols, String strDescription, ActionListener actionListener) {
"""
Constructor.
@param cols The columns for this text field.
@param strDescription The description to display when this component is blank.
@param actionListener The action listener for this field (must be removed and return added for this to work).
"""
m_strDescription = strDescription;
m_actionListener = actionListener;
this.setText(null);
this.addFocusListener(new FocusAdapter()
{ // Make sure a tab with a changed field triggers action performed.
String m_strOldValue;
public void focusGained(FocusEvent evt)
{
myFocusGained();
m_strOldValue = getText();
super.focusLost(evt);
}
public void focusLost(FocusEvent evt)
{
super.focusLost(evt);
myFocusLost();
if (m_actionListener != null)
if (!m_strOldValue.equalsIgnoreCase(getText()))
m_actionListener.actionPerformed(new ActionEvent(JDescTextField.this, evt.getID(), null));
}
});
this.setAlignmentX(LEFT_ALIGNMENT);
this.setAlignmentY(TOP_ALIGNMENT);
if (m_actionListener != null)
this.addActionListener(m_actionListener); // Validate on change
} | java | public void init(int cols, String strDescription, ActionListener actionListener)
{
m_strDescription = strDescription;
m_actionListener = actionListener;
this.setText(null);
this.addFocusListener(new FocusAdapter()
{ // Make sure a tab with a changed field triggers action performed.
String m_strOldValue;
public void focusGained(FocusEvent evt)
{
myFocusGained();
m_strOldValue = getText();
super.focusLost(evt);
}
public void focusLost(FocusEvent evt)
{
super.focusLost(evt);
myFocusLost();
if (m_actionListener != null)
if (!m_strOldValue.equalsIgnoreCase(getText()))
m_actionListener.actionPerformed(new ActionEvent(JDescTextField.this, evt.getID(), null));
}
});
this.setAlignmentX(LEFT_ALIGNMENT);
this.setAlignmentY(TOP_ALIGNMENT);
if (m_actionListener != null)
this.addActionListener(m_actionListener); // Validate on change
} | [
"public",
"void",
"init",
"(",
"int",
"cols",
",",
"String",
"strDescription",
",",
"ActionListener",
"actionListener",
")",
"{",
"m_strDescription",
"=",
"strDescription",
";",
"m_actionListener",
"=",
"actionListener",
";",
"this",
".",
"setText",
"(",
"null",
... | Constructor.
@param cols The columns for this text field.
@param strDescription The description to display when this component is blank.
@param actionListener The action listener for this field (must be removed and return added for this to work). | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JDescTextField.java#L79-L106 |
zanata/openprops | src/main/java/org/fedorahosted/openprops/Properties.java | Properties.setRawComment | public void setRawComment(String key, String rawComment) {
"""
Sets the "raw" comment for the specified key. Each line of the
comment must be either empty, whitespace-only, or preceded by a
comment marker ("#" or "!"). This is not enforced by this class.
<br>
Note: if you set a comment, you must set a corresponding value before
calling store or storeToXML.
@param key property key whose comment should be set
@param rawComment raw comment to go with property key, "" for no comment
"""
if (rawComment == null)
throw new NullPointerException();
Entry entry = props.get(key);
if (entry == null) {
entry = new Entry(rawComment, null);
props.put(key, entry);
} else {
entry.setRawComment(rawComment);
}
} | java | public void setRawComment(String key, String rawComment) {
if (rawComment == null)
throw new NullPointerException();
Entry entry = props.get(key);
if (entry == null) {
entry = new Entry(rawComment, null);
props.put(key, entry);
} else {
entry.setRawComment(rawComment);
}
} | [
"public",
"void",
"setRawComment",
"(",
"String",
"key",
",",
"String",
"rawComment",
")",
"{",
"if",
"(",
"rawComment",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"Entry",
"entry",
"=",
"props",
".",
"get",
"(",
"key",
")"... | Sets the "raw" comment for the specified key. Each line of the
comment must be either empty, whitespace-only, or preceded by a
comment marker ("#" or "!"). This is not enforced by this class.
<br>
Note: if you set a comment, you must set a corresponding value before
calling store or storeToXML.
@param key property key whose comment should be set
@param rawComment raw comment to go with property key, "" for no comment | [
"Sets",
"the",
"raw",
"comment",
"for",
"the",
"specified",
"key",
".",
"Each",
"line",
"of",
"the",
"comment",
"must",
"be",
"either",
"empty",
"whitespace",
"-",
"only",
"or",
"preceded",
"by",
"a",
"comment",
"marker",
"(",
"#",
"or",
"!",
")",
".",... | train | https://github.com/zanata/openprops/blob/46510e610a765e4a91b302fc0d6a2123ed589603/src/main/java/org/fedorahosted/openprops/Properties.java#L1253-L1263 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/Types.java | Types.appendArrayGenericType | @ObjectiveCName("appendArrayGenericType:types:")
public static void appendArrayGenericType(StringBuilder out, Type[] types) {
"""
Appends names of the {@code types} to {@code out} separated by commas.
"""
if (types.length == 0) {
return;
}
appendGenericType(out, types[0]);
for (int i = 1; i < types.length; i++) {
out.append(',');
appendGenericType(out, types[i]);
}
} | java | @ObjectiveCName("appendArrayGenericType:types:")
public static void appendArrayGenericType(StringBuilder out, Type[] types) {
if (types.length == 0) {
return;
}
appendGenericType(out, types[0]);
for (int i = 1; i < types.length; i++) {
out.append(',');
appendGenericType(out, types[i]);
}
} | [
"@",
"ObjectiveCName",
"(",
"\"appendArrayGenericType:types:\"",
")",
"public",
"static",
"void",
"appendArrayGenericType",
"(",
"StringBuilder",
"out",
",",
"Type",
"[",
"]",
"types",
")",
"{",
"if",
"(",
"types",
".",
"length",
"==",
"0",
")",
"{",
"return",... | Appends names of the {@code types} to {@code out} separated by commas. | [
"Appends",
"names",
"of",
"the",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/Types.java#L120-L130 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java | ScheduleExpressionParser.parseDate | private long parseDate(Date date, long defaultValue) // d666295 {
"""
Parses the date to milliseconds and rounds up to the nearest second.
@param date the date to parse
@param defaultValue the default value if the date is null
@return the rounded milliseconds
"""
if (date == null)
{
return defaultValue;
}
long value = date.getTime();
if (value > 0)
{
// Round up to the nearest second.
long remainder = value % 1000;
if (remainder != 0)
{
// Protect against overflow.
long newValue = value - remainder + 1000;
value = newValue > 0 || value < 0 ? newValue : Long.MAX_VALUE;
}
}
return value;
} | java | private long parseDate(Date date, long defaultValue) // d666295
{
if (date == null)
{
return defaultValue;
}
long value = date.getTime();
if (value > 0)
{
// Round up to the nearest second.
long remainder = value % 1000;
if (remainder != 0)
{
// Protect against overflow.
long newValue = value - remainder + 1000;
value = newValue > 0 || value < 0 ? newValue : Long.MAX_VALUE;
}
}
return value;
} | [
"private",
"long",
"parseDate",
"(",
"Date",
"date",
",",
"long",
"defaultValue",
")",
"// d666295",
"{",
"if",
"(",
"date",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"long",
"value",
"=",
"date",
".",
"getTime",
"(",
")",
";",
"if",
... | Parses the date to milliseconds and rounds up to the nearest second.
@param date the date to parse
@param defaultValue the default value if the date is null
@return the rounded milliseconds | [
"Parses",
"the",
"date",
"to",
"milliseconds",
"and",
"rounds",
"up",
"to",
"the",
"nearest",
"second",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ScheduleExpressionParser.java#L331-L353 |
leadware/jpersistence-tools | jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java | DAOValidatorHelper.isExpressionContainsENV | public static boolean isExpressionContainsENV(String expression) {
"""
Methode permettant de verifier si un chemin contient des variables d'environnement
@param expression Chaine a controler
@return Resultat de la verification
"""
// Si la chaine est vide : false
if(expression == null || expression.trim().length() == 0) {
// On retourne false
return false;
}
// On split
return isExpressionContainPattern(expression, ENV_CHAIN_PATTERN);
} | java | public static boolean isExpressionContainsENV(String expression) {
// Si la chaine est vide : false
if(expression == null || expression.trim().length() == 0) {
// On retourne false
return false;
}
// On split
return isExpressionContainPattern(expression, ENV_CHAIN_PATTERN);
} | [
"public",
"static",
"boolean",
"isExpressionContainsENV",
"(",
"String",
"expression",
")",
"{",
"// Si la chaine est vide : false\r",
"if",
"(",
"expression",
"==",
"null",
"||",
"expression",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{... | Methode permettant de verifier si un chemin contient des variables d'environnement
@param expression Chaine a controler
@return Resultat de la verification | [
"Methode",
"permettant",
"de",
"verifier",
"si",
"un",
"chemin",
"contient",
"des",
"variables",
"d",
"environnement"
] | train | https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L413-L424 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.validateNotNull | public void validateNotNull(Object object, String name) {
"""
Validates a given object to be not null
@param object The object to check
@param name The name of the field to display the error message
"""
validateNotNull(object, name, messages.get(Validation.NOTNULL_KEY.name(), name));
} | java | public void validateNotNull(Object object, String name) {
validateNotNull(object, name, messages.get(Validation.NOTNULL_KEY.name(), name));
} | [
"public",
"void",
"validateNotNull",
"(",
"Object",
"object",
",",
"String",
"name",
")",
"{",
"validateNotNull",
"(",
"object",
",",
"name",
",",
"messages",
".",
"get",
"(",
"Validation",
".",
"NOTNULL_KEY",
".",
"name",
"(",
")",
",",
"name",
")",
")"... | Validates a given object to be not null
@param object The object to check
@param name The name of the field to display the error message | [
"Validates",
"a",
"given",
"object",
"to",
"be",
"not",
"null"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L488-L490 |
michel-kraemer/bson4jackson | src/main/java/de/undercouch/bson4jackson/io/StaticBuffers.java | StaticBuffers.byteBuffer | public ByteBuffer byteBuffer(Key key, int minSize) {
"""
Creates or re-uses a {@link ByteBuffer} that has a minimum size. Calling
this method multiple times with the same key will always return the
same buffer, as long as it has the minimum size and is marked to be
re-used. Buffers that are allowed to be re-used should be released using
{@link #releaseByteBuffer(Key, ByteBuffer)}.
@param key the buffer's identifier
@param minSize the minimum size
@return the {@link ByteBuffer} instance
@see #charBuffer(Key, int)
"""
minSize = Math.max(minSize, GLOBAL_MIN_SIZE);
ByteBuffer r = _byteBuffers[key.ordinal()];
if (r == null || r.capacity() < minSize) {
r = ByteBuffer.allocate(minSize);
} else {
_byteBuffers[key.ordinal()] = null;
r.clear();
}
return r;
} | java | public ByteBuffer byteBuffer(Key key, int minSize) {
minSize = Math.max(minSize, GLOBAL_MIN_SIZE);
ByteBuffer r = _byteBuffers[key.ordinal()];
if (r == null || r.capacity() < minSize) {
r = ByteBuffer.allocate(minSize);
} else {
_byteBuffers[key.ordinal()] = null;
r.clear();
}
return r;
} | [
"public",
"ByteBuffer",
"byteBuffer",
"(",
"Key",
"key",
",",
"int",
"minSize",
")",
"{",
"minSize",
"=",
"Math",
".",
"max",
"(",
"minSize",
",",
"GLOBAL_MIN_SIZE",
")",
";",
"ByteBuffer",
"r",
"=",
"_byteBuffers",
"[",
"key",
".",
"ordinal",
"(",
")",
... | Creates or re-uses a {@link ByteBuffer} that has a minimum size. Calling
this method multiple times with the same key will always return the
same buffer, as long as it has the minimum size and is marked to be
re-used. Buffers that are allowed to be re-used should be released using
{@link #releaseByteBuffer(Key, ByteBuffer)}.
@param key the buffer's identifier
@param minSize the minimum size
@return the {@link ByteBuffer} instance
@see #charBuffer(Key, int) | [
"Creates",
"or",
"re",
"-",
"uses",
"a",
"{"
] | train | https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/io/StaticBuffers.java#L129-L140 |
TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchState.java | TouchState.canBeFoldedWith | boolean canBeFoldedWith(TouchState ts, boolean ignoreIDs) {
"""
Finds out whether two non-null states are identical in everything but
their touch point coordinates
@param ts the TouchState to compare to
@param ignoreIDs if true, ignore IDs when comparing points
"""
if (ts.pointCount != pointCount) {
return false;
}
if (ignoreIDs) {
return true;
}
for (int i = 0; i < pointCount; i++) {
if (ts.points[i].id != points[i].id) {
return false;
}
}
return true;
} | java | boolean canBeFoldedWith(TouchState ts, boolean ignoreIDs) {
if (ts.pointCount != pointCount) {
return false;
}
if (ignoreIDs) {
return true;
}
for (int i = 0; i < pointCount; i++) {
if (ts.points[i].id != points[i].id) {
return false;
}
}
return true;
} | [
"boolean",
"canBeFoldedWith",
"(",
"TouchState",
"ts",
",",
"boolean",
"ignoreIDs",
")",
"{",
"if",
"(",
"ts",
".",
"pointCount",
"!=",
"pointCount",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"ignoreIDs",
")",
"{",
"return",
"true",
";",
"}",
"... | Finds out whether two non-null states are identical in everything but
their touch point coordinates
@param ts the TouchState to compare to
@param ignoreIDs if true, ignore IDs when comparing points | [
"Finds",
"out",
"whether",
"two",
"non",
"-",
"null",
"states",
"are",
"identical",
"in",
"everything",
"but",
"their",
"touch",
"point",
"coordinates"
] | train | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchState.java#L272-L285 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.searchRules | public JSONObject searchRules(RuleQuery query, RequestOptions requestOptions) throws AlgoliaException, JSONException {
"""
Search for query rules
@param query the query
@param requestOptions Options to pass to this request
"""
JSONObject body = new JSONObject();
if (query.getQuery() != null) {
body = body.put("query", query.getQuery());
}
if (query.getAnchoring() != null) {
body = body.put("anchoring", query.getAnchoring());
}
if (query.getContext() != null) {
body = body.put("context", query.getContext());
}
if (query.getPage() != null) {
body = body.put("page", query.getPage());
}
if (query.getHitsPerPage() != null) {
body = body.put("hitsPerPage", query.getHitsPerPage());
}
return client.postRequest("/1/indexes/" + encodedIndexName + "/rules/search", body.toString(), false, true, requestOptions);
} | java | public JSONObject searchRules(RuleQuery query, RequestOptions requestOptions) throws AlgoliaException, JSONException {
JSONObject body = new JSONObject();
if (query.getQuery() != null) {
body = body.put("query", query.getQuery());
}
if (query.getAnchoring() != null) {
body = body.put("anchoring", query.getAnchoring());
}
if (query.getContext() != null) {
body = body.put("context", query.getContext());
}
if (query.getPage() != null) {
body = body.put("page", query.getPage());
}
if (query.getHitsPerPage() != null) {
body = body.put("hitsPerPage", query.getHitsPerPage());
}
return client.postRequest("/1/indexes/" + encodedIndexName + "/rules/search", body.toString(), false, true, requestOptions);
} | [
"public",
"JSONObject",
"searchRules",
"(",
"RuleQuery",
"query",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
",",
"JSONException",
"{",
"JSONObject",
"body",
"=",
"new",
"JSONObject",
"(",
")",
";",
"if",
"(",
"query",
".",
"getQ... | Search for query rules
@param query the query
@param requestOptions Options to pass to this request | [
"Search",
"for",
"query",
"rules"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1857-L1876 |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/price/Price.java | Price.createFromGrossAmount | @Nonnull
public static Price createFromGrossAmount (@Nonnull final ICurrencyValue aGrossAmount,
@Nonnull final IVATItem aVATItem) {
"""
Create a price from a gross amount using the scale and rounding mode from
the currency.
@param aGrossAmount
The gross amount to use. May not be <code>null</code>.
@param aVATItem
The VAT item to use. May not be <code>null</code>.
@return The created {@link Price}
"""
ValueEnforcer.notNull (aGrossAmount, "GrossAmount");
final ECurrency eCurrency = aGrossAmount.getCurrency ();
final PerCurrencySettings aPCS = CurrencyHelper.getSettings (eCurrency);
return createFromGrossAmount (aGrossAmount, aVATItem, aPCS.getScale (), aPCS.getRoundingMode ());
} | java | @Nonnull
public static Price createFromGrossAmount (@Nonnull final ICurrencyValue aGrossAmount,
@Nonnull final IVATItem aVATItem)
{
ValueEnforcer.notNull (aGrossAmount, "GrossAmount");
final ECurrency eCurrency = aGrossAmount.getCurrency ();
final PerCurrencySettings aPCS = CurrencyHelper.getSettings (eCurrency);
return createFromGrossAmount (aGrossAmount, aVATItem, aPCS.getScale (), aPCS.getRoundingMode ());
} | [
"@",
"Nonnull",
"public",
"static",
"Price",
"createFromGrossAmount",
"(",
"@",
"Nonnull",
"final",
"ICurrencyValue",
"aGrossAmount",
",",
"@",
"Nonnull",
"final",
"IVATItem",
"aVATItem",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aGrossAmount",
",",
"\"Gros... | Create a price from a gross amount using the scale and rounding mode from
the currency.
@param aGrossAmount
The gross amount to use. May not be <code>null</code>.
@param aVATItem
The VAT item to use. May not be <code>null</code>.
@return The created {@link Price} | [
"Create",
"a",
"price",
"from",
"a",
"gross",
"amount",
"using",
"the",
"scale",
"and",
"rounding",
"mode",
"from",
"the",
"currency",
"."
] | train | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/price/Price.java#L318-L327 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/TableBuilder.java | TableBuilder.setColumnStyle | public void setColumnStyle(final int col, final TableColumnStyle ts) throws FastOdsException {
"""
Set the style of a column.
@param col The column number
@param ts The style to be used, make sure the style is of type
TableFamilyStyle.STYLEFAMILY_TABLECOLUMN
@throws FastOdsException Thrown if col has an invalid value.
"""
TableBuilder.checkCol(col);
this.stylesContainer.addContentFontFaceContainerStyle(ts);
ts.addToContentStyles(this.stylesContainer);
this.columnStyles.set(col, ts);
} | java | public void setColumnStyle(final int col, final TableColumnStyle ts) throws FastOdsException {
TableBuilder.checkCol(col);
this.stylesContainer.addContentFontFaceContainerStyle(ts);
ts.addToContentStyles(this.stylesContainer);
this.columnStyles.set(col, ts);
} | [
"public",
"void",
"setColumnStyle",
"(",
"final",
"int",
"col",
",",
"final",
"TableColumnStyle",
"ts",
")",
"throws",
"FastOdsException",
"{",
"TableBuilder",
".",
"checkCol",
"(",
"col",
")",
";",
"this",
".",
"stylesContainer",
".",
"addContentFontFaceContainer... | Set the style of a column.
@param col The column number
@param ts The style to be used, make sure the style is of type
TableFamilyStyle.STYLEFAMILY_TABLECOLUMN
@throws FastOdsException Thrown if col has an invalid value. | [
"Set",
"the",
"style",
"of",
"a",
"column",
"."
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableBuilder.java#L369-L374 |
savoirtech/eos | core/src/main/java/com/savoirtech/eos/util/ServiceProperties.java | ServiceProperties.getProperty | @SuppressWarnings("unchecked")
public <T> T getProperty(String key, T defaultValue) {
"""
Returns the service property value or the default value if the property is not present.
@param key the service property key
@param defaultValue the default value
@param <T> the property type
@return the property value or the default value
@throws ClassCastException if the service property is not of the specified type
"""
T value = (T) serviceReference.getProperty(key);
return value == null ? defaultValue : value;
} | java | @SuppressWarnings("unchecked")
public <T> T getProperty(String key, T defaultValue) {
T value = (T) serviceReference.getProperty(key);
return value == null ? defaultValue : value;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getProperty",
"(",
"String",
"key",
",",
"T",
"defaultValue",
")",
"{",
"T",
"value",
"=",
"(",
"T",
")",
"serviceReference",
".",
"getProperty",
"(",
"key",
")",
";",
"... | Returns the service property value or the default value if the property is not present.
@param key the service property key
@param defaultValue the default value
@param <T> the property type
@return the property value or the default value
@throws ClassCastException if the service property is not of the specified type | [
"Returns",
"the",
"service",
"property",
"value",
"or",
"the",
"default",
"value",
"if",
"the",
"property",
"is",
"not",
"present",
"."
] | train | https://github.com/savoirtech/eos/blob/76c5c6b149d64adb15c5b85b9f0d75620117f54b/core/src/main/java/com/savoirtech/eos/util/ServiceProperties.java#L64-L68 |
ontop/ontop | client/protege/src/main/java/it/unibz/inf/ontop/protege/utils/TextMessageFrame.java | TextMessageFrame.initComponents | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
"""
This method is called from within the constructor to
initialize the form.
WARNING: Do NOT modify this code. The content of this method is
always regenerated by the Form Editor.
"""
java.awt.GridBagConstraints gridBagConstraints;
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(700, 550));
getContentPane().setLayout(new java.awt.GridBagLayout());
jPanel1.setLayout(new java.awt.GridBagLayout());
jTextArea1.setColumns(20);
jTextArea1.setEditable(false);
jTextArea1.setRows(5);
jTextArea1.setWrapStyleWord(true);
jTextArea1.setBackground(Color.white);
jTextArea1.setFont(new Font("Dialog", Font.PLAIN, 12));
jScrollPane1.setViewportView(jTextArea1);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
jPanel1.add(jScrollPane1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.ipady = 5;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
jPanel1.add(jLabel1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.ipadx = 20;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
getContentPane().add(jPanel1, gridBagConstraints);
jButton1.setText("close");
jButton1.setMinimumSize(new java.awt.Dimension(60, 29));
jButton1.setPreferredSize(new java.awt.Dimension(75, 29));
jButton1.setRolloverEnabled(false);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
getContentPane().add(jButton1, gridBagConstraints);
pack();
} | java | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setMinimumSize(new java.awt.Dimension(700, 550));
getContentPane().setLayout(new java.awt.GridBagLayout());
jPanel1.setLayout(new java.awt.GridBagLayout());
jTextArea1.setColumns(20);
jTextArea1.setEditable(false);
jTextArea1.setRows(5);
jTextArea1.setWrapStyleWord(true);
jTextArea1.setBackground(Color.white);
jTextArea1.setFont(new Font("Dialog", Font.PLAIN, 12));
jScrollPane1.setViewportView(jTextArea1);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
jPanel1.add(jScrollPane1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.ipady = 5;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
jPanel1.add(jLabel1, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.ipadx = 20;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
getContentPane().add(jPanel1, gridBagConstraints);
jButton1.setText("close");
jButton1.setMinimumSize(new java.awt.Dimension(60, 29));
jButton1.setPreferredSize(new java.awt.Dimension(75, 29));
jButton1.setRolloverEnabled(false);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
getContentPane().add(jButton1, gridBagConstraints);
pack();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents",
"private",
"void",
"initComponents",
"(",
")",
"{",
"java",
".",
"awt",
".",
"GridBagConstraints",
"gridBagConstraints",
";",
"jP... | This method is called from within the constructor to
initialize the form.
WARNING: Do NOT modify this code. The content of this method is
always regenerated by the Form Editor. | [
"This",
"method",
"is",
"called",
"from",
"within",
"the",
"constructor",
"to",
"initialize",
"the",
"form",
".",
"WARNING",
":",
"Do",
"NOT",
"modify",
"this",
"code",
".",
"The",
"content",
"of",
"this",
"method",
"is",
"always",
"regenerated",
"by",
"th... | train | https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/client/protege/src/main/java/it/unibz/inf/ontop/protege/utils/TextMessageFrame.java#L56-L124 |
census-instrumentation/opencensus-java | exporters/trace/jaeger/src/main/java/io/opencensus/exporter/trace/jaeger/JaegerTraceExporter.java | JaegerTraceExporter.createWithSender | public static void createWithSender(final ThriftSender sender, final String serviceName) {
"""
Creates and registers the Jaeger Trace exporter to the OpenCensus library using the provided
HttpSender. Only one Jaeger exporter can be registered at any point.
@param sender the pre-configured ThriftSender to use with the exporter
@param serviceName the local service name of the process.
@throws IllegalStateException if a Jaeger exporter is already registered.
@since 0.17
"""
synchronized (monitor) {
checkState(handler == null, "Jaeger exporter is already registered.");
final SpanExporter.Handler newHandler = newHandlerWithSender(sender, serviceName);
JaegerTraceExporter.handler = newHandler;
register(Tracing.getExportComponent().getSpanExporter(), newHandler);
}
} | java | public static void createWithSender(final ThriftSender sender, final String serviceName) {
synchronized (monitor) {
checkState(handler == null, "Jaeger exporter is already registered.");
final SpanExporter.Handler newHandler = newHandlerWithSender(sender, serviceName);
JaegerTraceExporter.handler = newHandler;
register(Tracing.getExportComponent().getSpanExporter(), newHandler);
}
} | [
"public",
"static",
"void",
"createWithSender",
"(",
"final",
"ThriftSender",
"sender",
",",
"final",
"String",
"serviceName",
")",
"{",
"synchronized",
"(",
"monitor",
")",
"{",
"checkState",
"(",
"handler",
"==",
"null",
",",
"\"Jaeger exporter is already register... | Creates and registers the Jaeger Trace exporter to the OpenCensus library using the provided
HttpSender. Only one Jaeger exporter can be registered at any point.
@param sender the pre-configured ThriftSender to use with the exporter
@param serviceName the local service name of the process.
@throws IllegalStateException if a Jaeger exporter is already registered.
@since 0.17 | [
"Creates",
"and",
"registers",
"the",
"Jaeger",
"Trace",
"exporter",
"to",
"the",
"OpenCensus",
"library",
"using",
"the",
"provided",
"HttpSender",
".",
"Only",
"one",
"Jaeger",
"exporter",
"can",
"be",
"registered",
"at",
"any",
"point",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/exporters/trace/jaeger/src/main/java/io/opencensus/exporter/trace/jaeger/JaegerTraceExporter.java#L81-L88 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/helpers/FileMovingUtil.java | FileMovingUtil.createTempFile | private static File createTempFile(File baseFile) {
"""
Create a temporary File object. Prefix the name of the base file with an
underscore.
"""
File parentDirectory = baseFile.getParentFile();
String filename = baseFile.getName();
return new File(parentDirectory, '_' + filename);
} | java | private static File createTempFile(File baseFile) {
File parentDirectory = baseFile.getParentFile();
String filename = baseFile.getName();
return new File(parentDirectory, '_' + filename);
} | [
"private",
"static",
"File",
"createTempFile",
"(",
"File",
"baseFile",
")",
"{",
"File",
"parentDirectory",
"=",
"baseFile",
".",
"getParentFile",
"(",
")",
";",
"String",
"filename",
"=",
"baseFile",
".",
"getName",
"(",
")",
";",
"return",
"new",
"File",
... | Create a temporary File object. Prefix the name of the base file with an
underscore. | [
"Create",
"a",
"temporary",
"File",
"object",
".",
"Prefix",
"the",
"name",
"of",
"the",
"base",
"file",
"with",
"an",
"underscore",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/helpers/FileMovingUtil.java#L108-L112 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java | DirectoryConnection.submitCallbackRequest | public void submitCallbackRequest(ProtocolHeader h, Protocol request, ProtocolCallback callBack, Object context) {
"""
Submit a Request with Callback.
It is a asynchronized method, it returns on until Request complete.
When the Request complete, SD API will invoke the Callback.
@param h
the ProtocolHeader.
@param request
the Protocol.
@param callBack
the Callback.
@param context
the Context object of the Callback.
"""
queuePacket(h, request, callBack, context, null, null);
} | java | public void submitCallbackRequest(ProtocolHeader h, Protocol request, ProtocolCallback callBack, Object context){
queuePacket(h, request, callBack, context, null, null);
} | [
"public",
"void",
"submitCallbackRequest",
"(",
"ProtocolHeader",
"h",
",",
"Protocol",
"request",
",",
"ProtocolCallback",
"callBack",
",",
"Object",
"context",
")",
"{",
"queuePacket",
"(",
"h",
",",
"request",
",",
"callBack",
",",
"context",
",",
"null",
"... | Submit a Request with Callback.
It is a asynchronized method, it returns on until Request complete.
When the Request complete, SD API will invoke the Callback.
@param h
the ProtocolHeader.
@param request
the Protocol.
@param callBack
the Callback.
@param context
the Context object of the Callback. | [
"Submit",
"a",
"Request",
"with",
"Callback",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java#L384-L386 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.