repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.beginUpdateTagsAsync | public Observable<NetworkInterfaceInner> beginUpdateTagsAsync(String resourceGroupName, String networkInterfaceName, Map<String, String> tags) {
"""
Updates a network interface tags.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NetworkInterfaceInner object
"""
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tags).map(new Func1<ServiceResponse<NetworkInterfaceInner>, NetworkInterfaceInner>() {
@Override
public NetworkInterfaceInner call(ServiceResponse<NetworkInterfaceInner> response) {
return response.body();
}
});
} | java | public Observable<NetworkInterfaceInner> beginUpdateTagsAsync(String resourceGroupName, String networkInterfaceName, Map<String, String> tags) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, networkInterfaceName, tags).map(new Func1<ServiceResponse<NetworkInterfaceInner>, NetworkInterfaceInner>() {
@Override
public NetworkInterfaceInner call(ServiceResponse<NetworkInterfaceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NetworkInterfaceInner",
">",
"beginUpdateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"beginUpdateTagsWithServiceResponseAs... | Updates a network interface tags.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NetworkInterfaceInner object | [
"Updates",
"a",
"network",
"interface",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L911-L918 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/PullFileLoader.java | PullFileLoader.loadJavaPropsWithFallback | private Config loadJavaPropsWithFallback(Path propertiesPath, Config fallback) throws IOException {
"""
Load a {@link Properties} compatible path using fallback as fallback.
@return The {@link Config} in path with fallback as fallback.
@throws IOException
"""
PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration();
try (InputStreamReader inputStreamReader = new InputStreamReader(this.fs.open(propertiesPath),
Charsets.UTF_8)) {
propertiesConfiguration.setDelimiterParsingDisabled(ConfigUtils.getBoolean(fallback,
PROPERTY_DELIMITER_PARSING_ENABLED_KEY, DEFAULT_PROPERTY_DELIMITER_PARSING_ENABLED_KEY));
propertiesConfiguration.load(inputStreamReader);
Config configFromProps =
ConfigUtils.propertiesToConfig(ConfigurationConverter.getProperties(propertiesConfiguration));
return ConfigFactory.parseMap(ImmutableMap.of(ConfigurationKeys.JOB_CONFIG_FILE_PATH_KEY,
PathUtils.getPathWithoutSchemeAndAuthority(propertiesPath).toString()))
.withFallback(configFromProps)
.withFallback(fallback);
} catch (ConfigurationException ce) {
throw new IOException(ce);
}
} | java | private Config loadJavaPropsWithFallback(Path propertiesPath, Config fallback) throws IOException {
PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration();
try (InputStreamReader inputStreamReader = new InputStreamReader(this.fs.open(propertiesPath),
Charsets.UTF_8)) {
propertiesConfiguration.setDelimiterParsingDisabled(ConfigUtils.getBoolean(fallback,
PROPERTY_DELIMITER_PARSING_ENABLED_KEY, DEFAULT_PROPERTY_DELIMITER_PARSING_ENABLED_KEY));
propertiesConfiguration.load(inputStreamReader);
Config configFromProps =
ConfigUtils.propertiesToConfig(ConfigurationConverter.getProperties(propertiesConfiguration));
return ConfigFactory.parseMap(ImmutableMap.of(ConfigurationKeys.JOB_CONFIG_FILE_PATH_KEY,
PathUtils.getPathWithoutSchemeAndAuthority(propertiesPath).toString()))
.withFallback(configFromProps)
.withFallback(fallback);
} catch (ConfigurationException ce) {
throw new IOException(ce);
}
} | [
"private",
"Config",
"loadJavaPropsWithFallback",
"(",
"Path",
"propertiesPath",
",",
"Config",
"fallback",
")",
"throws",
"IOException",
"{",
"PropertiesConfiguration",
"propertiesConfiguration",
"=",
"new",
"PropertiesConfiguration",
"(",
")",
";",
"try",
"(",
"InputS... | Load a {@link Properties} compatible path using fallback as fallback.
@return The {@link Config} in path with fallback as fallback.
@throws IOException | [
"Load",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/PullFileLoader.java#L279-L298 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/component/SeaGlassIcon.java | SeaGlassIcon.getIconWidth | @Override
public int getIconWidth(SynthContext context) {
"""
Returns the icon's width. This is a cover methods for <code>
getIconWidth(null)</code>.
@param context the SynthContext describing the component/region, the
style, and the state.
@return an int specifying the fixed width of the icon.
"""
if (context == null) {
return width;
}
JComponent c = context.getComponent();
if (c instanceof JToolBar && ((JToolBar) c).getOrientation() == JToolBar.VERTICAL) {
// we only do the -1 hack for UIResource borders, assuming
// that the border is probably going to be our border
if (c.getBorder() instanceof UIResource) {
return c.getWidth() - 1;
} else {
return c.getWidth();
}
} else {
return scale(context, width);
}
} | java | @Override
public int getIconWidth(SynthContext context) {
if (context == null) {
return width;
}
JComponent c = context.getComponent();
if (c instanceof JToolBar && ((JToolBar) c).getOrientation() == JToolBar.VERTICAL) {
// we only do the -1 hack for UIResource borders, assuming
// that the border is probably going to be our border
if (c.getBorder() instanceof UIResource) {
return c.getWidth() - 1;
} else {
return c.getWidth();
}
} else {
return scale(context, width);
}
} | [
"@",
"Override",
"public",
"int",
"getIconWidth",
"(",
"SynthContext",
"context",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"return",
"width",
";",
"}",
"JComponent",
"c",
"=",
"context",
".",
"getComponent",
"(",
")",
";",
"if",
"(",
"c"... | Returns the icon's width. This is a cover methods for <code>
getIconWidth(null)</code>.
@param context the SynthContext describing the component/region, the
style, and the state.
@return an int specifying the fixed width of the icon. | [
"Returns",
"the",
"icon",
"s",
"width",
".",
"This",
"is",
"a",
"cover",
"methods",
"for",
"<code",
">",
"getIconWidth",
"(",
"null",
")",
"<",
"/",
"code",
">",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/component/SeaGlassIcon.java#L210-L230 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/EntityManagerFactory.java | EntityManagerFactory.createEntityManager | public EntityManager createEntityManager(String projectId, String jsonCredentialsFile) {
"""
Creates and return a new {@link EntityManager} using the provided JSON formatted credentials.
@param projectId
the project ID
@param jsonCredentialsFile
the JSON formatted credentials file for the target Cloud project.
@return a new {@link EntityManager}
"""
return createEntityManager(projectId, jsonCredentialsFile, null);
} | java | public EntityManager createEntityManager(String projectId, String jsonCredentialsFile) {
return createEntityManager(projectId, jsonCredentialsFile, null);
} | [
"public",
"EntityManager",
"createEntityManager",
"(",
"String",
"projectId",
",",
"String",
"jsonCredentialsFile",
")",
"{",
"return",
"createEntityManager",
"(",
"projectId",
",",
"jsonCredentialsFile",
",",
"null",
")",
";",
"}"
] | Creates and return a new {@link EntityManager} using the provided JSON formatted credentials.
@param projectId
the project ID
@param jsonCredentialsFile
the JSON formatted credentials file for the target Cloud project.
@return a new {@link EntityManager} | [
"Creates",
"and",
"return",
"a",
"new",
"{",
"@link",
"EntityManager",
"}",
"using",
"the",
"provided",
"JSON",
"formatted",
"credentials",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/EntityManagerFactory.java#L88-L90 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/PausableScheduledThreadPoolExecutor.java | PausableScheduledThreadPoolExecutor.submit | @Override
public Future<?> submit(Runnable task) {
"""
{@inheritDoc}
<p>
Overridden to schedule with default delay, when non zero.
@throws RejectedExecutionException {@inheritDoc}
@throws NullPointerException {@inheritDoc}
@see #setIncrementalDefaultDelay(boolean)
@see #schedule(Runnable, long, TimeUnit)
@see #setDefaultDelay(long, TimeUnit)
"""
return schedule(task, getDefaultDelayForTask(), TimeUnit.MILLISECONDS);
} | java | @Override
public Future<?> submit(Runnable task) {
return schedule(task, getDefaultDelayForTask(), TimeUnit.MILLISECONDS);
} | [
"@",
"Override",
"public",
"Future",
"<",
"?",
">",
"submit",
"(",
"Runnable",
"task",
")",
"{",
"return",
"schedule",
"(",
"task",
",",
"getDefaultDelayForTask",
"(",
")",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}"
] | {@inheritDoc}
<p>
Overridden to schedule with default delay, when non zero.
@throws RejectedExecutionException {@inheritDoc}
@throws NullPointerException {@inheritDoc}
@see #setIncrementalDefaultDelay(boolean)
@see #schedule(Runnable, long, TimeUnit)
@see #setDefaultDelay(long, TimeUnit) | [
"{",
"@inheritDoc",
"}",
"<p",
">",
"Overridden",
"to",
"schedule",
"with",
"default",
"delay",
"when",
"non",
"zero",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/PausableScheduledThreadPoolExecutor.java#L236-L239 |
jamesdbloom/mockserver | mockserver-core/src/main/java/org/mockserver/model/HttpRequest.java | HttpRequest.withHeader | public HttpRequest withHeader(String name, String... values) {
"""
Adds one header to match which can specified using plain strings or regular expressions
(for more details of the supported regex syntax see http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html)
@param name the header name
@param values the header values which can be a varags of strings or regular expressions
"""
this.headers.withEntry(header(name, values));
return this;
} | java | public HttpRequest withHeader(String name, String... values) {
this.headers.withEntry(header(name, values));
return this;
} | [
"public",
"HttpRequest",
"withHeader",
"(",
"String",
"name",
",",
"String",
"...",
"values",
")",
"{",
"this",
".",
"headers",
".",
"withEntry",
"(",
"header",
"(",
"name",
",",
"values",
")",
")",
";",
"return",
"this",
";",
"}"
] | Adds one header to match which can specified using plain strings or regular expressions
(for more details of the supported regex syntax see http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html)
@param name the header name
@param values the header values which can be a varags of strings or regular expressions | [
"Adds",
"one",
"header",
"to",
"match",
"which",
"can",
"specified",
"using",
"plain",
"strings",
"or",
"regular",
"expressions",
"(",
"for",
"more",
"details",
"of",
"the",
"supported",
"regex",
"syntax",
"see",
"http",
":",
"//",
"docs",
".",
"oracle",
"... | train | https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/model/HttpRequest.java#L411-L414 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ImmutableAnalysis.java | ImmutableAnalysis.getImmutableAnnotation | AnnotationInfo getImmutableAnnotation(Tree tree, VisitorState state) {
"""
Gets the {@link Tree}'s {@code @Immutable} annotation info, either from an annotation on the
symbol or from the list of well-known immutable types.
"""
Symbol sym = ASTHelpers.getSymbol(tree);
return sym == null ? null : threadSafety.getMarkerOrAcceptedAnnotation(sym, state);
} | java | AnnotationInfo getImmutableAnnotation(Tree tree, VisitorState state) {
Symbol sym = ASTHelpers.getSymbol(tree);
return sym == null ? null : threadSafety.getMarkerOrAcceptedAnnotation(sym, state);
} | [
"AnnotationInfo",
"getImmutableAnnotation",
"(",
"Tree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"Symbol",
"sym",
"=",
"ASTHelpers",
".",
"getSymbol",
"(",
"tree",
")",
";",
"return",
"sym",
"==",
"null",
"?",
"null",
":",
"threadSafety",
".",
"getMa... | Gets the {@link Tree}'s {@code @Immutable} annotation info, either from an annotation on the
symbol or from the list of well-known immutable types. | [
"Gets",
"the",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/ImmutableAnalysis.java#L330-L333 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/background/BackgroundGmmCommon.java | BackgroundGmmCommon.checkBackground | public int checkBackground( float[] pixelValue , float[] dataRow , int modelIndex ) {
"""
Checks to see if the the pivel value refers to the background or foreground
@return true for background or false for foreground
"""
// see which gaussian is the best fit based on Mahalanobis distance
int index = modelIndex;
float bestDistance = maxDistance*numBands;
float bestWeight = 0;
int ng; // number of gaussians in use
for (ng = 0; ng < maxGaussians; ng++, index += gaussianStride) {
float variance = dataRow[index + 1];
if (variance <= 0) {
break;
}
float mahalanobis = 0;
for (int i = 0; i < numBands; i++) {
float mean = dataRow[index + 2+i];
float delta = pixelValue[i] - mean;
mahalanobis += delta * delta / variance;
}
if (mahalanobis < bestDistance) {
bestDistance = mahalanobis;
bestWeight = dataRow[index];
}
}
if( ng == 0 ) // There are no models. Return unknown
return unknownValue;
return bestWeight >= significantWeight ? 0 : 1;
} | java | public int checkBackground( float[] pixelValue , float[] dataRow , int modelIndex ) {
// see which gaussian is the best fit based on Mahalanobis distance
int index = modelIndex;
float bestDistance = maxDistance*numBands;
float bestWeight = 0;
int ng; // number of gaussians in use
for (ng = 0; ng < maxGaussians; ng++, index += gaussianStride) {
float variance = dataRow[index + 1];
if (variance <= 0) {
break;
}
float mahalanobis = 0;
for (int i = 0; i < numBands; i++) {
float mean = dataRow[index + 2+i];
float delta = pixelValue[i] - mean;
mahalanobis += delta * delta / variance;
}
if (mahalanobis < bestDistance) {
bestDistance = mahalanobis;
bestWeight = dataRow[index];
}
}
if( ng == 0 ) // There are no models. Return unknown
return unknownValue;
return bestWeight >= significantWeight ? 0 : 1;
} | [
"public",
"int",
"checkBackground",
"(",
"float",
"[",
"]",
"pixelValue",
",",
"float",
"[",
"]",
"dataRow",
",",
"int",
"modelIndex",
")",
"{",
"// see which gaussian is the best fit based on Mahalanobis distance",
"int",
"index",
"=",
"modelIndex",
";",
"float",
"... | Checks to see if the the pivel value refers to the background or foreground
@return true for background or false for foreground | [
"Checks",
"to",
"see",
"if",
"the",
"the",
"pivel",
"value",
"refers",
"to",
"the",
"background",
"or",
"foreground"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/background/BackgroundGmmCommon.java#L311-L341 |
google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/TreeConverter.java | TreeConverter.convertWithoutParens | private Expression convertWithoutParens(ExpressionTree condition, TreePath parent) {
"""
javac uses a ParenthesizedExpression for the if, do, and while statements, while JDT doesn't.
"""
Expression result = (Expression) convert(condition, parent);
if (result.getKind() == TreeNode.Kind.PARENTHESIZED_EXPRESSION) {
result = TreeUtil.remove(((ParenthesizedExpression) result).getExpression());
}
return result;
} | java | private Expression convertWithoutParens(ExpressionTree condition, TreePath parent) {
Expression result = (Expression) convert(condition, parent);
if (result.getKind() == TreeNode.Kind.PARENTHESIZED_EXPRESSION) {
result = TreeUtil.remove(((ParenthesizedExpression) result).getExpression());
}
return result;
} | [
"private",
"Expression",
"convertWithoutParens",
"(",
"ExpressionTree",
"condition",
",",
"TreePath",
"parent",
")",
"{",
"Expression",
"result",
"=",
"(",
"Expression",
")",
"convert",
"(",
"condition",
",",
"parent",
")",
";",
"if",
"(",
"result",
".",
"getK... | javac uses a ParenthesizedExpression for the if, do, and while statements, while JDT doesn't. | [
"javac",
"uses",
"a",
"ParenthesizedExpression",
"for",
"the",
"if",
"do",
"and",
"while",
"statements",
"while",
"JDT",
"doesn",
"t",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/TreeConverter.java#L1502-L1508 |
Erudika/para | para-core/src/main/java/com/erudika/para/core/Thing.java | Thing.addStateProperty | public Thing addStateProperty(String key, Object value) {
"""
Adds a new key/value pair to the map.
@param key a key
@param value a value
@return this
"""
if (!StringUtils.isBlank(key) && value != null) {
getDeviceState().put(key, value);
}
return this;
} | java | public Thing addStateProperty(String key, Object value) {
if (!StringUtils.isBlank(key) && value != null) {
getDeviceState().put(key, value);
}
return this;
} | [
"public",
"Thing",
"addStateProperty",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"key",
")",
"&&",
"value",
"!=",
"null",
")",
"{",
"getDeviceState",
"(",
")",
".",
"put",
"(",
"key",
... | Adds a new key/value pair to the map.
@param key a key
@param value a value
@return this | [
"Adds",
"a",
"new",
"key",
"/",
"value",
"pair",
"to",
"the",
"map",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/Thing.java#L123-L128 |
motown-io/motown | ocpp/view-model/src/main/java/io/motown/ocpp/viewmodel/domain/DomainService.java | DomainService.generateReservationIdentifier | public NumberedReservationId generateReservationIdentifier(ChargingStationId chargingStationId, String protocolIdentifier) {
"""
Generates a reservation identifier based on the charging station, the module (OCPP) and a auto-incremented number.
@param chargingStationId charging station identifier to use when generating a reservation identifier.
@param protocolIdentifier identifier of the protocol, used when generating a reservation identifier.
@return reservation identifier based on the charging station, module and auto-incremented number.
"""
ReservationIdentifier reservationIdentifier = new ReservationIdentifier();
reservationIdentifierRepository.insert(reservationIdentifier);
/* TODO JPA's identity generator creates longs, while OCPP and Motown supports ints. Where should we translate
* between these and how should we handle error cases? - Mark van den Bergh, Januari 7th 2013
*/
Long identifier = (Long) entityManagerFactory.getPersistenceUnitUtil().getIdentifier(reservationIdentifier);
return new NumberedReservationId(chargingStationId, protocolIdentifier, identifier.intValue());
} | java | public NumberedReservationId generateReservationIdentifier(ChargingStationId chargingStationId, String protocolIdentifier) {
ReservationIdentifier reservationIdentifier = new ReservationIdentifier();
reservationIdentifierRepository.insert(reservationIdentifier);
/* TODO JPA's identity generator creates longs, while OCPP and Motown supports ints. Where should we translate
* between these and how should we handle error cases? - Mark van den Bergh, Januari 7th 2013
*/
Long identifier = (Long) entityManagerFactory.getPersistenceUnitUtil().getIdentifier(reservationIdentifier);
return new NumberedReservationId(chargingStationId, protocolIdentifier, identifier.intValue());
} | [
"public",
"NumberedReservationId",
"generateReservationIdentifier",
"(",
"ChargingStationId",
"chargingStationId",
",",
"String",
"protocolIdentifier",
")",
"{",
"ReservationIdentifier",
"reservationIdentifier",
"=",
"new",
"ReservationIdentifier",
"(",
")",
";",
"reservationId... | Generates a reservation identifier based on the charging station, the module (OCPP) and a auto-incremented number.
@param chargingStationId charging station identifier to use when generating a reservation identifier.
@param protocolIdentifier identifier of the protocol, used when generating a reservation identifier.
@return reservation identifier based on the charging station, module and auto-incremented number. | [
"Generates",
"a",
"reservation",
"identifier",
"based",
"on",
"the",
"charging",
"station",
"the",
"module",
"(",
"OCPP",
")",
"and",
"a",
"auto",
"-",
"incremented",
"number",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/ocpp/view-model/src/main/java/io/motown/ocpp/viewmodel/domain/DomainService.java#L425-L435 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/program/jasper/JasperUtil.java | JasperUtil.getJasperDesign | public static JasperDesign getJasperDesign(final Instance _instance)
throws EFapsException {
"""
Get a JasperDesign for an instance.
@param _instance Instance the JasperDesign is wanted for
@return JasperDesign
@throws EFapsException on error
"""
final Checkout checkout = new Checkout(_instance);
final InputStream source = checkout.execute();
JasperDesign jasperDesign = null;
try {
JasperUtil.LOG.debug("Loading JasperDesign for :{}", _instance);
final DefaultJasperReportsContext reportContext = DefaultJasperReportsContext.getInstance();
final JRXmlLoader loader = new JRXmlLoader(reportContext,
JRXmlDigesterFactory.createDigester(reportContext));
jasperDesign = loader.loadXML(source);
} catch (final ParserConfigurationException e) {
throw new EFapsException(JasperUtil.class, "getJasperDesign", e);
} catch (final SAXException e) {
throw new EFapsException(JasperUtil.class, "getJasperDesign", e);
} catch (final JRException e) {
throw new EFapsException(JasperUtil.class, "getJasperDesign", e);
}
return jasperDesign;
} | java | public static JasperDesign getJasperDesign(final Instance _instance)
throws EFapsException
{
final Checkout checkout = new Checkout(_instance);
final InputStream source = checkout.execute();
JasperDesign jasperDesign = null;
try {
JasperUtil.LOG.debug("Loading JasperDesign for :{}", _instance);
final DefaultJasperReportsContext reportContext = DefaultJasperReportsContext.getInstance();
final JRXmlLoader loader = new JRXmlLoader(reportContext,
JRXmlDigesterFactory.createDigester(reportContext));
jasperDesign = loader.loadXML(source);
} catch (final ParserConfigurationException e) {
throw new EFapsException(JasperUtil.class, "getJasperDesign", e);
} catch (final SAXException e) {
throw new EFapsException(JasperUtil.class, "getJasperDesign", e);
} catch (final JRException e) {
throw new EFapsException(JasperUtil.class, "getJasperDesign", e);
}
return jasperDesign;
} | [
"public",
"static",
"JasperDesign",
"getJasperDesign",
"(",
"final",
"Instance",
"_instance",
")",
"throws",
"EFapsException",
"{",
"final",
"Checkout",
"checkout",
"=",
"new",
"Checkout",
"(",
"_instance",
")",
";",
"final",
"InputStream",
"source",
"=",
"checkou... | Get a JasperDesign for an instance.
@param _instance Instance the JasperDesign is wanted for
@return JasperDesign
@throws EFapsException on error | [
"Get",
"a",
"JasperDesign",
"for",
"an",
"instance",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/program/jasper/JasperUtil.java#L66-L86 |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java | AbstractSearch.logPerformances | protected String logPerformances(Space space, Vector<Performance> performances, Tag type) {
"""
generates a table string for all the performances in the space and returns
that.
@param space the current space to align the performances to
@param performances the performances to align
@param type the type of performance
@return the table string
"""
return m_Owner.logPerformances(space, performances, type);
} | java | protected String logPerformances(Space space, Vector<Performance> performances, Tag type) {
return m_Owner.logPerformances(space, performances, type);
} | [
"protected",
"String",
"logPerformances",
"(",
"Space",
"space",
",",
"Vector",
"<",
"Performance",
">",
"performances",
",",
"Tag",
"type",
")",
"{",
"return",
"m_Owner",
".",
"logPerformances",
"(",
"space",
",",
"performances",
",",
"type",
")",
";",
"}"
... | generates a table string for all the performances in the space and returns
that.
@param space the current space to align the performances to
@param performances the performances to align
@param type the type of performance
@return the table string | [
"generates",
"a",
"table",
"string",
"for",
"all",
"the",
"performances",
"in",
"the",
"space",
"and",
"returns",
"that",
"."
] | train | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java#L262-L264 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/UserMetadata.java | UserMetadata.setFieldProtected | public static void setFieldProtected(FormModel formModel, String fieldName, boolean protectedField) {
"""
defines the protectable state for a field
@param formModel the formmodel
@param fieldName the field to protect
@param protectedField if true the field will be defined as protectable otherwise false
"""
FieldMetadata metaData = formModel.getFieldMetadata(fieldName);
metaData.getAllUserMetadata().put(PROTECTED_FIELD, Boolean.valueOf(protectedField));
} | java | public static void setFieldProtected(FormModel formModel, String fieldName, boolean protectedField) {
FieldMetadata metaData = formModel.getFieldMetadata(fieldName);
metaData.getAllUserMetadata().put(PROTECTED_FIELD, Boolean.valueOf(protectedField));
} | [
"public",
"static",
"void",
"setFieldProtected",
"(",
"FormModel",
"formModel",
",",
"String",
"fieldName",
",",
"boolean",
"protectedField",
")",
"{",
"FieldMetadata",
"metaData",
"=",
"formModel",
".",
"getFieldMetadata",
"(",
"fieldName",
")",
";",
"metaData",
... | defines the protectable state for a field
@param formModel the formmodel
@param fieldName the field to protect
@param protectedField if true the field will be defined as protectable otherwise false | [
"defines",
"the",
"protectable",
"state",
"for",
"a",
"field"
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/UserMetadata.java#L56-L59 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.initRC4Encryption | protected void initRC4Encryption(byte[] sharedSecret) {
"""
Prepare the ciphers.
@param sharedSecret shared secret byte sequence
"""
log.debug("Shared secret: {}", Hex.encodeHexString(sharedSecret));
// create output cipher
log.debug("Outgoing public key [{}]: {}", outgoingPublicKey.length, Hex.encodeHexString(outgoingPublicKey));
byte[] rc4keyOut = new byte[32];
// digest is 32 bytes, but our key is 16
calculateHMAC_SHA256(outgoingPublicKey, 0, outgoingPublicKey.length, sharedSecret, KEY_LENGTH, rc4keyOut, 0);
log.debug("RC4 Out Key: {}", Hex.encodeHexString(Arrays.copyOfRange(rc4keyOut, 0, 16)));
try {
cipherOut = Cipher.getInstance("RC4");
cipherOut.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(rc4keyOut, 0, 16, "RC4"));
} catch (Exception e) {
log.warn("Encryption cipher creation failed", e);
}
// create input cipher
log.debug("Incoming public key [{}]: {}", incomingPublicKey.length, Hex.encodeHexString(incomingPublicKey));
// digest is 32 bytes, but our key is 16
byte[] rc4keyIn = new byte[32];
calculateHMAC_SHA256(incomingPublicKey, 0, incomingPublicKey.length, sharedSecret, KEY_LENGTH, rc4keyIn, 0);
log.debug("RC4 In Key: {}", Hex.encodeHexString(Arrays.copyOfRange(rc4keyIn, 0, 16)));
try {
cipherIn = Cipher.getInstance("RC4");
cipherIn.init(Cipher.DECRYPT_MODE, new SecretKeySpec(rc4keyIn, 0, 16, "RC4"));
} catch (Exception e) {
log.warn("Decryption cipher creation failed", e);
}
} | java | protected void initRC4Encryption(byte[] sharedSecret) {
log.debug("Shared secret: {}", Hex.encodeHexString(sharedSecret));
// create output cipher
log.debug("Outgoing public key [{}]: {}", outgoingPublicKey.length, Hex.encodeHexString(outgoingPublicKey));
byte[] rc4keyOut = new byte[32];
// digest is 32 bytes, but our key is 16
calculateHMAC_SHA256(outgoingPublicKey, 0, outgoingPublicKey.length, sharedSecret, KEY_LENGTH, rc4keyOut, 0);
log.debug("RC4 Out Key: {}", Hex.encodeHexString(Arrays.copyOfRange(rc4keyOut, 0, 16)));
try {
cipherOut = Cipher.getInstance("RC4");
cipherOut.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(rc4keyOut, 0, 16, "RC4"));
} catch (Exception e) {
log.warn("Encryption cipher creation failed", e);
}
// create input cipher
log.debug("Incoming public key [{}]: {}", incomingPublicKey.length, Hex.encodeHexString(incomingPublicKey));
// digest is 32 bytes, but our key is 16
byte[] rc4keyIn = new byte[32];
calculateHMAC_SHA256(incomingPublicKey, 0, incomingPublicKey.length, sharedSecret, KEY_LENGTH, rc4keyIn, 0);
log.debug("RC4 In Key: {}", Hex.encodeHexString(Arrays.copyOfRange(rc4keyIn, 0, 16)));
try {
cipherIn = Cipher.getInstance("RC4");
cipherIn.init(Cipher.DECRYPT_MODE, new SecretKeySpec(rc4keyIn, 0, 16, "RC4"));
} catch (Exception e) {
log.warn("Decryption cipher creation failed", e);
}
} | [
"protected",
"void",
"initRC4Encryption",
"(",
"byte",
"[",
"]",
"sharedSecret",
")",
"{",
"log",
".",
"debug",
"(",
"\"Shared secret: {}\"",
",",
"Hex",
".",
"encodeHexString",
"(",
"sharedSecret",
")",
")",
";",
"// create output cipher\r",
"log",
".",
"debug"... | Prepare the ciphers.
@param sharedSecret shared secret byte sequence | [
"Prepare",
"the",
"ciphers",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L213-L239 |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/ServletUtil.java | ServletUtil.getResource | @Deprecated
public static URL getResource(ServletContext servletContext, String path) throws MalformedURLException {
"""
Gets the URL for the provided absolute path or <code>null</code> if no resource
is mapped to the path.
@deprecated Use regular methods directly
@see ServletContext#getResource(java.lang.String)
@see ServletContextCache#getResource(java.lang.String)
@see ServletContextCache#getResource(javax.servlet.ServletContext, java.lang.String)
"""
return servletContext.getResource(path);
} | java | @Deprecated
public static URL getResource(ServletContext servletContext, String path) throws MalformedURLException {
return servletContext.getResource(path);
} | [
"@",
"Deprecated",
"public",
"static",
"URL",
"getResource",
"(",
"ServletContext",
"servletContext",
",",
"String",
"path",
")",
"throws",
"MalformedURLException",
"{",
"return",
"servletContext",
".",
"getResource",
"(",
"path",
")",
";",
"}"
] | Gets the URL for the provided absolute path or <code>null</code> if no resource
is mapped to the path.
@deprecated Use regular methods directly
@see ServletContext#getResource(java.lang.String)
@see ServletContextCache#getResource(java.lang.String)
@see ServletContextCache#getResource(javax.servlet.ServletContext, java.lang.String) | [
"Gets",
"the",
"URL",
"for",
"the",
"provided",
"absolute",
"path",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"no",
"resource",
"is",
"mapped",
"to",
"the",
"path",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L159-L162 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/RegistriesInner.java | RegistriesInner.queueBuild | public BuildInner queueBuild(String resourceGroupName, String registryName, QueueBuildRequest buildRequest) {
"""
Creates a new build based on the request parameters and add it to the build queue.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildRequest The parameters of a build that needs to queued.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BuildInner object if successful.
"""
return queueBuildWithServiceResponseAsync(resourceGroupName, registryName, buildRequest).toBlocking().last().body();
} | java | public BuildInner queueBuild(String resourceGroupName, String registryName, QueueBuildRequest buildRequest) {
return queueBuildWithServiceResponseAsync(resourceGroupName, registryName, buildRequest).toBlocking().last().body();
} | [
"public",
"BuildInner",
"queueBuild",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"QueueBuildRequest",
"buildRequest",
")",
"{",
"return",
"queueBuildWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"buildRequest",
... | Creates a new build based on the request parameters and add it to the build queue.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildRequest The parameters of a build that needs to queued.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BuildInner object if successful. | [
"Creates",
"a",
"new",
"build",
"based",
"on",
"the",
"request",
"parameters",
"and",
"add",
"it",
"to",
"the",
"build",
"queue",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/RegistriesInner.java#L1727-L1729 |
HotelsDotCom/corc | corc-cascading/src/main/java/com/hotels/corc/cascading/OrcFile.java | OrcFile.source | @Override
public boolean source(FlowProcess<? extends Configuration> flowProcess, SourceCall<Corc, RecordReader> sourceCall)
throws IOException {
"""
Populates the {@link Corc} with the next value from the {@link RecordReader}. Then copies the values into the
incoming {@link TupleEntry}.
"""
Corc corc = sourceCall.getContext();
@SuppressWarnings("unchecked")
boolean next = sourceCall.getInput().next(NullWritable.get(), corc);
if (!next) {
return false;
}
TupleEntry tupleEntry = sourceCall.getIncomingEntry();
for (Comparable<?> fieldName : tupleEntry.getFields()) {
if (ROW_ID_NAME.equals(fieldName)) {
tupleEntry.setObject(ROW_ID_NAME, corc.getRecordIdentifier());
} else {
tupleEntry.setObject(fieldName, corc.get(fieldName.toString()));
}
}
return true;
} | java | @Override
public boolean source(FlowProcess<? extends Configuration> flowProcess, SourceCall<Corc, RecordReader> sourceCall)
throws IOException {
Corc corc = sourceCall.getContext();
@SuppressWarnings("unchecked")
boolean next = sourceCall.getInput().next(NullWritable.get(), corc);
if (!next) {
return false;
}
TupleEntry tupleEntry = sourceCall.getIncomingEntry();
for (Comparable<?> fieldName : tupleEntry.getFields()) {
if (ROW_ID_NAME.equals(fieldName)) {
tupleEntry.setObject(ROW_ID_NAME, corc.getRecordIdentifier());
} else {
tupleEntry.setObject(fieldName, corc.get(fieldName.toString()));
}
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"source",
"(",
"FlowProcess",
"<",
"?",
"extends",
"Configuration",
">",
"flowProcess",
",",
"SourceCall",
"<",
"Corc",
",",
"RecordReader",
">",
"sourceCall",
")",
"throws",
"IOException",
"{",
"Corc",
"corc",
"=",
"sourc... | Populates the {@link Corc} with the next value from the {@link RecordReader}. Then copies the values into the
incoming {@link TupleEntry}. | [
"Populates",
"the",
"{"
] | train | https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-cascading/src/main/java/com/hotels/corc/cascading/OrcFile.java#L170-L188 |
rampatra/jbot | jbot-example/src/main/java/example/jbot/slack/SlackBot.java | SlackBot.onPinAdded | @Controller(events = EventType.PIN_ADDED)
public void onPinAdded(WebSocketSession session, Event event) {
"""
Invoked when an item is pinned in the channel.
@param session
@param event
"""
reply(session, event, "Thanks for the pin! You can find all pinned items under channel details.");
} | java | @Controller(events = EventType.PIN_ADDED)
public void onPinAdded(WebSocketSession session, Event event) {
reply(session, event, "Thanks for the pin! You can find all pinned items under channel details.");
} | [
"@",
"Controller",
"(",
"events",
"=",
"EventType",
".",
"PIN_ADDED",
")",
"public",
"void",
"onPinAdded",
"(",
"WebSocketSession",
"session",
",",
"Event",
"event",
")",
"{",
"reply",
"(",
"session",
",",
"event",
",",
"\"Thanks for the pin! You can find all pinn... | Invoked when an item is pinned in the channel.
@param session
@param event | [
"Invoked",
"when",
"an",
"item",
"is",
"pinned",
"in",
"the",
"channel",
"."
] | train | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/slack/SlackBot.java#L83-L86 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AbstractDataGridHtmlTag.java | AbstractDataGridHtmlTag.applyTagId | protected final void applyTagId(AbstractHtmlState state, String tagId)
throws JspException {
"""
Create an un-indexed tag identifier for the given state object.
@param state the {@link AbstractHtmlState} upon which the tag identifier will be set once created
@param tagId the base tag identifier
@throws JspException
"""
state.id = generateTagId(tagId);
} | java | protected final void applyTagId(AbstractHtmlState state, String tagId)
throws JspException {
state.id = generateTagId(tagId);
} | [
"protected",
"final",
"void",
"applyTagId",
"(",
"AbstractHtmlState",
"state",
",",
"String",
"tagId",
")",
"throws",
"JspException",
"{",
"state",
".",
"id",
"=",
"generateTagId",
"(",
"tagId",
")",
";",
"}"
] | Create an un-indexed tag identifier for the given state object.
@param state the {@link AbstractHtmlState} upon which the tag identifier will be set once created
@param tagId the base tag identifier
@throws JspException | [
"Create",
"an",
"un",
"-",
"indexed",
"tag",
"identifier",
"for",
"the",
"given",
"state",
"object",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AbstractDataGridHtmlTag.java#L79-L82 |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/support/AccumulatorUtil.java | AccumulatorUtil.createAccumulator | public void createAccumulator(final OnDemandStatsProducer producer, final A annotation, final Method method) {
"""
Create and register new {@link Accumulator} for class/method level stats accumulation.
In case producer or annotation is null does nothing.
@param producer
stats producer
@param annotation
{@link Accumulate} or {@link AccumulateWithSubClasses} annotation used to create {@link Accumulator}.
@param method
{@link Method} that was annotated or null in case ot class-level accumulator.
"""
if (producer != null && annotation != null) {
final String statsName = (method == null) ? OnDemandStatsProducer.CUMULATED_STATS_NAME : method.getName();
String accumulatorName = getName(annotation);
if (StringUtils.isEmpty(accumulatorName))
accumulatorName = method == null ? formAccumulatorNameForClass(producer, annotation) :
formAccumulatorNameForMethod(producer, annotation, method);
createAccumulator(
producer.getProducerId(),
annotation,
accumulatorName,
statsName
);
}
} | java | public void createAccumulator(final OnDemandStatsProducer producer, final A annotation, final Method method) {
if (producer != null && annotation != null) {
final String statsName = (method == null) ? OnDemandStatsProducer.CUMULATED_STATS_NAME : method.getName();
String accumulatorName = getName(annotation);
if (StringUtils.isEmpty(accumulatorName))
accumulatorName = method == null ? formAccumulatorNameForClass(producer, annotation) :
formAccumulatorNameForMethod(producer, annotation, method);
createAccumulator(
producer.getProducerId(),
annotation,
accumulatorName,
statsName
);
}
} | [
"public",
"void",
"createAccumulator",
"(",
"final",
"OnDemandStatsProducer",
"producer",
",",
"final",
"A",
"annotation",
",",
"final",
"Method",
"method",
")",
"{",
"if",
"(",
"producer",
"!=",
"null",
"&&",
"annotation",
"!=",
"null",
")",
"{",
"final",
"... | Create and register new {@link Accumulator} for class/method level stats accumulation.
In case producer or annotation is null does nothing.
@param producer
stats producer
@param annotation
{@link Accumulate} or {@link AccumulateWithSubClasses} annotation used to create {@link Accumulator}.
@param method
{@link Method} that was annotated or null in case ot class-level accumulator. | [
"Create",
"and",
"register",
"new",
"{",
"@link",
"Accumulator",
"}",
"for",
"class",
"/",
"method",
"level",
"stats",
"accumulation",
".",
"In",
"case",
"producer",
"or",
"annotation",
"is",
"null",
"does",
"nothing",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/support/AccumulatorUtil.java#L70-L87 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java | ConstructorBuilder.buildDeprecationInfo | public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) {
"""
Build the deprecation information.
@param node the XML element that specifies which components to document
@param constructorDocTree the content tree to which the documentation will be added
"""
writer.addDeprecated(
(ConstructorDoc) constructors.get(currentConstructorIndex), constructorDocTree);
} | java | public void buildDeprecationInfo(XMLNode node, Content constructorDocTree) {
writer.addDeprecated(
(ConstructorDoc) constructors.get(currentConstructorIndex), constructorDocTree);
} | [
"public",
"void",
"buildDeprecationInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"constructorDocTree",
")",
"{",
"writer",
".",
"addDeprecated",
"(",
"(",
"ConstructorDoc",
")",
"constructors",
".",
"get",
"(",
"currentConstructorIndex",
")",
",",
"constructorDocTr... | Build the deprecation information.
@param node the XML element that specifies which components to document
@param constructorDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"deprecation",
"information",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java#L201-L204 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java | StreamingJobsInner.beginStop | public void beginStop(String resourceGroupName, String jobName) {
"""
Stops a running streaming job. This will cause a running streaming job to stop processing input events and producing output.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
beginStopWithServiceResponseAsync(resourceGroupName, jobName).toBlocking().single().body();
} | java | public void beginStop(String resourceGroupName, String jobName) {
beginStopWithServiceResponseAsync(resourceGroupName, jobName).toBlocking().single().body();
} | [
"public",
"void",
"beginStop",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
")",
"{",
"beginStopWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"jobName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
"... | Stops a running streaming job. This will cause a running streaming job to stop processing input events and producing output.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param jobName The name of the streaming job.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Stops",
"a",
"running",
"streaming",
"job",
".",
"This",
"will",
"cause",
"a",
"running",
"streaming",
"job",
"to",
"stop",
"processing",
"input",
"events",
"and",
"producing",
"output",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java#L1828-L1830 |
square/pollexor | src/main/java/com/squareup/pollexor/Utilities.java | Utilities.rightPadString | static void rightPadString(StringBuilder builder, char padding, int multipleOf) {
"""
Pad a {@link StringBuilder} to a desired multiple on the right using a specified character.
@param builder Builder to pad.
@param padding Padding character.
@param multipleOf Number which the length must be a multiple of.
@throws IllegalArgumentException if {@code builder} is null or {@code multipleOf} is less than
2.
"""
if (builder == null) {
throw new IllegalArgumentException("Builder input must not be empty.");
}
if (multipleOf < 2) {
throw new IllegalArgumentException("Multiple must be greater than one.");
}
int needed = multipleOf - (builder.length() % multipleOf);
if (needed < multipleOf) {
for (int i = needed; i > 0; i--) {
builder.append(padding);
}
}
} | java | static void rightPadString(StringBuilder builder, char padding, int multipleOf) {
if (builder == null) {
throw new IllegalArgumentException("Builder input must not be empty.");
}
if (multipleOf < 2) {
throw new IllegalArgumentException("Multiple must be greater than one.");
}
int needed = multipleOf - (builder.length() % multipleOf);
if (needed < multipleOf) {
for (int i = needed; i > 0; i--) {
builder.append(padding);
}
}
} | [
"static",
"void",
"rightPadString",
"(",
"StringBuilder",
"builder",
",",
"char",
"padding",
",",
"int",
"multipleOf",
")",
"{",
"if",
"(",
"builder",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Builder input must not be empty.\"",
... | Pad a {@link StringBuilder} to a desired multiple on the right using a specified character.
@param builder Builder to pad.
@param padding Padding character.
@param multipleOf Number which the length must be a multiple of.
@throws IllegalArgumentException if {@code builder} is null or {@code multipleOf} is less than
2. | [
"Pad",
"a",
"{",
"@link",
"StringBuilder",
"}",
"to",
"a",
"desired",
"multiple",
"on",
"the",
"right",
"using",
"a",
"specified",
"character",
"."
] | train | https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/Utilities.java#L84-L97 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java | TreeUtil.getContextForId | public static UIContext getContextForId(final WComponent root, final String id) {
"""
Retrieves the context for the component with the given Id.
<p>
Searches visible and not visible components.
</p>
@param root the root component to search from.
@param id the id to search for.
@return the context for the component with the given id, or null if not found.
"""
return getContextForId(root, id, false);
} | java | public static UIContext getContextForId(final WComponent root, final String id) {
return getContextForId(root, id, false);
} | [
"public",
"static",
"UIContext",
"getContextForId",
"(",
"final",
"WComponent",
"root",
",",
"final",
"String",
"id",
")",
"{",
"return",
"getContextForId",
"(",
"root",
",",
"id",
",",
"false",
")",
";",
"}"
] | Retrieves the context for the component with the given Id.
<p>
Searches visible and not visible components.
</p>
@param root the root component to search from.
@param id the id to search for.
@return the context for the component with the given id, or null if not found. | [
"Retrieves",
"the",
"context",
"for",
"the",
"component",
"with",
"the",
"given",
"Id",
".",
"<p",
">",
"Searches",
"visible",
"and",
"not",
"visible",
"components",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java#L155-L157 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipSession.java | SipSession.setPublicAddress | public boolean setPublicAddress(String host, int port) {
"""
This method replaces the host/port values currently being used in this Sip agent's contact
address, via, and listening point 'sentby' components with the given host and port parameters.
<p>
Call this method when you are running a SipUnit testcase behind a NAT and need to register with
a proxy on the public internet. Before creating the SipStack and SipPhone, you'll need to first
obtain the public IP address/port using a mechanism such as the Stun4j API. See the
TestWithStun.java file in the sipunit test/examples directory for an example of how to do it.
@param host The publicly accessible IP address for this Sip client (ex: 66.32.44.112).
@param port The port to be used with the publicly accessible IP address.
@return true if the parameters are successfully parsed and this client's information is
updated, false otherwise.
"""
try {
// set 'sentBy' in the listening point for outbound messages
parent.getSipProvider().getListeningPoints()[0].setSentBy(host + ":" + port);
// update my contact info
SipURI my_uri = (SipURI) contactInfo.getContactHeader().getAddress().getURI();
my_uri.setHost(host);
my_uri.setPort(port);
// update my via header
ViaHeader my_via = (ViaHeader) viaHeaders.get(0);
my_via.setHost(host);
my_via.setPort(port);
// update my host
myhost = host;
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return false;
}
// LOG.info("my public IP {}", host);
// LOG.info("my public port = {}", port);
// LOG.info("my sentby = {}",
// parent.getSipProvider().getListeningPoints()[0].getSentBy());
return true;
} | java | public boolean setPublicAddress(String host, int port) {
try {
// set 'sentBy' in the listening point for outbound messages
parent.getSipProvider().getListeningPoints()[0].setSentBy(host + ":" + port);
// update my contact info
SipURI my_uri = (SipURI) contactInfo.getContactHeader().getAddress().getURI();
my_uri.setHost(host);
my_uri.setPort(port);
// update my via header
ViaHeader my_via = (ViaHeader) viaHeaders.get(0);
my_via.setHost(host);
my_via.setPort(port);
// update my host
myhost = host;
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return false;
}
// LOG.info("my public IP {}", host);
// LOG.info("my public port = {}", port);
// LOG.info("my sentby = {}",
// parent.getSipProvider().getListeningPoints()[0].getSentBy());
return true;
} | [
"public",
"boolean",
"setPublicAddress",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"try",
"{",
"// set 'sentBy' in the listening point for outbound messages",
"parent",
".",
"getSipProvider",
"(",
")",
".",
"getListeningPoints",
"(",
")",
"[",
"0",
"]",
... | This method replaces the host/port values currently being used in this Sip agent's contact
address, via, and listening point 'sentby' components with the given host and port parameters.
<p>
Call this method when you are running a SipUnit testcase behind a NAT and need to register with
a proxy on the public internet. Before creating the SipStack and SipPhone, you'll need to first
obtain the public IP address/port using a mechanism such as the Stun4j API. See the
TestWithStun.java file in the sipunit test/examples directory for an example of how to do it.
@param host The publicly accessible IP address for this Sip client (ex: 66.32.44.112).
@param port The port to be used with the publicly accessible IP address.
@return true if the parameters are successfully parsed and this client's information is
updated, false otherwise. | [
"This",
"method",
"replaces",
"the",
"host",
"/",
"port",
"values",
"currently",
"being",
"used",
"in",
"this",
"Sip",
"agent",
"s",
"contact",
"address",
"via",
"and",
"listening",
"point",
"sentby",
"components",
"with",
"the",
"given",
"host",
"and",
"por... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipSession.java#L404-L434 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AttributeMarshaller.java | AttributeMarshaller.isMarshallable | public boolean isMarshallable(final AttributeDefinition attribute, final ModelNode resourceModel, final boolean marshallDefault) {
"""
Gets whether the given {@code resourceModel} has a value for this attribute that should be marshalled to XML.
@param attribute - attribute for which marshaling is being done
@param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}.
@param marshallDefault {@code true} if the value should be marshalled even if it matches the default value
@return {@code true} if the given {@code resourceModel} has a defined value under this attribute's {@link AttributeDefinition#getName()} () name}
and {@code marshallDefault} is {@code true} or that value differs from this attribute's {@link AttributeDefinition#getDefaultValue() default value}.
"""
return resourceModel.hasDefined(attribute.getName()) && (marshallDefault || !resourceModel.get(attribute.getName()).equals(attribute.getDefaultValue()));
} | java | public boolean isMarshallable(final AttributeDefinition attribute, final ModelNode resourceModel, final boolean marshallDefault) {
return resourceModel.hasDefined(attribute.getName()) && (marshallDefault || !resourceModel.get(attribute.getName()).equals(attribute.getDefaultValue()));
} | [
"public",
"boolean",
"isMarshallable",
"(",
"final",
"AttributeDefinition",
"attribute",
",",
"final",
"ModelNode",
"resourceModel",
",",
"final",
"boolean",
"marshallDefault",
")",
"{",
"return",
"resourceModel",
".",
"hasDefined",
"(",
"attribute",
".",
"getName",
... | Gets whether the given {@code resourceModel} has a value for this attribute that should be marshalled to XML.
@param attribute - attribute for which marshaling is being done
@param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}.
@param marshallDefault {@code true} if the value should be marshalled even if it matches the default value
@return {@code true} if the given {@code resourceModel} has a defined value under this attribute's {@link AttributeDefinition#getName()} () name}
and {@code marshallDefault} is {@code true} or that value differs from this attribute's {@link AttributeDefinition#getDefaultValue() default value}. | [
"Gets",
"whether",
"the",
"given",
"{",
"@code",
"resourceModel",
"}",
"has",
"a",
"value",
"for",
"this",
"attribute",
"that",
"should",
"be",
"marshalled",
"to",
"XML",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeMarshaller.java#L63-L65 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/ContainerMetadataUpdateTransaction.java | ContainerMetadataUpdateTransaction.createSegmentMetadata | private UpdateableSegmentMetadata createSegmentMetadata(String segmentName, long segmentId) {
"""
Creates a new UpdateableSegmentMetadata for the given Segment and registers it.
"""
UpdateableSegmentMetadata metadata = new StreamSegmentMetadata(segmentName, segmentId, this.containerId);
this.newSegments.put(metadata.getId(), metadata);
this.newSegmentNames.put(metadata.getName(), metadata.getId());
return metadata;
} | java | private UpdateableSegmentMetadata createSegmentMetadata(String segmentName, long segmentId) {
UpdateableSegmentMetadata metadata = new StreamSegmentMetadata(segmentName, segmentId, this.containerId);
this.newSegments.put(metadata.getId(), metadata);
this.newSegmentNames.put(metadata.getName(), metadata.getId());
return metadata;
} | [
"private",
"UpdateableSegmentMetadata",
"createSegmentMetadata",
"(",
"String",
"segmentName",
",",
"long",
"segmentId",
")",
"{",
"UpdateableSegmentMetadata",
"metadata",
"=",
"new",
"StreamSegmentMetadata",
"(",
"segmentName",
",",
"segmentId",
",",
"this",
".",
"cont... | Creates a new UpdateableSegmentMetadata for the given Segment and registers it. | [
"Creates",
"a",
"new",
"UpdateableSegmentMetadata",
"for",
"the",
"given",
"Segment",
"and",
"registers",
"it",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/ContainerMetadataUpdateTransaction.java#L562-L567 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/JcrPropertyDefinition.java | JcrPropertyDefinition.createChecker | private ConstraintChecker createChecker( ExecutionContext context,
int type,
String[] valueConstraints ) {
"""
Returns a {@link ConstraintChecker} that will interpret the constraints described by <code>valueConstraints</code> using
the semantics defined in section 3.6.4 of the JCR 2.0 specification for the type indicated by <code>type</code> (where
<code>type</code> is a value from {@link PropertyType}) for the given <code>context</code>. The {@link ExecutionContext} is
used to provide namespace mappings and value factories for the other constraint checkers.
@param context the execution context
@param type the type of constraint checker that should be created (based on values from {@link PropertyType}).
Type-specific semantics are defined in section 3.7.3.6 of the JCR 2.0 specification.
@param valueConstraints the constraints for the node as provided by {@link PropertyDefinition#getValueConstraints()}.
@return a constraint checker that matches the given parameters
"""
switch (type) {
case PropertyType.BINARY:
return new BinaryConstraintChecker(valueConstraints, context);
case PropertyType.DATE:
return new DateTimeConstraintChecker(valueConstraints, context);
case PropertyType.DOUBLE:
return new DoubleConstraintChecker(valueConstraints, context);
case PropertyType.LONG:
return new LongConstraintChecker(valueConstraints, context);
case PropertyType.NAME:
return new NameConstraintChecker(valueConstraints, context);
case PropertyType.PATH:
return new PathConstraintChecker(valueConstraints, context);
case PropertyType.REFERENCE:
case PropertyType.WEAKREFERENCE:
return new ReferenceConstraintChecker(valueConstraints, context);
case org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE:
return new SimpleReferenceConstraintChecker(valueConstraints, context);
case PropertyType.URI:
case PropertyType.STRING:
return new StringConstraintChecker(valueConstraints, context);
case PropertyType.DECIMAL:
return new DecimalConstraintChecker(valueConstraints, context);
case PropertyType.BOOLEAN: {
return new BooleanConstraintChecker(context, valueConstraints);
}
default:
throw new IllegalStateException("Invalid property type: " + type);
}
} | java | private ConstraintChecker createChecker( ExecutionContext context,
int type,
String[] valueConstraints ) {
switch (type) {
case PropertyType.BINARY:
return new BinaryConstraintChecker(valueConstraints, context);
case PropertyType.DATE:
return new DateTimeConstraintChecker(valueConstraints, context);
case PropertyType.DOUBLE:
return new DoubleConstraintChecker(valueConstraints, context);
case PropertyType.LONG:
return new LongConstraintChecker(valueConstraints, context);
case PropertyType.NAME:
return new NameConstraintChecker(valueConstraints, context);
case PropertyType.PATH:
return new PathConstraintChecker(valueConstraints, context);
case PropertyType.REFERENCE:
case PropertyType.WEAKREFERENCE:
return new ReferenceConstraintChecker(valueConstraints, context);
case org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE:
return new SimpleReferenceConstraintChecker(valueConstraints, context);
case PropertyType.URI:
case PropertyType.STRING:
return new StringConstraintChecker(valueConstraints, context);
case PropertyType.DECIMAL:
return new DecimalConstraintChecker(valueConstraints, context);
case PropertyType.BOOLEAN: {
return new BooleanConstraintChecker(context, valueConstraints);
}
default:
throw new IllegalStateException("Invalid property type: " + type);
}
} | [
"private",
"ConstraintChecker",
"createChecker",
"(",
"ExecutionContext",
"context",
",",
"int",
"type",
",",
"String",
"[",
"]",
"valueConstraints",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"PropertyType",
".",
"BINARY",
":",
"return",
"new",
"Binar... | Returns a {@link ConstraintChecker} that will interpret the constraints described by <code>valueConstraints</code> using
the semantics defined in section 3.6.4 of the JCR 2.0 specification for the type indicated by <code>type</code> (where
<code>type</code> is a value from {@link PropertyType}) for the given <code>context</code>. The {@link ExecutionContext} is
used to provide namespace mappings and value factories for the other constraint checkers.
@param context the execution context
@param type the type of constraint checker that should be created (based on values from {@link PropertyType}).
Type-specific semantics are defined in section 3.7.3.6 of the JCR 2.0 specification.
@param valueConstraints the constraints for the node as provided by {@link PropertyDefinition#getValueConstraints()}.
@return a constraint checker that matches the given parameters | [
"Returns",
"a",
"{",
"@link",
"ConstraintChecker",
"}",
"that",
"will",
"interpret",
"the",
"constraints",
"described",
"by",
"<code",
">",
"valueConstraints<",
"/",
"code",
">",
"using",
"the",
"semantics",
"defined",
"in",
"section",
"3",
".",
"6",
".",
"4... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrPropertyDefinition.java#L454-L486 |
prometheus/client_java | simpleclient_hotspot/src/main/java/io/prometheus/client/hotspot/StandardExports.java | StandardExports.callLongGetter | static Long callLongGetter(Method method, Object obj) throws InvocationTargetException {
"""
Attempts to call a method either directly or via one of the implemented interfaces.
<p>
A Method object refers to a specific method declared in a specific class. The first invocation
might happen with method == SomeConcreteClass.publicLongGetter() and will fail if
SomeConcreteClass is not public. We then recurse over all interfaces implemented by
SomeConcreteClass (or extended by those interfaces and so on) until we eventually invoke
callMethod() with method == SomePublicInterface.publicLongGetter(), which will then succeed.
<p>
There is a built-in assumption that the method will never return null (or, equivalently, that
it returns the primitive data type, i.e. {@code long} rather than {@code Long}). If this
assumption doesn't hold, the method might be called repeatedly and the returned value will be
the one produced by the last call.
"""
try {
return (Long) method.invoke(obj);
} catch (IllegalAccessException e) {
// Expected, the declaring class or interface might not be public.
}
// Iterate over all implemented/extended interfaces and attempt invoking the method with the
// same name and parameters on each.
for (Class<?> clazz : method.getDeclaringClass().getInterfaces()) {
try {
Method interfaceMethod = clazz.getMethod(method.getName(), method.getParameterTypes());
Long result = callLongGetter(interfaceMethod, obj);
if (result != null) {
return result;
}
} catch (NoSuchMethodException e) {
// Expected, class might implement multiple, unrelated interfaces.
}
}
return null;
} | java | static Long callLongGetter(Method method, Object obj) throws InvocationTargetException {
try {
return (Long) method.invoke(obj);
} catch (IllegalAccessException e) {
// Expected, the declaring class or interface might not be public.
}
// Iterate over all implemented/extended interfaces and attempt invoking the method with the
// same name and parameters on each.
for (Class<?> clazz : method.getDeclaringClass().getInterfaces()) {
try {
Method interfaceMethod = clazz.getMethod(method.getName(), method.getParameterTypes());
Long result = callLongGetter(interfaceMethod, obj);
if (result != null) {
return result;
}
} catch (NoSuchMethodException e) {
// Expected, class might implement multiple, unrelated interfaces.
}
}
return null;
} | [
"static",
"Long",
"callLongGetter",
"(",
"Method",
"method",
",",
"Object",
"obj",
")",
"throws",
"InvocationTargetException",
"{",
"try",
"{",
"return",
"(",
"Long",
")",
"method",
".",
"invoke",
"(",
"obj",
")",
";",
"}",
"catch",
"(",
"IllegalAccessExcept... | Attempts to call a method either directly or via one of the implemented interfaces.
<p>
A Method object refers to a specific method declared in a specific class. The first invocation
might happen with method == SomeConcreteClass.publicLongGetter() and will fail if
SomeConcreteClass is not public. We then recurse over all interfaces implemented by
SomeConcreteClass (or extended by those interfaces and so on) until we eventually invoke
callMethod() with method == SomePublicInterface.publicLongGetter(), which will then succeed.
<p>
There is a built-in assumption that the method will never return null (or, equivalently, that
it returns the primitive data type, i.e. {@code long} rather than {@code Long}). If this
assumption doesn't hold, the method might be called repeatedly and the returned value will be
the one produced by the last call. | [
"Attempts",
"to",
"call",
"a",
"method",
"either",
"directly",
"or",
"via",
"one",
"of",
"the",
"implemented",
"interfaces",
".",
"<p",
">",
"A",
"Method",
"object",
"refers",
"to",
"a",
"specific",
"method",
"declared",
"in",
"a",
"specific",
"class",
"."... | train | https://github.com/prometheus/client_java/blob/4e0e7527b048f1ffd0382dcb74c0b9dab23b4d9f/simpleclient_hotspot/src/main/java/io/prometheus/client/hotspot/StandardExports.java#L121-L143 |
spring-projects/spring-flex | spring-flex-core/src/main/java/org/springframework/flex/core/io/SpringPropertyProxy.java | SpringPropertyProxy.proxyFor | public static SpringPropertyProxy proxyFor(Class<?> beanType, boolean useDirectFieldAccess, ConversionService conversionService) {
"""
Factory method for creating correctly configured Spring property proxy instances.
@param beanType the type being introspected
@param useDirectFieldAccess whether to access fields directly
@param conversionService the conversion service to use for property type conversion
@return a properly configured property proxy
"""
if(PropertyProxyUtils.hasAmfCreator(beanType)) {
SpringPropertyProxy proxy = new DelayedWriteSpringPropertyProxy(beanType, useDirectFieldAccess, conversionService);
return proxy;
} else {
Assert.isTrue(beanType.isEnum() || ClassUtils.hasConstructor(beanType), "Failed to create SpringPropertyProxy for "+beanType.getName()+" - Classes mapped " +
"for deserialization from AMF must have either a no-arg default constructor, " +
"or a constructor annotated with "+AmfCreator.class.getName());
SpringPropertyProxy proxy = new SpringPropertyProxy(beanType, useDirectFieldAccess, conversionService);
try {
//If possible, create an instance to introspect and cache the property names
Object instance = BeanUtils.instantiate(beanType);
proxy.setPropertyNames(PropertyProxyUtils.findPropertyNames(conversionService, useDirectFieldAccess, instance));
} catch(BeanInstantiationException ex) {
//Property names can't be cached, but this is ok
}
return proxy;
}
} | java | public static SpringPropertyProxy proxyFor(Class<?> beanType, boolean useDirectFieldAccess, ConversionService conversionService) {
if(PropertyProxyUtils.hasAmfCreator(beanType)) {
SpringPropertyProxy proxy = new DelayedWriteSpringPropertyProxy(beanType, useDirectFieldAccess, conversionService);
return proxy;
} else {
Assert.isTrue(beanType.isEnum() || ClassUtils.hasConstructor(beanType), "Failed to create SpringPropertyProxy for "+beanType.getName()+" - Classes mapped " +
"for deserialization from AMF must have either a no-arg default constructor, " +
"or a constructor annotated with "+AmfCreator.class.getName());
SpringPropertyProxy proxy = new SpringPropertyProxy(beanType, useDirectFieldAccess, conversionService);
try {
//If possible, create an instance to introspect and cache the property names
Object instance = BeanUtils.instantiate(beanType);
proxy.setPropertyNames(PropertyProxyUtils.findPropertyNames(conversionService, useDirectFieldAccess, instance));
} catch(BeanInstantiationException ex) {
//Property names can't be cached, but this is ok
}
return proxy;
}
} | [
"public",
"static",
"SpringPropertyProxy",
"proxyFor",
"(",
"Class",
"<",
"?",
">",
"beanType",
",",
"boolean",
"useDirectFieldAccess",
",",
"ConversionService",
"conversionService",
")",
"{",
"if",
"(",
"PropertyProxyUtils",
".",
"hasAmfCreator",
"(",
"beanType",
"... | Factory method for creating correctly configured Spring property proxy instances.
@param beanType the type being introspected
@param useDirectFieldAccess whether to access fields directly
@param conversionService the conversion service to use for property type conversion
@return a properly configured property proxy | [
"Factory",
"method",
"for",
"creating",
"correctly",
"configured",
"Spring",
"property",
"proxy",
"instances",
"."
] | train | https://github.com/spring-projects/spring-flex/blob/85f2bff300d74e2d77d565f97a09d12d18e19adc/spring-flex-core/src/main/java/org/springframework/flex/core/io/SpringPropertyProxy.java#L73-L93 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java | CompactCharArray.setElementAt | @Deprecated
public void setElementAt(char index, char value) {
"""
Set a new value for a Unicode character.
Set automatically expands the array if it is compacted.
@param index the character to set the mapped value with
@param value the new mapped value
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android
"""
if (isCompact)
expand();
values[index] = value;
touchBlock(index >> BLOCKSHIFT, value);
} | java | @Deprecated
public void setElementAt(char index, char value)
{
if (isCompact)
expand();
values[index] = value;
touchBlock(index >> BLOCKSHIFT, value);
} | [
"@",
"Deprecated",
"public",
"void",
"setElementAt",
"(",
"char",
"index",
",",
"char",
"value",
")",
"{",
"if",
"(",
"isCompact",
")",
"expand",
"(",
")",
";",
"values",
"[",
"index",
"]",
"=",
"value",
";",
"touchBlock",
"(",
"index",
">>",
"BLOCKSHI... | Set a new value for a Unicode character.
Set automatically expands the array if it is compacted.
@param index the character to set the mapped value with
@param value the new mapped value
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Set",
"a",
"new",
"value",
"for",
"a",
"Unicode",
"character",
".",
"Set",
"automatically",
"expands",
"the",
"array",
"if",
"it",
"is",
"compacted",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java#L152-L159 |
bazaarvoice/emodb | web/src/main/java/com/bazaarvoice/emodb/web/scanner/control/ScanPlan.java | ScanPlan.addTokenRangeToCurrentBatchForCluster | public void addTokenRangeToCurrentBatchForCluster(String cluster, String placement, Collection<ScanRange> ranges) {
"""
Adds a collection of scan ranges to the plan for a specific placement. The range collection should all belong
to a single token range in the ring.
@param cluster An identifier for the underlying resources used to scan the placement (typically an identifier for the Cassandra ring)
@param placement The name of the placement
@param ranges All non-overlapping sub-ranges from a single token range in the ring
"""
PlanBatch batch = _clusterTails.get(cluster);
if (batch == null) {
batch = new PlanBatch();
_clusterHeads.put(cluster, batch);
_clusterTails.put(cluster, batch);
}
batch.addPlanItem(new PlanItem(placement, ranges));
} | java | public void addTokenRangeToCurrentBatchForCluster(String cluster, String placement, Collection<ScanRange> ranges) {
PlanBatch batch = _clusterTails.get(cluster);
if (batch == null) {
batch = new PlanBatch();
_clusterHeads.put(cluster, batch);
_clusterTails.put(cluster, batch);
}
batch.addPlanItem(new PlanItem(placement, ranges));
} | [
"public",
"void",
"addTokenRangeToCurrentBatchForCluster",
"(",
"String",
"cluster",
",",
"String",
"placement",
",",
"Collection",
"<",
"ScanRange",
">",
"ranges",
")",
"{",
"PlanBatch",
"batch",
"=",
"_clusterTails",
".",
"get",
"(",
"cluster",
")",
";",
"if",... | Adds a collection of scan ranges to the plan for a specific placement. The range collection should all belong
to a single token range in the ring.
@param cluster An identifier for the underlying resources used to scan the placement (typically an identifier for the Cassandra ring)
@param placement The name of the placement
@param ranges All non-overlapping sub-ranges from a single token range in the ring | [
"Adds",
"a",
"collection",
"of",
"scan",
"ranges",
"to",
"the",
"plan",
"for",
"a",
"specific",
"placement",
".",
"The",
"range",
"collection",
"should",
"all",
"belong",
"to",
"a",
"single",
"token",
"range",
"in",
"the",
"ring",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/scanner/control/ScanPlan.java#L81-L89 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/BaasDocument.java | BaasDocument.fetchAllSync | public static BaasResult<List<BaasDocument>> fetchAllSync(String collection, BaasQuery.Criteria filter) {
"""
Synchronously retrieves the list of documents readable to the user
in <code>collection</code>
@param collection the collection to retrieve not <code>null</code>
@return the result of the request
"""
BaasBox box = BaasBox.getDefaultChecked();
if (collection == null) throw new IllegalArgumentException("collection cannot be null");
Fetch f = new Fetch(box, collection, filter, RequestOptions.DEFAULT, null);
return box.submitSync(f);
} | java | public static BaasResult<List<BaasDocument>> fetchAllSync(String collection, BaasQuery.Criteria filter) {
BaasBox box = BaasBox.getDefaultChecked();
if (collection == null) throw new IllegalArgumentException("collection cannot be null");
Fetch f = new Fetch(box, collection, filter, RequestOptions.DEFAULT, null);
return box.submitSync(f);
} | [
"public",
"static",
"BaasResult",
"<",
"List",
"<",
"BaasDocument",
">",
">",
"fetchAllSync",
"(",
"String",
"collection",
",",
"BaasQuery",
".",
"Criteria",
"filter",
")",
"{",
"BaasBox",
"box",
"=",
"BaasBox",
".",
"getDefaultChecked",
"(",
")",
";",
"if",... | Synchronously retrieves the list of documents readable to the user
in <code>collection</code>
@param collection the collection to retrieve not <code>null</code>
@return the result of the request | [
"Synchronously",
"retrieves",
"the",
"list",
"of",
"documents",
"readable",
"to",
"the",
"user",
"in",
"<code",
">",
"collection<",
"/",
"code",
">"
] | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L276-L281 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/Adapters.java | Adapters.createPutAdapter | public static PutAdapter createPutAdapter(Configuration config, BigtableOptions options) {
"""
<p>createPutAdapter.</p>
@param config a {@link org.apache.hadoop.conf.Configuration} object.
@param options a {@link com.google.cloud.bigtable.config.BigtableOptions} object.
@return a {@link com.google.cloud.bigtable.hbase.adapters.PutAdapter} object.
"""
boolean setClientTimestamp = !options.getRetryOptions().allowRetriesWithoutTimestamp();
return new PutAdapter(config.getInt("hbase.client.keyvalue.maxsize", -1), setClientTimestamp);
} | java | public static PutAdapter createPutAdapter(Configuration config, BigtableOptions options) {
boolean setClientTimestamp = !options.getRetryOptions().allowRetriesWithoutTimestamp();
return new PutAdapter(config.getInt("hbase.client.keyvalue.maxsize", -1), setClientTimestamp);
} | [
"public",
"static",
"PutAdapter",
"createPutAdapter",
"(",
"Configuration",
"config",
",",
"BigtableOptions",
"options",
")",
"{",
"boolean",
"setClientTimestamp",
"=",
"!",
"options",
".",
"getRetryOptions",
"(",
")",
".",
"allowRetriesWithoutTimestamp",
"(",
")",
... | <p>createPutAdapter.</p>
@param config a {@link org.apache.hadoop.conf.Configuration} object.
@param options a {@link com.google.cloud.bigtable.config.BigtableOptions} object.
@return a {@link com.google.cloud.bigtable.hbase.adapters.PutAdapter} object. | [
"<p",
">",
"createPutAdapter",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/Adapters.java#L88-L91 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/Duration.java | Duration.ofSeconds | public static Duration ofSeconds(long seconds, long nanoAdjustment) {
"""
Obtains an instance of {@code Duration} from a number of seconds
and an adjustment in nanoseconds.
<p>
This method allows an arbitrary number of nanoseconds to be passed in.
The factory will alter the values of the second and nanosecond in order
to ensure that the stored nanosecond is in the range 0 to 999,999,999.
For example, the following will result in the exactly the same duration:
<pre>
Duration.ofSeconds(3, 1);
Duration.ofSeconds(4, -999_999_999);
Duration.ofSeconds(2, 1000_000_001);
</pre>
@param seconds the number of seconds, positive or negative
@param nanoAdjustment the nanosecond adjustment to the number of seconds, positive or negative
@return a {@code Duration}, not null
@throws ArithmeticException if the adjustment causes the seconds to exceed the capacity of {@code Duration}
"""
long secs = Jdk8Methods.safeAdd(seconds, Jdk8Methods.floorDiv(nanoAdjustment, NANOS_PER_SECOND));
int nos = Jdk8Methods.floorMod(nanoAdjustment, NANOS_PER_SECOND);
return create(secs, nos);
} | java | public static Duration ofSeconds(long seconds, long nanoAdjustment) {
long secs = Jdk8Methods.safeAdd(seconds, Jdk8Methods.floorDiv(nanoAdjustment, NANOS_PER_SECOND));
int nos = Jdk8Methods.floorMod(nanoAdjustment, NANOS_PER_SECOND);
return create(secs, nos);
} | [
"public",
"static",
"Duration",
"ofSeconds",
"(",
"long",
"seconds",
",",
"long",
"nanoAdjustment",
")",
"{",
"long",
"secs",
"=",
"Jdk8Methods",
".",
"safeAdd",
"(",
"seconds",
",",
"Jdk8Methods",
".",
"floorDiv",
"(",
"nanoAdjustment",
",",
"NANOS_PER_SECOND",... | Obtains an instance of {@code Duration} from a number of seconds
and an adjustment in nanoseconds.
<p>
This method allows an arbitrary number of nanoseconds to be passed in.
The factory will alter the values of the second and nanosecond in order
to ensure that the stored nanosecond is in the range 0 to 999,999,999.
For example, the following will result in the exactly the same duration:
<pre>
Duration.ofSeconds(3, 1);
Duration.ofSeconds(4, -999_999_999);
Duration.ofSeconds(2, 1000_000_001);
</pre>
@param seconds the number of seconds, positive or negative
@param nanoAdjustment the nanosecond adjustment to the number of seconds, positive or negative
@return a {@code Duration}, not null
@throws ArithmeticException if the adjustment causes the seconds to exceed the capacity of {@code Duration} | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"Duration",
"}",
"from",
"a",
"number",
"of",
"seconds",
"and",
"an",
"adjustment",
"in",
"nanoseconds",
".",
"<p",
">",
"This",
"method",
"allows",
"an",
"arbitrary",
"number",
"of",
"nanoseconds",
"to",
"b... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/Duration.java#L212-L216 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/MultiChangeBuilder.java | MultiChangeBuilder.replaceAbsolutely | public MultiChangeBuilder<PS, SEG, S> replaceAbsolutely(int start, int end, StyledDocument<PS, SEG, S> replacement) {
"""
Replaces a range of characters with the given rich-text document.
"""
return absoluteReplace(start, end, ReadOnlyStyledDocument.from(replacement));
} | java | public MultiChangeBuilder<PS, SEG, S> replaceAbsolutely(int start, int end, StyledDocument<PS, SEG, S> replacement) {
return absoluteReplace(start, end, ReadOnlyStyledDocument.from(replacement));
} | [
"public",
"MultiChangeBuilder",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"replaceAbsolutely",
"(",
"int",
"start",
",",
"int",
"end",
",",
"StyledDocument",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"replacement",
")",
"{",
"return",
"absoluteReplace",
"(",
"st... | Replaces a range of characters with the given rich-text document. | [
"Replaces",
"a",
"range",
"of",
"characters",
"with",
"the",
"given",
"rich",
"-",
"text",
"document",
"."
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/MultiChangeBuilder.java#L352-L354 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java | POIUtils.getCell | public static Cell getCell(final Sheet sheet, final int column, final int row) {
"""
シートから任意アドレスのセルを取得する。
<p>{@literal jxl.Sheet.getCell(int column, int row)}</p>
@param sheet シートオブジェクト
@param column 列番号(0から始まる)
@param row 行番号(0から始まる)
@return セル
@throws IllegalArgumentException {@literal sheet == null}
"""
ArgUtils.notNull(sheet, "sheet");
Row rows = sheet.getRow(row);
if(rows == null) {
rows = sheet.createRow(row);
}
Cell cell = rows.getCell(column);
if(cell == null) {
cell = rows.createCell(column, CellType.BLANK);
}
return cell;
} | java | public static Cell getCell(final Sheet sheet, final int column, final int row) {
ArgUtils.notNull(sheet, "sheet");
Row rows = sheet.getRow(row);
if(rows == null) {
rows = sheet.createRow(row);
}
Cell cell = rows.getCell(column);
if(cell == null) {
cell = rows.createCell(column, CellType.BLANK);
}
return cell;
} | [
"public",
"static",
"Cell",
"getCell",
"(",
"final",
"Sheet",
"sheet",
",",
"final",
"int",
"column",
",",
"final",
"int",
"row",
")",
"{",
"ArgUtils",
".",
"notNull",
"(",
"sheet",
",",
"\"sheet\"",
")",
";",
"Row",
"rows",
"=",
"sheet",
".",
"getRow"... | シートから任意アドレスのセルを取得する。
<p>{@literal jxl.Sheet.getCell(int column, int row)}</p>
@param sheet シートオブジェクト
@param column 列番号(0から始まる)
@param row 行番号(0から始まる)
@return セル
@throws IllegalArgumentException {@literal sheet == null} | [
"シートから任意アドレスのセルを取得する。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java#L168-L182 |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.toPdbType | protected DbColumnType toPdbType(final int type, final String typeName) {
"""
Maps the database type to {@link DbColumnType}. If there's no mapping a {@link DbColumnType#UNMAPPED} is returned.
@param type The SQL type from {@link java.sql.Types}.
@param typeName The native database type name. It provides additional information for
derived classes to resolve types unmapped here.
@return The {@link DbColumnType}.
"""
switch (type) {
case Types.BIT:
case Types.BOOLEAN:
return DbColumnType.BOOLEAN;
case Types.CHAR:
case Types.LONGNVARCHAR:
case Types.LONGVARCHAR:
case Types.NCHAR:
case Types.NVARCHAR:
case Types.ROWID:
case Types.SQLXML:
case Types.VARCHAR:
return DbColumnType.STRING;
case Types.INTEGER:
case Types.SMALLINT:
case Types.TINYINT:
return DbColumnType.INT;
case Types.DECIMAL:
case Types.DOUBLE:
case Types.FLOAT:
case Types.NUMERIC:
case Types.REAL:
return DbColumnType.DOUBLE;
case Types.BIGINT:
case Types.TIMESTAMP:
return DbColumnType.LONG;
case Types.BINARY:
case Types.BLOB:
case Types.JAVA_OBJECT:
case Types.LONGVARBINARY:
case Types.VARBINARY:
return DbColumnType.BLOB;
case Types.CLOB:
case Types.NCLOB:
return DbColumnType.CLOB;
case Types.ARRAY:
case Types.DATALINK:
case Types.DATE:
case Types.DISTINCT:
case Types.NULL:
case Types.OTHER:
case Types.REF:
case Types.REF_CURSOR:
case Types.STRUCT:
case Types.TIME:
case Types.TIME_WITH_TIMEZONE:
case Types.TIMESTAMP_WITH_TIMEZONE:
default:
return DbColumnType.UNMAPPED;
}
} | java | protected DbColumnType toPdbType(final int type, final String typeName) {
switch (type) {
case Types.BIT:
case Types.BOOLEAN:
return DbColumnType.BOOLEAN;
case Types.CHAR:
case Types.LONGNVARCHAR:
case Types.LONGVARCHAR:
case Types.NCHAR:
case Types.NVARCHAR:
case Types.ROWID:
case Types.SQLXML:
case Types.VARCHAR:
return DbColumnType.STRING;
case Types.INTEGER:
case Types.SMALLINT:
case Types.TINYINT:
return DbColumnType.INT;
case Types.DECIMAL:
case Types.DOUBLE:
case Types.FLOAT:
case Types.NUMERIC:
case Types.REAL:
return DbColumnType.DOUBLE;
case Types.BIGINT:
case Types.TIMESTAMP:
return DbColumnType.LONG;
case Types.BINARY:
case Types.BLOB:
case Types.JAVA_OBJECT:
case Types.LONGVARBINARY:
case Types.VARBINARY:
return DbColumnType.BLOB;
case Types.CLOB:
case Types.NCLOB:
return DbColumnType.CLOB;
case Types.ARRAY:
case Types.DATALINK:
case Types.DATE:
case Types.DISTINCT:
case Types.NULL:
case Types.OTHER:
case Types.REF:
case Types.REF_CURSOR:
case Types.STRUCT:
case Types.TIME:
case Types.TIME_WITH_TIMEZONE:
case Types.TIMESTAMP_WITH_TIMEZONE:
default:
return DbColumnType.UNMAPPED;
}
} | [
"protected",
"DbColumnType",
"toPdbType",
"(",
"final",
"int",
"type",
",",
"final",
"String",
"typeName",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"Types",
".",
"BIT",
":",
"case",
"Types",
".",
"BOOLEAN",
":",
"return",
"DbColumnType",
".",
"... | Maps the database type to {@link DbColumnType}. If there's no mapping a {@link DbColumnType#UNMAPPED} is returned.
@param type The SQL type from {@link java.sql.Types}.
@param typeName The native database type name. It provides additional information for
derived classes to resolve types unmapped here.
@return The {@link DbColumnType}. | [
"Maps",
"the",
"database",
"type",
"to",
"{",
"@link",
"DbColumnType",
"}",
".",
"If",
"there",
"s",
"no",
"mapping",
"a",
"{",
"@link",
"DbColumnType#UNMAPPED",
"}",
"is",
"returned",
"."
] | train | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1483-L1541 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processNCNAME | Object processNCNAME(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException {
"""
Process an attribute string of type NCName into a String
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value A string that represents a potentially prefix qualified name.
@param owner
@return A String object if this attribute does not support AVT's. Otherwise, an AVT
is returned.
@throws org.xml.sax.SAXException if the string contains a prefix that can not be
resolved, or the string contains syntax that is invalid for a NCName.
"""
if (getSupportsAVT())
{
AVT avt = null;
try
{
avt = new AVT(handler, uri, name, rawName, value, owner);
// If an AVT wasn't used, validate the value
if ((avt.isSimple()) && (!XML11Char.isXML11ValidNCName(value)))
{
handleError(handler,XSLTErrorResources.INVALID_NCNAME,new Object[] {name,value},null);
return null;
}
return avt;
}
catch (TransformerException te)
{
// thrown by AVT constructor
throw new org.xml.sax.SAXException(te);
}
} else {
if (!XML11Char.isXML11ValidNCName(value))
{
handleError(handler,XSLTErrorResources.INVALID_NCNAME,new Object[] {name,value},null);
return null;
}
return value;
}
} | java | Object processNCNAME(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
if (getSupportsAVT())
{
AVT avt = null;
try
{
avt = new AVT(handler, uri, name, rawName, value, owner);
// If an AVT wasn't used, validate the value
if ((avt.isSimple()) && (!XML11Char.isXML11ValidNCName(value)))
{
handleError(handler,XSLTErrorResources.INVALID_NCNAME,new Object[] {name,value},null);
return null;
}
return avt;
}
catch (TransformerException te)
{
// thrown by AVT constructor
throw new org.xml.sax.SAXException(te);
}
} else {
if (!XML11Char.isXML11ValidNCName(value))
{
handleError(handler,XSLTErrorResources.INVALID_NCNAME,new Object[] {name,value},null);
return null;
}
return value;
}
} | [
"Object",
"processNCNAME",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException... | Process an attribute string of type NCName into a String
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value A string that represents a potentially prefix qualified name.
@param owner
@return A String object if this attribute does not support AVT's. Otherwise, an AVT
is returned.
@throws org.xml.sax.SAXException if the string contains a prefix that can not be
resolved, or the string contains syntax that is invalid for a NCName. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"NCName",
"into",
"a",
"String"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1030-L1064 |
structr/structr | structr-ui/src/main/java/org/structr/web/common/FileHelper.java | FileHelper.setFileProperties | public static void setFileProperties (final File file, final String contentType) throws IOException, FrameworkException {
"""
Set the contentType, checksum, size and version properties of the given fileNode
@param file
@param contentType if null, try to auto-detect content type
@throws FrameworkException
@throws IOException
"""
final java.io.File fileOnDisk = file.getFileOnDisk(false);
final PropertyMap map = new PropertyMap();
map.put(StructrApp.key(File.class, "contentType"), contentType != null ? contentType : FileHelper.getContentMimeType(fileOnDisk, file.getProperty(File.name)));
map.put(StructrApp.key(File.class, "size"), FileHelper.getSize(fileOnDisk));
map.put(StructrApp.key(File.class, "version"), 1);
map.putAll(getChecksums(file, fileOnDisk));
file.setProperties(file.getSecurityContext(), map);
} | java | public static void setFileProperties (final File file, final String contentType) throws IOException, FrameworkException {
final java.io.File fileOnDisk = file.getFileOnDisk(false);
final PropertyMap map = new PropertyMap();
map.put(StructrApp.key(File.class, "contentType"), contentType != null ? contentType : FileHelper.getContentMimeType(fileOnDisk, file.getProperty(File.name)));
map.put(StructrApp.key(File.class, "size"), FileHelper.getSize(fileOnDisk));
map.put(StructrApp.key(File.class, "version"), 1);
map.putAll(getChecksums(file, fileOnDisk));
file.setProperties(file.getSecurityContext(), map);
} | [
"public",
"static",
"void",
"setFileProperties",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"contentType",
")",
"throws",
"IOException",
",",
"FrameworkException",
"{",
"final",
"java",
".",
"io",
".",
"File",
"fileOnDisk",
"=",
"file",
".",
"getFil... | Set the contentType, checksum, size and version properties of the given fileNode
@param file
@param contentType if null, try to auto-detect content type
@throws FrameworkException
@throws IOException | [
"Set",
"the",
"contentType",
"checksum",
"size",
"and",
"version",
"properties",
"of",
"the",
"given",
"fileNode"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L307-L319 |
fracpete/multisearch-weka-package | src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java | PerformanceCache.getID | protected String getID(int cv, Point<Object> values) {
"""
returns the ID string for a cache item.
@param cv the number of folds in the cross-validation
@param values the point in the space
@return the ID string
"""
String result;
int i;
result = "" + cv;
for (i = 0; i < values.dimensions(); i++)
result += "\t" + values.getValue(i);
return result;
} | java | protected String getID(int cv, Point<Object> values) {
String result;
int i;
result = "" + cv;
for (i = 0; i < values.dimensions(); i++)
result += "\t" + values.getValue(i);
return result;
} | [
"protected",
"String",
"getID",
"(",
"int",
"cv",
",",
"Point",
"<",
"Object",
">",
"values",
")",
"{",
"String",
"result",
";",
"int",
"i",
";",
"result",
"=",
"\"\"",
"+",
"cv",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"values",
".",
"d... | returns the ID string for a cache item.
@param cv the number of folds in the cross-validation
@param values the point in the space
@return the ID string | [
"returns",
"the",
"ID",
"string",
"for",
"a",
"cache",
"item",
"."
] | train | https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/PerformanceCache.java#L50-L60 |
tango-controls/JTango | server/src/main/java/org/tango/server/build/BuilderUtils.java | BuilderUtils.getPipeName | static String getPipeName(final String fieldName, final Pipe annot) {
"""
Get pipe name from annotation {@link Pipe}
@param fieldName
@param annot
@return
"""
String attributeName = null;
if (annot.name().equals("")) {
attributeName = fieldName;
} else {
attributeName = annot.name();
}
return attributeName;
} | java | static String getPipeName(final String fieldName, final Pipe annot) {
String attributeName = null;
if (annot.name().equals("")) {
attributeName = fieldName;
} else {
attributeName = annot.name();
}
return attributeName;
} | [
"static",
"String",
"getPipeName",
"(",
"final",
"String",
"fieldName",
",",
"final",
"Pipe",
"annot",
")",
"{",
"String",
"attributeName",
"=",
"null",
";",
"if",
"(",
"annot",
".",
"name",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"attribu... | Get pipe name from annotation {@link Pipe}
@param fieldName
@param annot
@return | [
"Get",
"pipe",
"name",
"from",
"annotation",
"{",
"@link",
"Pipe",
"}"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/build/BuilderUtils.java#L92-L100 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_udp_farm_farmId_server_serverId_PUT | public void serviceName_udp_farm_farmId_server_serverId_PUT(String serviceName, Long farmId, Long serverId, OvhBackendUDPServer body) throws IOException {
"""
Alter this object properties
REST: PUT /ipLoadbalancing/{serviceName}/udp/farm/{farmId}/server/{serverId}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP load balancing
@param farmId [required] Id of your farm
@param serverId [required] Id of your server
API beta
"""
String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}/server/{serverId}";
StringBuilder sb = path(qPath, serviceName, farmId, serverId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_udp_farm_farmId_server_serverId_PUT(String serviceName, Long farmId, Long serverId, OvhBackendUDPServer body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}/server/{serverId}";
StringBuilder sb = path(qPath, serviceName, farmId, serverId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_udp_farm_farmId_server_serverId_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"farmId",
",",
"Long",
"serverId",
",",
"OvhBackendUDPServer",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceNa... | Alter this object properties
REST: PUT /ipLoadbalancing/{serviceName}/udp/farm/{farmId}/server/{serverId}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP load balancing
@param farmId [required] Id of your farm
@param serverId [required] Id of your server
API beta | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L961-L965 |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByFacebook | public Iterable<DContact> queryByFacebook(Object parent, java.lang.String facebook) {
"""
query-by method for field facebook
@param facebook the specified attribute
@return an Iterable of DContacts for the specified facebook
"""
return queryByField(parent, DContactMapper.Field.FACEBOOK.getFieldName(), facebook);
} | java | public Iterable<DContact> queryByFacebook(Object parent, java.lang.String facebook) {
return queryByField(parent, DContactMapper.Field.FACEBOOK.getFieldName(), facebook);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByFacebook",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"facebook",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"FACEBOOK",
".",
"getFie... | query-by method for field facebook
@param facebook the specified attribute
@return an Iterable of DContacts for the specified facebook | [
"query",
"-",
"by",
"method",
"for",
"field",
"facebook"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L160-L162 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java | WTableRenderer.paintRows | private void paintRows(final WTable table, final WebXmlRenderContext renderContext) {
"""
Paints the rows of the table.
@param table the table to paint the rows for.
@param renderContext the RenderContext to paint to.
"""
XmlStringBuilder xml = renderContext.getWriter();
TableModel model = table.getTableModel();
xml.appendTagOpen("ui:tbody");
xml.appendAttribute("id", table.getId() + ".body");
xml.appendClose();
if (model.getRowCount() == 0) {
xml.appendTag("ui:nodata");
xml.appendEscaped(table.getNoDataMessage());
xml.appendEndTag("ui:nodata");
} else {
// If has at least one visible col, paint the rows.
final int columnCount = table.getColumnCount();
for (int i = 0; i < columnCount; i++) {
if (table.getColumn(i).isVisible()) {
doPaintRows(table, renderContext);
break;
}
}
}
xml.appendEndTag("ui:tbody");
} | java | private void paintRows(final WTable table, final WebXmlRenderContext renderContext) {
XmlStringBuilder xml = renderContext.getWriter();
TableModel model = table.getTableModel();
xml.appendTagOpen("ui:tbody");
xml.appendAttribute("id", table.getId() + ".body");
xml.appendClose();
if (model.getRowCount() == 0) {
xml.appendTag("ui:nodata");
xml.appendEscaped(table.getNoDataMessage());
xml.appendEndTag("ui:nodata");
} else {
// If has at least one visible col, paint the rows.
final int columnCount = table.getColumnCount();
for (int i = 0; i < columnCount; i++) {
if (table.getColumn(i).isVisible()) {
doPaintRows(table, renderContext);
break;
}
}
}
xml.appendEndTag("ui:tbody");
} | [
"private",
"void",
"paintRows",
"(",
"final",
"WTable",
"table",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"XmlStringBuilder",
"xml",
"=",
"renderContext",
".",
"getWriter",
"(",
")",
";",
"TableModel",
"model",
"=",
"table",
".",
"getTable... | Paints the rows of the table.
@param table the table to paint the rows for.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"rows",
"of",
"the",
"table",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java#L338-L363 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.addSource | public <OUT> DataStreamSource<OUT> addSource(SourceFunction<OUT> function, TypeInformation<OUT> typeInfo) {
"""
Ads a data source with a custom type information thus opening a
{@link DataStream}. Only in very special cases does the user need to
support type information. Otherwise use
{@link #addSource(org.apache.flink.streaming.api.functions.source.SourceFunction)}
@param function
the user defined function
@param <OUT>
type of the returned stream
@param typeInfo
the user defined type information for the stream
@return the data stream constructed
"""
return addSource(function, "Custom Source", typeInfo);
} | java | public <OUT> DataStreamSource<OUT> addSource(SourceFunction<OUT> function, TypeInformation<OUT> typeInfo) {
return addSource(function, "Custom Source", typeInfo);
} | [
"public",
"<",
"OUT",
">",
"DataStreamSource",
"<",
"OUT",
">",
"addSource",
"(",
"SourceFunction",
"<",
"OUT",
">",
"function",
",",
"TypeInformation",
"<",
"OUT",
">",
"typeInfo",
")",
"{",
"return",
"addSource",
"(",
"function",
",",
"\"Custom Source\"",
... | Ads a data source with a custom type information thus opening a
{@link DataStream}. Only in very special cases does the user need to
support type information. Otherwise use
{@link #addSource(org.apache.flink.streaming.api.functions.source.SourceFunction)}
@param function
the user defined function
@param <OUT>
type of the returned stream
@param typeInfo
the user defined type information for the stream
@return the data stream constructed | [
"Ads",
"a",
"data",
"source",
"with",
"a",
"custom",
"type",
"information",
"thus",
"opening",
"a",
"{",
"@link",
"DataStream",
"}",
".",
"Only",
"in",
"very",
"special",
"cases",
"does",
"the",
"user",
"need",
"to",
"support",
"type",
"information",
".",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1429-L1431 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.sendUserEvent | public void sendUserEvent(KeyValueCollection userData, String callUuid, String connId) throws WorkspaceApiException {
"""
Send EventUserEvent to T-Server with the provided attached data. For details about EventUserEvent, refer to the
[*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/SpecialEvents).
@param userData The data to send. This is an array of objects with the properties key, type, and value.
@param callUuid The universally unique identifier associated with the call. (optional)
@param connId The connection ID for the call. This value comes from the Tlib event. (optional)
"""
try {
SendUserEventDataData sendUserEventData = new SendUserEventDataData();
sendUserEventData.setUserData(Util.toKVList(userData));
sendUserEventData.setCallUuid(callUuid);
sendUserEventData.setConnId(connId);
SendUserEventData data = new SendUserEventData();
data.data(sendUserEventData);
ApiSuccessResponse response = this.voiceApi.sendUserEvent(data);
throwIfNotOk("sendUserEvent", response);
} catch (ApiException e) {
throw new WorkspaceApiException("sendUserEvent failed.", e);
}
} | java | public void sendUserEvent(KeyValueCollection userData, String callUuid, String connId) throws WorkspaceApiException {
try {
SendUserEventDataData sendUserEventData = new SendUserEventDataData();
sendUserEventData.setUserData(Util.toKVList(userData));
sendUserEventData.setCallUuid(callUuid);
sendUserEventData.setConnId(connId);
SendUserEventData data = new SendUserEventData();
data.data(sendUserEventData);
ApiSuccessResponse response = this.voiceApi.sendUserEvent(data);
throwIfNotOk("sendUserEvent", response);
} catch (ApiException e) {
throw new WorkspaceApiException("sendUserEvent failed.", e);
}
} | [
"public",
"void",
"sendUserEvent",
"(",
"KeyValueCollection",
"userData",
",",
"String",
"callUuid",
",",
"String",
"connId",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"SendUserEventDataData",
"sendUserEventData",
"=",
"new",
"SendUserEventDataData",
"(",... | Send EventUserEvent to T-Server with the provided attached data. For details about EventUserEvent, refer to the
[*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/SpecialEvents).
@param userData The data to send. This is an array of objects with the properties key, type, and value.
@param callUuid The universally unique identifier associated with the call. (optional)
@param connId The connection ID for the call. This value comes from the Tlib event. (optional) | [
"Send",
"EventUserEvent",
"to",
"T",
"-",
"Server",
"with",
"the",
"provided",
"attached",
"data",
".",
"For",
"details",
"about",
"EventUserEvent",
"refer",
"to",
"the",
"[",
"*",
"Genesys",
"Events",
"and",
"Models",
"Reference",
"Manual",
"*",
"]",
"(",
... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1182-L1197 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLogoutExtensionProcessor.java | FormLogoutExtensionProcessor.formLogout | private void formLogout(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
"""
Log the user out by clearing the LTPA cookie if LTPA and SSO are enabled. Must also invalidate
the http session since it contains user id and password.
Finally, if the user specified an exit page with a form parameter of logoutExitPage,
redirect to the specified page.
This is a special hidden servlet which is always loaded by the servlet engine. Logout is
achieved by having a html, jsp, or other servlet which specifies ibm_security_logout
HTTP post action.
@param req The http request object
@param res The http response object.
@exception ServletException
@exception IOException
"""
try {
// if we have a valid custom logout page, set an attribute so SAML SLO knows about it.
String exitPage = getValidLogoutExitPage(req);
if (exitPage != null) {
req.setAttribute("FormLogoutExitPage", exitPage);
}
authenticateApi.logout(req, res, webAppSecurityConfig);
String str = null;
// if SAML SLO is in use, it will write the audit record and take care of the logoutExitPage redirection
if (req.getAttribute("SpSLOInProgress") == null) {
AuthenticationResult authResult = new AuthenticationResult(AuthResult.SUCCESS, str);
authResult.setAuditLogoutSubject(authenticateApi.returnSubjectOnLogout());
authResult.setAuditCredType("FORM");
authResult.setAuditOutcome(AuditEvent.OUTCOME_SUCCESS);
authResult.setTargetRealm(authResult.realm);
Audit.audit(Audit.EventID.SECURITY_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
redirectLogoutExitPage(req, res);
}
} catch (ServletException se) {
String str = "ServletException: " + se.getMessage();
AuthenticationResult authResult = new AuthenticationResult(AuthResult.FAILURE, str);
authResult.setAuditCredType("FORM");
authResult.setAuditOutcome(AuditEvent.OUTCOME_FAILURE);
authResult.setTargetRealm(authResult.realm);
Audit.audit(Audit.EventID.SECURITY_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
throw se;
} catch (IOException ie) {
String str = "IOException: " + ie.getMessage();
AuthenticationResult authResult = new AuthenticationResult(AuthResult.FAILURE, str);
authResult.setAuditCredType("FORM");
authResult.setAuditOutcome(AuditEvent.OUTCOME_FAILURE);
authResult.setTargetRealm(authResult.realm);
Audit.audit(Audit.EventID.SECURITY_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
throw ie;
}
} | java | private void formLogout(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
try {
// if we have a valid custom logout page, set an attribute so SAML SLO knows about it.
String exitPage = getValidLogoutExitPage(req);
if (exitPage != null) {
req.setAttribute("FormLogoutExitPage", exitPage);
}
authenticateApi.logout(req, res, webAppSecurityConfig);
String str = null;
// if SAML SLO is in use, it will write the audit record and take care of the logoutExitPage redirection
if (req.getAttribute("SpSLOInProgress") == null) {
AuthenticationResult authResult = new AuthenticationResult(AuthResult.SUCCESS, str);
authResult.setAuditLogoutSubject(authenticateApi.returnSubjectOnLogout());
authResult.setAuditCredType("FORM");
authResult.setAuditOutcome(AuditEvent.OUTCOME_SUCCESS);
authResult.setTargetRealm(authResult.realm);
Audit.audit(Audit.EventID.SECURITY_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
redirectLogoutExitPage(req, res);
}
} catch (ServletException se) {
String str = "ServletException: " + se.getMessage();
AuthenticationResult authResult = new AuthenticationResult(AuthResult.FAILURE, str);
authResult.setAuditCredType("FORM");
authResult.setAuditOutcome(AuditEvent.OUTCOME_FAILURE);
authResult.setTargetRealm(authResult.realm);
Audit.audit(Audit.EventID.SECURITY_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
throw se;
} catch (IOException ie) {
String str = "IOException: " + ie.getMessage();
AuthenticationResult authResult = new AuthenticationResult(AuthResult.FAILURE, str);
authResult.setAuditCredType("FORM");
authResult.setAuditOutcome(AuditEvent.OUTCOME_FAILURE);
authResult.setTargetRealm(authResult.realm);
Audit.audit(Audit.EventID.SECURITY_AUTHN_TERMINATE_01, req, authResult, Integer.valueOf(res.getStatus()));
throw ie;
}
} | [
"private",
"void",
"formLogout",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"try",
"{",
"// if we have a valid custom logout page, set an attribute so SAML SLO knows about it.",
"String",
"exi... | Log the user out by clearing the LTPA cookie if LTPA and SSO are enabled. Must also invalidate
the http session since it contains user id and password.
Finally, if the user specified an exit page with a form parameter of logoutExitPage,
redirect to the specified page.
This is a special hidden servlet which is always loaded by the servlet engine. Logout is
achieved by having a html, jsp, or other servlet which specifies ibm_security_logout
HTTP post action.
@param req The http request object
@param res The http response object.
@exception ServletException
@exception IOException | [
"Log",
"the",
"user",
"out",
"by",
"clearing",
"the",
"LTPA",
"cookie",
"if",
"LTPA",
"and",
"SSO",
"are",
"enabled",
".",
"Must",
"also",
"invalidate",
"the",
"http",
"session",
"since",
"it",
"contains",
"user",
"id",
"and",
"password",
".",
"Finally",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLogoutExtensionProcessor.java#L98-L142 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/view/explorer/BugPrioritySorter.java | BugPrioritySorter.compareGroups | static int compareGroups(BugGroup m1, BugGroup m2) {
"""
Sorts bug groups on severity first, then on bug pattern name.
"""
int result = m1.compareTo(m2);
if (result == 0) {
return m1.getShortDescription().compareToIgnoreCase(m2.getShortDescription());
}
return result;
} | java | static int compareGroups(BugGroup m1, BugGroup m2) {
int result = m1.compareTo(m2);
if (result == 0) {
return m1.getShortDescription().compareToIgnoreCase(m2.getShortDescription());
}
return result;
} | [
"static",
"int",
"compareGroups",
"(",
"BugGroup",
"m1",
",",
"BugGroup",
"m2",
")",
"{",
"int",
"result",
"=",
"m1",
".",
"compareTo",
"(",
"m2",
")",
";",
"if",
"(",
"result",
"==",
"0",
")",
"{",
"return",
"m1",
".",
"getShortDescription",
"(",
")... | Sorts bug groups on severity first, then on bug pattern name. | [
"Sorts",
"bug",
"groups",
"on",
"severity",
"first",
"then",
"on",
"bug",
"pattern",
"name",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/view/explorer/BugPrioritySorter.java#L74-L80 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/layout/GraphicsDeviceExtensions.java | GraphicsDeviceExtensions.showOnScreen | public static void showOnScreen(final int screen, final JFrame frame) {
"""
If the screen is available the given {@link JFrame} will be show in the given screen.
@param screen
the screen number.
@param frame
the {@link JFrame}
"""
if (isScreenAvailableToShow(screen))
{
final GraphicsDevice[] graphicsDevices = getAvailableScreens();
graphicsDevices[screen].setFullScreenWindow(frame);
}
} | java | public static void showOnScreen(final int screen, final JFrame frame)
{
if (isScreenAvailableToShow(screen))
{
final GraphicsDevice[] graphicsDevices = getAvailableScreens();
graphicsDevices[screen].setFullScreenWindow(frame);
}
} | [
"public",
"static",
"void",
"showOnScreen",
"(",
"final",
"int",
"screen",
",",
"final",
"JFrame",
"frame",
")",
"{",
"if",
"(",
"isScreenAvailableToShow",
"(",
"screen",
")",
")",
"{",
"final",
"GraphicsDevice",
"[",
"]",
"graphicsDevices",
"=",
"getAvailable... | If the screen is available the given {@link JFrame} will be show in the given screen.
@param screen
the screen number.
@param frame
the {@link JFrame} | [
"If",
"the",
"screen",
"is",
"available",
"the",
"given",
"{",
"@link",
"JFrame",
"}",
"will",
"be",
"show",
"in",
"the",
"given",
"screen",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/layout/GraphicsDeviceExtensions.java#L137-L144 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java | RespokeClient.getEndpoint | public RespokeEndpoint getEndpoint(String endpointIDToFind, boolean skipCreate) {
"""
Find an endpoint by id and return it. In most cases, if we don't find it we will create it. This is useful
in the case of dynamic endpoints where groups are not in use. Set skipCreate=true to return null
if the Endpoint is not already known.
@param endpointIDToFind The ID of the endpoint to return
@param skipCreate If true, return null if the connection is not already known
@return The endpoint whose ID was specified
"""
RespokeEndpoint endpoint = null;
if (null != endpointIDToFind) {
for (RespokeEndpoint eachEndpoint : knownEndpoints) {
if (eachEndpoint.getEndpointID().equals(endpointIDToFind)) {
endpoint = eachEndpoint;
break;
}
}
if ((null == endpoint) && (!skipCreate)) {
endpoint = new RespokeEndpoint(signalingChannel, endpointIDToFind, this);
knownEndpoints.add(endpoint);
}
if (null != endpoint) {
queuePresenceRegistration(endpoint.getEndpointID());
}
}
return endpoint;
} | java | public RespokeEndpoint getEndpoint(String endpointIDToFind, boolean skipCreate) {
RespokeEndpoint endpoint = null;
if (null != endpointIDToFind) {
for (RespokeEndpoint eachEndpoint : knownEndpoints) {
if (eachEndpoint.getEndpointID().equals(endpointIDToFind)) {
endpoint = eachEndpoint;
break;
}
}
if ((null == endpoint) && (!skipCreate)) {
endpoint = new RespokeEndpoint(signalingChannel, endpointIDToFind, this);
knownEndpoints.add(endpoint);
}
if (null != endpoint) {
queuePresenceRegistration(endpoint.getEndpointID());
}
}
return endpoint;
} | [
"public",
"RespokeEndpoint",
"getEndpoint",
"(",
"String",
"endpointIDToFind",
",",
"boolean",
"skipCreate",
")",
"{",
"RespokeEndpoint",
"endpoint",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"endpointIDToFind",
")",
"{",
"for",
"(",
"RespokeEndpoint",
"eachEndpo... | Find an endpoint by id and return it. In most cases, if we don't find it we will create it. This is useful
in the case of dynamic endpoints where groups are not in use. Set skipCreate=true to return null
if the Endpoint is not already known.
@param endpointIDToFind The ID of the endpoint to return
@param skipCreate If true, return null if the connection is not already known
@return The endpoint whose ID was specified | [
"Find",
"an",
"endpoint",
"by",
"id",
"and",
"return",
"it",
".",
"In",
"most",
"cases",
"if",
"we",
"don",
"t",
"find",
"it",
"we",
"will",
"create",
"it",
".",
"This",
"is",
"useful",
"in",
"the",
"case",
"of",
"dynamic",
"endpoints",
"where",
"gro... | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java#L512-L534 |
sriharshachilakapati/WebGL4J | webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java | WebGL10.glBindBuffer | public static void glBindBuffer(int target, int buffer) {
"""
<p>{@code glBindBuffer} binds a buffer object to the specified buffer binding point. Calling {@code glBindBuffer}
with {@code target} set to one of the accepted symbolic constants and {@code buffer} set to the name of a buffer
object binds that buffer object name to the target. If no buffer object with name {@code buffer} exists, one is
created with that name. When a buffer object is bound to a target, the previous binding for that target is
automatically broken.</p>
<p>{@link #GL_INVALID_ENUM} is generated if target is not one of the allowable values.</p>
<p>{@link #GL_INVALID_VALUE} is generated if buffer is not a name previously returned from a call to {@link
#glCreateBuffer()}.
@param target Specifies the target to which the buffer object is bound. The symbolic constant must be {@link
#GL_ARRAY_BUFFER}, {@link #GL_ELEMENT_ARRAY_BUFFER}.
@param buffer Specifies the name of a buffer object.
"""
checkContextCompatibility();
nglBindBuffer(target, WebGLObjectMap.get().toBuffer(buffer));
} | java | public static void glBindBuffer(int target, int buffer)
{
checkContextCompatibility();
nglBindBuffer(target, WebGLObjectMap.get().toBuffer(buffer));
} | [
"public",
"static",
"void",
"glBindBuffer",
"(",
"int",
"target",
",",
"int",
"buffer",
")",
"{",
"checkContextCompatibility",
"(",
")",
";",
"nglBindBuffer",
"(",
"target",
",",
"WebGLObjectMap",
".",
"get",
"(",
")",
".",
"toBuffer",
"(",
"buffer",
")",
... | <p>{@code glBindBuffer} binds a buffer object to the specified buffer binding point. Calling {@code glBindBuffer}
with {@code target} set to one of the accepted symbolic constants and {@code buffer} set to the name of a buffer
object binds that buffer object name to the target. If no buffer object with name {@code buffer} exists, one is
created with that name. When a buffer object is bound to a target, the previous binding for that target is
automatically broken.</p>
<p>{@link #GL_INVALID_ENUM} is generated if target is not one of the allowable values.</p>
<p>{@link #GL_INVALID_VALUE} is generated if buffer is not a name previously returned from a call to {@link
#glCreateBuffer()}.
@param target Specifies the target to which the buffer object is bound. The symbolic constant must be {@link
#GL_ARRAY_BUFFER}, {@link #GL_ELEMENT_ARRAY_BUFFER}.
@param buffer Specifies the name of a buffer object. | [
"<p",
">",
"{",
"@code",
"glBindBuffer",
"}",
"binds",
"a",
"buffer",
"object",
"to",
"the",
"specified",
"buffer",
"binding",
"point",
".",
"Calling",
"{",
"@code",
"glBindBuffer",
"}",
"with",
"{",
"@code",
"target",
"}",
"set",
"to",
"one",
"of",
"the... | train | https://github.com/sriharshachilakapati/WebGL4J/blob/7daa425300b08b338b50cef2935289849c92d415/webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java#L577-L581 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java | SDVariable.rsub | public SDVariable rsub(String name, SDVariable x) {
"""
Reverse subtraction operation: elementwise {@code x - this}<br>
If this and x variables have equal shape, the output shape is the same as the inputs.<br>
Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast.
@param name Name of the output variable
@param x Variable to perform operation with
@return Output (result) SDVariable
"""
val result = sameDiff.f().rsub(this,x);
return sameDiff.updateVariableNameAndReference(result,name);
} | java | public SDVariable rsub(String name, SDVariable x) {
val result = sameDiff.f().rsub(this,x);
return sameDiff.updateVariableNameAndReference(result,name);
} | [
"public",
"SDVariable",
"rsub",
"(",
"String",
"name",
",",
"SDVariable",
"x",
")",
"{",
"val",
"result",
"=",
"sameDiff",
".",
"f",
"(",
")",
".",
"rsub",
"(",
"this",
",",
"x",
")",
";",
"return",
"sameDiff",
".",
"updateVariableNameAndReference",
"(",... | Reverse subtraction operation: elementwise {@code x - this}<br>
If this and x variables have equal shape, the output shape is the same as the inputs.<br>
Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast.
@param name Name of the output variable
@param x Variable to perform operation with
@return Output (result) SDVariable | [
"Reverse",
"subtraction",
"operation",
":",
"elementwise",
"{",
"@code",
"x",
"-",
"this",
"}",
"<br",
">",
"If",
"this",
"and",
"x",
"variables",
"have",
"equal",
"shape",
"the",
"output",
"shape",
"is",
"the",
"same",
"as",
"the",
"inputs",
".",
"<br",... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L933-L936 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/ImagesInner.java | ImagesInner.beginUpdateAsync | public Observable<ImageInner> beginUpdateAsync(String resourceGroupName, String imageName, ImageUpdate parameters) {
"""
Update an image.
@param resourceGroupName The name of the resource group.
@param imageName The name of the image.
@param parameters Parameters supplied to the Update Image operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageInner object
"""
return beginUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).map(new Func1<ServiceResponse<ImageInner>, ImageInner>() {
@Override
public ImageInner call(ServiceResponse<ImageInner> response) {
return response.body();
}
});
} | java | public Observable<ImageInner> beginUpdateAsync(String resourceGroupName, String imageName, ImageUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).map(new Func1<ServiceResponse<ImageInner>, ImageInner>() {
@Override
public ImageInner call(ServiceResponse<ImageInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImageInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"imageName",
",",
"ImageUpdate",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"imageName",
"... | Update an image.
@param resourceGroupName The name of the resource group.
@param imageName The name of the image.
@param parameters Parameters supplied to the Update Image operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageInner object | [
"Update",
"an",
"image",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/ImagesInner.java#L402-L409 |
eurekaclinical/javautil | src/main/java/org/arp/javautil/collections/Collections.java | Collections.putSet | public static <K, V> void putSet(Map<K, Set<V>> map, K key, V valueElt) {
"""
Puts a value into a map of key -> set of values. If the specified key
is new, it creates a {@link HashSet} as its value.
@param map a {@link Map}.
@param key a key.
@param valueElt a value.
"""
if (map.containsKey(key)) {
Set<V> l = map.get(key);
l.add(valueElt);
} else {
Set<V> l = new HashSet<>();
l.add(valueElt);
map.put(key, l);
}
} | java | public static <K, V> void putSet(Map<K, Set<V>> map, K key, V valueElt) {
if (map.containsKey(key)) {
Set<V> l = map.get(key);
l.add(valueElt);
} else {
Set<V> l = new HashSet<>();
l.add(valueElt);
map.put(key, l);
}
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"putSet",
"(",
"Map",
"<",
"K",
",",
"Set",
"<",
"V",
">",
">",
"map",
",",
"K",
"key",
",",
"V",
"valueElt",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"S... | Puts a value into a map of key -> set of values. If the specified key
is new, it creates a {@link HashSet} as its value.
@param map a {@link Map}.
@param key a key.
@param valueElt a value. | [
"Puts",
"a",
"value",
"into",
"a",
"map",
"of",
"key",
"-",
">",
"set",
"of",
"values",
".",
"If",
"the",
"specified",
"key",
"is",
"new",
"it",
"creates",
"a",
"{"
] | train | https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/collections/Collections.java#L82-L91 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.queryEvents | public void queryEvents(@NonNull final String conversationId, @NonNull final Long from, @NonNull final Integer limit, @Nullable Callback<ComapiResult<EventsQueryResponse>> callback) {
"""
Query chanel events.
@param conversationId ID of a conversation to query events in it.
@param from ID of the event to start from.
@param limit Limit of events to obtain in this call.
@param callback Callback to deliver new session instance.
"""
adapter.adapt(queryEvents(conversationId, from, limit), callback);
} | java | public void queryEvents(@NonNull final String conversationId, @NonNull final Long from, @NonNull final Integer limit, @Nullable Callback<ComapiResult<EventsQueryResponse>> callback) {
adapter.adapt(queryEvents(conversationId, from, limit), callback);
} | [
"public",
"void",
"queryEvents",
"(",
"@",
"NonNull",
"final",
"String",
"conversationId",
",",
"@",
"NonNull",
"final",
"Long",
"from",
",",
"@",
"NonNull",
"final",
"Integer",
"limit",
",",
"@",
"Nullable",
"Callback",
"<",
"ComapiResult",
"<",
"EventsQueryR... | Query chanel events.
@param conversationId ID of a conversation to query events in it.
@param from ID of the event to start from.
@param limit Limit of events to obtain in this call.
@param callback Callback to deliver new session instance. | [
"Query",
"chanel",
"events",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L857-L859 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/util/retry/Retry.java | Retry.wrapForRetry | public static <T> Observable<T> wrapForRetry(Observable<T> source, int maxAttempts) {
"""
Wrap an {@link Observable} so that it will retry on all errors for a maximum number of times.
The retry is almost immediate (1ms delay).
@param source the {@link Observable} to wrap.
@param maxAttempts the maximum number of times to attempt a retry. It will be capped at <code>{@link Integer#MAX_VALUE} - 1</code>.
@param <T> the type of items emitted by the source Observable.
@return the wrapped retrying Observable.
"""
return wrapForRetry(source, new RetryWithDelayHandler(maxAttempts, DEFAULT_DELAY));
} | java | public static <T> Observable<T> wrapForRetry(Observable<T> source, int maxAttempts) {
return wrapForRetry(source, new RetryWithDelayHandler(maxAttempts, DEFAULT_DELAY));
} | [
"public",
"static",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"wrapForRetry",
"(",
"Observable",
"<",
"T",
">",
"source",
",",
"int",
"maxAttempts",
")",
"{",
"return",
"wrapForRetry",
"(",
"source",
",",
"new",
"RetryWithDelayHandler",
"(",
"maxAttempts",... | Wrap an {@link Observable} so that it will retry on all errors for a maximum number of times.
The retry is almost immediate (1ms delay).
@param source the {@link Observable} to wrap.
@param maxAttempts the maximum number of times to attempt a retry. It will be capped at <code>{@link Integer#MAX_VALUE} - 1</code>.
@param <T> the type of items emitted by the source Observable.
@return the wrapped retrying Observable. | [
"Wrap",
"an",
"{",
"@link",
"Observable",
"}",
"so",
"that",
"it",
"will",
"retry",
"on",
"all",
"errors",
"for",
"a",
"maximum",
"number",
"of",
"times",
".",
"The",
"retry",
"is",
"almost",
"immediate",
"(",
"1ms",
"delay",
")",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/retry/Retry.java#L51-L53 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/Record.java | Record.handleRemoteCommand | public Object handleRemoteCommand(String strCommand, Map<String, Object> properties, boolean bWriteAndRefresh, boolean bDontCallIfLocal, boolean bCloneServerRecord)
throws DBException, RemoteException {
"""
Do a remote command.
This method simplifies the task of calling a remote method.
Instead of having to override the session, all you have to do is override
doRemoteCommand in your record and handleRemoteCommand will call the remote version of the record.
@param strCommand
@param properties
@return
"""
RemoteTarget remoteTask = this.getTable().getRemoteTableType(org.jbundle.model.Remote.class);
if (bWriteAndRefresh)
this.writeAndRefresh();
if (remoteTask == null)
{
if (bDontCallIfLocal)
return Boolean.FALSE;
else
return this.doRemoteCommand(strCommand, properties);
}
if (bCloneServerRecord)
{
if (properties == null)
properties = new HashMap<String, Object>();
properties.put(MenuConstants.CLONE, Boolean.TRUE);
properties.put(DBParams.RECORD, this.getClass().getName());
}
return remoteTask.doRemoteAction(strCommand, properties);
} | java | public Object handleRemoteCommand(String strCommand, Map<String, Object> properties, boolean bWriteAndRefresh, boolean bDontCallIfLocal, boolean bCloneServerRecord)
throws DBException, RemoteException
{
RemoteTarget remoteTask = this.getTable().getRemoteTableType(org.jbundle.model.Remote.class);
if (bWriteAndRefresh)
this.writeAndRefresh();
if (remoteTask == null)
{
if (bDontCallIfLocal)
return Boolean.FALSE;
else
return this.doRemoteCommand(strCommand, properties);
}
if (bCloneServerRecord)
{
if (properties == null)
properties = new HashMap<String, Object>();
properties.put(MenuConstants.CLONE, Boolean.TRUE);
properties.put(DBParams.RECORD, this.getClass().getName());
}
return remoteTask.doRemoteAction(strCommand, properties);
} | [
"public",
"Object",
"handleRemoteCommand",
"(",
"String",
"strCommand",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"boolean",
"bWriteAndRefresh",
",",
"boolean",
"bDontCallIfLocal",
",",
"boolean",
"bCloneServerRecord",
")",
"throws",
"DBExcep... | Do a remote command.
This method simplifies the task of calling a remote method.
Instead of having to override the session, all you have to do is override
doRemoteCommand in your record and handleRemoteCommand will call the remote version of the record.
@param strCommand
@param properties
@return | [
"Do",
"a",
"remote",
"command",
".",
"This",
"method",
"simplifies",
"the",
"task",
"of",
"calling",
"a",
"remote",
"method",
".",
"Instead",
"of",
"having",
"to",
"override",
"the",
"session",
"all",
"you",
"have",
"to",
"do",
"is",
"override",
"doRemoteC... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L3401-L3422 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/db/QueryResults.java | QueryResults.getValue | public String getValue(String propertyName, int index) throws JspCoreException {
"""
This method was created in VisualAge.
@return java.lang.String
@param propertyName java.lang.String
"""
if (rows.size() > index) {
QueryRow qr = (QueryRow) rows.elementAt(index);
return (qr.getValue(propertyName));
}
else
return (null);
} | java | public String getValue(String propertyName, int index) throws JspCoreException {
if (rows.size() > index) {
QueryRow qr = (QueryRow) rows.elementAt(index);
return (qr.getValue(propertyName));
}
else
return (null);
} | [
"public",
"String",
"getValue",
"(",
"String",
"propertyName",
",",
"int",
"index",
")",
"throws",
"JspCoreException",
"{",
"if",
"(",
"rows",
".",
"size",
"(",
")",
">",
"index",
")",
"{",
"QueryRow",
"qr",
"=",
"(",
"QueryRow",
")",
"rows",
".",
"ele... | This method was created in VisualAge.
@return java.lang.String
@param propertyName java.lang.String | [
"This",
"method",
"was",
"created",
"in",
"VisualAge",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsp/src/com/ibm/ws/jsp/tsx/db/QueryResults.java#L117-L124 |
structr/structr | structr-core/src/main/java/org/structr/common/ValidationHelper.java | ValidationHelper.isValidStringNotBlank | public static boolean isValidStringNotBlank(final GraphObject node, final PropertyKey<String> key, final ErrorBuffer errorBuffer) {
"""
Checks whether the value for the given property key of the given node
is a non-empty string.
@param node the node
@param key the property key
@param errorBuffer the error buffer
@return true if the condition is valid
"""
if (StringUtils.isNotBlank(node.getProperty(key))) {
return true;
}
errorBuffer.add(new EmptyPropertyToken(node.getType(), key));
return false;
} | java | public static boolean isValidStringNotBlank(final GraphObject node, final PropertyKey<String> key, final ErrorBuffer errorBuffer) {
if (StringUtils.isNotBlank(node.getProperty(key))) {
return true;
}
errorBuffer.add(new EmptyPropertyToken(node.getType(), key));
return false;
} | [
"public",
"static",
"boolean",
"isValidStringNotBlank",
"(",
"final",
"GraphObject",
"node",
",",
"final",
"PropertyKey",
"<",
"String",
">",
"key",
",",
"final",
"ErrorBuffer",
"errorBuffer",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"node",
... | Checks whether the value for the given property key of the given node
is a non-empty string.
@param node the node
@param key the property key
@param errorBuffer the error buffer
@return true if the condition is valid | [
"Checks",
"whether",
"the",
"value",
"for",
"the",
"given",
"property",
"key",
"of",
"the",
"given",
"node",
"is",
"a",
"non",
"-",
"empty",
"string",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/ValidationHelper.java#L102-L112 |
codelibs/jcifs | src/main/java/jcifs/smb1/netbios/NbtAddress.java | NbtAddress.getByName | public static NbtAddress getByName( String host,
int type,
String scope )
throws UnknownHostException {
"""
Determines the address of a host given it's host name. NetBIOS
names also have a <code>type</code>. Types(aka Hex Codes)
are used to distiquish the various services on a host. <a
href="../../../nbtcodes.html">Here</a> is
a fairly complete list of NetBIOS hex codes. Scope is not used but is
still functional in other NetBIOS products and so for completeness it has been
implemented. A <code>scope</code> of <code>null</code> or <code>""</code>
signifies no scope.
@param host the name to resolve
@param type the hex code of the name
@param scope the scope of the name
@throws java.net.UnknownHostException if there is an error resolving the name
"""
return getByName( host, type, scope, null );
} | java | public static NbtAddress getByName( String host,
int type,
String scope )
throws UnknownHostException {
return getByName( host, type, scope, null );
} | [
"public",
"static",
"NbtAddress",
"getByName",
"(",
"String",
"host",
",",
"int",
"type",
",",
"String",
"scope",
")",
"throws",
"UnknownHostException",
"{",
"return",
"getByName",
"(",
"host",
",",
"type",
",",
"scope",
",",
"null",
")",
";",
"}"
] | Determines the address of a host given it's host name. NetBIOS
names also have a <code>type</code>. Types(aka Hex Codes)
are used to distiquish the various services on a host. <a
href="../../../nbtcodes.html">Here</a> is
a fairly complete list of NetBIOS hex codes. Scope is not used but is
still functional in other NetBIOS products and so for completeness it has been
implemented. A <code>scope</code> of <code>null</code> or <code>""</code>
signifies no scope.
@param host the name to resolve
@param type the hex code of the name
@param scope the scope of the name
@throws java.net.UnknownHostException if there is an error resolving the name | [
"Determines",
"the",
"address",
"of",
"a",
"host",
"given",
"it",
"s",
"host",
"name",
".",
"NetBIOS",
"names",
"also",
"have",
"a",
"<code",
">",
"type<",
"/",
"code",
">",
".",
"Types",
"(",
"aka",
"Hex",
"Codes",
")",
"are",
"used",
"to",
"distiqu... | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/netbios/NbtAddress.java#L399-L405 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/avro/HiveAvroCopyEntityHelper.java | HiveAvroCopyEntityHelper.updatePartitionAttributesIfAvro | public static void updatePartitionAttributesIfAvro(Table targetTable, Map<List<String>, Partition> sourcePartitions, HiveCopyEntityHelper hiveHelper) throws IOException {
"""
Currently updated the {@link #HIVE_TABLE_AVRO_SCHEMA_URL} location for new hive partitions
@param targetTable, new Table to be registered in hive
@param sourcePartitions, source partitions
@throws IOException
"""
if (isHiveTableAvroType(targetTable)) {
for (Map.Entry<List<String>, Partition> partition : sourcePartitions.entrySet()) {
updateAvroSchemaURL(partition.getValue().getCompleteName(), partition.getValue().getTPartition().getSd(), hiveHelper);
}
}
} | java | public static void updatePartitionAttributesIfAvro(Table targetTable, Map<List<String>, Partition> sourcePartitions, HiveCopyEntityHelper hiveHelper) throws IOException {
if (isHiveTableAvroType(targetTable)) {
for (Map.Entry<List<String>, Partition> partition : sourcePartitions.entrySet()) {
updateAvroSchemaURL(partition.getValue().getCompleteName(), partition.getValue().getTPartition().getSd(), hiveHelper);
}
}
} | [
"public",
"static",
"void",
"updatePartitionAttributesIfAvro",
"(",
"Table",
"targetTable",
",",
"Map",
"<",
"List",
"<",
"String",
">",
",",
"Partition",
">",
"sourcePartitions",
",",
"HiveCopyEntityHelper",
"hiveHelper",
")",
"throws",
"IOException",
"{",
"if",
... | Currently updated the {@link #HIVE_TABLE_AVRO_SCHEMA_URL} location for new hive partitions
@param targetTable, new Table to be registered in hive
@param sourcePartitions, source partitions
@throws IOException | [
"Currently",
"updated",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/avro/HiveAvroCopyEntityHelper.java#L63-L69 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java | BeanDefinitionParserUtils.setPropertyReference | public static void setPropertyReference(BeanDefinitionBuilder builder, String beanReference, String propertyName) {
"""
Sets the property reference on bean definition in case reference
is set properly.
@param builder the bean definition builder to be configured
@param beanReference bean reference to populate the property
@param propertyName the name of the property
"""
if (StringUtils.hasText(beanReference)) {
builder.addPropertyReference(propertyName, beanReference);
}
} | java | public static void setPropertyReference(BeanDefinitionBuilder builder, String beanReference, String propertyName) {
if (StringUtils.hasText(beanReference)) {
builder.addPropertyReference(propertyName, beanReference);
}
} | [
"public",
"static",
"void",
"setPropertyReference",
"(",
"BeanDefinitionBuilder",
"builder",
",",
"String",
"beanReference",
",",
"String",
"propertyName",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"beanReference",
")",
")",
"{",
"builder",
".",
"... | Sets the property reference on bean definition in case reference
is set properly.
@param builder the bean definition builder to be configured
@param beanReference bean reference to populate the property
@param propertyName the name of the property | [
"Sets",
"the",
"property",
"reference",
"on",
"bean",
"definition",
"in",
"case",
"reference",
"is",
"set",
"properly",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java#L75-L79 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerImpl.java | LayerImpl.setResponse | protected InputStream setResponse(HttpServletRequest request, HttpServletResponse response, CacheEntry entry) throws IOException {
"""
Sets the response data in the response object and calls
{@link #setResponseHeaders(HttpServletRequest, HttpServletResponse, int)} to set the headers.
@param request
The servlet request object
@param response
The servlet response object
@param entry
The {@link CacheEntry} object containing the response data.
@return The input stream to the response data
@throws IOException
"""
InputStream result;
MutableObject<byte[]> sourceMap = RequestUtil.isSourceMapRequest(request) ? new MutableObject<byte[]>() : null;
result = entry.getInputStream(request, sourceMap);
if (sourceMap != null && sourceMap.getValue() != null) {
byte[] sm = sourceMap.getValue();
result = new ByteArrayInputStream(sm);
setResponseHeaders(request, response, sm.length);
} else {
setResponseHeaders(request, response, entry.getSize());
}
return result;
} | java | protected InputStream setResponse(HttpServletRequest request, HttpServletResponse response, CacheEntry entry) throws IOException {
InputStream result;
MutableObject<byte[]> sourceMap = RequestUtil.isSourceMapRequest(request) ? new MutableObject<byte[]>() : null;
result = entry.getInputStream(request, sourceMap);
if (sourceMap != null && sourceMap.getValue() != null) {
byte[] sm = sourceMap.getValue();
result = new ByteArrayInputStream(sm);
setResponseHeaders(request, response, sm.length);
} else {
setResponseHeaders(request, response, entry.getSize());
}
return result;
} | [
"protected",
"InputStream",
"setResponse",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"CacheEntry",
"entry",
")",
"throws",
"IOException",
"{",
"InputStream",
"result",
";",
"MutableObject",
"<",
"byte",
"[",
"]",
">",
"source... | Sets the response data in the response object and calls
{@link #setResponseHeaders(HttpServletRequest, HttpServletResponse, int)} to set the headers.
@param request
The servlet request object
@param response
The servlet response object
@param entry
The {@link CacheEntry} object containing the response data.
@return The input stream to the response data
@throws IOException | [
"Sets",
"the",
"response",
"data",
"in",
"the",
"response",
"object",
"and",
"calls",
"{",
"@link",
"#setResponseHeaders",
"(",
"HttpServletRequest",
"HttpServletResponse",
"int",
")",
"}",
"to",
"set",
"the",
"headers",
"."
] | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerImpl.java#L577-L589 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/ComputerVisionManager.java | ComputerVisionManager.authenticate | public static ComputerVisionClient authenticate(ServiceClientCredentials credentials, String endpoint) {
"""
Initializes an instance of Computer Vision API client.
@param credentials the management credentials for Azure
@param endpoint Supported Cognitive Services endpoints.
@return the Computer Vision API client
"""
return authenticate("https://{endpoint}/vision/v2.0/", credentials)
.withEndpoint(endpoint);
} | java | public static ComputerVisionClient authenticate(ServiceClientCredentials credentials, String endpoint) {
return authenticate("https://{endpoint}/vision/v2.0/", credentials)
.withEndpoint(endpoint);
} | [
"public",
"static",
"ComputerVisionClient",
"authenticate",
"(",
"ServiceClientCredentials",
"credentials",
",",
"String",
"endpoint",
")",
"{",
"return",
"authenticate",
"(",
"\"https://{endpoint}/vision/v2.0/\"",
",",
"credentials",
")",
".",
"withEndpoint",
"(",
"endpo... | Initializes an instance of Computer Vision API client.
@param credentials the management credentials for Azure
@param endpoint Supported Cognitive Services endpoints.
@return the Computer Vision API client | [
"Initializes",
"an",
"instance",
"of",
"Computer",
"Vision",
"API",
"client",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/ComputerVisionManager.java#L69-L72 |
xiaolongzuo/niubi-job | niubi-job-framework/niubi-job-scheduler/src/main/java/com/zuoxiaolong/niubi/job/scheduler/JobEnvironmentCache.java | JobEnvironmentCache.loadJobEnvironment | public void loadJobEnvironment(String jarFilePath, String packagesToScan, boolean isSpring) throws Exception {
"""
创建Job的运行时环境,加载相应的Jar包资源.
@param jarFilePath jar包本地路径
@param packagesToScan 需要扫描的包
@param isSpring 是否spring环境
@throws Exception 当出现未检查的异常时抛出
"""
JobBeanFactory jobBeanFactory = jobBeanFactoryMap.get(jarFilePath);
if (jobBeanFactory != null) {
return;
}
synchronized (jobBeanFactoryMap) {
jobBeanFactory = jobBeanFactoryMap.get(jarFilePath);
if (jobBeanFactory != null) {
return;
}
jobBeanFactory = createJobBeanFactory(jarFilePath, isSpring);
jobBeanFactoryMap.put(jarFilePath, jobBeanFactory);
ClassLoader classLoader = ApplicationClassLoaderFactory.getJarApplicationClassLoader(jarFilePath);
JobScanner jobScanner = JobScannerFactory.createJarFileJobScanner(classLoader, packagesToScan, jarFilePath);
jobDescriptorListMap.put(jarFilePath, jobScanner.getJobDescriptorList());
}
} | java | public void loadJobEnvironment(String jarFilePath, String packagesToScan, boolean isSpring) throws Exception {
JobBeanFactory jobBeanFactory = jobBeanFactoryMap.get(jarFilePath);
if (jobBeanFactory != null) {
return;
}
synchronized (jobBeanFactoryMap) {
jobBeanFactory = jobBeanFactoryMap.get(jarFilePath);
if (jobBeanFactory != null) {
return;
}
jobBeanFactory = createJobBeanFactory(jarFilePath, isSpring);
jobBeanFactoryMap.put(jarFilePath, jobBeanFactory);
ClassLoader classLoader = ApplicationClassLoaderFactory.getJarApplicationClassLoader(jarFilePath);
JobScanner jobScanner = JobScannerFactory.createJarFileJobScanner(classLoader, packagesToScan, jarFilePath);
jobDescriptorListMap.put(jarFilePath, jobScanner.getJobDescriptorList());
}
} | [
"public",
"void",
"loadJobEnvironment",
"(",
"String",
"jarFilePath",
",",
"String",
"packagesToScan",
",",
"boolean",
"isSpring",
")",
"throws",
"Exception",
"{",
"JobBeanFactory",
"jobBeanFactory",
"=",
"jobBeanFactoryMap",
".",
"get",
"(",
"jarFilePath",
")",
";"... | 创建Job的运行时环境,加载相应的Jar包资源.
@param jarFilePath jar包本地路径
@param packagesToScan 需要扫描的包
@param isSpring 是否spring环境
@throws Exception 当出现未检查的异常时抛出 | [
"创建Job的运行时环境",
"加载相应的Jar包资源",
"."
] | train | https://github.com/xiaolongzuo/niubi-job/blob/ed21d5b80f8b16c8b3a0b2fbc688442b878edbe4/niubi-job-framework/niubi-job-scheduler/src/main/java/com/zuoxiaolong/niubi/job/scheduler/JobEnvironmentCache.java#L106-L122 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java | ZooKeeperMasterModel.deployJob | @Override
public void deployJob(final String host, final Deployment deployment, final String token)
throws JobDoesNotExistException, JobAlreadyDeployedException, HostNotFoundException,
JobPortAllocationConflictException, TokenVerificationException {
"""
Creates a config entry within the specified agent to un/deploy a job, or more generally, change
the deployment status according to the {@code Goal} value in {@link Deployment}.
"""
final ZooKeeperClient client = provider.get("deployJob");
deployJobRetry(client, host, deployment, 0, token);
} | java | @Override
public void deployJob(final String host, final Deployment deployment, final String token)
throws JobDoesNotExistException, JobAlreadyDeployedException, HostNotFoundException,
JobPortAllocationConflictException, TokenVerificationException {
final ZooKeeperClient client = provider.get("deployJob");
deployJobRetry(client, host, deployment, 0, token);
} | [
"@",
"Override",
"public",
"void",
"deployJob",
"(",
"final",
"String",
"host",
",",
"final",
"Deployment",
"deployment",
",",
"final",
"String",
"token",
")",
"throws",
"JobDoesNotExistException",
",",
"JobAlreadyDeployedException",
",",
"HostNotFoundException",
",",... | Creates a config entry within the specified agent to un/deploy a job, or more generally, change
the deployment status according to the {@code Goal} value in {@link Deployment}. | [
"Creates",
"a",
"config",
"entry",
"within",
"the",
"specified",
"agent",
"to",
"un",
"/",
"deploy",
"a",
"job",
"or",
"more",
"generally",
"change",
"the",
"deployment",
"status",
"according",
"to",
"the",
"{"
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1525-L1531 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DateUtils.java | DateUtils.getFragmentInHours | @GwtIncompatible("incompatible method")
public static long getFragmentInHours(final Calendar calendar, final int fragment) {
"""
<p>Returns the number of hours within the
fragment. All datefields greater than the fragment will be ignored.</p>
<p>Asking the hours of any date will only return the number of hours
of the current day (resulting in a number between 0 and 23). This
method will retrieve the number of hours for any fragment.
For example, if you want to calculate the number of hours past this month,
your fragment is Calendar.MONTH. The result will be all hours of the
past day(s).</p>
<p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
A fragment less than or equal to a HOUR field will return 0.</p>
<ul>
<li>January 1, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 7
(equivalent to calendar.get(Calendar.HOUR_OF_DAY))</li>
<li>January 6, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 7
(equivalent to calendar.get(Calendar.HOUR_OF_DAY))</li>
<li>January 1, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 7</li>
<li>January 6, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 127 (5*24 + 7)</li>
<li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
(a millisecond cannot be split in hours)</li>
</ul>
@param calendar the calendar to work with, not null
@param fragment the {@code Calendar} field part of calendar to calculate
@return number of hours within the fragment of date
@throws IllegalArgumentException if the date is <code>null</code> or
fragment is not supported
@since 2.4
"""
return getFragment(calendar, fragment, TimeUnit.HOURS);
} | java | @GwtIncompatible("incompatible method")
public static long getFragmentInHours(final Calendar calendar, final int fragment) {
return getFragment(calendar, fragment, TimeUnit.HOURS);
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"long",
"getFragmentInHours",
"(",
"final",
"Calendar",
"calendar",
",",
"final",
"int",
"fragment",
")",
"{",
"return",
"getFragment",
"(",
"calendar",
",",
"fragment",
",",
"TimeUni... | <p>Returns the number of hours within the
fragment. All datefields greater than the fragment will be ignored.</p>
<p>Asking the hours of any date will only return the number of hours
of the current day (resulting in a number between 0 and 23). This
method will retrieve the number of hours for any fragment.
For example, if you want to calculate the number of hours past this month,
your fragment is Calendar.MONTH. The result will be all hours of the
past day(s).</p>
<p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
A fragment less than or equal to a HOUR field will return 0.</p>
<ul>
<li>January 1, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 7
(equivalent to calendar.get(Calendar.HOUR_OF_DAY))</li>
<li>January 6, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 7
(equivalent to calendar.get(Calendar.HOUR_OF_DAY))</li>
<li>January 1, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 7</li>
<li>January 6, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 127 (5*24 + 7)</li>
<li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0
(a millisecond cannot be split in hours)</li>
</ul>
@param calendar the calendar to work with, not null
@param fragment the {@code Calendar} field part of calendar to calculate
@return number of hours within the fragment of date
@throws IllegalArgumentException if the date is <code>null</code> or
fragment is not supported
@since 2.4 | [
"<p",
">",
"Returns",
"the",
"number",
"of",
"hours",
"within",
"the",
"fragment",
".",
"All",
"datefields",
"greater",
"than",
"the",
"fragment",
"will",
"be",
"ignored",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L1607-L1610 |
real-logic/agrona | agrona/src/main/java/org/agrona/collections/Int2IntHashMap.java | Int2IntHashMap.computeIfAbsent | public int computeIfAbsent(final int key, final IntUnaryOperator mappingFunction) {
"""
Primitive specialised version of {@link #computeIfAbsent(Object, Function)}
@param key to search on.
@param mappingFunction to provide a value if the get returns null.
@return the value if found otherwise the missing value.
"""
int value = get(key);
if (value == missingValue)
{
value = mappingFunction.applyAsInt(key);
if (value != missingValue)
{
put(key, value);
}
}
return value;
} | java | public int computeIfAbsent(final int key, final IntUnaryOperator mappingFunction)
{
int value = get(key);
if (value == missingValue)
{
value = mappingFunction.applyAsInt(key);
if (value != missingValue)
{
put(key, value);
}
}
return value;
} | [
"public",
"int",
"computeIfAbsent",
"(",
"final",
"int",
"key",
",",
"final",
"IntUnaryOperator",
"mappingFunction",
")",
"{",
"int",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"missingValue",
")",
"{",
"value",
"=",
"mappingFunct... | Primitive specialised version of {@link #computeIfAbsent(Object, Function)}
@param key to search on.
@param mappingFunction to provide a value if the get returns null.
@return the value if found otherwise the missing value. | [
"Primitive",
"specialised",
"version",
"of",
"{",
"@link",
"#computeIfAbsent",
"(",
"Object",
"Function",
")",
"}"
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/collections/Int2IntHashMap.java#L335-L348 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/query/PagingPredicate.java | PagingPredicate.setAnchor | void setAnchor(int page, Map.Entry anchor) {
"""
After each query, an anchor entry is set for that page.
The anchor entry is the last entry of the query.
@param anchor the last entry of the query
"""
SimpleImmutableEntry anchorEntry = new SimpleImmutableEntry(page, anchor);
int anchorCount = anchorList.size();
if (page < anchorCount) {
anchorList.set(page, anchorEntry);
} else if (page == anchorCount) {
anchorList.add(anchorEntry);
} else {
throw new IllegalArgumentException("Anchor index is not correct, expected: " + page + " found: " + anchorCount);
}
} | java | void setAnchor(int page, Map.Entry anchor) {
SimpleImmutableEntry anchorEntry = new SimpleImmutableEntry(page, anchor);
int anchorCount = anchorList.size();
if (page < anchorCount) {
anchorList.set(page, anchorEntry);
} else if (page == anchorCount) {
anchorList.add(anchorEntry);
} else {
throw new IllegalArgumentException("Anchor index is not correct, expected: " + page + " found: " + anchorCount);
}
} | [
"void",
"setAnchor",
"(",
"int",
"page",
",",
"Map",
".",
"Entry",
"anchor",
")",
"{",
"SimpleImmutableEntry",
"anchorEntry",
"=",
"new",
"SimpleImmutableEntry",
"(",
"page",
",",
"anchor",
")",
";",
"int",
"anchorCount",
"=",
"anchorList",
".",
"size",
"(",... | After each query, an anchor entry is set for that page.
The anchor entry is the last entry of the query.
@param anchor the last entry of the query | [
"After",
"each",
"query",
"an",
"anchor",
"entry",
"is",
"set",
"for",
"that",
"page",
".",
"The",
"anchor",
"entry",
"is",
"the",
"last",
"entry",
"of",
"the",
"query",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/PagingPredicate.java#L300-L310 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.setPerspectiveRect | public Matrix4f setPerspectiveRect(float width, float height, float zNear, float zFar, boolean zZeroToOne) {
"""
Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system
using the given NDC z range.
<p>
In order to apply the perspective projection transformation to an existing transformation,
use {@link #perspectiveRect(float, float, float, float, boolean) perspectiveRect()}.
@see #perspectiveRect(float, float, float, float, boolean)
@param width
the width of the near frustum plane
@param height
the height of the near frustum plane
@param zNear
near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this
"""
MemUtil.INSTANCE.zero(this);
this._m00((zNear + zNear) / width);
this._m11((zNear + zNear) / height);
boolean farInf = zFar > 0 && Float.isInfinite(zFar);
boolean nearInf = zNear > 0 && Float.isInfinite(zNear);
if (farInf) {
// See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf)
float e = 1E-6f;
this._m22(e - 1.0f);
this._m32((e - (zZeroToOne ? 1.0f : 2.0f)) * zNear);
} else if (nearInf) {
float e = 1E-6f;
this._m22((zZeroToOne ? 0.0f : 1.0f) - e);
this._m32(((zZeroToOne ? 1.0f : 2.0f) - e) * zFar);
} else {
this._m22((zZeroToOne ? zFar : zFar + zNear) / (zNear - zFar));
this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar));
}
this._m23(-1.0f);
_properties(PROPERTY_PERSPECTIVE);
return this;
} | java | public Matrix4f setPerspectiveRect(float width, float height, float zNear, float zFar, boolean zZeroToOne) {
MemUtil.INSTANCE.zero(this);
this._m00((zNear + zNear) / width);
this._m11((zNear + zNear) / height);
boolean farInf = zFar > 0 && Float.isInfinite(zFar);
boolean nearInf = zNear > 0 && Float.isInfinite(zNear);
if (farInf) {
// See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf)
float e = 1E-6f;
this._m22(e - 1.0f);
this._m32((e - (zZeroToOne ? 1.0f : 2.0f)) * zNear);
} else if (nearInf) {
float e = 1E-6f;
this._m22((zZeroToOne ? 0.0f : 1.0f) - e);
this._m32(((zZeroToOne ? 1.0f : 2.0f) - e) * zFar);
} else {
this._m22((zZeroToOne ? zFar : zFar + zNear) / (zNear - zFar));
this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar));
}
this._m23(-1.0f);
_properties(PROPERTY_PERSPECTIVE);
return this;
} | [
"public",
"Matrix4f",
"setPerspectiveRect",
"(",
"float",
"width",
",",
"float",
"height",
",",
"float",
"zNear",
",",
"float",
"zFar",
",",
"boolean",
"zZeroToOne",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"zero",
"(",
"this",
")",
";",
"this",
".",
"... | Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system
using the given NDC z range.
<p>
In order to apply the perspective projection transformation to an existing transformation,
use {@link #perspectiveRect(float, float, float, float, boolean) perspectiveRect()}.
@see #perspectiveRect(float, float, float, float, boolean)
@param width
the width of the near frustum plane
@param height
the height of the near frustum plane
@param zNear
near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"perspective",
"projection",
"frustum",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"the",
"given",
"NDC",
"z",
"range",
".",
"<p",
">",
"In",
"order",
"to",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L9887-L9909 |
ronmamo/reflections | src/main/java/org/reflections/Reflections.java | Reflections.getConstructorsAnnotatedWith | public Set<Constructor> getConstructorsAnnotatedWith(final Class<? extends Annotation> annotation) {
"""
get all constructors annotated with a given annotation
<p/>depends on MethodAnnotationsScanner configured
"""
Iterable<String> methods = store.get(index(MethodAnnotationsScanner.class), annotation.getName());
return getConstructorsFromDescriptors(methods, loaders());
} | java | public Set<Constructor> getConstructorsAnnotatedWith(final Class<? extends Annotation> annotation) {
Iterable<String> methods = store.get(index(MethodAnnotationsScanner.class), annotation.getName());
return getConstructorsFromDescriptors(methods, loaders());
} | [
"public",
"Set",
"<",
"Constructor",
">",
"getConstructorsAnnotatedWith",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"Iterable",
"<",
"String",
">",
"methods",
"=",
"store",
".",
"get",
"(",
"index",
"(",
"MethodAn... | get all constructors annotated with a given annotation
<p/>depends on MethodAnnotationsScanner configured | [
"get",
"all",
"constructors",
"annotated",
"with",
"a",
"given",
"annotation",
"<p",
"/",
">",
"depends",
"on",
"MethodAnnotationsScanner",
"configured"
] | train | https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/Reflections.java#L524-L527 |
h2oai/h2o-3 | h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostScoreTask.java | XGBoostScoreTask.createMetricsBuilder | private ModelMetrics.MetricBuilder createMetricsBuilder(final int responseClassesNum, final String[] responseDomain) {
"""
Constructs a MetricBuilder for this XGBoostScoreTask based on parameters of response variable
@param responseClassesNum Number of classes found in response variable
@param responseDomain Specific domains in response variable
@return An instance of {@link hex.ModelMetrics.MetricBuilder} corresponding to given response variable type
"""
switch (responseClassesNum) {
case 1:
return new ModelMetricsRegression.MetricBuilderRegression();
case 2:
return new ModelMetricsBinomial.MetricBuilderBinomial(responseDomain);
default:
return new ModelMetricsMultinomial.MetricBuilderMultinomial(responseClassesNum, responseDomain);
}
} | java | private ModelMetrics.MetricBuilder createMetricsBuilder(final int responseClassesNum, final String[] responseDomain) {
switch (responseClassesNum) {
case 1:
return new ModelMetricsRegression.MetricBuilderRegression();
case 2:
return new ModelMetricsBinomial.MetricBuilderBinomial(responseDomain);
default:
return new ModelMetricsMultinomial.MetricBuilderMultinomial(responseClassesNum, responseDomain);
}
} | [
"private",
"ModelMetrics",
".",
"MetricBuilder",
"createMetricsBuilder",
"(",
"final",
"int",
"responseClassesNum",
",",
"final",
"String",
"[",
"]",
"responseDomain",
")",
"{",
"switch",
"(",
"responseClassesNum",
")",
"{",
"case",
"1",
":",
"return",
"new",
"M... | Constructs a MetricBuilder for this XGBoostScoreTask based on parameters of response variable
@param responseClassesNum Number of classes found in response variable
@param responseDomain Specific domains in response variable
@return An instance of {@link hex.ModelMetrics.MetricBuilder} corresponding to given response variable type | [
"Constructs",
"a",
"MetricBuilder",
"for",
"this",
"XGBoostScoreTask",
"based",
"on",
"parameters",
"of",
"response",
"variable"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-extensions/xgboost/src/main/java/ml/dmlc/xgboost4j/java/XGBoostScoreTask.java#L134-L143 |
Waikato/moa | moa/src/main/java/moa/core/Utils.java | Utils.kthSmallestValue | public static double kthSmallestValue(int[] array, int k) {
"""
Returns the kth-smallest value in the array.
@param array the array of integers
@param k the value of k
@return the kth-smallest value
"""
int[] index = new int[array.length];
for (int i = 0; i < index.length; i++) {
index[i] = i;
}
return array[index[select(array, index, 0, array.length - 1, k)]];
} | java | public static double kthSmallestValue(int[] array, int k) {
int[] index = new int[array.length];
for (int i = 0; i < index.length; i++) {
index[i] = i;
}
return array[index[select(array, index, 0, array.length - 1, k)]];
} | [
"public",
"static",
"double",
"kthSmallestValue",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"k",
")",
"{",
"int",
"[",
"]",
"index",
"=",
"new",
"int",
"[",
"array",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"in... | Returns the kth-smallest value in the array.
@param array the array of integers
@param k the value of k
@return the kth-smallest value | [
"Returns",
"the",
"kth",
"-",
"smallest",
"value",
"in",
"the",
"array",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/core/Utils.java#L1027-L1036 |
ironjacamar/ironjacamar | common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java | AbstractParser.elementAsString | protected String elementAsString(XMLStreamReader reader, String key, Map<String, String> expressions)
throws XMLStreamException {
"""
convert an xml element in String value
@param reader the StAX reader
@param key The key
@param expressions The expressions
@return the string representing element
@throws XMLStreamException StAX exception
"""
String elementtext = rawElementText(reader);
if (key != null && expressions != null && elementtext != null && elementtext.indexOf("${") != -1)
expressions.put(key, elementtext);
return getSubstitutionValue(elementtext);
} | java | protected String elementAsString(XMLStreamReader reader, String key, Map<String, String> expressions)
throws XMLStreamException
{
String elementtext = rawElementText(reader);
if (key != null && expressions != null && elementtext != null && elementtext.indexOf("${") != -1)
expressions.put(key, elementtext);
return getSubstitutionValue(elementtext);
} | [
"protected",
"String",
"elementAsString",
"(",
"XMLStreamReader",
"reader",
",",
"String",
"key",
",",
"Map",
"<",
"String",
",",
"String",
">",
"expressions",
")",
"throws",
"XMLStreamException",
"{",
"String",
"elementtext",
"=",
"rawElementText",
"(",
"reader",... | convert an xml element in String value
@param reader the StAX reader
@param key The key
@param expressions The expressions
@return the string representing element
@throws XMLStreamException StAX exception | [
"convert",
"an",
"xml",
"element",
"in",
"String",
"value"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java#L159-L168 |
m-m-m/util | reflect/src/main/java/net/sf/mmm/util/reflect/base/ReflectionUtilImpl.java | ReflectionUtilImpl.findClassNames | protected void findClassNames(String packageName, boolean includeSubPackages, Set<String> classSet, Filter<? super String> filter, ClassLoader classLoader) {
"""
@see #findClassNames(String, boolean, Filter, ClassLoader)
@param packageName is the name of the {@link Package} to scan.
@param includeSubPackages - if {@code true} all sub-packages of the specified {@link Package} will be included in
the search.
@param classSet is where to add the classes.
@param filter is used to {@link Filter#accept(Object) filter} the {@link Class}-names to be added to the resulting
{@link Set}. The {@link Filter} will receive {@link Class#getName() fully qualified class-names} as argument
(e.g. "net.sf.mmm.reflect.api.ReflectionUtil").
@param classLoader is the explicit {@link ClassLoader} to use.
@if the operation failed with an I/O error.
"""
ResourceVisitor visitor = new ClassNameCollector(classSet, filter);
visitResourceNames(packageName, includeSubPackages, classLoader, visitor);
} | java | protected void findClassNames(String packageName, boolean includeSubPackages, Set<String> classSet, Filter<? super String> filter, ClassLoader classLoader) {
ResourceVisitor visitor = new ClassNameCollector(classSet, filter);
visitResourceNames(packageName, includeSubPackages, classLoader, visitor);
} | [
"protected",
"void",
"findClassNames",
"(",
"String",
"packageName",
",",
"boolean",
"includeSubPackages",
",",
"Set",
"<",
"String",
">",
"classSet",
",",
"Filter",
"<",
"?",
"super",
"String",
">",
"filter",
",",
"ClassLoader",
"classLoader",
")",
"{",
"Reso... | @see #findClassNames(String, boolean, Filter, ClassLoader)
@param packageName is the name of the {@link Package} to scan.
@param includeSubPackages - if {@code true} all sub-packages of the specified {@link Package} will be included in
the search.
@param classSet is where to add the classes.
@param filter is used to {@link Filter#accept(Object) filter} the {@link Class}-names to be added to the resulting
{@link Set}. The {@link Filter} will receive {@link Class#getName() fully qualified class-names} as argument
(e.g. "net.sf.mmm.reflect.api.ReflectionUtil").
@param classLoader is the explicit {@link ClassLoader} to use.
@if the operation failed with an I/O error. | [
"@see",
"#findClassNames",
"(",
"String",
"boolean",
"Filter",
"ClassLoader",
")"
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/reflect/src/main/java/net/sf/mmm/util/reflect/base/ReflectionUtilImpl.java#L699-L703 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/db/RangeTombstoneList.java | RangeTombstoneList.searchInternal | private int searchInternal(Composite name, int startIdx) {
"""
/*
Return is the index of the range covering name if name is covered. If the return idx is negative,
no range cover name and -idx-1 is the index of the first range whose start is greater than name.
"""
if (isEmpty())
return -1;
int pos = Arrays.binarySearch(starts, startIdx, size, name, comparator);
if (pos >= 0)
{
// We're exactly on an interval start. The one subtility is that we need to check if
// the previous is not equal to us and doesn't have a higher marked at
if (pos > 0 && comparator.compare(name, ends[pos-1]) == 0 && markedAts[pos-1] > markedAts[pos])
return pos-1;
else
return pos;
}
else
{
// We potentially intersect the range before our "insertion point"
int idx = -pos-2;
if (idx < 0)
return -1;
return comparator.compare(name, ends[idx]) <= 0 ? idx : -idx-2;
}
} | java | private int searchInternal(Composite name, int startIdx)
{
if (isEmpty())
return -1;
int pos = Arrays.binarySearch(starts, startIdx, size, name, comparator);
if (pos >= 0)
{
// We're exactly on an interval start. The one subtility is that we need to check if
// the previous is not equal to us and doesn't have a higher marked at
if (pos > 0 && comparator.compare(name, ends[pos-1]) == 0 && markedAts[pos-1] > markedAts[pos])
return pos-1;
else
return pos;
}
else
{
// We potentially intersect the range before our "insertion point"
int idx = -pos-2;
if (idx < 0)
return -1;
return comparator.compare(name, ends[idx]) <= 0 ? idx : -idx-2;
}
} | [
"private",
"int",
"searchInternal",
"(",
"Composite",
"name",
",",
"int",
"startIdx",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"return",
"-",
"1",
";",
"int",
"pos",
"=",
"Arrays",
".",
"binarySearch",
"(",
"starts",
",",
"startIdx",
",",
"size",... | /*
Return is the index of the range covering name if name is covered. If the return idx is negative,
no range cover name and -idx-1 is the index of the first range whose start is greater than name. | [
"/",
"*",
"Return",
"is",
"the",
"index",
"of",
"the",
"range",
"covering",
"name",
"if",
"name",
"is",
"covered",
".",
"If",
"the",
"return",
"idx",
"is",
"negative",
"no",
"range",
"cover",
"name",
"and",
"-",
"idx",
"-",
"1",
"is",
"the",
"index",... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/RangeTombstoneList.java#L274-L298 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/io/AbstractCsvAnnotationBeanReader.java | AbstractCsvAnnotationBeanReader.validateHeader | protected void validateHeader(final String[] sourceHeader, final String[] definedHeader) {
"""
CSVのヘッダーの検証を行います。
@param sourceHeader オリジナルのヘッダー情報。
@param definedHeader アノテーションなどの定義を元にしたヘッダー情報
@throws SuperCsvNoMatchColumnSizeException ヘッダーのサイズ(カラム数)がBean定義と一致しない場合。
@throws SuperCsvNoMatchHeaderException ヘッダーの値がBean定義と一致しない場合。
"""
// check column size.
if(sourceHeader.length != definedHeader.length) {
final CsvContext context = new CsvContext(1, 1, 1);
throw new SuperCsvNoMatchColumnSizeException(sourceHeader.length, definedHeader.length, context);
}
// check header value
for(int i=0; i < sourceHeader.length; i++) {
if(!sourceHeader[i].equals(definedHeader[i])) {
final CsvContext context = new CsvContext(1, 1, i+1);
throw new SuperCsvNoMatchHeaderException(sourceHeader, definedHeader, context);
}
}
} | java | protected void validateHeader(final String[] sourceHeader, final String[] definedHeader) {
// check column size.
if(sourceHeader.length != definedHeader.length) {
final CsvContext context = new CsvContext(1, 1, 1);
throw new SuperCsvNoMatchColumnSizeException(sourceHeader.length, definedHeader.length, context);
}
// check header value
for(int i=0; i < sourceHeader.length; i++) {
if(!sourceHeader[i].equals(definedHeader[i])) {
final CsvContext context = new CsvContext(1, 1, i+1);
throw new SuperCsvNoMatchHeaderException(sourceHeader, definedHeader, context);
}
}
} | [
"protected",
"void",
"validateHeader",
"(",
"final",
"String",
"[",
"]",
"sourceHeader",
",",
"final",
"String",
"[",
"]",
"definedHeader",
")",
"{",
"// check column size.\r",
"if",
"(",
"sourceHeader",
".",
"length",
"!=",
"definedHeader",
".",
"length",
")",
... | CSVのヘッダーの検証を行います。
@param sourceHeader オリジナルのヘッダー情報。
@param definedHeader アノテーションなどの定義を元にしたヘッダー情報
@throws SuperCsvNoMatchColumnSizeException ヘッダーのサイズ(カラム数)がBean定義と一致しない場合。
@throws SuperCsvNoMatchHeaderException ヘッダーの値がBean定義と一致しない場合。 | [
"CSVのヘッダーの検証を行います。"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/io/AbstractCsvAnnotationBeanReader.java#L155-L172 |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/AbstractLibertySupport.java | AbstractLibertySupport.getArtifact | protected Artifact getArtifact(String groupId, String artifactId, String type, String version) throws MojoExecutionException {
"""
Equivalent to {@link #getArtifact(ArtifactItem)} with an ArtifactItem
defined by the given the coordinates.
@param groupId
The group ID
@param artifactId
The artifact ID
@param type
The type (e.g. jar)
@param version
The version, or null to retrieve it from the dependency list
or from the DependencyManagement section of the pom.
@return Artifact The artifact for the given item
@throws MojoExecutionException
Failed to create artifact
"""
ArtifactItem item = new ArtifactItem();
item.setGroupId(groupId);
item.setArtifactId(artifactId);
item.setType(type);
item.setVersion(version);
return getArtifact(item);
} | java | protected Artifact getArtifact(String groupId, String artifactId, String type, String version) throws MojoExecutionException {
ArtifactItem item = new ArtifactItem();
item.setGroupId(groupId);
item.setArtifactId(artifactId);
item.setType(type);
item.setVersion(version);
return getArtifact(item);
} | [
"protected",
"Artifact",
"getArtifact",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"type",
",",
"String",
"version",
")",
"throws",
"MojoExecutionException",
"{",
"ArtifactItem",
"item",
"=",
"new",
"ArtifactItem",
"(",
")",
";",
"item... | Equivalent to {@link #getArtifact(ArtifactItem)} with an ArtifactItem
defined by the given the coordinates.
@param groupId
The group ID
@param artifactId
The artifact ID
@param type
The type (e.g. jar)
@param version
The version, or null to retrieve it from the dependency list
or from the DependencyManagement section of the pom.
@return Artifact The artifact for the given item
@throws MojoExecutionException
Failed to create artifact | [
"Equivalent",
"to",
"{",
"@link",
"#getArtifact",
"(",
"ArtifactItem",
")",
"}",
"with",
"an",
"ArtifactItem",
"defined",
"by",
"the",
"given",
"the",
"coordinates",
"."
] | train | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/AbstractLibertySupport.java#L202-L210 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfStamperImp.java | PdfStamperImp.addViewerPreference | public void addViewerPreference(PdfName key, PdfObject value) {
"""
Adds a viewer preference
@param key a key for a viewer preference
@param value the value for the viewer preference
@see PdfViewerPreferences#addViewerPreference
"""
useVp = true;
this.viewerPreferences.addViewerPreference(key, value);
} | java | public void addViewerPreference(PdfName key, PdfObject value) {
useVp = true;
this.viewerPreferences.addViewerPreference(key, value);
} | [
"public",
"void",
"addViewerPreference",
"(",
"PdfName",
"key",
",",
"PdfObject",
"value",
")",
"{",
"useVp",
"=",
"true",
";",
"this",
".",
"viewerPreferences",
".",
"addViewerPreference",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Adds a viewer preference
@param key a key for a viewer preference
@param value the value for the viewer preference
@see PdfViewerPreferences#addViewerPreference | [
"Adds",
"a",
"viewer",
"preference"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java#L1352-L1355 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasLayer.java | KerasLayer.getNInFromConfig | protected long getNInFromConfig(Map<String, ? extends KerasLayer> previousLayers) throws UnsupportedKerasConfigurationException {
"""
Some DL4J layers need explicit specification of number of inputs, which Keras does infer.
This method searches through previous layers until a FeedForwardLayer is found. These layers
have nOut values that subsequently correspond to the nIn value of this layer.
@param previousLayers
@return
@throws UnsupportedKerasConfigurationException
"""
int size = previousLayers.size();
int count = 0;
long nIn;
String inboundLayerName = inboundLayerNames.get(0);
while (count <= size) {
if (previousLayers.containsKey(inboundLayerName)) {
KerasLayer inbound = previousLayers.get(inboundLayerName);
try {
FeedForwardLayer ffLayer = (FeedForwardLayer) inbound.getLayer();
nIn = ffLayer.getNOut();
if (nIn > 0)
return nIn;
count++;
inboundLayerName = inbound.getInboundLayerNames().get(0);
} catch (Exception e) {
inboundLayerName = inbound.getInboundLayerNames().get(0);
}
}
}
throw new UnsupportedKerasConfigurationException("Could not determine number of input channels for" +
"depthwise convolution.");
} | java | protected long getNInFromConfig(Map<String, ? extends KerasLayer> previousLayers) throws UnsupportedKerasConfigurationException {
int size = previousLayers.size();
int count = 0;
long nIn;
String inboundLayerName = inboundLayerNames.get(0);
while (count <= size) {
if (previousLayers.containsKey(inboundLayerName)) {
KerasLayer inbound = previousLayers.get(inboundLayerName);
try {
FeedForwardLayer ffLayer = (FeedForwardLayer) inbound.getLayer();
nIn = ffLayer.getNOut();
if (nIn > 0)
return nIn;
count++;
inboundLayerName = inbound.getInboundLayerNames().get(0);
} catch (Exception e) {
inboundLayerName = inbound.getInboundLayerNames().get(0);
}
}
}
throw new UnsupportedKerasConfigurationException("Could not determine number of input channels for" +
"depthwise convolution.");
} | [
"protected",
"long",
"getNInFromConfig",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"KerasLayer",
">",
"previousLayers",
")",
"throws",
"UnsupportedKerasConfigurationException",
"{",
"int",
"size",
"=",
"previousLayers",
".",
"size",
"(",
")",
";",
"int",
"... | Some DL4J layers need explicit specification of number of inputs, which Keras does infer.
This method searches through previous layers until a FeedForwardLayer is found. These layers
have nOut values that subsequently correspond to the nIn value of this layer.
@param previousLayers
@return
@throws UnsupportedKerasConfigurationException | [
"Some",
"DL4J",
"layers",
"need",
"explicit",
"specification",
"of",
"number",
"of",
"inputs",
"which",
"Keras",
"does",
"infer",
".",
"This",
"method",
"searches",
"through",
"previous",
"layers",
"until",
"a",
"FeedForwardLayer",
"is",
"found",
".",
"These",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasLayer.java#L398-L420 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/block/component/WallComponent.java | WallComponent.getBoundingBoxes | @Override
public AxisAlignedBB[] getBoundingBoxes(Block block, IBlockAccess world, BlockPos pos, IBlockState state, BoundingBoxType type) {
"""
Gets the bounding boxes for the block.
@param block the block
@param world the world
@param pos the pos
@param type the type
@return the bounding boxes
"""
boolean corner = isCorner(state);
if (type == BoundingBoxType.SELECTION && corner)
return AABBUtils.identities();
AxisAlignedBB aabb = new AxisAlignedBB(0, 0, 0, 1, 1, 3 / 16F);
if (world == null)
aabb = AABBUtils.rotate(aabb.offset(0, 0, 0.5F), -1);
if (!corner)
return new AxisAlignedBB[] { aabb };
return new AxisAlignedBB[] { aabb, AABBUtils.rotate(aabb, -1) };
} | java | @Override
public AxisAlignedBB[] getBoundingBoxes(Block block, IBlockAccess world, BlockPos pos, IBlockState state, BoundingBoxType type)
{
boolean corner = isCorner(state);
if (type == BoundingBoxType.SELECTION && corner)
return AABBUtils.identities();
AxisAlignedBB aabb = new AxisAlignedBB(0, 0, 0, 1, 1, 3 / 16F);
if (world == null)
aabb = AABBUtils.rotate(aabb.offset(0, 0, 0.5F), -1);
if (!corner)
return new AxisAlignedBB[] { aabb };
return new AxisAlignedBB[] { aabb, AABBUtils.rotate(aabb, -1) };
} | [
"@",
"Override",
"public",
"AxisAlignedBB",
"[",
"]",
"getBoundingBoxes",
"(",
"Block",
"block",
",",
"IBlockAccess",
"world",
",",
"BlockPos",
"pos",
",",
"IBlockState",
"state",
",",
"BoundingBoxType",
"type",
")",
"{",
"boolean",
"corner",
"=",
"isCorner",
... | Gets the bounding boxes for the block.
@param block the block
@param world the world
@param pos the pos
@param type the type
@return the bounding boxes | [
"Gets",
"the",
"bounding",
"boxes",
"for",
"the",
"block",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/block/component/WallComponent.java#L207-L222 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWComponent.java | AbstractWComponent.collateVisible | private static void collateVisible(final WComponent component, final List<WComponent> list) {
"""
Collates all the visible components in this branch of the WComponent tree. WComponents are added to the
<code>list</code> in depth-first order, as this list is traversed in order during the request handling phase.
@param component the current branch to collate visible items in.
@param list the list to add the visible components to.
"""
if (component.isVisible()) {
if (component instanceof Container) {
final int size = ((Container) component).getChildCount();
for (int i = 0; i < size; i++) {
collateVisible(((Container) component).getChildAt(i), list);
}
}
list.add(component);
}
} | java | private static void collateVisible(final WComponent component, final List<WComponent> list) {
if (component.isVisible()) {
if (component instanceof Container) {
final int size = ((Container) component).getChildCount();
for (int i = 0; i < size; i++) {
collateVisible(((Container) component).getChildAt(i), list);
}
}
list.add(component);
}
} | [
"private",
"static",
"void",
"collateVisible",
"(",
"final",
"WComponent",
"component",
",",
"final",
"List",
"<",
"WComponent",
">",
"list",
")",
"{",
"if",
"(",
"component",
".",
"isVisible",
"(",
")",
")",
"{",
"if",
"(",
"component",
"instanceof",
"Con... | Collates all the visible components in this branch of the WComponent tree. WComponents are added to the
<code>list</code> in depth-first order, as this list is traversed in order during the request handling phase.
@param component the current branch to collate visible items in.
@param list the list to add the visible components to. | [
"Collates",
"all",
"the",
"visible",
"components",
"in",
"this",
"branch",
"of",
"the",
"WComponent",
"tree",
".",
"WComponents",
"are",
"added",
"to",
"the",
"<code",
">",
"list<",
"/",
"code",
">",
"in",
"depth",
"-",
"first",
"order",
"as",
"this",
"l... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWComponent.java#L434-L448 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java | Whitebox.getInternalState | @Deprecated
public static <T> T getInternalState(Object object, String fieldName, Class<?> where, Class<T> type) {
"""
Get the value of a field using reflection. Use this method when you need
to specify in which class the field is declared. This might be useful
when you have mocked the instance you are trying to access. Use this
method to avoid casting.
@deprecated Use {@link #getInternalState(Object, String, Class)} instead.
@param <T>
the expected type of the field
@param object
the object to modify
@param fieldName
the name of the field
@param where
which class the field is defined
@param type
the expected type of the field
"""
return Whitebox.getInternalState(object, fieldName, where);
} | java | @Deprecated
public static <T> T getInternalState(Object object, String fieldName, Class<?> where, Class<T> type) {
return Whitebox.getInternalState(object, fieldName, where);
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
">",
"T",
"getInternalState",
"(",
"Object",
"object",
",",
"String",
"fieldName",
",",
"Class",
"<",
"?",
">",
"where",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"Whitebox",
".",
"getInte... | Get the value of a field using reflection. Use this method when you need
to specify in which class the field is declared. This might be useful
when you have mocked the instance you are trying to access. Use this
method to avoid casting.
@deprecated Use {@link #getInternalState(Object, String, Class)} instead.
@param <T>
the expected type of the field
@param object
the object to modify
@param fieldName
the name of the field
@param where
which class the field is defined
@param type
the expected type of the field | [
"Get",
"the",
"value",
"of",
"a",
"field",
"using",
"reflection",
".",
"Use",
"this",
"method",
"when",
"you",
"need",
"to",
"specify",
"in",
"which",
"class",
"the",
"field",
"is",
"declared",
".",
"This",
"might",
"be",
"useful",
"when",
"you",
"have",... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L330-L333 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/signer/internal/cms/BcStoreUtils.java | BcStoreUtils.newCertificateProvider | private static CertificateProvider newCertificateProvider(ComponentManager manager, Store store)
throws GeneralSecurityException {
"""
Wrap a bouncy castle store into an adapter for the CertificateProvider interface.
@param manager the component manager.
@param store the store.
@return a certificate provider wrapping the store.
@throws GeneralSecurityException if unable to initialize the provider.
"""
try {
CertificateProvider provider = manager.getInstance(CertificateProvider.class, "BCStoreX509");
((BcStoreX509CertificateProvider) provider).setStore(store);
return provider;
} catch (ComponentLookupException e) {
throw new GeneralSecurityException("Unable to initialize the certificates store", e);
}
} | java | private static CertificateProvider newCertificateProvider(ComponentManager manager, Store store)
throws GeneralSecurityException
{
try {
CertificateProvider provider = manager.getInstance(CertificateProvider.class, "BCStoreX509");
((BcStoreX509CertificateProvider) provider).setStore(store);
return provider;
} catch (ComponentLookupException e) {
throw new GeneralSecurityException("Unable to initialize the certificates store", e);
}
} | [
"private",
"static",
"CertificateProvider",
"newCertificateProvider",
"(",
"ComponentManager",
"manager",
",",
"Store",
"store",
")",
"throws",
"GeneralSecurityException",
"{",
"try",
"{",
"CertificateProvider",
"provider",
"=",
"manager",
".",
"getInstance",
"(",
"Cert... | Wrap a bouncy castle store into an adapter for the CertificateProvider interface.
@param manager the component manager.
@param store the store.
@return a certificate provider wrapping the store.
@throws GeneralSecurityException if unable to initialize the provider. | [
"Wrap",
"a",
"bouncy",
"castle",
"store",
"into",
"an",
"adapter",
"for",
"the",
"CertificateProvider",
"interface",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/signer/internal/cms/BcStoreUtils.java#L126-L137 |
alkacon/opencms-core | src/org/opencms/gwt/shared/property/CmsClientProperty.java | CmsClientProperty.getPathValue | public CmsPathValue getPathValue(Mode mode) {
"""
Gets the path value for a specific access mode.<p>
@param mode the access mode
@return the path value for the access mode
"""
switch (mode) {
case resource:
return new CmsPathValue(m_resourceValue, PATH_RESOURCE_VALUE);
case structure:
return new CmsPathValue(m_structureValue, PATH_STRUCTURE_VALUE);
case effective:
default:
return getPathValue();
}
} | java | public CmsPathValue getPathValue(Mode mode) {
switch (mode) {
case resource:
return new CmsPathValue(m_resourceValue, PATH_RESOURCE_VALUE);
case structure:
return new CmsPathValue(m_structureValue, PATH_STRUCTURE_VALUE);
case effective:
default:
return getPathValue();
}
} | [
"public",
"CmsPathValue",
"getPathValue",
"(",
"Mode",
"mode",
")",
"{",
"switch",
"(",
"mode",
")",
"{",
"case",
"resource",
":",
"return",
"new",
"CmsPathValue",
"(",
"m_resourceValue",
",",
"PATH_RESOURCE_VALUE",
")",
";",
"case",
"structure",
":",
"return"... | Gets the path value for a specific access mode.<p>
@param mode the access mode
@return the path value for the access mode | [
"Gets",
"the",
"path",
"value",
"for",
"a",
"specific",
"access",
"mode",
".",
"<p",
">",
"@param",
"mode",
"the",
"access",
"mode"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/shared/property/CmsClientProperty.java#L304-L315 |
xcesco/kripton | kripton/src/main/java/com/abubusoft/kripton/xml/XMLParser.java | XMLParser.readInternalSubset | private void readInternalSubset() throws IOException, KriptonRuntimeException {
"""
Read internal subset.
@throws IOException Signals that an I/O exception has occurred.
@throws KriptonRuntimeException the kripton runtime exception
"""
read('[');
while (true) {
skip();
if (peekCharacter() == ']') {
position++;
return;
}
int declarationType = peekType(true);
switch (declarationType) {
case ELEMENTDECL:
readElementDeclaration();
break;
case ATTLISTDECL:
readAttributeListDeclaration();
break;
case ENTITYDECL:
readEntityDeclaration();
break;
case NOTATIONDECL:
readNotationDeclaration();
break;
case PROCESSING_INSTRUCTION:
read(START_PROCESSING_INSTRUCTION);
readUntil(END_PROCESSING_INSTRUCTION, false);
break;
case COMMENT:
readComment(false);
break;
case PARAMETER_ENTITY_REF:
throw new KriptonRuntimeException("Parameter entity references are not supported", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
default:
throw new KriptonRuntimeException("Unexpected token", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
}
}
} | java | private void readInternalSubset() throws IOException, KriptonRuntimeException {
read('[');
while (true) {
skip();
if (peekCharacter() == ']') {
position++;
return;
}
int declarationType = peekType(true);
switch (declarationType) {
case ELEMENTDECL:
readElementDeclaration();
break;
case ATTLISTDECL:
readAttributeListDeclaration();
break;
case ENTITYDECL:
readEntityDeclaration();
break;
case NOTATIONDECL:
readNotationDeclaration();
break;
case PROCESSING_INSTRUCTION:
read(START_PROCESSING_INSTRUCTION);
readUntil(END_PROCESSING_INSTRUCTION, false);
break;
case COMMENT:
readComment(false);
break;
case PARAMETER_ENTITY_REF:
throw new KriptonRuntimeException("Parameter entity references are not supported", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
default:
throw new KriptonRuntimeException("Unexpected token", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
}
}
} | [
"private",
"void",
"readInternalSubset",
"(",
")",
"throws",
"IOException",
",",
"KriptonRuntimeException",
"{",
"read",
"(",
"'",
"'",
")",
";",
"while",
"(",
"true",
")",
"{",
"skip",
"(",
")",
";",
"if",
"(",
"peekCharacter",
"(",
")",
"==",
"'",
"'... | Read internal subset.
@throws IOException Signals that an I/O exception has occurred.
@throws KriptonRuntimeException the kripton runtime exception | [
"Read",
"internal",
"subset",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XMLParser.java#L853-L897 |
ops4j/org.ops4j.pax.exam2 | core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java | ZipBuilder.addDirectory | public ZipBuilder addDirectory(File sourceDir, String targetDir) throws IOException {
"""
Recursively adds a directory tree to the archive. The archive must not be closed.
<p>
Example:<br>
<pre>
sourceDir = /opt/work/classes
targetDir = WEB-INF/classes
/opt/work/classes/com/acme/Foo.class -> WEB-INF/classes/com/acme/Foo.class
</pre>
@param sourceDir
Root directory of tree to be added
@param targetDir
Relative path within the archive corresponding to root. Regardless of the OS, this
path must use slashes ('/') as separators.
@return this for fluent syntax
@throws IOException
on I/O error
"""
addDirectory(sourceDir, sourceDir, targetDir, jarOutputStream);
return this;
} | java | public ZipBuilder addDirectory(File sourceDir, String targetDir) throws IOException {
addDirectory(sourceDir, sourceDir, targetDir, jarOutputStream);
return this;
} | [
"public",
"ZipBuilder",
"addDirectory",
"(",
"File",
"sourceDir",
",",
"String",
"targetDir",
")",
"throws",
"IOException",
"{",
"addDirectory",
"(",
"sourceDir",
",",
"sourceDir",
",",
"targetDir",
",",
"jarOutputStream",
")",
";",
"return",
"this",
";",
"}"
] | Recursively adds a directory tree to the archive. The archive must not be closed.
<p>
Example:<br>
<pre>
sourceDir = /opt/work/classes
targetDir = WEB-INF/classes
/opt/work/classes/com/acme/Foo.class -> WEB-INF/classes/com/acme/Foo.class
</pre>
@param sourceDir
Root directory of tree to be added
@param targetDir
Relative path within the archive corresponding to root. Regardless of the OS, this
path must use slashes ('/') as separators.
@return this for fluent syntax
@throws IOException
on I/O error | [
"Recursively",
"adds",
"a",
"directory",
"tree",
"to",
"the",
"archive",
".",
"The",
"archive",
"must",
"not",
"be",
"closed",
".",
"<p",
">",
"Example",
":",
"<br",
">"
] | train | https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/war/ZipBuilder.java#L77-L80 |
qiniu/java-sdk | src/main/java/com/qiniu/storage/BucketManager.java | BucketManager.move | public Response move(String fromBucket, String fromFileKey, String toBucket, String toFileKey)
throws QiniuException {
"""
移动文件。要求空间在同一账号下, 可以添加force参数为true强行移动文件。
@param fromBucket 源空间名称
@param fromFileKey 源文件名称
@param toBucket 目的空间名称
@param toFileKey 目的文件名称
@throws QiniuException
"""
return move(fromBucket, fromFileKey, toBucket, toFileKey, false);
} | java | public Response move(String fromBucket, String fromFileKey, String toBucket, String toFileKey)
throws QiniuException {
return move(fromBucket, fromFileKey, toBucket, toFileKey, false);
} | [
"public",
"Response",
"move",
"(",
"String",
"fromBucket",
",",
"String",
"fromFileKey",
",",
"String",
"toBucket",
",",
"String",
"toFileKey",
")",
"throws",
"QiniuException",
"{",
"return",
"move",
"(",
"fromBucket",
",",
"fromFileKey",
",",
"toBucket",
",",
... | 移动文件。要求空间在同一账号下, 可以添加force参数为true强行移动文件。
@param fromBucket 源空间名称
@param fromFileKey 源文件名称
@param toBucket 目的空间名称
@param toFileKey 目的文件名称
@throws QiniuException | [
"移动文件。要求空间在同一账号下",
"可以添加force参数为true强行移动文件。"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L422-L425 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.withDataOutputStream | public static <T> T withDataOutputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.DataOutputStream") Closure<T> closure) throws IOException {
"""
Create a new DataOutputStream for this file and passes it into the closure.
This method ensures the stream is closed after the closure returns.
@param file a File
@param closure a closure
@return the value returned by the closure
@throws IOException if an IOException occurs.
@see IOGroovyMethods#withStream(java.io.OutputStream, groovy.lang.Closure)
@since 1.5.2
"""
return IOGroovyMethods.withStream(newDataOutputStream(file), closure);
} | java | public static <T> T withDataOutputStream(File file, @ClosureParams(value = SimpleType.class, options = "java.io.DataOutputStream") Closure<T> closure) throws IOException {
return IOGroovyMethods.withStream(newDataOutputStream(file), closure);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withDataOutputStream",
"(",
"File",
"file",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.io.DataOutputStream\"",
")",
"Closure",
"<",
"T",
">",
"closure",
")",... | Create a new DataOutputStream for this file and passes it into the closure.
This method ensures the stream is closed after the closure returns.
@param file a File
@param closure a closure
@return the value returned by the closure
@throws IOException if an IOException occurs.
@see IOGroovyMethods#withStream(java.io.OutputStream, groovy.lang.Closure)
@since 1.5.2 | [
"Create",
"a",
"new",
"DataOutputStream",
"for",
"this",
"file",
"and",
"passes",
"it",
"into",
"the",
"closure",
".",
"This",
"method",
"ensures",
"the",
"stream",
"is",
"closed",
"after",
"the",
"closure",
"returns",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1872-L1874 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/DBQuery.java | DBQuery.greaterThanEquals | public static Query greaterThanEquals(String field, Object value) {
"""
The field is greater than or equal to the given value
@param field The field to compare
@param value The value to compare to
@return the query
"""
return new Query().greaterThanEquals(field, value);
} | java | public static Query greaterThanEquals(String field, Object value) {
return new Query().greaterThanEquals(field, value);
} | [
"public",
"static",
"Query",
"greaterThanEquals",
"(",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"return",
"new",
"Query",
"(",
")",
".",
"greaterThanEquals",
"(",
"field",
",",
"value",
")",
";",
"}"
] | The field is greater than or equal to the given value
@param field The field to compare
@param value The value to compare to
@return the query | [
"The",
"field",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"given",
"value"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBQuery.java#L95-L97 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.deleteUser | public void deleteUser(CmsRequestContext context, CmsUUID userId) throws CmsException {
"""
Deletes a user.<p>
@param context the current request context
@param userId the Id of the user to be deleted
@throws CmsException if something goes wrong
"""
CmsUser user = readUser(context, userId);
deleteUser(context, user, null);
} | java | public void deleteUser(CmsRequestContext context, CmsUUID userId) throws CmsException {
CmsUser user = readUser(context, userId);
deleteUser(context, user, null);
} | [
"public",
"void",
"deleteUser",
"(",
"CmsRequestContext",
"context",
",",
"CmsUUID",
"userId",
")",
"throws",
"CmsException",
"{",
"CmsUser",
"user",
"=",
"readUser",
"(",
"context",
",",
"userId",
")",
";",
"deleteUser",
"(",
"context",
",",
"user",
",",
"n... | Deletes a user.<p>
@param context the current request context
@param userId the Id of the user to be deleted
@throws CmsException if something goes wrong | [
"Deletes",
"a",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L1663-L1667 |
jpaoletti/java-presentation-manager | modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/BCrypt.java | BCrypt.encode_base64 | private static String encode_base64(byte d[], int len)
throws IllegalArgumentException {
"""
Encode a byte array using bcrypt's slightly-modified base64
encoding scheme. Note that this is *not* compatible with
the standard MIME-base64 encoding.
@param d the byte array to encode
@param len the number of bytes to encode
@return base64-encoded string
@exception IllegalArgumentException if the length is invalid
"""
int off = 0;
StringBuilder rs = new StringBuilder();
int c1, c2;
if (len <= 0 || len > d.length) {
throw new IllegalArgumentException("Invalid len");
}
while (off < len) {
c1 = d[off++] & 0xff;
rs.append(base64_code[(c1 >> 2) & 0x3f]);
c1 = (c1 & 0x03) << 4;
if (off >= len) {
rs.append(base64_code[c1 & 0x3f]);
break;
}
c2 = d[off++] & 0xff;
c1 |= (c2 >> 4) & 0x0f;
rs.append(base64_code[c1 & 0x3f]);
c1 = (c2 & 0x0f) << 2;
if (off >= len) {
rs.append(base64_code[c1 & 0x3f]);
break;
}
c2 = d[off++] & 0xff;
c1 |= (c2 >> 6) & 0x03;
rs.append(base64_code[c1 & 0x3f]);
rs.append(base64_code[c2 & 0x3f]);
}
return rs.toString();
} | java | private static String encode_base64(byte d[], int len)
throws IllegalArgumentException {
int off = 0;
StringBuilder rs = new StringBuilder();
int c1, c2;
if (len <= 0 || len > d.length) {
throw new IllegalArgumentException("Invalid len");
}
while (off < len) {
c1 = d[off++] & 0xff;
rs.append(base64_code[(c1 >> 2) & 0x3f]);
c1 = (c1 & 0x03) << 4;
if (off >= len) {
rs.append(base64_code[c1 & 0x3f]);
break;
}
c2 = d[off++] & 0xff;
c1 |= (c2 >> 4) & 0x0f;
rs.append(base64_code[c1 & 0x3f]);
c1 = (c2 & 0x0f) << 2;
if (off >= len) {
rs.append(base64_code[c1 & 0x3f]);
break;
}
c2 = d[off++] & 0xff;
c1 |= (c2 >> 6) & 0x03;
rs.append(base64_code[c1 & 0x3f]);
rs.append(base64_code[c2 & 0x3f]);
}
return rs.toString();
} | [
"private",
"static",
"String",
"encode_base64",
"(",
"byte",
"d",
"[",
"]",
",",
"int",
"len",
")",
"throws",
"IllegalArgumentException",
"{",
"int",
"off",
"=",
"0",
";",
"StringBuilder",
"rs",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"c1",
",... | Encode a byte array using bcrypt's slightly-modified base64
encoding scheme. Note that this is *not* compatible with
the standard MIME-base64 encoding.
@param d the byte array to encode
@param len the number of bytes to encode
@return base64-encoded string
@exception IllegalArgumentException if the length is invalid | [
"Encode",
"a",
"byte",
"array",
"using",
"bcrypt",
"s",
"slightly",
"-",
"modified",
"base64",
"encoding",
"scheme",
".",
"Note",
"that",
"this",
"is",
"*",
"not",
"*",
"compatible",
"with",
"the",
"standard",
"MIME",
"-",
"base64",
"encoding",
"."
] | train | https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/security/core/BCrypt.java#L382-L414 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java | BinarySerde.doByteBufferPutCompressed | public static void doByteBufferPutCompressed(INDArray arr, ByteBuffer allocated, boolean rewind) {
"""
Setup the given byte buffer
for serialization (note that this is for compressed INDArrays)
4 bytes for rank
4 bytes for data opType
shape information
codec information
data opType
@param arr the array to setup
@param allocated the byte buffer to setup
@param rewind whether to rewind the byte buffer or not
"""
CompressedDataBuffer compressedDataBuffer = (CompressedDataBuffer) arr.data();
CompressionDescriptor descriptor = compressedDataBuffer.getCompressionDescriptor();
ByteBuffer codecByteBuffer = descriptor.toByteBuffer();
ByteBuffer buffer = arr.data().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
ByteBuffer shapeBuffer = arr.shapeInfoDataBuffer().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
allocated.putInt(arr.rank());
//put data opType next so its self describing
allocated.putInt(arr.data().dataType().ordinal());
//put shape next
allocated.put(shapeBuffer);
//put codec information next
allocated.put(codecByteBuffer);
//finally put the data
allocated.put(buffer);
if (rewind)
allocated.rewind();
} | java | public static void doByteBufferPutCompressed(INDArray arr, ByteBuffer allocated, boolean rewind) {
CompressedDataBuffer compressedDataBuffer = (CompressedDataBuffer) arr.data();
CompressionDescriptor descriptor = compressedDataBuffer.getCompressionDescriptor();
ByteBuffer codecByteBuffer = descriptor.toByteBuffer();
ByteBuffer buffer = arr.data().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
ByteBuffer shapeBuffer = arr.shapeInfoDataBuffer().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
allocated.putInt(arr.rank());
//put data opType next so its self describing
allocated.putInt(arr.data().dataType().ordinal());
//put shape next
allocated.put(shapeBuffer);
//put codec information next
allocated.put(codecByteBuffer);
//finally put the data
allocated.put(buffer);
if (rewind)
allocated.rewind();
} | [
"public",
"static",
"void",
"doByteBufferPutCompressed",
"(",
"INDArray",
"arr",
",",
"ByteBuffer",
"allocated",
",",
"boolean",
"rewind",
")",
"{",
"CompressedDataBuffer",
"compressedDataBuffer",
"=",
"(",
"CompressedDataBuffer",
")",
"arr",
".",
"data",
"(",
")",
... | Setup the given byte buffer
for serialization (note that this is for compressed INDArrays)
4 bytes for rank
4 bytes for data opType
shape information
codec information
data opType
@param arr the array to setup
@param allocated the byte buffer to setup
@param rewind whether to rewind the byte buffer or not | [
"Setup",
"the",
"given",
"byte",
"buffer",
"for",
"serialization",
"(",
"note",
"that",
"this",
"is",
"for",
"compressed",
"INDArrays",
")",
"4",
"bytes",
"for",
"rank",
"4",
"bytes",
"for",
"data",
"opType",
"shape",
"information",
"codec",
"information",
"... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L235-L252 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java | PropertyBuilder.buildDeprecationInfo | public void buildDeprecationInfo(XMLNode node, Content propertyDocTree) {
"""
Build the deprecation information.
@param node the XML element that specifies which components to document
@param propertyDocTree the content tree to which the documentation will be added
"""
writer.addDeprecated(
(MethodDoc) properties.get(currentPropertyIndex), propertyDocTree);
} | java | public void buildDeprecationInfo(XMLNode node, Content propertyDocTree) {
writer.addDeprecated(
(MethodDoc) properties.get(currentPropertyIndex), propertyDocTree);
} | [
"public",
"void",
"buildDeprecationInfo",
"(",
"XMLNode",
"node",
",",
"Content",
"propertyDocTree",
")",
"{",
"writer",
".",
"addDeprecated",
"(",
"(",
"MethodDoc",
")",
"properties",
".",
"get",
"(",
"currentPropertyIndex",
")",
",",
"propertyDocTree",
")",
";... | Build the deprecation information.
@param node the XML element that specifies which components to document
@param propertyDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"deprecation",
"information",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java#L193-L196 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesInner.java | DataMaskingPoliciesInner.createOrUpdate | public DataMaskingPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) {
"""
Creates or updates a database data masking policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param parameters Parameters for creating or updating a data masking policy.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DataMaskingPolicyInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body();
} | java | public DataMaskingPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, DataMaskingPolicyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().single().body();
} | [
"public",
"DataMaskingPolicyInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"DataMaskingPolicyInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroup... | Creates or updates a database data masking policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param parameters Parameters for creating or updating a data masking policy.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DataMaskingPolicyInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"database",
"data",
"masking",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DataMaskingPoliciesInner.java#L79-L81 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/contact/Grid.java | Grid.addAtoms | public void addAtoms(Atom[] iAtoms, BoundingBox icoordbounds, Atom[] jAtoms, BoundingBox jcoordbounds) {
"""
Adds the i and j atoms and fills the grid, passing their bounds (array of size 6 with x,y,z minima and x,y,z maxima)
This way the bounds don't need to be recomputed.
Subsequent call to {@link #getIndicesContacts()} or {@link #getAtomContacts()} will produce the interatomic contacts.
@param iAtoms
@param icoordbounds
@param jAtoms
@param jcoordbounds
"""
this.iAtoms = Calc.atomsToPoints(iAtoms);
this.iAtomObjects = iAtoms;
if (icoordbounds!=null) {
this.ibounds = icoordbounds;
} else {
this.ibounds = new BoundingBox(this.iAtoms);
}
this.jAtoms = Calc.atomsToPoints(jAtoms);
this.jAtomObjects = jAtoms;
if (jAtoms==iAtoms) {
this.jbounds=ibounds;
} else {
if (jcoordbounds!=null) {
this.jbounds = jcoordbounds;
} else {
this.jbounds = new BoundingBox(this.jAtoms);
}
}
fillGrid();
} | java | public void addAtoms(Atom[] iAtoms, BoundingBox icoordbounds, Atom[] jAtoms, BoundingBox jcoordbounds) {
this.iAtoms = Calc.atomsToPoints(iAtoms);
this.iAtomObjects = iAtoms;
if (icoordbounds!=null) {
this.ibounds = icoordbounds;
} else {
this.ibounds = new BoundingBox(this.iAtoms);
}
this.jAtoms = Calc.atomsToPoints(jAtoms);
this.jAtomObjects = jAtoms;
if (jAtoms==iAtoms) {
this.jbounds=ibounds;
} else {
if (jcoordbounds!=null) {
this.jbounds = jcoordbounds;
} else {
this.jbounds = new BoundingBox(this.jAtoms);
}
}
fillGrid();
} | [
"public",
"void",
"addAtoms",
"(",
"Atom",
"[",
"]",
"iAtoms",
",",
"BoundingBox",
"icoordbounds",
",",
"Atom",
"[",
"]",
"jAtoms",
",",
"BoundingBox",
"jcoordbounds",
")",
"{",
"this",
".",
"iAtoms",
"=",
"Calc",
".",
"atomsToPoints",
"(",
"iAtoms",
")",
... | Adds the i and j atoms and fills the grid, passing their bounds (array of size 6 with x,y,z minima and x,y,z maxima)
This way the bounds don't need to be recomputed.
Subsequent call to {@link #getIndicesContacts()} or {@link #getAtomContacts()} will produce the interatomic contacts.
@param iAtoms
@param icoordbounds
@param jAtoms
@param jcoordbounds | [
"Adds",
"the",
"i",
"and",
"j",
"atoms",
"and",
"fills",
"the",
"grid",
"passing",
"their",
"bounds",
"(",
"array",
"of",
"size",
"6",
"with",
"x",
"y",
"z",
"minima",
"and",
"x",
"y",
"z",
"maxima",
")",
"This",
"way",
"the",
"bounds",
"don",
"t",... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/Grid.java#L133-L158 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VFS.java | VFS.mountReal | public static Closeable mountReal(File realRoot, VirtualFile mountPoint) throws IOException {
"""
Create and mount a real file system, returning a single handle which will unmount and close the filesystem when
closed.
@param realRoot the real filesystem root
@param mountPoint the point at which the filesystem should be mounted
@return a handle
@throws IOException if an error occurs
"""
return doMount(new RealFileSystem(realRoot), mountPoint);
} | java | public static Closeable mountReal(File realRoot, VirtualFile mountPoint) throws IOException {
return doMount(new RealFileSystem(realRoot), mountPoint);
} | [
"public",
"static",
"Closeable",
"mountReal",
"(",
"File",
"realRoot",
",",
"VirtualFile",
"mountPoint",
")",
"throws",
"IOException",
"{",
"return",
"doMount",
"(",
"new",
"RealFileSystem",
"(",
"realRoot",
")",
",",
"mountPoint",
")",
";",
"}"
] | Create and mount a real file system, returning a single handle which will unmount and close the filesystem when
closed.
@param realRoot the real filesystem root
@param mountPoint the point at which the filesystem should be mounted
@return a handle
@throws IOException if an error occurs | [
"Create",
"and",
"mount",
"a",
"real",
"file",
"system",
"returning",
"a",
"single",
"handle",
"which",
"will",
"unmount",
"and",
"close",
"the",
"filesystem",
"when",
"closed",
"."
] | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFS.java#L380-L382 |
google/closure-compiler | src/com/google/javascript/jscomp/FunctionToBlockMutator.java | FunctionToBlockMutator.replaceReturns | private static Node replaceReturns(
Node block, String resultName, String labelName,
boolean resultMustBeSet) {
"""
Convert returns to assignments and breaks, as needed.
For example, with a labelName of 'foo':
{
return a;
}
becomes:
foo: {
a;
break foo;
}
or
foo: {
resultName = a;
break foo;
}
@param resultMustBeSet Whether the result must always be set to a value.
@return The node containing the transformed block, this may be different
than the passed in node 'block'.
"""
checkNotNull(block);
checkNotNull(labelName);
Node root = block;
boolean hasReturnAtExit = false;
int returnCount = NodeUtil.getNodeTypeReferenceCount(
block, Token.RETURN, new NodeUtil.MatchShallowStatement());
if (returnCount > 0) {
hasReturnAtExit = hasReturnAtExit(block);
// TODO(johnlenz): Simpler not to special case this,
// and let it be optimized later.
if (hasReturnAtExit) {
convertLastReturnToStatement(block, resultName);
returnCount--;
}
if (returnCount > 0) {
// A label and breaks are needed.
// Add the breaks
replaceReturnWithBreak(block, null, resultName, labelName);
// Add label
Node name = IR.labelName(labelName).srcref(block);
Node label = IR.label(name, block).srcref(block);
Node newRoot = IR.block().srcref(block);
newRoot.addChildToBack(label);
// The label is now the root.
root = newRoot;
}
}
// If there wasn't an return at the end of the function block, and we need
// a result, add one to the block.
if (resultMustBeSet && !hasReturnAtExit && resultName != null) {
addDummyAssignment(block, resultName);
}
return root;
} | java | private static Node replaceReturns(
Node block, String resultName, String labelName,
boolean resultMustBeSet) {
checkNotNull(block);
checkNotNull(labelName);
Node root = block;
boolean hasReturnAtExit = false;
int returnCount = NodeUtil.getNodeTypeReferenceCount(
block, Token.RETURN, new NodeUtil.MatchShallowStatement());
if (returnCount > 0) {
hasReturnAtExit = hasReturnAtExit(block);
// TODO(johnlenz): Simpler not to special case this,
// and let it be optimized later.
if (hasReturnAtExit) {
convertLastReturnToStatement(block, resultName);
returnCount--;
}
if (returnCount > 0) {
// A label and breaks are needed.
// Add the breaks
replaceReturnWithBreak(block, null, resultName, labelName);
// Add label
Node name = IR.labelName(labelName).srcref(block);
Node label = IR.label(name, block).srcref(block);
Node newRoot = IR.block().srcref(block);
newRoot.addChildToBack(label);
// The label is now the root.
root = newRoot;
}
}
// If there wasn't an return at the end of the function block, and we need
// a result, add one to the block.
if (resultMustBeSet && !hasReturnAtExit && resultName != null) {
addDummyAssignment(block, resultName);
}
return root;
} | [
"private",
"static",
"Node",
"replaceReturns",
"(",
"Node",
"block",
",",
"String",
"resultName",
",",
"String",
"labelName",
",",
"boolean",
"resultMustBeSet",
")",
"{",
"checkNotNull",
"(",
"block",
")",
";",
"checkNotNull",
"(",
"labelName",
")",
";",
"Node... | Convert returns to assignments and breaks, as needed.
For example, with a labelName of 'foo':
{
return a;
}
becomes:
foo: {
a;
break foo;
}
or
foo: {
resultName = a;
break foo;
}
@param resultMustBeSet Whether the result must always be set to a value.
@return The node containing the transformed block, this may be different
than the passed in node 'block'. | [
"Convert",
"returns",
"to",
"assignments",
"and",
"breaks",
"as",
"needed",
".",
"For",
"example",
"with",
"a",
"labelName",
"of",
"foo",
":",
"{",
"return",
"a",
";",
"}",
"becomes",
":",
"foo",
":",
"{",
"a",
";",
"break",
"foo",
";",
"}",
"or",
... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FunctionToBlockMutator.java#L402-L448 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.