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
|
---|---|---|---|---|---|---|---|---|---|---|
threerings/nenya | core/src/main/java/com/threerings/cast/builder/SpritePanel.java | SpritePanel.generateSprite | protected void generateSprite () {
"""
Generates a new character sprite for display to reflect the
currently selected character components.
"""
int components[] = _model.getSelectedComponents();
CharacterDescriptor desc = new CharacterDescriptor(components, null);
CharacterSprite sprite = _charmgr.getCharacter(desc);
setSprite(sprite);
} | java | protected void generateSprite ()
{
int components[] = _model.getSelectedComponents();
CharacterDescriptor desc = new CharacterDescriptor(components, null);
CharacterSprite sprite = _charmgr.getCharacter(desc);
setSprite(sprite);
} | [
"protected",
"void",
"generateSprite",
"(",
")",
"{",
"int",
"components",
"[",
"]",
"=",
"_model",
".",
"getSelectedComponents",
"(",
")",
";",
"CharacterDescriptor",
"desc",
"=",
"new",
"CharacterDescriptor",
"(",
"components",
",",
"null",
")",
";",
"CharacterSprite",
"sprite",
"=",
"_charmgr",
".",
"getCharacter",
"(",
"desc",
")",
";",
"setSprite",
"(",
"sprite",
")",
";",
"}"
]
| Generates a new character sprite for display to reflect the
currently selected character components. | [
"Generates",
"a",
"new",
"character",
"sprite",
"for",
"display",
"to",
"reflect",
"the",
"currently",
"selected",
"character",
"components",
"."
]
| train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/cast/builder/SpritePanel.java#L88-L94 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java | KeysAndAttributes.withKeys | public KeysAndAttributes withKeys(java.util.Collection<java.util.Map<String, AttributeValue>> keys) {
"""
<p>
The primary key attribute values that define the items and the attributes associated with the items.
</p>
@param keys
The primary key attribute values that define the items and the attributes associated with the items.
@return Returns a reference to this object so that method calls can be chained together.
"""
setKeys(keys);
return this;
} | java | public KeysAndAttributes withKeys(java.util.Collection<java.util.Map<String, AttributeValue>> keys) {
setKeys(keys);
return this;
} | [
"public",
"KeysAndAttributes",
"withKeys",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
">",
"keys",
")",
"{",
"setKeys",
"(",
"keys",
")",
";",
"return",
"this",
";",
"}"
]
| <p>
The primary key attribute values that define the items and the attributes associated with the items.
</p>
@param keys
The primary key attribute values that define the items and the attributes associated with the items.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"primary",
"key",
"attribute",
"values",
"that",
"define",
"the",
"items",
"and",
"the",
"attributes",
"associated",
"with",
"the",
"items",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/KeysAndAttributes.java#L210-L213 |
amaembo/streamex | src/main/java/one/util/streamex/AbstractStreamEx.java | AbstractStreamEx.foldRight | public <U> U foldRight(U seed, BiFunction<? super T, U, U> accumulator) {
"""
Folds the elements of this stream using the provided seed object and
accumulation function, going right to left.
<p>
This is a terminal operation.
<p>
As this method must process elements strictly right to left, it cannot
start processing till all the previous stream stages complete. Also it
requires intermediate memory to store the whole content of the stream as
the stream natural order is left to right. If your accumulator function
is associative and you can provide a combiner function, consider using
{@link #reduce(Object, BiFunction, BinaryOperator)} method.
<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the same thread.
@param <U> The type of the result
@param seed the starting value
@param accumulator a <a
href="package-summary.html#NonInterference">non-interfering </a>,
<a href="package-summary.html#Statelessness">stateless</a>
function for incorporating an additional element into a result
@return the result of the folding
@see #foldLeft(Object, BiFunction)
@see #reduce(Object, BinaryOperator)
@see #reduce(Object, BiFunction, BinaryOperator)
@since 0.2.2
"""
return toListAndThen(list -> {
U result = seed;
for (int i = list.size() - 1; i >= 0; i--)
result = accumulator.apply(list.get(i), result);
return result;
});
} | java | public <U> U foldRight(U seed, BiFunction<? super T, U, U> accumulator) {
return toListAndThen(list -> {
U result = seed;
for (int i = list.size() - 1; i >= 0; i--)
result = accumulator.apply(list.get(i), result);
return result;
});
} | [
"public",
"<",
"U",
">",
"U",
"foldRight",
"(",
"U",
"seed",
",",
"BiFunction",
"<",
"?",
"super",
"T",
",",
"U",
",",
"U",
">",
"accumulator",
")",
"{",
"return",
"toListAndThen",
"(",
"list",
"->",
"{",
"U",
"result",
"=",
"seed",
";",
"for",
"(",
"int",
"i",
"=",
"list",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"result",
"=",
"accumulator",
".",
"apply",
"(",
"list",
".",
"get",
"(",
"i",
")",
",",
"result",
")",
";",
"return",
"result",
";",
"}",
")",
";",
"}"
]
| Folds the elements of this stream using the provided seed object and
accumulation function, going right to left.
<p>
This is a terminal operation.
<p>
As this method must process elements strictly right to left, it cannot
start processing till all the previous stream stages complete. Also it
requires intermediate memory to store the whole content of the stream as
the stream natural order is left to right. If your accumulator function
is associative and you can provide a combiner function, consider using
{@link #reduce(Object, BiFunction, BinaryOperator)} method.
<p>
For parallel stream it's not guaranteed that accumulator will always be
executed in the same thread.
@param <U> The type of the result
@param seed the starting value
@param accumulator a <a
href="package-summary.html#NonInterference">non-interfering </a>,
<a href="package-summary.html#Statelessness">stateless</a>
function for incorporating an additional element into a result
@return the result of the folding
@see #foldLeft(Object, BiFunction)
@see #reduce(Object, BinaryOperator)
@see #reduce(Object, BiFunction, BinaryOperator)
@since 0.2.2 | [
"Folds",
"the",
"elements",
"of",
"this",
"stream",
"using",
"the",
"provided",
"seed",
"object",
"and",
"accumulation",
"function",
"going",
"right",
"to",
"left",
"."
]
| train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1437-L1444 |
google/closure-compiler | src/com/google/javascript/rhino/Node.java | Node.addChildrenAfter | public final void addChildrenAfter(@Nullable Node children, @Nullable Node node) {
"""
Add all children after 'node'. If 'node' is null, add them to the front of this node.
@param children first of a list of sibling nodes who have no parent.
NOTE: Usually you would get this argument from a removeChildren() call.
A single detached node will not work because its sibling pointers will not be
correctly initialized.
"""
if (children == null) {
return; // removeChildren() returns null when there are none
}
checkArgument(node == null || node.parent == this);
// NOTE: If there is only one sibling, its previous pointer must point to itself.
// Null indicates a fully detached node.
checkNotNull(children.previous, children);
if (node == null) {
addChildrenToFront(children);
return;
}
for (Node child = children; child != null; child = child.next) {
checkArgument(child.parent == null);
child.parent = this;
}
Node lastSibling = children.previous;
Node nodeAfter = node.next;
lastSibling.next = nodeAfter;
if (nodeAfter == null) {
first.previous = lastSibling;
} else {
nodeAfter.previous = lastSibling;
}
node.next = children;
children.previous = node;
} | java | public final void addChildrenAfter(@Nullable Node children, @Nullable Node node) {
if (children == null) {
return; // removeChildren() returns null when there are none
}
checkArgument(node == null || node.parent == this);
// NOTE: If there is only one sibling, its previous pointer must point to itself.
// Null indicates a fully detached node.
checkNotNull(children.previous, children);
if (node == null) {
addChildrenToFront(children);
return;
}
for (Node child = children; child != null; child = child.next) {
checkArgument(child.parent == null);
child.parent = this;
}
Node lastSibling = children.previous;
Node nodeAfter = node.next;
lastSibling.next = nodeAfter;
if (nodeAfter == null) {
first.previous = lastSibling;
} else {
nodeAfter.previous = lastSibling;
}
node.next = children;
children.previous = node;
} | [
"public",
"final",
"void",
"addChildrenAfter",
"(",
"@",
"Nullable",
"Node",
"children",
",",
"@",
"Nullable",
"Node",
"node",
")",
"{",
"if",
"(",
"children",
"==",
"null",
")",
"{",
"return",
";",
"// removeChildren() returns null when there are none",
"}",
"checkArgument",
"(",
"node",
"==",
"null",
"||",
"node",
".",
"parent",
"==",
"this",
")",
";",
"// NOTE: If there is only one sibling, its previous pointer must point to itself.",
"// Null indicates a fully detached node.",
"checkNotNull",
"(",
"children",
".",
"previous",
",",
"children",
")",
";",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"addChildrenToFront",
"(",
"children",
")",
";",
"return",
";",
"}",
"for",
"(",
"Node",
"child",
"=",
"children",
";",
"child",
"!=",
"null",
";",
"child",
"=",
"child",
".",
"next",
")",
"{",
"checkArgument",
"(",
"child",
".",
"parent",
"==",
"null",
")",
";",
"child",
".",
"parent",
"=",
"this",
";",
"}",
"Node",
"lastSibling",
"=",
"children",
".",
"previous",
";",
"Node",
"nodeAfter",
"=",
"node",
".",
"next",
";",
"lastSibling",
".",
"next",
"=",
"nodeAfter",
";",
"if",
"(",
"nodeAfter",
"==",
"null",
")",
"{",
"first",
".",
"previous",
"=",
"lastSibling",
";",
"}",
"else",
"{",
"nodeAfter",
".",
"previous",
"=",
"lastSibling",
";",
"}",
"node",
".",
"next",
"=",
"children",
";",
"children",
".",
"previous",
"=",
"node",
";",
"}"
]
| Add all children after 'node'. If 'node' is null, add them to the front of this node.
@param children first of a list of sibling nodes who have no parent.
NOTE: Usually you would get this argument from a removeChildren() call.
A single detached node will not work because its sibling pointers will not be
correctly initialized. | [
"Add",
"all",
"children",
"after",
"node",
".",
"If",
"node",
"is",
"null",
"add",
"them",
"to",
"the",
"front",
"of",
"this",
"node",
"."
]
| train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/Node.java#L921-L949 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_cartId_domainPacks_GET | public ArrayList<OvhDomainPacksProductInformation> cart_cartId_domainPacks_GET(String cartId, String domain) throws IOException {
"""
Get informations about Domain packs offers (AllDom)
REST: GET /order/cart/{cartId}/domainPacks
@param cartId [required] Cart identifier
@param domain [required] Domain name requested
API beta
"""
String qPath = "/order/cart/{cartId}/domainPacks";
StringBuilder sb = path(qPath, cartId);
query(sb, "domain", domain);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | java | public ArrayList<OvhDomainPacksProductInformation> cart_cartId_domainPacks_GET(String cartId, String domain) throws IOException {
String qPath = "/order/cart/{cartId}/domainPacks";
StringBuilder sb = path(qPath, cartId);
query(sb, "domain", domain);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
} | [
"public",
"ArrayList",
"<",
"OvhDomainPacksProductInformation",
">",
"cart_cartId_domainPacks_GET",
"(",
"String",
"cartId",
",",
"String",
"domain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart/{cartId}/domainPacks\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"cartId",
")",
";",
"query",
"(",
"sb",
",",
"\"domain\"",
",",
"domain",
")",
";",
"String",
"resp",
"=",
"execN",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t8",
")",
";",
"}"
]
| Get informations about Domain packs offers (AllDom)
REST: GET /order/cart/{cartId}/domainPacks
@param cartId [required] Cart identifier
@param domain [required] Domain name requested
API beta | [
"Get",
"informations",
"about",
"Domain",
"packs",
"offers",
"(",
"AllDom",
")"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L11486-L11492 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfCopyForms.java | PdfCopyForms.addDocument | public void addDocument(PdfReader reader, List pagesToKeep) throws DocumentException, IOException {
"""
Concatenates a PDF document selecting the pages to keep. The pages are described as a
<CODE>List</CODE> of <CODE>Integer</CODE>. The page ordering can be changed but
no page repetitions are allowed.
@param reader the PDF document
@param pagesToKeep the pages to keep
@throws DocumentException on error
"""
fc.addDocument(reader, pagesToKeep);
} | java | public void addDocument(PdfReader reader, List pagesToKeep) throws DocumentException, IOException {
fc.addDocument(reader, pagesToKeep);
} | [
"public",
"void",
"addDocument",
"(",
"PdfReader",
"reader",
",",
"List",
"pagesToKeep",
")",
"throws",
"DocumentException",
",",
"IOException",
"{",
"fc",
".",
"addDocument",
"(",
"reader",
",",
"pagesToKeep",
")",
";",
"}"
]
| Concatenates a PDF document selecting the pages to keep. The pages are described as a
<CODE>List</CODE> of <CODE>Integer</CODE>. The page ordering can be changed but
no page repetitions are allowed.
@param reader the PDF document
@param pagesToKeep the pages to keep
@throws DocumentException on error | [
"Concatenates",
"a",
"PDF",
"document",
"selecting",
"the",
"pages",
"to",
"keep",
".",
"The",
"pages",
"are",
"described",
"as",
"a",
"<CODE",
">",
"List<",
"/",
"CODE",
">",
"of",
"<CODE",
">",
"Integer<",
"/",
"CODE",
">",
".",
"The",
"page",
"ordering",
"can",
"be",
"changed",
"but",
"no",
"page",
"repetitions",
"are",
"allowed",
"."
]
| train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfCopyForms.java#L100-L102 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceCompositeGroupService.java | ReferenceCompositeGroupService.getEntity | @Override
public IEntity getEntity(String key, Class type) throws GroupsException {
"""
Returns an <code>IEntity</code> representing a portal entity. This does not guarantee that
the entity actually exists.
"""
return getEntity(key, type, null);
} | java | @Override
public IEntity getEntity(String key, Class type) throws GroupsException {
return getEntity(key, type, null);
} | [
"@",
"Override",
"public",
"IEntity",
"getEntity",
"(",
"String",
"key",
",",
"Class",
"type",
")",
"throws",
"GroupsException",
"{",
"return",
"getEntity",
"(",
"key",
",",
"type",
",",
"null",
")",
";",
"}"
]
| Returns an <code>IEntity</code> representing a portal entity. This does not guarantee that
the entity actually exists. | [
"Returns",
"an",
"<code",
">",
"IEntity<",
"/",
"code",
">",
"representing",
"a",
"portal",
"entity",
".",
"This",
"does",
"not",
"guarantee",
"that",
"the",
"entity",
"actually",
"exists",
"."
]
| train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceCompositeGroupService.java#L107-L110 |
soi-toolkit/soi-toolkit-mule | commons/components/studio-components/src/main/java/org/soitoolkit/commons/studio/components/logger/LoggerModule.java | LoggerModule.logError | @Processor
public Object logError(
@Optional @FriendlyName("Log Message") String message,
@Optional String integrationScenario,
@Optional String messageType,
@Optional String contractId,
@Optional String correlationId,
@Optional @FriendlyName("Extra Info") Map<String, String> extraInfo) {
"""
Log processor for level ERROR
{@sample.xml ../../../doc/soitoolkit-connector.xml.sample soitoolkit:log-error}
@param message Log-message to be processed
@param integrationScenario Optional name of the integration scenario or business process
@param messageType Optional name of the message type, e.g. a XML Schema namespace for a XML payload
@param contractId Optional name of the contract in use
@param correlationId Optional correlation identity of the message
@param extraInfo Optional extra info
@return The incoming payload
"""
return doLog(LogLevelType.ERROR, message, integrationScenario, contractId, correlationId, extraInfo);
} | java | @Processor
public Object logError(
@Optional @FriendlyName("Log Message") String message,
@Optional String integrationScenario,
@Optional String messageType,
@Optional String contractId,
@Optional String correlationId,
@Optional @FriendlyName("Extra Info") Map<String, String> extraInfo) {
return doLog(LogLevelType.ERROR, message, integrationScenario, contractId, correlationId, extraInfo);
} | [
"@",
"Processor",
"public",
"Object",
"logError",
"(",
"@",
"Optional",
"@",
"FriendlyName",
"(",
"\"Log Message\"",
")",
"String",
"message",
",",
"@",
"Optional",
"String",
"integrationScenario",
",",
"@",
"Optional",
"String",
"messageType",
",",
"@",
"Optional",
"String",
"contractId",
",",
"@",
"Optional",
"String",
"correlationId",
",",
"@",
"Optional",
"@",
"FriendlyName",
"(",
"\"Extra Info\"",
")",
"Map",
"<",
"String",
",",
"String",
">",
"extraInfo",
")",
"{",
"return",
"doLog",
"(",
"LogLevelType",
".",
"ERROR",
",",
"message",
",",
"integrationScenario",
",",
"contractId",
",",
"correlationId",
",",
"extraInfo",
")",
";",
"}"
]
| Log processor for level ERROR
{@sample.xml ../../../doc/soitoolkit-connector.xml.sample soitoolkit:log-error}
@param message Log-message to be processed
@param integrationScenario Optional name of the integration scenario or business process
@param messageType Optional name of the message type, e.g. a XML Schema namespace for a XML payload
@param contractId Optional name of the contract in use
@param correlationId Optional correlation identity of the message
@param extraInfo Optional extra info
@return The incoming payload | [
"Log",
"processor",
"for",
"level",
"ERROR"
]
| train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/studio-components/src/main/java/org/soitoolkit/commons/studio/components/logger/LoggerModule.java#L252-L262 |
strator-dev/greenpepper | greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java | ConfluenceGreenPepper.isInSutList | public boolean isInSutList(SystemUnderTest sut, Collection<SystemUnderTest> sutList) {
"""
<p>isInSutList.</p>
@param sut a {@link com.greenpepper.server.domain.SystemUnderTest} object.
@param sutList a {@link java.util.Collection} object.
@return a boolean.
"""
for (SystemUnderTest aSut : sutList) {
if (aSut.equalsTo(sut)) {
return true;
}
}
return false;
} | java | public boolean isInSutList(SystemUnderTest sut, Collection<SystemUnderTest> sutList) {
for (SystemUnderTest aSut : sutList) {
if (aSut.equalsTo(sut)) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"isInSutList",
"(",
"SystemUnderTest",
"sut",
",",
"Collection",
"<",
"SystemUnderTest",
">",
"sutList",
")",
"{",
"for",
"(",
"SystemUnderTest",
"aSut",
":",
"sutList",
")",
"{",
"if",
"(",
"aSut",
".",
"equalsTo",
"(",
"sut",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
]
| <p>isInSutList.</p>
@param sut a {@link com.greenpepper.server.domain.SystemUnderTest} object.
@param sutList a {@link java.util.Collection} object.
@return a boolean. | [
"<p",
">",
"isInSutList",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/velocity/ConfluenceGreenPepper.java#L783-L791 |
jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ExtensionDt.java | ExtensionDt.getValueAsPrimitive | public IPrimitiveDatatype<?> getValueAsPrimitive() {
"""
Returns the value of this extension, casted to a primitive datatype. This is a convenience method which should only be called if you are sure that the value for this particular extension will
be a primitive.
<p>
Note that if this extension contains extensions (instead of a datatype) then <b>this method will return null</b>. In that case, you must use {@link #getUndeclaredExtensions()} and
{@link #getUndeclaredModifierExtensions()} to retrieve the child extensions.
</p>
@throws ClassCastException
If the value of this extension is not a primitive datatype
"""
if (!(getValue() instanceof IPrimitiveDatatype)) {
throw new ClassCastException("Extension with URL["+myUrl+"] can not be cast to primitive type, type is: "+ getClass().getCanonicalName());
}
return (IPrimitiveDatatype<?>) getValue();
} | java | public IPrimitiveDatatype<?> getValueAsPrimitive() {
if (!(getValue() instanceof IPrimitiveDatatype)) {
throw new ClassCastException("Extension with URL["+myUrl+"] can not be cast to primitive type, type is: "+ getClass().getCanonicalName());
}
return (IPrimitiveDatatype<?>) getValue();
} | [
"public",
"IPrimitiveDatatype",
"<",
"?",
">",
"getValueAsPrimitive",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"getValue",
"(",
")",
"instanceof",
"IPrimitiveDatatype",
")",
")",
"{",
"throw",
"new",
"ClassCastException",
"(",
"\"Extension with URL[\"",
"+",
"myUrl",
"+",
"\"] can not be cast to primitive type, type is: \"",
"+",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
")",
";",
"}",
"return",
"(",
"IPrimitiveDatatype",
"<",
"?",
">",
")",
"getValue",
"(",
")",
";",
"}"
]
| Returns the value of this extension, casted to a primitive datatype. This is a convenience method which should only be called if you are sure that the value for this particular extension will
be a primitive.
<p>
Note that if this extension contains extensions (instead of a datatype) then <b>this method will return null</b>. In that case, you must use {@link #getUndeclaredExtensions()} and
{@link #getUndeclaredModifierExtensions()} to retrieve the child extensions.
</p>
@throws ClassCastException
If the value of this extension is not a primitive datatype | [
"Returns",
"the",
"value",
"of",
"this",
"extension",
"casted",
"to",
"a",
"primitive",
"datatype",
".",
"This",
"is",
"a",
"convenience",
"method",
"which",
"should",
"only",
"be",
"called",
"if",
"you",
"are",
"sure",
"that",
"the",
"value",
"for",
"this",
"particular",
"extension",
"will",
"be",
"a",
"primitive",
".",
"<p",
">",
"Note",
"that",
"if",
"this",
"extension",
"contains",
"extensions",
"(",
"instead",
"of",
"a",
"datatype",
")",
"then",
"<b",
">",
"this",
"method",
"will",
"return",
"null<",
"/",
"b",
">",
".",
"In",
"that",
"case",
"you",
"must",
"use",
"{",
"@link",
"#getUndeclaredExtensions",
"()",
"}",
"and",
"{",
"@link",
"#getUndeclaredModifierExtensions",
"()",
"}",
"to",
"retrieve",
"the",
"child",
"extensions",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ExtensionDt.java#L117-L122 |
networknt/light-4j | client/src/main/java/com/networknt/client/Http2Client.java | Http2Client.propagateHeaders | public Result propagateHeaders(ClientRequest request, final HttpServerExchange exchange) {
"""
Support API to API calls with scope token. The token is the original token from consumer and
the client credentials token of caller API is added from cache.
This method is used in API to API call
@param request the http request
@param exchange the http server exchange
"""
String tid = exchange.getRequestHeaders().getFirst(HttpStringConstants.TRACEABILITY_ID);
String token = exchange.getRequestHeaders().getFirst(Headers.AUTHORIZATION);
String cid = exchange.getRequestHeaders().getFirst(HttpStringConstants.CORRELATION_ID);
return populateHeader(request, token, cid, tid);
} | java | public Result propagateHeaders(ClientRequest request, final HttpServerExchange exchange) {
String tid = exchange.getRequestHeaders().getFirst(HttpStringConstants.TRACEABILITY_ID);
String token = exchange.getRequestHeaders().getFirst(Headers.AUTHORIZATION);
String cid = exchange.getRequestHeaders().getFirst(HttpStringConstants.CORRELATION_ID);
return populateHeader(request, token, cid, tid);
} | [
"public",
"Result",
"propagateHeaders",
"(",
"ClientRequest",
"request",
",",
"final",
"HttpServerExchange",
"exchange",
")",
"{",
"String",
"tid",
"=",
"exchange",
".",
"getRequestHeaders",
"(",
")",
".",
"getFirst",
"(",
"HttpStringConstants",
".",
"TRACEABILITY_ID",
")",
";",
"String",
"token",
"=",
"exchange",
".",
"getRequestHeaders",
"(",
")",
".",
"getFirst",
"(",
"Headers",
".",
"AUTHORIZATION",
")",
";",
"String",
"cid",
"=",
"exchange",
".",
"getRequestHeaders",
"(",
")",
".",
"getFirst",
"(",
"HttpStringConstants",
".",
"CORRELATION_ID",
")",
";",
"return",
"populateHeader",
"(",
"request",
",",
"token",
",",
"cid",
",",
"tid",
")",
";",
"}"
]
| Support API to API calls with scope token. The token is the original token from consumer and
the client credentials token of caller API is added from cache.
This method is used in API to API call
@param request the http request
@param exchange the http server exchange | [
"Support",
"API",
"to",
"API",
"calls",
"with",
"scope",
"token",
".",
"The",
"token",
"is",
"the",
"original",
"token",
"from",
"consumer",
"and",
"the",
"client",
"credentials",
"token",
"of",
"caller",
"API",
"is",
"added",
"from",
"cache",
"."
]
| train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L350-L355 |
mnlipp/jgrapes | examples/src/org/jgrapes/http/demo/httpserver/FormProcessor.java | FormProcessor.onGet | @RequestHandler(patterns = "/form,/form/**")
public void onGet(Request.In.Get event, IOSubchannel channel)
throws ParseException {
"""
Handle a `GET` request.
@param event the event
@param channel the channel
@throws ParseException the parse exception
"""
ResponseCreationSupport.sendStaticContent(event, channel,
path -> FormProcessor.class.getResource(
ResourcePattern.removeSegments(path, 1)),
null);
} | java | @RequestHandler(patterns = "/form,/form/**")
public void onGet(Request.In.Get event, IOSubchannel channel)
throws ParseException {
ResponseCreationSupport.sendStaticContent(event, channel,
path -> FormProcessor.class.getResource(
ResourcePattern.removeSegments(path, 1)),
null);
} | [
"@",
"RequestHandler",
"(",
"patterns",
"=",
"\"/form,/form/**\"",
")",
"public",
"void",
"onGet",
"(",
"Request",
".",
"In",
".",
"Get",
"event",
",",
"IOSubchannel",
"channel",
")",
"throws",
"ParseException",
"{",
"ResponseCreationSupport",
".",
"sendStaticContent",
"(",
"event",
",",
"channel",
",",
"path",
"->",
"FormProcessor",
".",
"class",
".",
"getResource",
"(",
"ResourcePattern",
".",
"removeSegments",
"(",
"path",
",",
"1",
")",
")",
",",
"null",
")",
";",
"}"
]
| Handle a `GET` request.
@param event the event
@param channel the channel
@throws ParseException the parse exception | [
"Handle",
"a",
"GET",
"request",
"."
]
| train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/examples/src/org/jgrapes/http/demo/httpserver/FormProcessor.java#L75-L82 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/bind/BindUploader.java | BindUploader.buildRows | private List<String[]> buildRows(List<ColumnTypeDataPair> columns) throws BindException {
"""
Transpose a list of columns and their values to a list of rows
@param columns the list of columns to transpose
@return list of rows
@throws BindException if columns improperly formed
"""
List<String[]> rows = new ArrayList<>();
int numColumns = columns.size();
// columns should have binds
if (columns.get(0).data.isEmpty())
{
throw new BindException("No binds found in first column", BindException.Type.SERIALIZATION);
}
int numRows = columns.get(0).data.size();
// every column should have the same number of binds
for (int i = 0; i < numColumns; i++)
{
int iNumRows = columns.get(i).data.size();
if (columns.get(i).data.size() != numRows)
{
throw new BindException(
String.format("Column %d has a different number of binds (%d) than column 1 (%d)", i, iNumRows, numRows), BindException.Type.SERIALIZATION);
}
}
for (int rowIdx = 0; rowIdx < numRows; rowIdx++)
{
String[] row = new String[numColumns];
for (int colIdx = 0; colIdx < numColumns; colIdx++)
{
row[colIdx] = columns.get(colIdx).data.get(rowIdx);
}
rows.add(row);
}
return rows;
} | java | private List<String[]> buildRows(List<ColumnTypeDataPair> columns) throws BindException
{
List<String[]> rows = new ArrayList<>();
int numColumns = columns.size();
// columns should have binds
if (columns.get(0).data.isEmpty())
{
throw new BindException("No binds found in first column", BindException.Type.SERIALIZATION);
}
int numRows = columns.get(0).data.size();
// every column should have the same number of binds
for (int i = 0; i < numColumns; i++)
{
int iNumRows = columns.get(i).data.size();
if (columns.get(i).data.size() != numRows)
{
throw new BindException(
String.format("Column %d has a different number of binds (%d) than column 1 (%d)", i, iNumRows, numRows), BindException.Type.SERIALIZATION);
}
}
for (int rowIdx = 0; rowIdx < numRows; rowIdx++)
{
String[] row = new String[numColumns];
for (int colIdx = 0; colIdx < numColumns; colIdx++)
{
row[colIdx] = columns.get(colIdx).data.get(rowIdx);
}
rows.add(row);
}
return rows;
} | [
"private",
"List",
"<",
"String",
"[",
"]",
">",
"buildRows",
"(",
"List",
"<",
"ColumnTypeDataPair",
">",
"columns",
")",
"throws",
"BindException",
"{",
"List",
"<",
"String",
"[",
"]",
">",
"rows",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"numColumns",
"=",
"columns",
".",
"size",
"(",
")",
";",
"// columns should have binds",
"if",
"(",
"columns",
".",
"get",
"(",
"0",
")",
".",
"data",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"BindException",
"(",
"\"No binds found in first column\"",
",",
"BindException",
".",
"Type",
".",
"SERIALIZATION",
")",
";",
"}",
"int",
"numRows",
"=",
"columns",
".",
"get",
"(",
"0",
")",
".",
"data",
".",
"size",
"(",
")",
";",
"// every column should have the same number of binds",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numColumns",
";",
"i",
"++",
")",
"{",
"int",
"iNumRows",
"=",
"columns",
".",
"get",
"(",
"i",
")",
".",
"data",
".",
"size",
"(",
")",
";",
"if",
"(",
"columns",
".",
"get",
"(",
"i",
")",
".",
"data",
".",
"size",
"(",
")",
"!=",
"numRows",
")",
"{",
"throw",
"new",
"BindException",
"(",
"String",
".",
"format",
"(",
"\"Column %d has a different number of binds (%d) than column 1 (%d)\"",
",",
"i",
",",
"iNumRows",
",",
"numRows",
")",
",",
"BindException",
".",
"Type",
".",
"SERIALIZATION",
")",
";",
"}",
"}",
"for",
"(",
"int",
"rowIdx",
"=",
"0",
";",
"rowIdx",
"<",
"numRows",
";",
"rowIdx",
"++",
")",
"{",
"String",
"[",
"]",
"row",
"=",
"new",
"String",
"[",
"numColumns",
"]",
";",
"for",
"(",
"int",
"colIdx",
"=",
"0",
";",
"colIdx",
"<",
"numColumns",
";",
"colIdx",
"++",
")",
"{",
"row",
"[",
"colIdx",
"]",
"=",
"columns",
".",
"get",
"(",
"colIdx",
")",
".",
"data",
".",
"get",
"(",
"rowIdx",
")",
";",
"}",
"rows",
".",
"add",
"(",
"row",
")",
";",
"}",
"return",
"rows",
";",
"}"
]
| Transpose a list of columns and their values to a list of rows
@param columns the list of columns to transpose
@return list of rows
@throws BindException if columns improperly formed | [
"Transpose",
"a",
"list",
"of",
"columns",
"and",
"their",
"values",
"to",
"a",
"list",
"of",
"rows"
]
| train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/bind/BindUploader.java#L280-L314 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.data_smd_smdId_GET | public OvhSmd data_smd_smdId_GET(Long smdId) throws IOException {
"""
Retrieve information about a SMD file
REST: GET /domain/data/smd/{smdId}
@param smdId [required] SMD ID
"""
String qPath = "/domain/data/smd/{smdId}";
StringBuilder sb = path(qPath, smdId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSmd.class);
} | java | public OvhSmd data_smd_smdId_GET(Long smdId) throws IOException {
String qPath = "/domain/data/smd/{smdId}";
StringBuilder sb = path(qPath, smdId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhSmd.class);
} | [
"public",
"OvhSmd",
"data_smd_smdId_GET",
"(",
"Long",
"smdId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/data/smd/{smdId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"smdId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhSmd",
".",
"class",
")",
";",
"}"
]
| Retrieve information about a SMD file
REST: GET /domain/data/smd/{smdId}
@param smdId [required] SMD ID | [
"Retrieve",
"information",
"about",
"a",
"SMD",
"file"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L141-L146 |
jenkinsci/jenkins | core/src/main/java/hudson/FilePath.java | FilePath.actAsync | public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException {
"""
Executes some program on the machine that this {@link FilePath} exists,
so that one can perform local file operations.
"""
try {
DelegatingCallable<T,IOException> wrapper = new FileCallableWrapper<>(callable);
for (FileCallableWrapperFactory factory : ExtensionList.lookup(FileCallableWrapperFactory.class)) {
wrapper = factory.wrap(wrapper);
}
return (channel!=null ? channel : localChannel)
.callAsync(wrapper);
} catch (IOException e) {
// wrap it into a new IOException so that we get the caller's stack trace as well.
throw new IOException("remote file operation failed",e);
}
} | java | public <T> Future<T> actAsync(final FileCallable<T> callable) throws IOException, InterruptedException {
try {
DelegatingCallable<T,IOException> wrapper = new FileCallableWrapper<>(callable);
for (FileCallableWrapperFactory factory : ExtensionList.lookup(FileCallableWrapperFactory.class)) {
wrapper = factory.wrap(wrapper);
}
return (channel!=null ? channel : localChannel)
.callAsync(wrapper);
} catch (IOException e) {
// wrap it into a new IOException so that we get the caller's stack trace as well.
throw new IOException("remote file operation failed",e);
}
} | [
"public",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"actAsync",
"(",
"final",
"FileCallable",
"<",
"T",
">",
"callable",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"try",
"{",
"DelegatingCallable",
"<",
"T",
",",
"IOException",
">",
"wrapper",
"=",
"new",
"FileCallableWrapper",
"<>",
"(",
"callable",
")",
";",
"for",
"(",
"FileCallableWrapperFactory",
"factory",
":",
"ExtensionList",
".",
"lookup",
"(",
"FileCallableWrapperFactory",
".",
"class",
")",
")",
"{",
"wrapper",
"=",
"factory",
".",
"wrap",
"(",
"wrapper",
")",
";",
"}",
"return",
"(",
"channel",
"!=",
"null",
"?",
"channel",
":",
"localChannel",
")",
".",
"callAsync",
"(",
"wrapper",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// wrap it into a new IOException so that we get the caller's stack trace as well.",
"throw",
"new",
"IOException",
"(",
"\"remote file operation failed\"",
",",
"e",
")",
";",
"}",
"}"
]
| Executes some program on the machine that this {@link FilePath} exists,
so that one can perform local file operations. | [
"Executes",
"some",
"program",
"on",
"the",
"machine",
"that",
"this",
"{"
]
| train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/FilePath.java#L1138-L1150 |
allure-framework/allure1 | allure-java-aspects/src/main/java/ru/yandex/qatools/allure/aspects/AllureAspectUtils.java | AllureAspectUtils.getName | public static String getName(String methodName, Object[] parameters) {
"""
Generate method in the following format: {methodName}[{param1}, {param2}, ...]. Cut a generated
name is it over {@link ru.yandex.qatools.allure.config.AllureConfig#maxTitleLength}
"""
int maxLength = AllureConfig.newInstance().getMaxTitleLength();
if (methodName.length() > maxLength) {
return cutBegin(methodName, maxLength);
} else {
return methodName + getParametersAsString(parameters, maxLength - methodName.length());
}
} | java | public static String getName(String methodName, Object[] parameters) {
int maxLength = AllureConfig.newInstance().getMaxTitleLength();
if (methodName.length() > maxLength) {
return cutBegin(methodName, maxLength);
} else {
return methodName + getParametersAsString(parameters, maxLength - methodName.length());
}
} | [
"public",
"static",
"String",
"getName",
"(",
"String",
"methodName",
",",
"Object",
"[",
"]",
"parameters",
")",
"{",
"int",
"maxLength",
"=",
"AllureConfig",
".",
"newInstance",
"(",
")",
".",
"getMaxTitleLength",
"(",
")",
";",
"if",
"(",
"methodName",
".",
"length",
"(",
")",
">",
"maxLength",
")",
"{",
"return",
"cutBegin",
"(",
"methodName",
",",
"maxLength",
")",
";",
"}",
"else",
"{",
"return",
"methodName",
"+",
"getParametersAsString",
"(",
"parameters",
",",
"maxLength",
"-",
"methodName",
".",
"length",
"(",
")",
")",
";",
"}",
"}"
]
| Generate method in the following format: {methodName}[{param1}, {param2}, ...]. Cut a generated
name is it over {@link ru.yandex.qatools.allure.config.AllureConfig#maxTitleLength} | [
"Generate",
"method",
"in",
"the",
"following",
"format",
":",
"{",
"methodName",
"}",
"[",
"{",
"param1",
"}",
"{",
"param2",
"}",
"...",
"]",
".",
"Cut",
"a",
"generated",
"name",
"is",
"it",
"over",
"{"
]
| train | https://github.com/allure-framework/allure1/blob/9a816fa05d8b894a917b7ebb7fd1a4056dee4693/allure-java-aspects/src/main/java/ru/yandex/qatools/allure/aspects/AllureAspectUtils.java#L27-L34 |
RuedigerMoeller/kontraktor | modules/reactive-streams/src/main/java/org/nustaq/kontraktor/reactivestreams/KxReactiveStreams.java | KxReactiveStreams.serve | public <OUT> IPromise serve(Publisher<OUT> source, ActorPublisher networRxPublisher, boolean closeConnectionOnCompleteOrError, Consumer<Actor> disconCB) {
"""
exposes a publisher on the network via kontraktor's generic remoting. Usually not called directly (see EventSink+RxPublisher)
@param source
@param networRxPublisher - the appropriate network publisher (TCP,TCPNIO,WS)
@param disconCB - called once a client disconnects/stops. can be null
@param <OUT>
@return
"""
if ( networRxPublisher.getClass().getSimpleName().equals("HttpPublisher") ) {
throw new RuntimeException("Http long poll cannot be supported. Use WebSockets instead.");
}
if (source instanceof KxPublisherActor == false || source instanceof ActorProxy == false ) {
Processor<OUT, OUT> proc = newAsyncProcessor(a -> a); // we need a queue before going to network
source.subscribe(proc);
source = proc;
}
((KxPublisherActor)source).setCloseOnComplete(closeConnectionOnCompleteOrError);
return networRxPublisher.facade((Actor) source).publish(disconCB);
} | java | public <OUT> IPromise serve(Publisher<OUT> source, ActorPublisher networRxPublisher, boolean closeConnectionOnCompleteOrError, Consumer<Actor> disconCB) {
if ( networRxPublisher.getClass().getSimpleName().equals("HttpPublisher") ) {
throw new RuntimeException("Http long poll cannot be supported. Use WebSockets instead.");
}
if (source instanceof KxPublisherActor == false || source instanceof ActorProxy == false ) {
Processor<OUT, OUT> proc = newAsyncProcessor(a -> a); // we need a queue before going to network
source.subscribe(proc);
source = proc;
}
((KxPublisherActor)source).setCloseOnComplete(closeConnectionOnCompleteOrError);
return networRxPublisher.facade((Actor) source).publish(disconCB);
} | [
"public",
"<",
"OUT",
">",
"IPromise",
"serve",
"(",
"Publisher",
"<",
"OUT",
">",
"source",
",",
"ActorPublisher",
"networRxPublisher",
",",
"boolean",
"closeConnectionOnCompleteOrError",
",",
"Consumer",
"<",
"Actor",
">",
"disconCB",
")",
"{",
"if",
"(",
"networRxPublisher",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
".",
"equals",
"(",
"\"HttpPublisher\"",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Http long poll cannot be supported. Use WebSockets instead.\"",
")",
";",
"}",
"if",
"(",
"source",
"instanceof",
"KxPublisherActor",
"==",
"false",
"||",
"source",
"instanceof",
"ActorProxy",
"==",
"false",
")",
"{",
"Processor",
"<",
"OUT",
",",
"OUT",
">",
"proc",
"=",
"newAsyncProcessor",
"(",
"a",
"->",
"a",
")",
";",
"// we need a queue before going to network",
"source",
".",
"subscribe",
"(",
"proc",
")",
";",
"source",
"=",
"proc",
";",
"}",
"(",
"(",
"KxPublisherActor",
")",
"source",
")",
".",
"setCloseOnComplete",
"(",
"closeConnectionOnCompleteOrError",
")",
";",
"return",
"networRxPublisher",
".",
"facade",
"(",
"(",
"Actor",
")",
"source",
")",
".",
"publish",
"(",
"disconCB",
")",
";",
"}"
]
| exposes a publisher on the network via kontraktor's generic remoting. Usually not called directly (see EventSink+RxPublisher)
@param source
@param networRxPublisher - the appropriate network publisher (TCP,TCPNIO,WS)
@param disconCB - called once a client disconnects/stops. can be null
@param <OUT>
@return | [
"exposes",
"a",
"publisher",
"on",
"the",
"network",
"via",
"kontraktor",
"s",
"generic",
"remoting",
".",
"Usually",
"not",
"called",
"directly",
"(",
"see",
"EventSink",
"+",
"RxPublisher",
")"
]
| train | https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/modules/reactive-streams/src/main/java/org/nustaq/kontraktor/reactivestreams/KxReactiveStreams.java#L323-L334 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.reconnectCall | public void reconnectCall(String connId, String heldConnId) throws WorkspaceApiException {
"""
Reconnect the specified call. This releases the established call and retrieves the held call
in one step. This is a quick way to to do `releaseCall()` and `retrieveCall()`.
@param connId The connection ID of the established call (will be released).
@param heldConnId The ID of the held call (will be retrieved).
"""
this.reconnectCall(connId, heldConnId, null, null);
} | java | public void reconnectCall(String connId, String heldConnId) throws WorkspaceApiException {
this.reconnectCall(connId, heldConnId, null, null);
} | [
"public",
"void",
"reconnectCall",
"(",
"String",
"connId",
",",
"String",
"heldConnId",
")",
"throws",
"WorkspaceApiException",
"{",
"this",
".",
"reconnectCall",
"(",
"connId",
",",
"heldConnId",
",",
"null",
",",
"null",
")",
";",
"}"
]
| Reconnect the specified call. This releases the established call and retrieves the held call
in one step. This is a quick way to to do `releaseCall()` and `retrieveCall()`.
@param connId The connection ID of the established call (will be released).
@param heldConnId The ID of the held call (will be retrieved). | [
"Reconnect",
"the",
"specified",
"call",
".",
"This",
"releases",
"the",
"established",
"call",
"and",
"retrieves",
"the",
"held",
"call",
"in",
"one",
"step",
".",
"This",
"is",
"a",
"quick",
"way",
"to",
"to",
"do",
"releaseCall",
"()",
"and",
"retrieveCall",
"()",
"."
]
| train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1280-L1282 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.sleepUninterruptibly | public static void sleepUninterruptibly(final long timeout, final TimeUnit unit) {
"""
Note: Copied from Google Guava under Apache License v2.0
<br />
<br />
If a thread is interrupted during such a call, the call continues to block until the result is available or the
timeout elapses, and only then re-interrupts the thread.
@param timeoutInMillis
"""
N.checkArgNotNull(unit, "unit");
if (timeout <= 0) {
return;
}
boolean interrupted = false;
try {
long remainingNanos = unit.toNanos(timeout);
final long sysNanos = System.nanoTime();
final long end = remainingNanos >= Long.MAX_VALUE - sysNanos ? Long.MAX_VALUE : sysNanos + remainingNanos;
while (true) {
try {
// TimeUnit.sleep() treats negative timeouts just like zero.
TimeUnit.NANOSECONDS.sleep(remainingNanos);
return;
} catch (InterruptedException e) {
interrupted = true;
remainingNanos = end - System.nanoTime();
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
} | java | public static void sleepUninterruptibly(final long timeout, final TimeUnit unit) {
N.checkArgNotNull(unit, "unit");
if (timeout <= 0) {
return;
}
boolean interrupted = false;
try {
long remainingNanos = unit.toNanos(timeout);
final long sysNanos = System.nanoTime();
final long end = remainingNanos >= Long.MAX_VALUE - sysNanos ? Long.MAX_VALUE : sysNanos + remainingNanos;
while (true) {
try {
// TimeUnit.sleep() treats negative timeouts just like zero.
TimeUnit.NANOSECONDS.sleep(remainingNanos);
return;
} catch (InterruptedException e) {
interrupted = true;
remainingNanos = end - System.nanoTime();
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
} | [
"public",
"static",
"void",
"sleepUninterruptibly",
"(",
"final",
"long",
"timeout",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"N",
".",
"checkArgNotNull",
"(",
"unit",
",",
"\"unit\"",
")",
";",
"if",
"(",
"timeout",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"boolean",
"interrupted",
"=",
"false",
";",
"try",
"{",
"long",
"remainingNanos",
"=",
"unit",
".",
"toNanos",
"(",
"timeout",
")",
";",
"final",
"long",
"sysNanos",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"final",
"long",
"end",
"=",
"remainingNanos",
">=",
"Long",
".",
"MAX_VALUE",
"-",
"sysNanos",
"?",
"Long",
".",
"MAX_VALUE",
":",
"sysNanos",
"+",
"remainingNanos",
";",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"// TimeUnit.sleep() treats negative timeouts just like zero.\r",
"TimeUnit",
".",
"NANOSECONDS",
".",
"sleep",
"(",
"remainingNanos",
")",
";",
"return",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"interrupted",
"=",
"true",
";",
"remainingNanos",
"=",
"end",
"-",
"System",
".",
"nanoTime",
"(",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"if",
"(",
"interrupted",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"}",
"}",
"}"
]
| Note: Copied from Google Guava under Apache License v2.0
<br />
<br />
If a thread is interrupted during such a call, the call continues to block until the result is available or the
timeout elapses, and only then re-interrupts the thread.
@param timeoutInMillis | [
"Note",
":",
"Copied",
"from",
"Google",
"Guava",
"under",
"Apache",
"License",
"v2",
".",
"0",
"<br",
"/",
">",
"<br",
"/",
">"
]
| train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L27889-L27918 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java | AbstractDoclet.startGeneration | private void startGeneration(RootDoc root) throws Configuration.Fault, Exception {
"""
Start the generation of files. Call generate methods in the individual
writers, which will in turn generate the documentation files. Call the
TreeWriter generation first to ensure the Class Hierarchy is built
first and then can be used in the later generation.
@see com.sun.javadoc.RootDoc
"""
if (root.classes().length == 0) {
configuration.message.
error("doclet.No_Public_Classes_To_Document");
return;
}
configuration.setOptions();
configuration.getDocletSpecificMsg().notice("doclet.build_version",
configuration.getDocletSpecificBuildDate());
ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
generateClassFiles(root, classtree);
Util.copyDocFiles(configuration, DocPaths.DOC_FILES);
PackageListWriter.generate(configuration);
generatePackageFiles(classtree);
generateProfileFiles();
generateOtherFiles(root, classtree);
configuration.tagletManager.printReport();
} | java | private void startGeneration(RootDoc root) throws Configuration.Fault, Exception {
if (root.classes().length == 0) {
configuration.message.
error("doclet.No_Public_Classes_To_Document");
return;
}
configuration.setOptions();
configuration.getDocletSpecificMsg().notice("doclet.build_version",
configuration.getDocletSpecificBuildDate());
ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
generateClassFiles(root, classtree);
Util.copyDocFiles(configuration, DocPaths.DOC_FILES);
PackageListWriter.generate(configuration);
generatePackageFiles(classtree);
generateProfileFiles();
generateOtherFiles(root, classtree);
configuration.tagletManager.printReport();
} | [
"private",
"void",
"startGeneration",
"(",
"RootDoc",
"root",
")",
"throws",
"Configuration",
".",
"Fault",
",",
"Exception",
"{",
"if",
"(",
"root",
".",
"classes",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"configuration",
".",
"message",
".",
"error",
"(",
"\"doclet.No_Public_Classes_To_Document\"",
")",
";",
"return",
";",
"}",
"configuration",
".",
"setOptions",
"(",
")",
";",
"configuration",
".",
"getDocletSpecificMsg",
"(",
")",
".",
"notice",
"(",
"\"doclet.build_version\"",
",",
"configuration",
".",
"getDocletSpecificBuildDate",
"(",
")",
")",
";",
"ClassTree",
"classtree",
"=",
"new",
"ClassTree",
"(",
"configuration",
",",
"configuration",
".",
"nodeprecated",
")",
";",
"generateClassFiles",
"(",
"root",
",",
"classtree",
")",
";",
"Util",
".",
"copyDocFiles",
"(",
"configuration",
",",
"DocPaths",
".",
"DOC_FILES",
")",
";",
"PackageListWriter",
".",
"generate",
"(",
"configuration",
")",
";",
"generatePackageFiles",
"(",
"classtree",
")",
";",
"generateProfileFiles",
"(",
")",
";",
"generateOtherFiles",
"(",
"root",
",",
"classtree",
")",
";",
"configuration",
".",
"tagletManager",
".",
"printReport",
"(",
")",
";",
"}"
]
| Start the generation of files. Call generate methods in the individual
writers, which will in turn generate the documentation files. Call the
TreeWriter generation first to ensure the Class Hierarchy is built
first and then can be used in the later generation.
@see com.sun.javadoc.RootDoc | [
"Start",
"the",
"generation",
"of",
"files",
".",
"Call",
"generate",
"methods",
"in",
"the",
"individual",
"writers",
"which",
"will",
"in",
"turn",
"generate",
"the",
"documentation",
"files",
".",
"Call",
"the",
"TreeWriter",
"generation",
"first",
"to",
"ensure",
"the",
"Class",
"Hierarchy",
"is",
"built",
"first",
"and",
"then",
"can",
"be",
"used",
"in",
"the",
"later",
"generation",
"."
]
| train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java#L128-L148 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/subset/neigh/adv/DisjointMultiAdditionNeighbourhood.java | DisjointMultiAdditionNeighbourhood.getAllMoves | @Override
public List<SubsetMove> getAllMoves(SubsetSolution solution) {
"""
<p>
Generates the list of all possible moves that perform \(k\) additions, where \(k\) is the fixed number
specified at construction. Note: taking into account the current number of unselected items, the imposed
maximum subset size (if set) and the fixed IDs (if any) may result in fewer additions (as many as possible).
</p>
<p>
May return an empty list if no moves can be generated.
</p>
@param solution solution for which all possible multi addition moves are generated
@return list of all multi addition moves, may be empty
"""
// create empty list to store generated moves
List<SubsetMove> moves = new ArrayList<>();
// get set of candidate IDs for addition (fixed IDs are discarded)
Set<Integer> addCandidates = getAddCandidates(solution);
// compute number of additions
int curNumAdd = numAdditions(addCandidates, solution);
if(curNumAdd == 0){
// impossible: return empty set
return moves;
}
// create all moves that add curNumAdd items
Set<Integer> add;
SubsetIterator<Integer> itAdd = new SubsetIterator<>(addCandidates, curNumAdd);
while(itAdd.hasNext()){
add = itAdd.next();
// create and add move
moves.add(new GeneralSubsetMove(add, Collections.emptySet()));
}
// return all moves
return moves;
} | java | @Override
public List<SubsetMove> getAllMoves(SubsetSolution solution) {
// create empty list to store generated moves
List<SubsetMove> moves = new ArrayList<>();
// get set of candidate IDs for addition (fixed IDs are discarded)
Set<Integer> addCandidates = getAddCandidates(solution);
// compute number of additions
int curNumAdd = numAdditions(addCandidates, solution);
if(curNumAdd == 0){
// impossible: return empty set
return moves;
}
// create all moves that add curNumAdd items
Set<Integer> add;
SubsetIterator<Integer> itAdd = new SubsetIterator<>(addCandidates, curNumAdd);
while(itAdd.hasNext()){
add = itAdd.next();
// create and add move
moves.add(new GeneralSubsetMove(add, Collections.emptySet()));
}
// return all moves
return moves;
} | [
"@",
"Override",
"public",
"List",
"<",
"SubsetMove",
">",
"getAllMoves",
"(",
"SubsetSolution",
"solution",
")",
"{",
"// create empty list to store generated moves",
"List",
"<",
"SubsetMove",
">",
"moves",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// get set of candidate IDs for addition (fixed IDs are discarded)",
"Set",
"<",
"Integer",
">",
"addCandidates",
"=",
"getAddCandidates",
"(",
"solution",
")",
";",
"// compute number of additions",
"int",
"curNumAdd",
"=",
"numAdditions",
"(",
"addCandidates",
",",
"solution",
")",
";",
"if",
"(",
"curNumAdd",
"==",
"0",
")",
"{",
"// impossible: return empty set",
"return",
"moves",
";",
"}",
"// create all moves that add curNumAdd items",
"Set",
"<",
"Integer",
">",
"add",
";",
"SubsetIterator",
"<",
"Integer",
">",
"itAdd",
"=",
"new",
"SubsetIterator",
"<>",
"(",
"addCandidates",
",",
"curNumAdd",
")",
";",
"while",
"(",
"itAdd",
".",
"hasNext",
"(",
")",
")",
"{",
"add",
"=",
"itAdd",
".",
"next",
"(",
")",
";",
"// create and add move",
"moves",
".",
"add",
"(",
"new",
"GeneralSubsetMove",
"(",
"add",
",",
"Collections",
".",
"emptySet",
"(",
")",
")",
")",
";",
"}",
"// return all moves",
"return",
"moves",
";",
"}"
]
| <p>
Generates the list of all possible moves that perform \(k\) additions, where \(k\) is the fixed number
specified at construction. Note: taking into account the current number of unselected items, the imposed
maximum subset size (if set) and the fixed IDs (if any) may result in fewer additions (as many as possible).
</p>
<p>
May return an empty list if no moves can be generated.
</p>
@param solution solution for which all possible multi addition moves are generated
@return list of all multi addition moves, may be empty | [
"<p",
">",
"Generates",
"the",
"list",
"of",
"all",
"possible",
"moves",
"that",
"perform",
"\\",
"(",
"k",
"\\",
")",
"additions",
"where",
"\\",
"(",
"k",
"\\",
")",
"is",
"the",
"fixed",
"number",
"specified",
"at",
"construction",
".",
"Note",
":",
"taking",
"into",
"account",
"the",
"current",
"number",
"of",
"unselected",
"items",
"the",
"imposed",
"maximum",
"subset",
"size",
"(",
"if",
"set",
")",
"and",
"the",
"fixed",
"IDs",
"(",
"if",
"any",
")",
"may",
"result",
"in",
"fewer",
"additions",
"(",
"as",
"many",
"as",
"possible",
")",
".",
"<",
"/",
"p",
">",
"<p",
">",
"May",
"return",
"an",
"empty",
"list",
"if",
"no",
"moves",
"can",
"be",
"generated",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/adv/DisjointMultiAdditionNeighbourhood.java#L176-L198 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/JMessageClient.java | JMessageClient.getAdminListByAppkey | public UserListResult getAdminListByAppkey(int start, int count)
throws APIConnectionException, APIRequestException {
"""
Get admins by appkey
@param start The start index of the list
@param count The number that how many you want to get from list
@return admin user info list
@throws APIConnectionException connect exception
@throws APIRequestException request exception
"""
return _userClient.getAdminListByAppkey(start, count);
} | java | public UserListResult getAdminListByAppkey(int start, int count)
throws APIConnectionException, APIRequestException {
return _userClient.getAdminListByAppkey(start, count);
} | [
"public",
"UserListResult",
"getAdminListByAppkey",
"(",
"int",
"start",
",",
"int",
"count",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"return",
"_userClient",
".",
"getAdminListByAppkey",
"(",
"start",
",",
"count",
")",
";",
"}"
]
| Get admins by appkey
@param start The start index of the list
@param count The number that how many you want to get from list
@return admin user info list
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Get",
"admins",
"by",
"appkey"
]
| train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L216-L219 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java | JQLChecker.replaceFromVariableStatement | public String replaceFromVariableStatement(JQLContext context, String jql, final JQLReplacerListener listener) {
"""
Replace place holder with element passed by listener.
@param context
the context
@param jql
the jql
@param listener
the listener
@return string obtained by replacements
"""
JQLRewriterListener rewriterListener = new JQLRewriterListener();
rewriterListener.init(listener);
return replaceFromVariableStatementInternal(context, jql, replace, rewriterListener);
} | java | public String replaceFromVariableStatement(JQLContext context, String jql, final JQLReplacerListener listener) {
JQLRewriterListener rewriterListener = new JQLRewriterListener();
rewriterListener.init(listener);
return replaceFromVariableStatementInternal(context, jql, replace, rewriterListener);
} | [
"public",
"String",
"replaceFromVariableStatement",
"(",
"JQLContext",
"context",
",",
"String",
"jql",
",",
"final",
"JQLReplacerListener",
"listener",
")",
"{",
"JQLRewriterListener",
"rewriterListener",
"=",
"new",
"JQLRewriterListener",
"(",
")",
";",
"rewriterListener",
".",
"init",
"(",
"listener",
")",
";",
"return",
"replaceFromVariableStatementInternal",
"(",
"context",
",",
"jql",
",",
"replace",
",",
"rewriterListener",
")",
";",
"}"
]
| Replace place holder with element passed by listener.
@param context
the context
@param jql
the jql
@param listener
the listener
@return string obtained by replacements | [
"Replace",
"place",
"holder",
"with",
"element",
"passed",
"by",
"listener",
"."
]
| train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L393-L398 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/Util.java | Util.computeCombinedBufferItemCapacity | static int computeCombinedBufferItemCapacity(final int k, final long n) {
"""
Returns the total item capacity of an updatable, non-compact combined buffer
given <i>k</i> and <i>n</i>. If total levels = 0, this returns the ceiling power of 2
size for the base buffer or the MIN_BASE_BUF_SIZE, whichever is larger.
@param k sketch parameter. This determines the accuracy of the sketch and the
size of the updatable data structure, which is a function of <i>k</i> and <i>n</i>.
@param n The number of items in the input stream
@return the current item capacity of the combined buffer
"""
final int totLevels = computeNumLevelsNeeded(k, n);
if (totLevels == 0) {
final int bbItems = computeBaseBufferItems(k, n);
return Math.max(2 * DoublesSketch.MIN_K, ceilingPowerOf2(bbItems));
}
return (2 + totLevels) * k;
} | java | static int computeCombinedBufferItemCapacity(final int k, final long n) {
final int totLevels = computeNumLevelsNeeded(k, n);
if (totLevels == 0) {
final int bbItems = computeBaseBufferItems(k, n);
return Math.max(2 * DoublesSketch.MIN_K, ceilingPowerOf2(bbItems));
}
return (2 + totLevels) * k;
} | [
"static",
"int",
"computeCombinedBufferItemCapacity",
"(",
"final",
"int",
"k",
",",
"final",
"long",
"n",
")",
"{",
"final",
"int",
"totLevels",
"=",
"computeNumLevelsNeeded",
"(",
"k",
",",
"n",
")",
";",
"if",
"(",
"totLevels",
"==",
"0",
")",
"{",
"final",
"int",
"bbItems",
"=",
"computeBaseBufferItems",
"(",
"k",
",",
"n",
")",
";",
"return",
"Math",
".",
"max",
"(",
"2",
"*",
"DoublesSketch",
".",
"MIN_K",
",",
"ceilingPowerOf2",
"(",
"bbItems",
")",
")",
";",
"}",
"return",
"(",
"2",
"+",
"totLevels",
")",
"*",
"k",
";",
"}"
]
| Returns the total item capacity of an updatable, non-compact combined buffer
given <i>k</i> and <i>n</i>. If total levels = 0, this returns the ceiling power of 2
size for the base buffer or the MIN_BASE_BUF_SIZE, whichever is larger.
@param k sketch parameter. This determines the accuracy of the sketch and the
size of the updatable data structure, which is a function of <i>k</i> and <i>n</i>.
@param n The number of items in the input stream
@return the current item capacity of the combined buffer | [
"Returns",
"the",
"total",
"item",
"capacity",
"of",
"an",
"updatable",
"non",
"-",
"compact",
"combined",
"buffer",
"given",
"<i",
">",
"k<",
"/",
"i",
">",
"and",
"<i",
">",
"n<",
"/",
"i",
">",
".",
"If",
"total",
"levels",
"=",
"0",
"this",
"returns",
"the",
"ceiling",
"power",
"of",
"2",
"size",
"for",
"the",
"base",
"buffer",
"or",
"the",
"MIN_BASE_BUF_SIZE",
"whichever",
"is",
"larger",
"."
]
| train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/Util.java#L339-L346 |
JoeKerouac/utils | src/main/java/com/joe/utils/collection/CollectionUtil.java | CollectionUtil.calcStackDeep | public static <T> int calcStackDeep(List<T> input, List<T> output) {
"""
给定原顺序队列与出栈顺序队列求出栈最小深度
@param input 原队列,不能包含重复元素
@param output 出栈队列
@param <T> 数据类型
@return 栈的最小深度
"""
int max = 0;
//当前已有交集大小
int helper = 0;
for (int i = 0; i < output.size(); i++) {
// 求出出栈元素在原队列中的位置index,然后算出原队列0-index区间与出栈队列0-i区间的交集,用index-该交集长度加上当前元素占用
// 位置就是当前栈深度,然后遍历出栈队列取最大栈深度即可
Object obj = output.get(i);
int index = input.indexOf(obj);
if ((index - Math.min(index, i) + 1 - helper) <= max) {
continue;
}
int repeat = helper = intersection(input, 0, index, output, 0, i).size();
int temp = index - repeat + 1;
max = temp > max ? temp : max;
}
return max;
} | java | public static <T> int calcStackDeep(List<T> input, List<T> output) {
int max = 0;
//当前已有交集大小
int helper = 0;
for (int i = 0; i < output.size(); i++) {
// 求出出栈元素在原队列中的位置index,然后算出原队列0-index区间与出栈队列0-i区间的交集,用index-该交集长度加上当前元素占用
// 位置就是当前栈深度,然后遍历出栈队列取最大栈深度即可
Object obj = output.get(i);
int index = input.indexOf(obj);
if ((index - Math.min(index, i) + 1 - helper) <= max) {
continue;
}
int repeat = helper = intersection(input, 0, index, output, 0, i).size();
int temp = index - repeat + 1;
max = temp > max ? temp : max;
}
return max;
} | [
"public",
"static",
"<",
"T",
">",
"int",
"calcStackDeep",
"(",
"List",
"<",
"T",
">",
"input",
",",
"List",
"<",
"T",
">",
"output",
")",
"{",
"int",
"max",
"=",
"0",
";",
"//当前已有交集大小",
"int",
"helper",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"output",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"// 求出出栈元素在原队列中的位置index,然后算出原队列0-index区间与出栈队列0-i区间的交集,用index-该交集长度加上当前元素占用",
"// 位置就是当前栈深度,然后遍历出栈队列取最大栈深度即可",
"Object",
"obj",
"=",
"output",
".",
"get",
"(",
"i",
")",
";",
"int",
"index",
"=",
"input",
".",
"indexOf",
"(",
"obj",
")",
";",
"if",
"(",
"(",
"index",
"-",
"Math",
".",
"min",
"(",
"index",
",",
"i",
")",
"+",
"1",
"-",
"helper",
")",
"<=",
"max",
")",
"{",
"continue",
";",
"}",
"int",
"repeat",
"=",
"helper",
"=",
"intersection",
"(",
"input",
",",
"0",
",",
"index",
",",
"output",
",",
"0",
",",
"i",
")",
".",
"size",
"(",
")",
";",
"int",
"temp",
"=",
"index",
"-",
"repeat",
"+",
"1",
";",
"max",
"=",
"temp",
">",
"max",
"?",
"temp",
":",
"max",
";",
"}",
"return",
"max",
";",
"}"
]
| 给定原顺序队列与出栈顺序队列求出栈最小深度
@param input 原队列,不能包含重复元素
@param output 出栈队列
@param <T> 数据类型
@return 栈的最小深度 | [
"给定原顺序队列与出栈顺序队列求出栈最小深度"
]
| train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/collection/CollectionUtil.java#L96-L113 |
qzagarese/hyaline-dto | hyaline-dto/src/main/java/org/hyalinedto/api/Hyaline.java | Hyaline.dtoFromScratch | public static Object dtoFromScratch(DTO dtoTemplate, String proxyClassName) throws HyalineException {
"""
It lets you create a new DTO from scratch.
@param dtoTemplate
the DTO template passed as an anonymous class.
@param proxyClassName
the name you want to assign to newly generated class
@return a new object holding the same instance variables declared in the
dtoTemplate
@throws HyalineException
if the dynamic type could be created.
"""
return dtoFromScratch(new Object(), dtoTemplate, proxyClassName);
} | java | public static Object dtoFromScratch(DTO dtoTemplate, String proxyClassName) throws HyalineException {
return dtoFromScratch(new Object(), dtoTemplate, proxyClassName);
} | [
"public",
"static",
"Object",
"dtoFromScratch",
"(",
"DTO",
"dtoTemplate",
",",
"String",
"proxyClassName",
")",
"throws",
"HyalineException",
"{",
"return",
"dtoFromScratch",
"(",
"new",
"Object",
"(",
")",
",",
"dtoTemplate",
",",
"proxyClassName",
")",
";",
"}"
]
| It lets you create a new DTO from scratch.
@param dtoTemplate
the DTO template passed as an anonymous class.
@param proxyClassName
the name you want to assign to newly generated class
@return a new object holding the same instance variables declared in the
dtoTemplate
@throws HyalineException
if the dynamic type could be created. | [
"It",
"lets",
"you",
"create",
"a",
"new",
"DTO",
"from",
"scratch",
"."
]
| train | https://github.com/qzagarese/hyaline-dto/blob/3392de5b7f93cdb3a1c53aa977ee682c141df5f4/hyaline-dto/src/main/java/org/hyalinedto/api/Hyaline.java#L54-L56 |
MorphiaOrg/morphia | morphia/src/main/java/dev/morphia/utils/Assert.java | Assert.parameterNotNull | public static void parameterNotNull(final String name, final Object reference) {
"""
Validates that the parameter is not null
@param name the parameter name
@param reference the proposed parameter value
"""
if (reference == null) {
raiseError(format("Parameter '%s' is not expected to be null.", name));
}
} | java | public static void parameterNotNull(final String name, final Object reference) {
if (reference == null) {
raiseError(format("Parameter '%s' is not expected to be null.", name));
}
} | [
"public",
"static",
"void",
"parameterNotNull",
"(",
"final",
"String",
"name",
",",
"final",
"Object",
"reference",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"raiseError",
"(",
"format",
"(",
"\"Parameter '%s' is not expected to be null.\"",
",",
"name",
")",
")",
";",
"}",
"}"
]
| Validates that the parameter is not null
@param name the parameter name
@param reference the proposed parameter value | [
"Validates",
"that",
"the",
"parameter",
"is",
"not",
"null"
]
| train | https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/Assert.java#L49-L53 |
padrig64/ValidationFramework | validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java | AbstractComponentDecoration.updateDecorationPainterClippedBounds | private void updateDecorationPainterClippedBounds(JLayeredPane layeredPane, Point relativeLocationToOwner) {
"""
Calculates and updates the clipped bounds of the decoration painter in layered pane coordinates.
@param layeredPane Layered pane containing the decoration painter.
@param relativeLocationToOwner Location of the decoration painter relatively to the decorated component.
"""
if (layeredPane == null) {
decorationPainter.setClipBounds(null);
} else {
JComponent clippingComponent = getEffectiveClippingAncestor();
if (clippingComponent == null) {
LOGGER.error("No decoration clipping component can be found for decorated component: " +
decoratedComponent);
decorationPainter.setClipBounds(null);
} else if (clippingComponent.isShowing()) {
Rectangle ownerBoundsInParent = decoratedComponent.getBounds();
Rectangle decorationBoundsInParent = new Rectangle(ownerBoundsInParent.x + relativeLocationToOwner.x,
ownerBoundsInParent.y + relativeLocationToOwner.y, getWidth(), getHeight());
Rectangle decorationBoundsInAncestor = SwingUtilities.convertRectangle(decoratedComponent.getParent()
, decorationBoundsInParent, clippingComponent);
Rectangle decorationVisibleBoundsInAncestor;
Rectangle ancestorVisibleRect = clippingComponent.getVisibleRect();
decorationVisibleBoundsInAncestor = ancestorVisibleRect.intersection(decorationBoundsInAncestor);
if ((decorationVisibleBoundsInAncestor.width == 0) || (decorationVisibleBoundsInAncestor.height == 0)) {
// No bounds, no painting
decorationPainter.setClipBounds(null);
} else {
Rectangle decorationVisibleBoundsInLayeredPane = SwingUtilities.convertRectangle
(clippingComponent, decorationVisibleBoundsInAncestor, layeredPane);
// Clip graphics context
Rectangle clipBounds = SwingUtilities.convertRectangle(decorationPainter.getParent(),
decorationVisibleBoundsInLayeredPane, decorationPainter);
decorationPainter.setClipBounds(clipBounds);
}
} else {
// This could happen for example when a dialog is closed, so no need to log anything
decorationPainter.setClipBounds(null);
}
}
} | java | private void updateDecorationPainterClippedBounds(JLayeredPane layeredPane, Point relativeLocationToOwner) {
if (layeredPane == null) {
decorationPainter.setClipBounds(null);
} else {
JComponent clippingComponent = getEffectiveClippingAncestor();
if (clippingComponent == null) {
LOGGER.error("No decoration clipping component can be found for decorated component: " +
decoratedComponent);
decorationPainter.setClipBounds(null);
} else if (clippingComponent.isShowing()) {
Rectangle ownerBoundsInParent = decoratedComponent.getBounds();
Rectangle decorationBoundsInParent = new Rectangle(ownerBoundsInParent.x + relativeLocationToOwner.x,
ownerBoundsInParent.y + relativeLocationToOwner.y, getWidth(), getHeight());
Rectangle decorationBoundsInAncestor = SwingUtilities.convertRectangle(decoratedComponent.getParent()
, decorationBoundsInParent, clippingComponent);
Rectangle decorationVisibleBoundsInAncestor;
Rectangle ancestorVisibleRect = clippingComponent.getVisibleRect();
decorationVisibleBoundsInAncestor = ancestorVisibleRect.intersection(decorationBoundsInAncestor);
if ((decorationVisibleBoundsInAncestor.width == 0) || (decorationVisibleBoundsInAncestor.height == 0)) {
// No bounds, no painting
decorationPainter.setClipBounds(null);
} else {
Rectangle decorationVisibleBoundsInLayeredPane = SwingUtilities.convertRectangle
(clippingComponent, decorationVisibleBoundsInAncestor, layeredPane);
// Clip graphics context
Rectangle clipBounds = SwingUtilities.convertRectangle(decorationPainter.getParent(),
decorationVisibleBoundsInLayeredPane, decorationPainter);
decorationPainter.setClipBounds(clipBounds);
}
} else {
// This could happen for example when a dialog is closed, so no need to log anything
decorationPainter.setClipBounds(null);
}
}
} | [
"private",
"void",
"updateDecorationPainterClippedBounds",
"(",
"JLayeredPane",
"layeredPane",
",",
"Point",
"relativeLocationToOwner",
")",
"{",
"if",
"(",
"layeredPane",
"==",
"null",
")",
"{",
"decorationPainter",
".",
"setClipBounds",
"(",
"null",
")",
";",
"}",
"else",
"{",
"JComponent",
"clippingComponent",
"=",
"getEffectiveClippingAncestor",
"(",
")",
";",
"if",
"(",
"clippingComponent",
"==",
"null",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"No decoration clipping component can be found for decorated component: \"",
"+",
"decoratedComponent",
")",
";",
"decorationPainter",
".",
"setClipBounds",
"(",
"null",
")",
";",
"}",
"else",
"if",
"(",
"clippingComponent",
".",
"isShowing",
"(",
")",
")",
"{",
"Rectangle",
"ownerBoundsInParent",
"=",
"decoratedComponent",
".",
"getBounds",
"(",
")",
";",
"Rectangle",
"decorationBoundsInParent",
"=",
"new",
"Rectangle",
"(",
"ownerBoundsInParent",
".",
"x",
"+",
"relativeLocationToOwner",
".",
"x",
",",
"ownerBoundsInParent",
".",
"y",
"+",
"relativeLocationToOwner",
".",
"y",
",",
"getWidth",
"(",
")",
",",
"getHeight",
"(",
")",
")",
";",
"Rectangle",
"decorationBoundsInAncestor",
"=",
"SwingUtilities",
".",
"convertRectangle",
"(",
"decoratedComponent",
".",
"getParent",
"(",
")",
",",
"decorationBoundsInParent",
",",
"clippingComponent",
")",
";",
"Rectangle",
"decorationVisibleBoundsInAncestor",
";",
"Rectangle",
"ancestorVisibleRect",
"=",
"clippingComponent",
".",
"getVisibleRect",
"(",
")",
";",
"decorationVisibleBoundsInAncestor",
"=",
"ancestorVisibleRect",
".",
"intersection",
"(",
"decorationBoundsInAncestor",
")",
";",
"if",
"(",
"(",
"decorationVisibleBoundsInAncestor",
".",
"width",
"==",
"0",
")",
"||",
"(",
"decorationVisibleBoundsInAncestor",
".",
"height",
"==",
"0",
")",
")",
"{",
"// No bounds, no painting",
"decorationPainter",
".",
"setClipBounds",
"(",
"null",
")",
";",
"}",
"else",
"{",
"Rectangle",
"decorationVisibleBoundsInLayeredPane",
"=",
"SwingUtilities",
".",
"convertRectangle",
"(",
"clippingComponent",
",",
"decorationVisibleBoundsInAncestor",
",",
"layeredPane",
")",
";",
"// Clip graphics context",
"Rectangle",
"clipBounds",
"=",
"SwingUtilities",
".",
"convertRectangle",
"(",
"decorationPainter",
".",
"getParent",
"(",
")",
",",
"decorationVisibleBoundsInLayeredPane",
",",
"decorationPainter",
")",
";",
"decorationPainter",
".",
"setClipBounds",
"(",
"clipBounds",
")",
";",
"}",
"}",
"else",
"{",
"// This could happen for example when a dialog is closed, so no need to log anything",
"decorationPainter",
".",
"setClipBounds",
"(",
"null",
")",
";",
"}",
"}",
"}"
]
| Calculates and updates the clipped bounds of the decoration painter in layered pane coordinates.
@param layeredPane Layered pane containing the decoration painter.
@param relativeLocationToOwner Location of the decoration painter relatively to the decorated component. | [
"Calculates",
"and",
"updates",
"the",
"clipped",
"bounds",
"of",
"the",
"decoration",
"painter",
"in",
"layered",
"pane",
"coordinates",
"."
]
| train | https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/AbstractComponentDecoration.java#L691-L727 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateXYZ | public Matrix4f rotateXYZ(Vector3f angles) {
"""
Apply rotation of <code>angles.x</code> radians about the X axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and
followed by a rotation of <code>angles.z</code> radians about the Z axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateX(angles.x).rotateY(angles.y).rotateZ(angles.z)</code>
@param angles
the Euler angles
@return this
"""
return rotateXYZ(angles.x, angles.y, angles.z);
} | java | public Matrix4f rotateXYZ(Vector3f angles) {
return rotateXYZ(angles.x, angles.y, angles.z);
} | [
"public",
"Matrix4f",
"rotateXYZ",
"(",
"Vector3f",
"angles",
")",
"{",
"return",
"rotateXYZ",
"(",
"angles",
".",
"x",
",",
"angles",
".",
"y",
",",
"angles",
".",
"z",
")",
";",
"}"
]
| Apply rotation of <code>angles.x</code> radians about the X axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and
followed by a rotation of <code>angles.z</code> radians about the Z axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateX(angles.x).rotateY(angles.y).rotateZ(angles.z)</code>
@param angles
the Euler angles
@return this | [
"Apply",
"rotation",
"of",
"<code",
">",
"angles",
".",
"x<",
"/",
"code",
">",
"radians",
"about",
"the",
"X",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"y<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axis",
"and",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"z<",
"/",
"code",
">",
"radians",
"about",
"the",
"Z",
"axis",
".",
"<p",
">",
"When",
"used",
"with",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"the",
"produced",
"rotation",
"will",
"rotate",
"a",
"vector",
"counter",
"-",
"clockwise",
"around",
"the",
"rotation",
"axis",
"when",
"viewing",
"along",
"the",
"negative",
"axis",
"direction",
"towards",
"the",
"origin",
".",
"When",
"used",
"with",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"the",
"rotation",
"is",
"clockwise",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"R<",
"/",
"code",
">",
"the",
"rotation",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"R<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"R",
"*",
"v<",
"/",
"code",
">",
"the",
"rotation",
"will",
"be",
"applied",
"first!",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
":",
"<code",
">",
"rotateX",
"(",
"angles",
".",
"x",
")",
".",
"rotateY",
"(",
"angles",
".",
"y",
")",
".",
"rotateZ",
"(",
"angles",
".",
"z",
")",
"<",
"/",
"code",
">"
]
| train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L5287-L5289 |
bartprokop/rxtx | src/main/java/gnu/io/RXTXPort.java | RXTXPort.setUARTType | @Override
public boolean setUARTType(String type, boolean test)
throws UnsupportedCommOperationException {
"""
Extension to CommAPI This is an extension to CommAPI. It may not be
supported on all operating systems.
@param type String representation of the UART type which mayb be "none",
"8250", "16450", "16550", "16550A", "16650", "16550V2" or "16750".
@param test boolean flag to determin if the UART should be tested.
@return boolean true on success
@throws UnsupportedCommOperationException on error
"""
logger.fine("RXTXPort:setUARTType()");
return nativeSetUartType(type, test);
} | java | @Override
public boolean setUARTType(String type, boolean test)
throws UnsupportedCommOperationException {
logger.fine("RXTXPort:setUARTType()");
return nativeSetUartType(type, test);
} | [
"@",
"Override",
"public",
"boolean",
"setUARTType",
"(",
"String",
"type",
",",
"boolean",
"test",
")",
"throws",
"UnsupportedCommOperationException",
"{",
"logger",
".",
"fine",
"(",
"\"RXTXPort:setUARTType()\"",
")",
";",
"return",
"nativeSetUartType",
"(",
"type",
",",
"test",
")",
";",
"}"
]
| Extension to CommAPI This is an extension to CommAPI. It may not be
supported on all operating systems.
@param type String representation of the UART type which mayb be "none",
"8250", "16450", "16550", "16550A", "16650", "16550V2" or "16750".
@param test boolean flag to determin if the UART should be tested.
@return boolean true on success
@throws UnsupportedCommOperationException on error | [
"Extension",
"to",
"CommAPI",
"This",
"is",
"an",
"extension",
"to",
"CommAPI",
".",
"It",
"may",
"not",
"be",
"supported",
"on",
"all",
"operating",
"systems",
"."
]
| train | https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/RXTXPort.java#L1971-L1977 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/backend/BackendManager.java | BackendManager.convertExceptionToJson | public Object convertExceptionToJson(Throwable pExp, JmxRequest pJmxReq) {
"""
Convert a Throwable to a JSON object so that it can be included in an error response
@param pExp throwable to convert
@param pJmxReq the request from where to take the serialization options
@return the exception.
"""
JsonConvertOptions opts = getJsonConvertOptions(pJmxReq);
try {
JSONObject expObj =
(JSONObject) converters.getToJsonConverter().convertToJson(pExp,null,opts);
return expObj;
} catch (AttributeNotFoundException e) {
// Cannot happen, since we dont use a path
return null;
}
} | java | public Object convertExceptionToJson(Throwable pExp, JmxRequest pJmxReq) {
JsonConvertOptions opts = getJsonConvertOptions(pJmxReq);
try {
JSONObject expObj =
(JSONObject) converters.getToJsonConverter().convertToJson(pExp,null,opts);
return expObj;
} catch (AttributeNotFoundException e) {
// Cannot happen, since we dont use a path
return null;
}
} | [
"public",
"Object",
"convertExceptionToJson",
"(",
"Throwable",
"pExp",
",",
"JmxRequest",
"pJmxReq",
")",
"{",
"JsonConvertOptions",
"opts",
"=",
"getJsonConvertOptions",
"(",
"pJmxReq",
")",
";",
"try",
"{",
"JSONObject",
"expObj",
"=",
"(",
"JSONObject",
")",
"converters",
".",
"getToJsonConverter",
"(",
")",
".",
"convertToJson",
"(",
"pExp",
",",
"null",
",",
"opts",
")",
";",
"return",
"expObj",
";",
"}",
"catch",
"(",
"AttributeNotFoundException",
"e",
")",
"{",
"// Cannot happen, since we dont use a path",
"return",
"null",
";",
"}",
"}"
]
| Convert a Throwable to a JSON object so that it can be included in an error response
@param pExp throwable to convert
@param pJmxReq the request from where to take the serialization options
@return the exception. | [
"Convert",
"a",
"Throwable",
"to",
"a",
"JSON",
"object",
"so",
"that",
"it",
"can",
"be",
"included",
"in",
"an",
"error",
"response"
]
| train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/backend/BackendManager.java#L187-L198 |
spring-projects/spring-mobile | spring-mobile-device/src/main/java/org/springframework/mobile/device/LiteDeviceResolver.java | LiteDeviceResolver.resolveWithPlatform | protected Device resolveWithPlatform(DeviceType deviceType, DevicePlatform devicePlatform) {
"""
Wrapper method for allow subclassing platform based resolution
"""
return LiteDevice.from(deviceType, devicePlatform);
} | java | protected Device resolveWithPlatform(DeviceType deviceType, DevicePlatform devicePlatform) {
return LiteDevice.from(deviceType, devicePlatform);
} | [
"protected",
"Device",
"resolveWithPlatform",
"(",
"DeviceType",
"deviceType",
",",
"DevicePlatform",
"devicePlatform",
")",
"{",
"return",
"LiteDevice",
".",
"from",
"(",
"deviceType",
",",
"devicePlatform",
")",
";",
"}"
]
| Wrapper method for allow subclassing platform based resolution | [
"Wrapper",
"method",
"for",
"allow",
"subclassing",
"platform",
"based",
"resolution"
]
| train | https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/LiteDeviceResolver.java#L158-L160 |
skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java | LargestAreaFitFirstPackager.removeIdentical | private void removeIdentical(List<Box> containerProducts, Box currentBox) {
"""
Remove from list, more explicit implementation than {@linkplain List#remove} with no equals.
@param containerProducts list of products
@param currentBox item to remove
"""
for(int i = 0; i < containerProducts.size(); i++) {
if(containerProducts.get(i) == currentBox) {
containerProducts.remove(i);
return;
}
}
throw new IllegalArgumentException();
} | java | private void removeIdentical(List<Box> containerProducts, Box currentBox) {
for(int i = 0; i < containerProducts.size(); i++) {
if(containerProducts.get(i) == currentBox) {
containerProducts.remove(i);
return;
}
}
throw new IllegalArgumentException();
} | [
"private",
"void",
"removeIdentical",
"(",
"List",
"<",
"Box",
">",
"containerProducts",
",",
"Box",
"currentBox",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"containerProducts",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"containerProducts",
".",
"get",
"(",
"i",
")",
"==",
"currentBox",
")",
"{",
"containerProducts",
".",
"remove",
"(",
"i",
")",
";",
"return",
";",
"}",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}"
]
| Remove from list, more explicit implementation than {@linkplain List#remove} with no equals.
@param containerProducts list of products
@param currentBox item to remove | [
"Remove",
"from",
"list",
"more",
"explicit",
"implementation",
"than",
"{"
]
| train | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java#L163-L172 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/text/DecimalFormat.java | DecimalFormat.expandAffix | private String expandAffix(String pattern, StringBuffer buffer) {
"""
Expand an affix pattern into an affix string. All characters in the
pattern are literal unless prefixed by QUOTE. The following characters
after QUOTE are recognized: PATTERN_PERCENT, PATTERN_PER_MILLE,
PATTERN_MINUS, and CURRENCY_SIGN. If CURRENCY_SIGN is doubled (QUOTE +
CURRENCY_SIGN + CURRENCY_SIGN), it is interpreted as an ISO 4217
currency code. Any other character after a QUOTE represents itself.
QUOTE must be followed by another character; QUOTE may not occur by
itself at the end of the pattern.
@param pattern the non-null, possibly empty pattern
@param buffer a scratch StringBuffer; its contents will be lost
@return the expanded equivalent of pattern
"""
buffer.setLength(0);
for (int i=0; i<pattern.length(); ) {
char c = pattern.charAt(i++);
if (c == QUOTE) {
c = pattern.charAt(i++);
switch (c) {
case CURRENCY_SIGN:
if (i<pattern.length() &&
pattern.charAt(i) == CURRENCY_SIGN) {
++i;
buffer.append(symbols.getInternationalCurrencySymbol());
} else {
buffer.append(symbols.getCurrencySymbol());
}
continue;
case PATTERN_PERCENT:
c = symbols.getPercent();
break;
case PATTERN_PER_MILLE:
c = symbols.getPerMill();
break;
case PATTERN_MINUS:
c = symbols.getMinusSign();
break;
}
}
buffer.append(c);
}
return buffer.toString();
} | java | private String expandAffix(String pattern, StringBuffer buffer) {
buffer.setLength(0);
for (int i=0; i<pattern.length(); ) {
char c = pattern.charAt(i++);
if (c == QUOTE) {
c = pattern.charAt(i++);
switch (c) {
case CURRENCY_SIGN:
if (i<pattern.length() &&
pattern.charAt(i) == CURRENCY_SIGN) {
++i;
buffer.append(symbols.getInternationalCurrencySymbol());
} else {
buffer.append(symbols.getCurrencySymbol());
}
continue;
case PATTERN_PERCENT:
c = symbols.getPercent();
break;
case PATTERN_PER_MILLE:
c = symbols.getPerMill();
break;
case PATTERN_MINUS:
c = symbols.getMinusSign();
break;
}
}
buffer.append(c);
}
return buffer.toString();
} | [
"private",
"String",
"expandAffix",
"(",
"String",
"pattern",
",",
"StringBuffer",
"buffer",
")",
"{",
"buffer",
".",
"setLength",
"(",
"0",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pattern",
".",
"length",
"(",
")",
";",
")",
"{",
"char",
"c",
"=",
"pattern",
".",
"charAt",
"(",
"i",
"++",
")",
";",
"if",
"(",
"c",
"==",
"QUOTE",
")",
"{",
"c",
"=",
"pattern",
".",
"charAt",
"(",
"i",
"++",
")",
";",
"switch",
"(",
"c",
")",
"{",
"case",
"CURRENCY_SIGN",
":",
"if",
"(",
"i",
"<",
"pattern",
".",
"length",
"(",
")",
"&&",
"pattern",
".",
"charAt",
"(",
"i",
")",
"==",
"CURRENCY_SIGN",
")",
"{",
"++",
"i",
";",
"buffer",
".",
"append",
"(",
"symbols",
".",
"getInternationalCurrencySymbol",
"(",
")",
")",
";",
"}",
"else",
"{",
"buffer",
".",
"append",
"(",
"symbols",
".",
"getCurrencySymbol",
"(",
")",
")",
";",
"}",
"continue",
";",
"case",
"PATTERN_PERCENT",
":",
"c",
"=",
"symbols",
".",
"getPercent",
"(",
")",
";",
"break",
";",
"case",
"PATTERN_PER_MILLE",
":",
"c",
"=",
"symbols",
".",
"getPerMill",
"(",
")",
";",
"break",
";",
"case",
"PATTERN_MINUS",
":",
"c",
"=",
"symbols",
".",
"getMinusSign",
"(",
")",
";",
"break",
";",
"}",
"}",
"buffer",
".",
"append",
"(",
"c",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
]
| Expand an affix pattern into an affix string. All characters in the
pattern are literal unless prefixed by QUOTE. The following characters
after QUOTE are recognized: PATTERN_PERCENT, PATTERN_PER_MILLE,
PATTERN_MINUS, and CURRENCY_SIGN. If CURRENCY_SIGN is doubled (QUOTE +
CURRENCY_SIGN + CURRENCY_SIGN), it is interpreted as an ISO 4217
currency code. Any other character after a QUOTE represents itself.
QUOTE must be followed by another character; QUOTE may not occur by
itself at the end of the pattern.
@param pattern the non-null, possibly empty pattern
@param buffer a scratch StringBuffer; its contents will be lost
@return the expanded equivalent of pattern | [
"Expand",
"an",
"affix",
"pattern",
"into",
"an",
"affix",
"string",
".",
"All",
"characters",
"in",
"the",
"pattern",
"are",
"literal",
"unless",
"prefixed",
"by",
"QUOTE",
".",
"The",
"following",
"characters",
"after",
"QUOTE",
"are",
"recognized",
":",
"PATTERN_PERCENT",
"PATTERN_PER_MILLE",
"PATTERN_MINUS",
"and",
"CURRENCY_SIGN",
".",
"If",
"CURRENCY_SIGN",
"is",
"doubled",
"(",
"QUOTE",
"+",
"CURRENCY_SIGN",
"+",
"CURRENCY_SIGN",
")",
"it",
"is",
"interpreted",
"as",
"an",
"ISO",
"4217",
"currency",
"code",
".",
"Any",
"other",
"character",
"after",
"a",
"QUOTE",
"represents",
"itself",
".",
"QUOTE",
"must",
"be",
"followed",
"by",
"another",
"character",
";",
"QUOTE",
"may",
"not",
"occur",
"by",
"itself",
"at",
"the",
"end",
"of",
"the",
"pattern",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/text/DecimalFormat.java#L2817-L2847 |
knowm/XChange | xchange-bitstamp/src/main/java/org/knowm/xchange/bitstamp/BitstampAdapters.java | BitstampAdapters.adaptAccountInfo | public static AccountInfo adaptAccountInfo(BitstampBalance bitstampBalance, String userName) {
"""
Adapts a BitstampBalance to an AccountInfo
@param bitstampBalance The Bitstamp balance
@param userName The user name
@return The account info
"""
// Adapt to XChange DTOs
List<Balance> balances = new ArrayList<>();
for (org.knowm.xchange.bitstamp.dto.account.BitstampBalance.Balance b :
bitstampBalance.getBalances()) {
Balance xchangeBalance =
new Balance(
Currency.getInstance(b.getCurrency().toUpperCase()),
b.getBalance(),
b.getAvailable(),
b.getReserved(),
ZERO,
ZERO,
b.getBalance().subtract(b.getAvailable()).subtract(b.getReserved()),
ZERO);
balances.add(xchangeBalance);
}
return new AccountInfo(userName, bitstampBalance.getFee(), new Wallet(balances));
} | java | public static AccountInfo adaptAccountInfo(BitstampBalance bitstampBalance, String userName) {
// Adapt to XChange DTOs
List<Balance> balances = new ArrayList<>();
for (org.knowm.xchange.bitstamp.dto.account.BitstampBalance.Balance b :
bitstampBalance.getBalances()) {
Balance xchangeBalance =
new Balance(
Currency.getInstance(b.getCurrency().toUpperCase()),
b.getBalance(),
b.getAvailable(),
b.getReserved(),
ZERO,
ZERO,
b.getBalance().subtract(b.getAvailable()).subtract(b.getReserved()),
ZERO);
balances.add(xchangeBalance);
}
return new AccountInfo(userName, bitstampBalance.getFee(), new Wallet(balances));
} | [
"public",
"static",
"AccountInfo",
"adaptAccountInfo",
"(",
"BitstampBalance",
"bitstampBalance",
",",
"String",
"userName",
")",
"{",
"// Adapt to XChange DTOs",
"List",
"<",
"Balance",
">",
"balances",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"org",
".",
"knowm",
".",
"xchange",
".",
"bitstamp",
".",
"dto",
".",
"account",
".",
"BitstampBalance",
".",
"Balance",
"b",
":",
"bitstampBalance",
".",
"getBalances",
"(",
")",
")",
"{",
"Balance",
"xchangeBalance",
"=",
"new",
"Balance",
"(",
"Currency",
".",
"getInstance",
"(",
"b",
".",
"getCurrency",
"(",
")",
".",
"toUpperCase",
"(",
")",
")",
",",
"b",
".",
"getBalance",
"(",
")",
",",
"b",
".",
"getAvailable",
"(",
")",
",",
"b",
".",
"getReserved",
"(",
")",
",",
"ZERO",
",",
"ZERO",
",",
"b",
".",
"getBalance",
"(",
")",
".",
"subtract",
"(",
"b",
".",
"getAvailable",
"(",
")",
")",
".",
"subtract",
"(",
"b",
".",
"getReserved",
"(",
")",
")",
",",
"ZERO",
")",
";",
"balances",
".",
"add",
"(",
"xchangeBalance",
")",
";",
"}",
"return",
"new",
"AccountInfo",
"(",
"userName",
",",
"bitstampBalance",
".",
"getFee",
"(",
")",
",",
"new",
"Wallet",
"(",
"balances",
")",
")",
";",
"}"
]
| Adapts a BitstampBalance to an AccountInfo
@param bitstampBalance The Bitstamp balance
@param userName The user name
@return The account info | [
"Adapts",
"a",
"BitstampBalance",
"to",
"an",
"AccountInfo"
]
| train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitstamp/src/main/java/org/knowm/xchange/bitstamp/BitstampAdapters.java#L54-L73 |
zamrokk/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Chain.java | Chain.eventHubConnect | public void eventHubConnect(String peerUrl, String pem) {
"""
Set and connect to the peer to be used as the event source.
@param peerUrl peerUrl
@param pem permission
"""
this.eventHub.setPeerAddr(peerUrl, pem);
this.eventHub.connect();
} | java | public void eventHubConnect(String peerUrl, String pem) {
this.eventHub.setPeerAddr(peerUrl, pem);
this.eventHub.connect();
} | [
"public",
"void",
"eventHubConnect",
"(",
"String",
"peerUrl",
",",
"String",
"pem",
")",
"{",
"this",
".",
"eventHub",
".",
"setPeerAddr",
"(",
"peerUrl",
",",
"pem",
")",
";",
"this",
".",
"eventHub",
".",
"connect",
"(",
")",
";",
"}"
]
| Set and connect to the peer to be used as the event source.
@param peerUrl peerUrl
@param pem permission | [
"Set",
"and",
"connect",
"to",
"the",
"peer",
"to",
"be",
"used",
"as",
"the",
"event",
"source",
"."
]
| train | https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/Chain.java#L275-L278 |
apache/incubator-druid | core/src/main/java/org/apache/druid/java/util/common/Numbers.java | Numbers.parseInt | public static int parseInt(Object val) {
"""
Parse the given object as a {@code int}. The input object can be a {@link String} or one of the implementations of
{@link Number}.
@throws NumberFormatException if the input is an unparseable string.
@throws NullPointerException if the input is null.
@throws ISE if the input is not a string or a number.
"""
if (val instanceof String) {
return Integer.parseInt((String) val);
} else if (val instanceof Number) {
return ((Number) val).intValue();
} else {
if (val == null) {
throw new NullPointerException("Input is null");
} else {
throw new ISE("Unknown type [%s]", val.getClass());
}
}
} | java | public static int parseInt(Object val)
{
if (val instanceof String) {
return Integer.parseInt((String) val);
} else if (val instanceof Number) {
return ((Number) val).intValue();
} else {
if (val == null) {
throw new NullPointerException("Input is null");
} else {
throw new ISE("Unknown type [%s]", val.getClass());
}
}
} | [
"public",
"static",
"int",
"parseInt",
"(",
"Object",
"val",
")",
"{",
"if",
"(",
"val",
"instanceof",
"String",
")",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"(",
"String",
")",
"val",
")",
";",
"}",
"else",
"if",
"(",
"val",
"instanceof",
"Number",
")",
"{",
"return",
"(",
"(",
"Number",
")",
"val",
")",
".",
"intValue",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Input is null\"",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"ISE",
"(",
"\"Unknown type [%s]\"",
",",
"val",
".",
"getClass",
"(",
")",
")",
";",
"}",
"}",
"}"
]
| Parse the given object as a {@code int}. The input object can be a {@link String} or one of the implementations of
{@link Number}.
@throws NumberFormatException if the input is an unparseable string.
@throws NullPointerException if the input is null.
@throws ISE if the input is not a string or a number. | [
"Parse",
"the",
"given",
"object",
"as",
"a",
"{",
"@code",
"int",
"}",
".",
"The",
"input",
"object",
"can",
"be",
"a",
"{",
"@link",
"String",
"}",
"or",
"one",
"of",
"the",
"implementations",
"of",
"{",
"@link",
"Number",
"}",
"."
]
| train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/java/util/common/Numbers.java#L56-L69 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java | XmlStringBuilder.appendOptionalAttribute | public void appendOptionalAttribute(final String name, final Object value) {
"""
<p>
If the value is not null, add an xml attribute name+value pair to the end of this XmlStringBuilder
<p>
Eg. name="value"
</p>
@param name the name of the attribute to be added.
@param value the value of the attribute.
"""
if (value != null) {
appendAttribute(name, value);
}
} | java | public void appendOptionalAttribute(final String name, final Object value) {
if (value != null) {
appendAttribute(name, value);
}
} | [
"public",
"void",
"appendOptionalAttribute",
"(",
"final",
"String",
"name",
",",
"final",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"appendAttribute",
"(",
"name",
",",
"value",
")",
";",
"}",
"}"
]
| <p>
If the value is not null, add an xml attribute name+value pair to the end of this XmlStringBuilder
<p>
Eg. name="value"
</p>
@param name the name of the attribute to be added.
@param value the value of the attribute. | [
"<p",
">",
"If",
"the",
"value",
"is",
"not",
"null",
"add",
"an",
"xml",
"attribute",
"name",
"+",
"value",
"pair",
"to",
"the",
"end",
"of",
"this",
"XmlStringBuilder",
"<p",
">",
"Eg",
".",
"name",
"=",
"value",
"<",
"/",
"p",
">"
]
| train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java#L233-L237 |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/MaterializeBuilder.java | MaterializeBuilder.withContainer | public MaterializeBuilder withContainer(ViewGroup container, ViewGroup.LayoutParams layoutParams) {
"""
set the layout which will host the ScrimInsetsFrameLayout and its layoutParams
@param container
@param layoutParams
@return
"""
this.mContainer = container;
this.mContainerLayoutParams = layoutParams;
return this;
} | java | public MaterializeBuilder withContainer(ViewGroup container, ViewGroup.LayoutParams layoutParams) {
this.mContainer = container;
this.mContainerLayoutParams = layoutParams;
return this;
} | [
"public",
"MaterializeBuilder",
"withContainer",
"(",
"ViewGroup",
"container",
",",
"ViewGroup",
".",
"LayoutParams",
"layoutParams",
")",
"{",
"this",
".",
"mContainer",
"=",
"container",
";",
"this",
".",
"mContainerLayoutParams",
"=",
"layoutParams",
";",
"return",
"this",
";",
"}"
]
| set the layout which will host the ScrimInsetsFrameLayout and its layoutParams
@param container
@param layoutParams
@return | [
"set",
"the",
"layout",
"which",
"will",
"host",
"the",
"ScrimInsetsFrameLayout",
"and",
"its",
"layoutParams"
]
| train | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/MaterializeBuilder.java#L314-L318 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java | TypeQualifierApplications.getDirectApplications | public static void getDirectApplications(Set<TypeQualifierAnnotation> result, AnnotatedObject o, ElementType e) {
"""
Populate a Set of TypeQualifierAnnotations representing directly-applied
type qualifier annotations on given AnnotatedObject.
@param result
Set of TypeQualifierAnnotations
@param o
an AnnotatedObject
@param e
ElementType representing kind of annotated object
"""
if (!o.getElementType().equals(e)) {
return;
}
Collection<AnnotationValue> values = getDirectAnnotation(o);
for (AnnotationValue v : values) {
constructTypeQualifierAnnotation(result, v);
}
} | java | public static void getDirectApplications(Set<TypeQualifierAnnotation> result, AnnotatedObject o, ElementType e) {
if (!o.getElementType().equals(e)) {
return;
}
Collection<AnnotationValue> values = getDirectAnnotation(o);
for (AnnotationValue v : values) {
constructTypeQualifierAnnotation(result, v);
}
} | [
"public",
"static",
"void",
"getDirectApplications",
"(",
"Set",
"<",
"TypeQualifierAnnotation",
">",
"result",
",",
"AnnotatedObject",
"o",
",",
"ElementType",
"e",
")",
"{",
"if",
"(",
"!",
"o",
".",
"getElementType",
"(",
")",
".",
"equals",
"(",
"e",
")",
")",
"{",
"return",
";",
"}",
"Collection",
"<",
"AnnotationValue",
">",
"values",
"=",
"getDirectAnnotation",
"(",
"o",
")",
";",
"for",
"(",
"AnnotationValue",
"v",
":",
"values",
")",
"{",
"constructTypeQualifierAnnotation",
"(",
"result",
",",
"v",
")",
";",
"}",
"}"
]
| Populate a Set of TypeQualifierAnnotations representing directly-applied
type qualifier annotations on given AnnotatedObject.
@param result
Set of TypeQualifierAnnotations
@param o
an AnnotatedObject
@param e
ElementType representing kind of annotated object | [
"Populate",
"a",
"Set",
"of",
"TypeQualifierAnnotations",
"representing",
"directly",
"-",
"applied",
"type",
"qualifier",
"annotations",
"on",
"given",
"AnnotatedObject",
"."
]
| train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/TypeQualifierApplications.java#L233-L242 |
spotify/docker-maven-plugin | src/main/java/com/spotify/docker/CompositeImageName.java | CompositeImageName.create | static CompositeImageName create(final String imageName, final List<String> imageTags)
throws MojoExecutionException {
"""
An image name can be a plain image name or in the composite format <name>:<tag> and
this factory method makes sure that we get the plain image name as well as all the desired tags
for an image, including any composite tag.
@param imageName Image name.
@param imageTags List of image tags.
@return {@link CompositeImageName}
@throws MojoExecutionException
"""
final boolean containsTag = containsTag(imageName);
final String name = containsTag ? StringUtils.substringBeforeLast(imageName, ":") : imageName;
if (StringUtils.isBlank(name)) {
throw new MojoExecutionException("imageName not set!");
}
final List<String> tags = new ArrayList<>();
final String tag = containsTag ? StringUtils.substringAfterLast(imageName, ":") : "";
if (StringUtils.isNotBlank(tag)) {
tags.add(tag);
}
if (imageTags != null) {
tags.addAll(imageTags);
}
if (tags.size() == 0) {
throw new MojoExecutionException("No tag included in imageName and no imageTags set!");
}
return new CompositeImageName(name, tags);
} | java | static CompositeImageName create(final String imageName, final List<String> imageTags)
throws MojoExecutionException {
final boolean containsTag = containsTag(imageName);
final String name = containsTag ? StringUtils.substringBeforeLast(imageName, ":") : imageName;
if (StringUtils.isBlank(name)) {
throw new MojoExecutionException("imageName not set!");
}
final List<String> tags = new ArrayList<>();
final String tag = containsTag ? StringUtils.substringAfterLast(imageName, ":") : "";
if (StringUtils.isNotBlank(tag)) {
tags.add(tag);
}
if (imageTags != null) {
tags.addAll(imageTags);
}
if (tags.size() == 0) {
throw new MojoExecutionException("No tag included in imageName and no imageTags set!");
}
return new CompositeImageName(name, tags);
} | [
"static",
"CompositeImageName",
"create",
"(",
"final",
"String",
"imageName",
",",
"final",
"List",
"<",
"String",
">",
"imageTags",
")",
"throws",
"MojoExecutionException",
"{",
"final",
"boolean",
"containsTag",
"=",
"containsTag",
"(",
"imageName",
")",
";",
"final",
"String",
"name",
"=",
"containsTag",
"?",
"StringUtils",
".",
"substringBeforeLast",
"(",
"imageName",
",",
"\":\"",
")",
":",
"imageName",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"imageName not set!\"",
")",
";",
"}",
"final",
"List",
"<",
"String",
">",
"tags",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"String",
"tag",
"=",
"containsTag",
"?",
"StringUtils",
".",
"substringAfterLast",
"(",
"imageName",
",",
"\":\"",
")",
":",
"\"\"",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"tag",
")",
")",
"{",
"tags",
".",
"add",
"(",
"tag",
")",
";",
"}",
"if",
"(",
"imageTags",
"!=",
"null",
")",
"{",
"tags",
".",
"addAll",
"(",
"imageTags",
")",
";",
"}",
"if",
"(",
"tags",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"MojoExecutionException",
"(",
"\"No tag included in imageName and no imageTags set!\"",
")",
";",
"}",
"return",
"new",
"CompositeImageName",
"(",
"name",
",",
"tags",
")",
";",
"}"
]
| An image name can be a plain image name or in the composite format <name>:<tag> and
this factory method makes sure that we get the plain image name as well as all the desired tags
for an image, including any composite tag.
@param imageName Image name.
@param imageTags List of image tags.
@return {@link CompositeImageName}
@throws MojoExecutionException | [
"An",
"image",
"name",
"can",
"be",
"a",
"plain",
"image",
"name",
"or",
"in",
"the",
"composite",
"format",
"<",
";",
"name>",
";",
":",
"<",
";",
"tag>",
";",
"and",
"this",
"factory",
"method",
"makes",
"sure",
"that",
"we",
"get",
"the",
"plain",
"image",
"name",
"as",
"well",
"as",
"all",
"the",
"desired",
"tags",
"for",
"an",
"image",
"including",
"any",
"composite",
"tag",
"."
]
| train | https://github.com/spotify/docker-maven-plugin/blob/c5bbc1c4993f5dc37c96457fa5de5af8308f7829/src/main/java/com/spotify/docker/CompositeImageName.java#L53-L75 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/platform/ApplicationUrl.java | ApplicationUrl.upsertPackageFileUrl | public static MozuUrl upsertPackageFileUrl(String applicationKey, String filepath, String lastModifiedTime, String responseFields) {
"""
Get Resource Url for UpsertPackageFile
@param applicationKey The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
@param filepath The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
@param lastModifiedTime The date and time of the last file insert or update. This parameter is optional.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url
"""
UrlFormatter formatter = new UrlFormatter("/api/platform/developer/packages/{applicationKey}/files/{filepath}?lastModifiedTime={lastModifiedTime}&responseFields={responseFields}");
formatter.formatUrl("applicationKey", applicationKey);
formatter.formatUrl("filepath", filepath);
formatter.formatUrl("lastModifiedTime", lastModifiedTime);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | java | public static MozuUrl upsertPackageFileUrl(String applicationKey, String filepath, String lastModifiedTime, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/developer/packages/{applicationKey}/files/{filepath}?lastModifiedTime={lastModifiedTime}&responseFields={responseFields}");
formatter.formatUrl("applicationKey", applicationKey);
formatter.formatUrl("filepath", filepath);
formatter.formatUrl("lastModifiedTime", lastModifiedTime);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | [
"public",
"static",
"MozuUrl",
"upsertPackageFileUrl",
"(",
"String",
"applicationKey",
",",
"String",
"filepath",
",",
"String",
"lastModifiedTime",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/developer/packages/{applicationKey}/files/{filepath}?lastModifiedTime={lastModifiedTime}&responseFields={responseFields}\"",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"applicationKey\"",
",",
"applicationKey",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"filepath\"",
",",
"filepath",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"lastModifiedTime\"",
",",
"lastModifiedTime",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"responseFields\"",
",",
"responseFields",
")",
";",
"return",
"new",
"MozuUrl",
"(",
"formatter",
".",
"getResourceUrl",
"(",
")",
",",
"MozuUrl",
".",
"UrlLocation",
".",
"HOME_POD",
")",
";",
"}"
]
| Get Resource Url for UpsertPackageFile
@param applicationKey The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
@param filepath The application key uniquely identifies the developer namespace, application ID, version, and package in Dev Center. The format is {Dev Account namespace}.{Application ID}.{Application Version}.{Package name}.
@param lastModifiedTime The date and time of the last file insert or update. This parameter is optional.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpsertPackageFile"
]
| train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/ApplicationUrl.java#L82-L90 |
Stratio/deep-spark | deep-jdbc/src/main/java/com/stratio/deep/jdbc/utils/UtilJdbc.java | UtilJdbc.getCellsFromObject | public static<T extends DeepJobConfig> Cells getCellsFromObject(Map<String, Object> row, DeepJobConfig<Cells, T> config) {
"""
Returns a Cells object from a JDBC row data structure.
@param row JDBC row data structure as a Map.
@param config JDBC Deep Job config.
@return Cells object from a JDBC row data structure.
"""
Cells result = new Cells(config.getCatalog() + "." + config.getTable());
for(Map.Entry<String, Object> entry:row.entrySet()) {
Cell cell = Cell.create(entry.getKey(), entry.getValue());
result.add(cell);
}
return result;
} | java | public static<T extends DeepJobConfig> Cells getCellsFromObject(Map<String, Object> row, DeepJobConfig<Cells, T> config) {
Cells result = new Cells(config.getCatalog() + "." + config.getTable());
for(Map.Entry<String, Object> entry:row.entrySet()) {
Cell cell = Cell.create(entry.getKey(), entry.getValue());
result.add(cell);
}
return result;
} | [
"public",
"static",
"<",
"T",
"extends",
"DeepJobConfig",
">",
"Cells",
"getCellsFromObject",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"row",
",",
"DeepJobConfig",
"<",
"Cells",
",",
"T",
">",
"config",
")",
"{",
"Cells",
"result",
"=",
"new",
"Cells",
"(",
"config",
".",
"getCatalog",
"(",
")",
"+",
"\".\"",
"+",
"config",
".",
"getTable",
"(",
")",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
":",
"row",
".",
"entrySet",
"(",
")",
")",
"{",
"Cell",
"cell",
"=",
"Cell",
".",
"create",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"result",
".",
"add",
"(",
"cell",
")",
";",
"}",
"return",
"result",
";",
"}"
]
| Returns a Cells object from a JDBC row data structure.
@param row JDBC row data structure as a Map.
@param config JDBC Deep Job config.
@return Cells object from a JDBC row data structure. | [
"Returns",
"a",
"Cells",
"object",
"from",
"a",
"JDBC",
"row",
"data",
"structure",
"."
]
| train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-jdbc/src/main/java/com/stratio/deep/jdbc/utils/UtilJdbc.java#L109-L116 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatednasha/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednasha.java | ApiOvhDedicatednasha.serviceName_partition_partitionName_options_POST | public OvhTask serviceName_partition_partitionName_options_POST(String serviceName, String partitionName, OvhAtimeEnum atime, OvhRecordSizeEnum recordsize, OvhSyncEnum sync) throws IOException {
"""
Setup options
REST: POST /dedicated/nasha/{serviceName}/partition/{partitionName}/options
@param sync [required] sync setting
@param recordsize [required] ZFS recordsize
@param atime [required] atime setting
@param serviceName [required] The internal name of your storage
@param partitionName [required] the given name of partition
"""
String qPath = "/dedicated/nasha/{serviceName}/partition/{partitionName}/options";
StringBuilder sb = path(qPath, serviceName, partitionName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "atime", atime);
addBody(o, "recordsize", recordsize);
addBody(o, "sync", sync);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_partition_partitionName_options_POST(String serviceName, String partitionName, OvhAtimeEnum atime, OvhRecordSizeEnum recordsize, OvhSyncEnum sync) throws IOException {
String qPath = "/dedicated/nasha/{serviceName}/partition/{partitionName}/options";
StringBuilder sb = path(qPath, serviceName, partitionName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "atime", atime);
addBody(o, "recordsize", recordsize);
addBody(o, "sync", sync);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_partition_partitionName_options_POST",
"(",
"String",
"serviceName",
",",
"String",
"partitionName",
",",
"OvhAtimeEnum",
"atime",
",",
"OvhRecordSizeEnum",
"recordsize",
",",
"OvhSyncEnum",
"sync",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/nasha/{serviceName}/partition/{partitionName}/options\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"partitionName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"atime\"",
",",
"atime",
")",
";",
"addBody",
"(",
"o",
",",
"\"recordsize\"",
",",
"recordsize",
")",
";",
"addBody",
"(",
"o",
",",
"\"sync\"",
",",
"sync",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTask",
".",
"class",
")",
";",
"}"
]
| Setup options
REST: POST /dedicated/nasha/{serviceName}/partition/{partitionName}/options
@param sync [required] sync setting
@param recordsize [required] ZFS recordsize
@param atime [required] atime setting
@param serviceName [required] The internal name of your storage
@param partitionName [required] the given name of partition | [
"Setup",
"options"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatednasha/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednasha.java#L128-L137 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Waiter.java | Waiter.waitForText | public TextView waitForText(String text, int expectedMinimumNumberOfMatches, long timeout, boolean scroll, boolean onlyVisible, boolean hardStoppage) {
"""
Waits for a text to be shown.
@param text the text that needs to be shown, specified as a regular expression.
@param expectedMinimumNumberOfMatches the minimum number of matches of text that must be shown. {@code 0} means any number of matches
@param timeout the amount of time in milliseconds to wait
@param scroll {@code true} if scrolling should be performed
@param onlyVisible {@code true} if only visible text views should be waited for
@param hardStoppage {@code true} if search is to be stopped when timeout expires
@return {@code true} if text is found and {@code false} if it is not found before the timeout
"""
return waitForText(TextView.class, text, expectedMinimumNumberOfMatches, timeout, scroll, onlyVisible, hardStoppage);
} | java | public TextView waitForText(String text, int expectedMinimumNumberOfMatches, long timeout, boolean scroll, boolean onlyVisible, boolean hardStoppage) {
return waitForText(TextView.class, text, expectedMinimumNumberOfMatches, timeout, scroll, onlyVisible, hardStoppage);
} | [
"public",
"TextView",
"waitForText",
"(",
"String",
"text",
",",
"int",
"expectedMinimumNumberOfMatches",
",",
"long",
"timeout",
",",
"boolean",
"scroll",
",",
"boolean",
"onlyVisible",
",",
"boolean",
"hardStoppage",
")",
"{",
"return",
"waitForText",
"(",
"TextView",
".",
"class",
",",
"text",
",",
"expectedMinimumNumberOfMatches",
",",
"timeout",
",",
"scroll",
",",
"onlyVisible",
",",
"hardStoppage",
")",
";",
"}"
]
| Waits for a text to be shown.
@param text the text that needs to be shown, specified as a regular expression.
@param expectedMinimumNumberOfMatches the minimum number of matches of text that must be shown. {@code 0} means any number of matches
@param timeout the amount of time in milliseconds to wait
@param scroll {@code true} if scrolling should be performed
@param onlyVisible {@code true} if only visible text views should be waited for
@param hardStoppage {@code true} if search is to be stopped when timeout expires
@return {@code true} if text is found and {@code false} if it is not found before the timeout | [
"Waits",
"for",
"a",
"text",
"to",
"be",
"shown",
"."
]
| train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L598-L600 |
telly/groundy | library/src/main/java/com/telly/groundy/GroundyTask.java | GroundyTask.updateProgress | public void updateProgress(int progress, Bundle extraData) {
"""
Prepare and sends a progress update to the current receiver. Callback used is {@link
com.telly.groundy.annotations.OnProgress} and it will contain a bundle with an integer extra
called {@link Groundy#PROGRESS}
@param extraData additional information to send to the progress callback
@param progress percentage to send to receiver
"""
if (mReceiver != null) {
Bundle resultData = new Bundle();
resultData.putInt(Groundy.PROGRESS, progress);
resultData.putSerializable(Groundy.TASK_IMPLEMENTATION, getClass());
if (extraData != null) resultData.putAll(extraData);
send(OnProgress.class, resultData);
}
} | java | public void updateProgress(int progress, Bundle extraData) {
if (mReceiver != null) {
Bundle resultData = new Bundle();
resultData.putInt(Groundy.PROGRESS, progress);
resultData.putSerializable(Groundy.TASK_IMPLEMENTATION, getClass());
if (extraData != null) resultData.putAll(extraData);
send(OnProgress.class, resultData);
}
} | [
"public",
"void",
"updateProgress",
"(",
"int",
"progress",
",",
"Bundle",
"extraData",
")",
"{",
"if",
"(",
"mReceiver",
"!=",
"null",
")",
"{",
"Bundle",
"resultData",
"=",
"new",
"Bundle",
"(",
")",
";",
"resultData",
".",
"putInt",
"(",
"Groundy",
".",
"PROGRESS",
",",
"progress",
")",
";",
"resultData",
".",
"putSerializable",
"(",
"Groundy",
".",
"TASK_IMPLEMENTATION",
",",
"getClass",
"(",
")",
")",
";",
"if",
"(",
"extraData",
"!=",
"null",
")",
"resultData",
".",
"putAll",
"(",
"extraData",
")",
";",
"send",
"(",
"OnProgress",
".",
"class",
",",
"resultData",
")",
";",
"}",
"}"
]
| Prepare and sends a progress update to the current receiver. Callback used is {@link
com.telly.groundy.annotations.OnProgress} and it will contain a bundle with an integer extra
called {@link Groundy#PROGRESS}
@param extraData additional information to send to the progress callback
@param progress percentage to send to receiver | [
"Prepare",
"and",
"sends",
"a",
"progress",
"update",
"to",
"the",
"current",
"receiver",
".",
"Callback",
"used",
"is",
"{",
"@link",
"com",
".",
"telly",
".",
"groundy",
".",
"annotations",
".",
"OnProgress",
"}",
"and",
"it",
"will",
"contain",
"a",
"bundle",
"with",
"an",
"integer",
"extra",
"called",
"{",
"@link",
"Groundy#PROGRESS",
"}"
]
| train | https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/GroundyTask.java#L299-L307 |
code4everything/util | src/main/java/com/zhazhapan/util/LoggerUtils.java | LoggerUtils.debug | public static void debug(Class<?> clazz, String message, String... values) {
"""
调试
@param clazz 类
@param message 消息
@param values 格式化参数
@since 1.0.8
"""
getLogger(clazz).debug(formatString(message, values));
} | java | public static void debug(Class<?> clazz, String message, String... values) {
getLogger(clazz).debug(formatString(message, values));
} | [
"public",
"static",
"void",
"debug",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"message",
",",
"String",
"...",
"values",
")",
"{",
"getLogger",
"(",
"clazz",
")",
".",
"debug",
"(",
"formatString",
"(",
"message",
",",
"values",
")",
")",
";",
"}"
]
| 调试
@param clazz 类
@param message 消息
@param values 格式化参数
@since 1.0.8 | [
"调试"
]
| train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/LoggerUtils.java#L219-L221 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/RegularPactTask.java | RegularPactTask.reportAndClearAccumulators | protected static void reportAndClearAccumulators(Environment env, Map<String, Accumulator<?, ?>> accumulators,
ArrayList<ChainedDriver<?, ?>> chainedTasks) {
"""
This method is called at the end of a task, receiving the accumulators of
the task and the chained tasks. It merges them into a single map of
accumulators and sends them to the JobManager.
@param chainedTasks
Each chained task might have accumulators which will be merged
with the accumulators of the stub.
"""
// We can merge here the accumulators from the stub and the chained
// tasks. Type conflicts can occur here if counters with same name but
// different type were used.
for (ChainedDriver<?, ?> chainedTask : chainedTasks) {
Map<String, Accumulator<?, ?>> chainedAccumulators = chainedTask.getStub().getRuntimeContext().getAllAccumulators();
AccumulatorHelper.mergeInto(accumulators, chainedAccumulators);
}
// Don't report if the UDF didn't collect any accumulators
if (accumulators.size() == 0) {
return;
}
// Report accumulators to JobManager
synchronized (env.getAccumulatorProtocolProxy()) {
try {
env.getAccumulatorProtocolProxy().reportAccumulatorResult(
new AccumulatorEvent(env.getJobID(), accumulators, true));
} catch (IOException e) {
throw new RuntimeException("Communication with JobManager is broken. Could not send accumulators.", e);
}
}
// We also clear the accumulators, since stub instances might be reused
// (e.g. in iterations) and we don't want to count twice. This may not be
// done before sending
AccumulatorHelper.resetAndClearAccumulators(accumulators);
for (ChainedDriver<?, ?> chainedTask : chainedTasks) {
AccumulatorHelper.resetAndClearAccumulators(chainedTask.getStub().getRuntimeContext().getAllAccumulators());
}
} | java | protected static void reportAndClearAccumulators(Environment env, Map<String, Accumulator<?, ?>> accumulators,
ArrayList<ChainedDriver<?, ?>> chainedTasks) {
// We can merge here the accumulators from the stub and the chained
// tasks. Type conflicts can occur here if counters with same name but
// different type were used.
for (ChainedDriver<?, ?> chainedTask : chainedTasks) {
Map<String, Accumulator<?, ?>> chainedAccumulators = chainedTask.getStub().getRuntimeContext().getAllAccumulators();
AccumulatorHelper.mergeInto(accumulators, chainedAccumulators);
}
// Don't report if the UDF didn't collect any accumulators
if (accumulators.size() == 0) {
return;
}
// Report accumulators to JobManager
synchronized (env.getAccumulatorProtocolProxy()) {
try {
env.getAccumulatorProtocolProxy().reportAccumulatorResult(
new AccumulatorEvent(env.getJobID(), accumulators, true));
} catch (IOException e) {
throw new RuntimeException("Communication with JobManager is broken. Could not send accumulators.", e);
}
}
// We also clear the accumulators, since stub instances might be reused
// (e.g. in iterations) and we don't want to count twice. This may not be
// done before sending
AccumulatorHelper.resetAndClearAccumulators(accumulators);
for (ChainedDriver<?, ?> chainedTask : chainedTasks) {
AccumulatorHelper.resetAndClearAccumulators(chainedTask.getStub().getRuntimeContext().getAllAccumulators());
}
} | [
"protected",
"static",
"void",
"reportAndClearAccumulators",
"(",
"Environment",
"env",
",",
"Map",
"<",
"String",
",",
"Accumulator",
"<",
"?",
",",
"?",
">",
">",
"accumulators",
",",
"ArrayList",
"<",
"ChainedDriver",
"<",
"?",
",",
"?",
">",
">",
"chainedTasks",
")",
"{",
"// We can merge here the accumulators from the stub and the chained",
"// tasks. Type conflicts can occur here if counters with same name but",
"// different type were used.",
"for",
"(",
"ChainedDriver",
"<",
"?",
",",
"?",
">",
"chainedTask",
":",
"chainedTasks",
")",
"{",
"Map",
"<",
"String",
",",
"Accumulator",
"<",
"?",
",",
"?",
">",
">",
"chainedAccumulators",
"=",
"chainedTask",
".",
"getStub",
"(",
")",
".",
"getRuntimeContext",
"(",
")",
".",
"getAllAccumulators",
"(",
")",
";",
"AccumulatorHelper",
".",
"mergeInto",
"(",
"accumulators",
",",
"chainedAccumulators",
")",
";",
"}",
"// Don't report if the UDF didn't collect any accumulators",
"if",
"(",
"accumulators",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"// Report accumulators to JobManager",
"synchronized",
"(",
"env",
".",
"getAccumulatorProtocolProxy",
"(",
")",
")",
"{",
"try",
"{",
"env",
".",
"getAccumulatorProtocolProxy",
"(",
")",
".",
"reportAccumulatorResult",
"(",
"new",
"AccumulatorEvent",
"(",
"env",
".",
"getJobID",
"(",
")",
",",
"accumulators",
",",
"true",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Communication with JobManager is broken. Could not send accumulators.\"",
",",
"e",
")",
";",
"}",
"}",
"// We also clear the accumulators, since stub instances might be reused",
"// (e.g. in iterations) and we don't want to count twice. This may not be",
"// done before sending",
"AccumulatorHelper",
".",
"resetAndClearAccumulators",
"(",
"accumulators",
")",
";",
"for",
"(",
"ChainedDriver",
"<",
"?",
",",
"?",
">",
"chainedTask",
":",
"chainedTasks",
")",
"{",
"AccumulatorHelper",
".",
"resetAndClearAccumulators",
"(",
"chainedTask",
".",
"getStub",
"(",
")",
".",
"getRuntimeContext",
"(",
")",
".",
"getAllAccumulators",
"(",
")",
")",
";",
"}",
"}"
]
| This method is called at the end of a task, receiving the accumulators of
the task and the chained tasks. It merges them into a single map of
accumulators and sends them to the JobManager.
@param chainedTasks
Each chained task might have accumulators which will be merged
with the accumulators of the stub. | [
"This",
"method",
"is",
"called",
"at",
"the",
"end",
"of",
"a",
"task",
"receiving",
"the",
"accumulators",
"of",
"the",
"task",
"and",
"the",
"chained",
"tasks",
".",
"It",
"merges",
"them",
"into",
"a",
"single",
"map",
"of",
"accumulators",
"and",
"sends",
"them",
"to",
"the",
"JobManager",
"."
]
| train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/task/RegularPactTask.java#L564-L598 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getDeletedCertificateAsync | public ServiceFuture<DeletedCertificateBundle> getDeletedCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<DeletedCertificateBundle> serviceCallback) {
"""
Retrieves information about the specified deleted certificate.
The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires the certificates/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
"""
return ServiceFuture.fromResponse(getDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | java | public ServiceFuture<DeletedCertificateBundle> getDeletedCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<DeletedCertificateBundle> serviceCallback) {
return ServiceFuture.fromResponse(getDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"DeletedCertificateBundle",
">",
"getDeletedCertificateAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"final",
"ServiceCallback",
"<",
"DeletedCertificateBundle",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"getDeletedCertificateWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"certificateName",
")",
",",
"serviceCallback",
")",
";",
"}"
]
| Retrieves information about the specified deleted certificate.
The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires the certificates/get permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Retrieves",
"information",
"about",
"the",
"specified",
"deleted",
"certificate",
".",
"The",
"GetDeletedCertificate",
"operation",
"retrieves",
"the",
"deleted",
"certificate",
"information",
"plus",
"its",
"attributes",
"such",
"as",
"retention",
"interval",
"scheduled",
"permanent",
"deletion",
"and",
"the",
"current",
"deletion",
"recovery",
"level",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"get",
"permission",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8548-L8550 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java | EventServiceSegment.pingNotifiableEventListener | private void pingNotifiableEventListener(String topic, Registration registration, boolean register) {
"""
Notifies the registration of a event in the listener lifecycle.
The registration is checked for a {@link NotifiableEventListener} in this order :
<ul>
<li>first check if {@link Registration#getListener()} returns a {@link NotifiableEventListener}</li>
<li>otherwise check if the event filter wraps a listener and use that one</li>
</ul>
@param topic the event topic
@param registration the listener registration
@param register if the listener was registered or not
"""
Object listener = registration.getListener();
if (!(listener instanceof NotifiableEventListener)) {
EventFilter filter = registration.getFilter();
if (filter instanceof ListenerWrapperEventFilter) {
listener = ((ListenerWrapperEventFilter) filter).getListener();
}
}
pingNotifiableEventListenerInternal(listener, topic, registration, register);
pingNotifiableEventListenerInternal(service, topic, registration, register);
} | java | private void pingNotifiableEventListener(String topic, Registration registration, boolean register) {
Object listener = registration.getListener();
if (!(listener instanceof NotifiableEventListener)) {
EventFilter filter = registration.getFilter();
if (filter instanceof ListenerWrapperEventFilter) {
listener = ((ListenerWrapperEventFilter) filter).getListener();
}
}
pingNotifiableEventListenerInternal(listener, topic, registration, register);
pingNotifiableEventListenerInternal(service, topic, registration, register);
} | [
"private",
"void",
"pingNotifiableEventListener",
"(",
"String",
"topic",
",",
"Registration",
"registration",
",",
"boolean",
"register",
")",
"{",
"Object",
"listener",
"=",
"registration",
".",
"getListener",
"(",
")",
";",
"if",
"(",
"!",
"(",
"listener",
"instanceof",
"NotifiableEventListener",
")",
")",
"{",
"EventFilter",
"filter",
"=",
"registration",
".",
"getFilter",
"(",
")",
";",
"if",
"(",
"filter",
"instanceof",
"ListenerWrapperEventFilter",
")",
"{",
"listener",
"=",
"(",
"(",
"ListenerWrapperEventFilter",
")",
"filter",
")",
".",
"getListener",
"(",
")",
";",
"}",
"}",
"pingNotifiableEventListenerInternal",
"(",
"listener",
",",
"topic",
",",
"registration",
",",
"register",
")",
";",
"pingNotifiableEventListenerInternal",
"(",
"service",
",",
"topic",
",",
"registration",
",",
"register",
")",
";",
"}"
]
| Notifies the registration of a event in the listener lifecycle.
The registration is checked for a {@link NotifiableEventListener} in this order :
<ul>
<li>first check if {@link Registration#getListener()} returns a {@link NotifiableEventListener}</li>
<li>otherwise check if the event filter wraps a listener and use that one</li>
</ul>
@param topic the event topic
@param registration the listener registration
@param register if the listener was registered or not | [
"Notifies",
"the",
"registration",
"of",
"a",
"event",
"in",
"the",
"listener",
"lifecycle",
".",
"The",
"registration",
"is",
"checked",
"for",
"a",
"{",
"@link",
"NotifiableEventListener",
"}",
"in",
"this",
"order",
":",
"<ul",
">",
"<li",
">",
"first",
"check",
"if",
"{",
"@link",
"Registration#getListener",
"()",
"}",
"returns",
"a",
"{",
"@link",
"NotifiableEventListener",
"}",
"<",
"/",
"li",
">",
"<li",
">",
"otherwise",
"check",
"if",
"the",
"event",
"filter",
"wraps",
"a",
"listener",
"and",
"use",
"that",
"one<",
"/",
"li",
">",
"<",
"/",
"ul",
">"
]
| train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceSegment.java#L79-L89 |
finmath/finmath-lib | src/main/java/net/finmath/marketdata2/model/curves/DiscountCurveInterpolation.java | DiscountCurveInterpolation.createDiscountCurveFromAnnualizedZeroRates | public static DiscountCurveInterpolation createDiscountCurveFromAnnualizedZeroRates(
String name, LocalDate referenceDate,
double[] times, RandomVariable[] givenAnnualizedZeroRates, boolean[] isParameter,
InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) {
"""
Create a discount curve from given times and given annualized zero rates using given interpolation and extrapolation methods.
The discount factor is determined by
<code>
givenDiscountFactors[timeIndex] = Math.pow(1.0 + givenAnnualizedZeroRates[timeIndex], -times[timeIndex]);
</code>
@param name The name of this discount curve.
@param referenceDate The reference date for this curve, i.e., the date which defined t=0.
@param times Array of times as doubles.
@param givenAnnualizedZeroRates Array of corresponding zero rates.
@param isParameter Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves).
@param interpolationMethod The interpolation method used for the curve.
@param extrapolationMethod The extrapolation method used for the curve.
@param interpolationEntity The entity interpolated/extrapolated.
@return A new discount factor object.
"""
RandomVariable[] givenDiscountFactors = new RandomVariable[givenAnnualizedZeroRates.length];
for(int timeIndex=0; timeIndex<times.length;timeIndex++) {
givenDiscountFactors[timeIndex] = givenAnnualizedZeroRates[timeIndex].add(1.0).pow(-times[timeIndex]);
}
return createDiscountCurveFromDiscountFactors(name, referenceDate, times, givenDiscountFactors, isParameter, interpolationMethod, extrapolationMethod, interpolationEntity);
} | java | public static DiscountCurveInterpolation createDiscountCurveFromAnnualizedZeroRates(
String name, LocalDate referenceDate,
double[] times, RandomVariable[] givenAnnualizedZeroRates, boolean[] isParameter,
InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) {
RandomVariable[] givenDiscountFactors = new RandomVariable[givenAnnualizedZeroRates.length];
for(int timeIndex=0; timeIndex<times.length;timeIndex++) {
givenDiscountFactors[timeIndex] = givenAnnualizedZeroRates[timeIndex].add(1.0).pow(-times[timeIndex]);
}
return createDiscountCurveFromDiscountFactors(name, referenceDate, times, givenDiscountFactors, isParameter, interpolationMethod, extrapolationMethod, interpolationEntity);
} | [
"public",
"static",
"DiscountCurveInterpolation",
"createDiscountCurveFromAnnualizedZeroRates",
"(",
"String",
"name",
",",
"LocalDate",
"referenceDate",
",",
"double",
"[",
"]",
"times",
",",
"RandomVariable",
"[",
"]",
"givenAnnualizedZeroRates",
",",
"boolean",
"[",
"]",
"isParameter",
",",
"InterpolationMethod",
"interpolationMethod",
",",
"ExtrapolationMethod",
"extrapolationMethod",
",",
"InterpolationEntity",
"interpolationEntity",
")",
"{",
"RandomVariable",
"[",
"]",
"givenDiscountFactors",
"=",
"new",
"RandomVariable",
"[",
"givenAnnualizedZeroRates",
".",
"length",
"]",
";",
"for",
"(",
"int",
"timeIndex",
"=",
"0",
";",
"timeIndex",
"<",
"times",
".",
"length",
";",
"timeIndex",
"++",
")",
"{",
"givenDiscountFactors",
"[",
"timeIndex",
"]",
"=",
"givenAnnualizedZeroRates",
"[",
"timeIndex",
"]",
".",
"add",
"(",
"1.0",
")",
".",
"pow",
"(",
"-",
"times",
"[",
"timeIndex",
"]",
")",
";",
"}",
"return",
"createDiscountCurveFromDiscountFactors",
"(",
"name",
",",
"referenceDate",
",",
"times",
",",
"givenDiscountFactors",
",",
"isParameter",
",",
"interpolationMethod",
",",
"extrapolationMethod",
",",
"interpolationEntity",
")",
";",
"}"
]
| Create a discount curve from given times and given annualized zero rates using given interpolation and extrapolation methods.
The discount factor is determined by
<code>
givenDiscountFactors[timeIndex] = Math.pow(1.0 + givenAnnualizedZeroRates[timeIndex], -times[timeIndex]);
</code>
@param name The name of this discount curve.
@param referenceDate The reference date for this curve, i.e., the date which defined t=0.
@param times Array of times as doubles.
@param givenAnnualizedZeroRates Array of corresponding zero rates.
@param isParameter Array of booleans specifying whether this point is served "as as parameter", e.g., whether it is calibrates (e.g. using CalibratedCurves).
@param interpolationMethod The interpolation method used for the curve.
@param extrapolationMethod The extrapolation method used for the curve.
@param interpolationEntity The entity interpolated/extrapolated.
@return A new discount factor object. | [
"Create",
"a",
"discount",
"curve",
"from",
"given",
"times",
"and",
"given",
"annualized",
"zero",
"rates",
"using",
"given",
"interpolation",
"and",
"extrapolation",
"methods",
".",
"The",
"discount",
"factor",
"is",
"determined",
"by",
"<code",
">",
"givenDiscountFactors",
"[",
"timeIndex",
"]",
"=",
"Math",
".",
"pow",
"(",
"1",
".",
"0",
"+",
"givenAnnualizedZeroRates",
"[",
"timeIndex",
"]",
"-",
"times",
"[",
"timeIndex",
"]",
")",
";",
"<",
"/",
"code",
">"
]
| train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata2/model/curves/DiscountCurveInterpolation.java#L325-L337 |
shrinkwrap/resolver | maven/api-maven/src/main/java/org/jboss/shrinkwrap/resolver/api/maven/coordinate/MavenDependencies.java | MavenDependencies.createDependency | public static MavenDependency createDependency(final String canonicalForm, final ScopeType scope,
final boolean optional, final MavenDependencyExclusion... exclusions) throws IllegalArgumentException,
CoordinateParseException {
"""
Creates a new {@link MavenDependency} instance from the specified, required canonical form in format
{@code <groupId>:<artifactId>[:<packagingType>[:<classifier>]][:<version>]}, with the additional, optional
properties. If no {@link ScopeType} is specified, default will be {@link ScopeType#COMPILE}.
@param canonicalForm A canonical form in format {@code <groupId>:<artifactId>[:<packagingType>[:<classifier>]][:<version>]}
of the new {@link MavenDependency} instance.
@param scope A scope of the new {@link MavenDependency} instance. Default will be {@link ScopeType#COMPILE}.
@param optional Whether or not this {@link MavenDependency} has been marked as optional; defaults to <code>false</code>.
@param exclusions Exclusions of the new {@link MavenDependency} instance.
@return The new {@link MavenDependency} instance.
@throws IllegalArgumentException
If the canonical form is not supplied
@throws CoordinateParseException
If the specified canonical form is not valid
"""
if (canonicalForm == null || canonicalForm.length() == 0) {
throw new IllegalArgumentException("canonical form is required");
}
final MavenCoordinate delegate = MavenCoordinates.createCoordinate(canonicalForm);
return createDependency(delegate, scope, optional, exclusions);
} | java | public static MavenDependency createDependency(final String canonicalForm, final ScopeType scope,
final boolean optional, final MavenDependencyExclusion... exclusions) throws IllegalArgumentException,
CoordinateParseException {
if (canonicalForm == null || canonicalForm.length() == 0) {
throw new IllegalArgumentException("canonical form is required");
}
final MavenCoordinate delegate = MavenCoordinates.createCoordinate(canonicalForm);
return createDependency(delegate, scope, optional, exclusions);
} | [
"public",
"static",
"MavenDependency",
"createDependency",
"(",
"final",
"String",
"canonicalForm",
",",
"final",
"ScopeType",
"scope",
",",
"final",
"boolean",
"optional",
",",
"final",
"MavenDependencyExclusion",
"...",
"exclusions",
")",
"throws",
"IllegalArgumentException",
",",
"CoordinateParseException",
"{",
"if",
"(",
"canonicalForm",
"==",
"null",
"||",
"canonicalForm",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"canonical form is required\"",
")",
";",
"}",
"final",
"MavenCoordinate",
"delegate",
"=",
"MavenCoordinates",
".",
"createCoordinate",
"(",
"canonicalForm",
")",
";",
"return",
"createDependency",
"(",
"delegate",
",",
"scope",
",",
"optional",
",",
"exclusions",
")",
";",
"}"
]
| Creates a new {@link MavenDependency} instance from the specified, required canonical form in format
{@code <groupId>:<artifactId>[:<packagingType>[:<classifier>]][:<version>]}, with the additional, optional
properties. If no {@link ScopeType} is specified, default will be {@link ScopeType#COMPILE}.
@param canonicalForm A canonical form in format {@code <groupId>:<artifactId>[:<packagingType>[:<classifier>]][:<version>]}
of the new {@link MavenDependency} instance.
@param scope A scope of the new {@link MavenDependency} instance. Default will be {@link ScopeType#COMPILE}.
@param optional Whether or not this {@link MavenDependency} has been marked as optional; defaults to <code>false</code>.
@param exclusions Exclusions of the new {@link MavenDependency} instance.
@return The new {@link MavenDependency} instance.
@throws IllegalArgumentException
If the canonical form is not supplied
@throws CoordinateParseException
If the specified canonical form is not valid | [
"Creates",
"a",
"new",
"{",
"@link",
"MavenDependency",
"}",
"instance",
"from",
"the",
"specified",
"required",
"canonical",
"form",
"in",
"format",
"{",
"@code",
"<groupId",
">",
":",
"<artifactId",
">",
"[",
":",
"<packagingType",
">",
"[",
":",
"<classifier",
">",
"]]",
"[",
":",
"<version",
">",
"]",
"}",
"with",
"the",
"additional",
"optional",
"properties",
".",
"If",
"no",
"{",
"@link",
"ScopeType",
"}",
"is",
"specified",
"default",
"will",
"be",
"{",
"@link",
"ScopeType#COMPILE",
"}",
"."
]
| train | https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/api-maven/src/main/java/org/jboss/shrinkwrap/resolver/api/maven/coordinate/MavenDependencies.java#L70-L78 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/extra/AsiExtraField.java | AsiExtraField.parseFromLocalFileData | public void parseFromLocalFileData(byte[] data, int offset, int length)
throws ZipException {
"""
Populate data from this array as if it was in local file data.
@param data an array of bytes
@param offset the start offset
@param length the number of bytes in the array from offset
@since 1.1
@throws ZipException on error
"""
long givenChecksum = ZipLong.getValue(data, offset);
byte[] tmp = new byte[length - WORD];
System.arraycopy(data, offset + WORD, tmp, 0, length - WORD);
crc.reset();
crc.update(tmp);
long realChecksum = crc.getValue();
if (givenChecksum != realChecksum) {
throw new ZipException("bad CRC checksum "
+ Long.toHexString(givenChecksum)
+ " instead of "
+ Long.toHexString(realChecksum));
}
int newMode = ZipShort.getValue(tmp, 0);
// CheckStyle:MagicNumber OFF
byte[] linkArray = new byte[(int) ZipLong.getValue(tmp, 2)];
uid = ZipShort.getValue(tmp, 6);
gid = ZipShort.getValue(tmp, 8);
if (linkArray.length == 0) {
link = "";
}
else {
System.arraycopy(tmp, 10, linkArray, 0, linkArray.length);
link = new String(linkArray); // Uses default charset - see class Javadoc
}
// CheckStyle:MagicNumber ON
setDirectory((newMode & DIR_FLAG) != 0);
setMode(newMode);
} | java | public void parseFromLocalFileData(byte[] data, int offset, int length)
throws ZipException {
long givenChecksum = ZipLong.getValue(data, offset);
byte[] tmp = new byte[length - WORD];
System.arraycopy(data, offset + WORD, tmp, 0, length - WORD);
crc.reset();
crc.update(tmp);
long realChecksum = crc.getValue();
if (givenChecksum != realChecksum) {
throw new ZipException("bad CRC checksum "
+ Long.toHexString(givenChecksum)
+ " instead of "
+ Long.toHexString(realChecksum));
}
int newMode = ZipShort.getValue(tmp, 0);
// CheckStyle:MagicNumber OFF
byte[] linkArray = new byte[(int) ZipLong.getValue(tmp, 2)];
uid = ZipShort.getValue(tmp, 6);
gid = ZipShort.getValue(tmp, 8);
if (linkArray.length == 0) {
link = "";
}
else {
System.arraycopy(tmp, 10, linkArray, 0, linkArray.length);
link = new String(linkArray); // Uses default charset - see class Javadoc
}
// CheckStyle:MagicNumber ON
setDirectory((newMode & DIR_FLAG) != 0);
setMode(newMode);
} | [
"public",
"void",
"parseFromLocalFileData",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"ZipException",
"{",
"long",
"givenChecksum",
"=",
"ZipLong",
".",
"getValue",
"(",
"data",
",",
"offset",
")",
";",
"byte",
"[",
"]",
"tmp",
"=",
"new",
"byte",
"[",
"length",
"-",
"WORD",
"]",
";",
"System",
".",
"arraycopy",
"(",
"data",
",",
"offset",
"+",
"WORD",
",",
"tmp",
",",
"0",
",",
"length",
"-",
"WORD",
")",
";",
"crc",
".",
"reset",
"(",
")",
";",
"crc",
".",
"update",
"(",
"tmp",
")",
";",
"long",
"realChecksum",
"=",
"crc",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"givenChecksum",
"!=",
"realChecksum",
")",
"{",
"throw",
"new",
"ZipException",
"(",
"\"bad CRC checksum \"",
"+",
"Long",
".",
"toHexString",
"(",
"givenChecksum",
")",
"+",
"\" instead of \"",
"+",
"Long",
".",
"toHexString",
"(",
"realChecksum",
")",
")",
";",
"}",
"int",
"newMode",
"=",
"ZipShort",
".",
"getValue",
"(",
"tmp",
",",
"0",
")",
";",
"// CheckStyle:MagicNumber OFF",
"byte",
"[",
"]",
"linkArray",
"=",
"new",
"byte",
"[",
"(",
"int",
")",
"ZipLong",
".",
"getValue",
"(",
"tmp",
",",
"2",
")",
"]",
";",
"uid",
"=",
"ZipShort",
".",
"getValue",
"(",
"tmp",
",",
"6",
")",
";",
"gid",
"=",
"ZipShort",
".",
"getValue",
"(",
"tmp",
",",
"8",
")",
";",
"if",
"(",
"linkArray",
".",
"length",
"==",
"0",
")",
"{",
"link",
"=",
"\"\"",
";",
"}",
"else",
"{",
"System",
".",
"arraycopy",
"(",
"tmp",
",",
"10",
",",
"linkArray",
",",
"0",
",",
"linkArray",
".",
"length",
")",
";",
"link",
"=",
"new",
"String",
"(",
"linkArray",
")",
";",
"// Uses default charset - see class Javadoc",
"}",
"// CheckStyle:MagicNumber ON",
"setDirectory",
"(",
"(",
"newMode",
"&",
"DIR_FLAG",
")",
"!=",
"0",
")",
";",
"setMode",
"(",
"newMode",
")",
";",
"}"
]
| Populate data from this array as if it was in local file data.
@param data an array of bytes
@param offset the start offset
@param length the number of bytes in the array from offset
@since 1.1
@throws ZipException on error | [
"Populate",
"data",
"from",
"this",
"array",
"as",
"if",
"it",
"was",
"in",
"local",
"file",
"data",
"."
]
| train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/extra/AsiExtraField.java#L369-L401 |
apache/incubator-druid | server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java | AuthorizationUtils.filterAuthorizedResources | public static <ResType> Iterable<ResType> filterAuthorizedResources(
final AuthenticationResult authenticationResult,
final Iterable<ResType> resources,
final Function<? super ResType, Iterable<ResourceAction>> resourceActionGenerator,
final AuthorizerMapper authorizerMapper
) {
"""
Filter a collection of resources by applying the resourceActionGenerator to each resource, return an iterable
containing the filtered resources.
The resourceActionGenerator returns an Iterable<ResourceAction> for each resource.
If every resource-action in the iterable is authorized, the resource will be added to the filtered resources.
If there is an authorization failure for one of the resource-actions, the resource will not be
added to the returned filtered resources..
If the resourceActionGenerator returns null for a resource, that resource will not be added to the filtered
resources.
@param authenticationResult Authentication result representing identity of requester
@param resources resources to be processed into resource-actions
@param resourceActionGenerator Function that creates an iterable of resource-actions from a resource
@param authorizerMapper authorizer mapper
@return Iterable containing resources that were authorized
"""
final Authorizer authorizer = authorizerMapper.getAuthorizer(authenticationResult.getAuthorizerName());
if (authorizer == null) {
throw new ISE("No authorizer found with name: [%s].", authenticationResult.getAuthorizerName());
}
final Map<ResourceAction, Access> resultCache = new HashMap<>();
final Iterable<ResType> filteredResources = Iterables.filter(
resources,
resource -> {
final Iterable<ResourceAction> resourceActions = resourceActionGenerator.apply(resource);
if (resourceActions == null) {
return false;
}
for (ResourceAction resourceAction : resourceActions) {
Access access = resultCache.computeIfAbsent(
resourceAction,
ra -> authorizer.authorize(
authenticationResult,
ra.getResource(),
ra.getAction()
)
);
if (!access.isAllowed()) {
return false;
}
}
return true;
}
);
return filteredResources;
} | java | public static <ResType> Iterable<ResType> filterAuthorizedResources(
final AuthenticationResult authenticationResult,
final Iterable<ResType> resources,
final Function<? super ResType, Iterable<ResourceAction>> resourceActionGenerator,
final AuthorizerMapper authorizerMapper
)
{
final Authorizer authorizer = authorizerMapper.getAuthorizer(authenticationResult.getAuthorizerName());
if (authorizer == null) {
throw new ISE("No authorizer found with name: [%s].", authenticationResult.getAuthorizerName());
}
final Map<ResourceAction, Access> resultCache = new HashMap<>();
final Iterable<ResType> filteredResources = Iterables.filter(
resources,
resource -> {
final Iterable<ResourceAction> resourceActions = resourceActionGenerator.apply(resource);
if (resourceActions == null) {
return false;
}
for (ResourceAction resourceAction : resourceActions) {
Access access = resultCache.computeIfAbsent(
resourceAction,
ra -> authorizer.authorize(
authenticationResult,
ra.getResource(),
ra.getAction()
)
);
if (!access.isAllowed()) {
return false;
}
}
return true;
}
);
return filteredResources;
} | [
"public",
"static",
"<",
"ResType",
">",
"Iterable",
"<",
"ResType",
">",
"filterAuthorizedResources",
"(",
"final",
"AuthenticationResult",
"authenticationResult",
",",
"final",
"Iterable",
"<",
"ResType",
">",
"resources",
",",
"final",
"Function",
"<",
"?",
"super",
"ResType",
",",
"Iterable",
"<",
"ResourceAction",
">",
">",
"resourceActionGenerator",
",",
"final",
"AuthorizerMapper",
"authorizerMapper",
")",
"{",
"final",
"Authorizer",
"authorizer",
"=",
"authorizerMapper",
".",
"getAuthorizer",
"(",
"authenticationResult",
".",
"getAuthorizerName",
"(",
")",
")",
";",
"if",
"(",
"authorizer",
"==",
"null",
")",
"{",
"throw",
"new",
"ISE",
"(",
"\"No authorizer found with name: [%s].\"",
",",
"authenticationResult",
".",
"getAuthorizerName",
"(",
")",
")",
";",
"}",
"final",
"Map",
"<",
"ResourceAction",
",",
"Access",
">",
"resultCache",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"final",
"Iterable",
"<",
"ResType",
">",
"filteredResources",
"=",
"Iterables",
".",
"filter",
"(",
"resources",
",",
"resource",
"->",
"{",
"final",
"Iterable",
"<",
"ResourceAction",
">",
"resourceActions",
"=",
"resourceActionGenerator",
".",
"apply",
"(",
"resource",
")",
";",
"if",
"(",
"resourceActions",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"ResourceAction",
"resourceAction",
":",
"resourceActions",
")",
"{",
"Access",
"access",
"=",
"resultCache",
".",
"computeIfAbsent",
"(",
"resourceAction",
",",
"ra",
"->",
"authorizer",
".",
"authorize",
"(",
"authenticationResult",
",",
"ra",
".",
"getResource",
"(",
")",
",",
"ra",
".",
"getAction",
"(",
")",
")",
")",
";",
"if",
"(",
"!",
"access",
".",
"isAllowed",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}",
")",
";",
"return",
"filteredResources",
";",
"}"
]
| Filter a collection of resources by applying the resourceActionGenerator to each resource, return an iterable
containing the filtered resources.
The resourceActionGenerator returns an Iterable<ResourceAction> for each resource.
If every resource-action in the iterable is authorized, the resource will be added to the filtered resources.
If there is an authorization failure for one of the resource-actions, the resource will not be
added to the returned filtered resources..
If the resourceActionGenerator returns null for a resource, that resource will not be added to the filtered
resources.
@param authenticationResult Authentication result representing identity of requester
@param resources resources to be processed into resource-actions
@param resourceActionGenerator Function that creates an iterable of resource-actions from a resource
@param authorizerMapper authorizer mapper
@return Iterable containing resources that were authorized | [
"Filter",
"a",
"collection",
"of",
"resources",
"by",
"applying",
"the",
"resourceActionGenerator",
"to",
"each",
"resource",
"return",
"an",
"iterable",
"containing",
"the",
"filtered",
"resources",
"."
]
| train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/server/security/AuthorizationUtils.java#L254-L292 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(byte[] data) {
"""
Adds data to the digest using the specified array of bytes, starting at an offset of 0.
@param data the array of bytes.
@return The same {@link DataHasher} object for chaining calls.
@throws NullPointerException when input data is null.
"""
Util.notNull(data, "Date");
return addData(data, 0, data.length);
} | java | public final DataHasher addData(byte[] data) {
Util.notNull(data, "Date");
return addData(data, 0, data.length);
} | [
"public",
"final",
"DataHasher",
"addData",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"Util",
".",
"notNull",
"(",
"data",
",",
"\"Date\"",
")",
";",
"return",
"addData",
"(",
"data",
",",
"0",
",",
"data",
".",
"length",
")",
";",
"}"
]
| Adds data to the digest using the specified array of bytes, starting at an offset of 0.
@param data the array of bytes.
@return The same {@link DataHasher} object for chaining calls.
@throws NullPointerException when input data is null. | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"array",
"of",
"bytes",
"starting",
"at",
"an",
"offset",
"of",
"0",
"."
]
| train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L161-L165 |
ow2-chameleon/fuchsia | discoveries/file-based/src/main/java/org/ow2/chameleon/fuchsia/discovery/filebased/AbstractFileBasedDiscovery.java | AbstractFileBasedDiscovery.parseFile | private Properties parseFile(File file) throws InvalidDeclarationFileException {
"""
Parse the given file to obtains a Properties object.
@param file
@return a properties object containing all the properties present in the file.
@throws InvalidDeclarationFileException
"""
Properties properties = new Properties();
InputStream is = null;
try {
is = new FileInputStream(file);
properties.load(is);
} catch (Exception e) {
throw new InvalidDeclarationFileException(String.format("Error reading declaration file %s", file.getAbsoluteFile()), e);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
LOG.error("IOException thrown while trying to close the declaration file.", e);
}
}
}
if (!properties.containsKey(Constants.ID)) {
throw new InvalidDeclarationFileException(String.format("File %s is not a correct declaration, needs to contains an id property", file.getAbsoluteFile()));
}
return properties;
} | java | private Properties parseFile(File file) throws InvalidDeclarationFileException {
Properties properties = new Properties();
InputStream is = null;
try {
is = new FileInputStream(file);
properties.load(is);
} catch (Exception e) {
throw new InvalidDeclarationFileException(String.format("Error reading declaration file %s", file.getAbsoluteFile()), e);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
LOG.error("IOException thrown while trying to close the declaration file.", e);
}
}
}
if (!properties.containsKey(Constants.ID)) {
throw new InvalidDeclarationFileException(String.format("File %s is not a correct declaration, needs to contains an id property", file.getAbsoluteFile()));
}
return properties;
} | [
"private",
"Properties",
"parseFile",
"(",
"File",
"file",
")",
"throws",
"InvalidDeclarationFileException",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"properties",
".",
"load",
"(",
"is",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"InvalidDeclarationFileException",
"(",
"String",
".",
"format",
"(",
"\"Error reading declaration file %s\"",
",",
"file",
".",
"getAbsoluteFile",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"is",
"!=",
"null",
")",
"{",
"try",
"{",
"is",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"IOException thrown while trying to close the declaration file.\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"properties",
".",
"containsKey",
"(",
"Constants",
".",
"ID",
")",
")",
"{",
"throw",
"new",
"InvalidDeclarationFileException",
"(",
"String",
".",
"format",
"(",
"\"File %s is not a correct declaration, needs to contains an id property\"",
",",
"file",
".",
"getAbsoluteFile",
"(",
")",
")",
")",
";",
"}",
"return",
"properties",
";",
"}"
]
| Parse the given file to obtains a Properties object.
@param file
@return a properties object containing all the properties present in the file.
@throws InvalidDeclarationFileException | [
"Parse",
"the",
"given",
"file",
"to",
"obtains",
"a",
"Properties",
"object",
"."
]
| train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/discoveries/file-based/src/main/java/org/ow2/chameleon/fuchsia/discovery/filebased/AbstractFileBasedDiscovery.java#L84-L106 |
lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.writeDocument | public void writeDocument(String filename, Document document) {
"""
Write a {@link Document} to file, serialized according to the file extension
@param filename path of the file to write the Document to
@param document a {@link Document} to serialize
"""
ProvFormat format = getTypeForFile(filename);
if (format == null) {
System.err.println("Unknown output file format: " + filename);
return;
}
writeDocument(filename, format, document);
} | java | public void writeDocument(String filename, Document document) {
ProvFormat format = getTypeForFile(filename);
if (format == null) {
System.err.println("Unknown output file format: " + filename);
return;
}
writeDocument(filename, format, document);
} | [
"public",
"void",
"writeDocument",
"(",
"String",
"filename",
",",
"Document",
"document",
")",
"{",
"ProvFormat",
"format",
"=",
"getTypeForFile",
"(",
"filename",
")",
";",
"if",
"(",
"format",
"==",
"null",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Unknown output file format: \"",
"+",
"filename",
")",
";",
"return",
";",
"}",
"writeDocument",
"(",
"filename",
",",
"format",
",",
"document",
")",
";",
"}"
]
| Write a {@link Document} to file, serialized according to the file extension
@param filename path of the file to write the Document to
@param document a {@link Document} to serialize | [
"Write",
"a",
"{"
]
| train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L1173-L1180 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_acl_accountId_DELETE | public void domain_acl_accountId_DELETE(String domain, String accountId) throws IOException {
"""
Delete ACL
REST: DELETE /email/domain/{domain}/acl/{accountId}
@param domain [required] Name of your domain name
@param accountId [required] OVH customer unique identifier
"""
String qPath = "/email/domain/{domain}/acl/{accountId}";
StringBuilder sb = path(qPath, domain, accountId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void domain_acl_accountId_DELETE(String domain, String accountId) throws IOException {
String qPath = "/email/domain/{domain}/acl/{accountId}";
StringBuilder sb = path(qPath, domain, accountId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"domain_acl_accountId_DELETE",
"(",
"String",
"domain",
",",
"String",
"accountId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/acl/{accountId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"domain",
",",
"accountId",
")",
";",
"exec",
"(",
"qPath",
",",
"\"DELETE\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"}"
]
| Delete ACL
REST: DELETE /email/domain/{domain}/acl/{accountId}
@param domain [required] Name of your domain name
@param accountId [required] OVH customer unique identifier | [
"Delete",
"ACL"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1322-L1326 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java | AmazonDynamoDBClient.updateTable | public UpdateTableResult updateTable(UpdateTableRequest updateTableRequest)
throws AmazonServiceException, AmazonClientException {
"""
<p>
Updates the provisioned throughput for the given table.
</p>
<p>
Setting the throughput for a table helps you manage performance and is
part of the Provisioned Throughput feature of Amazon DynamoDB.
</p>
@param updateTableRequest Container for the necessary parameters to
execute the UpdateTable service method on AmazonDynamoDB.
@return The response from the UpdateTable service method, as returned
by AmazonDynamoDB.
@throws ResourceInUseException
@throws LimitExceededException
@throws InternalServerErrorException
@throws ResourceNotFoundException
@throws AmazonClientException
If any internal errors are encountered inside the client while
attempting to make the request or handle the response. For example
if a network connection is not available.
@throws AmazonServiceException
If an error response is returned by AmazonDynamoDB indicating
either a problem with the data in the request, or a server side issue.
"""
ExecutionContext executionContext = createExecutionContext(updateTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<UpdateTableRequest> request = marshall(updateTableRequest,
new UpdateTableRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<UpdateTableResult, JsonUnmarshallerContext> unmarshaller = new UpdateTableResultJsonUnmarshaller();
JsonResponseHandler<UpdateTableResult> responseHandler = new JsonResponseHandler<UpdateTableResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | java | public UpdateTableResult updateTable(UpdateTableRequest updateTableRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(updateTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<UpdateTableRequest> request = marshall(updateTableRequest,
new UpdateTableRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<UpdateTableResult, JsonUnmarshallerContext> unmarshaller = new UpdateTableResultJsonUnmarshaller();
JsonResponseHandler<UpdateTableResult> responseHandler = new JsonResponseHandler<UpdateTableResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | [
"public",
"UpdateTableResult",
"updateTable",
"(",
"UpdateTableRequest",
"updateTableRequest",
")",
"throws",
"AmazonServiceException",
",",
"AmazonClientException",
"{",
"ExecutionContext",
"executionContext",
"=",
"createExecutionContext",
"(",
"updateTableRequest",
")",
";",
"AWSRequestMetrics",
"awsRequestMetrics",
"=",
"executionContext",
".",
"getAwsRequestMetrics",
"(",
")",
";",
"Request",
"<",
"UpdateTableRequest",
">",
"request",
"=",
"marshall",
"(",
"updateTableRequest",
",",
"new",
"UpdateTableRequestMarshaller",
"(",
")",
",",
"executionContext",
".",
"getAwsRequestMetrics",
"(",
")",
")",
";",
"// Binds the request metrics to the current request.",
"request",
".",
"setAWSRequestMetrics",
"(",
"awsRequestMetrics",
")",
";",
"Unmarshaller",
"<",
"UpdateTableResult",
",",
"JsonUnmarshallerContext",
">",
"unmarshaller",
"=",
"new",
"UpdateTableResultJsonUnmarshaller",
"(",
")",
";",
"JsonResponseHandler",
"<",
"UpdateTableResult",
">",
"responseHandler",
"=",
"new",
"JsonResponseHandler",
"<",
"UpdateTableResult",
">",
"(",
"unmarshaller",
")",
";",
"return",
"invoke",
"(",
"request",
",",
"responseHandler",
",",
"executionContext",
")",
";",
"}"
]
| <p>
Updates the provisioned throughput for the given table.
</p>
<p>
Setting the throughput for a table helps you manage performance and is
part of the Provisioned Throughput feature of Amazon DynamoDB.
</p>
@param updateTableRequest Container for the necessary parameters to
execute the UpdateTable service method on AmazonDynamoDB.
@return The response from the UpdateTable service method, as returned
by AmazonDynamoDB.
@throws ResourceInUseException
@throws LimitExceededException
@throws InternalServerErrorException
@throws ResourceNotFoundException
@throws AmazonClientException
If any internal errors are encountered inside the client while
attempting to make the request or handle the response. For example
if a network connection is not available.
@throws AmazonServiceException
If an error response is returned by AmazonDynamoDB indicating
either a problem with the data in the request, or a server side issue. | [
"<p",
">",
"Updates",
"the",
"provisioned",
"throughput",
"for",
"the",
"given",
"table",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Setting",
"the",
"throughput",
"for",
"a",
"table",
"helps",
"you",
"manage",
"performance",
"and",
"is",
"part",
"of",
"the",
"Provisioned",
"Throughput",
"feature",
"of",
"Amazon",
"DynamoDB",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L721-L733 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/RunbookDraftsInner.java | RunbookDraftsInner.replaceContent | public String replaceContent(String resourceGroupName, String automationAccountName, String runbookName, String runbookContent) {
"""
Replaces the runbook draft content.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param runbookName The runbook name.
@param runbookContent The runbook draft content.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the String object if successful.
"""
return replaceContentWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName, runbookContent).toBlocking().last().body();
} | java | public String replaceContent(String resourceGroupName, String automationAccountName, String runbookName, String runbookContent) {
return replaceContentWithServiceResponseAsync(resourceGroupName, automationAccountName, runbookName, runbookContent).toBlocking().last().body();
} | [
"public",
"String",
"replaceContent",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"runbookName",
",",
"String",
"runbookContent",
")",
"{",
"return",
"replaceContentWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"runbookName",
",",
"runbookContent",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Replaces the runbook draft content.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param runbookName The runbook name.
@param runbookContent The runbook draft content.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the String object if successful. | [
"Replaces",
"the",
"runbook",
"draft",
"content",
"."
]
| 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/RunbookDraftsInner.java#L194-L196 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/transport/ChannelContext.java | ChannelContext.putHeadCache | public void putHeadCache(Short key, String value) {
"""
Put header cache
@param key the key
@param value the value
"""
if (headerCache == null) {
synchronized (this) {
if (headerCache == null) {
headerCache = new TwoWayMap<Short, String>();
}
}
}
if (headerCache != null && !headerCache.containsKey(key)) {
headerCache.put(key, value);
}
} | java | public void putHeadCache(Short key, String value) {
if (headerCache == null) {
synchronized (this) {
if (headerCache == null) {
headerCache = new TwoWayMap<Short, String>();
}
}
}
if (headerCache != null && !headerCache.containsKey(key)) {
headerCache.put(key, value);
}
} | [
"public",
"void",
"putHeadCache",
"(",
"Short",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"headerCache",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"headerCache",
"==",
"null",
")",
"{",
"headerCache",
"=",
"new",
"TwoWayMap",
"<",
"Short",
",",
"String",
">",
"(",
")",
";",
"}",
"}",
"}",
"if",
"(",
"headerCache",
"!=",
"null",
"&&",
"!",
"headerCache",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"headerCache",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}",
"}"
]
| Put header cache
@param key the key
@param value the value | [
"Put",
"header",
"cache"
]
| train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/transport/ChannelContext.java#L64-L75 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java | MetaClassRegistryImpl.installMetaClassCreationHandle | private void installMetaClassCreationHandle() {
"""
Looks for a class called 'groovy.runtime.metaclass.CustomMetaClassCreationHandle' and if it exists uses it as the MetaClassCreationHandle
otherwise uses the default
@see groovy.lang.MetaClassRegistry.MetaClassCreationHandle
"""
try {
final Class customMetaClassHandle = Class.forName("groovy.runtime.metaclass.CustomMetaClassCreationHandle");
final Constructor customMetaClassHandleConstructor = customMetaClassHandle.getConstructor();
this.metaClassCreationHandle = (MetaClassCreationHandle)customMetaClassHandleConstructor.newInstance();
} catch (final ClassNotFoundException e) {
this.metaClassCreationHandle = new MetaClassCreationHandle();
} catch (final Exception e) {
throw new GroovyRuntimeException("Could not instantiate custom Metaclass creation handle: "+ e, e);
}
} | java | private void installMetaClassCreationHandle() {
try {
final Class customMetaClassHandle = Class.forName("groovy.runtime.metaclass.CustomMetaClassCreationHandle");
final Constructor customMetaClassHandleConstructor = customMetaClassHandle.getConstructor();
this.metaClassCreationHandle = (MetaClassCreationHandle)customMetaClassHandleConstructor.newInstance();
} catch (final ClassNotFoundException e) {
this.metaClassCreationHandle = new MetaClassCreationHandle();
} catch (final Exception e) {
throw new GroovyRuntimeException("Could not instantiate custom Metaclass creation handle: "+ e, e);
}
} | [
"private",
"void",
"installMetaClassCreationHandle",
"(",
")",
"{",
"try",
"{",
"final",
"Class",
"customMetaClassHandle",
"=",
"Class",
".",
"forName",
"(",
"\"groovy.runtime.metaclass.CustomMetaClassCreationHandle\"",
")",
";",
"final",
"Constructor",
"customMetaClassHandleConstructor",
"=",
"customMetaClassHandle",
".",
"getConstructor",
"(",
")",
";",
"this",
".",
"metaClassCreationHandle",
"=",
"(",
"MetaClassCreationHandle",
")",
"customMetaClassHandleConstructor",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"ClassNotFoundException",
"e",
")",
"{",
"this",
".",
"metaClassCreationHandle",
"=",
"new",
"MetaClassCreationHandle",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"throw",
"new",
"GroovyRuntimeException",
"(",
"\"Could not instantiate custom Metaclass creation handle: \"",
"+",
"e",
",",
"e",
")",
";",
"}",
"}"
]
| Looks for a class called 'groovy.runtime.metaclass.CustomMetaClassCreationHandle' and if it exists uses it as the MetaClassCreationHandle
otherwise uses the default
@see groovy.lang.MetaClassRegistry.MetaClassCreationHandle | [
"Looks",
"for",
"a",
"class",
"called",
"groovy",
".",
"runtime",
".",
"metaclass",
".",
"CustomMetaClassCreationHandle",
"and",
"if",
"it",
"exists",
"uses",
"it",
"as",
"the",
"MetaClassCreationHandle",
"otherwise",
"uses",
"the",
"default"
]
| train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/metaclass/MetaClassRegistryImpl.java#L182-L192 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java | ConnectionsInner.createOrUpdateAsync | public Observable<ConnectionInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String connectionName, ConnectionCreateOrUpdateParameters parameters) {
"""
Create or update a connection.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param connectionName The parameters supplied to the create or update connection operation.
@param parameters The parameters supplied to the create or update connection operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ConnectionInner object
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionName, parameters).map(new Func1<ServiceResponse<ConnectionInner>, ConnectionInner>() {
@Override
public ConnectionInner call(ServiceResponse<ConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<ConnectionInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String connectionName, ConnectionCreateOrUpdateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, connectionName, parameters).map(new Func1<ServiceResponse<ConnectionInner>, ConnectionInner>() {
@Override
public ConnectionInner call(ServiceResponse<ConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ConnectionInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"connectionName",
",",
"ConnectionCreateOrUpdateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"connectionName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ConnectionInner",
">",
",",
"ConnectionInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ConnectionInner",
"call",
"(",
"ServiceResponse",
"<",
"ConnectionInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Create or update a connection.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param connectionName The parameters supplied to the create or update connection operation.
@param parameters The parameters supplied to the create or update connection operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ConnectionInner object | [
"Create",
"or",
"update",
"a",
"connection",
"."
]
| 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/ConnectionsInner.java#L317-L324 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java | GeoInterface.setContext | public void setContext(String photoId, int context) throws FlickrException {
"""
Indicate the state of a photo's geotagginess beyond latitude and longitude.
<p>
Note : photos passed to this method must already be geotagged (using the {@link GeoInterface#setLocation(String, GeoData)} method).
@param photoId
Photo id (required).
@param context
Context is a numeric value representing the photo's geotagginess beyond latitude and longitude. For example, you may wish to indicate that a
photo was taken "indoors" (1) or "outdoors" (2).
@throws FlickrException
"""
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_CONTEXT);
parameters.put("photo_id", photoId);
parameters.put("context", "" + context);
// Note: This method requires an HTTP POST request.
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
// This method has no specific response - It returns an empty sucess response
// if it completes without error.
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | java | public void setContext(String photoId, int context) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_CONTEXT);
parameters.put("photo_id", photoId);
parameters.put("context", "" + context);
// Note: This method requires an HTTP POST request.
Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
// This method has no specific response - It returns an empty sucess response
// if it completes without error.
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
} | [
"public",
"void",
"setContext",
"(",
"String",
"photoId",
",",
"int",
"context",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"parameters",
".",
"put",
"(",
"\"method\"",
",",
"METHOD_SET_CONTEXT",
")",
";",
"parameters",
".",
"put",
"(",
"\"photo_id\"",
",",
"photoId",
")",
";",
"parameters",
".",
"put",
"(",
"\"context\"",
",",
"\"\"",
"+",
"context",
")",
";",
"// Note: This method requires an HTTP POST request.\r",
"Response",
"response",
"=",
"transport",
".",
"post",
"(",
"transport",
".",
"getPath",
"(",
")",
",",
"parameters",
",",
"apiKey",
",",
"sharedSecret",
")",
";",
"// This method has no specific response - It returns an empty sucess response\r",
"// if it completes without error.\r",
"if",
"(",
"response",
".",
"isError",
"(",
")",
")",
"{",
"throw",
"new",
"FlickrException",
"(",
"response",
".",
"getErrorCode",
"(",
")",
",",
"response",
".",
"getErrorMessage",
"(",
")",
")",
";",
"}",
"}"
]
| Indicate the state of a photo's geotagginess beyond latitude and longitude.
<p>
Note : photos passed to this method must already be geotagged (using the {@link GeoInterface#setLocation(String, GeoData)} method).
@param photoId
Photo id (required).
@param context
Context is a numeric value representing the photo's geotagginess beyond latitude and longitude. For example, you may wish to indicate that a
photo was taken "indoors" (1) or "outdoors" (2).
@throws FlickrException | [
"Indicate",
"the",
"state",
"of",
"a",
"photo",
"s",
"geotagginess",
"beyond",
"latitude",
"and",
"longitude",
".",
"<p",
">"
]
| train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/geo/GeoInterface.java#L339-L353 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/SuspensionRecord.java | SuspensionRecord.findInfractionCount | public static int findInfractionCount(EntityManager em, PrincipalUser user, SubSystem subSystem, long startTime) {
"""
Finds the number of user infractions for a subsystem that have occurred since the given start time.
@param em The entity manager to use. Cannot be null.
@param user The user. Cannot be null.
@param subSystem The subsystem. If null, infractions for all subsystems are counted.
@param startTime The start time threshold.
@return The number of infractions.
"""
List<SuspensionRecord> records;
if (subSystem == null) {
records = findByUser(em, user);
} else {
SuspensionRecord record = findByUserAndSubsystem(em, user, subSystem);
records = record == null ? new ArrayList<SuspensionRecord>(0) : Arrays.asList(new SuspensionRecord[] { record });
}
int count = 0;
for (SuspensionRecord record : records) {
List<Long> timestamps = record.getInfractionHistory();
for (Long timestamp : timestamps) {
if (timestamp > startTime) {
count++;
}
}
}
return count;
} | java | public static int findInfractionCount(EntityManager em, PrincipalUser user, SubSystem subSystem, long startTime) {
List<SuspensionRecord> records;
if (subSystem == null) {
records = findByUser(em, user);
} else {
SuspensionRecord record = findByUserAndSubsystem(em, user, subSystem);
records = record == null ? new ArrayList<SuspensionRecord>(0) : Arrays.asList(new SuspensionRecord[] { record });
}
int count = 0;
for (SuspensionRecord record : records) {
List<Long> timestamps = record.getInfractionHistory();
for (Long timestamp : timestamps) {
if (timestamp > startTime) {
count++;
}
}
}
return count;
} | [
"public",
"static",
"int",
"findInfractionCount",
"(",
"EntityManager",
"em",
",",
"PrincipalUser",
"user",
",",
"SubSystem",
"subSystem",
",",
"long",
"startTime",
")",
"{",
"List",
"<",
"SuspensionRecord",
">",
"records",
";",
"if",
"(",
"subSystem",
"==",
"null",
")",
"{",
"records",
"=",
"findByUser",
"(",
"em",
",",
"user",
")",
";",
"}",
"else",
"{",
"SuspensionRecord",
"record",
"=",
"findByUserAndSubsystem",
"(",
"em",
",",
"user",
",",
"subSystem",
")",
";",
"records",
"=",
"record",
"==",
"null",
"?",
"new",
"ArrayList",
"<",
"SuspensionRecord",
">",
"(",
"0",
")",
":",
"Arrays",
".",
"asList",
"(",
"new",
"SuspensionRecord",
"[",
"]",
"{",
"record",
"}",
")",
";",
"}",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"SuspensionRecord",
"record",
":",
"records",
")",
"{",
"List",
"<",
"Long",
">",
"timestamps",
"=",
"record",
".",
"getInfractionHistory",
"(",
")",
";",
"for",
"(",
"Long",
"timestamp",
":",
"timestamps",
")",
"{",
"if",
"(",
"timestamp",
">",
"startTime",
")",
"{",
"count",
"++",
";",
"}",
"}",
"}",
"return",
"count",
";",
"}"
]
| Finds the number of user infractions for a subsystem that have occurred since the given start time.
@param em The entity manager to use. Cannot be null.
@param user The user. Cannot be null.
@param subSystem The subsystem. If null, infractions for all subsystems are counted.
@param startTime The start time threshold.
@return The number of infractions. | [
"Finds",
"the",
"number",
"of",
"user",
"infractions",
"for",
"a",
"subsystem",
"that",
"have",
"occurred",
"since",
"the",
"given",
"start",
"time",
"."
]
| train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/SuspensionRecord.java#L137-L160 |
jcuda/jcudnn | JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java | JCudnn.cudnnGetLRNDescriptor | public static int cudnnGetLRNDescriptor(
cudnnLRNDescriptor normDesc,
int[] lrnN,
double[] lrnAlpha,
double[] lrnBeta,
double[] lrnK) {
"""
<pre>
Retrieve the settings currently stored in an LRN layer descriptor
Any of the provided pointers can be NULL (no corresponding value will be returned)
</pre>
"""
return checkResult(cudnnGetLRNDescriptorNative(normDesc, lrnN, lrnAlpha, lrnBeta, lrnK));
} | java | public static int cudnnGetLRNDescriptor(
cudnnLRNDescriptor normDesc,
int[] lrnN,
double[] lrnAlpha,
double[] lrnBeta,
double[] lrnK)
{
return checkResult(cudnnGetLRNDescriptorNative(normDesc, lrnN, lrnAlpha, lrnBeta, lrnK));
} | [
"public",
"static",
"int",
"cudnnGetLRNDescriptor",
"(",
"cudnnLRNDescriptor",
"normDesc",
",",
"int",
"[",
"]",
"lrnN",
",",
"double",
"[",
"]",
"lrnAlpha",
",",
"double",
"[",
"]",
"lrnBeta",
",",
"double",
"[",
"]",
"lrnK",
")",
"{",
"return",
"checkResult",
"(",
"cudnnGetLRNDescriptorNative",
"(",
"normDesc",
",",
"lrnN",
",",
"lrnAlpha",
",",
"lrnBeta",
",",
"lrnK",
")",
")",
";",
"}"
]
| <pre>
Retrieve the settings currently stored in an LRN layer descriptor
Any of the provided pointers can be NULL (no corresponding value will be returned)
</pre> | [
"<pre",
">",
"Retrieve",
"the",
"settings",
"currently",
"stored",
"in",
"an",
"LRN",
"layer",
"descriptor",
"Any",
"of",
"the",
"provided",
"pointers",
"can",
"be",
"NULL",
"(",
"no",
"corresponding",
"value",
"will",
"be",
"returned",
")",
"<",
"/",
"pre",
">"
]
| train | https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L2025-L2033 |
j256/simplejmx | src/main/java/com/j256/simplejmx/client/JmxClient.java | JmxClient.invokeOperationToString | public String invokeOperationToString(ObjectName name, String operName, String... paramStrings) throws Exception {
"""
Invoke a JMX method as an array of parameter strings.
@return The value returned by the method as a string or null if none.
"""
return ClientUtils.valueToString(invokeOperation(name, operName, paramStrings));
} | java | public String invokeOperationToString(ObjectName name, String operName, String... paramStrings) throws Exception {
return ClientUtils.valueToString(invokeOperation(name, operName, paramStrings));
} | [
"public",
"String",
"invokeOperationToString",
"(",
"ObjectName",
"name",
",",
"String",
"operName",
",",
"String",
"...",
"paramStrings",
")",
"throws",
"Exception",
"{",
"return",
"ClientUtils",
".",
"valueToString",
"(",
"invokeOperation",
"(",
"name",
",",
"operName",
",",
"paramStrings",
")",
")",
";",
"}"
]
| Invoke a JMX method as an array of parameter strings.
@return The value returned by the method as a string or null if none. | [
"Invoke",
"a",
"JMX",
"method",
"as",
"an",
"array",
"of",
"parameter",
"strings",
"."
]
| train | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L440-L442 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/templateresolver/AbstractTemplateResolver.java | AbstractTemplateResolver.computeResolvable | protected boolean computeResolvable(final IEngineConfiguration configuration, final String ownerTemplate, final String template, final Map<String, Object> templateResolutionAttributes) {
"""
<p>
Computes whether a template can be resolved by this resolver or not,
applying the corresponding patterns. Meant only for use or override by subclasses.
</p>
@param configuration the engine configuration.
@param ownerTemplate the owner template, if the resource being computed is a fragment. Might be null.
@param template the template to be resolved (usually its name).
@param templateResolutionAttributes the template resolution attributes, if any. Might be null.
@return whether the template is resolvable or not.
"""
if (this.resolvablePatternSpec.isEmpty()) {
return true;
}
return this.resolvablePatternSpec.matches(template);
} | java | protected boolean computeResolvable(final IEngineConfiguration configuration, final String ownerTemplate, final String template, final Map<String, Object> templateResolutionAttributes) {
if (this.resolvablePatternSpec.isEmpty()) {
return true;
}
return this.resolvablePatternSpec.matches(template);
} | [
"protected",
"boolean",
"computeResolvable",
"(",
"final",
"IEngineConfiguration",
"configuration",
",",
"final",
"String",
"ownerTemplate",
",",
"final",
"String",
"template",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"templateResolutionAttributes",
")",
"{",
"if",
"(",
"this",
".",
"resolvablePatternSpec",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"this",
".",
"resolvablePatternSpec",
".",
"matches",
"(",
"template",
")",
";",
"}"
]
| <p>
Computes whether a template can be resolved by this resolver or not,
applying the corresponding patterns. Meant only for use or override by subclasses.
</p>
@param configuration the engine configuration.
@param ownerTemplate the owner template, if the resource being computed is a fragment. Might be null.
@param template the template to be resolved (usually its name).
@param templateResolutionAttributes the template resolution attributes, if any. Might be null.
@return whether the template is resolvable or not. | [
"<p",
">",
"Computes",
"whether",
"a",
"template",
"can",
"be",
"resolved",
"by",
"this",
"resolver",
"or",
"not",
"applying",
"the",
"corresponding",
"patterns",
".",
"Meant",
"only",
"for",
"use",
"or",
"override",
"by",
"subclasses",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/templateresolver/AbstractTemplateResolver.java#L390-L395 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/Reflecter.java | Reflecter.copyTo | public <Dest> Dest copyTo(Object dest, String... excludes) {
"""
Copy all the same property to the given object, except the property name in the given exclude array
@param dest
@param excludes
@return
"""
return from(dest)
.setExchanges(exchangeProps)
.setExchangeFuncs(exchangeFuncs)
.setAutoExchange(autoExchange)
.setExcludePackagePath(excludePackagePath)
.setTrace(trace)
.populate(asMap(), excludes).get();
} | java | public <Dest> Dest copyTo(Object dest, String... excludes) {
return from(dest)
.setExchanges(exchangeProps)
.setExchangeFuncs(exchangeFuncs)
.setAutoExchange(autoExchange)
.setExcludePackagePath(excludePackagePath)
.setTrace(trace)
.populate(asMap(), excludes).get();
} | [
"public",
"<",
"Dest",
">",
"Dest",
"copyTo",
"(",
"Object",
"dest",
",",
"String",
"...",
"excludes",
")",
"{",
"return",
"from",
"(",
"dest",
")",
".",
"setExchanges",
"(",
"exchangeProps",
")",
".",
"setExchangeFuncs",
"(",
"exchangeFuncs",
")",
".",
"setAutoExchange",
"(",
"autoExchange",
")",
".",
"setExcludePackagePath",
"(",
"excludePackagePath",
")",
".",
"setTrace",
"(",
"trace",
")",
".",
"populate",
"(",
"asMap",
"(",
")",
",",
"excludes",
")",
".",
"get",
"(",
")",
";",
"}"
]
| Copy all the same property to the given object, except the property name in the given exclude array
@param dest
@param excludes
@return | [
"Copy",
"all",
"the",
"same",
"property",
"to",
"the",
"given",
"object",
"except",
"the",
"property",
"name",
"in",
"the",
"given",
"exclude",
"array"
]
| train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Reflecter.java#L159-L167 |
iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java | AccessPoint.makeCaptureQueryUrl | public String makeCaptureQueryUrl(String url, String startdate, String enddate) {
"""
Build a self-referencing URL that will perform a query for all copies
of URL {@code url}.
@param url URL to search for copies of
@param startdate start of date range in DT14 format (may be {@code null}
for no date range.
@param enddate end of date range in DT14 format (may be {@code null}, ignored
if {@code startdate} is {@code null})
@return String URL that will make a query for all captures of {@code url}.
"""
// XXX assumes particular style of query URL, which may not be compatible
// with RequestParsers in use. TODO: refactor.
if (startdate != null) {
if (enddate != null) {
return getQueryPrefix() + startdate + "-" + enddate + "*/" + url;
} else {
return getQueryPrefix() + startdate + "*/" + url;
}
} else {
return getQueryPrefix() + "*/" + url;
}
} | java | public String makeCaptureQueryUrl(String url, String startdate, String enddate) {
// XXX assumes particular style of query URL, which may not be compatible
// with RequestParsers in use. TODO: refactor.
if (startdate != null) {
if (enddate != null) {
return getQueryPrefix() + startdate + "-" + enddate + "*/" + url;
} else {
return getQueryPrefix() + startdate + "*/" + url;
}
} else {
return getQueryPrefix() + "*/" + url;
}
} | [
"public",
"String",
"makeCaptureQueryUrl",
"(",
"String",
"url",
",",
"String",
"startdate",
",",
"String",
"enddate",
")",
"{",
"// XXX assumes particular style of query URL, which may not be compatible",
"// with RequestParsers in use. TODO: refactor.",
"if",
"(",
"startdate",
"!=",
"null",
")",
"{",
"if",
"(",
"enddate",
"!=",
"null",
")",
"{",
"return",
"getQueryPrefix",
"(",
")",
"+",
"startdate",
"+",
"\"-\"",
"+",
"enddate",
"+",
"\"*/\"",
"+",
"url",
";",
"}",
"else",
"{",
"return",
"getQueryPrefix",
"(",
")",
"+",
"startdate",
"+",
"\"*/\"",
"+",
"url",
";",
"}",
"}",
"else",
"{",
"return",
"getQueryPrefix",
"(",
")",
"+",
"\"*/\"",
"+",
"url",
";",
"}",
"}"
]
| Build a self-referencing URL that will perform a query for all copies
of URL {@code url}.
@param url URL to search for copies of
@param startdate start of date range in DT14 format (may be {@code null}
for no date range.
@param enddate end of date range in DT14 format (may be {@code null}, ignored
if {@code startdate} is {@code null})
@return String URL that will make a query for all captures of {@code url}. | [
"Build",
"a",
"self",
"-",
"referencing",
"URL",
"that",
"will",
"perform",
"a",
"query",
"for",
"all",
"copies",
"of",
"URL",
"{"
]
| train | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java#L1439-L1451 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AbstractHtmlTableCell.java | AbstractHtmlTableCell.setBehavior | public void setBehavior(String name, Object value, String facet)
throws JspException {
"""
<p>
Base support for setting behavior values via the {@link IBehaviorConsumer} interface. The
AbstractHtmlTableCell does not support any attributes by default. Attributes set via this
interface are used to configure internal functionality of the tags which is not exposed
via JSP tag attributes.
</p>
@param name the name of the behavior
@param value the value of the behavior
@param facet the name of a facet of the tag to which the behavior will be applied. This is optional.
@throws JspException
"""
String s = Bundle.getString("Tags_BehaviorFacetNotSupported", new Object[]{facet});
throw new JspException(s);
} | java | public void setBehavior(String name, Object value, String facet)
throws JspException {
String s = Bundle.getString("Tags_BehaviorFacetNotSupported", new Object[]{facet});
throw new JspException(s);
} | [
"public",
"void",
"setBehavior",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"String",
"facet",
")",
"throws",
"JspException",
"{",
"String",
"s",
"=",
"Bundle",
".",
"getString",
"(",
"\"Tags_BehaviorFacetNotSupported\"",
",",
"new",
"Object",
"[",
"]",
"{",
"facet",
"}",
")",
";",
"throw",
"new",
"JspException",
"(",
"s",
")",
";",
"}"
]
| <p>
Base support for setting behavior values via the {@link IBehaviorConsumer} interface. The
AbstractHtmlTableCell does not support any attributes by default. Attributes set via this
interface are used to configure internal functionality of the tags which is not exposed
via JSP tag attributes.
</p>
@param name the name of the behavior
@param value the value of the behavior
@param facet the name of a facet of the tag to which the behavior will be applied. This is optional.
@throws JspException | [
"<p",
">",
"Base",
"support",
"for",
"setting",
"behavior",
"values",
"via",
"the",
"{"
]
| train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AbstractHtmlTableCell.java#L461-L465 |
syphr42/prom | src/main/java/org/syphr/prom/PropertiesManagers.java | PropertiesManagers.newManager | public static <T extends Enum<T>> PropertiesManager<T> newManager(File file,
File defaultFile,
Class<T> keyType,
ExecutorService executor,
final Retriever... retrievers) throws IOException {
"""
Build a new manager for the given properties file.
@param <T>
the type of key used for the new manager
@param file
the file system location of the properties represented by the
new manager
@param defaultFile
a file containing default values for the properties
represented by the new manager
@param keyType
the enumeration of keys in the properties file
@param executor
a service to handle potentially long running tasks, such as
interacting with the file system
@param retrievers
a set of retrievers that will be used to resolve extra
property references (i.e. if a nested value reference is found
in a properties file and there is no property to match it, the
given retrievers will be used)
@return a new manager
@throws IOException
if there is an error while reading the default properties
"""
return new PropertiesManager<T>(file,
getProperties(defaultFile),
getEnumTranslator(keyType),
new DefaultEvaluator(),
executor)
{
@Override
protected Retriever createRetriever()
{
return new AddOnRetriever(true, super.createRetriever(), retrievers);
}
};
} | java | public static <T extends Enum<T>> PropertiesManager<T> newManager(File file,
File defaultFile,
Class<T> keyType,
ExecutorService executor,
final Retriever... retrievers) throws IOException
{
return new PropertiesManager<T>(file,
getProperties(defaultFile),
getEnumTranslator(keyType),
new DefaultEvaluator(),
executor)
{
@Override
protected Retriever createRetriever()
{
return new AddOnRetriever(true, super.createRetriever(), retrievers);
}
};
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"PropertiesManager",
"<",
"T",
">",
"newManager",
"(",
"File",
"file",
",",
"File",
"defaultFile",
",",
"Class",
"<",
"T",
">",
"keyType",
",",
"ExecutorService",
"executor",
",",
"final",
"Retriever",
"...",
"retrievers",
")",
"throws",
"IOException",
"{",
"return",
"new",
"PropertiesManager",
"<",
"T",
">",
"(",
"file",
",",
"getProperties",
"(",
"defaultFile",
")",
",",
"getEnumTranslator",
"(",
"keyType",
")",
",",
"new",
"DefaultEvaluator",
"(",
")",
",",
"executor",
")",
"{",
"@",
"Override",
"protected",
"Retriever",
"createRetriever",
"(",
")",
"{",
"return",
"new",
"AddOnRetriever",
"(",
"true",
",",
"super",
".",
"createRetriever",
"(",
")",
",",
"retrievers",
")",
";",
"}",
"}",
";",
"}"
]
| Build a new manager for the given properties file.
@param <T>
the type of key used for the new manager
@param file
the file system location of the properties represented by the
new manager
@param defaultFile
a file containing default values for the properties
represented by the new manager
@param keyType
the enumeration of keys in the properties file
@param executor
a service to handle potentially long running tasks, such as
interacting with the file system
@param retrievers
a set of retrievers that will be used to resolve extra
property references (i.e. if a nested value reference is found
in a properties file and there is no property to match it, the
given retrievers will be used)
@return a new manager
@throws IOException
if there is an error while reading the default properties | [
"Build",
"a",
"new",
"manager",
"for",
"the",
"given",
"properties",
"file",
"."
]
| train | https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/PropertiesManagers.java#L146-L164 |
sagiegurari/fax4j | src/main/java/org/fax4j/util/ReflectionHelper.java | ReflectionHelper.invokeMethod | public static Object invokeMethod(Class<?> type,Object instance,String methodName,Class<?>[] inputTypes,Object[] input) {
"""
This function invokes the requested method.
@param type
The class type
@param instance
The instance
@param methodName
The method name to invoke
@param inputTypes
An array of input types
@param input
The method input
@return The method output
"""
Method method=null;
try
{
//get method
method=type.getDeclaredMethod(methodName,inputTypes);
}
catch(Exception exception)
{
throw new FaxException("Unable to extract method: "+methodName+" from type: "+type,exception);
}
//set accessible
method.setAccessible(true);
Object output=null;
try
{
//invoke method
output=method.invoke(instance,input);
}
catch(Exception exception)
{
throw new FaxException("Unable to invoke method: "+methodName+" of type: "+type,exception);
}
return output;
} | java | public static Object invokeMethod(Class<?> type,Object instance,String methodName,Class<?>[] inputTypes,Object[] input)
{
Method method=null;
try
{
//get method
method=type.getDeclaredMethod(methodName,inputTypes);
}
catch(Exception exception)
{
throw new FaxException("Unable to extract method: "+methodName+" from type: "+type,exception);
}
//set accessible
method.setAccessible(true);
Object output=null;
try
{
//invoke method
output=method.invoke(instance,input);
}
catch(Exception exception)
{
throw new FaxException("Unable to invoke method: "+methodName+" of type: "+type,exception);
}
return output;
} | [
"public",
"static",
"Object",
"invokeMethod",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Object",
"instance",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"inputTypes",
",",
"Object",
"[",
"]",
"input",
")",
"{",
"Method",
"method",
"=",
"null",
";",
"try",
"{",
"//get method",
"method",
"=",
"type",
".",
"getDeclaredMethod",
"(",
"methodName",
",",
"inputTypes",
")",
";",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"throw",
"new",
"FaxException",
"(",
"\"Unable to extract method: \"",
"+",
"methodName",
"+",
"\" from type: \"",
"+",
"type",
",",
"exception",
")",
";",
"}",
"//set accessible",
"method",
".",
"setAccessible",
"(",
"true",
")",
";",
"Object",
"output",
"=",
"null",
";",
"try",
"{",
"//invoke method",
"output",
"=",
"method",
".",
"invoke",
"(",
"instance",
",",
"input",
")",
";",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"throw",
"new",
"FaxException",
"(",
"\"Unable to invoke method: \"",
"+",
"methodName",
"+",
"\" of type: \"",
"+",
"type",
",",
"exception",
")",
";",
"}",
"return",
"output",
";",
"}"
]
| This function invokes the requested method.
@param type
The class type
@param instance
The instance
@param methodName
The method name to invoke
@param inputTypes
An array of input types
@param input
The method input
@return The method output | [
"This",
"function",
"invokes",
"the",
"requested",
"method",
"."
]
| train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/ReflectionHelper.java#L118-L146 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java | SeaGlassTextFieldUI.paintSearchButton | protected void paintSearchButton(Graphics g, JTextComponent c, Region region) {
"""
DOCUMENT ME!
@param g DOCUMENT ME!
@param c DOCUMENT ME!
@param region DOCUMENT ME!
"""
Rectangle bounds;
if (region == SeaGlassRegion.SEARCH_FIELD_FIND_BUTTON) {
bounds = getFindButtonBounds();
} else {
bounds = getCancelButtonBounds();
}
SeaGlassContext subcontext = getContext(c, region);
SeaGlassLookAndFeel.updateSubregion(subcontext, g, bounds);
SeaGlassSynthPainterImpl painter = (SeaGlassSynthPainterImpl) subcontext.getPainter();
painter.paintSearchButtonForeground(subcontext, g, bounds.x, bounds.y, bounds.width, bounds.height);
subcontext.dispose();
} | java | protected void paintSearchButton(Graphics g, JTextComponent c, Region region) {
Rectangle bounds;
if (region == SeaGlassRegion.SEARCH_FIELD_FIND_BUTTON) {
bounds = getFindButtonBounds();
} else {
bounds = getCancelButtonBounds();
}
SeaGlassContext subcontext = getContext(c, region);
SeaGlassLookAndFeel.updateSubregion(subcontext, g, bounds);
SeaGlassSynthPainterImpl painter = (SeaGlassSynthPainterImpl) subcontext.getPainter();
painter.paintSearchButtonForeground(subcontext, g, bounds.x, bounds.y, bounds.width, bounds.height);
subcontext.dispose();
} | [
"protected",
"void",
"paintSearchButton",
"(",
"Graphics",
"g",
",",
"JTextComponent",
"c",
",",
"Region",
"region",
")",
"{",
"Rectangle",
"bounds",
";",
"if",
"(",
"region",
"==",
"SeaGlassRegion",
".",
"SEARCH_FIELD_FIND_BUTTON",
")",
"{",
"bounds",
"=",
"getFindButtonBounds",
"(",
")",
";",
"}",
"else",
"{",
"bounds",
"=",
"getCancelButtonBounds",
"(",
")",
";",
"}",
"SeaGlassContext",
"subcontext",
"=",
"getContext",
"(",
"c",
",",
"region",
")",
";",
"SeaGlassLookAndFeel",
".",
"updateSubregion",
"(",
"subcontext",
",",
"g",
",",
"bounds",
")",
";",
"SeaGlassSynthPainterImpl",
"painter",
"=",
"(",
"SeaGlassSynthPainterImpl",
")",
"subcontext",
".",
"getPainter",
"(",
")",
";",
"painter",
".",
"paintSearchButtonForeground",
"(",
"subcontext",
",",
"g",
",",
"bounds",
".",
"x",
",",
"bounds",
".",
"y",
",",
"bounds",
".",
"width",
",",
"bounds",
".",
"height",
")",
";",
"subcontext",
".",
"dispose",
"(",
")",
";",
"}"
]
| DOCUMENT ME!
@param g DOCUMENT ME!
@param c DOCUMENT ME!
@param region DOCUMENT ME! | [
"DOCUMENT",
"ME!"
]
| train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java#L527-L545 |
undertow-io/undertow | core/src/main/java/io/undertow/util/QueryParameterUtils.java | QueryParameterUtils.parseQueryString | @Deprecated
public static Map<String, Deque<String>> parseQueryString(final String newQueryString) {
"""
Parses a query string into a map
@param newQueryString The query string
@return The map of key value parameters
"""
return parseQueryString(newQueryString, null);
} | java | @Deprecated
public static Map<String, Deque<String>> parseQueryString(final String newQueryString) {
return parseQueryString(newQueryString, null);
} | [
"@",
"Deprecated",
"public",
"static",
"Map",
"<",
"String",
",",
"Deque",
"<",
"String",
">",
">",
"parseQueryString",
"(",
"final",
"String",
"newQueryString",
")",
"{",
"return",
"parseQueryString",
"(",
"newQueryString",
",",
"null",
")",
";",
"}"
]
| Parses a query string into a map
@param newQueryString The query string
@return The map of key value parameters | [
"Parses",
"a",
"query",
"string",
"into",
"a",
"map"
]
| train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/QueryParameterUtils.java#L77-L80 |
m-m-m/util | resource/src/main/java/net/sf/mmm/util/resource/base/AbstractDataResource.java | AbstractDataResource.getSize | @Override
public long getSize() throws ResourceNotAvailableException {
"""
{@inheritDoc}
This is a default implementation. Override if there is a more performing way to implement this.
"""
try {
// return getUrl().openConnection().getContentLengthLong();
return getUrl().openConnection().getContentLength();
} catch (IOException e) {
throw new ResourceNotAvailableException(e, getPath());
}
} | java | @Override
public long getSize() throws ResourceNotAvailableException {
try {
// return getUrl().openConnection().getContentLengthLong();
return getUrl().openConnection().getContentLength();
} catch (IOException e) {
throw new ResourceNotAvailableException(e, getPath());
}
} | [
"@",
"Override",
"public",
"long",
"getSize",
"(",
")",
"throws",
"ResourceNotAvailableException",
"{",
"try",
"{",
"// return getUrl().openConnection().getContentLengthLong();\r",
"return",
"getUrl",
"(",
")",
".",
"openConnection",
"(",
")",
".",
"getContentLength",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"ResourceNotAvailableException",
"(",
"e",
",",
"getPath",
"(",
")",
")",
";",
"}",
"}"
]
| {@inheritDoc}
This is a default implementation. Override if there is a more performing way to implement this. | [
"{",
"@inheritDoc",
"}"
]
| train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/resource/src/main/java/net/sf/mmm/util/resource/base/AbstractDataResource.java#L74-L83 |
sd4324530/fastweixin | src/main/java/com/github/sd4324530/fastweixin/company/api/QYTagAPI.java | QYTagAPI.addTagUsers | public AddTagUsersResponse addTagUsers(Integer tagid, List<String> users, List<Integer> partys) {
"""
增加标签成员。userlist与partylist非必须,但不能同时为空
@param tagid 目标标签id。必填
@param users 企业成员ID列表。单次请求长度不能超过1000
@param partys 企业部门ID列表。单次请求长度不能超过100
@return 操作结果
"""
BeanUtil.requireNonNull(tagid, "tagid不能为空!");
if((users == null || users.size() == 0) && (partys == null || partys.size() == 0)){
throw new WeixinException("userlist、partylist不能同时为空!");
}
if(users != null && users.size() > 1000){
throw new WeixinException("userlist单次请求长度不能大于1000");
}
if(partys != null && partys.size() > 100){
throw new WeixinException("partylist单次请求长度不能大于100");
}
AddTagUsersResponse response;
String url = BASE_API_URL + "cgi-bin/tag/addtagusers?access_token=#";
final Map<String, Object> params = new HashMap<String, Object>();
params.put("tagid", tagid);
params.put("userlist", users);
params.put("partylist", partys);
BaseResponse r = executePost(url, JSONUtil.toJson(params));
String jsonResult = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
response = JSONUtil.toBean(jsonResult, AddTagUsersResponse.class);
return response;
} | java | public AddTagUsersResponse addTagUsers(Integer tagid, List<String> users, List<Integer> partys){
BeanUtil.requireNonNull(tagid, "tagid不能为空!");
if((users == null || users.size() == 0) && (partys == null || partys.size() == 0)){
throw new WeixinException("userlist、partylist不能同时为空!");
}
if(users != null && users.size() > 1000){
throw new WeixinException("userlist单次请求长度不能大于1000");
}
if(partys != null && partys.size() > 100){
throw new WeixinException("partylist单次请求长度不能大于100");
}
AddTagUsersResponse response;
String url = BASE_API_URL + "cgi-bin/tag/addtagusers?access_token=#";
final Map<String, Object> params = new HashMap<String, Object>();
params.put("tagid", tagid);
params.put("userlist", users);
params.put("partylist", partys);
BaseResponse r = executePost(url, JSONUtil.toJson(params));
String jsonResult = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
response = JSONUtil.toBean(jsonResult, AddTagUsersResponse.class);
return response;
} | [
"public",
"AddTagUsersResponse",
"addTagUsers",
"(",
"Integer",
"tagid",
",",
"List",
"<",
"String",
">",
"users",
",",
"List",
"<",
"Integer",
">",
"partys",
")",
"{",
"BeanUtil",
".",
"requireNonNull",
"(",
"tagid",
",",
"\"tagid不能为空!\");",
"",
"",
"if",
"(",
"(",
"users",
"==",
"null",
"||",
"users",
".",
"size",
"(",
")",
"==",
"0",
")",
"&&",
"(",
"partys",
"==",
"null",
"||",
"partys",
".",
"size",
"(",
")",
"==",
"0",
")",
")",
"{",
"throw",
"new",
"WeixinException",
"(",
"\"userlist、partylist不能同时为空!\");",
"",
"",
"}",
"if",
"(",
"users",
"!=",
"null",
"&&",
"users",
".",
"size",
"(",
")",
">",
"1000",
")",
"{",
"throw",
"new",
"WeixinException",
"(",
"\"userlist单次请求长度不能大于1000\");",
"",
"",
"}",
"if",
"(",
"partys",
"!=",
"null",
"&&",
"partys",
".",
"size",
"(",
")",
">",
"100",
")",
"{",
"throw",
"new",
"WeixinException",
"(",
"\"partylist单次请求长度不能大于100\");",
"",
"",
"}",
"AddTagUsersResponse",
"response",
";",
"String",
"url",
"=",
"BASE_API_URL",
"+",
"\"cgi-bin/tag/addtagusers?access_token=#\"",
";",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"params",
".",
"put",
"(",
"\"tagid\"",
",",
"tagid",
")",
";",
"params",
".",
"put",
"(",
"\"userlist\"",
",",
"users",
")",
";",
"params",
".",
"put",
"(",
"\"partylist\"",
",",
"partys",
")",
";",
"BaseResponse",
"r",
"=",
"executePost",
"(",
"url",
",",
"JSONUtil",
".",
"toJson",
"(",
"params",
")",
")",
";",
"String",
"jsonResult",
"=",
"isSuccess",
"(",
"r",
".",
"getErrcode",
"(",
")",
")",
"?",
"r",
".",
"getErrmsg",
"(",
")",
":",
"r",
".",
"toJsonString",
"(",
")",
";",
"response",
"=",
"JSONUtil",
".",
"toBean",
"(",
"jsonResult",
",",
"AddTagUsersResponse",
".",
"class",
")",
";",
"return",
"response",
";",
"}"
]
| 增加标签成员。userlist与partylist非必须,但不能同时为空
@param tagid 目标标签id。必填
@param users 企业成员ID列表。单次请求长度不能超过1000
@param partys 企业部门ID列表。单次请求长度不能超过100
@return 操作结果 | [
"增加标签成员。userlist与partylist非必须,但不能同时为空"
]
| train | https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/company/api/QYTagAPI.java#L101-L122 |
belaban/JGroups | src/org/jgroups/blocks/PartitionedHashMap.java | PartitionedHashMap.put | @ManagedOperation
public void put(K key, V val, long caching_time) {
"""
Adds a key/value to the cache, replacing a previous item if there was one
@param key The key
@param val The value
@param caching_time Time to live. -1 means never cache, 0 means cache forever. All other (positive) values
are the number of milliseconds to cache the item
"""
Address dest_node=getNode(key);
if(dest_node.equals(local_addr)) {
l2_cache.put(key, val, caching_time);
}
else {
sendPut(dest_node, key, val, caching_time, false);
}
if(l1_cache != null && caching_time >= 0)
l1_cache.put(key, val, caching_time);
} | java | @ManagedOperation
public void put(K key, V val, long caching_time) {
Address dest_node=getNode(key);
if(dest_node.equals(local_addr)) {
l2_cache.put(key, val, caching_time);
}
else {
sendPut(dest_node, key, val, caching_time, false);
}
if(l1_cache != null && caching_time >= 0)
l1_cache.put(key, val, caching_time);
} | [
"@",
"ManagedOperation",
"public",
"void",
"put",
"(",
"K",
"key",
",",
"V",
"val",
",",
"long",
"caching_time",
")",
"{",
"Address",
"dest_node",
"=",
"getNode",
"(",
"key",
")",
";",
"if",
"(",
"dest_node",
".",
"equals",
"(",
"local_addr",
")",
")",
"{",
"l2_cache",
".",
"put",
"(",
"key",
",",
"val",
",",
"caching_time",
")",
";",
"}",
"else",
"{",
"sendPut",
"(",
"dest_node",
",",
"key",
",",
"val",
",",
"caching_time",
",",
"false",
")",
";",
"}",
"if",
"(",
"l1_cache",
"!=",
"null",
"&&",
"caching_time",
">=",
"0",
")",
"l1_cache",
".",
"put",
"(",
"key",
",",
"val",
",",
"caching_time",
")",
";",
"}"
]
| Adds a key/value to the cache, replacing a previous item if there was one
@param key The key
@param val The value
@param caching_time Time to live. -1 means never cache, 0 means cache forever. All other (positive) values
are the number of milliseconds to cache the item | [
"Adds",
"a",
"key",
"/",
"value",
"to",
"the",
"cache",
"replacing",
"a",
"previous",
"item",
"if",
"there",
"was",
"one"
]
| train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/PartitionedHashMap.java#L255-L266 |
saxsys/SynchronizeFX | transmitter/websocket-transmitter/src/main/java/de/saxsys/synchronizefx/websocket/SynchronizeFXWebsocketChannel.java | SynchronizeFXWebsocketChannel.newMessage | void newMessage(final byte[] message, final Session session) {
"""
Inform this channel that one of its client has send a message.
@param message The message that was send.
@param session The client that send the message.
"""
callback.recive(serializer.deserialize(message), session);
} | java | void newMessage(final byte[] message, final Session session) {
callback.recive(serializer.deserialize(message), session);
} | [
"void",
"newMessage",
"(",
"final",
"byte",
"[",
"]",
"message",
",",
"final",
"Session",
"session",
")",
"{",
"callback",
".",
"recive",
"(",
"serializer",
".",
"deserialize",
"(",
"message",
")",
",",
"session",
")",
";",
"}"
]
| Inform this channel that one of its client has send a message.
@param message The message that was send.
@param session The client that send the message. | [
"Inform",
"this",
"channel",
"that",
"one",
"of",
"its",
"client",
"has",
"send",
"a",
"message",
"."
]
| train | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/transmitter/websocket-transmitter/src/main/java/de/saxsys/synchronizefx/websocket/SynchronizeFXWebsocketChannel.java#L87-L89 |
carewebframework/carewebframework-core | org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java | InfoPanelService.associateEvent | public static void associateEvent(BaseComponent component, String eventName, Action action) {
"""
Associate a generic event with an action on this component's container.
@param component Component whose container is the target of an action.
@param eventName The name of the generic event that will invoke the action.
@param action The action to be performed.
"""
getActionListeners(component, true).add(new ActionListener(eventName, action));
} | java | public static void associateEvent(BaseComponent component, String eventName, Action action) {
getActionListeners(component, true).add(new ActionListener(eventName, action));
} | [
"public",
"static",
"void",
"associateEvent",
"(",
"BaseComponent",
"component",
",",
"String",
"eventName",
",",
"Action",
"action",
")",
"{",
"getActionListeners",
"(",
"component",
",",
"true",
")",
".",
"add",
"(",
"new",
"ActionListener",
"(",
"eventName",
",",
"action",
")",
")",
";",
"}"
]
| Associate a generic event with an action on this component's container.
@param component Component whose container is the target of an action.
@param eventName The name of the generic event that will invoke the action.
@param action The action to be performed. | [
"Associate",
"a",
"generic",
"event",
"with",
"an",
"action",
"on",
"this",
"component",
"s",
"container",
"."
]
| train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java#L159-L161 |
facebookarchive/hadoop-20 | src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java | FairScheduler.getAvailableSlots | private int getAvailableSlots(TaskTrackerStatus tts, TaskType type) {
"""
Obtain the how many more slots can be scheduled on this tasktracker
@param tts The status of the tasktracker
@param type The type of the task to be scheduled
@return the number of tasks can be scheduled
"""
return getMaxSlots(tts, type) - occupiedSlotsAfterHeartbeat(tts, type);
} | java | private int getAvailableSlots(TaskTrackerStatus tts, TaskType type) {
return getMaxSlots(tts, type) - occupiedSlotsAfterHeartbeat(tts, type);
} | [
"private",
"int",
"getAvailableSlots",
"(",
"TaskTrackerStatus",
"tts",
",",
"TaskType",
"type",
")",
"{",
"return",
"getMaxSlots",
"(",
"tts",
",",
"type",
")",
"-",
"occupiedSlotsAfterHeartbeat",
"(",
"tts",
",",
"type",
")",
";",
"}"
]
| Obtain the how many more slots can be scheduled on this tasktracker
@param tts The status of the tasktracker
@param type The type of the task to be scheduled
@return the number of tasks can be scheduled | [
"Obtain",
"the",
"how",
"many",
"more",
"slots",
"can",
"be",
"scheduled",
"on",
"this",
"tasktracker"
]
| train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/fairscheduler/src/java/org/apache/hadoop/mapred/FairScheduler.java#L805-L807 |
morimekta/utils | io-util/src/main/java/net/morimekta/util/FileWatcher.java | FileWatcher.weakAddWatcher | @Deprecated
public void weakAddWatcher(Path file, Watcher watcher) {
"""
Start watching file path and notify watcher for updates on that file.
The watcher will be kept in a weak reference and will allow GC to delete
the instance.
@param file The file path to watch.
@param watcher The watcher to be notified.
"""
weakAddWatcher(file, (Listener) watcher);
} | java | @Deprecated
public void weakAddWatcher(Path file, Watcher watcher) {
weakAddWatcher(file, (Listener) watcher);
} | [
"@",
"Deprecated",
"public",
"void",
"weakAddWatcher",
"(",
"Path",
"file",
",",
"Watcher",
"watcher",
")",
"{",
"weakAddWatcher",
"(",
"file",
",",
"(",
"Listener",
")",
"watcher",
")",
";",
"}"
]
| Start watching file path and notify watcher for updates on that file.
The watcher will be kept in a weak reference and will allow GC to delete
the instance.
@param file The file path to watch.
@param watcher The watcher to be notified. | [
"Start",
"watching",
"file",
"path",
"and",
"notify",
"watcher",
"for",
"updates",
"on",
"that",
"file",
".",
"The",
"watcher",
"will",
"be",
"kept",
"in",
"a",
"weak",
"reference",
"and",
"will",
"allow",
"GC",
"to",
"delete",
"the",
"instance",
"."
]
| train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/FileWatcher.java#L277-L280 |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java | BottomSheet.setIntent | public final void setIntent(@NonNull final Activity activity, @NonNull final Intent intent) {
"""
Adds the apps, which are able to handle a specific intent, as items to the bottom sheet. This
causes all previously added items to be removed. When an item is clicked, the corresponding
app is started.
@param activity
The activity, the bottom sheet belongs to, as an instance of the class {@link
Activity}. The activity may not be null
@param intent
The intent as an instance of the class {@link Intent}. The intent may not be null
"""
Condition.INSTANCE.ensureNotNull(activity, "The activity may not be null");
Condition.INSTANCE.ensureNotNull(intent, "The intent may not be null");
removeAllItems();
PackageManager packageManager = activity.getPackageManager();
List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(intent, 0);
for (int i = 0; i < resolveInfos.size(); i++) {
ResolveInfo resolveInfo = resolveInfos.get(i);
addItem(i, resolveInfo.loadLabel(packageManager), resolveInfo.loadIcon(packageManager));
}
setOnItemClickListener(
createIntentClickListener(activity, (Intent) intent.clone(), resolveInfos));
} | java | public final void setIntent(@NonNull final Activity activity, @NonNull final Intent intent) {
Condition.INSTANCE.ensureNotNull(activity, "The activity may not be null");
Condition.INSTANCE.ensureNotNull(intent, "The intent may not be null");
removeAllItems();
PackageManager packageManager = activity.getPackageManager();
List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(intent, 0);
for (int i = 0; i < resolveInfos.size(); i++) {
ResolveInfo resolveInfo = resolveInfos.get(i);
addItem(i, resolveInfo.loadLabel(packageManager), resolveInfo.loadIcon(packageManager));
}
setOnItemClickListener(
createIntentClickListener(activity, (Intent) intent.clone(), resolveInfos));
} | [
"public",
"final",
"void",
"setIntent",
"(",
"@",
"NonNull",
"final",
"Activity",
"activity",
",",
"@",
"NonNull",
"final",
"Intent",
"intent",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"activity",
",",
"\"The activity may not be null\"",
")",
";",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"intent",
",",
"\"The intent may not be null\"",
")",
";",
"removeAllItems",
"(",
")",
";",
"PackageManager",
"packageManager",
"=",
"activity",
".",
"getPackageManager",
"(",
")",
";",
"List",
"<",
"ResolveInfo",
">",
"resolveInfos",
"=",
"packageManager",
".",
"queryIntentActivities",
"(",
"intent",
",",
"0",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resolveInfos",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"ResolveInfo",
"resolveInfo",
"=",
"resolveInfos",
".",
"get",
"(",
"i",
")",
";",
"addItem",
"(",
"i",
",",
"resolveInfo",
".",
"loadLabel",
"(",
"packageManager",
")",
",",
"resolveInfo",
".",
"loadIcon",
"(",
"packageManager",
")",
")",
";",
"}",
"setOnItemClickListener",
"(",
"createIntentClickListener",
"(",
"activity",
",",
"(",
"Intent",
")",
"intent",
".",
"clone",
"(",
")",
",",
"resolveInfos",
")",
")",
";",
"}"
]
| Adds the apps, which are able to handle a specific intent, as items to the bottom sheet. This
causes all previously added items to be removed. When an item is clicked, the corresponding
app is started.
@param activity
The activity, the bottom sheet belongs to, as an instance of the class {@link
Activity}. The activity may not be null
@param intent
The intent as an instance of the class {@link Intent}. The intent may not be null | [
"Adds",
"the",
"apps",
"which",
"are",
"able",
"to",
"handle",
"a",
"specific",
"intent",
"as",
"items",
"to",
"the",
"bottom",
"sheet",
".",
"This",
"causes",
"all",
"previously",
"added",
"items",
"to",
"be",
"removed",
".",
"When",
"an",
"item",
"is",
"clicked",
"the",
"corresponding",
"app",
"is",
"started",
"."
]
| train | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/BottomSheet.java#L2315-L2329 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java | XmlStringBuilder.appendOptionalUrlAttribute | public void appendOptionalUrlAttribute(final String name, final String value) {
"""
<p>
If the value is not null, add an xml attribute name+value pair to the end of this XmlStringBuilder
<p>
Eg. name="value"
</p>
@param name the name of the attribute to be added.
@param value the value of the attribute.
"""
if (value != null) {
appendUrlAttribute(name, value);
}
} | java | public void appendOptionalUrlAttribute(final String name, final String value) {
if (value != null) {
appendUrlAttribute(name, value);
}
} | [
"public",
"void",
"appendOptionalUrlAttribute",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"appendUrlAttribute",
"(",
"name",
",",
"value",
")",
";",
"}",
"}"
]
| <p>
If the value is not null, add an xml attribute name+value pair to the end of this XmlStringBuilder
<p>
Eg. name="value"
</p>
@param name the name of the attribute to be added.
@param value the value of the attribute. | [
"<p",
">",
"If",
"the",
"value",
"is",
"not",
"null",
"add",
"an",
"xml",
"attribute",
"name",
"+",
"value",
"pair",
"to",
"the",
"end",
"of",
"this",
"XmlStringBuilder",
"<p",
">",
"Eg",
".",
"name",
"=",
"value",
"<",
"/",
"p",
">"
]
| train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java#L169-L173 |
apache/flink | flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java | RequiredParameters.checkAmbiguousValues | private void checkAmbiguousValues(Option o, Map<String, String> data) throws RequiredParametersException {
"""
check if it also contains a value for the shortName in option (if any is defined)
"""
if (data.containsKey(o.getAlt()) && !Objects.equals(data.get(o.getAlt()), ParameterTool.NO_VALUE_KEY)) {
throw new RequiredParametersException("Value passed for parameter " + o.getName() +
" is ambiguous. Value passed for short and long name.");
}
} | java | private void checkAmbiguousValues(Option o, Map<String, String> data) throws RequiredParametersException{
if (data.containsKey(o.getAlt()) && !Objects.equals(data.get(o.getAlt()), ParameterTool.NO_VALUE_KEY)) {
throw new RequiredParametersException("Value passed for parameter " + o.getName() +
" is ambiguous. Value passed for short and long name.");
}
} | [
"private",
"void",
"checkAmbiguousValues",
"(",
"Option",
"o",
",",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"throws",
"RequiredParametersException",
"{",
"if",
"(",
"data",
".",
"containsKey",
"(",
"o",
".",
"getAlt",
"(",
")",
")",
"&&",
"!",
"Objects",
".",
"equals",
"(",
"data",
".",
"get",
"(",
"o",
".",
"getAlt",
"(",
")",
")",
",",
"ParameterTool",
".",
"NO_VALUE_KEY",
")",
")",
"{",
"throw",
"new",
"RequiredParametersException",
"(",
"\"Value passed for parameter \"",
"+",
"o",
".",
"getName",
"(",
")",
"+",
"\" is ambiguous. Value passed for short and long name.\"",
")",
";",
"}",
"}"
]
| check if it also contains a value for the shortName in option (if any is defined) | [
"check",
"if",
"it",
"also",
"contains",
"a",
"value",
"for",
"the",
"shortName",
"in",
"option",
"(",
"if",
"any",
"is",
"defined",
")"
]
| train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/utils/RequiredParameters.java#L166-L171 |
Waikato/moa | moa/src/main/java/moa/options/DependentOptionsUpdater.java | DependentOptionsUpdater.getVariedOption | public static Option getVariedOption(OptionHandler learner, String variedParamName) {
"""
Resolve the name of the varied parameter and return the corresponding option.
The varied parameter name has the format "learner/suboptions.../numberOption".
If no matching parameter can be found, <code>null</code> is returned.
@param learner the learner object that has the varied option
@param variedParamName name of the (nested) varied parameter
@return varied option
"""
// split nested option string
String[] singleOptions = variedParamName.split("/");
// check if first level is "learner", which has already been resolved
int startIndex = 0;
if (singleOptions.length > 0 && singleOptions[0].equals("learner/")) {
startIndex = 1;
}
// iteratively create objects and get next options for each level
Option learnerVariedParamOption = null;
OptionHandler currentOptionHandler = learner;
for (int i = startIndex; i < singleOptions.length; i++) {
for (Option opt : currentOptionHandler.getOptions().getOptionArray()) {
if (opt.getName().equals(singleOptions[i])) {
if (opt instanceof ClassOption) {
currentOptionHandler = (OptionHandler)
((ClassOption) opt).getPreMaterializedObject();
}
else {
learnerVariedParamOption = opt;
}
break;
}
}
}
return learnerVariedParamOption;
} | java | public static Option getVariedOption(OptionHandler learner, String variedParamName) {
// split nested option string
String[] singleOptions = variedParamName.split("/");
// check if first level is "learner", which has already been resolved
int startIndex = 0;
if (singleOptions.length > 0 && singleOptions[0].equals("learner/")) {
startIndex = 1;
}
// iteratively create objects and get next options for each level
Option learnerVariedParamOption = null;
OptionHandler currentOptionHandler = learner;
for (int i = startIndex; i < singleOptions.length; i++) {
for (Option opt : currentOptionHandler.getOptions().getOptionArray()) {
if (opt.getName().equals(singleOptions[i])) {
if (opt instanceof ClassOption) {
currentOptionHandler = (OptionHandler)
((ClassOption) opt).getPreMaterializedObject();
}
else {
learnerVariedParamOption = opt;
}
break;
}
}
}
return learnerVariedParamOption;
} | [
"public",
"static",
"Option",
"getVariedOption",
"(",
"OptionHandler",
"learner",
",",
"String",
"variedParamName",
")",
"{",
"// split nested option string",
"String",
"[",
"]",
"singleOptions",
"=",
"variedParamName",
".",
"split",
"(",
"\"/\"",
")",
";",
"// check if first level is \"learner\", which has already been resolved",
"int",
"startIndex",
"=",
"0",
";",
"if",
"(",
"singleOptions",
".",
"length",
">",
"0",
"&&",
"singleOptions",
"[",
"0",
"]",
".",
"equals",
"(",
"\"learner/\"",
")",
")",
"{",
"startIndex",
"=",
"1",
";",
"}",
"// iteratively create objects and get next options for each level",
"Option",
"learnerVariedParamOption",
"=",
"null",
";",
"OptionHandler",
"currentOptionHandler",
"=",
"learner",
";",
"for",
"(",
"int",
"i",
"=",
"startIndex",
";",
"i",
"<",
"singleOptions",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"Option",
"opt",
":",
"currentOptionHandler",
".",
"getOptions",
"(",
")",
".",
"getOptionArray",
"(",
")",
")",
"{",
"if",
"(",
"opt",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"singleOptions",
"[",
"i",
"]",
")",
")",
"{",
"if",
"(",
"opt",
"instanceof",
"ClassOption",
")",
"{",
"currentOptionHandler",
"=",
"(",
"OptionHandler",
")",
"(",
"(",
"ClassOption",
")",
"opt",
")",
".",
"getPreMaterializedObject",
"(",
")",
";",
"}",
"else",
"{",
"learnerVariedParamOption",
"=",
"opt",
";",
"}",
"break",
";",
"}",
"}",
"}",
"return",
"learnerVariedParamOption",
";",
"}"
]
| Resolve the name of the varied parameter and return the corresponding option.
The varied parameter name has the format "learner/suboptions.../numberOption".
If no matching parameter can be found, <code>null</code> is returned.
@param learner the learner object that has the varied option
@param variedParamName name of the (nested) varied parameter
@return varied option | [
"Resolve",
"the",
"name",
"of",
"the",
"varied",
"parameter",
"and",
"return",
"the",
"corresponding",
"option",
".",
"The",
"varied",
"parameter",
"name",
"has",
"the",
"format",
"learner",
"/",
"suboptions",
"...",
"/",
"numberOption",
".",
"If",
"no",
"matching",
"parameter",
"can",
"be",
"found",
"<code",
">",
"null<",
"/",
"code",
">",
"is",
"returned",
"."
]
| train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/options/DependentOptionsUpdater.java#L175-L204 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java | CollUtil.valuesOfKeys | public static <K, V> ArrayList<V> valuesOfKeys(Map<K, V> map, Iterable<K> keys) {
"""
从Map中获取指定键列表对应的值列表<br>
如果key在map中不存在或key对应值为null,则返回值列表对应位置的值也为null
@param <K> 键类型
@param <V> 值类型
@param map {@link Map}
@param keys 键列表
@return 值列表
@since 3.0.9
"""
return valuesOfKeys(map, keys.iterator());
} | java | public static <K, V> ArrayList<V> valuesOfKeys(Map<K, V> map, Iterable<K> keys) {
return valuesOfKeys(map, keys.iterator());
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"ArrayList",
"<",
"V",
">",
"valuesOfKeys",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"Iterable",
"<",
"K",
">",
"keys",
")",
"{",
"return",
"valuesOfKeys",
"(",
"map",
",",
"keys",
".",
"iterator",
"(",
")",
")",
";",
"}"
]
| 从Map中获取指定键列表对应的值列表<br>
如果key在map中不存在或key对应值为null,则返回值列表对应位置的值也为null
@param <K> 键类型
@param <V> 值类型
@param map {@link Map}
@param keys 键列表
@return 值列表
@since 3.0.9 | [
"从Map中获取指定键列表对应的值列表<br",
">",
"如果key在map中不存在或key对应值为null,则返回值列表对应位置的值也为null"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java#L1995-L1997 |
alkacon/opencms-core | src/org/opencms/ui/dialogs/CmsPublishScheduledDialog.java | CmsPublishScheduledDialog.createTempProject | private CmsProject createTempProject(CmsObject adminCms, List<CmsResource> resources, Date date)
throws CmsException {
"""
Creates the temporary project.<p>
@param adminCms the admin cms context
@param resources the resources
@param date the publish date
@return the project
@throws CmsException in case writing the project fails
"""
CmsProject tmpProject;
String rootPath = resources.get(0).getRootPath();
if (resources.size() > 1) {
rootPath = CmsResource.getParentFolder(rootPath);
}
String projectName = computeProjectName(rootPath, date);
try {
// create the project
tmpProject = adminCms.createProject(
projectName,
"",
CmsRole.WORKPLACE_USER.getGroupName(),
CmsRole.PROJECT_MANAGER.getGroupName(),
CmsProject.PROJECT_TYPE_TEMPORARY);
} catch (CmsException e) {
String resName = CmsResource.getName(rootPath);
if (resName.length() > 64) {
resName = resName.substring(0, 64) + "...";
}
// use UUID to make sure the project name is still unique
projectName = computeProjectName(resName, date) + " [" + new CmsUUID() + "]";
// create the project
tmpProject = adminCms.createProject(
projectName,
"",
CmsRole.WORKPLACE_USER.getGroupName(),
CmsRole.PROJECT_MANAGER.getGroupName(),
CmsProject.PROJECT_TYPE_TEMPORARY);
}
// make the project invisible for all users
tmpProject.setHidden(true);
// write the project to the database
adminCms.writeProject(tmpProject);
return tmpProject;
} | java | private CmsProject createTempProject(CmsObject adminCms, List<CmsResource> resources, Date date)
throws CmsException {
CmsProject tmpProject;
String rootPath = resources.get(0).getRootPath();
if (resources.size() > 1) {
rootPath = CmsResource.getParentFolder(rootPath);
}
String projectName = computeProjectName(rootPath, date);
try {
// create the project
tmpProject = adminCms.createProject(
projectName,
"",
CmsRole.WORKPLACE_USER.getGroupName(),
CmsRole.PROJECT_MANAGER.getGroupName(),
CmsProject.PROJECT_TYPE_TEMPORARY);
} catch (CmsException e) {
String resName = CmsResource.getName(rootPath);
if (resName.length() > 64) {
resName = resName.substring(0, 64) + "...";
}
// use UUID to make sure the project name is still unique
projectName = computeProjectName(resName, date) + " [" + new CmsUUID() + "]";
// create the project
tmpProject = adminCms.createProject(
projectName,
"",
CmsRole.WORKPLACE_USER.getGroupName(),
CmsRole.PROJECT_MANAGER.getGroupName(),
CmsProject.PROJECT_TYPE_TEMPORARY);
}
// make the project invisible for all users
tmpProject.setHidden(true);
// write the project to the database
adminCms.writeProject(tmpProject);
return tmpProject;
} | [
"private",
"CmsProject",
"createTempProject",
"(",
"CmsObject",
"adminCms",
",",
"List",
"<",
"CmsResource",
">",
"resources",
",",
"Date",
"date",
")",
"throws",
"CmsException",
"{",
"CmsProject",
"tmpProject",
";",
"String",
"rootPath",
"=",
"resources",
".",
"get",
"(",
"0",
")",
".",
"getRootPath",
"(",
")",
";",
"if",
"(",
"resources",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"rootPath",
"=",
"CmsResource",
".",
"getParentFolder",
"(",
"rootPath",
")",
";",
"}",
"String",
"projectName",
"=",
"computeProjectName",
"(",
"rootPath",
",",
"date",
")",
";",
"try",
"{",
"// create the project",
"tmpProject",
"=",
"adminCms",
".",
"createProject",
"(",
"projectName",
",",
"\"\"",
",",
"CmsRole",
".",
"WORKPLACE_USER",
".",
"getGroupName",
"(",
")",
",",
"CmsRole",
".",
"PROJECT_MANAGER",
".",
"getGroupName",
"(",
")",
",",
"CmsProject",
".",
"PROJECT_TYPE_TEMPORARY",
")",
";",
"}",
"catch",
"(",
"CmsException",
"e",
")",
"{",
"String",
"resName",
"=",
"CmsResource",
".",
"getName",
"(",
"rootPath",
")",
";",
"if",
"(",
"resName",
".",
"length",
"(",
")",
">",
"64",
")",
"{",
"resName",
"=",
"resName",
".",
"substring",
"(",
"0",
",",
"64",
")",
"+",
"\"...\"",
";",
"}",
"// use UUID to make sure the project name is still unique",
"projectName",
"=",
"computeProjectName",
"(",
"resName",
",",
"date",
")",
"+",
"\" [\"",
"+",
"new",
"CmsUUID",
"(",
")",
"+",
"\"]\"",
";",
"// create the project",
"tmpProject",
"=",
"adminCms",
".",
"createProject",
"(",
"projectName",
",",
"\"\"",
",",
"CmsRole",
".",
"WORKPLACE_USER",
".",
"getGroupName",
"(",
")",
",",
"CmsRole",
".",
"PROJECT_MANAGER",
".",
"getGroupName",
"(",
")",
",",
"CmsProject",
".",
"PROJECT_TYPE_TEMPORARY",
")",
";",
"}",
"// make the project invisible for all users",
"tmpProject",
".",
"setHidden",
"(",
"true",
")",
";",
"// write the project to the database",
"adminCms",
".",
"writeProject",
"(",
"tmpProject",
")",
";",
"return",
"tmpProject",
";",
"}"
]
| Creates the temporary project.<p>
@param adminCms the admin cms context
@param resources the resources
@param date the publish date
@return the project
@throws CmsException in case writing the project fails | [
"Creates",
"the",
"temporary",
"project",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/CmsPublishScheduledDialog.java#L347-L386 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java | base_resource.delete_bulk_request | protected static base_responses delete_bulk_request(nitro_service service,base_resource resources[]) throws Exception {
"""
Use this method to perform a delete operation on netscaler resources.
@param service nitro_service object.
@param resources Nitro resources to be deleted on netscaler.
@param option options class object.
@return status of the performed operation.
@throws Exception Nitro exception is thrown.
"""
if (!service.isLogin())
service.login();
options option = new options();
option.set_action("rm");
String type = resources[0].get_object_type();
if (type.indexOf("_binding") > 0)
{
option.set_action("unbind");
}
String id = service.get_sessionid();
String onerror = service.get_onerror();
Boolean warning = service.get_warning();
String request = service.get_payload_formatter().resource_to_string(resources, id, option,warning, onerror);
base_responses result = post_bulk_data(service,request);
return result;
} | java | protected static base_responses delete_bulk_request(nitro_service service,base_resource resources[]) throws Exception
{
if (!service.isLogin())
service.login();
options option = new options();
option.set_action("rm");
String type = resources[0].get_object_type();
if (type.indexOf("_binding") > 0)
{
option.set_action("unbind");
}
String id = service.get_sessionid();
String onerror = service.get_onerror();
Boolean warning = service.get_warning();
String request = service.get_payload_formatter().resource_to_string(resources, id, option,warning, onerror);
base_responses result = post_bulk_data(service,request);
return result;
} | [
"protected",
"static",
"base_responses",
"delete_bulk_request",
"(",
"nitro_service",
"service",
",",
"base_resource",
"resources",
"[",
"]",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"service",
".",
"isLogin",
"(",
")",
")",
"service",
".",
"login",
"(",
")",
";",
"options",
"option",
"=",
"new",
"options",
"(",
")",
";",
"option",
".",
"set_action",
"(",
"\"rm\"",
")",
";",
"String",
"type",
"=",
"resources",
"[",
"0",
"]",
".",
"get_object_type",
"(",
")",
";",
"if",
"(",
"type",
".",
"indexOf",
"(",
"\"_binding\"",
")",
">",
"0",
")",
"{",
"option",
".",
"set_action",
"(",
"\"unbind\"",
")",
";",
"}",
"String",
"id",
"=",
"service",
".",
"get_sessionid",
"(",
")",
";",
"String",
"onerror",
"=",
"service",
".",
"get_onerror",
"(",
")",
";",
"Boolean",
"warning",
"=",
"service",
".",
"get_warning",
"(",
")",
";",
"String",
"request",
"=",
"service",
".",
"get_payload_formatter",
"(",
")",
".",
"resource_to_string",
"(",
"resources",
",",
"id",
",",
"option",
",",
"warning",
",",
"onerror",
")",
";",
"base_responses",
"result",
"=",
"post_bulk_data",
"(",
"service",
",",
"request",
")",
";",
"return",
"result",
";",
"}"
]
| Use this method to perform a delete operation on netscaler resources.
@param service nitro_service object.
@param resources Nitro resources to be deleted on netscaler.
@param option options class object.
@return status of the performed operation.
@throws Exception Nitro exception is thrown. | [
"Use",
"this",
"method",
"to",
"perform",
"a",
"delete",
"operation",
"on",
"netscaler",
"resources",
"."
]
| train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L552-L571 |
Red5/red5-io | src/main/java/org/red5/io/utils/IOUtils.java | IOUtils.writeMediumInt | public final static void writeMediumInt(ByteBuffer out, int value) {
"""
Writes medium integer
@param out
Output buffer
@param value
Integer to write
"""
out.put((byte) ((value >>> 16) & 0xff));
out.put((byte) ((value >>> 8) & 0xff));
out.put((byte) (value & 0xff));
} | java | public final static void writeMediumInt(ByteBuffer out, int value) {
out.put((byte) ((value >>> 16) & 0xff));
out.put((byte) ((value >>> 8) & 0xff));
out.put((byte) (value & 0xff));
} | [
"public",
"final",
"static",
"void",
"writeMediumInt",
"(",
"ByteBuffer",
"out",
",",
"int",
"value",
")",
"{",
"out",
".",
"put",
"(",
"(",
"byte",
")",
"(",
"(",
"value",
">>>",
"16",
")",
"&",
"0xff",
")",
")",
";",
"out",
".",
"put",
"(",
"(",
"byte",
")",
"(",
"(",
"value",
">>>",
"8",
")",
"&",
"0xff",
")",
")",
";",
"out",
".",
"put",
"(",
"(",
"byte",
")",
"(",
"value",
"&",
"0xff",
")",
")",
";",
"}"
]
| Writes medium integer
@param out
Output buffer
@param value
Integer to write | [
"Writes",
"medium",
"integer"
]
| train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/IOUtils.java#L75-L79 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.logf | public void logf(Level level, String format, Object param1) {
"""
Issue a formatted log message at the given log level.
@param level the level
@param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
@param param1 the sole parameter
"""
if (isEnabled(level)) {
doLogf(level, FQCN, format, new Object[] { param1 }, null);
}
} | java | public void logf(Level level, String format, Object param1) {
if (isEnabled(level)) {
doLogf(level, FQCN, format, new Object[] { param1 }, null);
}
} | [
"public",
"void",
"logf",
"(",
"Level",
"level",
",",
"String",
"format",
",",
"Object",
"param1",
")",
"{",
"if",
"(",
"isEnabled",
"(",
"level",
")",
")",
"{",
"doLogf",
"(",
"level",
",",
"FQCN",
",",
"format",
",",
"new",
"Object",
"[",
"]",
"{",
"param1",
"}",
",",
"null",
")",
";",
"}",
"}"
]
| Issue a formatted log message at the given log level.
@param level the level
@param format the format string as per {@link String#format(String, Object...)} or resource bundle key therefor
@param param1 the sole parameter | [
"Issue",
"a",
"formatted",
"log",
"message",
"at",
"the",
"given",
"log",
"level",
"."
]
| train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L2295-L2299 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Dispatching.java | Dispatching.curry | public static <T> Runnable curry(Consumer<T> consumer, T value) {
"""
Partial application of the first parameter to an consumer.
@param <T> the consumer parameter type
@param consumer the consumer to be curried
@param value the value to be curried
@return the curried runnable
"""
dbc.precondition(consumer != null, "cannot bind parameter of a null consumer");
return () -> consumer.accept(value);
} | java | public static <T> Runnable curry(Consumer<T> consumer, T value) {
dbc.precondition(consumer != null, "cannot bind parameter of a null consumer");
return () -> consumer.accept(value);
} | [
"public",
"static",
"<",
"T",
">",
"Runnable",
"curry",
"(",
"Consumer",
"<",
"T",
">",
"consumer",
",",
"T",
"value",
")",
"{",
"dbc",
".",
"precondition",
"(",
"consumer",
"!=",
"null",
",",
"\"cannot bind parameter of a null consumer\"",
")",
";",
"return",
"(",
")",
"->",
"consumer",
".",
"accept",
"(",
"value",
")",
";",
"}"
]
| Partial application of the first parameter to an consumer.
@param <T> the consumer parameter type
@param consumer the consumer to be curried
@param value the value to be curried
@return the curried runnable | [
"Partial",
"application",
"of",
"the",
"first",
"parameter",
"to",
"an",
"consumer",
"."
]
| train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L35-L38 |
alkacon/opencms-core | src/org/opencms/ade/upload/CmsUploadBean.java | CmsUploadBean.getNewResourceName | public static String getNewResourceName(CmsObject cms, String fileName, String folder) {
"""
Returns the VFS path for the given filename and folder.<p>
@param cms the cms object
@param fileName the filename to combine with the folder
@param folder the folder to combine with the filename
@return the VFS path for the given filename and folder
"""
String newResname = CmsResource.getName(fileName.replace('\\', '/'));
newResname = cms.getRequestContext().getFileTranslator().translateResource(newResname);
newResname = folder + newResname;
return newResname;
} | java | public static String getNewResourceName(CmsObject cms, String fileName, String folder) {
String newResname = CmsResource.getName(fileName.replace('\\', '/'));
newResname = cms.getRequestContext().getFileTranslator().translateResource(newResname);
newResname = folder + newResname;
return newResname;
} | [
"public",
"static",
"String",
"getNewResourceName",
"(",
"CmsObject",
"cms",
",",
"String",
"fileName",
",",
"String",
"folder",
")",
"{",
"String",
"newResname",
"=",
"CmsResource",
".",
"getName",
"(",
"fileName",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
")",
";",
"newResname",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getFileTranslator",
"(",
")",
".",
"translateResource",
"(",
"newResname",
")",
";",
"newResname",
"=",
"folder",
"+",
"newResname",
";",
"return",
"newResname",
";",
"}"
]
| Returns the VFS path for the given filename and folder.<p>
@param cms the cms object
@param fileName the filename to combine with the folder
@param folder the folder to combine with the filename
@return the VFS path for the given filename and folder | [
"Returns",
"the",
"VFS",
"path",
"for",
"the",
"given",
"filename",
"and",
"folder",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/upload/CmsUploadBean.java#L161-L167 |
samskivert/samskivert | src/main/java/com/samskivert/util/CountHashMap.java | CountHashMap.incrementCount | public int incrementCount (K key, int amount) {
"""
Increment the value associated with the specified key, return the new value.
"""
int[] val = get(key);
if (val == null) {
put(key, val = new int[1]);
}
val[0] += amount;
return val[0];
/* Alternate implementation, less hashing on the first increment but more garbage created
* every other time. (this whole method would be more optimal if this class were
* rewritten)
*
int[] newVal = new int[] { amount };
int[] oldVal = put(key, newVal);
if (oldVal != null) {
newVal[0] += oldVal[0];
return oldVal[0];
}
return 0;
*/
} | java | public int incrementCount (K key, int amount)
{
int[] val = get(key);
if (val == null) {
put(key, val = new int[1]);
}
val[0] += amount;
return val[0];
/* Alternate implementation, less hashing on the first increment but more garbage created
* every other time. (this whole method would be more optimal if this class were
* rewritten)
*
int[] newVal = new int[] { amount };
int[] oldVal = put(key, newVal);
if (oldVal != null) {
newVal[0] += oldVal[0];
return oldVal[0];
}
return 0;
*/
} | [
"public",
"int",
"incrementCount",
"(",
"K",
"key",
",",
"int",
"amount",
")",
"{",
"int",
"[",
"]",
"val",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"put",
"(",
"key",
",",
"val",
"=",
"new",
"int",
"[",
"1",
"]",
")",
";",
"}",
"val",
"[",
"0",
"]",
"+=",
"amount",
";",
"return",
"val",
"[",
"0",
"]",
";",
"/* Alternate implementation, less hashing on the first increment but more garbage created\n * every other time. (this whole method would be more optimal if this class were\n * rewritten)\n *\n int[] newVal = new int[] { amount };\n int[] oldVal = put(key, newVal);\n if (oldVal != null) {\n newVal[0] += oldVal[0];\n return oldVal[0];\n }\n return 0;\n */",
"}"
]
| Increment the value associated with the specified key, return the new value. | [
"Increment",
"the",
"value",
"associated",
"with",
"the",
"specified",
"key",
"return",
"the",
"new",
"value",
"."
]
| train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/CountHashMap.java#L42-L63 |
devnewton/jnuit | tablelayout/src/main/java/com/esotericsoftware/tablelayout/Value.java | Value.percentWidth | static public <C, T extends C> Value<C, T> percentWidth (Toolkit<C, T> toolkit, final float percent, final C widget) {
"""
Returns a value that is a percentage of the specified widget's width.
"""
return new Value<C, T>(toolkit) {
@Override
public float get (Cell<C, T> cell) {
return toolkit.getWidth(widget) * percent;
}
@Override
public float get (Object table) {
return toolkit.getWidth(widget) * percent;
}
};
} | java | static public <C, T extends C> Value<C, T> percentWidth (Toolkit<C, T> toolkit, final float percent, final C widget) {
return new Value<C, T>(toolkit) {
@Override
public float get (Cell<C, T> cell) {
return toolkit.getWidth(widget) * percent;
}
@Override
public float get (Object table) {
return toolkit.getWidth(widget) * percent;
}
};
} | [
"static",
"public",
"<",
"C",
",",
"T",
"extends",
"C",
">",
"Value",
"<",
"C",
",",
"T",
">",
"percentWidth",
"(",
"Toolkit",
"<",
"C",
",",
"T",
">",
"toolkit",
",",
"final",
"float",
"percent",
",",
"final",
"C",
"widget",
")",
"{",
"return",
"new",
"Value",
"<",
"C",
",",
"T",
">",
"(",
"toolkit",
")",
"{",
"@",
"Override",
"public",
"float",
"get",
"(",
"Cell",
"<",
"C",
",",
"T",
">",
"cell",
")",
"{",
"return",
"toolkit",
".",
"getWidth",
"(",
"widget",
")",
"*",
"percent",
";",
"}",
"@",
"Override",
"public",
"float",
"get",
"(",
"Object",
"table",
")",
"{",
"return",
"toolkit",
".",
"getWidth",
"(",
"widget",
")",
"*",
"percent",
";",
"}",
"}",
";",
"}"
]
| Returns a value that is a percentage of the specified widget's width. | [
"Returns",
"a",
"value",
"that",
"is",
"a",
"percentage",
"of",
"the",
"specified",
"widget",
"s",
"width",
"."
]
| train | https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/tablelayout/src/main/java/com/esotericsoftware/tablelayout/Value.java#L89-L101 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/BoxFactory.java | BoxFactory.createAnonymousElement | public Element createAnonymousElement(Document doc, String name, String display) {
"""
Creates a new DOM element that represents an anonymous box in a document.
@param doc the document
@param name the anonymous element name (generally arbitrary)
@param display the display style value for the block
@return the new element
"""
Element div = doc.createElement(name);
div.setAttribute("class", "Xanonymous");
div.setAttribute("style", "display:" + display);
return div;
} | java | public Element createAnonymousElement(Document doc, String name, String display)
{
Element div = doc.createElement(name);
div.setAttribute("class", "Xanonymous");
div.setAttribute("style", "display:" + display);
return div;
} | [
"public",
"Element",
"createAnonymousElement",
"(",
"Document",
"doc",
",",
"String",
"name",
",",
"String",
"display",
")",
"{",
"Element",
"div",
"=",
"doc",
".",
"createElement",
"(",
"name",
")",
";",
"div",
".",
"setAttribute",
"(",
"\"class\"",
",",
"\"Xanonymous\"",
")",
";",
"div",
".",
"setAttribute",
"(",
"\"style\"",
",",
"\"display:\"",
"+",
"display",
")",
";",
"return",
"div",
";",
"}"
]
| Creates a new DOM element that represents an anonymous box in a document.
@param doc the document
@param name the anonymous element name (generally arbitrary)
@param display the display style value for the block
@return the new element | [
"Creates",
"a",
"new",
"DOM",
"element",
"that",
"represents",
"an",
"anonymous",
"box",
"in",
"a",
"document",
"."
]
| train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/BoxFactory.java#L951-L957 |
liferay/com-liferay-commerce | commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java | CommerceWishListPersistenceImpl.findAll | @Override
public List<CommerceWishList> findAll(int start, int end) {
"""
Returns a range of all the commerce wish lists.
<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 CommerceWishListModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce wish lists
@param end the upper bound of the range of commerce wish lists (not inclusive)
@return the range of commerce wish lists
"""
return findAll(start, end, null);
} | java | @Override
public List<CommerceWishList> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceWishList",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
]
| Returns a range of all the commerce wish lists.
<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 CommerceWishListModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce wish lists
@param end the upper bound of the range of commerce wish lists (not inclusive)
@return the range of commerce wish lists | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"wish",
"lists",
"."
]
| train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java#L4930-L4933 |
buschmais/jqa-javaee6-plugin | src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/WebXmlScannerPlugin.java | WebXmlScannerPlugin.createFilter | private FilterDescriptor createFilter(FilterType filterType, Map<String, FilterDescriptor> filters, ScannerContext context) {
"""
Create a filter descriptor.
@param filterType
The XML filter type.
@param context
The scanner context.
@return The filter descriptor.
"""
Store store = context.getStore();
FilterDescriptor filterDescriptor = getOrCreateNamedDescriptor(FilterDescriptor.class, filterType.getFilterName().getValue(), filters, store);
setAsyncSupported(filterDescriptor, filterType.getAsyncSupported());
for (DescriptionType descriptionType : filterType.getDescription()) {
filterDescriptor.getDescriptions().add(XmlDescriptorHelper.createDescription(descriptionType, store));
}
for (DisplayNameType displayNameType : filterType.getDisplayName()) {
filterDescriptor.getDisplayNames().add(XmlDescriptorHelper.createDisplayName(displayNameType, store));
}
FullyQualifiedClassType filterClass = filterType.getFilterClass();
if (filterClass != null) {
TypeResolver typeResolver = context.peek(TypeResolver.class);
TypeCache.CachedType<TypeDescriptor> filterClassDescriptor = typeResolver.resolve(filterClass.getValue(), context);
filterDescriptor.setType(filterClassDescriptor.getTypeDescriptor());
}
for (IconType iconType : filterType.getIcon()) {
IconDescriptor iconDescriptor = XmlDescriptorHelper.createIcon(iconType, store);
filterDescriptor.getIcons().add(iconDescriptor);
}
for (ParamValueType paramValueType : filterType.getInitParam()) {
ParamValueDescriptor paramValueDescriptor = createParamValue(paramValueType, store);
filterDescriptor.getInitParams().add(paramValueDescriptor);
}
return filterDescriptor;
} | java | private FilterDescriptor createFilter(FilterType filterType, Map<String, FilterDescriptor> filters, ScannerContext context) {
Store store = context.getStore();
FilterDescriptor filterDescriptor = getOrCreateNamedDescriptor(FilterDescriptor.class, filterType.getFilterName().getValue(), filters, store);
setAsyncSupported(filterDescriptor, filterType.getAsyncSupported());
for (DescriptionType descriptionType : filterType.getDescription()) {
filterDescriptor.getDescriptions().add(XmlDescriptorHelper.createDescription(descriptionType, store));
}
for (DisplayNameType displayNameType : filterType.getDisplayName()) {
filterDescriptor.getDisplayNames().add(XmlDescriptorHelper.createDisplayName(displayNameType, store));
}
FullyQualifiedClassType filterClass = filterType.getFilterClass();
if (filterClass != null) {
TypeResolver typeResolver = context.peek(TypeResolver.class);
TypeCache.CachedType<TypeDescriptor> filterClassDescriptor = typeResolver.resolve(filterClass.getValue(), context);
filterDescriptor.setType(filterClassDescriptor.getTypeDescriptor());
}
for (IconType iconType : filterType.getIcon()) {
IconDescriptor iconDescriptor = XmlDescriptorHelper.createIcon(iconType, store);
filterDescriptor.getIcons().add(iconDescriptor);
}
for (ParamValueType paramValueType : filterType.getInitParam()) {
ParamValueDescriptor paramValueDescriptor = createParamValue(paramValueType, store);
filterDescriptor.getInitParams().add(paramValueDescriptor);
}
return filterDescriptor;
} | [
"private",
"FilterDescriptor",
"createFilter",
"(",
"FilterType",
"filterType",
",",
"Map",
"<",
"String",
",",
"FilterDescriptor",
">",
"filters",
",",
"ScannerContext",
"context",
")",
"{",
"Store",
"store",
"=",
"context",
".",
"getStore",
"(",
")",
";",
"FilterDescriptor",
"filterDescriptor",
"=",
"getOrCreateNamedDescriptor",
"(",
"FilterDescriptor",
".",
"class",
",",
"filterType",
".",
"getFilterName",
"(",
")",
".",
"getValue",
"(",
")",
",",
"filters",
",",
"store",
")",
";",
"setAsyncSupported",
"(",
"filterDescriptor",
",",
"filterType",
".",
"getAsyncSupported",
"(",
")",
")",
";",
"for",
"(",
"DescriptionType",
"descriptionType",
":",
"filterType",
".",
"getDescription",
"(",
")",
")",
"{",
"filterDescriptor",
".",
"getDescriptions",
"(",
")",
".",
"add",
"(",
"XmlDescriptorHelper",
".",
"createDescription",
"(",
"descriptionType",
",",
"store",
")",
")",
";",
"}",
"for",
"(",
"DisplayNameType",
"displayNameType",
":",
"filterType",
".",
"getDisplayName",
"(",
")",
")",
"{",
"filterDescriptor",
".",
"getDisplayNames",
"(",
")",
".",
"add",
"(",
"XmlDescriptorHelper",
".",
"createDisplayName",
"(",
"displayNameType",
",",
"store",
")",
")",
";",
"}",
"FullyQualifiedClassType",
"filterClass",
"=",
"filterType",
".",
"getFilterClass",
"(",
")",
";",
"if",
"(",
"filterClass",
"!=",
"null",
")",
"{",
"TypeResolver",
"typeResolver",
"=",
"context",
".",
"peek",
"(",
"TypeResolver",
".",
"class",
")",
";",
"TypeCache",
".",
"CachedType",
"<",
"TypeDescriptor",
">",
"filterClassDescriptor",
"=",
"typeResolver",
".",
"resolve",
"(",
"filterClass",
".",
"getValue",
"(",
")",
",",
"context",
")",
";",
"filterDescriptor",
".",
"setType",
"(",
"filterClassDescriptor",
".",
"getTypeDescriptor",
"(",
")",
")",
";",
"}",
"for",
"(",
"IconType",
"iconType",
":",
"filterType",
".",
"getIcon",
"(",
")",
")",
"{",
"IconDescriptor",
"iconDescriptor",
"=",
"XmlDescriptorHelper",
".",
"createIcon",
"(",
"iconType",
",",
"store",
")",
";",
"filterDescriptor",
".",
"getIcons",
"(",
")",
".",
"add",
"(",
"iconDescriptor",
")",
";",
"}",
"for",
"(",
"ParamValueType",
"paramValueType",
":",
"filterType",
".",
"getInitParam",
"(",
")",
")",
"{",
"ParamValueDescriptor",
"paramValueDescriptor",
"=",
"createParamValue",
"(",
"paramValueType",
",",
"store",
")",
";",
"filterDescriptor",
".",
"getInitParams",
"(",
")",
".",
"add",
"(",
"paramValueDescriptor",
")",
";",
"}",
"return",
"filterDescriptor",
";",
"}"
]
| Create a filter descriptor.
@param filterType
The XML filter type.
@param context
The scanner context.
@return The filter descriptor. | [
"Create",
"a",
"filter",
"descriptor",
"."
]
| train | https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/WebXmlScannerPlugin.java#L269-L294 |
apollographql/apollo-android | apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java | ResponseField.forInt | public static ResponseField forInt(String responseName, String fieldName, Map<String, Object> arguments,
boolean optional, List<Condition> conditions) {
"""
Factory method for creating a Field instance representing {@link Type#INT}.
@param responseName alias for the result of a field
@param fieldName name of the field in the GraphQL operation
@param arguments arguments to be passed along with the field
@param optional whether the arguments passed along are optional or required
@param conditions list of conditions for this field
@return Field instance representing {@link Type#INT}
"""
return new ResponseField(Type.INT, responseName, fieldName, arguments, optional, conditions);
} | java | public static ResponseField forInt(String responseName, String fieldName, Map<String, Object> arguments,
boolean optional, List<Condition> conditions) {
return new ResponseField(Type.INT, responseName, fieldName, arguments, optional, conditions);
} | [
"public",
"static",
"ResponseField",
"forInt",
"(",
"String",
"responseName",
",",
"String",
"fieldName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"arguments",
",",
"boolean",
"optional",
",",
"List",
"<",
"Condition",
">",
"conditions",
")",
"{",
"return",
"new",
"ResponseField",
"(",
"Type",
".",
"INT",
",",
"responseName",
",",
"fieldName",
",",
"arguments",
",",
"optional",
",",
"conditions",
")",
";",
"}"
]
| Factory method for creating a Field instance representing {@link Type#INT}.
@param responseName alias for the result of a field
@param fieldName name of the field in the GraphQL operation
@param arguments arguments to be passed along with the field
@param optional whether the arguments passed along are optional or required
@param conditions list of conditions for this field
@return Field instance representing {@link Type#INT} | [
"Factory",
"method",
"for",
"creating",
"a",
"Field",
"instance",
"representing",
"{",
"@link",
"Type#INT",
"}",
"."
]
| train | https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java#L55-L58 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.recoverDeletedKey | public KeyBundle recoverDeletedKey(String vaultBaseUrl, String keyName) {
"""
Recovers the deleted key to its latest version.
The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the deleted key.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the KeyBundle object if successful.
"""
return recoverDeletedKeyWithServiceResponseAsync(vaultBaseUrl, keyName).toBlocking().single().body();
} | java | public KeyBundle recoverDeletedKey(String vaultBaseUrl, String keyName) {
return recoverDeletedKeyWithServiceResponseAsync(vaultBaseUrl, keyName).toBlocking().single().body();
} | [
"public",
"KeyBundle",
"recoverDeletedKey",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
")",
"{",
"return",
"recoverDeletedKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Recovers the deleted key to its latest version.
The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the deleted key.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the KeyBundle object if successful. | [
"Recovers",
"the",
"deleted",
"key",
"to",
"its",
"latest",
"version",
".",
"The",
"Recover",
"Deleted",
"Key",
"operation",
"is",
"applicable",
"for",
"deleted",
"keys",
"in",
"soft",
"-",
"delete",
"enabled",
"vaults",
".",
"It",
"recovers",
"the",
"deleted",
"key",
"back",
"to",
"its",
"latest",
"version",
"under",
"/",
"keys",
".",
"An",
"attempt",
"to",
"recover",
"an",
"non",
"-",
"deleted",
"key",
"will",
"return",
"an",
"error",
".",
"Consider",
"this",
"the",
"inverse",
"of",
"the",
"delete",
"operation",
"on",
"soft",
"-",
"delete",
"enabled",
"vaults",
".",
"This",
"operation",
"requires",
"the",
"keys",
"/",
"recover",
"permission",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3233-L3235 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.