repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/GetInstance.java | GetInstance.getInstance | public static Instance getInstance(String type, Class<?> clazz,
String algorithm) throws NoSuchAlgorithmException {
// in the almost all cases, the first service will work
// avoid taking long path if so
ProviderList list = Providers.getProviderList();
Service firstService = list.getService(type, algorithm);
if (firstService == null) {
throw new NoSuchAlgorithmException
(algorithm + " " + type + " not available");
}
NoSuchAlgorithmException failure;
try {
return getInstance(firstService, clazz);
} catch (NoSuchAlgorithmException e) {
failure = e;
}
// if we cannot get the service from the preferred provider,
// fail over to the next
for (Service s : list.getServices(type, algorithm)) {
if (s == firstService) {
// do not retry initial failed service
continue;
}
try {
return getInstance(s, clazz);
} catch (NoSuchAlgorithmException e) {
failure = e;
}
}
throw failure;
} | java | public static Instance getInstance(String type, Class<?> clazz,
String algorithm) throws NoSuchAlgorithmException {
// in the almost all cases, the first service will work
// avoid taking long path if so
ProviderList list = Providers.getProviderList();
Service firstService = list.getService(type, algorithm);
if (firstService == null) {
throw new NoSuchAlgorithmException
(algorithm + " " + type + " not available");
}
NoSuchAlgorithmException failure;
try {
return getInstance(firstService, clazz);
} catch (NoSuchAlgorithmException e) {
failure = e;
}
// if we cannot get the service from the preferred provider,
// fail over to the next
for (Service s : list.getServices(type, algorithm)) {
if (s == firstService) {
// do not retry initial failed service
continue;
}
try {
return getInstance(s, clazz);
} catch (NoSuchAlgorithmException e) {
failure = e;
}
}
throw failure;
} | [
"public",
"static",
"Instance",
"getInstance",
"(",
"String",
"type",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"algorithm",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"// in the almost all cases, the first service will work",
"// avoid taking long path if s... | /*
For all the getInstance() methods below:
@param type the type of engine (e.g. MessageDigest)
@param clazz the Spi class that the implementation must subclass
(e.g. MessageDigestSpi.class) or null if no superclass check
is required
@param algorithm the name of the algorithm (or alias), e.g. MD5
@param provider the provider (String or Provider object)
@param param the parameter to pass to the Spi constructor
(for CertStores)
There are overloaded methods for all the permutations. | [
"/",
"*",
"For",
"all",
"the",
"getInstance",
"()",
"methods",
"below",
":",
"@param",
"type",
"the",
"type",
"of",
"engine",
"(",
"e",
".",
"g",
".",
"MessageDigest",
")",
"@param",
"clazz",
"the",
"Spi",
"class",
"that",
"the",
"implementation",
"must"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/GetInstance.java#L152-L182 |
wcm-io/wcm-io-wcm | ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/impl/servlets/TemplateFilterPageTreeProvider.java | TemplateFilterPageTreeProvider.searchNodesByTemplate | @SuppressWarnings("null")
private NodeIterator searchNodesByTemplate(String[] templates, String rootPath, SlingHttpServletRequest request) throws RepositoryException {
String queryString = "/jcr:root" + ISO9075.encodePath(rootPath) + "//*"
+ "[@cq:template='" + StringUtils.join(escapeXPathQueryExpressions(templates), "' or @cq:template='") + "']";
QueryManager queryManager = request.getResourceResolver().adaptTo(Session.class).getWorkspace().getQueryManager();
@SuppressWarnings("deprecation")
Query query = queryManager.createQuery(queryString, Query.XPATH);
QueryResult result = query.execute();
return result.getNodes();
} | java | @SuppressWarnings("null")
private NodeIterator searchNodesByTemplate(String[] templates, String rootPath, SlingHttpServletRequest request) throws RepositoryException {
String queryString = "/jcr:root" + ISO9075.encodePath(rootPath) + "//*"
+ "[@cq:template='" + StringUtils.join(escapeXPathQueryExpressions(templates), "' or @cq:template='") + "']";
QueryManager queryManager = request.getResourceResolver().adaptTo(Session.class).getWorkspace().getQueryManager();
@SuppressWarnings("deprecation")
Query query = queryManager.createQuery(queryString, Query.XPATH);
QueryResult result = query.execute();
return result.getNodes();
} | [
"@",
"SuppressWarnings",
"(",
"\"null\"",
")",
"private",
"NodeIterator",
"searchNodesByTemplate",
"(",
"String",
"[",
"]",
"templates",
",",
"String",
"rootPath",
",",
"SlingHttpServletRequest",
"request",
")",
"throws",
"RepositoryException",
"{",
"String",
"querySt... | Searches for page content nodes under the {@code pRootPath} with given
template It uses a XPATH query and return the node iterator of results.
@param templates
@param rootPath
@return results node iterator
@throws RepositoryException | [
"Searches",
"for",
"page",
"content",
"nodes",
"under",
"the",
"{",
"@code",
"pRootPath",
"}",
"with",
"given",
"template",
"It",
"uses",
"a",
"XPATH",
"query",
"and",
"return",
"the",
"node",
"iterator",
"of",
"results",
"."
] | train | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/impl/servlets/TemplateFilterPageTreeProvider.java#L128-L137 |
liferay/com-liferay-commerce | commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java | CommerceVirtualOrderItemPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommerceVirtualOrderItem commerceVirtualOrderItem : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceVirtualOrderItem);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommerceVirtualOrderItem commerceVirtualOrderItem : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceVirtualOrderItem);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CommerceVirtualOrderItem",
"commerceVirtualOrderItem",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS"... | Removes all the commerce virtual order items where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"commerce",
"virtual",
"order",
"items",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java#L1418-L1424 |
structurizr/java | structurizr-core/src/com/structurizr/model/Model.java | Model.addSoftwareSystem | @Nonnull
public SoftwareSystem addSoftwareSystem(@Nullable Location location, @Nonnull String name, @Nullable String description) {
if (getSoftwareSystemWithName(name) == null) {
SoftwareSystem softwareSystem = new SoftwareSystem();
softwareSystem.setLocation(location);
softwareSystem.setName(name);
softwareSystem.setDescription(description);
softwareSystems.add(softwareSystem);
softwareSystem.setId(idGenerator.generateId(softwareSystem));
addElementToInternalStructures(softwareSystem);
return softwareSystem;
} else {
throw new IllegalArgumentException("A software system named '" + name + "' already exists.");
}
} | java | @Nonnull
public SoftwareSystem addSoftwareSystem(@Nullable Location location, @Nonnull String name, @Nullable String description) {
if (getSoftwareSystemWithName(name) == null) {
SoftwareSystem softwareSystem = new SoftwareSystem();
softwareSystem.setLocation(location);
softwareSystem.setName(name);
softwareSystem.setDescription(description);
softwareSystems.add(softwareSystem);
softwareSystem.setId(idGenerator.generateId(softwareSystem));
addElementToInternalStructures(softwareSystem);
return softwareSystem;
} else {
throw new IllegalArgumentException("A software system named '" + name + "' already exists.");
}
} | [
"@",
"Nonnull",
"public",
"SoftwareSystem",
"addSoftwareSystem",
"(",
"@",
"Nullable",
"Location",
"location",
",",
"@",
"Nonnull",
"String",
"name",
",",
"@",
"Nullable",
"String",
"description",
")",
"{",
"if",
"(",
"getSoftwareSystemWithName",
"(",
"name",
")... | Creates a software system and adds it to the model.
@param location the location of the software system (e.g. internal, external, etc)
@param name the name of the software system
@param description a short description of the software system
@return the SoftwareSystem instance created and added to the model (or null)
@throws IllegalArgumentException if a software system with the same name already exists | [
"Creates",
"a",
"software",
"system",
"and",
"adds",
"it",
"to",
"the",
"model",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L68-L85 |
beanshell/beanshell | src/main/java/bsh/ExternalNameSpace.java | ExternalNameSpace.getVariableImpl | protected Variable getVariableImpl( String name, boolean recurse )
throws UtilEvalError
{
// check the external map for the variable name
Object value = externalMap.get( name );
if ( value == null && externalMap.containsKey( name ) )
value = Primitive.NULL;
Variable var;
if ( value == null )
{
// The var is not in external map and it should therefore not be
// found in local scope (it may have been removed via the map).
// Clear it prophalactically.
super.unsetVariable( name );
// Search parent for var if applicable.
var = super.getVariableImpl( name, recurse );
} else
{
// Var in external map may be found in local scope with type and
// modifier info.
Variable localVar = super.getVariableImpl( name, false );
// If not in local scope then it was added via the external map,
// we'll wrap it and pass it along. Else we'll use the one we
// found.
if ( localVar == null )
var = createVariable( name, null/*type*/, value, null/*mods*/ );
else
var = localVar;
}
return var;
} | java | protected Variable getVariableImpl( String name, boolean recurse )
throws UtilEvalError
{
// check the external map for the variable name
Object value = externalMap.get( name );
if ( value == null && externalMap.containsKey( name ) )
value = Primitive.NULL;
Variable var;
if ( value == null )
{
// The var is not in external map and it should therefore not be
// found in local scope (it may have been removed via the map).
// Clear it prophalactically.
super.unsetVariable( name );
// Search parent for var if applicable.
var = super.getVariableImpl( name, recurse );
} else
{
// Var in external map may be found in local scope with type and
// modifier info.
Variable localVar = super.getVariableImpl( name, false );
// If not in local scope then it was added via the external map,
// we'll wrap it and pass it along. Else we'll use the one we
// found.
if ( localVar == null )
var = createVariable( name, null/*type*/, value, null/*mods*/ );
else
var = localVar;
}
return var;
} | [
"protected",
"Variable",
"getVariableImpl",
"(",
"String",
"name",
",",
"boolean",
"recurse",
")",
"throws",
"UtilEvalError",
"{",
"// check the external map for the variable name",
"Object",
"value",
"=",
"externalMap",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",... | /*
Notes: This implementation of getVariableImpl handles the following
cases:
1) var in map not in local scope - var was added through map
2) var in map and in local scope - var was added through namespace
3) var not in map but in local scope - var was removed via map
4) var not in map and not in local scope - non-existent var
Note: It would seem that we could simply override getImportedVar()
in NameSpace, rather than this higher level method. However we need
more control here to change the import precedence and remove variables
if they are removed via the extenal map. | [
"/",
"*",
"Notes",
":",
"This",
"implementation",
"of",
"getVariableImpl",
"handles",
"the",
"following",
"cases",
":",
"1",
")",
"var",
"in",
"map",
"not",
"in",
"local",
"scope",
"-",
"var",
"was",
"added",
"through",
"map",
"2",
")",
"var",
"in",
"m... | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/ExternalNameSpace.java#L147-L182 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java | Packer.fillboth | public Packer fillboth(final double wtx, final double wty) {
gc.fill = GridBagConstraints.BOTH;
gc.weightx = wtx;
gc.weighty = wty;
setConstraints(comp, gc);
return this;
} | java | public Packer fillboth(final double wtx, final double wty) {
gc.fill = GridBagConstraints.BOTH;
gc.weightx = wtx;
gc.weighty = wty;
setConstraints(comp, gc);
return this;
} | [
"public",
"Packer",
"fillboth",
"(",
"final",
"double",
"wtx",
",",
"final",
"double",
"wty",
")",
"{",
"gc",
".",
"fill",
"=",
"GridBagConstraints",
".",
"BOTH",
";",
"gc",
".",
"weightx",
"=",
"wtx",
";",
"gc",
".",
"weighty",
"=",
"wty",
";",
"set... | Add fill=BOTH, weighty=1, weightx=1 to the constraints for the current
component. | [
"Add",
"fill",
"=",
"BOTH",
"weighty",
"=",
"1",
"weightx",
"=",
"1",
"to",
"the",
"constraints",
"for",
"the",
"current",
"component",
"."
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/Packer.java#L775-L781 |
google/closure-compiler | src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java | TypeTransformationParser.validConditionalExpression | private boolean validConditionalExpression(Node expr) {
// The expression must have four children:
// - The cond keyword
// - A boolean expression
// - A type transformation expression with the 'if' branch
// - A type transformation expression with the 'else' branch
if (!checkParameterCount(expr, Keywords.COND)) {
return false;
}
// Check for the validity of the boolean and the expressions
if (!validBooleanExpression(getCallArgument(expr, 0))) {
warnInvalidInside("conditional", expr);
return false;
}
if (!validTypeTransformationExpression(getCallArgument(expr, 1))) {
warnInvalidInside("conditional", expr);
return false;
}
if (!validTypeTransformationExpression(getCallArgument(expr, 2))) {
warnInvalidInside("conditional", expr);
return false;
}
return true;
} | java | private boolean validConditionalExpression(Node expr) {
// The expression must have four children:
// - The cond keyword
// - A boolean expression
// - A type transformation expression with the 'if' branch
// - A type transformation expression with the 'else' branch
if (!checkParameterCount(expr, Keywords.COND)) {
return false;
}
// Check for the validity of the boolean and the expressions
if (!validBooleanExpression(getCallArgument(expr, 0))) {
warnInvalidInside("conditional", expr);
return false;
}
if (!validTypeTransformationExpression(getCallArgument(expr, 1))) {
warnInvalidInside("conditional", expr);
return false;
}
if (!validTypeTransformationExpression(getCallArgument(expr, 2))) {
warnInvalidInside("conditional", expr);
return false;
}
return true;
} | [
"private",
"boolean",
"validConditionalExpression",
"(",
"Node",
"expr",
")",
"{",
"// The expression must have four children:",
"// - The cond keyword",
"// - A boolean expression",
"// - A type transformation expression with the 'if' branch",
"// - A type transformation expression with the... | A conditional type transformation expression must be of the
form cond(BoolExp, TTLExp, TTLExp) | [
"A",
"conditional",
"type",
"transformation",
"expression",
"must",
"be",
"of",
"the",
"form",
"cond",
"(",
"BoolExp",
"TTLExp",
"TTLExp",
")"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java#L605-L628 |
srikalyc/Sql4D | Sql4DCompiler/src/main/java/com/yahoo/sql4d/converter/druidGParser.java | druidGParser.anyValue | public final Object anyValue() throws RecognitionException {
Object obj = null;
Token a=null;
Token b=null;
try {
// druidG.g:266:2: (a= SINGLE_QUOTE_STRING |b= ( LONG | FLOAT ) )
int alt128=2;
int LA128_0 = input.LA(1);
if ( (LA128_0==SINGLE_QUOTE_STRING) ) {
alt128=1;
}
else if ( (LA128_0==FLOAT||LA128_0==LONG) ) {
alt128=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 128, 0, input);
throw nvae;
}
switch (alt128) {
case 1 :
// druidG.g:266:3: a= SINGLE_QUOTE_STRING
{
a=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_anyValue1912);
obj = unquote((a!=null?a.getText():null));
}
break;
case 2 :
// druidG.g:266:53: b= ( LONG | FLOAT )
{
b=input.LT(1);
if ( input.LA(1)==FLOAT||input.LA(1)==LONG ) {
input.consume();
state.errorRecovery=false;
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
throw mse;
}
obj = (b!=null?b.getText():null);
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
return obj;
} | java | public final Object anyValue() throws RecognitionException {
Object obj = null;
Token a=null;
Token b=null;
try {
// druidG.g:266:2: (a= SINGLE_QUOTE_STRING |b= ( LONG | FLOAT ) )
int alt128=2;
int LA128_0 = input.LA(1);
if ( (LA128_0==SINGLE_QUOTE_STRING) ) {
alt128=1;
}
else if ( (LA128_0==FLOAT||LA128_0==LONG) ) {
alt128=2;
}
else {
NoViableAltException nvae =
new NoViableAltException("", 128, 0, input);
throw nvae;
}
switch (alt128) {
case 1 :
// druidG.g:266:3: a= SINGLE_QUOTE_STRING
{
a=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_anyValue1912);
obj = unquote((a!=null?a.getText():null));
}
break;
case 2 :
// druidG.g:266:53: b= ( LONG | FLOAT )
{
b=input.LT(1);
if ( input.LA(1)==FLOAT||input.LA(1)==LONG ) {
input.consume();
state.errorRecovery=false;
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
throw mse;
}
obj = (b!=null?b.getText():null);
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
return obj;
} | [
"public",
"final",
"Object",
"anyValue",
"(",
")",
"throws",
"RecognitionException",
"{",
"Object",
"obj",
"=",
"null",
";",
"Token",
"a",
"=",
"null",
";",
"Token",
"b",
"=",
"null",
";",
"try",
"{",
"// druidG.g:266:2: (a= SINGLE_QUOTE_STRING |b= ( LONG | FLOAT ... | druidG.g:265:1: anyValue returns [Object obj] : (a= SINGLE_QUOTE_STRING |b= ( LONG | FLOAT ) ); | [
"druidG",
".",
"g",
":",
"265",
":",
"1",
":",
"anyValue",
"returns",
"[",
"Object",
"obj",
"]",
":",
"(",
"a",
"=",
"SINGLE_QUOTE_STRING",
"|b",
"=",
"(",
"LONG",
"|",
"FLOAT",
")",
")",
";"
] | train | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/Sql4DCompiler/src/main/java/com/yahoo/sql4d/converter/druidGParser.java#L3545-L3603 |
coursera/courier | android/generator/src/main/java/org/coursera/courier/android/JavaSyntax.java | JavaSyntax.toOptionalType | public String toOptionalType(ClassTemplateSpec spec, boolean optional) {
return toType(
spec,
optional ? Optionality.REQUIRED_FIELDS_MAY_BE_ABSENT : androidProperties.optionality);
} | java | public String toOptionalType(ClassTemplateSpec spec, boolean optional) {
return toType(
spec,
optional ? Optionality.REQUIRED_FIELDS_MAY_BE_ABSENT : androidProperties.optionality);
} | [
"public",
"String",
"toOptionalType",
"(",
"ClassTemplateSpec",
"spec",
",",
"boolean",
"optional",
")",
"{",
"return",
"toType",
"(",
"spec",
",",
"optional",
"?",
"Optionality",
".",
"REQUIRED_FIELDS_MAY_BE_ABSENT",
":",
"androidProperties",
".",
"optionality",
")... | Returns the Java type of an optional field for the given {@link ClassTemplateSpec} as a
Java source code string.
If the field is optional it is always represented as a
{@link AndroidProperties.Optionality#REQUIRED_FIELDS_MAY_BE_ABSENT} type else it is
represented using the {@link AndroidProperties.Optionality} for this instance.
@param spec to get a Java type name for.
@param optional indicates if the type is optional or not.
@return a Java source code string identifying the given type. | [
"Returns",
"the",
"Java",
"type",
"of",
"an",
"optional",
"field",
"for",
"the",
"given",
"{",
"@link",
"ClassTemplateSpec",
"}",
"as",
"a",
"Java",
"source",
"code",
"string",
"."
] | train | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/android/generator/src/main/java/org/coursera/courier/android/JavaSyntax.java#L117-L121 |
HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.hexcolorInternal | protected LexicalUnit hexcolorInternal(final LexicalUnit prev, final Token t) {
// Step past the hash at the beginning
final int i = 1;
int r = 0;
int g = 0;
int b = 0;
final int len = t.image.length() - 1;
try {
if (len == 3) {
r = Integer.parseInt(t.image.substring(i + 0, i + 1), 16);
g = Integer.parseInt(t.image.substring(i + 1, i + 2), 16);
b = Integer.parseInt(t.image.substring(i + 2, i + 3), 16);
r = (r << 4) | r;
g = (g << 4) | g;
b = (b << 4) | b;
}
else if (len == 6) {
r = Integer.parseInt(t.image.substring(i + 0, i + 2), 16);
g = Integer.parseInt(t.image.substring(i + 2, i + 4), 16);
b = Integer.parseInt(t.image.substring(i + 4, i + 6), 16);
}
else {
final String pattern = getParserMessage("invalidColor");
throw new CSSParseException(MessageFormat.format(
pattern, new Object[] {t}),
getInputSource().getURI(), t.beginLine,
t.beginColumn);
}
// Turn into an "rgb()"
final LexicalUnit lr = LexicalUnitImpl.createNumber(null, r);
final LexicalUnit lc1 = LexicalUnitImpl.createComma(lr);
final LexicalUnit lg = LexicalUnitImpl.createNumber(lc1, g);
final LexicalUnit lc2 = LexicalUnitImpl.createComma(lg);
LexicalUnitImpl.createNumber(lc2, b);
return LexicalUnitImpl.createRgbColor(prev, lr);
}
catch (final NumberFormatException ex) {
final String pattern = getParserMessage("invalidColor");
throw new CSSParseException(MessageFormat.format(
pattern, new Object[] {t}),
getInputSource().getURI(), t.beginLine,
t.beginColumn, ex);
}
} | java | protected LexicalUnit hexcolorInternal(final LexicalUnit prev, final Token t) {
// Step past the hash at the beginning
final int i = 1;
int r = 0;
int g = 0;
int b = 0;
final int len = t.image.length() - 1;
try {
if (len == 3) {
r = Integer.parseInt(t.image.substring(i + 0, i + 1), 16);
g = Integer.parseInt(t.image.substring(i + 1, i + 2), 16);
b = Integer.parseInt(t.image.substring(i + 2, i + 3), 16);
r = (r << 4) | r;
g = (g << 4) | g;
b = (b << 4) | b;
}
else if (len == 6) {
r = Integer.parseInt(t.image.substring(i + 0, i + 2), 16);
g = Integer.parseInt(t.image.substring(i + 2, i + 4), 16);
b = Integer.parseInt(t.image.substring(i + 4, i + 6), 16);
}
else {
final String pattern = getParserMessage("invalidColor");
throw new CSSParseException(MessageFormat.format(
pattern, new Object[] {t}),
getInputSource().getURI(), t.beginLine,
t.beginColumn);
}
// Turn into an "rgb()"
final LexicalUnit lr = LexicalUnitImpl.createNumber(null, r);
final LexicalUnit lc1 = LexicalUnitImpl.createComma(lr);
final LexicalUnit lg = LexicalUnitImpl.createNumber(lc1, g);
final LexicalUnit lc2 = LexicalUnitImpl.createComma(lg);
LexicalUnitImpl.createNumber(lc2, b);
return LexicalUnitImpl.createRgbColor(prev, lr);
}
catch (final NumberFormatException ex) {
final String pattern = getParserMessage("invalidColor");
throw new CSSParseException(MessageFormat.format(
pattern, new Object[] {t}),
getInputSource().getURI(), t.beginLine,
t.beginColumn, ex);
}
} | [
"protected",
"LexicalUnit",
"hexcolorInternal",
"(",
"final",
"LexicalUnit",
"prev",
",",
"final",
"Token",
"t",
")",
"{",
"// Step past the hash at the beginning",
"final",
"int",
"i",
"=",
"1",
";",
"int",
"r",
"=",
"0",
";",
"int",
"g",
"=",
"0",
";",
"... | Processes a hexadecimal color definition.
@param prev the previous lexical unit
@param t the token
@return a new lexical unit | [
"Processes",
"a",
"hexadecimal",
"color",
"definition",
"."
] | train | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L698-L743 |
banq/jdonframework | src/main/java/com/jdon/container/annotation/type/ModelConsumerLoader.java | ModelConsumerLoader.loadMehtodAnnotations | public void loadMehtodAnnotations(Class cclass, ContainerWrapper containerWrapper) {
try {
for (Method method : ClassUtil.getAllDecaredMethods(cclass)) {
if (method.isAnnotationPresent(OnCommand.class)) {
addConsumerMethod(method, cclass, containerWrapper);
}
}
} catch (Exception e) {
e.printStackTrace();
}
} | java | public void loadMehtodAnnotations(Class cclass, ContainerWrapper containerWrapper) {
try {
for (Method method : ClassUtil.getAllDecaredMethods(cclass)) {
if (method.isAnnotationPresent(OnCommand.class)) {
addConsumerMethod(method, cclass, containerWrapper);
}
}
} catch (Exception e) {
e.printStackTrace();
}
} | [
"public",
"void",
"loadMehtodAnnotations",
"(",
"Class",
"cclass",
",",
"ContainerWrapper",
"containerWrapper",
")",
"{",
"try",
"{",
"for",
"(",
"Method",
"method",
":",
"ClassUtil",
".",
"getAllDecaredMethods",
"(",
"cclass",
")",
")",
"{",
"if",
"(",
"metho... | add the class to consumers annotated with @OnCommand
@param cclass
@param containerWrapper | [
"add",
"the",
"class",
"to",
"consumers",
"annotated",
"with",
"@OnCommand"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/container/annotation/type/ModelConsumerLoader.java#L58-L70 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java | WebhooksInner.listEventsWithServiceResponseAsync | public Observable<ServiceResponse<Page<EventInner>>> listEventsWithServiceResponseAsync(final String resourceGroupName, final String registryName, final String webhookName) {
return listEventsSinglePageAsync(resourceGroupName, registryName, webhookName)
.concatMap(new Func1<ServiceResponse<Page<EventInner>>, Observable<ServiceResponse<Page<EventInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EventInner>>> call(ServiceResponse<Page<EventInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listEventsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<EventInner>>> listEventsWithServiceResponseAsync(final String resourceGroupName, final String registryName, final String webhookName) {
return listEventsSinglePageAsync(resourceGroupName, registryName, webhookName)
.concatMap(new Func1<ServiceResponse<Page<EventInner>>, Observable<ServiceResponse<Page<EventInner>>>>() {
@Override
public Observable<ServiceResponse<Page<EventInner>>> call(ServiceResponse<Page<EventInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listEventsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"EventInner",
">",
">",
">",
"listEventsWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"registryName",
",",
"final",
"String",
"webhookName",
")",
"{",... | Lists recent events for the specified webhook.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param webhookName The name of the webhook.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<EventInner> object | [
"Lists",
"recent",
"events",
"for",
"the",
"specified",
"webhook",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L1116-L1128 |
OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.uidToLong | public static long uidToLong(final byte[] uid, final short uid_length) {
if (uid.length != uid_length) {
throw new IllegalArgumentException("UID was " + uid.length
+ " bytes long but expected to be " + uid_length);
}
final byte[] uid_raw = new byte[8];
System.arraycopy(uid, 0, uid_raw, 8 - uid_length, uid_length);
return Bytes.getLong(uid_raw);
} | java | public static long uidToLong(final byte[] uid, final short uid_length) {
if (uid.length != uid_length) {
throw new IllegalArgumentException("UID was " + uid.length
+ " bytes long but expected to be " + uid_length);
}
final byte[] uid_raw = new byte[8];
System.arraycopy(uid, 0, uid_raw, 8 - uid_length, uid_length);
return Bytes.getLong(uid_raw);
} | [
"public",
"static",
"long",
"uidToLong",
"(",
"final",
"byte",
"[",
"]",
"uid",
",",
"final",
"short",
"uid_length",
")",
"{",
"if",
"(",
"uid",
".",
"length",
"!=",
"uid_length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"UID was \"",
"... | Converts a UID to an integer value. The array must be the same length as
uid_length or an exception will be thrown.
@param uid The byte array to convert
@param uid_length Length the array SHOULD be according to the UID config
@return The UID converted to an integer
@throws IllegalArgumentException if the length of the byte array does not
match the uid_length value
@since 2.1 | [
"Converts",
"a",
"UID",
"to",
"an",
"integer",
"value",
".",
"The",
"array",
"must",
"be",
"the",
"same",
"length",
"as",
"uid_length",
"or",
"an",
"exception",
"will",
"be",
"thrown",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1457-L1466 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/style/StyleHelper.java | StyleHelper.delayedStyle | public static void delayedStyle(Chunk c, String tag, Collection<? extends Advanced> stylers, EventHelper eventHelper, Image img) {
// add to pagehelper and set generic tag
eventHelper.addDelayedStyler(tag, stylers, c, img);
c.setGenericTag(tag);
} | java | public static void delayedStyle(Chunk c, String tag, Collection<? extends Advanced> stylers, EventHelper eventHelper, Image img) {
// add to pagehelper and set generic tag
eventHelper.addDelayedStyler(tag, stylers, c, img);
c.setGenericTag(tag);
} | [
"public",
"static",
"void",
"delayedStyle",
"(",
"Chunk",
"c",
",",
"String",
"tag",
",",
"Collection",
"<",
"?",
"extends",
"Advanced",
">",
"stylers",
",",
"EventHelper",
"eventHelper",
",",
"Image",
"img",
")",
"{",
"// add to pagehelper and set generic tag",
... | register advanced stylers with the EventHelper to do the styling later
@param c
@param tag
@param stylers
@param eventHelper
@param img the value of rect
@see EventHelper#onGenericTag(com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document,
com.itextpdf.text.Rectangle, java.lang.String) | [
"register",
"advanced",
"stylers",
"with",
"the",
"EventHelper",
"to",
"do",
"the",
"styling",
"later"
] | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/StyleHelper.java#L229-L233 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/utils/WidgetUtil.java | WidgetUtil.getWidgetBanner | public static String getWidgetBanner(String guildId, BannerType type)
{
Checks.notNull(guildId, "GuildId");
Checks.notNull(type, "BannerType");
return String.format(WIDGET_PNG, guildId, type.name().toLowerCase());
} | java | public static String getWidgetBanner(String guildId, BannerType type)
{
Checks.notNull(guildId, "GuildId");
Checks.notNull(type, "BannerType");
return String.format(WIDGET_PNG, guildId, type.name().toLowerCase());
} | [
"public",
"static",
"String",
"getWidgetBanner",
"(",
"String",
"guildId",
",",
"BannerType",
"type",
")",
"{",
"Checks",
".",
"notNull",
"(",
"guildId",
",",
"\"GuildId\"",
")",
";",
"Checks",
".",
"notNull",
"(",
"type",
",",
"\"BannerType\"",
")",
";",
... | Gets the banner image for the specified guild of the specified type.
<br>This banner will only be available if the guild in question has the
Widget enabled. Additionally, this method can be used independently of
being on the guild in question.
@param guildId
the guild ID
@param type
The type (visual style) of the banner
@return A String containing the URL of the banner image | [
"Gets",
"the",
"banner",
"image",
"for",
"the",
"specified",
"guild",
"of",
"the",
"specified",
"type",
".",
"<br",
">",
"This",
"banner",
"will",
"only",
"be",
"available",
"if",
"the",
"guild",
"in",
"question",
"has",
"the",
"Widget",
"enabled",
".",
... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/WidgetUtil.java#L83-L88 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Graphics.java | Graphics.fillRoundRect | public void fillRoundRect(float x, float y, float width, float height,
int cornerRadius, int segs) {
if (cornerRadius < 0)
throw new IllegalArgumentException("corner radius must be > 0");
if (cornerRadius == 0) {
fillRect(x, y, width, height);
return;
}
int mr = (int) Math.min(width, height) / 2;
// make sure that w & h are larger than 2*cornerRadius
if (cornerRadius > mr) {
cornerRadius = mr;
}
float d = cornerRadius * 2;
fillRect(x + cornerRadius, y, width - d, cornerRadius);
fillRect(x, y + cornerRadius, cornerRadius, height - d);
fillRect(x + width - cornerRadius, y + cornerRadius, cornerRadius,
height - d);
fillRect(x + cornerRadius, y + height - cornerRadius, width - d,
cornerRadius);
fillRect(x + cornerRadius, y + cornerRadius, width - d, height - d);
// bottom right - 0, 90
fillArc(x + width - d, y + height - d, d, d, segs, 0, 90);
// bottom left - 90, 180
fillArc(x, y + height - d, d, d, segs, 90, 180);
// top right - 270, 360
fillArc(x + width - d, y, d, d, segs, 270, 360);
// top left - 180, 270
fillArc(x, y, d, d, segs, 180, 270);
} | java | public void fillRoundRect(float x, float y, float width, float height,
int cornerRadius, int segs) {
if (cornerRadius < 0)
throw new IllegalArgumentException("corner radius must be > 0");
if (cornerRadius == 0) {
fillRect(x, y, width, height);
return;
}
int mr = (int) Math.min(width, height) / 2;
// make sure that w & h are larger than 2*cornerRadius
if (cornerRadius > mr) {
cornerRadius = mr;
}
float d = cornerRadius * 2;
fillRect(x + cornerRadius, y, width - d, cornerRadius);
fillRect(x, y + cornerRadius, cornerRadius, height - d);
fillRect(x + width - cornerRadius, y + cornerRadius, cornerRadius,
height - d);
fillRect(x + cornerRadius, y + height - cornerRadius, width - d,
cornerRadius);
fillRect(x + cornerRadius, y + cornerRadius, width - d, height - d);
// bottom right - 0, 90
fillArc(x + width - d, y + height - d, d, d, segs, 0, 90);
// bottom left - 90, 180
fillArc(x, y + height - d, d, d, segs, 90, 180);
// top right - 270, 360
fillArc(x + width - d, y, d, d, segs, 270, 360);
// top left - 180, 270
fillArc(x, y, d, d, segs, 180, 270);
} | [
"public",
"void",
"fillRoundRect",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"width",
",",
"float",
"height",
",",
"int",
"cornerRadius",
",",
"int",
"segs",
")",
"{",
"if",
"(",
"cornerRadius",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentEx... | Fill a rounded rectangle
@param x
The x coordinate of the top left corner of the rectangle
@param y
The y coordinate of the top left corner of the rectangle
@param width
The width of the rectangle
@param height
The height of the rectangle
@param cornerRadius
The radius of the rounded edges on the corners
@param segs
The number of segments to make the corners out of | [
"Fill",
"a",
"rounded",
"rectangle"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1255-L1288 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/windows/WindowsJNIFaxClientSpi.java | WindowsJNIFaxClientSpi.submitFaxJobImpl | @Override
protected void submitFaxJobImpl(FaxJob faxJob)
{
//get fax job values
String targetAddress=faxJob.getTargetAddress();
String targetName=faxJob.getTargetName();
if(targetName==null)
{
targetName="";
}
String senderName=faxJob.getSenderName();
if(senderName==null)
{
senderName="";
}
File file=faxJob.getFile();
String filePath=null;
try
{
filePath=file.getCanonicalPath();
}
catch(Exception exception)
{
throw new FaxException("Unable to extract canonical path from file: "+file,exception);
}
String documentName=faxJob.getProperty(WindowsFaxClientSpi.FaxJobExtendedPropertyConstants.DOCUMENT_NAME_PROPERTY_KEY.toString(), "");
//invoke fax action
int faxJobIDInt=this.winSubmitFaxJob(this.faxServerName,targetAddress,targetName,senderName,filePath,documentName);
//validate fax job ID
WindowsFaxClientSpiHelper.validateFaxJobID(faxJobIDInt);
//set fax job ID
String faxJobID=String.valueOf(faxJobIDInt);
faxJob.setID(faxJobID);
} | java | @Override
protected void submitFaxJobImpl(FaxJob faxJob)
{
//get fax job values
String targetAddress=faxJob.getTargetAddress();
String targetName=faxJob.getTargetName();
if(targetName==null)
{
targetName="";
}
String senderName=faxJob.getSenderName();
if(senderName==null)
{
senderName="";
}
File file=faxJob.getFile();
String filePath=null;
try
{
filePath=file.getCanonicalPath();
}
catch(Exception exception)
{
throw new FaxException("Unable to extract canonical path from file: "+file,exception);
}
String documentName=faxJob.getProperty(WindowsFaxClientSpi.FaxJobExtendedPropertyConstants.DOCUMENT_NAME_PROPERTY_KEY.toString(), "");
//invoke fax action
int faxJobIDInt=this.winSubmitFaxJob(this.faxServerName,targetAddress,targetName,senderName,filePath,documentName);
//validate fax job ID
WindowsFaxClientSpiHelper.validateFaxJobID(faxJobIDInt);
//set fax job ID
String faxJobID=String.valueOf(faxJobIDInt);
faxJob.setID(faxJobID);
} | [
"@",
"Override",
"protected",
"void",
"submitFaxJobImpl",
"(",
"FaxJob",
"faxJob",
")",
"{",
"//get fax job values",
"String",
"targetAddress",
"=",
"faxJob",
".",
"getTargetAddress",
"(",
")",
";",
"String",
"targetName",
"=",
"faxJob",
".",
"getTargetName",
"(",... | This function will submit a new fax job.<br>
The fax job ID may be populated by this method in the provided
fax job object.
@param faxJob
The fax job object containing the needed information | [
"This",
"function",
"will",
"submit",
"a",
"new",
"fax",
"job",
".",
"<br",
">",
"The",
"fax",
"job",
"ID",
"may",
"be",
"populated",
"by",
"this",
"method",
"in",
"the",
"provided",
"fax",
"job",
"object",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/windows/WindowsJNIFaxClientSpi.java#L136-L172 |
JOML-CI/JOML | src/org/joml/Quaternionf.java | Quaternionf.lookAlong | public Quaternionf lookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ) {
return lookAlong(dirX, dirY, dirZ, upX, upY, upZ, this);
} | java | public Quaternionf lookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ) {
return lookAlong(dirX, dirY, dirZ, upX, upY, upZ, this);
} | [
"public",
"Quaternionf",
"lookAlong",
"(",
"float",
"dirX",
",",
"float",
"dirY",
",",
"float",
"dirZ",
",",
"float",
"upX",
",",
"float",
"upY",
",",
"float",
"upZ",
")",
"{",
"return",
"lookAlong",
"(",
"dirX",
",",
"dirY",
",",
"dirZ",
",",
"upX",
... | Apply a rotation to this quaternion that maps the given direction to the positive Z axis.
<p>
Because there are multiple possibilities for such a rotation, this method will choose the one that ensures the given up direction to remain
parallel to the plane spanned by the <code>up</code> and <code>dir</code> vectors.
<p>
If <code>Q</code> is <code>this</code> quaternion and <code>R</code> the quaternion representing the
specified rotation, then the new quaternion will be <code>Q * R</code>. So when transforming a
vector <code>v</code> with the new quaternion by using <code>Q * R * v</code>, the
rotation added by this method will be applied first!
<p>
Reference: <a href="http://answers.unity3d.com/questions/467614/what-is-the-source-code-of-quaternionlookrotation.html">http://answers.unity3d.com</a>
@see #lookAlong(float, float, float, float, float, float, Quaternionf)
@param dirX
the x-coordinate of the direction to look along
@param dirY
the y-coordinate of the direction to look along
@param dirZ
the z-coordinate of the direction to look along
@param upX
the x-coordinate of the up vector
@param upY
the y-coordinate of the up vector
@param upZ
the z-coordinate of the up vector
@return this | [
"Apply",
"a",
"rotation",
"to",
"this",
"quaternion",
"that",
"maps",
"the",
"given",
"direction",
"to",
"the",
"positive",
"Z",
"axis",
".",
"<p",
">",
"Because",
"there",
"are",
"multiple",
"possibilities",
"for",
"such",
"a",
"rotation",
"this",
"method",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaternionf.java#L2131-L2133 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/support/pagefactory/AjaxElementLocator.java | AjaxElementLocator.findElements | @Override
public List<WebElement> findElements() {
SlowLoadingElementList list = new SlowLoadingElementList(clock, timeOutInSeconds);
try {
return list.get().getElements();
} catch (NoSuchElementError e) {
return new ArrayList<>();
}
} | java | @Override
public List<WebElement> findElements() {
SlowLoadingElementList list = new SlowLoadingElementList(clock, timeOutInSeconds);
try {
return list.get().getElements();
} catch (NoSuchElementError e) {
return new ArrayList<>();
}
} | [
"@",
"Override",
"public",
"List",
"<",
"WebElement",
">",
"findElements",
"(",
")",
"{",
"SlowLoadingElementList",
"list",
"=",
"new",
"SlowLoadingElementList",
"(",
"clock",
",",
"timeOutInSeconds",
")",
";",
"try",
"{",
"return",
"list",
".",
"get",
"(",
... | {@inheritDoc}
Will poll the interface on a regular basis until at least one element is present. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/support/pagefactory/AjaxElementLocator.java#L108-L116 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java | TransliteratorIDParser.specsToID | private static SingleID specsToID(Specs specs, int dir) {
String canonID = "";
String basicID = "";
String basicPrefix = "";
if (specs != null) {
StringBuilder buf = new StringBuilder();
if (dir == FORWARD) {
if (specs.sawSource) {
buf.append(specs.source).append(TARGET_SEP);
} else {
basicPrefix = specs.source + TARGET_SEP;
}
buf.append(specs.target);
} else {
buf.append(specs.target).append(TARGET_SEP).append(specs.source);
}
if (specs.variant != null) {
buf.append(VARIANT_SEP).append(specs.variant);
}
basicID = basicPrefix + buf.toString();
if (specs.filter != null) {
buf.insert(0, specs.filter);
}
canonID = buf.toString();
}
return new SingleID(canonID, basicID);
} | java | private static SingleID specsToID(Specs specs, int dir) {
String canonID = "";
String basicID = "";
String basicPrefix = "";
if (specs != null) {
StringBuilder buf = new StringBuilder();
if (dir == FORWARD) {
if (specs.sawSource) {
buf.append(specs.source).append(TARGET_SEP);
} else {
basicPrefix = specs.source + TARGET_SEP;
}
buf.append(specs.target);
} else {
buf.append(specs.target).append(TARGET_SEP).append(specs.source);
}
if (specs.variant != null) {
buf.append(VARIANT_SEP).append(specs.variant);
}
basicID = basicPrefix + buf.toString();
if (specs.filter != null) {
buf.insert(0, specs.filter);
}
canonID = buf.toString();
}
return new SingleID(canonID, basicID);
} | [
"private",
"static",
"SingleID",
"specsToID",
"(",
"Specs",
"specs",
",",
"int",
"dir",
")",
"{",
"String",
"canonID",
"=",
"\"\"",
";",
"String",
"basicID",
"=",
"\"\"",
";",
"String",
"basicPrefix",
"=",
"\"\"",
";",
"if",
"(",
"specs",
"!=",
"null",
... | Givens a Spec object, convert it to a SingleID object. The
Spec object is a more unprocessed parse result. The SingleID
object contains information about canonical and basic IDs.
@return a SingleID; never returns null. Returned object always
has 'filter' field of null. | [
"Givens",
"a",
"Spec",
"object",
"convert",
"it",
"to",
"a",
"SingleID",
"object",
".",
"The",
"Spec",
"object",
"is",
"a",
"more",
"unprocessed",
"parse",
"result",
".",
"The",
"SingleID",
"object",
"contains",
"information",
"about",
"canonical",
"and",
"b... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorIDParser.java#L701-L727 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/client/ProviderInfo.java | ProviderInfo.setDynamicAttr | public ProviderInfo setDynamicAttr(String dynamicAttrKey, Object dynamicAttrValue) {
if (dynamicAttrValue == null) {
dynamicAttrs.remove(dynamicAttrKey);
} else {
dynamicAttrs.put(dynamicAttrKey, dynamicAttrValue);
}
return this;
} | java | public ProviderInfo setDynamicAttr(String dynamicAttrKey, Object dynamicAttrValue) {
if (dynamicAttrValue == null) {
dynamicAttrs.remove(dynamicAttrKey);
} else {
dynamicAttrs.put(dynamicAttrKey, dynamicAttrValue);
}
return this;
} | [
"public",
"ProviderInfo",
"setDynamicAttr",
"(",
"String",
"dynamicAttrKey",
",",
"Object",
"dynamicAttrValue",
")",
"{",
"if",
"(",
"dynamicAttrValue",
"==",
"null",
")",
"{",
"dynamicAttrs",
".",
"remove",
"(",
"dynamicAttrKey",
")",
";",
"}",
"else",
"{",
"... | Sets dynamic attribute.
@param dynamicAttrKey the dynamic attribute key
@param dynamicAttrValue the dynamic attribute value
@return the dynamic attribute | [
"Sets",
"dynamic",
"attribute",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/client/ProviderInfo.java#L482-L489 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_instance_group_groupId_GET | public OvhInstanceGroup project_serviceName_instance_group_groupId_GET(String serviceName, String groupId, String region) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/group/{groupId}";
StringBuilder sb = path(qPath, serviceName, groupId);
query(sb, "region", region);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhInstanceGroup.class);
} | java | public OvhInstanceGroup project_serviceName_instance_group_groupId_GET(String serviceName, String groupId, String region) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/group/{groupId}";
StringBuilder sb = path(qPath, serviceName, groupId);
query(sb, "region", region);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhInstanceGroup.class);
} | [
"public",
"OvhInstanceGroup",
"project_serviceName_instance_group_groupId_GET",
"(",
"String",
"serviceName",
",",
"String",
"groupId",
",",
"String",
"region",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/instance/group/{groupId}\"... | Get all groups
REST: GET /cloud/project/{serviceName}/instance/group/{groupId}
@param groupId [required] Instance group id
@param region [required] Instance region
@param serviceName [required] Project id | [
"Get",
"all",
"groups"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2166-L2172 |
RestComm/sip-servlets | containers/sip-servlets-as10/src/main/java/org/mobicents/servlet/sip/undertow/SipStandardService.java | SipStandardService.findSipConnector | private SipProtocolHandler findSipConnector(String ipAddress, int port, String transport) {
SipConnector connectorToRemove = null;
for (SipProtocolHandler protocolHandler : connectors) {
if (protocolHandler.getIpAddress().equals(ipAddress) && protocolHandler.getPort() == port
&& protocolHandler.getSignalingTransport().equalsIgnoreCase(transport)) {
connectorToRemove = protocolHandler.getSipConnector();
return protocolHandler;
}
}
return null;
} | java | private SipProtocolHandler findSipConnector(String ipAddress, int port, String transport) {
SipConnector connectorToRemove = null;
for (SipProtocolHandler protocolHandler : connectors) {
if (protocolHandler.getIpAddress().equals(ipAddress) && protocolHandler.getPort() == port
&& protocolHandler.getSignalingTransport().equalsIgnoreCase(transport)) {
connectorToRemove = protocolHandler.getSipConnector();
return protocolHandler;
}
}
return null;
} | [
"private",
"SipProtocolHandler",
"findSipConnector",
"(",
"String",
"ipAddress",
",",
"int",
"port",
",",
"String",
"transport",
")",
"{",
"SipConnector",
"connectorToRemove",
"=",
"null",
";",
"for",
"(",
"SipProtocolHandler",
"protocolHandler",
":",
"connectors",
... | Find a sip Connector by it's ip address, port and transport
@param ipAddress ip address of the connector to find
@param port port of the connector to find
@param transport transport of the connector to find
@return the found sip connector or null if noting found | [
"Find",
"a",
"sip",
"Connector",
"by",
"it",
"s",
"ip",
"address",
"port",
"and",
"transport"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/sip-servlets-as10/src/main/java/org/mobicents/servlet/sip/undertow/SipStandardService.java#L735-L745 |
jhalterman/lyra | src/main/java/net/jodah/lyra/internal/RecurringPolicy.java | RecurringPolicy.withBackoff | @SuppressWarnings("unchecked")
public T withBackoff(Duration interval, Duration maxInterval, int intervalMultiplier) {
Assert.notNull(interval, "interval");
Assert.notNull(maxInterval, "maxInterval");
Assert.isTrue(interval.length > 0, "The interval must be greater than 0");
Assert.isTrue(interval.toNanoseconds() < maxInterval.toNanoseconds(),
"The interval must be less than the maxInterval");
Assert.isTrue(intervalMultiplier > 1, "The intervalMultiplier must be greater than 1");
this.interval = interval;
this.maxInterval = maxInterval;
this.intervalMultiplier = intervalMultiplier;
return (T) this;
} | java | @SuppressWarnings("unchecked")
public T withBackoff(Duration interval, Duration maxInterval, int intervalMultiplier) {
Assert.notNull(interval, "interval");
Assert.notNull(maxInterval, "maxInterval");
Assert.isTrue(interval.length > 0, "The interval must be greater than 0");
Assert.isTrue(interval.toNanoseconds() < maxInterval.toNanoseconds(),
"The interval must be less than the maxInterval");
Assert.isTrue(intervalMultiplier > 1, "The intervalMultiplier must be greater than 1");
this.interval = interval;
this.maxInterval = maxInterval;
this.intervalMultiplier = intervalMultiplier;
return (T) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"withBackoff",
"(",
"Duration",
"interval",
",",
"Duration",
"maxInterval",
",",
"int",
"intervalMultiplier",
")",
"{",
"Assert",
".",
"notNull",
"(",
"interval",
",",
"\"interval\"",
")",
";",
... | Sets the {@code interval} to pause for between attempts, exponentially backing of to the
{@code maxInterval} multiplying successive intervals by the {@code intervalMultiplier}.
@throws NullPointerException if {@code interval} or {@code maxInterval} are null
@throws IllegalArgumentException if {@code interval} is <= 0, {@code interval} is >=
{@code maxInterval} or the {@code intervalMultiplier} is <= 1 | [
"Sets",
"the",
"{",
"@code",
"interval",
"}",
"to",
"pause",
"for",
"between",
"attempts",
"exponentially",
"backing",
"of",
"to",
"the",
"{",
"@code",
"maxInterval",
"}",
"multiplying",
"successive",
"intervals",
"by",
"the",
"{",
"@code",
"intervalMultiplier",... | train | https://github.com/jhalterman/lyra/blob/ce347a69357fef1b34e92d92a4f9e68792d81255/src/main/java/net/jodah/lyra/internal/RecurringPolicy.java#L101-L113 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java | SubWriterHolderWriter.addIndexComment | protected void addIndexComment(Element member, Content contentTree) {
List<? extends DocTree> tags = utils.getFirstSentenceTrees(member);
addIndexComment(member, tags, contentTree);
} | java | protected void addIndexComment(Element member, Content contentTree) {
List<? extends DocTree> tags = utils.getFirstSentenceTrees(member);
addIndexComment(member, tags, contentTree);
} | [
"protected",
"void",
"addIndexComment",
"(",
"Element",
"member",
",",
"Content",
"contentTree",
")",
"{",
"List",
"<",
"?",
"extends",
"DocTree",
">",
"tags",
"=",
"utils",
".",
"getFirstSentenceTrees",
"(",
"member",
")",
";",
"addIndexComment",
"(",
"member... | Add the index comment.
@param member the member being documented
@param contentTree the content tree to which the comment will be added | [
"Add",
"the",
"index",
"comment",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java#L173-L176 |
b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optEnum | public <E extends Enum<E>> E optEnum(Class<E> clazz, int index) {
return this.optEnum(clazz, index, null);
} | java | public <E extends Enum<E>> E optEnum(Class<E> clazz, int index) {
return this.optEnum(clazz, index, null);
} | [
"public",
"<",
"E",
"extends",
"Enum",
"<",
"E",
">",
">",
"E",
"optEnum",
"(",
"Class",
"<",
"E",
">",
"clazz",
",",
"int",
"index",
")",
"{",
"return",
"this",
".",
"optEnum",
"(",
"clazz",
",",
"index",
",",
"null",
")",
";",
"}"
] | Get the enum value associated with a key.
@param <E>
Enum Type
@param clazz
The type of enum to retrieve.
@param index
The index must be between 0 and length() - 1.
@return The enum value at the index location or null if not found | [
"Get",
"the",
"enum",
"value",
"associated",
"with",
"a",
"key",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L660-L662 |
haraldk/TwelveMonkeys | imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java | QuickDrawContext.frameRoundRect | public void frameRoundRect(final Rectangle2D pRectangle, int pArcW, int pArcH) {
frameShape(toRoundRect(pRectangle, pArcW, pArcH));
} | java | public void frameRoundRect(final Rectangle2D pRectangle, int pArcW, int pArcH) {
frameShape(toRoundRect(pRectangle, pArcW, pArcH));
} | [
"public",
"void",
"frameRoundRect",
"(",
"final",
"Rectangle2D",
"pRectangle",
",",
"int",
"pArcW",
",",
"int",
"pArcH",
")",
"{",
"frameShape",
"(",
"toRoundRect",
"(",
"pRectangle",
",",
"pArcW",
",",
"pArcH",
")",
")",
";",
"}"
] | FrameRoundRect(r,int,int) // outline round rect with the size, pattern, and pattern mode of
the graphics pen.
@param pRectangle the rectangle to frame
@param pArcW width of the oval defining the rounded corner.
@param pArcH height of the oval defining the rounded corner. | [
"FrameRoundRect",
"(",
"r",
"int",
"int",
")",
"//",
"outline",
"round",
"rect",
"with",
"the",
"size",
"pattern",
"and",
"pattern",
"mode",
"of",
"the",
"graphics",
"pen",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/QuickDrawContext.java#L594-L596 |
hypercube1024/firefly | firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java | ScriptUtils.executeSqlScript | public static void executeSqlScript(Connection connection, Resource resource) throws ScriptException {
executeSqlScript(connection, new EncodedResource(resource));
} | java | public static void executeSqlScript(Connection connection, Resource resource) throws ScriptException {
executeSqlScript(connection, new EncodedResource(resource));
} | [
"public",
"static",
"void",
"executeSqlScript",
"(",
"Connection",
"connection",
",",
"Resource",
"resource",
")",
"throws",
"ScriptException",
"{",
"executeSqlScript",
"(",
"connection",
",",
"new",
"EncodedResource",
"(",
"resource",
")",
")",
";",
"}"
] | Execute the given SQL script using default settings for statement
separators, comment delimiters, and exception handling flags.
<p>
Statement separators and comments will be removed before executing
individual statements within the supplied script.
<p>
<strong>Warning</strong>: this method does <em>not</em> release the
provided {@link Connection}.
@param connection the JDBC connection to use to execute the script; already
configured and ready to use
@param resource the resource to load the SQL script from; encoded with the
current platform's default encoding
@throws ScriptException if an error occurred while executing the SQL script
@see #executeSqlScript(Connection, EncodedResource, boolean, boolean,
String, String, String, String)
@see #DEFAULT_STATEMENT_SEPARATOR
@see #DEFAULT_COMMENT_PREFIX
@see #DEFAULT_BLOCK_COMMENT_START_DELIMITER
@see #DEFAULT_BLOCK_COMMENT_END_DELIMITER | [
"Execute",
"the",
"given",
"SQL",
"script",
"using",
"default",
"settings",
"for",
"statement",
"separators",
"comment",
"delimiters",
"and",
"exception",
"handling",
"flags",
".",
"<p",
">",
"Statement",
"separators",
"and",
"comments",
"will",
"be",
"removed",
... | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java#L371-L373 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java | MapMessage.with | @SuppressWarnings("unchecked")
public M with(final String key, final String value) {
put(key, value);
return (M) this;
} | java | @SuppressWarnings("unchecked")
public M with(final String key, final String value) {
put(key, value);
return (M) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"M",
"with",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"(",
"M",
")",
"this",
";",
"}"
] | Adds an item to the data Map in fluent style.
@param key The name of the data item.
@param value The value of the data item.
@return {@code this} | [
"Adds",
"an",
"item",
"to",
"the",
"data",
"Map",
"in",
"fluent",
"style",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java#L665-L669 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/action/ActionableHelper.java | ActionableHelper.deleteFilePathOnExit | public static void deleteFilePathOnExit(FilePath workspace, String path) throws IOException, InterruptedException {
FilePath filePath = new FilePath(workspace, path);
deleteFilePathOnExit(filePath);
} | java | public static void deleteFilePathOnExit(FilePath workspace, String path) throws IOException, InterruptedException {
FilePath filePath = new FilePath(workspace, path);
deleteFilePathOnExit(filePath);
} | [
"public",
"static",
"void",
"deleteFilePathOnExit",
"(",
"FilePath",
"workspace",
",",
"String",
"path",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"FilePath",
"filePath",
"=",
"new",
"FilePath",
"(",
"workspace",
",",
"path",
")",
";",
"del... | Deletes a FilePath file on exit.
@param workspace The build workspace.
@param path The path in the workspace.
@throws IOException In case of a missing file. | [
"Deletes",
"a",
"FilePath",
"file",
"on",
"exit",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/action/ActionableHelper.java#L295-L298 |
apache/fluo | modules/core/src/main/java/org/apache/fluo/core/impl/TxInfo.java | TxInfo.getTransactionInfo | public static TxInfo getTransactionInfo(Environment env, Bytes prow, Column pcol, long startTs) {
// TODO ensure primary is visible
IteratorSetting is = new IteratorSetting(10, RollbackCheckIterator.class);
RollbackCheckIterator.setLocktime(is, startTs);
Entry<Key, Value> entry = ColumnUtil.checkColumn(env, is, prow, pcol);
TxInfo txInfo = new TxInfo();
if (entry == null) {
txInfo.status = TxStatus.UNKNOWN;
return txInfo;
}
ColumnType colType = ColumnType.from(entry.getKey());
long ts = entry.getKey().getTimestamp() & ColumnConstants.TIMESTAMP_MASK;
switch (colType) {
case LOCK: {
if (ts == startTs) {
txInfo.status = TxStatus.LOCKED;
txInfo.lockValue = entry.getValue().get();
} else {
txInfo.status = TxStatus.UNKNOWN; // locked by another tx
}
break;
}
case DEL_LOCK: {
DelLockValue dlv = new DelLockValue(entry.getValue().get());
if (ts != startTs) {
// expect this to always be false, must be a bug in the iterator
throw new IllegalStateException(prow + " " + pcol + " (" + ts + " != " + startTs + ") ");
}
if (dlv.isRollback()) {
txInfo.status = TxStatus.ROLLED_BACK;
} else {
txInfo.status = TxStatus.COMMITTED;
txInfo.commitTs = dlv.getCommitTimestamp();
}
break;
}
case WRITE: {
long timePtr = WriteValue.getTimestamp(entry.getValue().get());
if (timePtr != startTs) {
// expect this to always be false, must be a bug in the iterator
throw new IllegalStateException(
prow + " " + pcol + " (" + timePtr + " != " + startTs + ") ");
}
txInfo.status = TxStatus.COMMITTED;
txInfo.commitTs = ts;
break;
}
default:
throw new IllegalStateException("unexpected col type returned " + colType);
}
return txInfo;
} | java | public static TxInfo getTransactionInfo(Environment env, Bytes prow, Column pcol, long startTs) {
// TODO ensure primary is visible
IteratorSetting is = new IteratorSetting(10, RollbackCheckIterator.class);
RollbackCheckIterator.setLocktime(is, startTs);
Entry<Key, Value> entry = ColumnUtil.checkColumn(env, is, prow, pcol);
TxInfo txInfo = new TxInfo();
if (entry == null) {
txInfo.status = TxStatus.UNKNOWN;
return txInfo;
}
ColumnType colType = ColumnType.from(entry.getKey());
long ts = entry.getKey().getTimestamp() & ColumnConstants.TIMESTAMP_MASK;
switch (colType) {
case LOCK: {
if (ts == startTs) {
txInfo.status = TxStatus.LOCKED;
txInfo.lockValue = entry.getValue().get();
} else {
txInfo.status = TxStatus.UNKNOWN; // locked by another tx
}
break;
}
case DEL_LOCK: {
DelLockValue dlv = new DelLockValue(entry.getValue().get());
if (ts != startTs) {
// expect this to always be false, must be a bug in the iterator
throw new IllegalStateException(prow + " " + pcol + " (" + ts + " != " + startTs + ") ");
}
if (dlv.isRollback()) {
txInfo.status = TxStatus.ROLLED_BACK;
} else {
txInfo.status = TxStatus.COMMITTED;
txInfo.commitTs = dlv.getCommitTimestamp();
}
break;
}
case WRITE: {
long timePtr = WriteValue.getTimestamp(entry.getValue().get());
if (timePtr != startTs) {
// expect this to always be false, must be a bug in the iterator
throw new IllegalStateException(
prow + " " + pcol + " (" + timePtr + " != " + startTs + ") ");
}
txInfo.status = TxStatus.COMMITTED;
txInfo.commitTs = ts;
break;
}
default:
throw new IllegalStateException("unexpected col type returned " + colType);
}
return txInfo;
} | [
"public",
"static",
"TxInfo",
"getTransactionInfo",
"(",
"Environment",
"env",
",",
"Bytes",
"prow",
",",
"Column",
"pcol",
",",
"long",
"startTs",
")",
"{",
"// TODO ensure primary is visible",
"IteratorSetting",
"is",
"=",
"new",
"IteratorSetting",
"(",
"10",
",... | determine the what state a transaction is in by inspecting the primary column | [
"determine",
"the",
"what",
"state",
"a",
"transaction",
"is",
"in",
"by",
"inspecting",
"the",
"primary",
"column"
] | train | https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/core/src/main/java/org/apache/fluo/core/impl/TxInfo.java#L40-L102 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaGraphicsMapResources | public static int cudaGraphicsMapResources(int count, cudaGraphicsResource resources[], cudaStream_t stream)
{
return checkResult(cudaGraphicsMapResourcesNative(count, resources, stream));
} | java | public static int cudaGraphicsMapResources(int count, cudaGraphicsResource resources[], cudaStream_t stream)
{
return checkResult(cudaGraphicsMapResourcesNative(count, resources, stream));
} | [
"public",
"static",
"int",
"cudaGraphicsMapResources",
"(",
"int",
"count",
",",
"cudaGraphicsResource",
"resources",
"[",
"]",
",",
"cudaStream_t",
"stream",
")",
"{",
"return",
"checkResult",
"(",
"cudaGraphicsMapResourcesNative",
"(",
"count",
",",
"resources",
"... | Map graphics resources for access by CUDA.
<pre>
cudaError_t cudaGraphicsMapResources (
int count,
cudaGraphicsResource_t* resources,
cudaStream_t stream = 0 )
</pre>
<div>
<p>Map graphics resources for access by
CUDA. Maps the <tt>count</tt> graphics resources in <tt>resources</tt>
for access by CUDA.
</p>
<p>The resources in <tt>resources</tt>
may be accessed by CUDA until they are unmapped. The graphics API from
which <tt>resources</tt> were registered should not access any
resources while they are mapped by CUDA. If an application does so,
the results are
undefined.
</p>
<p>This function provides the synchronization
guarantee that any graphics calls issued before cudaGraphicsMapResources()
will complete before any subsequent CUDA work issued in <tt>stream</tt>
begins.
</p>
<p>If <tt>resources</tt> contains any
duplicate entries then cudaErrorInvalidResourceHandle is returned. If
any of <tt>resources</tt> are presently mapped for access by CUDA then
cudaErrorUnknown is returned.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param count Number of resources to map
@param resources Resources to map for CUDA
@param stream Stream for synchronization
@return cudaSuccess, cudaErrorInvalidResourceHandle, cudaErrorUnknown
@see JCuda#cudaGraphicsResourceGetMappedPointer
@see JCuda#cudaGraphicsSubResourceGetMappedArray
@see JCuda#cudaGraphicsUnmapResources | [
"Map",
"graphics",
"resources",
"for",
"access",
"by",
"CUDA",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L11507-L11510 |
CODAIT/stocator | src/main/java/com/ibm/stocator/fs/cos/COSUtils.java | COSUtils.translateException | @SuppressWarnings("ThrowableInstanceNeverThrown")
public static IOException translateException(String operation, String path,
AmazonClientException exception) {
String message = String.format("%s%s: %s", operation, path != null ? (" on "
+ path) : "", exception);
if (!(exception instanceof AmazonServiceException)) {
if (containsInterruptedException(exception)) {
return (IOException) new InterruptedIOException(message).initCause(exception);
}
return new COSClientIOException(message, exception);
} else {
IOException ioe;
AmazonServiceException ase = (AmazonServiceException) exception;
// this exception is non-null if the service exception is an COS one
AmazonS3Exception s3Exception = ase instanceof AmazonS3Exception ? (AmazonS3Exception) ase
: null;
int status = ase.getStatusCode();
switch (status) {
case 301:
if (s3Exception != null) {
if (s3Exception.getAdditionalDetails() != null
&& s3Exception.getAdditionalDetails().containsKey(ENDPOINT_KEY)) {
message = String.format(
"Received permanent redirect response to "
+ "endpoint %s. This likely indicates that the COS endpoint "
+ "configured in %s does not match the region containing "
+ "the bucket.",
s3Exception.getAdditionalDetails().get(ENDPOINT_KEY), ENDPOINT_URL);
}
ioe = new COSIOException(message, s3Exception);
} else {
ioe = new COSServiceIOException(message, ase);
}
break;
// permissions
case 401:
case 403:
ioe = new AccessDeniedException(path, null, message);
ioe.initCause(ase);
break;
// the object isn't there
case 404:
case 410:
ioe = new FileNotFoundException(message);
ioe.initCause(ase);
break;
// out of range. This may happen if an object is overwritten with
// a shorter one while it is being read.
case 416:
ioe = new EOFException(message);
break;
default:
// no specific exit code. Choose an IOE subclass based on the class
// of the caught exception
ioe = s3Exception != null ? new COSIOException(message, s3Exception)
: new COSServiceIOException(message, ase);
break;
}
return ioe;
}
} | java | @SuppressWarnings("ThrowableInstanceNeverThrown")
public static IOException translateException(String operation, String path,
AmazonClientException exception) {
String message = String.format("%s%s: %s", operation, path != null ? (" on "
+ path) : "", exception);
if (!(exception instanceof AmazonServiceException)) {
if (containsInterruptedException(exception)) {
return (IOException) new InterruptedIOException(message).initCause(exception);
}
return new COSClientIOException(message, exception);
} else {
IOException ioe;
AmazonServiceException ase = (AmazonServiceException) exception;
// this exception is non-null if the service exception is an COS one
AmazonS3Exception s3Exception = ase instanceof AmazonS3Exception ? (AmazonS3Exception) ase
: null;
int status = ase.getStatusCode();
switch (status) {
case 301:
if (s3Exception != null) {
if (s3Exception.getAdditionalDetails() != null
&& s3Exception.getAdditionalDetails().containsKey(ENDPOINT_KEY)) {
message = String.format(
"Received permanent redirect response to "
+ "endpoint %s. This likely indicates that the COS endpoint "
+ "configured in %s does not match the region containing "
+ "the bucket.",
s3Exception.getAdditionalDetails().get(ENDPOINT_KEY), ENDPOINT_URL);
}
ioe = new COSIOException(message, s3Exception);
} else {
ioe = new COSServiceIOException(message, ase);
}
break;
// permissions
case 401:
case 403:
ioe = new AccessDeniedException(path, null, message);
ioe.initCause(ase);
break;
// the object isn't there
case 404:
case 410:
ioe = new FileNotFoundException(message);
ioe.initCause(ase);
break;
// out of range. This may happen if an object is overwritten with
// a shorter one while it is being read.
case 416:
ioe = new EOFException(message);
break;
default:
// no specific exit code. Choose an IOE subclass based on the class
// of the caught exception
ioe = s3Exception != null ? new COSIOException(message, s3Exception)
: new COSServiceIOException(message, ase);
break;
}
return ioe;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"ThrowableInstanceNeverThrown\"",
")",
"public",
"static",
"IOException",
"translateException",
"(",
"String",
"operation",
",",
"String",
"path",
",",
"AmazonClientException",
"exception",
")",
"{",
"String",
"message",
"=",
"String",
... | Translate an exception raised in an operation into an IOException. The
specific type of IOException depends on the class of
{@link AmazonClientException} passed in, and any status codes included in
the operation. That is: HTTP error codes are examined and can be used to
build a more specific response.
@param operation operation
@param path path operated on (may be null)
@param exception amazon exception raised
@return an IOE which wraps the caught exception | [
"Translate",
"an",
"exception",
"raised",
"in",
"an",
"operation",
"into",
"an",
"IOException",
".",
"The",
"specific",
"type",
"of",
"IOException",
"depends",
"on",
"the",
"class",
"of",
"{",
"@link",
"AmazonClientException",
"}",
"passed",
"in",
"and",
"any"... | train | https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSUtils.java#L89-L154 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.checkStatusAsync | public Observable<DataMigrationServiceStatusResponseInner> checkStatusAsync(String groupName, String serviceName) {
return checkStatusWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<DataMigrationServiceStatusResponseInner>, DataMigrationServiceStatusResponseInner>() {
@Override
public DataMigrationServiceStatusResponseInner call(ServiceResponse<DataMigrationServiceStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<DataMigrationServiceStatusResponseInner> checkStatusAsync(String groupName, String serviceName) {
return checkStatusWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<DataMigrationServiceStatusResponseInner>, DataMigrationServiceStatusResponseInner>() {
@Override
public DataMigrationServiceStatusResponseInner call(ServiceResponse<DataMigrationServiceStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataMigrationServiceStatusResponseInner",
">",
"checkStatusAsync",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
")",
"{",
"return",
"checkStatusWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
")",
".",
"map",
"... | Check service health status.
The services resource is the top-level resource that represents the Data Migration Service. This action performs a health check and returns the status of the service and virtual machine size.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataMigrationServiceStatusResponseInner object | [
"Check",
"service",
"health",
"status",
".",
"The",
"services",
"resource",
"is",
"the",
"top",
"-",
"level",
"resource",
"that",
"represents",
"the",
"Data",
"Migration",
"Service",
".",
"This",
"action",
"performs",
"a",
"health",
"check",
"and",
"returns",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L967-L974 |
mgm-tp/jfunk | jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/data/FormData.java | FormData.getFormEntry | public FormEntry getFormEntry(final String entryKey, final int index) {
return getFormEntry(entryKey + JFunkConstants.INDEXED_KEY_SEPARATOR + index);
} | java | public FormEntry getFormEntry(final String entryKey, final int index) {
return getFormEntry(entryKey + JFunkConstants.INDEXED_KEY_SEPARATOR + index);
} | [
"public",
"FormEntry",
"getFormEntry",
"(",
"final",
"String",
"entryKey",
",",
"final",
"int",
"index",
")",
"{",
"return",
"getFormEntry",
"(",
"entryKey",
"+",
"JFunkConstants",
".",
"INDEXED_KEY_SEPARATOR",
"+",
"index",
")",
";",
"}"
] | Returns the FormEntry for the given entryKey and index. This is the same as calling
getFormEntry(entryKey+index)
@see #getFormEntry(String) | [
"Returns",
"the",
"FormEntry",
"for",
"the",
"given",
"entryKey",
"and",
"index",
".",
"This",
"is",
"the",
"same",
"as",
"calling",
"getFormEntry",
"(",
"entryKey",
"+",
"index",
")"
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/data/FormData.java#L209-L211 |
graknlabs/grakn | server/src/graql/gremlin/sets/EquivalentFragmentSets.java | EquivalentFragmentSets.neq | public static EquivalentFragmentSet neq(VarProperty varProperty, Variable varA, Variable varB) {
return new AutoValue_NeqFragmentSet(varProperty, varA, varB);
} | java | public static EquivalentFragmentSet neq(VarProperty varProperty, Variable varA, Variable varB) {
return new AutoValue_NeqFragmentSet(varProperty, varA, varB);
} | [
"public",
"static",
"EquivalentFragmentSet",
"neq",
"(",
"VarProperty",
"varProperty",
",",
"Variable",
"varA",
",",
"Variable",
"varB",
")",
"{",
"return",
"new",
"AutoValue_NeqFragmentSet",
"(",
"varProperty",
",",
"varA",
",",
"varB",
")",
";",
"}"
] | An {@link EquivalentFragmentSet} that indicates a variable is not equal to another variable. | [
"An",
"{"
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/sets/EquivalentFragmentSets.java#L121-L123 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_vlan_vlanId_GET | public OvhVlan serviceName_vlan_vlanId_GET(String serviceName, Long vlanId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/vlan/{vlanId}";
StringBuilder sb = path(qPath, serviceName, vlanId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhVlan.class);
} | java | public OvhVlan serviceName_vlan_vlanId_GET(String serviceName, Long vlanId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/vlan/{vlanId}";
StringBuilder sb = path(qPath, serviceName, vlanId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhVlan.class);
} | [
"public",
"OvhVlan",
"serviceName_vlan_vlanId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"vlanId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}/vlan/{vlanId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
... | Get this object properties
REST: GET /dedicatedCloud/{serviceName}/vlan/{vlanId}
@param serviceName [required] Domain of the service
@param vlanId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1229-L1234 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.retrieveCall | public void retrieveCall(
String connId,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidanswerData retrieveData = new VoicecallsidanswerData();
retrieveData.setReasons(Util.toKVList(reasons));
retrieveData.setExtensions(Util.toKVList(extensions));
RetrieveData data = new RetrieveData();
data.data(retrieveData);
ApiSuccessResponse response = this.voiceApi.retrieve(connId, data);
throwIfNotOk("retrieveCall", response);
} catch (ApiException e) {
throw new WorkspaceApiException("retrieveCall failed.", e);
}
} | java | public void retrieveCall(
String connId,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidanswerData retrieveData = new VoicecallsidanswerData();
retrieveData.setReasons(Util.toKVList(reasons));
retrieveData.setExtensions(Util.toKVList(extensions));
RetrieveData data = new RetrieveData();
data.data(retrieveData);
ApiSuccessResponse response = this.voiceApi.retrieve(connId, data);
throwIfNotOk("retrieveCall", response);
} catch (ApiException e) {
throw new WorkspaceApiException("retrieveCall failed.", e);
}
} | [
"public",
"void",
"retrieveCall",
"(",
"String",
"connId",
",",
"KeyValueCollection",
"reasons",
",",
"KeyValueCollection",
"extensions",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"VoicecallsidanswerData",
"retrieveData",
"=",
"new",
"VoicecallsidanswerData... | Retrieve the specified call from hold.
@param connId The connection ID of the call.
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) | [
"Retrieve",
"the",
"specified",
"call",
"from",
"hold",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L601-L619 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskContext.java | TaskContext.getTaskPublisher | public TaskPublisher getTaskPublisher(TaskState taskState, TaskLevelPolicyCheckResults results) throws Exception {
return TaskPublisherBuilderFactory.newTaskPublisherBuilder(taskState, results).build();
} | java | public TaskPublisher getTaskPublisher(TaskState taskState, TaskLevelPolicyCheckResults results) throws Exception {
return TaskPublisherBuilderFactory.newTaskPublisherBuilder(taskState, results).build();
} | [
"public",
"TaskPublisher",
"getTaskPublisher",
"(",
"TaskState",
"taskState",
",",
"TaskLevelPolicyCheckResults",
"results",
")",
"throws",
"Exception",
"{",
"return",
"TaskPublisherBuilderFactory",
".",
"newTaskPublisherBuilder",
"(",
"taskState",
",",
"results",
")",
".... | Get a post-fork {@link TaskPublisher} for publishing data in the given branch.
@param taskState {@link TaskState} of a {@link Task}
@param results Task-level policy checking results
@return a {@link TaskPublisher} | [
"Get",
"a",
"post",
"-",
"fork",
"{",
"@link",
"TaskPublisher",
"}",
"for",
"publishing",
"data",
"in",
"the",
"given",
"branch",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskContext.java#L353-L355 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java | QueryExecutor.sqlToSortIds | protected static SqlParts sqlToSortIds(Set<String> docIdSet,
List<FieldSort> sortDocument,
List<Index> indexes) throws QueryException {
String chosenIndex = chooseIndexForSort(sortDocument, indexes);
if (chosenIndex == null) {
String msg = String.format(Locale.ENGLISH, "No single index can satisfy order %s", sortDocument);
logger.log(Level.SEVERE, msg);
throw new QueryException(msg);
}
String indexTable = QueryImpl.tableNameForIndex(chosenIndex);
// for small result sets:
// SELECT _id FROM idx WHERE _id IN (?, ?) ORDER BY fieldName ASC, fieldName2 DESC
// for large result sets:
// SELECT _id FROM idx ORDER BY fieldName ASC, fieldName2 DESC
List<String> orderClauses = new ArrayList<String>();
for (FieldSort clause : sortDocument) {
String fieldName = clause.field;
String direction = clause.sort == FieldSort.Direction.ASCENDING ? "asc" : "desc";
String orderClause = String.format("\"%s\" %s", fieldName, direction.toUpperCase(Locale.ENGLISH));
orderClauses.add(orderClause);
}
// If we have few results, it's more efficient to reduce the search space
// for SQLite. 500 placeholders should be a safe value.
List<String> parameterList = new ArrayList<String>();
String whereClause = "";
if (docIdSet.size() < SMALL_RESULT_SET_SIZE_THRESHOLD) {
List<String> placeholders = new ArrayList<String>();
for (String docId : docIdSet) {
placeholders.add("?");
parameterList.add(docId);
}
whereClause = String.format("WHERE _id IN (%s)", Misc.join(", ", placeholders));
}
String orderBy = Misc.join(", ", orderClauses);
String sql = String.format("SELECT DISTINCT _id FROM %s %s ORDER BY %s", indexTable,
whereClause,
orderBy);
String[] parameters = new String[parameterList.size()];
return SqlParts.partsForSql(sql, parameterList.toArray(parameters));
} | java | protected static SqlParts sqlToSortIds(Set<String> docIdSet,
List<FieldSort> sortDocument,
List<Index> indexes) throws QueryException {
String chosenIndex = chooseIndexForSort(sortDocument, indexes);
if (chosenIndex == null) {
String msg = String.format(Locale.ENGLISH, "No single index can satisfy order %s", sortDocument);
logger.log(Level.SEVERE, msg);
throw new QueryException(msg);
}
String indexTable = QueryImpl.tableNameForIndex(chosenIndex);
// for small result sets:
// SELECT _id FROM idx WHERE _id IN (?, ?) ORDER BY fieldName ASC, fieldName2 DESC
// for large result sets:
// SELECT _id FROM idx ORDER BY fieldName ASC, fieldName2 DESC
List<String> orderClauses = new ArrayList<String>();
for (FieldSort clause : sortDocument) {
String fieldName = clause.field;
String direction = clause.sort == FieldSort.Direction.ASCENDING ? "asc" : "desc";
String orderClause = String.format("\"%s\" %s", fieldName, direction.toUpperCase(Locale.ENGLISH));
orderClauses.add(orderClause);
}
// If we have few results, it's more efficient to reduce the search space
// for SQLite. 500 placeholders should be a safe value.
List<String> parameterList = new ArrayList<String>();
String whereClause = "";
if (docIdSet.size() < SMALL_RESULT_SET_SIZE_THRESHOLD) {
List<String> placeholders = new ArrayList<String>();
for (String docId : docIdSet) {
placeholders.add("?");
parameterList.add(docId);
}
whereClause = String.format("WHERE _id IN (%s)", Misc.join(", ", placeholders));
}
String orderBy = Misc.join(", ", orderClauses);
String sql = String.format("SELECT DISTINCT _id FROM %s %s ORDER BY %s", indexTable,
whereClause,
orderBy);
String[] parameters = new String[parameterList.size()];
return SqlParts.partsForSql(sql, parameterList.toArray(parameters));
} | [
"protected",
"static",
"SqlParts",
"sqlToSortIds",
"(",
"Set",
"<",
"String",
">",
"docIdSet",
",",
"List",
"<",
"FieldSort",
">",
"sortDocument",
",",
"List",
"<",
"Index",
">",
"indexes",
")",
"throws",
"QueryException",
"{",
"String",
"chosenIndex",
"=",
... | Return SQL to get ordered list of docIds.
Method assumes `sortDocument` is valid.
@param docIdSet The original set of document IDs
@param sortDocument Array of ordering definitions
[ { "fieldName" : "asc" }, { "fieldName2", "desc" } ]
@param indexes dictionary of indexes
@return the SQL containing the order by clause | [
"Return",
"SQL",
"to",
"get",
"ordered",
"list",
"of",
"docIds",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java#L340-L387 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java | CommerceCountryPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommerceCountry commerceCountry : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceCountry);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommerceCountry commerceCountry : findByUuid_C(uuid, companyId,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceCountry);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CommerceCountry",
"commerceCountry",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryU... | Removes all the commerce countries where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"commerce",
"countries",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L1402-L1408 |
kmi/iserve | iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java | ServiceManagerSparql.listEntitiesByDataModel | private Set<URI> listEntitiesByDataModel(com.hp.hpl.jena.rdf.model.Resource entityType, Property dataPropertyType, URI modelReference) {
if (modelReference == null) {
return ImmutableSet.of();
}
StringBuilder queryBuilder = new StringBuilder()
.append("SELECT DISTINCT ?entity WHERE { \n");
// Deal with engines that store the inference in the default graph (e.g., OWLIM)
queryBuilder.append("{").append("\n")
.append(" ?entity <").append(RDF.type.getURI()).append("> <").append(entityType.getURI()).append("> .").append("\n");
// Deal with the difference between Services and Operations
if (entityType.equals(MSM.Service)) {
queryBuilder.append(" ?entity <").append(MSM.hasOperation.getURI()).append("> / ").append("\n")
.append(" <").append(dataPropertyType.getURI()).append("> / ").append("\n");
} else {
queryBuilder.append(" ?entity <").append(dataPropertyType.getURI()).append("> / ").append("\n");
}
queryBuilder.append(" <").append(SAWSDL.modelReference.getURI()).append("> <").append(modelReference.toASCIIString()).append("> .").append("\n");
// UNION
queryBuilder.append("\n } UNION { \n");
queryBuilder.append(" ?entity <").append(RDF.type.getURI()).append("> <").append(entityType.getURI()).append("> .").append("\n");
// Deal with the difference between Services and Operations
if (entityType.equals(MSM.Service)) {
queryBuilder.append(" ?entity <").append(MSM.hasOperation.getURI()).append("> / ").append("\n")
.append(" <").append(dataPropertyType.getURI()).append("> ?message .").append("\n");
} else {
queryBuilder.append(" ?entity <").append(dataPropertyType.getURI()).append("> ?message .").append("\n");
}
queryBuilder.append("?message (<").append(MSM.hasOptionalPart.getURI()).
append("> | <").append(MSM.hasMandatoryPart.getURI()).append(">)+ ?part . \n").
append(" ?part <").append(SAWSDL.modelReference.getURI()).append("> <").append(modelReference.toASCIIString()).append("> .").
append("}}");
return this.graphStoreManager.listResourcesByQuery(queryBuilder.toString(), "entity");
} | java | private Set<URI> listEntitiesByDataModel(com.hp.hpl.jena.rdf.model.Resource entityType, Property dataPropertyType, URI modelReference) {
if (modelReference == null) {
return ImmutableSet.of();
}
StringBuilder queryBuilder = new StringBuilder()
.append("SELECT DISTINCT ?entity WHERE { \n");
// Deal with engines that store the inference in the default graph (e.g., OWLIM)
queryBuilder.append("{").append("\n")
.append(" ?entity <").append(RDF.type.getURI()).append("> <").append(entityType.getURI()).append("> .").append("\n");
// Deal with the difference between Services and Operations
if (entityType.equals(MSM.Service)) {
queryBuilder.append(" ?entity <").append(MSM.hasOperation.getURI()).append("> / ").append("\n")
.append(" <").append(dataPropertyType.getURI()).append("> / ").append("\n");
} else {
queryBuilder.append(" ?entity <").append(dataPropertyType.getURI()).append("> / ").append("\n");
}
queryBuilder.append(" <").append(SAWSDL.modelReference.getURI()).append("> <").append(modelReference.toASCIIString()).append("> .").append("\n");
// UNION
queryBuilder.append("\n } UNION { \n");
queryBuilder.append(" ?entity <").append(RDF.type.getURI()).append("> <").append(entityType.getURI()).append("> .").append("\n");
// Deal with the difference between Services and Operations
if (entityType.equals(MSM.Service)) {
queryBuilder.append(" ?entity <").append(MSM.hasOperation.getURI()).append("> / ").append("\n")
.append(" <").append(dataPropertyType.getURI()).append("> ?message .").append("\n");
} else {
queryBuilder.append(" ?entity <").append(dataPropertyType.getURI()).append("> ?message .").append("\n");
}
queryBuilder.append("?message (<").append(MSM.hasOptionalPart.getURI()).
append("> | <").append(MSM.hasMandatoryPart.getURI()).append(">)+ ?part . \n").
append(" ?part <").append(SAWSDL.modelReference.getURI()).append("> <").append(modelReference.toASCIIString()).append("> .").
append("}}");
return this.graphStoreManager.listResourcesByQuery(queryBuilder.toString(), "entity");
} | [
"private",
"Set",
"<",
"URI",
">",
"listEntitiesByDataModel",
"(",
"com",
".",
"hp",
".",
"hpl",
".",
"jena",
".",
"rdf",
".",
"model",
".",
"Resource",
"entityType",
",",
"Property",
"dataPropertyType",
",",
"URI",
"modelReference",
")",
"{",
"if",
"(",
... | Given the URI of a type (i.e., a modelReference), this method figures out all the entities of a type
(Service or Operation are the ones that are expected) that have this as part of their inputs or outputs. What
data relationship should be used is also parameterised.
@param entityType the type of entity we are looking for (i.e., service or operation)
@param dataPropertyType the kind of data property we are interested in (e.g., inputs, outputs, fault)
@param modelReference the type of input sought for
@return a Set of URIs of the entities that matched the request or the empty Set otherwise. | [
"Given",
"the",
"URI",
"of",
"a",
"type",
"(",
"i",
".",
"e",
".",
"a",
"modelReference",
")",
"this",
"method",
"figures",
"out",
"all",
"the",
"entities",
"of",
"a",
"type",
"(",
"Service",
"or",
"Operation",
"are",
"the",
"ones",
"that",
"are",
"e... | train | https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ServiceManagerSparql.java#L831-L873 |
michel-kraemer/bson4jackson | src/main/java/de/undercouch/bson4jackson/BsonParser.java | BsonParser.readObjectId | protected ObjectId readObjectId() throws IOException {
int time = ByteOrderUtil.flip(_in.readInt());
int machine = ByteOrderUtil.flip(_in.readInt());
int inc = ByteOrderUtil.flip(_in.readInt());
return new ObjectId(time, machine, inc);
} | java | protected ObjectId readObjectId() throws IOException {
int time = ByteOrderUtil.flip(_in.readInt());
int machine = ByteOrderUtil.flip(_in.readInt());
int inc = ByteOrderUtil.flip(_in.readInt());
return new ObjectId(time, machine, inc);
} | [
"protected",
"ObjectId",
"readObjectId",
"(",
")",
"throws",
"IOException",
"{",
"int",
"time",
"=",
"ByteOrderUtil",
".",
"flip",
"(",
"_in",
".",
"readInt",
"(",
")",
")",
";",
"int",
"machine",
"=",
"ByteOrderUtil",
".",
"flip",
"(",
"_in",
".",
"read... | Reads a ObjectID from the input stream
@return the ObjectID
@throws IOException if the ObjectID could not be read | [
"Reads",
"a",
"ObjectID",
"from",
"the",
"input",
"stream"
] | train | https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/BsonParser.java#L618-L623 |
attribyte/acp | src/main/java/org/attribyte/sql/pool/ConnectionPoolSegment.java | ConnectionPoolSegment.createRealConnection | private Connection createRealConnection(final long timeoutMillis) throws SQLException {
if(timeoutMillis < 1L) {
String usePassword = getPassword();
Connection conn = dbConnection.datasource == null ?
DriverManager.getConnection(dbConnection.connectionString, dbConnection.user, usePassword) :
dbConnection.datasource.getConnection(dbConnection.user, usePassword);
if(conn != null) {
return conn;
} else {
throw new SQLException("Unable to create connection: driver/datasource returned [null]");
}
} else {
try {
return connectionTimeLimiter.callWithTimeout(() -> createRealConnection(0L), timeoutMillis, TimeUnit.MILLISECONDS);
} catch(UncheckedTimeoutException ute) {
throw new SQLException("Unable to create connection after waiting " + timeoutMillis + " ms");
} catch(Exception e) {
throw new SQLException("Unable to create connection: driver/datasource", e);
}
}
} | java | private Connection createRealConnection(final long timeoutMillis) throws SQLException {
if(timeoutMillis < 1L) {
String usePassword = getPassword();
Connection conn = dbConnection.datasource == null ?
DriverManager.getConnection(dbConnection.connectionString, dbConnection.user, usePassword) :
dbConnection.datasource.getConnection(dbConnection.user, usePassword);
if(conn != null) {
return conn;
} else {
throw new SQLException("Unable to create connection: driver/datasource returned [null]");
}
} else {
try {
return connectionTimeLimiter.callWithTimeout(() -> createRealConnection(0L), timeoutMillis, TimeUnit.MILLISECONDS);
} catch(UncheckedTimeoutException ute) {
throw new SQLException("Unable to create connection after waiting " + timeoutMillis + " ms");
} catch(Exception e) {
throw new SQLException("Unable to create connection: driver/datasource", e);
}
}
} | [
"private",
"Connection",
"createRealConnection",
"(",
"final",
"long",
"timeoutMillis",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"timeoutMillis",
"<",
"1L",
")",
"{",
"String",
"usePassword",
"=",
"getPassword",
"(",
")",
";",
"Connection",
"conn",
"=",
... | Creates a real database connection, failing if one is not obtained in the specified time.
@param timeoutMillis The timeout in milliseconds.
@return The connection.
@throws SQLException on connection problem or timeout waiting for connection. | [
"Creates",
"a",
"real",
"database",
"connection",
"failing",
"if",
"one",
"is",
"not",
"obtained",
"in",
"the",
"specified",
"time",
"."
] | train | https://github.com/attribyte/acp/blob/dbee6ebb83fda4f19fbbbcb9d0ac2b527e3cb659/src/main/java/org/attribyte/sql/pool/ConnectionPoolSegment.java#L1179-L1204 |
playn/playn | core/src/playn/core/Platform.java | Platform.reportError | public void reportError (String message, Throwable cause) {
errors.emit(new Error(message, cause));
log().warn(message, cause);
} | java | public void reportError (String message, Throwable cause) {
errors.emit(new Error(message, cause));
log().warn(message, cause);
} | [
"public",
"void",
"reportError",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"errors",
".",
"emit",
"(",
"new",
"Error",
"(",
"message",
",",
"cause",
")",
")",
";",
"log",
"(",
")",
".",
"warn",
"(",
"message",
",",
"cause",
")",
... | Called when a backend (or other framework code) encounters an exception that it can recover
from, but which it would like to report in some orderly fashion. <em>NOTE:</em> this method
may be called from threads other than the main PlayN thread. | [
"Called",
"when",
"a",
"backend",
"(",
"or",
"other",
"framework",
"code",
")",
"encounters",
"an",
"exception",
"that",
"it",
"can",
"recover",
"from",
"but",
"which",
"it",
"would",
"like",
"to",
"report",
"in",
"some",
"orderly",
"fashion",
".",
"<em",
... | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Platform.java#L99-L102 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java | SQLiteDatabase.insertOrThrow | public long insertOrThrow(String table, String nullColumnHack, ContentValues values)
throws SQLException {
return insertWithOnConflict(table, nullColumnHack, values, CONFLICT_NONE);
} | java | public long insertOrThrow(String table, String nullColumnHack, ContentValues values)
throws SQLException {
return insertWithOnConflict(table, nullColumnHack, values, CONFLICT_NONE);
} | [
"public",
"long",
"insertOrThrow",
"(",
"String",
"table",
",",
"String",
"nullColumnHack",
",",
"ContentValues",
"values",
")",
"throws",
"SQLException",
"{",
"return",
"insertWithOnConflict",
"(",
"table",
",",
"nullColumnHack",
",",
"values",
",",
"CONFLICT_NONE"... | Convenience method for inserting a row into the database.
@param table the table to insert the row into
@param nullColumnHack optional; may be <code>null</code>.
SQL doesn't allow inserting a completely empty row without
naming at least one column name. If your provided <code>values</code> is
empty, no column names are known and an empty row can't be inserted.
If not set to null, the <code>nullColumnHack</code> parameter
provides the name of nullable column name to explicitly insert a NULL into
in the case where your <code>values</code> is empty.
@param values this map contains the initial column values for the
row. The keys should be the column names and the values the
column values
@throws SQLException
@return the row ID of the newly inserted row, or -1 if an error occurred | [
"Convenience",
"method",
"for",
"inserting",
"a",
"row",
"into",
"the",
"database",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L1369-L1372 |
basho/riak-java-client | src/main/java/com/basho/riak/client/api/RiakClient.java | RiakClient.newClient | public static RiakClient newClient(String... remoteAddresses) throws UnknownHostException
{
return newClient(RiakNode.Builder.DEFAULT_REMOTE_PORT, Arrays.asList(remoteAddresses));
} | java | public static RiakClient newClient(String... remoteAddresses) throws UnknownHostException
{
return newClient(RiakNode.Builder.DEFAULT_REMOTE_PORT, Arrays.asList(remoteAddresses));
} | [
"public",
"static",
"RiakClient",
"newClient",
"(",
"String",
"...",
"remoteAddresses",
")",
"throws",
"UnknownHostException",
"{",
"return",
"newClient",
"(",
"RiakNode",
".",
"Builder",
".",
"DEFAULT_REMOTE_PORT",
",",
"Arrays",
".",
"asList",
"(",
"remoteAddresse... | Static factory method to create a new client instance.
This method produces a client connected to the supplied addresses on
the default (protocol buffers) port (8087).
@param remoteAddresses a list of IP addresses or hostnames
@return a new client instance
@throws UnknownHostException if a supplied hostname cannot be resolved. | [
"Static",
"factory",
"method",
"to",
"create",
"a",
"new",
"client",
"instance",
".",
"This",
"method",
"produces",
"a",
"client",
"connected",
"to",
"the",
"supplied",
"addresses",
"on",
"the",
"default",
"(",
"protocol",
"buffers",
")",
"port",
"(",
"8087"... | train | https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/RiakClient.java#L231-L234 |
op4j/op4j | src/main/java/org/op4j/functions/FnString.java | FnString.toInteger | public static final Function<String,Integer> toInteger(final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToInteger(roundingMode, decimalPoint);
} | java | public static final Function<String,Integer> toInteger(final RoundingMode roundingMode, final DecimalPoint decimalPoint) {
return new ToInteger(roundingMode, decimalPoint);
} | [
"public",
"static",
"final",
"Function",
"<",
"String",
",",
"Integer",
">",
"toInteger",
"(",
"final",
"RoundingMode",
"roundingMode",
",",
"final",
"DecimalPoint",
"decimalPoint",
")",
"{",
"return",
"new",
"ToInteger",
"(",
"roundingMode",
",",
"decimalPoint",
... | <p>
Converts a String into an Integer, using the specified decimal point
configuration ({@link DecimalPoint}). Rounding mode is used for removing the
decimal part of the number. The target String should contain no
thousand separators. The integer part of the input string must be between
{@link Integer#MIN_VALUE} and {@link Integer#MAX_VALUE}
</p>
@param roundingMode the rounding mode to be used when setting the scale
@param decimalPoint the decimal point being used by the String
@return the resulting Integer object | [
"<p",
">",
"Converts",
"a",
"String",
"into",
"an",
"Integer",
"using",
"the",
"specified",
"decimal",
"point",
"configuration",
"(",
"{",
"@link",
"DecimalPoint",
"}",
")",
".",
"Rounding",
"mode",
"is",
"used",
"for",
"removing",
"the",
"decimal",
"part",
... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L938-L940 |
alkacon/opencms-core | src/org/opencms/ui/components/fileselect/CmsResourceSelectDialog.java | CmsResourceSelectDialog.updateRoot | protected void updateRoot(CmsObject rootCms, CmsResource siteRootResource) {
m_root = siteRootResource;
m_currentCms = rootCms;
updateView();
} | java | protected void updateRoot(CmsObject rootCms, CmsResource siteRootResource) {
m_root = siteRootResource;
m_currentCms = rootCms;
updateView();
} | [
"protected",
"void",
"updateRoot",
"(",
"CmsObject",
"rootCms",
",",
"CmsResource",
"siteRootResource",
")",
"{",
"m_root",
"=",
"siteRootResource",
";",
"m_currentCms",
"=",
"rootCms",
";",
"updateView",
"(",
")",
";",
"}"
] | Updates the current site root resource.<p>
@param rootCms the CMS context
@param siteRootResource the resource corresponding to a site root | [
"Updates",
"the",
"current",
"site",
"root",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/fileselect/CmsResourceSelectDialog.java#L413-L418 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java | ExpressionUtils.predicateTemplate | @Deprecated
public static PredicateTemplate predicateTemplate(String template, ImmutableList<?> args) {
return predicateTemplate(TemplateFactory.DEFAULT.create(template), args);
} | java | @Deprecated
public static PredicateTemplate predicateTemplate(String template, ImmutableList<?> args) {
return predicateTemplate(TemplateFactory.DEFAULT.create(template), args);
} | [
"@",
"Deprecated",
"public",
"static",
"PredicateTemplate",
"predicateTemplate",
"(",
"String",
"template",
",",
"ImmutableList",
"<",
"?",
">",
"args",
")",
"{",
"return",
"predicateTemplate",
"(",
"TemplateFactory",
".",
"DEFAULT",
".",
"create",
"(",
"template"... | Create a new Template expression
@deprecated Use {@link #predicateTemplate(String, List)} instead.
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L153-L156 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SpoofChecker.java | SpoofChecker.getResolvedScriptSet | private void getResolvedScriptSet(CharSequence input, ScriptSet result) {
getResolvedScriptSetWithout(input, UScript.CODE_LIMIT, result);
} | java | private void getResolvedScriptSet(CharSequence input, ScriptSet result) {
getResolvedScriptSetWithout(input, UScript.CODE_LIMIT, result);
} | [
"private",
"void",
"getResolvedScriptSet",
"(",
"CharSequence",
"input",
",",
"ScriptSet",
"result",
")",
"{",
"getResolvedScriptSetWithout",
"(",
"input",
",",
"UScript",
".",
"CODE_LIMIT",
",",
"result",
")",
";",
"}"
] | Computes the resolved script set for a string, according to UTS 39 section 5.1. | [
"Computes",
"the",
"resolved",
"script",
"set",
"for",
"a",
"string",
"according",
"to",
"UTS",
"39",
"section",
"5",
".",
"1",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SpoofChecker.java#L1519-L1521 |
powermock/powermock | powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java | SuppressCode.suppressConstructor | public static synchronized void suppressConstructor(Class<?> clazz, boolean excludePrivateConstructors) {
Constructor<?>[] ctors = null;
if (excludePrivateConstructors) {
ctors = clazz.getConstructors();
} else {
ctors = clazz.getDeclaredConstructors();
}
for (Constructor<?> ctor : ctors) {
MockRepository.addConstructorToSuppress(ctor);
}
} | java | public static synchronized void suppressConstructor(Class<?> clazz, boolean excludePrivateConstructors) {
Constructor<?>[] ctors = null;
if (excludePrivateConstructors) {
ctors = clazz.getConstructors();
} else {
ctors = clazz.getDeclaredConstructors();
}
for (Constructor<?> ctor : ctors) {
MockRepository.addConstructorToSuppress(ctor);
}
} | [
"public",
"static",
"synchronized",
"void",
"suppressConstructor",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"boolean",
"excludePrivateConstructors",
")",
"{",
"Constructor",
"<",
"?",
">",
"[",
"]",
"ctors",
"=",
"null",
";",
"if",
"(",
"excludePrivateConstr... | Suppress all constructors in the given class.
@param clazz
The classes whose constructors will be suppressed.
@param excludePrivateConstructors
optionally keep code in private constructors | [
"Suppress",
"all",
"constructors",
"in",
"the",
"given",
"class",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java#L80-L92 |
facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java | DefaultImageFormatChecker.getWebpFormat | private static ImageFormat getWebpFormat(final byte[] imageHeaderBytes, final int headerSize) {
Preconditions.checkArgument(WebpSupportStatus.isWebpHeader(imageHeaderBytes, 0, headerSize));
if (WebpSupportStatus.isSimpleWebpHeader(imageHeaderBytes, 0)) {
return DefaultImageFormats.WEBP_SIMPLE;
}
if (WebpSupportStatus.isLosslessWebpHeader(imageHeaderBytes, 0)) {
return DefaultImageFormats.WEBP_LOSSLESS;
}
if (WebpSupportStatus.isExtendedWebpHeader(imageHeaderBytes, 0, headerSize)) {
if (WebpSupportStatus.isAnimatedWebpHeader(imageHeaderBytes, 0)) {
return DefaultImageFormats.WEBP_ANIMATED;
}
if (WebpSupportStatus.isExtendedWebpHeaderWithAlpha(imageHeaderBytes, 0)) {
return DefaultImageFormats.WEBP_EXTENDED_WITH_ALPHA;
}
return DefaultImageFormats.WEBP_EXTENDED;
}
return ImageFormat.UNKNOWN;
} | java | private static ImageFormat getWebpFormat(final byte[] imageHeaderBytes, final int headerSize) {
Preconditions.checkArgument(WebpSupportStatus.isWebpHeader(imageHeaderBytes, 0, headerSize));
if (WebpSupportStatus.isSimpleWebpHeader(imageHeaderBytes, 0)) {
return DefaultImageFormats.WEBP_SIMPLE;
}
if (WebpSupportStatus.isLosslessWebpHeader(imageHeaderBytes, 0)) {
return DefaultImageFormats.WEBP_LOSSLESS;
}
if (WebpSupportStatus.isExtendedWebpHeader(imageHeaderBytes, 0, headerSize)) {
if (WebpSupportStatus.isAnimatedWebpHeader(imageHeaderBytes, 0)) {
return DefaultImageFormats.WEBP_ANIMATED;
}
if (WebpSupportStatus.isExtendedWebpHeaderWithAlpha(imageHeaderBytes, 0)) {
return DefaultImageFormats.WEBP_EXTENDED_WITH_ALPHA;
}
return DefaultImageFormats.WEBP_EXTENDED;
}
return ImageFormat.UNKNOWN;
} | [
"private",
"static",
"ImageFormat",
"getWebpFormat",
"(",
"final",
"byte",
"[",
"]",
"imageHeaderBytes",
",",
"final",
"int",
"headerSize",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"WebpSupportStatus",
".",
"isWebpHeader",
"(",
"imageHeaderBytes",
",",
... | Determines type of WebP image. imageHeaderBytes has to be header of a WebP image | [
"Determines",
"type",
"of",
"WebP",
"image",
".",
"imageHeaderBytes",
"has",
"to",
"be",
"header",
"of",
"a",
"WebP",
"image"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java#L104-L125 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java | PathNormalizer.joinPaths | public static String joinPaths(String prefix, String path, GeneratorRegistry generatorRegistry) {
return joinPaths(prefix, path, generatorRegistry.isPathGenerated(prefix));
} | java | public static String joinPaths(String prefix, String path, GeneratorRegistry generatorRegistry) {
return joinPaths(prefix, path, generatorRegistry.isPathGenerated(prefix));
} | [
"public",
"static",
"String",
"joinPaths",
"(",
"String",
"prefix",
",",
"String",
"path",
",",
"GeneratorRegistry",
"generatorRegistry",
")",
"{",
"return",
"joinPaths",
"(",
"prefix",
",",
"path",
",",
"generatorRegistry",
".",
"isPathGenerated",
"(",
"prefix",
... | Normalizes two paths and joins them as a single path.
@param prefix
@param path
@param generatorRegistry
the generator registry
@return the joined path | [
"Normalizes",
"two",
"paths",
"and",
"joins",
"them",
"as",
"a",
"single",
"path",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L282-L285 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.matchTypeMap | public static final boolean matchTypeMap(Map<String, Class<?>> m1, Map<String, Class<?>> m2) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "matchTypeMap", new Object[] { m1, m2 });
boolean match = false;
if (m1 == m2)
match = true;
else if (m1 != null && m1.equals(m2))
match = true;
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "matchTypeMap", match);
return match;
} | java | public static final boolean matchTypeMap(Map<String, Class<?>> m1, Map<String, Class<?>> m2) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "matchTypeMap", new Object[] { m1, m2 });
boolean match = false;
if (m1 == m2)
match = true;
else if (m1 != null && m1.equals(m2))
match = true;
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "matchTypeMap", match);
return match;
} | [
"public",
"static",
"final",
"boolean",
"matchTypeMap",
"(",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"m1",
",",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"m2",
")",
"{",
"final",
"boolean",
"isTraceOn",
"=",
"TraceCompon... | determines if two typeMaps match. Note that this method takes under account
an Oracle 11g change with TypeMap
@param m1
@param m2
@return | [
"determines",
"if",
"two",
"typeMaps",
"match",
".",
"Note",
"that",
"this",
"method",
"takes",
"under",
"account",
"an",
"Oracle",
"11g",
"change",
"with",
"TypeMap"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L676-L691 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/spec/DESKeySpec.java | DESKeySpec.isParityAdjusted | public static boolean isParityAdjusted(byte[] key, int offset)
throws InvalidKeyException {
if (key == null) {
throw new InvalidKeyException("null key");
}
if (key.length - offset < DES_KEY_LEN) {
throw new InvalidKeyException("Wrong key size");
}
for (int i = 0; i < DES_KEY_LEN; i++) {
int k = Integer.bitCount(key[offset++] & 0xff);
if ((k & 1) == 0) {
return false;
}
}
return true;
} | java | public static boolean isParityAdjusted(byte[] key, int offset)
throws InvalidKeyException {
if (key == null) {
throw new InvalidKeyException("null key");
}
if (key.length - offset < DES_KEY_LEN) {
throw new InvalidKeyException("Wrong key size");
}
for (int i = 0; i < DES_KEY_LEN; i++) {
int k = Integer.bitCount(key[offset++] & 0xff);
if ((k & 1) == 0) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isParityAdjusted",
"(",
"byte",
"[",
"]",
"key",
",",
"int",
"offset",
")",
"throws",
"InvalidKeyException",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidKeyException",
"(",
"\"null key\"",
")",
";",
... | Checks if the given DES key material, starting at <code>offset</code>
inclusive, is parity-adjusted.
@param key the buffer with the DES key material.
@param offset the offset in <code>key</code>, where the DES key
material starts.
@return true if the given DES key material is parity-adjusted, false
otherwise.
@exception InvalidKeyException if the given key material is
<code>null</code>, or starting at <code>offset</code> inclusive, is
shorter than 8 bytes. | [
"Checks",
"if",
"the",
"given",
"DES",
"key",
"material",
"starting",
"at",
"<code",
">",
"offset<",
"/",
"code",
">",
"inclusive",
"is",
"parity",
"-",
"adjusted",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/spec/DESKeySpec.java#L186-L203 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java | JsonRpcClient.invokeNotification | public void invokeNotification(String methodName, Object argument, OutputStream output) throws IOException {
writeRequest(methodName, argument, output, null);
output.flush();
} | java | public void invokeNotification(String methodName, Object argument, OutputStream output) throws IOException {
writeRequest(methodName, argument, output, null);
output.flush();
} | [
"public",
"void",
"invokeNotification",
"(",
"String",
"methodName",
",",
"Object",
"argument",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"writeRequest",
"(",
"methodName",
",",
"argument",
",",
"output",
",",
"null",
")",
";",
"output",
... | Invokes the given method on the remote service passing
the given argument without reading or expecting a return
response.
@param methodName the method to invoke
@param argument the argument to pass to the method
@param output the {@link OutputStream} to write to
@throws IOException on error
@see #writeRequest(String, Object, OutputStream, String) | [
"Invokes",
"the",
"given",
"method",
"on",
"the",
"remote",
"service",
"passing",
"the",
"given",
"argument",
"without",
"reading",
"or",
"expecting",
"a",
"return",
"response",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L501-L504 |
chr78rm/tracelogger | src/main/java/de/christofreichardt/diagnosis/QueueTracer.java | QueueTracer.logException | @Override
public void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName) {
this.tracer.logException(logLevel, throwable, clazz, methodName);
} | java | @Override
public void logException(LogLevel logLevel, Throwable throwable, Class clazz, String methodName) {
this.tracer.logException(logLevel, throwable, clazz, methodName);
} | [
"@",
"Override",
"public",
"void",
"logException",
"(",
"LogLevel",
"logLevel",
",",
"Throwable",
"throwable",
",",
"Class",
"clazz",
",",
"String",
"methodName",
")",
"{",
"this",
".",
"tracer",
".",
"logException",
"(",
"logLevel",
",",
"throwable",
",",
"... | Delegates to the corresponding method of the wrapped tracer.
@param logLevel one of the predefined levels INFO, WARNING, ERROR, FATAL and SEVERE
@param throwable the to be logged throwable
@param clazz the originating class
@param methodName the name of the relevant method | [
"Delegates",
"to",
"the",
"corresponding",
"method",
"of",
"the",
"wrapped",
"tracer",
"."
] | train | https://github.com/chr78rm/tracelogger/blob/ad22452b20f8111ad4d367302c2b26a100a20200/src/main/java/de/christofreichardt/diagnosis/QueueTracer.java#L205-L208 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/openStreetMap/OpenStreetMapRenderer.java | OpenStreetMapRenderer.encodeEnd | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
OpenStreetMap openStreetMap = (OpenStreetMap) component;
ResponseWriter rw = context.getResponseWriter();
String clientIdRaw = openStreetMap.getClientId();
String clientId = clientIdRaw.replace(":", "");
rw.endElement("div");
rw.startElement("script", component);
rw.writeText("var " + clientId + "_map = L.map('" + clientIdRaw + "', {center: [" + openStreetMap.getCenter()
+ "], zoom: " + openStreetMap.getZoom() + ", layers: L.tileLayer('" + openStreetMap.getUrlTemplate()
+ "', {id: 'osm', attribution: '" + openStreetMap.getAttribution() + "', maxZoom: "
+ openStreetMap.getMaxZoom() + ", minZoom: " + openStreetMap.getMinZoom() + "}), dragging:"
+ openStreetMap.isDragging() + ", zoomControl:" + openStreetMap.isZoomControl() + " });", null);
rw.writeText("if('" + openStreetMap.getMarker() + "')", null);
rw.writeText("{", null);
rw.writeText("var " + clientId + "_marker = L.marker([" + openStreetMap.getMarker()
+ "],{icon: new L.Icon({iconSize: [25, 41], iconAnchor: [25, 41], popupAnchor: [-12, -45], iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/"+openStreetMap.LEAFLET_VERSION+"/images/marker-icon.png', shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/"+openStreetMap.LEAFLET_VERSION+"/images/marker-shadow.png'})}).addTo("
+ clientId + "_map);", null);
rw.writeText("if('" + openStreetMap.getPopupMsg() + "')", null);
rw.writeText(clientId + "_marker.bindPopup('" + openStreetMap.getPopupMsg() + "');", null);
rw.writeText("}", null);
rw.writeText("if(!" + openStreetMap.isZoomGlobal() + ")", null);
rw.writeText("{", null);
rw.writeText(clientId + "_map.touchZoom.disable();", null);
rw.writeText(clientId + "_map.doubleClickZoom.disable();", null);
rw.writeText(clientId + "_map.scrollWheelZoom.disable();", null);
rw.writeText(clientId + "_map.boxZoom.disable();", null);
rw.writeText(clientId + "_map.keyboard.disable();", null);
rw.writeText("}", null);
rw.writeText("if(" + openStreetMap.isMiniMap() + ")", null);
rw.writeText("{", null);
rw.writeText("new L.Control.MiniMap(L.tileLayer('" + openStreetMap.getUrlTemplate() + "', {}), {", null);
rw.writeText("toggleDisplay: true,", null);
rw.writeText("zoomAnimation: true,", null);
rw.writeText("position: '" + openStreetMap.getMiniMapPosition() + "',", null);
rw.writeText("width: " + openStreetMap.getMiniMapWidth() + ",", null);
rw.writeText("height: " + openStreetMap.getMiniMapWidth(), null);
rw.writeText("}).addTo(" + clientId + "_map);", null);
rw.writeText("}", null);
rw.endElement("script");
} | java | @Override
public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
OpenStreetMap openStreetMap = (OpenStreetMap) component;
ResponseWriter rw = context.getResponseWriter();
String clientIdRaw = openStreetMap.getClientId();
String clientId = clientIdRaw.replace(":", "");
rw.endElement("div");
rw.startElement("script", component);
rw.writeText("var " + clientId + "_map = L.map('" + clientIdRaw + "', {center: [" + openStreetMap.getCenter()
+ "], zoom: " + openStreetMap.getZoom() + ", layers: L.tileLayer('" + openStreetMap.getUrlTemplate()
+ "', {id: 'osm', attribution: '" + openStreetMap.getAttribution() + "', maxZoom: "
+ openStreetMap.getMaxZoom() + ", minZoom: " + openStreetMap.getMinZoom() + "}), dragging:"
+ openStreetMap.isDragging() + ", zoomControl:" + openStreetMap.isZoomControl() + " });", null);
rw.writeText("if('" + openStreetMap.getMarker() + "')", null);
rw.writeText("{", null);
rw.writeText("var " + clientId + "_marker = L.marker([" + openStreetMap.getMarker()
+ "],{icon: new L.Icon({iconSize: [25, 41], iconAnchor: [25, 41], popupAnchor: [-12, -45], iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/"+openStreetMap.LEAFLET_VERSION+"/images/marker-icon.png', shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/"+openStreetMap.LEAFLET_VERSION+"/images/marker-shadow.png'})}).addTo("
+ clientId + "_map);", null);
rw.writeText("if('" + openStreetMap.getPopupMsg() + "')", null);
rw.writeText(clientId + "_marker.bindPopup('" + openStreetMap.getPopupMsg() + "');", null);
rw.writeText("}", null);
rw.writeText("if(!" + openStreetMap.isZoomGlobal() + ")", null);
rw.writeText("{", null);
rw.writeText(clientId + "_map.touchZoom.disable();", null);
rw.writeText(clientId + "_map.doubleClickZoom.disable();", null);
rw.writeText(clientId + "_map.scrollWheelZoom.disable();", null);
rw.writeText(clientId + "_map.boxZoom.disable();", null);
rw.writeText(clientId + "_map.keyboard.disable();", null);
rw.writeText("}", null);
rw.writeText("if(" + openStreetMap.isMiniMap() + ")", null);
rw.writeText("{", null);
rw.writeText("new L.Control.MiniMap(L.tileLayer('" + openStreetMap.getUrlTemplate() + "', {}), {", null);
rw.writeText("toggleDisplay: true,", null);
rw.writeText("zoomAnimation: true,", null);
rw.writeText("position: '" + openStreetMap.getMiniMapPosition() + "',", null);
rw.writeText("width: " + openStreetMap.getMiniMapWidth() + ",", null);
rw.writeText("height: " + openStreetMap.getMiniMapWidth(), null);
rw.writeText("}).addTo(" + clientId + "_map);", null);
rw.writeText("}", null);
rw.endElement("script");
} | [
"@",
"Override",
"public",
"void",
"encodeEnd",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"OpenStreetMap",
"open... | This methods generates the HTML code of the current b:openStreetMap.
<code>encodeBegin</code> generates the start of the component. After the, the
JSF framework calls <code>encodeChildren()</code> to generate the HTML code
between the beginning and the end of the component. For instance, in the case
of a panel component the content of the panel is generated by
<code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:openStreetMap.
@throws IOException thrown if something goes wrong when writing the HTML
code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"openStreetMap",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framew... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/openStreetMap/OpenStreetMapRenderer.java#L90-L135 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java | TileSystem.getLatitudeFromY01 | public double getLatitudeFromY01(final double pY01, boolean wrapEnabled) {
final double latitude = getLatitudeFromY01(wrapEnabled ? Clip(pY01, 0, 1) : pY01);
return wrapEnabled ? Clip(latitude, getMinLatitude(), getMaxLatitude()) : latitude;
} | java | public double getLatitudeFromY01(final double pY01, boolean wrapEnabled) {
final double latitude = getLatitudeFromY01(wrapEnabled ? Clip(pY01, 0, 1) : pY01);
return wrapEnabled ? Clip(latitude, getMinLatitude(), getMaxLatitude()) : latitude;
} | [
"public",
"double",
"getLatitudeFromY01",
"(",
"final",
"double",
"pY01",
",",
"boolean",
"wrapEnabled",
")",
"{",
"final",
"double",
"latitude",
"=",
"getLatitudeFromY01",
"(",
"wrapEnabled",
"?",
"Clip",
"(",
"pY01",
",",
"0",
",",
"1",
")",
":",
"pY01",
... | Converts a "Y01" value into latitude
"Y01" is a double between 0 and 1 for the whole latitude range
MaxLatitude:0 ... MinLatitude:1
@since 6.0.0 | [
"Converts",
"a",
"Y01",
"value",
"into",
"latitude",
"Y01",
"is",
"a",
"double",
"between",
"0",
"and",
"1",
"for",
"the",
"whole",
"latitude",
"range",
"MaxLatitude",
":",
"0",
"...",
"MinLatitude",
":",
"1"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java#L505-L508 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java | HttpChannelConfig.parseBinaryTransport | private void parseBinaryTransport(Map<Object, Object> props) {
Object value = props.get(HttpConfigConstants.PROPNAME_BINARY_TRANSPORT);
if (null != value) {
this.bBinaryTransport = convertBoolean(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: binary transport is " + isBinaryTransportEnabled());
}
}
} | java | private void parseBinaryTransport(Map<Object, Object> props) {
Object value = props.get(HttpConfigConstants.PROPNAME_BINARY_TRANSPORT);
if (null != value) {
this.bBinaryTransport = convertBoolean(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: binary transport is " + isBinaryTransportEnabled());
}
}
} | [
"private",
"void",
"parseBinaryTransport",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"props",
")",
"{",
"Object",
"value",
"=",
"props",
".",
"get",
"(",
"HttpConfigConstants",
".",
"PROPNAME_BINARY_TRANSPORT",
")",
";",
"if",
"(",
"null",
"!=",
"value"... | Check the input configuration for whether the parsing and marshalling
should use the binary transport mode or not.
@param props | [
"Check",
"the",
"input",
"configuration",
"for",
"whether",
"the",
"parsing",
"and",
"marshalling",
"should",
"use",
"the",
"binary",
"transport",
"mode",
"or",
"not",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L797-L805 |
jhg023/SimpleNet | src/main/java/simplenet/Server.java | Server.writeHelper | @SafeVarargs
private <T extends Client> void writeHelper(Consumer<Client> consumer, T... clients) {
var toExclude = Collections.newSetFromMap(new IdentityHashMap<>(clients.length));
toExclude.addAll(List.of(clients));
connectedClients.stream().filter(Predicate.not(toExclude::contains)).forEach(consumer);
} | java | @SafeVarargs
private <T extends Client> void writeHelper(Consumer<Client> consumer, T... clients) {
var toExclude = Collections.newSetFromMap(new IdentityHashMap<>(clients.length));
toExclude.addAll(List.of(clients));
connectedClients.stream().filter(Predicate.not(toExclude::contains)).forEach(consumer);
} | [
"@",
"SafeVarargs",
"private",
"<",
"T",
"extends",
"Client",
">",
"void",
"writeHelper",
"(",
"Consumer",
"<",
"Client",
">",
"consumer",
",",
"T",
"...",
"clients",
")",
"{",
"var",
"toExclude",
"=",
"Collections",
".",
"newSetFromMap",
"(",
"new",
"Iden... | A helper method that eliminates code duplication in the {@link #writeToAllExcept(Packet, Client[])} and
{@link #writeAndFlushToAllExcept(Packet, Client[])} methods.
@param <T> A {@link Client} or any of its children.
@param consumer The action to perform for each {@link Client}.
@param clients A variable amount of {@link Client}s to exclude from receiving the {@link Packet}. | [
"A",
"helper",
"method",
"that",
"eliminates",
"code",
"duplication",
"in",
"the",
"{",
"@link",
"#writeToAllExcept",
"(",
"Packet",
"Client",
"[]",
")",
"}",
"and",
"{",
"@link",
"#writeAndFlushToAllExcept",
"(",
"Packet",
"Client",
"[]",
")",
"}",
"methods",... | train | https://github.com/jhg023/SimpleNet/blob/a5b55cbfe1768c6a28874f12adac3c748f2b509a/src/main/java/simplenet/Server.java#L210-L215 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java | MailService.findMessage | public MailMessage findMessage(final String accountReservationKey, final Predicate<MailMessage> condition,
final long timeoutSeconds) {
return findMessage(accountReservationKey, condition, timeoutSeconds, defaultSleepMillis);
} | java | public MailMessage findMessage(final String accountReservationKey, final Predicate<MailMessage> condition,
final long timeoutSeconds) {
return findMessage(accountReservationKey, condition, timeoutSeconds, defaultSleepMillis);
} | [
"public",
"MailMessage",
"findMessage",
"(",
"final",
"String",
"accountReservationKey",
",",
"final",
"Predicate",
"<",
"MailMessage",
">",
"condition",
",",
"final",
"long",
"timeoutSeconds",
")",
"{",
"return",
"findMessage",
"(",
"accountReservationKey",
",",
"c... | Tries to find a message for the mail account reserved under the specified
{@code accountReservationKey} applying the specified {@code condition} until it times out
using the specified {@code timeout} and {@link EmailConstants#MAIL_SLEEP_MILLIS}.
@param accountReservationKey
the key under which the account has been reserved
@param condition
the condition a message must meet
@param timeoutSeconds
the timeout in seconds
@return the mail message | [
"Tries",
"to",
"find",
"a",
"message",
"for",
"the",
"mail",
"account",
"reserved",
"under",
"the",
"specified",
"{",
"@code",
"accountReservationKey",
"}",
"applying",
"the",
"specified",
"{",
"@code",
"condition",
"}",
"until",
"it",
"times",
"out",
"using",... | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java#L117-L120 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/widget/FacebookDialog.java | FacebookDialog.canPresentShareDialog | public static boolean canPresentShareDialog(Context context, ShareDialogFeature... features) {
return handleCanPresent(context, EnumSet.of(ShareDialogFeature.SHARE_DIALOG, features));
} | java | public static boolean canPresentShareDialog(Context context, ShareDialogFeature... features) {
return handleCanPresent(context, EnumSet.of(ShareDialogFeature.SHARE_DIALOG, features));
} | [
"public",
"static",
"boolean",
"canPresentShareDialog",
"(",
"Context",
"context",
",",
"ShareDialogFeature",
"...",
"features",
")",
"{",
"return",
"handleCanPresent",
"(",
"context",
",",
"EnumSet",
".",
"of",
"(",
"ShareDialogFeature",
".",
"SHARE_DIALOG",
",",
... | Determines whether the version of the Facebook application installed on the user's device is recent
enough to support specific features of the native Share dialog, which in turn may be used to determine
which UI, etc., to present to the user.
@param context the calling Context
@param features zero or more features to check for; {@link ShareDialogFeature#SHARE_DIALOG} is implicitly checked
if not explicitly specified
@return true if all of the specified features are supported by the currently installed version of the
Facebook application; false if any of the features are not supported | [
"Determines",
"whether",
"the",
"version",
"of",
"the",
"Facebook",
"application",
"installed",
"on",
"the",
"user",
"s",
"device",
"is",
"recent",
"enough",
"to",
"support",
"specific",
"features",
"of",
"the",
"native",
"Share",
"dialog",
"which",
"in",
"tur... | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/widget/FacebookDialog.java#L369-L371 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java | AbstractManagedType.addSingularAttribute | public void addSingularAttribute(String attributeName, SingularAttribute<X, ?> attribute)
{
if (declaredSingluarAttribs == null)
{
declaredSingluarAttribs = new HashMap<String, SingularAttribute<X, ?>>();
}
declaredSingluarAttribs.put(attributeName, attribute);
onValidateAttributeConstraints((Field) attribute.getJavaMember());
onEmbeddableAttribute((Field) attribute.getJavaMember());
} | java | public void addSingularAttribute(String attributeName, SingularAttribute<X, ?> attribute)
{
if (declaredSingluarAttribs == null)
{
declaredSingluarAttribs = new HashMap<String, SingularAttribute<X, ?>>();
}
declaredSingluarAttribs.put(attributeName, attribute);
onValidateAttributeConstraints((Field) attribute.getJavaMember());
onEmbeddableAttribute((Field) attribute.getJavaMember());
} | [
"public",
"void",
"addSingularAttribute",
"(",
"String",
"attributeName",
",",
"SingularAttribute",
"<",
"X",
",",
"?",
">",
"attribute",
")",
"{",
"if",
"(",
"declaredSingluarAttribs",
"==",
"null",
")",
"{",
"declaredSingluarAttribs",
"=",
"new",
"HashMap",
"<... | Adds the singular attribute.
@param attributeName
the attribute name
@param attribute
the attribute | [
"Adds",
"the",
"singular",
"attribute",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L820-L831 |
alkacon/opencms-core | src/org/opencms/jsp/util/A_CmsJspValueWrapper.java | A_CmsJspValueWrapper.substituteLink | protected static String substituteLink(CmsObject cms, String target) {
if (cms != null) {
return OpenCms.getLinkManager().substituteLinkForUnknownTarget(
cms,
CmsLinkManager.getAbsoluteUri(String.valueOf(target), cms.getRequestContext().getUri()));
} else {
return "";
}
} | java | protected static String substituteLink(CmsObject cms, String target) {
if (cms != null) {
return OpenCms.getLinkManager().substituteLinkForUnknownTarget(
cms,
CmsLinkManager.getAbsoluteUri(String.valueOf(target), cms.getRequestContext().getUri()));
} else {
return "";
}
} | [
"protected",
"static",
"String",
"substituteLink",
"(",
"CmsObject",
"cms",
",",
"String",
"target",
")",
"{",
"if",
"(",
"cms",
"!=",
"null",
")",
"{",
"return",
"OpenCms",
".",
"getLinkManager",
"(",
")",
".",
"substituteLinkForUnknownTarget",
"(",
"cms",
... | Returns the substituted link to the given target.<p>
@param cms the cms context
@param target the link target
@return the substituted link | [
"Returns",
"the",
"substituted",
"link",
"to",
"the",
"given",
"target",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/A_CmsJspValueWrapper.java#L171-L180 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/io/sstable/Downsampling.java | Downsampling.getEffectiveIndexIntervalAfterIndex | public static int getEffectiveIndexIntervalAfterIndex(int index, int samplingLevel, int minIndexInterval)
{
assert index >= 0;
index %= samplingLevel;
List<Integer> originalIndexes = getOriginalIndexes(samplingLevel);
int nextEntryOriginalIndex = (index == originalIndexes.size() - 1) ? BASE_SAMPLING_LEVEL : originalIndexes.get(index + 1);
return (nextEntryOriginalIndex - originalIndexes.get(index)) * minIndexInterval;
} | java | public static int getEffectiveIndexIntervalAfterIndex(int index, int samplingLevel, int minIndexInterval)
{
assert index >= 0;
index %= samplingLevel;
List<Integer> originalIndexes = getOriginalIndexes(samplingLevel);
int nextEntryOriginalIndex = (index == originalIndexes.size() - 1) ? BASE_SAMPLING_LEVEL : originalIndexes.get(index + 1);
return (nextEntryOriginalIndex - originalIndexes.get(index)) * minIndexInterval;
} | [
"public",
"static",
"int",
"getEffectiveIndexIntervalAfterIndex",
"(",
"int",
"index",
",",
"int",
"samplingLevel",
",",
"int",
"minIndexInterval",
")",
"{",
"assert",
"index",
">=",
"0",
";",
"index",
"%=",
"samplingLevel",
";",
"List",
"<",
"Integer",
">",
"... | Calculates the effective index interval after the entry at `index` in an IndexSummary. In other words, this
returns the number of partitions in the primary on-disk index before the next partition that has an entry in
the index summary. If samplingLevel == BASE_SAMPLING_LEVEL, this will be equal to the index interval.
@param index an index into an IndexSummary
@param samplingLevel the current sampling level for that IndexSummary
@param minIndexInterval the min index interval (effective index interval at full sampling)
@return the number of partitions before the next index summary entry, inclusive on one end | [
"Calculates",
"the",
"effective",
"index",
"interval",
"after",
"the",
"entry",
"at",
"index",
"in",
"an",
"IndexSummary",
".",
"In",
"other",
"words",
"this",
"returns",
"the",
"number",
"of",
"partitions",
"in",
"the",
"primary",
"on",
"-",
"disk",
"index"... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/Downsampling.java#L116-L123 |
feroult/yawp | yawp-core/src/main/java/io/yawp/commons/utils/json/gson/CustomTypeAdapterFactory.java | CustomTypeAdapterFactory.read | protected T read(JsonReader in, TypeAdapter<JsonElement> elementAdapter, TypeAdapter<T> delegate) throws IOException {
JsonElement tree = elementAdapter.read(in);
afterRead(tree);
return delegate.fromJsonTree(tree);
} | java | protected T read(JsonReader in, TypeAdapter<JsonElement> elementAdapter, TypeAdapter<T> delegate) throws IOException {
JsonElement tree = elementAdapter.read(in);
afterRead(tree);
return delegate.fromJsonTree(tree);
} | [
"protected",
"T",
"read",
"(",
"JsonReader",
"in",
",",
"TypeAdapter",
"<",
"JsonElement",
">",
"elementAdapter",
",",
"TypeAdapter",
"<",
"T",
">",
"delegate",
")",
"throws",
"IOException",
"{",
"JsonElement",
"tree",
"=",
"elementAdapter",
".",
"read",
"(",
... | Override this to define how this is deserialized in {@code deserialize} to
its type. | [
"Override",
"this",
"to",
"define",
"how",
"this",
"is",
"deserialized",
"in",
"{"
] | train | https://github.com/feroult/yawp/blob/b90deb905edd3fdb3009a5525e310cd17ead7f3d/yawp-core/src/main/java/io/yawp/commons/utils/json/gson/CustomTypeAdapterFactory.java#L58-L62 |
forge/core | maven/api/src/main/java/org/jboss/forge/addon/maven/archetype/SimpleNamespaceContext.java | SimpleNamespaceContext.registerMapping | public void registerMapping(String prefix, String namespaceURI)
{
prefix2Ns.put(prefix, namespaceURI);
ns2Prefix.put(namespaceURI, prefix);
} | java | public void registerMapping(String prefix, String namespaceURI)
{
prefix2Ns.put(prefix, namespaceURI);
ns2Prefix.put(namespaceURI, prefix);
} | [
"public",
"void",
"registerMapping",
"(",
"String",
"prefix",
",",
"String",
"namespaceURI",
")",
"{",
"prefix2Ns",
".",
"put",
"(",
"prefix",
",",
"namespaceURI",
")",
";",
"ns2Prefix",
".",
"put",
"(",
"namespaceURI",
",",
"prefix",
")",
";",
"}"
] | Registers prefix - namespace URI mapping
@param prefix
@param namespaceURI | [
"Registers",
"prefix",
"-",
"namespace",
"URI",
"mapping"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/maven/api/src/main/java/org/jboss/forge/addon/maven/archetype/SimpleNamespaceContext.java#L57-L61 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java | SvgGraphicsContext.setCursor | public void setCursor(Object parent, String name, String cursor) {
if (isAttached()) {
helper.setCursor(parent, name, cursor);
}
} | java | public void setCursor(Object parent, String name, String cursor) {
if (isAttached()) {
helper.setCursor(parent, name, cursor);
}
} | [
"public",
"void",
"setCursor",
"(",
"Object",
"parent",
",",
"String",
"name",
",",
"String",
"cursor",
")",
"{",
"if",
"(",
"isAttached",
"(",
")",
")",
"{",
"helper",
".",
"setCursor",
"(",
"parent",
",",
"name",
",",
"cursor",
")",
";",
"}",
"}"
] | Set a specific cursor on an element of this <code>GraphicsContext</code>.
@param parent
the parent of the element on which the cursor should be set.
@param name
the name of the child element on which the cursor should be set
@param cursor
The string representation of the cursor to use. | [
"Set",
"a",
"specific",
"cursor",
"on",
"an",
"element",
"of",
"this",
"<code",
">",
"GraphicsContext<",
"/",
"code",
">",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L695-L699 |
haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.learn | public double learn(double[] x, double[] y, double weight) {
setInput(x);
propagate();
double err = weight * computeOutputError(y);
if (weight != 1.0) {
for (int i = 0; i < outputLayer.units; i++) {
outputLayer.error[i] *= weight;
}
}
backpropagate();
adjustWeights();
return err;
} | java | public double learn(double[] x, double[] y, double weight) {
setInput(x);
propagate();
double err = weight * computeOutputError(y);
if (weight != 1.0) {
for (int i = 0; i < outputLayer.units; i++) {
outputLayer.error[i] *= weight;
}
}
backpropagate();
adjustWeights();
return err;
} | [
"public",
"double",
"learn",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
",",
"double",
"weight",
")",
"{",
"setInput",
"(",
"x",
")",
";",
"propagate",
"(",
")",
";",
"double",
"err",
"=",
"weight",
"*",
"computeOutputError",
"(",
... | Update the neural network with given instance and associated target value.
Note that this method is NOT multi-thread safe.
@param x the training instance.
@param y the target value.
@param weight a positive weight value associated with the training instance.
@return the weighted training error before back-propagation. | [
"Update",
"the",
"neural",
"network",
"with",
"given",
"instance",
"and",
"associated",
"target",
"value",
".",
"Note",
"that",
"this",
"method",
"is",
"NOT",
"multi",
"-",
"thread",
"safe",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L849-L864 |
netty/netty | common/src/main/java/io/netty/util/AsciiString.java | AsciiString.forEachByteDesc | public int forEachByteDesc(int index, int length, ByteProcessor visitor) throws Exception {
if (isOutOfBounds(index, length, length())) {
throw new IndexOutOfBoundsException("expected: " + "0 <= index(" + index + ") <= start + length(" + length
+ ") <= " + "length(" + length() + ')');
}
return forEachByteDesc0(index, length, visitor);
} | java | public int forEachByteDesc(int index, int length, ByteProcessor visitor) throws Exception {
if (isOutOfBounds(index, length, length())) {
throw new IndexOutOfBoundsException("expected: " + "0 <= index(" + index + ") <= start + length(" + length
+ ") <= " + "length(" + length() + ')');
}
return forEachByteDesc0(index, length, visitor);
} | [
"public",
"int",
"forEachByteDesc",
"(",
"int",
"index",
",",
"int",
"length",
",",
"ByteProcessor",
"visitor",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isOutOfBounds",
"(",
"index",
",",
"length",
",",
"length",
"(",
")",
")",
")",
"{",
"throw",
"ne... | Iterates over the specified area of this buffer with the specified {@code processor} in descending order.
(i.e. {@code (index + length - 1)}, {@code (index + length - 2)}, ... {@code index}).
@return {@code -1} if the processor iterated to or beyond the beginning of the specified area.
The last-visited index If the {@link ByteProcessor#process(byte)} returned {@code false}. | [
"Iterates",
"over",
"the",
"specified",
"area",
"of",
"this",
"buffer",
"with",
"the",
"specified",
"{",
"@code",
"processor",
"}",
"in",
"descending",
"order",
".",
"(",
"i",
".",
"e",
".",
"{",
"@code",
"(",
"index",
"+",
"length",
"-",
"1",
")",
"... | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L304-L310 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_account_primaryEmailAddress_alias_alias_GET | public OvhExchangeAccountAlias organizationName_service_exchangeService_account_primaryEmailAddress_alias_alias_GET(String organizationName, String exchangeService, String primaryEmailAddress, String alias) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/alias/{alias}";
StringBuilder sb = path(qPath, organizationName, exchangeService, primaryEmailAddress, alias);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhExchangeAccountAlias.class);
} | java | public OvhExchangeAccountAlias organizationName_service_exchangeService_account_primaryEmailAddress_alias_alias_GET(String organizationName, String exchangeService, String primaryEmailAddress, String alias) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/alias/{alias}";
StringBuilder sb = path(qPath, organizationName, exchangeService, primaryEmailAddress, alias);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhExchangeAccountAlias.class);
} | [
"public",
"OvhExchangeAccountAlias",
"organizationName_service_exchangeService_account_primaryEmailAddress_alias_alias_GET",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"primaryEmailAddress",
",",
"String",
"alias",
")",
"throws",
"IOExceptio... | Get this object properties
REST: GET /email/exchange/{organizationName}/service/{exchangeService}/account/{primaryEmailAddress}/alias/{alias}
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param primaryEmailAddress [required] Default email for this mailbox
@param alias [required] Alias | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1673-L1678 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaConf.java | CoronaConf.getPoolInfo | public PoolInfo getPoolInfo() {
String poolNameProperty = get(IMPLICIT_POOL_PROPERTY, "user.name");
String explicitPool =
get(EXPLICIT_POOL_PROPERTY, get(poolNameProperty, "")).trim();
String[] poolInfoSplitString = explicitPool.split("[.]");
if (poolInfoSplitString != null && poolInfoSplitString.length == 2) {
return new PoolInfo(poolInfoSplitString[0], poolInfoSplitString[1]);
} else if (!explicitPool.isEmpty()) {
return new PoolInfo(PoolGroupManager.DEFAULT_POOL_GROUP, explicitPool);
} else {
return PoolGroupManager.DEFAULT_POOL_INFO;
}
} | java | public PoolInfo getPoolInfo() {
String poolNameProperty = get(IMPLICIT_POOL_PROPERTY, "user.name");
String explicitPool =
get(EXPLICIT_POOL_PROPERTY, get(poolNameProperty, "")).trim();
String[] poolInfoSplitString = explicitPool.split("[.]");
if (poolInfoSplitString != null && poolInfoSplitString.length == 2) {
return new PoolInfo(poolInfoSplitString[0], poolInfoSplitString[1]);
} else if (!explicitPool.isEmpty()) {
return new PoolInfo(PoolGroupManager.DEFAULT_POOL_GROUP, explicitPool);
} else {
return PoolGroupManager.DEFAULT_POOL_INFO;
}
} | [
"public",
"PoolInfo",
"getPoolInfo",
"(",
")",
"{",
"String",
"poolNameProperty",
"=",
"get",
"(",
"IMPLICIT_POOL_PROPERTY",
",",
"\"user.name\"",
")",
";",
"String",
"explicitPool",
"=",
"get",
"(",
"EXPLICIT_POOL_PROPERTY",
",",
"get",
"(",
"poolNameProperty",
"... | Get the pool info. In order to support previous behavior, a single pool
name is accepted.
@return Pool info, using a default pool group if the
explicit pool can not be found | [
"Get",
"the",
"pool",
"info",
".",
"In",
"order",
"to",
"support",
"previous",
"behavior",
"a",
"single",
"pool",
"name",
"is",
"accepted",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaConf.java#L376-L388 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java | PathManagerService.removePathEntry | final void removePathEntry(final String pathName, boolean check) throws OperationFailedException{
synchronized (pathEntries) {
PathEntry pathEntry = pathEntries.get(pathName);
if (pathEntry.isReadOnly()) {
throw ControllerLogger.ROOT_LOGGER.pathEntryIsReadOnly(pathName);
}
Set<String> dependents = dependenctRelativePaths.get(pathName);
if (check && dependents != null) {
throw ControllerLogger.ROOT_LOGGER.cannotRemovePathWithDependencies(pathName, dependents);
}
pathEntries.remove(pathName);
triggerCallbacksForEvent(pathEntry, Event.REMOVED);
if (pathEntry.getRelativeTo() != null) {
dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo());
if (dependents != null) {
dependents.remove(pathEntry.getName());
if (dependents.size() == 0) {
dependenctRelativePaths.remove(pathEntry.getRelativeTo());
}
}
}
}
} | java | final void removePathEntry(final String pathName, boolean check) throws OperationFailedException{
synchronized (pathEntries) {
PathEntry pathEntry = pathEntries.get(pathName);
if (pathEntry.isReadOnly()) {
throw ControllerLogger.ROOT_LOGGER.pathEntryIsReadOnly(pathName);
}
Set<String> dependents = dependenctRelativePaths.get(pathName);
if (check && dependents != null) {
throw ControllerLogger.ROOT_LOGGER.cannotRemovePathWithDependencies(pathName, dependents);
}
pathEntries.remove(pathName);
triggerCallbacksForEvent(pathEntry, Event.REMOVED);
if (pathEntry.getRelativeTo() != null) {
dependents = dependenctRelativePaths.get(pathEntry.getRelativeTo());
if (dependents != null) {
dependents.remove(pathEntry.getName());
if (dependents.size() == 0) {
dependenctRelativePaths.remove(pathEntry.getRelativeTo());
}
}
}
}
} | [
"final",
"void",
"removePathEntry",
"(",
"final",
"String",
"pathName",
",",
"boolean",
"check",
")",
"throws",
"OperationFailedException",
"{",
"synchronized",
"(",
"pathEntries",
")",
"{",
"PathEntry",
"pathEntry",
"=",
"pathEntries",
".",
"get",
"(",
"pathName"... | Removes the entry for a path and sends an {@link org.jboss.as.controller.services.path.PathManager.Event#REMOVED}
notification to any registered
{@linkplain org.jboss.as.controller.services.path.PathManager.Callback#pathEvent(Event, PathEntry) callbacks}.
@param pathName the logical name of the path within the model. Cannot be {@code null}
@param check {@code true} if a check for the existence of other paths that depend on {@code pathName}
as their {@link PathEntry#getRelativeTo() relative-to} value should be performed
@throws OperationFailedException if {@code check} is {@code true} and other paths depend on the path being removed | [
"Removes",
"the",
"entry",
"for",
"a",
"path",
"and",
"sends",
"an",
"{"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/services/path/PathManagerService.java#L224-L247 |
mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/items/SwipeableItem.java | SwipeableItem.bindView | @Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
viewHolder.swipeResultContent.setVisibility(swipedDirection != 0 ? View.VISIBLE : View.GONE);
viewHolder.itemContent.setVisibility(swipedDirection != 0 ? View.GONE : View.VISIBLE);
CharSequence swipedAction = null;
CharSequence swipedText = null;
if (swipedDirection != 0) {
swipedAction = viewHolder.itemView.getContext().getString(R.string.action_undo);
swipedText = swipedDirection == ItemTouchHelper.LEFT ? "Removed" : "Archived";
viewHolder.swipeResultContent.setBackgroundColor(ContextCompat.getColor(viewHolder.itemView.getContext(), swipedDirection == ItemTouchHelper.LEFT ? R.color.md_red_900 : R.color.md_blue_900));
}
viewHolder.swipedAction.setText(swipedAction == null ? "" : swipedAction);
viewHolder.swipedText.setText(swipedText == null ? "" : swipedText);
viewHolder.swipedActionRunnable = this.swipedAction;
} | java | @Override
public void bindView(ViewHolder viewHolder, List<Object> payloads) {
super.bindView(viewHolder, payloads);
//set the text for the name
StringHolder.applyTo(name, viewHolder.name);
//set the text for the description or hide
StringHolder.applyToOrHide(description, viewHolder.description);
viewHolder.swipeResultContent.setVisibility(swipedDirection != 0 ? View.VISIBLE : View.GONE);
viewHolder.itemContent.setVisibility(swipedDirection != 0 ? View.GONE : View.VISIBLE);
CharSequence swipedAction = null;
CharSequence swipedText = null;
if (swipedDirection != 0) {
swipedAction = viewHolder.itemView.getContext().getString(R.string.action_undo);
swipedText = swipedDirection == ItemTouchHelper.LEFT ? "Removed" : "Archived";
viewHolder.swipeResultContent.setBackgroundColor(ContextCompat.getColor(viewHolder.itemView.getContext(), swipedDirection == ItemTouchHelper.LEFT ? R.color.md_red_900 : R.color.md_blue_900));
}
viewHolder.swipedAction.setText(swipedAction == null ? "" : swipedAction);
viewHolder.swipedText.setText(swipedText == null ? "" : swipedText);
viewHolder.swipedActionRunnable = this.swipedAction;
} | [
"@",
"Override",
"public",
"void",
"bindView",
"(",
"ViewHolder",
"viewHolder",
",",
"List",
"<",
"Object",
">",
"payloads",
")",
"{",
"super",
".",
"bindView",
"(",
"viewHolder",
",",
"payloads",
")",
";",
"//set the text for the name",
"StringHolder",
".",
"... | binds the data of this item onto the viewHolder
@param viewHolder the viewHolder of this item | [
"binds",
"the",
"data",
"of",
"this",
"item",
"onto",
"the",
"viewHolder"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/items/SwipeableItem.java#L115-L137 |
samskivert/samskivert | src/main/java/com/samskivert/util/ConfigUtil.java | ConfigUtil.loadProperties | public static void loadProperties (String path, ClassLoader loader, Properties target)
throws IOException
{
InputStream in = getStream(path, loader);
if (in == null) {
throw new FileNotFoundException(path);
}
target.load(in);
in.close();
} | java | public static void loadProperties (String path, ClassLoader loader, Properties target)
throws IOException
{
InputStream in = getStream(path, loader);
if (in == null) {
throw new FileNotFoundException(path);
}
target.load(in);
in.close();
} | [
"public",
"static",
"void",
"loadProperties",
"(",
"String",
"path",
",",
"ClassLoader",
"loader",
",",
"Properties",
"target",
")",
"throws",
"IOException",
"{",
"InputStream",
"in",
"=",
"getStream",
"(",
"path",
",",
"loader",
")",
";",
"if",
"(",
"in",
... | Like {@link #loadProperties(String,ClassLoader)} but the properties are loaded into the
supplied {@link Properties} object. | [
"Like",
"{"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ConfigUtil.java#L78-L87 |
Cleveroad/AdaptiveTableLayout | library/src/main/java/com/cleveroad/adaptivetablelayout/LinkedAdaptiveTableAdapter.java | LinkedAdaptiveTableAdapter.notifyItemChanged | @Override
public void notifyItemChanged(int rowIndex, int columnIndex) {
for (AdaptiveTableDataSetObserver observer : mAdaptiveTableDataSetObservers) {
observer.notifyItemChanged(rowIndex, columnIndex);
}
} | java | @Override
public void notifyItemChanged(int rowIndex, int columnIndex) {
for (AdaptiveTableDataSetObserver observer : mAdaptiveTableDataSetObservers) {
observer.notifyItemChanged(rowIndex, columnIndex);
}
} | [
"@",
"Override",
"public",
"void",
"notifyItemChanged",
"(",
"int",
"rowIndex",
",",
"int",
"columnIndex",
")",
"{",
"for",
"(",
"AdaptiveTableDataSetObserver",
"observer",
":",
"mAdaptiveTableDataSetObservers",
")",
"{",
"observer",
".",
"notifyItemChanged",
"(",
"... | {@inheritDoc}
@param rowIndex the row index
@param columnIndex the column index | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/Cleveroad/AdaptiveTableLayout/blob/188213b35e05e635497b03fe741799782dde7208/library/src/main/java/com/cleveroad/adaptivetablelayout/LinkedAdaptiveTableAdapter.java#L97-L102 |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java | AbstractBoundaryEventBuilder.errorEventDefinition | public ErrorEventDefinitionBuilder errorEventDefinition(String id) {
ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition();
if (id != null) {
errorEventDefinition.setId(id);
}
element.getEventDefinitions().add(errorEventDefinition);
return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition);
} | java | public ErrorEventDefinitionBuilder errorEventDefinition(String id) {
ErrorEventDefinition errorEventDefinition = createEmptyErrorEventDefinition();
if (id != null) {
errorEventDefinition.setId(id);
}
element.getEventDefinitions().add(errorEventDefinition);
return new ErrorEventDefinitionBuilder(modelInstance, errorEventDefinition);
} | [
"public",
"ErrorEventDefinitionBuilder",
"errorEventDefinition",
"(",
"String",
"id",
")",
"{",
"ErrorEventDefinition",
"errorEventDefinition",
"=",
"createEmptyErrorEventDefinition",
"(",
")",
";",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"errorEventDefinition",
".",
... | Creates an error event definition with an unique id
and returns a builder for the error event definition.
@return the error event definition builder object | [
"Creates",
"an",
"error",
"event",
"definition",
"with",
"an",
"unique",
"id",
"and",
"returns",
"a",
"builder",
"for",
"the",
"error",
"event",
"definition",
"."
] | train | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractBoundaryEventBuilder.java#L79-L87 |
google/error-prone-javac | src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java | Util.remoteInputOutput | public static ExecutionControl remoteInputOutput(InputStream input, OutputStream output,
Map<String, OutputStream> outputStreamMap, Map<String, InputStream> inputStreamMap,
BiFunction<ObjectInput, ObjectOutput, ExecutionControl> factory) throws IOException {
ExecutionControl[] result = new ExecutionControl[1];
Map<String, OutputStream> augmentedStreamMap = new HashMap<>(outputStreamMap);
ObjectOutput commandOut = new ObjectOutputStream(Util.multiplexingOutputStream("$command", output));
for (Entry<String, InputStream> e : inputStreamMap.entrySet()) {
InputStream in = e.getValue();
OutputStream inTarget = Util.multiplexingOutputStream(e.getKey(), output);
augmentedStreamMap.put("$" + e.getKey() + "-input-requested", new OutputStream() {
@Override
public void write(int b) throws IOException {
//value ignored, just a trigger to read from the input
try {
int r = in.read();
if (r == (-1)) {
inTarget.write(TAG_CLOSED);
} else {
inTarget.write(new byte[] {TAG_DATA, (byte) r});
}
} catch (InterruptedIOException exc) {
try {
result[0].stop();
} catch (ExecutionControlException ex) {
debug(ex, "$" + e.getKey() + "-input-requested.write");
}
} catch (IOException exc) {
byte[] message = exc.getMessage().getBytes("UTF-8");
inTarget.write(TAG_EXCEPTION);
inTarget.write((message.length >> 0) & 0xFF);
inTarget.write((message.length >> 8) & 0xFF);
inTarget.write((message.length >> 16) & 0xFF);
inTarget.write((message.length >> 24) & 0xFF);
inTarget.write(message);
}
}
});
}
PipeInputStream commandIn = new PipeInputStream();
OutputStream commandInTarget = commandIn.createOutput();
augmentedStreamMap.put("$command", commandInTarget);
new DemultiplexInput(input, augmentedStreamMap, Arrays.asList(commandInTarget)).start();
return result[0] = factory.apply(new ObjectInputStream(commandIn), commandOut);
} | java | public static ExecutionControl remoteInputOutput(InputStream input, OutputStream output,
Map<String, OutputStream> outputStreamMap, Map<String, InputStream> inputStreamMap,
BiFunction<ObjectInput, ObjectOutput, ExecutionControl> factory) throws IOException {
ExecutionControl[] result = new ExecutionControl[1];
Map<String, OutputStream> augmentedStreamMap = new HashMap<>(outputStreamMap);
ObjectOutput commandOut = new ObjectOutputStream(Util.multiplexingOutputStream("$command", output));
for (Entry<String, InputStream> e : inputStreamMap.entrySet()) {
InputStream in = e.getValue();
OutputStream inTarget = Util.multiplexingOutputStream(e.getKey(), output);
augmentedStreamMap.put("$" + e.getKey() + "-input-requested", new OutputStream() {
@Override
public void write(int b) throws IOException {
//value ignored, just a trigger to read from the input
try {
int r = in.read();
if (r == (-1)) {
inTarget.write(TAG_CLOSED);
} else {
inTarget.write(new byte[] {TAG_DATA, (byte) r});
}
} catch (InterruptedIOException exc) {
try {
result[0].stop();
} catch (ExecutionControlException ex) {
debug(ex, "$" + e.getKey() + "-input-requested.write");
}
} catch (IOException exc) {
byte[] message = exc.getMessage().getBytes("UTF-8");
inTarget.write(TAG_EXCEPTION);
inTarget.write((message.length >> 0) & 0xFF);
inTarget.write((message.length >> 8) & 0xFF);
inTarget.write((message.length >> 16) & 0xFF);
inTarget.write((message.length >> 24) & 0xFF);
inTarget.write(message);
}
}
});
}
PipeInputStream commandIn = new PipeInputStream();
OutputStream commandInTarget = commandIn.createOutput();
augmentedStreamMap.put("$command", commandInTarget);
new DemultiplexInput(input, augmentedStreamMap, Arrays.asList(commandInTarget)).start();
return result[0] = factory.apply(new ObjectInputStream(commandIn), commandOut);
} | [
"public",
"static",
"ExecutionControl",
"remoteInputOutput",
"(",
"InputStream",
"input",
",",
"OutputStream",
"output",
",",
"Map",
"<",
"String",
",",
"OutputStream",
">",
"outputStreamMap",
",",
"Map",
"<",
"String",
",",
"InputStream",
">",
"inputStreamMap",
"... | Creates an ExecutionControl for given packetized input and output. The given InputStream
is de-packetized, and content forwarded to ObjectInput and given OutputStreams. The ObjectOutput
and values read from the given InputStream are packetized and sent to the given OutputStream.
@param input the packetized input stream
@param output the packetized output stream
@param outputStreamMap a map between stream names and the output streams to forward.
Names starting with '$' are reserved for internal use.
@param inputStreamMap a map between stream names and the input streams to forward.
Names starting with '$' are reserved for internal use.
@param factory to create the ExecutionControl from ObjectInput and ObjectOutput.
@return the created ExecutionControl
@throws IOException if setting up the streams raised an exception | [
"Creates",
"an",
"ExecutionControl",
"for",
"given",
"packetized",
"input",
"and",
"output",
".",
"The",
"given",
"InputStream",
"is",
"de",
"-",
"packetized",
"and",
"content",
"forwarded",
"to",
"ObjectInput",
"and",
"given",
"OutputStreams",
".",
"The",
"Obje... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java#L159-L202 |
gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java | ElementService.dragElementTo | public void dragElementTo(By draggable, int x, int y) throws InterruptedException {
WebDriver driver = getWebDriver();
Actions clickAndDrag = new Actions(getWebDriver());
clickAndDrag.dragAndDropBy(driver.findElement(draggable), x, y);
clickAndDrag.perform();
} | java | public void dragElementTo(By draggable, int x, int y) throws InterruptedException {
WebDriver driver = getWebDriver();
Actions clickAndDrag = new Actions(getWebDriver());
clickAndDrag.dragAndDropBy(driver.findElement(draggable), x, y);
clickAndDrag.perform();
} | [
"public",
"void",
"dragElementTo",
"(",
"By",
"draggable",
",",
"int",
"x",
",",
"int",
"y",
")",
"throws",
"InterruptedException",
"{",
"WebDriver",
"driver",
"=",
"getWebDriver",
"(",
")",
";",
"Actions",
"clickAndDrag",
"=",
"new",
"Actions",
"(",
"getWeb... | Drags an element some place else
@param draggable
The element to drag
@param x
Offset
@param y
Offset
@throws InterruptedException | [
"Drags",
"an",
"element",
"some",
"place",
"else"
] | train | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ElementService.java#L351-L357 |
spring-projects/spring-loaded | springloaded/src/main/java/org/springsource/loaded/Utils.java | Utils.isAssignableFrom | public static boolean isAssignableFrom(String lookingFor, TypeDescriptor candidate) {
String[] interfaces = candidate.getSuperinterfacesName();
for (String intface : interfaces) {
if (intface.equals(lookingFor)) {
return true;
}
boolean b = isAssignableFrom(lookingFor, candidate.getTypeRegistry().getDescriptorFor(intface));
if (b) {
return true;
}
}
String supertypename = candidate.getSupertypeName();
if (supertypename == null) {
return false;
}
if (supertypename.equals(lookingFor)) {
return true;
}
return isAssignableFrom(lookingFor, candidate.getTypeRegistry().getDescriptorFor(supertypename));
} | java | public static boolean isAssignableFrom(String lookingFor, TypeDescriptor candidate) {
String[] interfaces = candidate.getSuperinterfacesName();
for (String intface : interfaces) {
if (intface.equals(lookingFor)) {
return true;
}
boolean b = isAssignableFrom(lookingFor, candidate.getTypeRegistry().getDescriptorFor(intface));
if (b) {
return true;
}
}
String supertypename = candidate.getSupertypeName();
if (supertypename == null) {
return false;
}
if (supertypename.equals(lookingFor)) {
return true;
}
return isAssignableFrom(lookingFor, candidate.getTypeRegistry().getDescriptorFor(supertypename));
} | [
"public",
"static",
"boolean",
"isAssignableFrom",
"(",
"String",
"lookingFor",
",",
"TypeDescriptor",
"candidate",
")",
"{",
"String",
"[",
"]",
"interfaces",
"=",
"candidate",
".",
"getSuperinterfacesName",
"(",
")",
";",
"for",
"(",
"String",
"intface",
":",
... | /*
Determine if the type specified in lookingFor is a supertype (class/interface) of the specified typedescriptor, i.e. can an
object of type 'candidate' be assigned to a variable of typ 'lookingFor'.
@return true if it is a supertype | [
"/",
"*",
"Determine",
"if",
"the",
"type",
"specified",
"in",
"lookingFor",
"is",
"a",
"supertype",
"(",
"class",
"/",
"interface",
")",
"of",
"the",
"specified",
"typedescriptor",
"i",
".",
"e",
".",
"can",
"an",
"object",
"of",
"type",
"candidate",
"b... | train | https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/Utils.java#L1662-L1681 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/DdosProtectionPlansInner.java | DdosProtectionPlansInner.createOrUpdateAsync | public Observable<DdosProtectionPlanInner> createOrUpdateAsync(String resourceGroupName, String ddosProtectionPlanName, DdosProtectionPlanInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, parameters).map(new Func1<ServiceResponse<DdosProtectionPlanInner>, DdosProtectionPlanInner>() {
@Override
public DdosProtectionPlanInner call(ServiceResponse<DdosProtectionPlanInner> response) {
return response.body();
}
});
} | java | public Observable<DdosProtectionPlanInner> createOrUpdateAsync(String resourceGroupName, String ddosProtectionPlanName, DdosProtectionPlanInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName, parameters).map(new Func1<ServiceResponse<DdosProtectionPlanInner>, DdosProtectionPlanInner>() {
@Override
public DdosProtectionPlanInner call(ServiceResponse<DdosProtectionPlanInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DdosProtectionPlanInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"ddosProtectionPlanName",
",",
"DdosProtectionPlanInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"r... | Creates or updates a DDoS protection plan.
@param resourceGroupName The name of the resource group.
@param ddosProtectionPlanName The name of the DDoS protection plan.
@param parameters Parameters supplied to the create or update operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"DDoS",
"protection",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/DdosProtectionPlansInner.java#L378-L385 |
xcesco/kripton | kripton-arch-integration/src/main/java/android/arch/lifecycle/MediatorLiveData.java | MediatorLiveData.addSource | @MainThread
public <S> void addSource(@NonNull LiveData<S> source, @NonNull Observer<S> onChanged) {
Source<S> e = new Source<>(source, onChanged);
Source<?> existing = mSources.putIfAbsent(source, e);
if (existing != null && existing.mObserver != onChanged) {
throw new IllegalArgumentException(
"This source was already added with the different observer");
}
if (existing != null) {
return;
}
if (hasActiveObservers()) {
e.plug();
}
} | java | @MainThread
public <S> void addSource(@NonNull LiveData<S> source, @NonNull Observer<S> onChanged) {
Source<S> e = new Source<>(source, onChanged);
Source<?> existing = mSources.putIfAbsent(source, e);
if (existing != null && existing.mObserver != onChanged) {
throw new IllegalArgumentException(
"This source was already added with the different observer");
}
if (existing != null) {
return;
}
if (hasActiveObservers()) {
e.plug();
}
} | [
"@",
"MainThread",
"public",
"<",
"S",
">",
"void",
"addSource",
"(",
"@",
"NonNull",
"LiveData",
"<",
"S",
">",
"source",
",",
"@",
"NonNull",
"Observer",
"<",
"S",
">",
"onChanged",
")",
"{",
"Source",
"<",
"S",
">",
"e",
"=",
"new",
"Source",
"<... | Starts to listen the given {@code source} LiveData, {@code onChanged} observer will be called
when {@code source} value was changed.
<p>
{@code onChanged} callback will be called only when this {@code MediatorLiveData} is active.
<p> If the given LiveData is already added as a source but with a different Observer,
{@link IllegalArgumentException} will be thrown.
@param <S> The type of data hold by {@code source} LiveData
@param source the {@code LiveData} to listen to
@param onChanged The observer that will receive the events | [
"Starts",
"to",
"listen",
"the",
"given",
"{",
"@code",
"source",
"}",
"LiveData",
"{",
"@code",
"onChanged",
"}",
"observer",
"will",
"be",
"called",
"when",
"{",
"@code",
"source",
"}",
"value",
"was",
"changed",
".",
"<p",
">",
"{",
"@code",
"onChange... | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-arch-integration/src/main/java/android/arch/lifecycle/MediatorLiveData.java#L85-L99 |
headius/invokebinder | src/main/java/com/headius/invokebinder/SmartBinder.java | SmartBinder.invokeStaticQuiet | public SmartHandle invokeStaticQuiet(Lookup lookup, Class<?> target, String name) {
return new SmartHandle(start, binder.invokeStaticQuiet(lookup, target, name));
} | java | public SmartHandle invokeStaticQuiet(Lookup lookup, Class<?> target, String name) {
return new SmartHandle(start, binder.invokeStaticQuiet(lookup, target, name));
} | [
"public",
"SmartHandle",
"invokeStaticQuiet",
"(",
"Lookup",
"lookup",
",",
"Class",
"<",
"?",
">",
"target",
",",
"String",
"name",
")",
"{",
"return",
"new",
"SmartHandle",
"(",
"start",
",",
"binder",
".",
"invokeStaticQuiet",
"(",
"lookup",
",",
"target"... | Terminate this binder by looking up the named static method on the
given target type. Perform the actual method lookup using the given
Lookup object. If the lookup fails, a RuntimeException will be raised,
containing the actual reason. This method is for convenience in (for
example) field declarations, where checked exceptions noise up code
that can't recover anyway.
Use this in situations where you would not expect your library to be
usable if the target method can't be acquired.
@param lookup the Lookup to use for handle lookups
@param target the type on which to find the static method
@param name the name of the target static method
@return a SmartHandle with this binder's starting signature, bound
to the target method | [
"Terminate",
"this",
"binder",
"by",
"looking",
"up",
"the",
"named",
"static",
"method",
"on",
"the",
"given",
"target",
"type",
".",
"Perform",
"the",
"actual",
"method",
"lookup",
"using",
"the",
"given",
"Lookup",
"object",
".",
"If",
"the",
"lookup",
... | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/SmartBinder.java#L1039-L1041 |
Netflix/Hystrix | hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesStrategy.java | HystrixPropertiesStrategy.getThreadPoolProperties | public HystrixThreadPoolProperties getThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties.Setter builder) {
return new HystrixPropertiesThreadPoolDefault(threadPoolKey, builder);
} | java | public HystrixThreadPoolProperties getThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties.Setter builder) {
return new HystrixPropertiesThreadPoolDefault(threadPoolKey, builder);
} | [
"public",
"HystrixThreadPoolProperties",
"getThreadPoolProperties",
"(",
"HystrixThreadPoolKey",
"threadPoolKey",
",",
"HystrixThreadPoolProperties",
".",
"Setter",
"builder",
")",
"{",
"return",
"new",
"HystrixPropertiesThreadPoolDefault",
"(",
"threadPoolKey",
",",
"builder",... | Construct an implementation of {@link HystrixThreadPoolProperties} for {@link HystrixThreadPool} instances with {@link HystrixThreadPoolKey}.
<p>
<b>Default Implementation</b>
<p>
Constructs instance of {@link HystrixPropertiesThreadPoolDefault}.
@param threadPoolKey
{@link HystrixThreadPoolKey} representing the name or type of {@link HystrixThreadPool}
@param builder
{@link com.netflix.hystrix.HystrixThreadPoolProperties.Setter} with default overrides as injected via {@link HystrixCommand} to the {@link HystrixThreadPool} implementation.
<p>
The builder will return NULL for each value if no override was provided.
@return Implementation of {@link HystrixThreadPoolProperties} | [
"Construct",
"an",
"implementation",
"of",
"{",
"@link",
"HystrixThreadPoolProperties",
"}",
"for",
"{",
"@link",
"HystrixThreadPool",
"}",
"instances",
"with",
"{",
"@link",
"HystrixThreadPoolKey",
"}",
".",
"<p",
">",
"<b",
">",
"Default",
"Implementation<",
"/"... | train | https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesStrategy.java#L92-L94 |
kaazing/gateway | transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpMergeRequestFilter.java | HttpMergeRequestFilter.mergeRequests | private boolean mergeRequests(HttpRequestMessage from, HttpRequestMessage to) {
if (from == null || to == null) {
return false;
}
final URI initialRequestURI = from.getRequestURI();
final URI extendedRequestURI = to.getRequestURI();
boolean uriPathOk = initialRequestURI.getPath().equals(extendedRequestURI.getPath());
if ( !uriPathOk ) {
return false;
}
// Note: the fact that "Host" is an allowance was required by KG-3481.
final String[] allowances = {"Host", "Sec-WebSocket-Protocol", HEADER_SEC_WEBSOCKET_EXTENSIONS, "Connection"};
if ( HttpUtils.containsForbiddenHeaders(to, allowances) ) {
return false;
}
final String[] restrictions = {"Authorization", "X-WebSocket-Protocol", "WebSocket-Protocol", "Sec-WebSocket-Protocol",
HEADER_X_WEBSOCKET_EXTENSIONS, HEADER_WEBSOCKET_EXTENSIONS, HEADER_SEC_WEBSOCKET_EXTENSIONS};
HttpUtils.restrictHeaders(to, restrictions);
final String[] ignoreHeaders = {HEADER_X_WEBSOCKET_EXTENSIONS,
HEADER_WEBSOCKET_EXTENSIONS,
HEADER_SEC_WEBSOCKET_EXTENSIONS};
HttpUtils.mergeHeaders(from, to, ignoreHeaders);
final String[] protocolHeaders = {"X-WebSocket-Protocol", "WebSocket-Protocol", "Sec-WebSocket-Protocol"};
HttpUtils.removeValueFromHeaders(to, protocolHeaders, EXTENDED_HANDSHAKE_PROTOCOL_NAME);
HttpUtils.mergeParameters(from, to);
HttpUtils.mergeCookies(from, to);
return true;
} | java | private boolean mergeRequests(HttpRequestMessage from, HttpRequestMessage to) {
if (from == null || to == null) {
return false;
}
final URI initialRequestURI = from.getRequestURI();
final URI extendedRequestURI = to.getRequestURI();
boolean uriPathOk = initialRequestURI.getPath().equals(extendedRequestURI.getPath());
if ( !uriPathOk ) {
return false;
}
// Note: the fact that "Host" is an allowance was required by KG-3481.
final String[] allowances = {"Host", "Sec-WebSocket-Protocol", HEADER_SEC_WEBSOCKET_EXTENSIONS, "Connection"};
if ( HttpUtils.containsForbiddenHeaders(to, allowances) ) {
return false;
}
final String[] restrictions = {"Authorization", "X-WebSocket-Protocol", "WebSocket-Protocol", "Sec-WebSocket-Protocol",
HEADER_X_WEBSOCKET_EXTENSIONS, HEADER_WEBSOCKET_EXTENSIONS, HEADER_SEC_WEBSOCKET_EXTENSIONS};
HttpUtils.restrictHeaders(to, restrictions);
final String[] ignoreHeaders = {HEADER_X_WEBSOCKET_EXTENSIONS,
HEADER_WEBSOCKET_EXTENSIONS,
HEADER_SEC_WEBSOCKET_EXTENSIONS};
HttpUtils.mergeHeaders(from, to, ignoreHeaders);
final String[] protocolHeaders = {"X-WebSocket-Protocol", "WebSocket-Protocol", "Sec-WebSocket-Protocol"};
HttpUtils.removeValueFromHeaders(to, protocolHeaders, EXTENDED_HANDSHAKE_PROTOCOL_NAME);
HttpUtils.mergeParameters(from, to);
HttpUtils.mergeCookies(from, to);
return true;
} | [
"private",
"boolean",
"mergeRequests",
"(",
"HttpRequestMessage",
"from",
",",
"HttpRequestMessage",
"to",
")",
"{",
"if",
"(",
"from",
"==",
"null",
"||",
"to",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"final",
"URI",
"initialRequestURI",
"=",
... | Return true iff the extended request matches the initial request.
<p/>
This function, when returning true, additionally ensures that the extended request
contains no illegal headers, and has had selected header elements from the initial
request merged into the extended request.
@param from the initial request
@param to the extended request, possibly amended with a merged set of headers.
@return true iff the extended request is the same as the initial request. | [
"Return",
"true",
"iff",
"the",
"extended",
"request",
"matches",
"the",
"initial",
"request",
".",
"<p",
"/",
">",
"This",
"function",
"when",
"returning",
"true",
"additionally",
"ensures",
"that",
"the",
"extended",
"request",
"contains",
"no",
"illegal",
"... | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpMergeRequestFilter.java#L348-L388 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/StatementsForClassImpl.java | StatementsForClassImpl.createStatement | private Statement createStatement(Connection con, boolean scrollable, int explicitFetchSizeHint)
throws java.sql.SQLException
{
Statement result;
try
{
// if necessary use JDBC1.0 methods
if (!FORCEJDBC1_0)
{
result =
con.createStatement(
scrollable
? ResultSet.TYPE_SCROLL_INSENSITIVE
: ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
afterJdbc2CapableStatementCreate(result, explicitFetchSizeHint);
}
else
{
result = con.createStatement();
}
}
catch (AbstractMethodError err)
{
// if a JDBC1.0 driver is used, the signature
// createStatement(int, int) is not defined.
// we then call the JDBC1.0 variant createStatement()
log.warn("Used driver seems not JDBC 2.0 compatible, use the JDBC 1.0 mode", err);
result = con.createStatement();
FORCEJDBC1_0 = true;
}
catch (SQLException eSql)
{
// there are JDBC Driver that nominally implement JDBC 2.0, but
// throw DriverNotCapableExceptions. If we catch one of these
// we force usage of JDBC 1.0
if (eSql.getClass().getName()
.equals("interbase.interclient.DriverNotCapableException"))
{
log.warn("JDBC 2.0 problems with this interbase driver, we use the JDBC 1.0 mode");
FORCEJDBC1_0 = true;
result = con.createStatement();
}
else
{
throw eSql;
}
}
try
{
platform.afterStatementCreate(result);
}
catch (PlatformException e)
{
log.error("Platform dependend failure", e);
}
return result;
} | java | private Statement createStatement(Connection con, boolean scrollable, int explicitFetchSizeHint)
throws java.sql.SQLException
{
Statement result;
try
{
// if necessary use JDBC1.0 methods
if (!FORCEJDBC1_0)
{
result =
con.createStatement(
scrollable
? ResultSet.TYPE_SCROLL_INSENSITIVE
: ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
afterJdbc2CapableStatementCreate(result, explicitFetchSizeHint);
}
else
{
result = con.createStatement();
}
}
catch (AbstractMethodError err)
{
// if a JDBC1.0 driver is used, the signature
// createStatement(int, int) is not defined.
// we then call the JDBC1.0 variant createStatement()
log.warn("Used driver seems not JDBC 2.0 compatible, use the JDBC 1.0 mode", err);
result = con.createStatement();
FORCEJDBC1_0 = true;
}
catch (SQLException eSql)
{
// there are JDBC Driver that nominally implement JDBC 2.0, but
// throw DriverNotCapableExceptions. If we catch one of these
// we force usage of JDBC 1.0
if (eSql.getClass().getName()
.equals("interbase.interclient.DriverNotCapableException"))
{
log.warn("JDBC 2.0 problems with this interbase driver, we use the JDBC 1.0 mode");
FORCEJDBC1_0 = true;
result = con.createStatement();
}
else
{
throw eSql;
}
}
try
{
platform.afterStatementCreate(result);
}
catch (PlatformException e)
{
log.error("Platform dependend failure", e);
}
return result;
} | [
"private",
"Statement",
"createStatement",
"(",
"Connection",
"con",
",",
"boolean",
"scrollable",
",",
"int",
"explicitFetchSizeHint",
")",
"throws",
"java",
".",
"sql",
".",
"SQLException",
"{",
"Statement",
"result",
";",
"try",
"{",
"// if necessary use JDBC1.0 ... | Creates a statement with parameters that should work with most RDBMS. | [
"Creates",
"a",
"statement",
"with",
"parameters",
"that",
"should",
"work",
"with",
"most",
"RDBMS",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementsForClassImpl.java#L352-L409 |
perwendel/spark | src/main/java/spark/embeddedserver/jetty/SocketConnectorFactory.java | SocketConnectorFactory.createSecureSocketConnector | public static ServerConnector createSecureSocketConnector(Server server,
String host,
int port,
SslStores sslStores) {
Assert.notNull(server, "'server' must not be null");
Assert.notNull(host, "'host' must not be null");
Assert.notNull(sslStores, "'sslStores' must not be null");
SslContextFactory sslContextFactory = new SslContextFactory(sslStores.keystoreFile());
if (sslStores.keystorePassword() != null) {
sslContextFactory.setKeyStorePassword(sslStores.keystorePassword());
}
if (sslStores.certAlias() != null) {
sslContextFactory.setCertAlias(sslStores.certAlias());
}
if (sslStores.trustStoreFile() != null) {
sslContextFactory.setTrustStorePath(sslStores.trustStoreFile());
}
if (sslStores.trustStorePassword() != null) {
sslContextFactory.setTrustStorePassword(sslStores.trustStorePassword());
}
if (sslStores.needsClientCert()) {
sslContextFactory.setNeedClientAuth(true);
sslContextFactory.setWantClientAuth(true);
}
HttpConnectionFactory httpConnectionFactory = createHttpConnectionFactory();
ServerConnector connector = new ServerConnector(server, sslContextFactory, httpConnectionFactory);
initializeConnector(connector, host, port);
return connector;
} | java | public static ServerConnector createSecureSocketConnector(Server server,
String host,
int port,
SslStores sslStores) {
Assert.notNull(server, "'server' must not be null");
Assert.notNull(host, "'host' must not be null");
Assert.notNull(sslStores, "'sslStores' must not be null");
SslContextFactory sslContextFactory = new SslContextFactory(sslStores.keystoreFile());
if (sslStores.keystorePassword() != null) {
sslContextFactory.setKeyStorePassword(sslStores.keystorePassword());
}
if (sslStores.certAlias() != null) {
sslContextFactory.setCertAlias(sslStores.certAlias());
}
if (sslStores.trustStoreFile() != null) {
sslContextFactory.setTrustStorePath(sslStores.trustStoreFile());
}
if (sslStores.trustStorePassword() != null) {
sslContextFactory.setTrustStorePassword(sslStores.trustStorePassword());
}
if (sslStores.needsClientCert()) {
sslContextFactory.setNeedClientAuth(true);
sslContextFactory.setWantClientAuth(true);
}
HttpConnectionFactory httpConnectionFactory = createHttpConnectionFactory();
ServerConnector connector = new ServerConnector(server, sslContextFactory, httpConnectionFactory);
initializeConnector(connector, host, port);
return connector;
} | [
"public",
"static",
"ServerConnector",
"createSecureSocketConnector",
"(",
"Server",
"server",
",",
"String",
"host",
",",
"int",
"port",
",",
"SslStores",
"sslStores",
")",
"{",
"Assert",
".",
"notNull",
"(",
"server",
",",
"\"'server' must not be null\"",
")",
"... | Creates a ssl jetty socket jetty. Keystore required, truststore
optional. If truststore not specified keystore will be reused.
@param server Jetty server
@param sslStores the security sslStores.
@param host host
@param port port
@return a ssl socket jetty | [
"Creates",
"a",
"ssl",
"jetty",
"socket",
"jetty",
".",
"Keystore",
"required",
"truststore",
"optional",
".",
"If",
"truststore",
"not",
"specified",
"keystore",
"will",
"be",
"reused",
"."
] | train | https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/embeddedserver/jetty/SocketConnectorFactory.java#L64-L100 |
real-logic/agrona | agrona/src/main/java/org/agrona/BufferUtil.java | BufferUtil.allocateDirectAligned | public static ByteBuffer allocateDirectAligned(final int capacity, final int alignment)
{
if (!isPowerOfTwo(alignment))
{
throw new IllegalArgumentException("Must be a power of 2: alignment=" + alignment);
}
final ByteBuffer buffer = ByteBuffer.allocateDirect(capacity + alignment);
final long address = address(buffer);
final int remainder = (int)(address & (alignment - 1));
final int offset = alignment - remainder;
buffer.limit(capacity + offset);
buffer.position(offset);
return buffer.slice();
} | java | public static ByteBuffer allocateDirectAligned(final int capacity, final int alignment)
{
if (!isPowerOfTwo(alignment))
{
throw new IllegalArgumentException("Must be a power of 2: alignment=" + alignment);
}
final ByteBuffer buffer = ByteBuffer.allocateDirect(capacity + alignment);
final long address = address(buffer);
final int remainder = (int)(address & (alignment - 1));
final int offset = alignment - remainder;
buffer.limit(capacity + offset);
buffer.position(offset);
return buffer.slice();
} | [
"public",
"static",
"ByteBuffer",
"allocateDirectAligned",
"(",
"final",
"int",
"capacity",
",",
"final",
"int",
"alignment",
")",
"{",
"if",
"(",
"!",
"isPowerOfTwo",
"(",
"alignment",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must be a... | Allocate a new direct {@link ByteBuffer} that is aligned on a given alignment boundary.
@param capacity required for the buffer.
@param alignment boundary at which the buffer should begin.
@return a new {@link ByteBuffer} with the required alignment.
@throws IllegalArgumentException if the alignment is not a power of 2. | [
"Allocate",
"a",
"new",
"direct",
"{",
"@link",
"ByteBuffer",
"}",
"that",
"is",
"aligned",
"on",
"a",
"given",
"alignment",
"boundary",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/BufferUtil.java#L139-L156 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java | Utils.isCompatibleSARLLibraryOnClasspath | public static boolean isCompatibleSARLLibraryOnClasspath(TypeReferences typeReferences, Notifier context) {
final OutParameter<String> version = new OutParameter<>();
final SarlLibraryErrorCode code = getSARLLibraryVersionOnClasspath(typeReferences, context, version);
if (code == SarlLibraryErrorCode.SARL_FOUND) {
return isCompatibleSARLLibraryVersion(version.get());
}
return false;
} | java | public static boolean isCompatibleSARLLibraryOnClasspath(TypeReferences typeReferences, Notifier context) {
final OutParameter<String> version = new OutParameter<>();
final SarlLibraryErrorCode code = getSARLLibraryVersionOnClasspath(typeReferences, context, version);
if (code == SarlLibraryErrorCode.SARL_FOUND) {
return isCompatibleSARLLibraryVersion(version.get());
}
return false;
} | [
"public",
"static",
"boolean",
"isCompatibleSARLLibraryOnClasspath",
"(",
"TypeReferences",
"typeReferences",
",",
"Notifier",
"context",
")",
"{",
"final",
"OutParameter",
"<",
"String",
">",
"version",
"=",
"new",
"OutParameter",
"<>",
"(",
")",
";",
"final",
"S... | Check if a compatible SARL library is available on the classpath.
@param typeReferences - the accessor to the types.
@param context - the context that is providing the access to the classpath.
@return <code>true</code> if a compatible SARL library was found.
Otherwise <code>false</code>. | [
"Check",
"if",
"a",
"compatible",
"SARL",
"library",
"is",
"available",
"on",
"the",
"classpath",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L1047-L1054 |
wisdom-framework/wisdom-jdbc | wisdom-openjpa-enhancer-plugin/src/main/java/org/wisdom/openjpa/enhancer/OpenJPAEnhancerMojo.java | OpenJPAEnhancerMojo.extendRealmClasspath | protected void extendRealmClasspath()
throws MojoExecutionException {
List<URL> urls = new ArrayList<>();
for (String fileName : compileClasspathElements) {
File pathElem = new File(fileName);
try {
URL url = pathElem.toURI().toURL();
urls.add(url);
getLog().debug("Added classpathElement URL " + url);
} catch (MalformedURLException e) {
throw new MojoExecutionException("Error in adding the classpath " + pathElem, e);
}
}
ClassLoader jpaRealm =
new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader());
// set the new ClassLoader as default for this Thread
// will be reverted in the caller method.
Thread.currentThread().setContextClassLoader(jpaRealm);
} | java | protected void extendRealmClasspath()
throws MojoExecutionException {
List<URL> urls = new ArrayList<>();
for (String fileName : compileClasspathElements) {
File pathElem = new File(fileName);
try {
URL url = pathElem.toURI().toURL();
urls.add(url);
getLog().debug("Added classpathElement URL " + url);
} catch (MalformedURLException e) {
throw new MojoExecutionException("Error in adding the classpath " + pathElem, e);
}
}
ClassLoader jpaRealm =
new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader());
// set the new ClassLoader as default for this Thread
// will be reverted in the caller method.
Thread.currentThread().setContextClassLoader(jpaRealm);
} | [
"protected",
"void",
"extendRealmClasspath",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"List",
"<",
"URL",
">",
"urls",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"fileName",
":",
"compileClasspathElements",
")",
"{",
"File",
... | This will prepare the current ClassLoader and add all jars and local
classpaths (e.g. target/classes) needed by the OpenJPA task.
@throws MojoExecutionException on any error inside the mojo | [
"This",
"will",
"prepare",
"the",
"current",
"ClassLoader",
"and",
"add",
"all",
"jars",
"and",
"local",
"classpaths",
"(",
"e",
".",
"g",
".",
"target",
"/",
"classes",
")",
"needed",
"by",
"the",
"OpenJPA",
"task",
"."
] | train | https://github.com/wisdom-framework/wisdom-jdbc/blob/931f5acf0b2bcb0a8f3b683d60d326caafd09a72/wisdom-openjpa-enhancer-plugin/src/main/java/org/wisdom/openjpa/enhancer/OpenJPAEnhancerMojo.java#L320-L341 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addAnnotationInfo | public void addAnnotationInfo(ProgramElementDoc doc, Content htmltree) {
addAnnotationInfo(doc, doc.annotations(), htmltree);
} | java | public void addAnnotationInfo(ProgramElementDoc doc, Content htmltree) {
addAnnotationInfo(doc, doc.annotations(), htmltree);
} | [
"public",
"void",
"addAnnotationInfo",
"(",
"ProgramElementDoc",
"doc",
",",
"Content",
"htmltree",
")",
"{",
"addAnnotationInfo",
"(",
"doc",
",",
"doc",
".",
"annotations",
"(",
")",
",",
"htmltree",
")",
";",
"}"
] | Adds the annotatation types for the given doc.
@param doc the package to write annotations for
@param htmltree the content tree to which the annotation types will be added | [
"Adds",
"the",
"annotatation",
"types",
"for",
"the",
"given",
"doc",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1861-L1863 |
luontola/jumi | jumi-core/src/main/java/fi/jumi/core/network/NettyNetworkEndpointAdapter.java | NettyNetworkEndpointAdapter.channelClosed | @Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
endpoint.onDisconnected();
super.channelClosed(ctx, e);
} | java | @Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
endpoint.onDisconnected();
super.channelClosed(ctx, e);
} | [
"@",
"Override",
"public",
"void",
"channelClosed",
"(",
"ChannelHandlerContext",
"ctx",
",",
"ChannelStateEvent",
"e",
")",
"throws",
"Exception",
"{",
"endpoint",
".",
"onDisconnected",
"(",
")",
";",
"super",
".",
"channelClosed",
"(",
"ctx",
",",
"e",
")",... | of those events comes, even though the channelConnected came. Using just channelClosed appears to be reliable. | [
"of",
"those",
"events",
"comes",
"even",
"though",
"the",
"channelConnected",
"came",
".",
"Using",
"just",
"channelClosed",
"appears",
"to",
"be",
"reliable",
"."
] | train | https://github.com/luontola/jumi/blob/18815c499b770f51cdb58cc6720dca4f254b2019/jumi-core/src/main/java/fi/jumi/core/network/NettyNetworkEndpointAdapter.java#L37-L41 |
junit-team/junit4 | src/main/java/org/junit/runner/FilterFactories.java | FilterFactories.createFilter | public static Filter createFilter(Class<? extends FilterFactory> filterFactoryClass, FilterFactoryParams params)
throws FilterFactory.FilterNotCreatedException {
FilterFactory filterFactory = createFilterFactory(filterFactoryClass);
return filterFactory.createFilter(params);
} | java | public static Filter createFilter(Class<? extends FilterFactory> filterFactoryClass, FilterFactoryParams params)
throws FilterFactory.FilterNotCreatedException {
FilterFactory filterFactory = createFilterFactory(filterFactoryClass);
return filterFactory.createFilter(params);
} | [
"public",
"static",
"Filter",
"createFilter",
"(",
"Class",
"<",
"?",
"extends",
"FilterFactory",
">",
"filterFactoryClass",
",",
"FilterFactoryParams",
"params",
")",
"throws",
"FilterFactory",
".",
"FilterNotCreatedException",
"{",
"FilterFactory",
"filterFactory",
"=... | Creates a {@link Filter}.
@param filterFactoryClass The class of the {@link FilterFactory}
@param params The arguments to the {@link FilterFactory} | [
"Creates",
"a",
"{",
"@link",
"Filter",
"}",
"."
] | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runner/FilterFactories.java#L55-L60 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java | AbstractMySQLQuery.withRollup | @WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
public C withRollup() {
return addFlag(Position.AFTER_GROUP_BY, WITH_ROLLUP);
} | java | @WithBridgeMethods(value = MySQLQuery.class, castRequired = true)
public C withRollup() {
return addFlag(Position.AFTER_GROUP_BY, WITH_ROLLUP);
} | [
"@",
"WithBridgeMethods",
"(",
"value",
"=",
"MySQLQuery",
".",
"class",
",",
"castRequired",
"=",
"true",
")",
"public",
"C",
"withRollup",
"(",
")",
"{",
"return",
"addFlag",
"(",
"Position",
".",
"AFTER_GROUP_BY",
",",
"WITH_ROLLUP",
")",
";",
"}"
] | The GROUP BY clause permits a WITH ROLLUP modifier that causes extra rows to be added to the
summary output. These rows represent higher-level (or super-aggregate) summary operations.
ROLLUP thus enables you to answer questions at multiple levels of analysis with a single query.
It can be used, for example, to provide support for OLAP (Online Analytical Processing) operations.
@return the current object | [
"The",
"GROUP",
"BY",
"clause",
"permits",
"a",
"WITH",
"ROLLUP",
"modifier",
"that",
"causes",
"extra",
"rows",
"to",
"be",
"added",
"to",
"the",
"summary",
"output",
".",
"These",
"rows",
"represent",
"higher",
"-",
"level",
"(",
"or",
"super",
"-",
"a... | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java#L251-L254 |
alkacon/opencms-core | src/org/opencms/workflow/A_CmsWorkflowManager.java | A_CmsWorkflowManager.setParameters | public void setParameters(Map<String, String> parameters) {
if (m_parameters != null) {
throw new IllegalStateException();
}
m_parameters = parameters;
} | java | public void setParameters(Map<String, String> parameters) {
if (m_parameters != null) {
throw new IllegalStateException();
}
m_parameters = parameters;
} | [
"public",
"void",
"setParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"if",
"(",
"m_parameters",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"m_parameters",
"=",
"parameters",
";"... | Sets the configuration parameters of the workflow manager.<p>
@param parameters the map of configuration parameters | [
"Sets",
"the",
"configuration",
"parameters",
"of",
"the",
"workflow",
"manager",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/A_CmsWorkflowManager.java#L73-L79 |
strator-dev/greenpepper | greenpepper/core/src/main/java/com/greenpepper/util/BOMUtil.java | BOMUtil.newReader | public static Reader newReader(File file, String encoding)
throws IOException
{
int bomType = getBOMType( file );
int skipBytes = getSkipBytes( bomType );
FileInputStream fIn = new FileInputStream( file );
long skippedBytes = fIn.skip( skipBytes );
return new InputStreamReader( fIn, encoding );
} | java | public static Reader newReader(File file, String encoding)
throws IOException
{
int bomType = getBOMType( file );
int skipBytes = getSkipBytes( bomType );
FileInputStream fIn = new FileInputStream( file );
long skippedBytes = fIn.skip( skipBytes );
return new InputStreamReader( fIn, encoding );
} | [
"public",
"static",
"Reader",
"newReader",
"(",
"File",
"file",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"int",
"bomType",
"=",
"getBOMType",
"(",
"file",
")",
";",
"int",
"skipBytes",
"=",
"getSkipBytes",
"(",
"bomType",
")",
";",
"Fi... | <p>newReader.</p>
@param file a {@link java.io.File} object.
@param encoding a {@link java.lang.String} object.
@return a {@link java.io.Reader} object.
@throws java.io.IOException if any. | [
"<p",
">",
"newReader",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/BOMUtil.java#L160-L168 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/Tesseract1.java | Tesseract1.createDocuments | private int createDocuments(String filename, TessResultRenderer renderer) throws TesseractException {
TessBaseAPISetInputName(handle, filename); //for reading a UNLV zone file
int result = TessBaseAPIProcessPages(handle, filename, null, 0, renderer);
// if (result == ITessAPI.FALSE) {
// throw new TesseractException("Error during processing page.");
// }
return TessBaseAPIMeanTextConf(handle);
} | java | private int createDocuments(String filename, TessResultRenderer renderer) throws TesseractException {
TessBaseAPISetInputName(handle, filename); //for reading a UNLV zone file
int result = TessBaseAPIProcessPages(handle, filename, null, 0, renderer);
// if (result == ITessAPI.FALSE) {
// throw new TesseractException("Error during processing page.");
// }
return TessBaseAPIMeanTextConf(handle);
} | [
"private",
"int",
"createDocuments",
"(",
"String",
"filename",
",",
"TessResultRenderer",
"renderer",
")",
"throws",
"TesseractException",
"{",
"TessBaseAPISetInputName",
"(",
"handle",
",",
"filename",
")",
";",
"//for reading a UNLV zone file",
"int",
"result",
"=",
... | Creates documents.
@param filename input file
@param renderer renderer
@throws TesseractException
@return the average text confidence for Tesseract page result | [
"Creates",
"documents",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/Tesseract1.java#L636-L644 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/io/OAuthCredentialsCache.java | OAuthCredentialsCache.getHeaderUnsafe | @VisibleForTesting
HeaderCacheElement getHeaderUnsafe(long timeout, TimeUnit timeUnit) {
// Optimize for the common case: do a volatile read to peek for a Good cache value
HeaderCacheElement headerCacheUnsync = this.headerCache;
// TODO(igorbernstein2): figure out how to make this work with appengine request scoped threads
switch (headerCacheUnsync.getCacheState()) {
case Good:
return headerCacheUnsync;
case Stale:
asyncRefresh();
return headerCacheUnsync;
case Expired:
case Exception:
// defer the future resolution (asyncRefresh will spin up a thread that will try to acquire the lock)
return syncRefresh(timeout, timeUnit);
default:
String message = "Could not process state: " + headerCacheUnsync.getCacheState();
LOG.warn(message);
return new HeaderCacheElement(
Status.UNAUTHENTICATED
.withCause(new IllegalStateException(message)));
}
} | java | @VisibleForTesting
HeaderCacheElement getHeaderUnsafe(long timeout, TimeUnit timeUnit) {
// Optimize for the common case: do a volatile read to peek for a Good cache value
HeaderCacheElement headerCacheUnsync = this.headerCache;
// TODO(igorbernstein2): figure out how to make this work with appengine request scoped threads
switch (headerCacheUnsync.getCacheState()) {
case Good:
return headerCacheUnsync;
case Stale:
asyncRefresh();
return headerCacheUnsync;
case Expired:
case Exception:
// defer the future resolution (asyncRefresh will spin up a thread that will try to acquire the lock)
return syncRefresh(timeout, timeUnit);
default:
String message = "Could not process state: " + headerCacheUnsync.getCacheState();
LOG.warn(message);
return new HeaderCacheElement(
Status.UNAUTHENTICATED
.withCause(new IllegalStateException(message)));
}
} | [
"@",
"VisibleForTesting",
"HeaderCacheElement",
"getHeaderUnsafe",
"(",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"// Optimize for the common case: do a volatile read to peek for a Good cache value",
"HeaderCacheElement",
"headerCacheUnsync",
"=",
"this",
".",
"he... | Get the http credential header we need from a new oauth2 AccessToken. | [
"Get",
"the",
"http",
"credential",
"header",
"we",
"need",
"from",
"a",
"new",
"oauth2",
"AccessToken",
"."
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-client-core/src/main/java/com/google/cloud/bigtable/grpc/io/OAuthCredentialsCache.java#L203-L226 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.