repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
buschmais/jqa-core-framework | shared/src/main/java/com/buschmais/jqassistant/core/shared/option/OptionHelper.java | OptionHelper.selectValue | public static <T> T selectValue(T defaultValue, T... overrides) {
for (T override : overrides) {
if (override != null) {
return override;
}
}
return defaultValue;
} | java | public static <T> T selectValue(T defaultValue, T... overrides) {
for (T override : overrides) {
if (override != null) {
return override;
}
}
return defaultValue;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"selectValue",
"(",
"T",
"defaultValue",
",",
"T",
"...",
"overrides",
")",
"{",
"for",
"(",
"T",
"override",
":",
"overrides",
")",
"{",
"if",
"(",
"override",
"!=",
"null",
")",
"{",
"return",
"override",
";"... | Determine a value from given options.
@param defaultValue
The default (i.e. fallback) value.
@param overrides
The option that override the default value, the first non-null value will be accepted.
@param <T>
The value type.
@return The value. | [
"Determine",
"a",
"value",
"from",
"given",
"options",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/shared/src/main/java/com/buschmais/jqassistant/core/shared/option/OptionHelper.java#L25-L32 |
milaboratory/milib | src/main/java/com/milaboratory/core/alignment/AlignmentUtils.java | AlignmentUtils.calculateScore | public static <S extends Sequence<S>> int calculateScore(S seq1, Range seq1Range, Mutations<S> mutations,
AlignmentScoring<S> scoring) {
if (scoring instanceof LinearGapAlignmentScoring)
return calculateScore(seq1, seq1Range, mutations, (LinearGapAlignmentScoring<S>) scoring);
else if (scoring instanceof AffineGapAlignmentScoring)
return calculateScore(seq1, seq1Range, mutations, (AffineGapAlignmentScoring<S>) scoring);
else
throw new IllegalArgumentException("Unknown scoring type");
} | java | public static <S extends Sequence<S>> int calculateScore(S seq1, Range seq1Range, Mutations<S> mutations,
AlignmentScoring<S> scoring) {
if (scoring instanceof LinearGapAlignmentScoring)
return calculateScore(seq1, seq1Range, mutations, (LinearGapAlignmentScoring<S>) scoring);
else if (scoring instanceof AffineGapAlignmentScoring)
return calculateScore(seq1, seq1Range, mutations, (AffineGapAlignmentScoring<S>) scoring);
else
throw new IllegalArgumentException("Unknown scoring type");
} | [
"public",
"static",
"<",
"S",
"extends",
"Sequence",
"<",
"S",
">",
">",
"int",
"calculateScore",
"(",
"S",
"seq1",
",",
"Range",
"seq1Range",
",",
"Mutations",
"<",
"S",
">",
"mutations",
",",
"AlignmentScoring",
"<",
"S",
">",
"scoring",
")",
"{",
"i... | Calculates score of alignment
@param seq1 target sequence
@param seq1Range aligned range
@param mutations mutations (alignment)
@param scoring scoring
@param <S> sequence type
@return score | [
"Calculates",
"score",
"of",
"alignment"
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/alignment/AlignmentUtils.java#L59-L67 |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ResourceInjectionBinding.java | ResourceInjectionBinding.setXMLType | private void setXMLType(String typeName, String element, String nameElement, String typeElement) // F743-32443
throws InjectionConfigurationException
{
if (ivNameSpaceConfig.getClassLoader() == null)
{
setInjectionClassTypeName(typeName);
}
else
{
Class<?> type = loadClass(typeName);
//The type parameter is "optional"
if (type != null)
{
ResourceImpl curAnnotation = (ResourceImpl) getAnnotation();
if (curAnnotation.ivIsSetType)
{
Class<?> curType = getInjectionClassType();
// check that value from xml is a subclasss, if not throw an error
Class<?> mostSpecificClass = mostSpecificClass(type, curType);
if (mostSpecificClass == null)
{
Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
ivComponent,
ivModule,
ivApplication,
typeElement,
element,
nameElement,
getJndiName(),
curType,
type); // d479669
String exMsg = "The " + ivComponent +
" bean in the " + ivModule +
" module of the " + ivApplication +
" application has conflicting configuration data in the XML" +
" deployment descriptor. Conflicting " + typeElement +
" element values exist for multiple " + element +
" elements with the same " + nameElement + " element value : " +
getJndiName() + ". The conflicting " + typeElement +
" element values are " + curType + " and " +
type + "."; // d479669
throw new InjectionConfigurationException(exMsg);
}
curAnnotation.ivType = mostSpecificClass;
}
else
{
curAnnotation.ivType = type;
curAnnotation.ivIsSetType = true;
}
}
}
} | java | private void setXMLType(String typeName, String element, String nameElement, String typeElement) // F743-32443
throws InjectionConfigurationException
{
if (ivNameSpaceConfig.getClassLoader() == null)
{
setInjectionClassTypeName(typeName);
}
else
{
Class<?> type = loadClass(typeName);
//The type parameter is "optional"
if (type != null)
{
ResourceImpl curAnnotation = (ResourceImpl) getAnnotation();
if (curAnnotation.ivIsSetType)
{
Class<?> curType = getInjectionClassType();
// check that value from xml is a subclasss, if not throw an error
Class<?> mostSpecificClass = mostSpecificClass(type, curType);
if (mostSpecificClass == null)
{
Tr.error(tc, "CONFLICTING_XML_VALUES_CWNEN0052E",
ivComponent,
ivModule,
ivApplication,
typeElement,
element,
nameElement,
getJndiName(),
curType,
type); // d479669
String exMsg = "The " + ivComponent +
" bean in the " + ivModule +
" module of the " + ivApplication +
" application has conflicting configuration data in the XML" +
" deployment descriptor. Conflicting " + typeElement +
" element values exist for multiple " + element +
" elements with the same " + nameElement + " element value : " +
getJndiName() + ". The conflicting " + typeElement +
" element values are " + curType + " and " +
type + "."; // d479669
throw new InjectionConfigurationException(exMsg);
}
curAnnotation.ivType = mostSpecificClass;
}
else
{
curAnnotation.ivType = type;
curAnnotation.ivIsSetType = true;
}
}
}
} | [
"private",
"void",
"setXMLType",
"(",
"String",
"typeName",
",",
"String",
"element",
",",
"String",
"nameElement",
",",
"String",
"typeElement",
")",
"// F743-32443",
"throws",
"InjectionConfigurationException",
"{",
"if",
"(",
"ivNameSpaceConfig",
".",
"getClassLoad... | Sets the injection type as specified in XML.
@param typeName the type name specified in XML
@param element the XML ref element
@param nameElement the XML name element in the ref element
@param typeElement the XML type element in the ref element
@throws InjectionConfigurationException | [
"Sets",
"the",
"injection",
"type",
"as",
"specified",
"in",
"XML",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection.core/src/com/ibm/ws/injectionengine/processor/ResourceInjectionBinding.java#L1641-L1693 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getLeagues | public Future<List<LeagueList>> getLeagues(String teamId) {
return new ApiFuture<>(() -> handler.getLeagues(teamId));
} | java | public Future<List<LeagueList>> getLeagues(String teamId) {
return new ApiFuture<>(() -> handler.getLeagues(teamId));
} | [
"public",
"Future",
"<",
"List",
"<",
"LeagueList",
">",
">",
"getLeagues",
"(",
"String",
"teamId",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getLeagues",
"(",
"teamId",
")",
")",
";",
"}"
] | Get a listing of leagues for the specified team
@param teamId The id of the team
@return A list of leagues
@see <a href=https://developer.riotgames.com/api/methods#!/593/1860>Official API documentation</a> | [
"Get",
"a",
"listing",
"of",
"leagues",
"for",
"the",
"specified",
"team"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L265-L267 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/utils/WidgetUtil.java | WidgetUtil.getWidgetBanner | public static String getWidgetBanner(Guild guild, BannerType type)
{
Checks.notNull(guild, "Guild");
return getWidgetBanner(guild.getId(), type);
} | java | public static String getWidgetBanner(Guild guild, BannerType type)
{
Checks.notNull(guild, "Guild");
return getWidgetBanner(guild.getId(), type);
} | [
"public",
"static",
"String",
"getWidgetBanner",
"(",
"Guild",
"guild",
",",
"BannerType",
"type",
")",
"{",
"Checks",
".",
"notNull",
"(",
"guild",
",",
"\"Guild\"",
")",
";",
"return",
"getWidgetBanner",
"(",
"guild",
".",
"getId",
"(",
")",
",",
"type",... | Gets the banner image for the specified guild of the specified type.
<br>This banner will only be available if the guild in question has the
Widget enabled.
@param guild
The guild
@param type
The type (visual style) of the banner
@return A String containing the URL of the banner image | [
"Gets",
"the",
"banner",
"image",
"for",
"the",
"specified",
"guild",
"of",
"the",
"specified",
"type",
".",
"<br",
">",
"This",
"banner",
"will",
"only",
"be",
"available",
"if",
"the",
"guild",
"in",
"question",
"has",
"the",
"Widget",
"enabled",
"."
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/WidgetUtil.java#L64-L68 |
tracee/tracee | api/src/main/java/io/tracee/BackendProviderResolver.java | BackendProviderResolver.getBackendProviders | public Set<TraceeBackendProvider> getBackendProviders() {
// Create a working copy of Cache. Reference is updated upon cache update.
final Map<ClassLoader, Set<TraceeBackendProvider>> cacheCopy = providersPerClassloader;
// Try to determine TraceeBackendProvider by context classloader. Fallback: use classloader of class.
final Set<TraceeBackendProvider> providerFromContextClassLoader = getTraceeProviderFromClassloader(cacheCopy,
GetClassLoader.fromContext());
if (!providerFromContextClassLoader.isEmpty()) {
return providerFromContextClassLoader;
} else {
return getTraceeProviderFromClassloader(cacheCopy, GetClassLoader.fromClass(BackendProviderResolver.class));
}
} | java | public Set<TraceeBackendProvider> getBackendProviders() {
// Create a working copy of Cache. Reference is updated upon cache update.
final Map<ClassLoader, Set<TraceeBackendProvider>> cacheCopy = providersPerClassloader;
// Try to determine TraceeBackendProvider by context classloader. Fallback: use classloader of class.
final Set<TraceeBackendProvider> providerFromContextClassLoader = getTraceeProviderFromClassloader(cacheCopy,
GetClassLoader.fromContext());
if (!providerFromContextClassLoader.isEmpty()) {
return providerFromContextClassLoader;
} else {
return getTraceeProviderFromClassloader(cacheCopy, GetClassLoader.fromClass(BackendProviderResolver.class));
}
} | [
"public",
"Set",
"<",
"TraceeBackendProvider",
">",
"getBackendProviders",
"(",
")",
"{",
"// Create a working copy of Cache. Reference is updated upon cache update.",
"final",
"Map",
"<",
"ClassLoader",
",",
"Set",
"<",
"TraceeBackendProvider",
">",
">",
"cacheCopy",
"=",
... | Find correct backend provider for the current context classloader. If no context classloader is available, a
fallback with the classloader of this resolver class is taken
@return A bunch of TraceeBackendProvider registered and available in the current classloader | [
"Find",
"correct",
"backend",
"provider",
"for",
"the",
"current",
"context",
"classloader",
".",
"If",
"no",
"context",
"classloader",
"is",
"available",
"a",
"fallback",
"with",
"the",
"classloader",
"of",
"this",
"resolver",
"class",
"is",
"taken"
] | train | https://github.com/tracee/tracee/blob/15a68e435248f57757beb8ceac6db5b7f6035bb3/api/src/main/java/io/tracee/BackendProviderResolver.java#L29-L41 |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/converter/OIdentifiableConverter.java | OIdentifiableConverter.convertToOIdentifiable | public OIdentifiable convertToOIdentifiable(String value, Locale locale)
{
try
{
return new ORecordId(value);
} catch (Exception e)
{
throw newConversionException("Cannot convert '" + value + "' to "+getTargetType().getSimpleName(), value, locale);
}
} | java | public OIdentifiable convertToOIdentifiable(String value, Locale locale)
{
try
{
return new ORecordId(value);
} catch (Exception e)
{
throw newConversionException("Cannot convert '" + value + "' to "+getTargetType().getSimpleName(), value, locale);
}
} | [
"public",
"OIdentifiable",
"convertToOIdentifiable",
"(",
"String",
"value",
",",
"Locale",
"locale",
")",
"{",
"try",
"{",
"return",
"new",
"ORecordId",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"newConversionException",
... | Converts string to {@link ORecordId}
@param value string representation of a {@link ORID}
@param locale locale
@return {@link ORecordId} for a specified rid | [
"Converts",
"string",
"to",
"{"
] | train | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/converter/OIdentifiableConverter.java#L35-L44 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/r/houghes/OmsHoughCirclesRaster.java | OmsHoughCirclesRaster.getCenterPoints | private Coordinate[] getCenterPoints( double[][][] houghValues, int maxCircles ) {
Coordinate[] centerPoints = new Coordinate[maxCircles];
int xMax = 0;
int yMax = 0;
int rMax = 0;
pm.beginTask("Search for circles...", maxCircles);
for( int c = 0; c < maxCircles; c++ ) {
double counterMax = -1;
for( int radius = radiusMinPixel; radius <= radiusMaxPixel; radius = radius + radiusIncPixel ) {
int indexR = (radius - radiusMinPixel) / radiusIncPixel;
for( int y = 0; y < height; y++ ) {
for( int x = 0; x < width; x++ ) {
if (houghValues[x][y][indexR] > counterMax) {
counterMax = houghValues[x][y][indexR];
xMax = x;
yMax = y;
rMax = radius;
}
}
}
}
centerPoints[c] = new Coordinate(xMax, yMax, rMax);
clearNeighbours(houghValues, xMax, yMax, rMax);
pm.worked(1);
}
pm.done();
return centerPoints;
} | java | private Coordinate[] getCenterPoints( double[][][] houghValues, int maxCircles ) {
Coordinate[] centerPoints = new Coordinate[maxCircles];
int xMax = 0;
int yMax = 0;
int rMax = 0;
pm.beginTask("Search for circles...", maxCircles);
for( int c = 0; c < maxCircles; c++ ) {
double counterMax = -1;
for( int radius = radiusMinPixel; radius <= radiusMaxPixel; radius = radius + radiusIncPixel ) {
int indexR = (radius - radiusMinPixel) / radiusIncPixel;
for( int y = 0; y < height; y++ ) {
for( int x = 0; x < width; x++ ) {
if (houghValues[x][y][indexR] > counterMax) {
counterMax = houghValues[x][y][indexR];
xMax = x;
yMax = y;
rMax = radius;
}
}
}
}
centerPoints[c] = new Coordinate(xMax, yMax, rMax);
clearNeighbours(houghValues, xMax, yMax, rMax);
pm.worked(1);
}
pm.done();
return centerPoints;
} | [
"private",
"Coordinate",
"[",
"]",
"getCenterPoints",
"(",
"double",
"[",
"]",
"[",
"]",
"[",
"]",
"houghValues",
",",
"int",
"maxCircles",
")",
"{",
"Coordinate",
"[",
"]",
"centerPoints",
"=",
"new",
"Coordinate",
"[",
"maxCircles",
"]",
";",
"int",
"x... | Search for a fixed number of circles.
@param houghValues the hough values.
@param maxCircles The number of circles that should be found.
@return the center coordinates. | [
"Search",
"for",
"a",
"fixed",
"number",
"of",
"circles",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/houghes/OmsHoughCirclesRaster.java#L285-L316 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/objects/conversations/ConversationHsmLocalizableParameter.java | ConversationHsmLocalizableParameter.dateTime | public static ConversationHsmLocalizableParameter dateTime(final String defaultValue, final Date dateTime) {
ConversationHsmLocalizableParameter parameter = new ConversationHsmLocalizableParameter();
parameter.defaultValue = defaultValue;
parameter.dateTime = dateTime;
return parameter;
} | java | public static ConversationHsmLocalizableParameter dateTime(final String defaultValue, final Date dateTime) {
ConversationHsmLocalizableParameter parameter = new ConversationHsmLocalizableParameter();
parameter.defaultValue = defaultValue;
parameter.dateTime = dateTime;
return parameter;
} | [
"public",
"static",
"ConversationHsmLocalizableParameter",
"dateTime",
"(",
"final",
"String",
"defaultValue",
",",
"final",
"Date",
"dateTime",
")",
"{",
"ConversationHsmLocalizableParameter",
"parameter",
"=",
"new",
"ConversationHsmLocalizableParameter",
"(",
")",
";",
... | Gets a parameter that localizes a date/time.
@param defaultValue Default for when localization fails.
@param dateTime Localizable date/time. | [
"Gets",
"a",
"parameter",
"that",
"localizes",
"a",
"date",
"/",
"time",
"."
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/objects/conversations/ConversationHsmLocalizableParameter.java#L57-L63 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerImpl.java | TransformerImpl.setErrorListener | public void setErrorListener(ErrorListener listener)
throws IllegalArgumentException
{
synchronized (m_reentryGuard)
{
if (listener == null)
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NULL_ERROR_HANDLER, null)); //"Null error handler");
m_errorHandler = listener;
}
} | java | public void setErrorListener(ErrorListener listener)
throws IllegalArgumentException
{
synchronized (m_reentryGuard)
{
if (listener == null)
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NULL_ERROR_HANDLER, null)); //"Null error handler");
m_errorHandler = listener;
}
} | [
"public",
"void",
"setErrorListener",
"(",
"ErrorListener",
"listener",
")",
"throws",
"IllegalArgumentException",
"{",
"synchronized",
"(",
"m_reentryGuard",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"XSLMe... | Set the error event listener.
@param listener The new error listener.
@throws IllegalArgumentException if | [
"Set",
"the",
"error",
"event",
"listener",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerImpl.java#L2819-L2830 |
podio/podio-java | src/main/java/com/podio/org/OrgAPI.java | OrgAPI.getMemberByMail | public OrganizationMember getMemberByMail(int orgId, String mail) {
return getResourceFactory().getApiResource(
"/org/" + orgId + "/member/mail/" + mail).get(
OrganizationMember.class);
} | java | public OrganizationMember getMemberByMail(int orgId, String mail) {
return getResourceFactory().getApiResource(
"/org/" + orgId + "/member/mail/" + mail).get(
OrganizationMember.class);
} | [
"public",
"OrganizationMember",
"getMemberByMail",
"(",
"int",
"orgId",
",",
"String",
"mail",
")",
"{",
"return",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/org/\"",
"+",
"orgId",
"+",
"\"/member/mail/\"",
"+",
"mail",
")",
".",
"get",
"(... | Returns the member data for the given user in the given organization.
@param orgId
The id of the organization
@param mail
The mail of the users account
@return The details of the users membership of the organization | [
"Returns",
"the",
"member",
"data",
"for",
"the",
"given",
"user",
"in",
"the",
"given",
"organization",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/org/OrgAPI.java#L209-L213 |
karczews/RxBroadcastReceiver | library/src/main/java/com/github/karczews/rxbroadcastreceiver/RxBroadcastReceivers.java | RxBroadcastReceivers.fromIntentFilter | @NonNull
@CheckResult
public static Observable<Intent> fromIntentFilter(@NonNull final Context context,
@NonNull final IntentFilter filter) {
return new RxBroadcastReceiver(context, filter);
} | java | @NonNull
@CheckResult
public static Observable<Intent> fromIntentFilter(@NonNull final Context context,
@NonNull final IntentFilter filter) {
return new RxBroadcastReceiver(context, filter);
} | [
"@",
"NonNull",
"@",
"CheckResult",
"public",
"static",
"Observable",
"<",
"Intent",
">",
"fromIntentFilter",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"NonNull",
"final",
"IntentFilter",
"filter",
")",
"{",
"return",
"new",
"RxBroadcastRecei... | Creates Observable that will register {@link android.content.BroadcastReceiver} for provided
{@link IntentFilter} when subscribed to. Observable will emit received broadcast as data {@link Intent}
@param context used to register broadcast receiver to.
@param filter {@link IntentFilter} used to select Intent broadcast to be received. | [
"Creates",
"Observable",
"that",
"will",
"register",
"{",
"@link",
"android",
".",
"content",
".",
"BroadcastReceiver",
"}",
"for",
"provided",
"{",
"@link",
"IntentFilter",
"}",
"when",
"subscribed",
"to",
".",
"Observable",
"will",
"emit",
"received",
"broadca... | train | https://github.com/karczews/RxBroadcastReceiver/blob/08dfc33fca4e8772b25ae98a859c2cff69b4a203/library/src/main/java/com/github/karczews/rxbroadcastreceiver/RxBroadcastReceivers.java#L40-L45 |
revapi/revapi | revapi/src/main/java/org/revapi/AnalysisContext.java | AnalysisContext.copyWithConfiguration | public AnalysisContext copyWithConfiguration(ModelNode configuration) {
return new AnalysisContext(this.locale, configuration, this.oldApi, this.newApi, this.data);
} | java | public AnalysisContext copyWithConfiguration(ModelNode configuration) {
return new AnalysisContext(this.locale, configuration, this.oldApi, this.newApi, this.data);
} | [
"public",
"AnalysisContext",
"copyWithConfiguration",
"(",
"ModelNode",
"configuration",
")",
"{",
"return",
"new",
"AnalysisContext",
"(",
"this",
".",
"locale",
",",
"configuration",
",",
"this",
".",
"oldApi",
",",
"this",
".",
"newApi",
",",
"this",
".",
"... | This is generally only useful for extensions that delegate some of their functionality to other "internal"
extensions of their own that they need to configure.
@param configuration the configuration to be supplied with the returned analysis context.
@return an analysis context that is a clone of this instance but its configuration is replaced with the provided
one. | [
"This",
"is",
"generally",
"only",
"useful",
"for",
"extensions",
"that",
"delegate",
"some",
"of",
"their",
"functionality",
"to",
"other",
"internal",
"extensions",
"of",
"their",
"own",
"that",
"they",
"need",
"to",
"configure",
"."
] | train | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/AnalysisContext.java#L195-L197 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/splitassigner/InputSplitManager.java | InputSplitManager.getNextInputSplit | public InputSplit getNextInputSplit(final ExecutionVertex vertex, final int sequenceNumber) {
InputSplit nextInputSplit = this.inputSplitTracker.getInputSplitFromLog(vertex, sequenceNumber);
if (nextInputSplit != null) {
LOG.info("Input split " + nextInputSplit.getSplitNumber() + " for vertex " + vertex + " replayed from log");
return nextInputSplit;
}
final ExecutionGroupVertex groupVertex = vertex.getGroupVertex();
final InputSplitAssigner inputSplitAssigner = this.assignerCache.get(groupVertex);
if (inputSplitAssigner == null) {
final JobID jobID = groupVertex.getExecutionStage().getExecutionGraph().getJobID();
LOG.error("Cannot find input assigner for group vertex " + groupVertex.getName() + " (job " + jobID + ")");
return null;
}
nextInputSplit = inputSplitAssigner.getNextInputSplit(vertex);
if (nextInputSplit != null) {
this.inputSplitTracker.addInputSplitToLog(vertex, sequenceNumber, nextInputSplit);
LOG.info(vertex + " receives input split " + nextInputSplit.getSplitNumber());
}
return nextInputSplit;
} | java | public InputSplit getNextInputSplit(final ExecutionVertex vertex, final int sequenceNumber) {
InputSplit nextInputSplit = this.inputSplitTracker.getInputSplitFromLog(vertex, sequenceNumber);
if (nextInputSplit != null) {
LOG.info("Input split " + nextInputSplit.getSplitNumber() + " for vertex " + vertex + " replayed from log");
return nextInputSplit;
}
final ExecutionGroupVertex groupVertex = vertex.getGroupVertex();
final InputSplitAssigner inputSplitAssigner = this.assignerCache.get(groupVertex);
if (inputSplitAssigner == null) {
final JobID jobID = groupVertex.getExecutionStage().getExecutionGraph().getJobID();
LOG.error("Cannot find input assigner for group vertex " + groupVertex.getName() + " (job " + jobID + ")");
return null;
}
nextInputSplit = inputSplitAssigner.getNextInputSplit(vertex);
if (nextInputSplit != null) {
this.inputSplitTracker.addInputSplitToLog(vertex, sequenceNumber, nextInputSplit);
LOG.info(vertex + " receives input split " + nextInputSplit.getSplitNumber());
}
return nextInputSplit;
} | [
"public",
"InputSplit",
"getNextInputSplit",
"(",
"final",
"ExecutionVertex",
"vertex",
",",
"final",
"int",
"sequenceNumber",
")",
"{",
"InputSplit",
"nextInputSplit",
"=",
"this",
".",
"inputSplitTracker",
".",
"getInputSplitFromLog",
"(",
"vertex",
",",
"sequenceNu... | Returns the next input split the input split manager (or the responsible {@link InputSplitAssigner} to be more
precise) has chosen for the given vertex to consume.
@param vertex
the vertex for which the next input split is to be determined
@param sequenceNumber
the sequence number of the vertex's request
@return the next input split to consume or <code>null</code> if the vertex shall consume no more input splits | [
"Returns",
"the",
"next",
"input",
"split",
"the",
"input",
"split",
"manager",
"(",
"or",
"the",
"responsible",
"{",
"@link",
"InputSplitAssigner",
"}",
"to",
"be",
"more",
"precise",
")",
"has",
"chosen",
"for",
"the",
"given",
"vertex",
"to",
"consume",
... | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/splitassigner/InputSplitManager.java#L173-L196 |
michael-rapp/AndroidPreferenceActivity | example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java | AppearancePreferenceFragment.createToolbarElevationChangeListener | private OnPreferenceChangeListener createToolbarElevationChangeListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int elevation = Integer.valueOf((String) newValue);
((PreferenceActivity) getActivity()).setToolbarElevation(elevation);
return true;
}
};
} | java | private OnPreferenceChangeListener createToolbarElevationChangeListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int elevation = Integer.valueOf((String) newValue);
((PreferenceActivity) getActivity()).setToolbarElevation(elevation);
return true;
}
};
} | [
"private",
"OnPreferenceChangeListener",
"createToolbarElevationChangeListener",
"(",
")",
"{",
"return",
"new",
"OnPreferenceChangeListener",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"onPreferenceChange",
"(",
"Preference",
"preference",
",",
"Object",
"newVa... | Creates and returns a listener, which allows to adapt the elevation of the toolbar, when the
value of the corresponding preference has been changed.
@return The listener, which has been created, as an instance of the type {@link
OnPreferenceChangeListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"adapt",
"the",
"elevation",
"of",
"the",
"toolbar",
"when",
"the",
"value",
"of",
"the",
"corresponding",
"preference",
"has",
"been",
"changed",
"."
] | train | https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java#L67-L78 |
apache/incubator-gobblin | gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java | AzkabanClient.createHttpClient | private CloseableHttpClient createHttpClient() throws AzkabanClientException {
try {
// SSLSocketFactory using custom TrustStrategy that ignores warnings about untrusted certificates
// Self sign SSL
SSLContextBuilder sslcb = new SSLContextBuilder();
sslcb.loadTrustMaterial(null, (TrustStrategy) new TrustSelfSignedStrategy());
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcb.build());
HttpClientBuilder builder = HttpClientBuilder.create();
RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT)
.setSocketTimeout(10000)
.setConnectTimeout(10000)
.setConnectionRequestTimeout(10000)
.build();
builder.disableCookieManagement()
.useSystemProperties()
.setDefaultRequestConfig(requestConfig)
.setConnectionManager(new BasicHttpClientConnectionManager())
.setSSLSocketFactory(sslsf);
return builder.build();
} catch (Exception e) {
throw new AzkabanClientException("HttpClient cannot be created", e);
}
} | java | private CloseableHttpClient createHttpClient() throws AzkabanClientException {
try {
// SSLSocketFactory using custom TrustStrategy that ignores warnings about untrusted certificates
// Self sign SSL
SSLContextBuilder sslcb = new SSLContextBuilder();
sslcb.loadTrustMaterial(null, (TrustStrategy) new TrustSelfSignedStrategy());
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcb.build());
HttpClientBuilder builder = HttpClientBuilder.create();
RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT)
.setSocketTimeout(10000)
.setConnectTimeout(10000)
.setConnectionRequestTimeout(10000)
.build();
builder.disableCookieManagement()
.useSystemProperties()
.setDefaultRequestConfig(requestConfig)
.setConnectionManager(new BasicHttpClientConnectionManager())
.setSSLSocketFactory(sslsf);
return builder.build();
} catch (Exception e) {
throw new AzkabanClientException("HttpClient cannot be created", e);
}
} | [
"private",
"CloseableHttpClient",
"createHttpClient",
"(",
")",
"throws",
"AzkabanClientException",
"{",
"try",
"{",
"// SSLSocketFactory using custom TrustStrategy that ignores warnings about untrusted certificates",
"// Self sign SSL",
"SSLContextBuilder",
"sslcb",
"=",
"new",
"SSL... | Create a {@link CloseableHttpClient} used to communicate with Azkaban server.
Derived class can configure different http client by overriding this method.
@return A closeable http client. | [
"Create",
"a",
"{",
"@link",
"CloseableHttpClient",
"}",
"used",
"to",
"communicate",
"with",
"Azkaban",
"server",
".",
"Derived",
"class",
"can",
"configure",
"different",
"http",
"client",
"by",
"overriding",
"this",
"method",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java#L150-L175 |
wildfly/wildfly-core | remoting/subsystem/src/main/java/org/jboss/as/remoting/management/ManagementRemotingServices.java | ManagementRemotingServices.installManagementChannelOpenListenerService | public static void installManagementChannelOpenListenerService(
final ServiceTarget serviceTarget,
final ServiceName endpointName,
final String channelName,
final ServiceName operationHandlerName,
final OptionMap options,
final boolean onDemand) {
final ManagementChannelOpenListenerService channelOpenListenerService = new ManagementChannelOpenListenerService(channelName, options);
final ServiceBuilder<?> builder = serviceTarget.addService(channelOpenListenerService.getServiceName(endpointName), channelOpenListenerService)
.addDependency(endpointName, Endpoint.class, channelOpenListenerService.getEndpointInjector())
.addDependency(operationHandlerName, ManagementChannelInitialization.class, channelOpenListenerService.getOperationHandlerInjector())
.addDependency(ManagementChannelRegistryService.SERVICE_NAME, ManagementChannelRegistryService.class, channelOpenListenerService.getRegistry())
.addDependency(SHUTDOWN_EXECUTOR_NAME, ExecutorService.class, channelOpenListenerService.getExecutorServiceInjectedValue())
.setInitialMode(onDemand ? ON_DEMAND : ACTIVE);
builder.install();
} | java | public static void installManagementChannelOpenListenerService(
final ServiceTarget serviceTarget,
final ServiceName endpointName,
final String channelName,
final ServiceName operationHandlerName,
final OptionMap options,
final boolean onDemand) {
final ManagementChannelOpenListenerService channelOpenListenerService = new ManagementChannelOpenListenerService(channelName, options);
final ServiceBuilder<?> builder = serviceTarget.addService(channelOpenListenerService.getServiceName(endpointName), channelOpenListenerService)
.addDependency(endpointName, Endpoint.class, channelOpenListenerService.getEndpointInjector())
.addDependency(operationHandlerName, ManagementChannelInitialization.class, channelOpenListenerService.getOperationHandlerInjector())
.addDependency(ManagementChannelRegistryService.SERVICE_NAME, ManagementChannelRegistryService.class, channelOpenListenerService.getRegistry())
.addDependency(SHUTDOWN_EXECUTOR_NAME, ExecutorService.class, channelOpenListenerService.getExecutorServiceInjectedValue())
.setInitialMode(onDemand ? ON_DEMAND : ACTIVE);
builder.install();
} | [
"public",
"static",
"void",
"installManagementChannelOpenListenerService",
"(",
"final",
"ServiceTarget",
"serviceTarget",
",",
"final",
"ServiceName",
"endpointName",
",",
"final",
"String",
"channelName",
",",
"final",
"ServiceName",
"operationHandlerName",
",",
"final",
... | Set up the services to create a channel listener. This assumes that an endpoint service called {@code endpointName} exists.
@param serviceTarget the service target to install the services into
@param endpointName the name of the endpoint to install a channel listener into
@param channelName the name of the channel
@param operationHandlerName the name of the operation handler to handle request for this channel
@param options the remoting options
@param onDemand whether to install the services on demand | [
"Set",
"up",
"the",
"services",
"to",
"create",
"a",
"channel",
"listener",
".",
"This",
"assumes",
"that",
"an",
"endpoint",
"service",
"called",
"{"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/remoting/subsystem/src/main/java/org/jboss/as/remoting/management/ManagementRemotingServices.java#L114-L131 |
joniles/mpxj | src/main/java/net/sf/mpxj/Resource.java | Resource.setEnterpriseCost | public void setEnterpriseCost(int index, Number value)
{
set(selectField(ResourceFieldLists.ENTERPRISE_COST, index), value);
} | java | public void setEnterpriseCost(int index, Number value)
{
set(selectField(ResourceFieldLists.ENTERPRISE_COST, index), value);
} | [
"public",
"void",
"setEnterpriseCost",
"(",
"int",
"index",
",",
"Number",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"ResourceFieldLists",
".",
"ENTERPRISE_COST",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set an enterprise field value.
@param index field index
@param value field value | [
"Set",
"an",
"enterprise",
"field",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L2051-L2054 |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/MathService.java | MathService.intersectsLineSegment | public static boolean intersectsLineSegment(Coordinate a, Coordinate b, Coordinate c, Coordinate d) {
// check single-point segment: these never intersect
if ((a.getX() == b.getX() && a.getY() == b.getY()) || (c.getX() == d.getX() && c.getY() == d.getY())) {
return false;
}
double c1 = cross(a, c, a, b);
double c2 = cross(a, b, c, d);
if (c1 == 0 && c2 == 0) {
// colinear, only intersecting if overlapping (touch is ok)
double xmin = Math.min(a.getX(), b.getX());
double ymin = Math.min(a.getY(), b.getY());
double xmax = Math.max(a.getX(), b.getX());
double ymax = Math.max(a.getY(), b.getY());
// check first point of last segment in bounding box of first segment
if (c.getX() > xmin && c.getX() < xmax && c.getY() > ymin && c.getY() < ymax) {
return true;
// check last point of last segment in bounding box of first segment
} else if (d.getX() > xmin && d.getX() < xmax && d.getY() > ymin && d.getY() < ymax) {
return true;
// check same segment
} else {
return c.getX() >= xmin && c.getX() <= xmax && c.getY() >= ymin && c.getY() <= ymax & d.getX() >= xmin
&& d.getX() <= xmax && d.getY() >= ymin && d.getY() <= ymax;
}
}
if (c2 == 0) {
// segments are parallel but not colinear
return false;
}
// not parallel, classical test
double u = c1 / c2;
double t = cross(a, c, c, d) / c2;
return (t > 0) && (t < 1) && (u > 0) && (u < 1);
} | java | public static boolean intersectsLineSegment(Coordinate a, Coordinate b, Coordinate c, Coordinate d) {
// check single-point segment: these never intersect
if ((a.getX() == b.getX() && a.getY() == b.getY()) || (c.getX() == d.getX() && c.getY() == d.getY())) {
return false;
}
double c1 = cross(a, c, a, b);
double c2 = cross(a, b, c, d);
if (c1 == 0 && c2 == 0) {
// colinear, only intersecting if overlapping (touch is ok)
double xmin = Math.min(a.getX(), b.getX());
double ymin = Math.min(a.getY(), b.getY());
double xmax = Math.max(a.getX(), b.getX());
double ymax = Math.max(a.getY(), b.getY());
// check first point of last segment in bounding box of first segment
if (c.getX() > xmin && c.getX() < xmax && c.getY() > ymin && c.getY() < ymax) {
return true;
// check last point of last segment in bounding box of first segment
} else if (d.getX() > xmin && d.getX() < xmax && d.getY() > ymin && d.getY() < ymax) {
return true;
// check same segment
} else {
return c.getX() >= xmin && c.getX() <= xmax && c.getY() >= ymin && c.getY() <= ymax & d.getX() >= xmin
&& d.getX() <= xmax && d.getY() >= ymin && d.getY() <= ymax;
}
}
if (c2 == 0) {
// segments are parallel but not colinear
return false;
}
// not parallel, classical test
double u = c1 / c2;
double t = cross(a, c, c, d) / c2;
return (t > 0) && (t < 1) && (u > 0) && (u < 1);
} | [
"public",
"static",
"boolean",
"intersectsLineSegment",
"(",
"Coordinate",
"a",
",",
"Coordinate",
"b",
",",
"Coordinate",
"c",
",",
"Coordinate",
"d",
")",
"{",
"// check single-point segment: these never intersect",
"if",
"(",
"(",
"a",
".",
"getX",
"(",
")",
... | Calculates whether or not 2 line-segments intersect. The definition we use is that line segments intersect if
they either cross or overlap. If they touch in 1 end point, they do not intersect. This definition is most useful
for checking polygon validity, as touching rings in 1 point are allowed, but crossing or overlapping not.
@param a First coordinate of the first line-segment.
@param b Second coordinate of the first line-segment.
@param c First coordinate of the second line-segment.
@param d Second coordinate of the second line-segment.
@return Returns true or false. | [
"Calculates",
"whether",
"or",
"not",
"2",
"line",
"-",
"segments",
"intersect",
".",
"The",
"definition",
"we",
"use",
"is",
"that",
"line",
"segments",
"intersect",
"if",
"they",
"either",
"cross",
"or",
"overlap",
".",
"If",
"they",
"touch",
"in",
"1",
... | train | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/MathService.java#L41-L74 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.recoverDeletedStorageAccount | public StorageBundle recoverDeletedStorageAccount(String vaultBaseUrl, String storageAccountName) {
return recoverDeletedStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).toBlocking().single().body();
} | java | public StorageBundle recoverDeletedStorageAccount(String vaultBaseUrl, String storageAccountName) {
return recoverDeletedStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).toBlocking().single().body();
} | [
"public",
"StorageBundle",
"recoverDeletedStorageAccount",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
")",
"{",
"return",
"recoverDeletedStorageAccountWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"storageAccountName",
")",
".",
"toBlocking",
"... | Recovers the deleted storage account.
Recovers the deleted storage account in the specified vault. This operation can only be performed on a soft-delete enabled vault. This operation requires the storage/recover permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the StorageBundle object if successful. | [
"Recovers",
"the",
"deleted",
"storage",
"account",
".",
"Recovers",
"the",
"deleted",
"storage",
"account",
"in",
"the",
"specified",
"vault",
".",
"This",
"operation",
"can",
"only",
"be",
"performed",
"on",
"a",
"soft",
"-",
"delete",
"enabled",
"vault",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9432-L9434 |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateAssume | private Context translateAssume(WyilFile.Stmt.Assume stmt, Context context) {
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
Expr condition = p.first();
context = p.second();
return context.assume(condition);
} | java | private Context translateAssume(WyilFile.Stmt.Assume stmt, Context context) {
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
Expr condition = p.first();
context = p.second();
return context.assume(condition);
} | [
"private",
"Context",
"translateAssume",
"(",
"WyilFile",
".",
"Stmt",
".",
"Assume",
"stmt",
",",
"Context",
"context",
")",
"{",
"Pair",
"<",
"Expr",
",",
"Context",
">",
"p",
"=",
"translateExpressionWithChecks",
"(",
"stmt",
".",
"getCondition",
"(",
")"... | Translate an assume statement. This simply updates the current context to
assume that the given condition holds true (i.e. regardless of whether it
does or not). The purpose of assume statements is to allow some level of
interaction between the programmer and the verifier. That is, the programmer
can assume things which he/she knows to be true which the verifier cannot
prove (for whatever reason).
@param stmt
@param wyalFile | [
"Translate",
"an",
"assume",
"statement",
".",
"This",
"simply",
"updates",
"the",
"current",
"context",
"to",
"assume",
"that",
"the",
"given",
"condition",
"holds",
"true",
"(",
"i",
".",
"e",
".",
"regardless",
"of",
"whether",
"it",
"does",
"or",
"not"... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L730-L735 |
h2oai/h2o-2 | src/main/java/water/Model.java | Model.score | public final float[] score( String names[], String domains[][], boolean exact, double row[] ) {
return score(adapt(names,domains,exact),row,new float[nclasses()]);
} | java | public final float[] score( String names[], String domains[][], boolean exact, double row[] ) {
return score(adapt(names,domains,exact),row,new float[nclasses()]);
} | [
"public",
"final",
"float",
"[",
"]",
"score",
"(",
"String",
"names",
"[",
"]",
",",
"String",
"domains",
"[",
"]",
"[",
"]",
",",
"boolean",
"exact",
",",
"double",
"row",
"[",
"]",
")",
"{",
"return",
"score",
"(",
"adapt",
"(",
"names",
",",
... | Single row scoring, on a compatible set of data. Fairly expensive to adapt. | [
"Single",
"row",
"scoring",
"on",
"a",
"compatible",
"set",
"of",
"data",
".",
"Fairly",
"expensive",
"to",
"adapt",
"."
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Model.java#L296-L298 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfiguratorHelper.java | WebAppConfiguratorHelper.processFilterConfig | private FilterConfig processFilterConfig(DeploymentDescriptor webDD, Filter filter) {
String filterName = filter.getFilterName();
Map<String, ConfigItem<FilterConfig>> filterMap = configurator.getConfigItemMap("filter");
ConfigItem<FilterConfig> existedFilter = filterMap.get(filterName);
FilterConfig filterConfig = null;
if (existedFilter == null) {
String id = webDD.getIdForComponent(filter);
if (id == null) {
id = "FilterGeneratedId" + configurator.generateUniqueId();
}
filterConfig = webAppConfiguration.createFilterConfig(id, filterName);
configureTargetConfig(filterConfig, filter.getFilterClass(), "Filter", filter);
webAppConfiguration.addFilterInfo(filterConfig);
filterMap.put(filterName, createConfigItem(filterConfig));
} else {
filterConfig = existedFilter.getValue();
}
configureInitParams(filterConfig, filter.getInitParams(), "filter");
if (filter.isSetAsyncSupported()) {
configureAsyncSupported(filterConfig, filter.isAsyncSupported(), "filter");
}
return filterConfig;
} | java | private FilterConfig processFilterConfig(DeploymentDescriptor webDD, Filter filter) {
String filterName = filter.getFilterName();
Map<String, ConfigItem<FilterConfig>> filterMap = configurator.getConfigItemMap("filter");
ConfigItem<FilterConfig> existedFilter = filterMap.get(filterName);
FilterConfig filterConfig = null;
if (existedFilter == null) {
String id = webDD.getIdForComponent(filter);
if (id == null) {
id = "FilterGeneratedId" + configurator.generateUniqueId();
}
filterConfig = webAppConfiguration.createFilterConfig(id, filterName);
configureTargetConfig(filterConfig, filter.getFilterClass(), "Filter", filter);
webAppConfiguration.addFilterInfo(filterConfig);
filterMap.put(filterName, createConfigItem(filterConfig));
} else {
filterConfig = existedFilter.getValue();
}
configureInitParams(filterConfig, filter.getInitParams(), "filter");
if (filter.isSetAsyncSupported()) {
configureAsyncSupported(filterConfig, filter.isAsyncSupported(), "filter");
}
return filterConfig;
} | [
"private",
"FilterConfig",
"processFilterConfig",
"(",
"DeploymentDescriptor",
"webDD",
",",
"Filter",
"filter",
")",
"{",
"String",
"filterName",
"=",
"filter",
".",
"getFilterName",
"(",
")",
";",
"Map",
"<",
"String",
",",
"ConfigItem",
"<",
"FilterConfig",
"... | Merging Rules :
a. Once a filter configuration exists, the following ones with the same filter name are ignored
b. If init-param/asyncSupported is configured in web.xml, all the values from web-fagment.xml and annotation are ignored
b. If init-param/asyncSupported is NOT configured in web.xml,
b1. Those values from web-fragment.xml and annotation will be considered
b2. If they are configured in different web-fragment.xml, their values should be the same, or will trigger a warning | [
"Merging",
"Rules",
":",
"a",
".",
"Once",
"a",
"filter",
"configuration",
"exists",
"the",
"following",
"ones",
"with",
"the",
"same",
"filter",
"name",
"are",
"ignored",
"b",
".",
"If",
"init",
"-",
"param",
"/",
"asyncSupported",
"is",
"configured",
"in... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfiguratorHelper.java#L2812-L2841 |
biojava/biojava | biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java | Alignments.getPairwiseScore | static <S extends Sequence<C>, C extends Compound> double getPairwiseScore(S query, S target,
PairwiseSequenceScorerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) {
return getPairwiseScorer(query, target, type, gapPenalty, subMatrix).getScore();
} | java | static <S extends Sequence<C>, C extends Compound> double getPairwiseScore(S query, S target,
PairwiseSequenceScorerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) {
return getPairwiseScorer(query, target, type, gapPenalty, subMatrix).getScore();
} | [
"static",
"<",
"S",
"extends",
"Sequence",
"<",
"C",
">",
",",
"C",
"extends",
"Compound",
">",
"double",
"getPairwiseScore",
"(",
"S",
"query",
",",
"S",
"target",
",",
"PairwiseSequenceScorerType",
"type",
",",
"GapPenalty",
"gapPenalty",
",",
"SubstitutionM... | Factory method which computes a similarity score for the given {@link Sequence} pair.
@param <S> each {@link Sequence} of the pair is of type S
@param <C> each element of a {@link Sequence} is a {@link Compound} of type C
@param query the first {@link Sequence} to score
@param target the second {@link Sequence} to score
@param type chosen type from list of pairwise sequence scoring routines
@param gapPenalty the gap penalties used during alignment
@param subMatrix the set of substitution scores used during alignment
@return sequence pair score | [
"Factory",
"method",
"which",
"computes",
"a",
"similarity",
"score",
"for",
"the",
"given",
"{",
"@link",
"Sequence",
"}",
"pair",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java#L352-L355 |
doanduyhai/Achilles | achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java | AbstractProperty.encodeFromJava | public VALUETO encodeFromJava(VALUEFROM javaValue, Optional<CassandraOptions> cassandraOptions) {
if (javaValue == null) return null;
return encodeFromJavaInternal(javaValue, cassandraOptions);
} | java | public VALUETO encodeFromJava(VALUEFROM javaValue, Optional<CassandraOptions> cassandraOptions) {
if (javaValue == null) return null;
return encodeFromJavaInternal(javaValue, cassandraOptions);
} | [
"public",
"VALUETO",
"encodeFromJava",
"(",
"VALUEFROM",
"javaValue",
",",
"Optional",
"<",
"CassandraOptions",
">",
"cassandraOptions",
")",
"{",
"if",
"(",
"javaValue",
"==",
"null",
")",
"return",
"null",
";",
"return",
"encodeFromJavaInternal",
"(",
"javaValue... | Encode given java value to CQL-compatible value using Achilles codec system and a CassandraOptions
containing a runtime SchemaNameProvider. Use the
<br/>
<br/>
<pre class="code"><code class="java">
CassandraOptions.withSchemaNameProvider(SchemaNameProvider provider)
</code></pre>
<br/>
static method to build such a CassandraOptions instance
@param javaValue
@param cassandraOptions
@return | [
"Encode",
"given",
"java",
"value",
"to",
"CQL",
"-",
"compatible",
"value",
"using",
"Achilles",
"codec",
"system",
"and",
"a",
"CassandraOptions",
"containing",
"a",
"runtime",
"SchemaNameProvider",
".",
"Use",
"the",
"<br",
"/",
">",
"<br",
"/",
">",
"<pr... | train | https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java#L81-L84 |
rosette-api/java | api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java | HttpRosetteAPI.getSupportedLanguagePairs | @Override
public SupportedLanguagePairsResponse getSupportedLanguagePairs(String endpoint) throws HttpRosetteAPIException {
if (NAMES_ENDPOINTS.contains(endpoint) && !NAME_DEDUPLICATION_SERVICE_PATH.equals(endpoint)) {
return sendGetRequest(urlBase + endpoint + SUPPORTED_LANGUAGES_SUBPATH, SupportedLanguagePairsResponse.class);
} else {
return null;
}
} | java | @Override
public SupportedLanguagePairsResponse getSupportedLanguagePairs(String endpoint) throws HttpRosetteAPIException {
if (NAMES_ENDPOINTS.contains(endpoint) && !NAME_DEDUPLICATION_SERVICE_PATH.equals(endpoint)) {
return sendGetRequest(urlBase + endpoint + SUPPORTED_LANGUAGES_SUBPATH, SupportedLanguagePairsResponse.class);
} else {
return null;
}
} | [
"@",
"Override",
"public",
"SupportedLanguagePairsResponse",
"getSupportedLanguagePairs",
"(",
"String",
"endpoint",
")",
"throws",
"HttpRosetteAPIException",
"{",
"if",
"(",
"NAMES_ENDPOINTS",
".",
"contains",
"(",
"endpoint",
")",
"&&",
"!",
"NAME_DEDUPLICATION_SERVICE_... | Gets the set of language, script codes and transliteration scheme pairs supported by the specified Rosette API
endpoint.
@param endpoint Rosette API endpoint.
@return SupportedLanguagePairsResponse
@throws HttpRosetteAPIException for an error returned from the Rosette API. | [
"Gets",
"the",
"set",
"of",
"language",
"script",
"codes",
"and",
"transliteration",
"scheme",
"pairs",
"supported",
"by",
"the",
"specified",
"Rosette",
"API",
"endpoint",
"."
] | train | https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java#L257-L264 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.lockResource | public void lockResource(CmsRequestContext context, CmsResource resource, CmsLockType type) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL);
m_driverManager.lockResource(dbc, resource, type);
} catch (Exception e) {
CmsMessageContainer messageContainer;
if (e instanceof CmsLockException) {
messageContainer = ((CmsLockException)e).getMessageContainer();
} else {
messageContainer = Messages.get().container(
Messages.ERR_LOCK_RESOURCE_2,
context.getSitePath(resource),
type.toString());
}
dbc.report(null, messageContainer, e);
} finally {
dbc.clear();
}
} | java | public void lockResource(CmsRequestContext context, CmsResource resource, CmsLockType type) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL);
m_driverManager.lockResource(dbc, resource, type);
} catch (Exception e) {
CmsMessageContainer messageContainer;
if (e instanceof CmsLockException) {
messageContainer = ((CmsLockException)e).getMessageContainer();
} else {
messageContainer = Messages.get().container(
Messages.ERR_LOCK_RESOURCE_2,
context.getSitePath(resource),
type.toString());
}
dbc.report(null, messageContainer, e);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"lockResource",
"(",
"CmsRequestContext",
"context",
",",
"CmsResource",
"resource",
",",
"CmsLockType",
"type",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
... | Locks a resource.<p>
The <code>type</code> parameter controls what kind of lock is used.<br>
Possible values for this parameter are: <br>
<ul>
<li><code>{@link org.opencms.lock.CmsLockType#EXCLUSIVE}</code></li>
<li><code>{@link org.opencms.lock.CmsLockType#TEMPORARY}</code></li>
<li><code>{@link org.opencms.lock.CmsLockType#PUBLISH}</code></li>
</ul><p>
@param context the current request context
@param resource the resource to lock
@param type type of the lock
@throws CmsException if something goes wrong
@see CmsObject#lockResource(String)
@see CmsObject#lockResourceTemporary(String)
@see org.opencms.file.types.I_CmsResourceType#lockResource(CmsObject, CmsSecurityManager, CmsResource, CmsLockType) | [
"Locks",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L3562-L3583 |
gwt-maven-plugin/gwt-maven-plugin | src/main/java/org/codehaus/mojo/gwt/AbstractGwtMojo.java | AbstractGwtMojo.addClasspathElements | protected int addClasspathElements( Collection<?> elements, URL[] urls, int startPosition )
throws MojoExecutionException
{
for ( Object object : elements )
{
try
{
if ( object instanceof Artifact )
{
urls[startPosition] = ( (Artifact) object ).getFile().toURI().toURL();
}
else if ( object instanceof Resource )
{
urls[startPosition] = new File( ( (Resource) object ).getDirectory() ).toURI().toURL();
}
else
{
urls[startPosition] = new File( (String) object ).toURI().toURL();
}
}
catch ( MalformedURLException e )
{
throw new MojoExecutionException(
"Failed to convert original classpath element " + object + " to URL.",
e );
}
startPosition++;
}
return startPosition;
} | java | protected int addClasspathElements( Collection<?> elements, URL[] urls, int startPosition )
throws MojoExecutionException
{
for ( Object object : elements )
{
try
{
if ( object instanceof Artifact )
{
urls[startPosition] = ( (Artifact) object ).getFile().toURI().toURL();
}
else if ( object instanceof Resource )
{
urls[startPosition] = new File( ( (Resource) object ).getDirectory() ).toURI().toURL();
}
else
{
urls[startPosition] = new File( (String) object ).toURI().toURL();
}
}
catch ( MalformedURLException e )
{
throw new MojoExecutionException(
"Failed to convert original classpath element " + object + " to URL.",
e );
}
startPosition++;
}
return startPosition;
} | [
"protected",
"int",
"addClasspathElements",
"(",
"Collection",
"<",
"?",
">",
"elements",
",",
"URL",
"[",
"]",
"urls",
",",
"int",
"startPosition",
")",
"throws",
"MojoExecutionException",
"{",
"for",
"(",
"Object",
"object",
":",
"elements",
")",
"{",
"try... | Add classpath elements to a classpath URL set
@param elements the initial URL set
@param urls the urls to add
@param startPosition the position to insert URLS
@return full classpath URL set
@throws MojoExecutionException some error occured | [
"Add",
"classpath",
"elements",
"to",
"a",
"classpath",
"URL",
"set"
] | train | https://github.com/gwt-maven-plugin/gwt-maven-plugin/blob/0cdd5054b43f182cc22a8acf61ec79ac42b0dfdc/src/main/java/org/codehaus/mojo/gwt/AbstractGwtMojo.java#L184-L213 |
JadiraOrg/jadira | bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java | BasicBinder.registerMarshaller | public final <S, T> void registerMarshaller(ConverterKey<S,T> key, ToMarshaller<S, T> converter) {
registerConverter(key, new ToMarshallerConverter<S,T>(converter));
} | java | public final <S, T> void registerMarshaller(ConverterKey<S,T> key, ToMarshaller<S, T> converter) {
registerConverter(key, new ToMarshallerConverter<S,T>(converter));
} | [
"public",
"final",
"<",
"S",
",",
"T",
">",
"void",
"registerMarshaller",
"(",
"ConverterKey",
"<",
"S",
",",
"T",
">",
"key",
",",
"ToMarshaller",
"<",
"S",
",",
"T",
">",
"converter",
")",
"{",
"registerConverter",
"(",
"key",
",",
"new",
"ToMarshall... | Register a Marshaller with the given source and target class.
The marshaller is used as follows: Instances of the source can be marshalled into the target class.
@param key Converter Key to use
@param converter The ToMarshaller to be registered | [
"Register",
"a",
"Marshaller",
"with",
"the",
"given",
"source",
"and",
"target",
"class",
".",
"The",
"marshaller",
"is",
"used",
"as",
"follows",
":",
"Instances",
"of",
"the",
"source",
"can",
"be",
"marshalled",
"into",
"the",
"target",
"class",
"."
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L655-L657 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseScsrsm_analysis | public static int cusparseScsrsm_analysis(
cusparseHandle handle,
int transA,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrSortedValA,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
cusparseSolveAnalysisInfo info)
{
return checkResult(cusparseScsrsm_analysisNative(handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info));
} | java | public static int cusparseScsrsm_analysis(
cusparseHandle handle,
int transA,
int m,
int nnz,
cusparseMatDescr descrA,
Pointer csrSortedValA,
Pointer csrSortedRowPtrA,
Pointer csrSortedColIndA,
cusparseSolveAnalysisInfo info)
{
return checkResult(cusparseScsrsm_analysisNative(handle, transA, m, nnz, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, info));
} | [
"public",
"static",
"int",
"cusparseScsrsm_analysis",
"(",
"cusparseHandle",
"handle",
",",
"int",
"transA",
",",
"int",
"m",
",",
"int",
"nnz",
",",
"cusparseMatDescr",
"descrA",
",",
"Pointer",
"csrSortedValA",
",",
"Pointer",
"csrSortedRowPtrA",
",",
"Pointer",... | <pre>
Description: Solution of triangular linear system op(A) * X = alpha * F,
with multiple right-hand-sides, where A is a sparse matrix in CSR storage
format, rhs F and solution X are dense tall matrices.
This routine implements algorithm 1 for this problem.
</pre> | [
"<pre",
">",
"Description",
":",
"Solution",
"of",
"triangular",
"linear",
"system",
"op",
"(",
"A",
")",
"*",
"X",
"=",
"alpha",
"*",
"F",
"with",
"multiple",
"right",
"-",
"hand",
"-",
"sides",
"where",
"A",
"is",
"a",
"sparse",
"matrix",
"in",
"CS... | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L4300-L4312 |
jeevatkm/excelReader | src/main/java/com/myjeeva/poi/ExcelReader.java | ExcelReader.readSheet | private void readSheet(StylesTable styles, ReadOnlySharedStringsTable sharedStringsTable,
InputStream sheetInputStream) throws IOException, ParserConfigurationException, SAXException {
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
XMLReader sheetParser = saxFactory.newSAXParser().getXMLReader();
ContentHandler handler =
new XSSFSheetXMLHandler(styles, sharedStringsTable, sheetContentsHandler, true);
sheetParser.setContentHandler(handler);
sheetParser.parse(new InputSource(sheetInputStream));
} | java | private void readSheet(StylesTable styles, ReadOnlySharedStringsTable sharedStringsTable,
InputStream sheetInputStream) throws IOException, ParserConfigurationException, SAXException {
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
XMLReader sheetParser = saxFactory.newSAXParser().getXMLReader();
ContentHandler handler =
new XSSFSheetXMLHandler(styles, sharedStringsTable, sheetContentsHandler, true);
sheetParser.setContentHandler(handler);
sheetParser.parse(new InputSource(sheetInputStream));
} | [
"private",
"void",
"readSheet",
"(",
"StylesTable",
"styles",
",",
"ReadOnlySharedStringsTable",
"sharedStringsTable",
",",
"InputStream",
"sheetInputStream",
")",
"throws",
"IOException",
",",
"ParserConfigurationException",
",",
"SAXException",
"{",
"SAXParserFactory",
"s... | Parses the content of one sheet using the specified styles and shared-strings tables.
@param styles a {@link StylesTable} object
@param sharedStringsTable a {@link ReadOnlySharedStringsTable} object
@param sheetInputStream a {@link InputStream} object
@throws IOException
@throws ParserConfigurationException
@throws SAXException | [
"Parses",
"the",
"content",
"of",
"one",
"sheet",
"using",
"the",
"specified",
"styles",
"and",
"shared",
"-",
"strings",
"tables",
"."
] | train | https://github.com/jeevatkm/excelReader/blob/87f451474e3e8863688d19269bcd2bcc56873e87/src/main/java/com/myjeeva/poi/ExcelReader.java#L188-L199 |
auth0/Auth0.Android | auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java | AuthenticationAPIClient.loginWithOTP | @SuppressWarnings("WeakerAccess")
public AuthenticationRequest loginWithOTP(@NonNull String mfaToken, @NonNull String otp) {
Map<String, Object> parameters = ParameterBuilder.newBuilder()
.setGrantType(GRANT_TYPE_MFA_OTP)
.set(MFA_TOKEN_KEY, mfaToken)
.set(ONE_TIME_PASSWORD_KEY, otp)
.asDictionary();
return loginWithToken(parameters);
} | java | @SuppressWarnings("WeakerAccess")
public AuthenticationRequest loginWithOTP(@NonNull String mfaToken, @NonNull String otp) {
Map<String, Object> parameters = ParameterBuilder.newBuilder()
.setGrantType(GRANT_TYPE_MFA_OTP)
.set(MFA_TOKEN_KEY, mfaToken)
.set(ONE_TIME_PASSWORD_KEY, otp)
.asDictionary();
return loginWithToken(parameters);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"AuthenticationRequest",
"loginWithOTP",
"(",
"@",
"NonNull",
"String",
"mfaToken",
",",
"@",
"NonNull",
"String",
"otp",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"P... | Log in a user using the One Time Password code after they have received the 'mfa_required' error.
The MFA token tells the server the username or email, password and realm values sent on the first request.
Requires your client to have the <b>MFA</b> Grant Type enabled. See <a href="https://auth0.com/docs/clients/client-grant-types">Client Grant Types</a> to learn how to enable it.* Example usage:
<pre>
{@code
client.loginWithOTP("{mfa token}", "{one time password}")
.start(new BaseCallback<Credentials>() {
{@literal}Override
public void onSuccess(Credentials payload) { }
{@literal}Override
public void onFailure(AuthenticationException error) { }
});
}
</pre>
@param mfaToken the token received in the previous {@link #login(String, String, String)} response.
@param otp the one time password code provided by the resource owner, typically obtained from an
MFA application such as Google Authenticator or Guardian.
@return a request to configure and start that will yield {@link Credentials} | [
"Log",
"in",
"a",
"user",
"using",
"the",
"One",
"Time",
"Password",
"code",
"after",
"they",
"have",
"received",
"the",
"mfa_required",
"error",
".",
"The",
"MFA",
"token",
"tells",
"the",
"server",
"the",
"username",
"or",
"email",
"password",
"and",
"re... | train | https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java#L268-L277 |
b3dgs/lionengine | lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/MouseAwt.java | MouseAwt.setResolution | public void setResolution(Resolution output, Resolution source)
{
Check.notNull(output);
Check.notNull(source);
xRatio = output.getWidth() / (double) source.getWidth();
yRatio = output.getHeight() / (double) source.getHeight();
} | java | public void setResolution(Resolution output, Resolution source)
{
Check.notNull(output);
Check.notNull(source);
xRatio = output.getWidth() / (double) source.getWidth();
yRatio = output.getHeight() / (double) source.getHeight();
} | [
"public",
"void",
"setResolution",
"(",
"Resolution",
"output",
",",
"Resolution",
"source",
")",
"{",
"Check",
".",
"notNull",
"(",
"output",
")",
";",
"Check",
".",
"notNull",
"(",
"source",
")",
";",
"xRatio",
"=",
"output",
".",
"getWidth",
"(",
")",... | Set the resolution used. This will compute mouse horizontal and vertical ratio.
@param output The resolution output (must not be <code>null</code>).
@param source The resolution source (must not be <code>null</code>).
@throws LionEngineException If invalid argument. | [
"Set",
"the",
"resolution",
"used",
".",
"This",
"will",
"compute",
"mouse",
"horizontal",
"and",
"vertical",
"ratio",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/MouseAwt.java#L93-L100 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java | AmazonDynamoDBClient.createTable | public CreateTableResult createTable(CreateTableRequest createTableRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(createTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<CreateTableRequest> request = marshall(createTableRequest,
new CreateTableRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<CreateTableResult, JsonUnmarshallerContext> unmarshaller = new CreateTableResultJsonUnmarshaller();
JsonResponseHandler<CreateTableResult> responseHandler = new JsonResponseHandler<CreateTableResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | java | public CreateTableResult createTable(CreateTableRequest createTableRequest)
throws AmazonServiceException, AmazonClientException {
ExecutionContext executionContext = createExecutionContext(createTableRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
Request<CreateTableRequest> request = marshall(createTableRequest,
new CreateTableRequestMarshaller(),
executionContext.getAwsRequestMetrics());
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
Unmarshaller<CreateTableResult, JsonUnmarshallerContext> unmarshaller = new CreateTableResultJsonUnmarshaller();
JsonResponseHandler<CreateTableResult> responseHandler = new JsonResponseHandler<CreateTableResult>(unmarshaller);
return invoke(request, responseHandler, executionContext);
} | [
"public",
"CreateTableResult",
"createTable",
"(",
"CreateTableRequest",
"createTableRequest",
")",
"throws",
"AmazonServiceException",
",",
"AmazonClientException",
"{",
"ExecutionContext",
"executionContext",
"=",
"createExecutionContext",
"(",
"createTableRequest",
")",
";",... | <p>
Adds a new table to your account.
</p>
<p>
The table name must be unique among those associated with the AWS
Account issuing the request, and the AWS Region that receives the
request (e.g. <code>us-east-1</code> ).
</p>
<p>
The <code>CreateTable</code> operation triggers an asynchronous
workflow to begin creating the table. Amazon DynamoDB immediately
returns the state of the table ( <code>CREATING</code> ) until the
table is in the <code>ACTIVE</code> state. Once the table is in the
<code>ACTIVE</code> state, you can perform data plane operations.
</p>
@param createTableRequest Container for the necessary parameters to
execute the CreateTable service method on AmazonDynamoDB.
@return The response from the CreateTable service method, as returned
by AmazonDynamoDB.
@throws ResourceInUseException
@throws LimitExceededException
@throws InternalServerErrorException
@throws AmazonClientException
If any internal errors are encountered inside the client while
attempting to make the request or handle the response. For example
if a network connection is not available.
@throws AmazonServiceException
If an error response is returned by AmazonDynamoDB indicating
either a problem with the data in the request, or a server side issue. | [
"<p",
">",
"Adds",
"a",
"new",
"table",
"to",
"your",
"account",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"table",
"name",
"must",
"be",
"unique",
"among",
"those",
"associated",
"with",
"the",
"AWS",
"Account",
"issuing",
"the",
"request",
"and",
... | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L679-L691 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/MemcachedClient.java | MemcachedClient.waitForQueues | @Override
public boolean waitForQueues(long timeout, TimeUnit unit) {
CountDownLatch blatch = broadcastOp(new BroadcastOpFactory() {
@Override
public Operation newOp(final MemcachedNode n,
final CountDownLatch latch) {
return opFact.noop(new OperationCallback() {
@Override
public void complete() {
latch.countDown();
}
@Override
public void receivedStatus(OperationStatus s) {
// Nothing special when receiving status, only
// necessary to complete the interface
}
});
}
}, mconn.getLocator().getAll(), false);
try {
// XXX: Perhaps IllegalStateException should be caught here
// and the check retried.
return blatch.await(timeout, unit);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for queues", e);
}
} | java | @Override
public boolean waitForQueues(long timeout, TimeUnit unit) {
CountDownLatch blatch = broadcastOp(new BroadcastOpFactory() {
@Override
public Operation newOp(final MemcachedNode n,
final CountDownLatch latch) {
return opFact.noop(new OperationCallback() {
@Override
public void complete() {
latch.countDown();
}
@Override
public void receivedStatus(OperationStatus s) {
// Nothing special when receiving status, only
// necessary to complete the interface
}
});
}
}, mconn.getLocator().getAll(), false);
try {
// XXX: Perhaps IllegalStateException should be caught here
// and the check retried.
return blatch.await(timeout, unit);
} catch (InterruptedException e) {
throw new RuntimeException("Interrupted waiting for queues", e);
}
} | [
"@",
"Override",
"public",
"boolean",
"waitForQueues",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"CountDownLatch",
"blatch",
"=",
"broadcastOp",
"(",
"new",
"BroadcastOpFactory",
"(",
")",
"{",
"@",
"Override",
"public",
"Operation",
"newOp",
... | Wait for the queues to die down.
@param timeout the amount of time time for shutdown
@param unit the TimeUnit for the timeout
@return result of the request for the wait
@throws IllegalStateException in the rare circumstance where queue is too
full to accept any more requests | [
"Wait",
"for",
"the",
"queues",
"to",
"die",
"down",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L2533-L2560 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.rotateAround | public Matrix4d rotateAround(Quaterniondc quat, double ox, double oy, double oz) {
return rotateAround(quat, ox, oy, oz, this);
} | java | public Matrix4d rotateAround(Quaterniondc quat, double ox, double oy, double oz) {
return rotateAround(quat, ox, oy, oz, this);
} | [
"public",
"Matrix4d",
"rotateAround",
"(",
"Quaterniondc",
"quat",
",",
"double",
"ox",
",",
"double",
"oy",
",",
"double",
"oz",
")",
"{",
"return",
"rotateAround",
"(",
"quat",
",",
"ox",
",",
"oy",
",",
"oz",
",",
"this",
")",
";",
"}"
] | Apply the rotation transformation of the given {@link Quaterniondc} to this matrix while using <code>(ox, oy, oz)</code> as the rotation origin.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>Q</code> the rotation matrix obtained from the given quaternion,
then the new matrix will be <code>M * Q</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * Q * v</code>,
the quaternion rotation will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy, oz).rotate(quat).translate(-ox, -oy, -oz)</code>
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion">http://en.wikipedia.org</a>
@param quat
the {@link Quaterniondc}
@param ox
the x coordinate of the rotation origin
@param oy
the y coordinate of the rotation origin
@param oz
the z coordinate of the rotation origin
@return a matrix holding the result | [
"Apply",
"the",
"rotation",
"transformation",
"of",
"the",
"given",
"{",
"@link",
"Quaterniondc",
"}",
"to",
"this",
"matrix",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
"oz",
")",
"<",
"/",
"code",
">",
"as",
"the",
"rotation",
"origin",
".",
"<... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L5005-L5007 |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/EnforcementJobRest.java | EnforcementJobRest.getEnforcements | @GET
@Produces(MediaType.APPLICATION_XML)
public Response getEnforcements() {
logger.debug("StartOf getEnforcements - REQUEST for /enforcements");
EnforcementJobHelper enforcementJobService = getHelper();
String serializedEnforcements = null;
try{
serializedEnforcements = enforcementJobService.getEnforcements();
} catch (HelperException e) {
logger.info("getEnforcements exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getEnforcements");
return buildResponse(200, serializedEnforcements);
} | java | @GET
@Produces(MediaType.APPLICATION_XML)
public Response getEnforcements() {
logger.debug("StartOf getEnforcements - REQUEST for /enforcements");
EnforcementJobHelper enforcementJobService = getHelper();
String serializedEnforcements = null;
try{
serializedEnforcements = enforcementJobService.getEnforcements();
} catch (HelperException e) {
logger.info("getEnforcements exception:"+e.getMessage());
return buildResponse(e);
}
logger.debug("EndOf getEnforcements");
return buildResponse(200, serializedEnforcements);
} | [
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_XML",
")",
"public",
"Response",
"getEnforcements",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"StartOf getEnforcements - REQUEST for /enforcements\"",
")",
";",
"EnforcementJobHelper",
"enforcementJobS... | Get the list of available enforcements
<pre>
GET /enforcements
Request:
GET /enforcements HTTP/1.1
Accept: application/xml
Response:
{@code
<?xml version="1.0" encoding="UTF-8"?>
<collection href="/enforcements">
<items offset="0" total="1">
<enforcement_job>
<agreement_id>agreement04</agreement_id>
<enabled>false</enabled>
</enforcement_job>
</items>
</collection>
}
</pre>
Example: <li>curl http://localhost:8080/sla-service/enforcements</li>
@return XML information with the different details of the different
enforcements
@throws Exception | [
"Get",
"the",
"list",
"of",
"available",
"enforcements"
] | train | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/EnforcementJobRest.java#L101-L117 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/job_monitor/AvroJobSpecKafkaJobMonitor.java | Factory.forConfig | public JobSpecMonitor forConfig(Config localScopeConfig, MutableJobCatalog jobCatalog) throws IOException {
Preconditions.checkArgument(localScopeConfig.hasPath(TOPIC_KEY));
Config config = localScopeConfig.withFallback(DEFAULTS);
String topic = config.getString(TOPIC_KEY);
SchemaVersionWriter versionWriter;
try {
versionWriter = (SchemaVersionWriter) GobblinConstructorUtils.
invokeLongestConstructor(Class.forName(config.getString(SCHEMA_VERSION_READER_CLASS)), config);
} catch (ReflectiveOperationException roe) {
throw new IllegalArgumentException(roe);
}
return new AvroJobSpecKafkaJobMonitor(topic, jobCatalog, config, versionWriter);
} | java | public JobSpecMonitor forConfig(Config localScopeConfig, MutableJobCatalog jobCatalog) throws IOException {
Preconditions.checkArgument(localScopeConfig.hasPath(TOPIC_KEY));
Config config = localScopeConfig.withFallback(DEFAULTS);
String topic = config.getString(TOPIC_KEY);
SchemaVersionWriter versionWriter;
try {
versionWriter = (SchemaVersionWriter) GobblinConstructorUtils.
invokeLongestConstructor(Class.forName(config.getString(SCHEMA_VERSION_READER_CLASS)), config);
} catch (ReflectiveOperationException roe) {
throw new IllegalArgumentException(roe);
}
return new AvroJobSpecKafkaJobMonitor(topic, jobCatalog, config, versionWriter);
} | [
"public",
"JobSpecMonitor",
"forConfig",
"(",
"Config",
"localScopeConfig",
",",
"MutableJobCatalog",
"jobCatalog",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"localScopeConfig",
".",
"hasPath",
"(",
"TOPIC_KEY",
")",
")",
";",
"C... | Create a {@link AvroJobSpecKafkaJobMonitor} from an input {@link Config}. Useful for multiple monitors, where
the configuration of each monitor is scoped.
@param localScopeConfig The sub-{@link Config} for this monitor without any namespacing (e.g. the key for
topic should simply be "topic").
@throws IOException | [
"Create",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/job_monitor/AvroJobSpecKafkaJobMonitor.java#L78-L93 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java | DroolsStreamUtils.streamIn | public static Object streamIn(byte[] bytes, boolean compressed) throws IOException, ClassNotFoundException {
return streamIn(new ByteArrayInputStream(bytes), null, compressed);
} | java | public static Object streamIn(byte[] bytes, boolean compressed) throws IOException, ClassNotFoundException {
return streamIn(new ByteArrayInputStream(bytes), null, compressed);
} | [
"public",
"static",
"Object",
"streamIn",
"(",
"byte",
"[",
"]",
"bytes",
",",
"boolean",
"compressed",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"return",
"streamIn",
"(",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
",",
"null",
... | This method reads the contents from the given byte array and returns the object. The contents in the given
buffer could be compressed or uncompressed depending on the given flag. It is assumed that the content
stream was written by the corresponding streamOut methods of this class.
@param bytes
@param compressed
@return
@throws IOException
@throws ClassNotFoundException | [
"This",
"method",
"reads",
"the",
"contents",
"from",
"the",
"given",
"byte",
"array",
"and",
"returns",
"the",
"object",
".",
"The",
"contents",
"in",
"the",
"given",
"buffer",
"could",
"be",
"compressed",
"or",
"uncompressed",
"depending",
"on",
"the",
"gi... | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java#L144-L146 |
alkacon/opencms-core | src-modules/org/opencms/workplace/CmsFrameset.java | CmsFrameset.getPreferencesButton | public String getPreferencesButton() {
int buttonStyle = getSettings().getUserSettings().getWorkplaceButtonStyle();
if (!getCms().getRequestContext().getCurrentUser().isManaged()) {
return button(
"../commons/preferences.jsp",
"body",
"preferences.png",
Messages.GUI_BUTTON_PREFERENCES_0,
buttonStyle);
} else {
return button(null, null, "preferences_in.png", Messages.GUI_BUTTON_PREFERENCES_0, buttonStyle);
}
} | java | public String getPreferencesButton() {
int buttonStyle = getSettings().getUserSettings().getWorkplaceButtonStyle();
if (!getCms().getRequestContext().getCurrentUser().isManaged()) {
return button(
"../commons/preferences.jsp",
"body",
"preferences.png",
Messages.GUI_BUTTON_PREFERENCES_0,
buttonStyle);
} else {
return button(null, null, "preferences_in.png", Messages.GUI_BUTTON_PREFERENCES_0, buttonStyle);
}
} | [
"public",
"String",
"getPreferencesButton",
"(",
")",
"{",
"int",
"buttonStyle",
"=",
"getSettings",
"(",
")",
".",
"getUserSettings",
"(",
")",
".",
"getWorkplaceButtonStyle",
"(",
")",
";",
"if",
"(",
"!",
"getCms",
"(",
")",
".",
"getRequestContext",
"(",... | Returns the html for the "preferences" button depending on the current users permissions and
the default workplace settings.<p>
@return the html for the "preferences" button | [
"Returns",
"the",
"html",
"for",
"the",
"preferences",
"button",
"depending",
"on",
"the",
"current",
"users",
"permissions",
"and",
"the",
"default",
"workplace",
"settings",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsFrameset.java#L177-L190 |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.read2ByteIntegerRecordValue | private static int read2ByteIntegerRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Integer> value) throws IOException {
final short rawNumber = EndianNumbers.toLEShort(rawData[rawOffset], rawData[rawOffset + 1]);
try {
value.set(new Integer(rawNumber));
return 2;
} catch (NumberFormatException exception) {
throw new InvalidRawDataFormatException(nrecord, nfield, Short.toString(rawNumber));
}
} | java | private static int read2ByteIntegerRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Integer> value) throws IOException {
final short rawNumber = EndianNumbers.toLEShort(rawData[rawOffset], rawData[rawOffset + 1]);
try {
value.set(new Integer(rawNumber));
return 2;
} catch (NumberFormatException exception) {
throw new InvalidRawDataFormatException(nrecord, nfield, Short.toString(rawNumber));
}
} | [
"private",
"static",
"int",
"read2ByteIntegerRecordValue",
"(",
"DBaseFileField",
"field",
",",
"int",
"nrecord",
",",
"int",
"nfield",
",",
"byte",
"[",
"]",
"rawData",
",",
"int",
"rawOffset",
",",
"OutputParameter",
"<",
"Integer",
">",
"value",
")",
"throw... | Read a 2 BYTE INTEGER record value.
@param field is the current parsed field.
@param nrecord is the number of the record
@param nfield is the number of the field
@param rawData raw data
@param rawOffset is the index at which the data could be obtained
@param value will be set with the value extracted from the dBASE file
@return the count of consumed bytes
@throws IOException in case of error. | [
"Read",
"a",
"2",
"BYTE",
"INTEGER",
"record",
"value",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1177-L1186 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java | Util.shouldEnforceChunkingforHttpOneZero | public static boolean shouldEnforceChunkingforHttpOneZero(ChunkConfig chunkConfig, String httpVersion) {
return chunkConfig == ChunkConfig.ALWAYS && Float.valueOf(httpVersion) >= Constants.HTTP_1_0;
} | java | public static boolean shouldEnforceChunkingforHttpOneZero(ChunkConfig chunkConfig, String httpVersion) {
return chunkConfig == ChunkConfig.ALWAYS && Float.valueOf(httpVersion) >= Constants.HTTP_1_0;
} | [
"public",
"static",
"boolean",
"shouldEnforceChunkingforHttpOneZero",
"(",
"ChunkConfig",
"chunkConfig",
",",
"String",
"httpVersion",
")",
"{",
"return",
"chunkConfig",
"==",
"ChunkConfig",
".",
"ALWAYS",
"&&",
"Float",
".",
"valueOf",
"(",
"httpVersion",
")",
">="... | Returns whether to enforce chunking on HTTP 1.0 requests.
@param chunkConfig Chunking configuration.
@param httpVersion http version string.
@return true if chunking should be enforced else false. | [
"Returns",
"whether",
"to",
"enforce",
"chunking",
"on",
"HTTP",
"1",
".",
"0",
"requests",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L308-L310 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/SizeConfig.java | SizeConfig.imports | public static SizeConfig imports(Xml root)
{
Check.notNull(root);
final Xml node = root.getChild(NODE_SIZE);
final int width = node.readInteger(ATT_WIDTH);
final int height = node.readInteger(ATT_HEIGHT);
return new SizeConfig(width, height);
} | java | public static SizeConfig imports(Xml root)
{
Check.notNull(root);
final Xml node = root.getChild(NODE_SIZE);
final int width = node.readInteger(ATT_WIDTH);
final int height = node.readInteger(ATT_HEIGHT);
return new SizeConfig(width, height);
} | [
"public",
"static",
"SizeConfig",
"imports",
"(",
"Xml",
"root",
")",
"{",
"Check",
".",
"notNull",
"(",
"root",
")",
";",
"final",
"Xml",
"node",
"=",
"root",
".",
"getChild",
"(",
"NODE_SIZE",
")",
";",
"final",
"int",
"width",
"=",
"node",
".",
"r... | Import the size data from configurer.
@param root The root reference (must not be <code>null</code>).
@return The size data.
@throws LionEngineException If unable to read node. | [
"Import",
"the",
"size",
"data",
"from",
"configurer",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/SizeConfig.java#L63-L72 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/mult/MatrixMultProduct_DDRM.java | MatrixMultProduct_DDRM.inner_reorder_lower | public static void inner_reorder_lower(DMatrix1Row A , DMatrix1Row B )
{
final int cols = A.numCols;
B.reshape(cols,cols);
Arrays.fill(B.data,0);
for (int i = 0; i <cols; i++) {
for (int j = 0; j <=i; j++) {
B.data[i*cols+j] += A.data[i]*A.data[j];
}
for (int k = 1; k < A.numRows; k++) {
int indexRow = k*cols;
double valI = A.data[i+indexRow];
int indexB = i*cols;
for (int j = 0; j <= i; j++) {
B.data[indexB++] += valI*A.data[indexRow++];
}
}
}
} | java | public static void inner_reorder_lower(DMatrix1Row A , DMatrix1Row B )
{
final int cols = A.numCols;
B.reshape(cols,cols);
Arrays.fill(B.data,0);
for (int i = 0; i <cols; i++) {
for (int j = 0; j <=i; j++) {
B.data[i*cols+j] += A.data[i]*A.data[j];
}
for (int k = 1; k < A.numRows; k++) {
int indexRow = k*cols;
double valI = A.data[i+indexRow];
int indexB = i*cols;
for (int j = 0; j <= i; j++) {
B.data[indexB++] += valI*A.data[indexRow++];
}
}
}
} | [
"public",
"static",
"void",
"inner_reorder_lower",
"(",
"DMatrix1Row",
"A",
",",
"DMatrix1Row",
"B",
")",
"{",
"final",
"int",
"cols",
"=",
"A",
".",
"numCols",
";",
"B",
".",
"reshape",
"(",
"cols",
",",
"cols",
")",
";",
"Arrays",
".",
"fill",
"(",
... | Computes the inner product of A times A and stores the results in B. The inner product is symmetric and this
function will only store the lower triangle. The value of the upper triangular matrix is undefined.
<p>B = A<sup>T</sup>*A</sup>
@param A (Input) Matrix
@param B (Output) Storage for output. | [
"Computes",
"the",
"inner",
"product",
"of",
"A",
"times",
"A",
"and",
"stores",
"the",
"results",
"in",
"B",
".",
"The",
"inner",
"product",
"is",
"symmetric",
"and",
"this",
"function",
"will",
"only",
"store",
"the",
"lower",
"triangle",
".",
"The",
"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/mult/MatrixMultProduct_DDRM.java#L162-L182 |
protegeproject/jpaul | src/main/java/jpaul/DataStructs/NoCompTreeMap.java | NoCompTreeMap.put | public final V put(K key, V value) {
BinTreeNode<K,V> prev = null;
BinTreeNode<K,V> node = root;
int key_hash_code = key.hashCode();
while(node != null) {
prev = node;
if(key_hash_code < node.keyHashCode) {
node = node.left;
}
else {
if((key_hash_code > node.keyHashCode) || !node.key.equals(key)) {
node = node.right;
}
else {
cachedHashCode -= node.hashCode();
V temp = node.value;
node.value = value;
cachedHashCode += node.hashCode();
return temp;
}
}
}
size++;
BinTreeNode<K,V> new_node = new BinTreeNode<K,V>(key, value);
cachedHashCode += new_node.hashCode(); // invalidate the cached hash code
if(prev == null) {
root = new_node;
return null;
}
if(key_hash_code < prev.keyHashCode) {
prev.left = new_node;
}
else {
prev.right = new_node;
}
return null;
} | java | public final V put(K key, V value) {
BinTreeNode<K,V> prev = null;
BinTreeNode<K,V> node = root;
int key_hash_code = key.hashCode();
while(node != null) {
prev = node;
if(key_hash_code < node.keyHashCode) {
node = node.left;
}
else {
if((key_hash_code > node.keyHashCode) || !node.key.equals(key)) {
node = node.right;
}
else {
cachedHashCode -= node.hashCode();
V temp = node.value;
node.value = value;
cachedHashCode += node.hashCode();
return temp;
}
}
}
size++;
BinTreeNode<K,V> new_node = new BinTreeNode<K,V>(key, value);
cachedHashCode += new_node.hashCode(); // invalidate the cached hash code
if(prev == null) {
root = new_node;
return null;
}
if(key_hash_code < prev.keyHashCode) {
prev.left = new_node;
}
else {
prev.right = new_node;
}
return null;
} | [
"public",
"final",
"V",
"put",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"BinTreeNode",
"<",
"K",
",",
"V",
">",
"prev",
"=",
"null",
";",
"BinTreeNode",
"<",
"K",
",",
"V",
">",
"node",
"=",
"root",
";",
"int",
"key_hash_code",
"=",
"key",
... | Associates the specified value with the specified key in this map. | [
"Associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"in",
"this",
"map",
"."
] | train | https://github.com/protegeproject/jpaul/blob/db579ffb16faaa4b0c577ec82c246f7349427714/src/main/java/jpaul/DataStructs/NoCompTreeMap.java#L103-L145 |
sebastiangraf/treetank | interfacemodules/iscsi/src/main/java/org/treetank/iscsi/jscsi/HybridTreetankStorageModule.java | HybridTreetankStorageModule.createStorage | private void createStorage() throws TTException {
LOGGER.debug("Creating storage with " + mDataNumbers + " nodes containing " + BLOCKS_IN_DATA
+ " blocks with " + IStorageModule.VIRTUAL_BLOCK_SIZE + " bytes each.");
// Creating mirror
jCloudsStorageModule =
new JCloudsStorageModule(BLOCKS_IN_DATA * VIRTUAL_BLOCK_SIZE, Files.createTempDir());
IData data = this.mRtx.getCurrentData();
if (data != null) {
return;
}
for (int i = 0; i < mDataNumbers; i++) {
// Bootstrapping nodes containing clusterSize -many blocks/sectors.
LOGGER.debug("Bootstraping node " + i + "\tof " + (mDataNumbers - 1));
this.mRtx.bootstrap(new byte[HybridTreetankStorageModule.BYTES_IN_DATA]);
}
this.mRtx.commit();
} | java | private void createStorage() throws TTException {
LOGGER.debug("Creating storage with " + mDataNumbers + " nodes containing " + BLOCKS_IN_DATA
+ " blocks with " + IStorageModule.VIRTUAL_BLOCK_SIZE + " bytes each.");
// Creating mirror
jCloudsStorageModule =
new JCloudsStorageModule(BLOCKS_IN_DATA * VIRTUAL_BLOCK_SIZE, Files.createTempDir());
IData data = this.mRtx.getCurrentData();
if (data != null) {
return;
}
for (int i = 0; i < mDataNumbers; i++) {
// Bootstrapping nodes containing clusterSize -many blocks/sectors.
LOGGER.debug("Bootstraping node " + i + "\tof " + (mDataNumbers - 1));
this.mRtx.bootstrap(new byte[HybridTreetankStorageModule.BYTES_IN_DATA]);
}
this.mRtx.commit();
} | [
"private",
"void",
"createStorage",
"(",
")",
"throws",
"TTException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Creating storage with \"",
"+",
"mDataNumbers",
"+",
"\" nodes containing \"",
"+",
"BLOCKS_IN_DATA",
"+",
"\" blocks with \"",
"+",
"IStorageModule",
".",
"VIR... | Bootstrap a new device as a treetank storage using nodes to abstract the
device.
@throws IOException
is thrown if a node couldn't be created due to errors in the
backend. | [
"Bootstrap",
"a",
"new",
"device",
"as",
"a",
"treetank",
"storage",
"using",
"nodes",
"to",
"abstract",
"the",
"device",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/iscsi/src/main/java/org/treetank/iscsi/jscsi/HybridTreetankStorageModule.java#L141-L164 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/Script.java | Script.getScriptSigWithSignature | public Script getScriptSigWithSignature(Script scriptSig, byte[] sigBytes, int index) {
int sigsPrefixCount = 0;
int sigsSuffixCount = 0;
if (ScriptPattern.isP2SH(this)) {
sigsPrefixCount = 1; // OP_0 <sig>* <redeemScript>
sigsSuffixCount = 1;
} else if (ScriptPattern.isSentToMultisig(this)) {
sigsPrefixCount = 1; // OP_0 <sig>*
} else if (ScriptPattern.isP2PKH(this)) {
sigsSuffixCount = 1; // <sig> <pubkey>
}
return ScriptBuilder.updateScriptWithSignature(scriptSig, sigBytes, index, sigsPrefixCount, sigsSuffixCount);
} | java | public Script getScriptSigWithSignature(Script scriptSig, byte[] sigBytes, int index) {
int sigsPrefixCount = 0;
int sigsSuffixCount = 0;
if (ScriptPattern.isP2SH(this)) {
sigsPrefixCount = 1; // OP_0 <sig>* <redeemScript>
sigsSuffixCount = 1;
} else if (ScriptPattern.isSentToMultisig(this)) {
sigsPrefixCount = 1; // OP_0 <sig>*
} else if (ScriptPattern.isP2PKH(this)) {
sigsSuffixCount = 1; // <sig> <pubkey>
}
return ScriptBuilder.updateScriptWithSignature(scriptSig, sigBytes, index, sigsPrefixCount, sigsSuffixCount);
} | [
"public",
"Script",
"getScriptSigWithSignature",
"(",
"Script",
"scriptSig",
",",
"byte",
"[",
"]",
"sigBytes",
",",
"int",
"index",
")",
"{",
"int",
"sigsPrefixCount",
"=",
"0",
";",
"int",
"sigsSuffixCount",
"=",
"0",
";",
"if",
"(",
"ScriptPattern",
".",
... | Returns a copy of the given scriptSig with the signature inserted in the given position. | [
"Returns",
"a",
"copy",
"of",
"the",
"given",
"scriptSig",
"with",
"the",
"signature",
"inserted",
"in",
"the",
"given",
"position",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L419-L431 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.serviceName_updateInvalidOrMissingRio_POST | public void serviceName_updateInvalidOrMissingRio_POST(String serviceName, Boolean relaunchWithoutPortability, String rio) throws IOException {
String qPath = "/xdsl/{serviceName}/updateInvalidOrMissingRio";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "relaunchWithoutPortability", relaunchWithoutPortability);
addBody(o, "rio", rio);
exec(qPath, "POST", sb.toString(), o);
} | java | public void serviceName_updateInvalidOrMissingRio_POST(String serviceName, Boolean relaunchWithoutPortability, String rio) throws IOException {
String qPath = "/xdsl/{serviceName}/updateInvalidOrMissingRio";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "relaunchWithoutPortability", relaunchWithoutPortability);
addBody(o, "rio", rio);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"serviceName_updateInvalidOrMissingRio_POST",
"(",
"String",
"serviceName",
",",
"Boolean",
"relaunchWithoutPortability",
",",
"String",
"rio",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/{serviceName}/updateInvalidOrMissingRio\"",
";... | Update RIO, or disable portability, for order in error because of missing or invalid RIO
REST: POST /xdsl/{serviceName}/updateInvalidOrMissingRio
@param rio [required] RIO number for portability
@param relaunchWithoutPortability [required] Do not set RIO, and relaunch order without portability
@param serviceName [required] The internal name of your XDSL offer | [
"Update",
"RIO",
"or",
"disable",
"portability",
"for",
"order",
"in",
"error",
"because",
"of",
"missing",
"or",
"invalid",
"RIO"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L644-L651 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/ReusableMessageFactory.java | ReusableMessageFactory.newMessage | @Override
public Message newMessage(final String message, final Object... params) {
return getParameterized().set(message, params);
} | java | @Override
public Message newMessage(final String message, final Object... params) {
return getParameterized().set(message, params);
} | [
"@",
"Override",
"public",
"Message",
"newMessage",
"(",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"params",
")",
"{",
"return",
"getParameterized",
"(",
")",
".",
"set",
"(",
"message",
",",
"params",
")",
";",
"}"
] | Creates {@link ReusableParameterizedMessage} instances.
@param message The message pattern.
@param params The message parameters.
@return The Message.
@see MessageFactory#newMessage(String, Object...) | [
"Creates",
"{",
"@link",
"ReusableParameterizedMessage",
"}",
"instances",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/ReusableMessageFactory.java#L108-L111 |
mozilla/rhino | src/org/mozilla/javascript/ScriptRuntime.java | ScriptRuntime.escapeAttributeValue | public static String escapeAttributeValue(Object value, Context cx)
{
XMLLib xmlLib = currentXMLLib(cx);
return xmlLib.escapeAttributeValue(value);
} | java | public static String escapeAttributeValue(Object value, Context cx)
{
XMLLib xmlLib = currentXMLLib(cx);
return xmlLib.escapeAttributeValue(value);
} | [
"public",
"static",
"String",
"escapeAttributeValue",
"(",
"Object",
"value",
",",
"Context",
"cx",
")",
"{",
"XMLLib",
"xmlLib",
"=",
"currentXMLLib",
"(",
"cx",
")",
";",
"return",
"xmlLib",
".",
"escapeAttributeValue",
"(",
"value",
")",
";",
"}"
] | Escapes the reserved characters in a value of an attribute
@param value Unescaped text
@return The escaped text | [
"Escapes",
"the",
"reserved",
"characters",
"in",
"a",
"value",
"of",
"an",
"attribute"
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L4429-L4433 |
Clivern/Racter | src/main/java/com/clivern/racter/senders/templates/ReceiptTemplate.java | ReceiptTemplate.setElement | public void setElement(String title, String subtitle, String quantity, String price, String currency, String image_url)
{
HashMap<String, String> element = new HashMap<String, String>();
element.put("title", title);
element.put("subtitle", subtitle);
element.put("quantity", quantity);
element.put("price", price);
element.put("currency", currency);
element.put("image_url", image_url);
this.elements.add(element);
} | java | public void setElement(String title, String subtitle, String quantity, String price, String currency, String image_url)
{
HashMap<String, String> element = new HashMap<String, String>();
element.put("title", title);
element.put("subtitle", subtitle);
element.put("quantity", quantity);
element.put("price", price);
element.put("currency", currency);
element.put("image_url", image_url);
this.elements.add(element);
} | [
"public",
"void",
"setElement",
"(",
"String",
"title",
",",
"String",
"subtitle",
",",
"String",
"quantity",
",",
"String",
"price",
",",
"String",
"currency",
",",
"String",
"image_url",
")",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"element",
... | Set Element
@param title the receipt element title
@param subtitle the receipt element subtitle
@param quantity the receipt element quantity
@param price the receipt element price
@param currency the receipt element currency
@param image_url the receipt element image url | [
"Set",
"Element"
] | train | https://github.com/Clivern/Racter/blob/bbde02f0c2a8a80653ad6b1607376d8408acd71c/src/main/java/com/clivern/racter/senders/templates/ReceiptTemplate.java#L132-L142 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java | ExceptionUtils.indexOfType | @GwtIncompatible("incompatible method")
public static int indexOfType(final Throwable throwable, final Class<?> type, final int fromIndex) {
return indexOf(throwable, type, fromIndex, true);
} | java | @GwtIncompatible("incompatible method")
public static int indexOfType(final Throwable throwable, final Class<?> type, final int fromIndex) {
return indexOf(throwable, type, fromIndex, true);
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"int",
"indexOfType",
"(",
"final",
"Throwable",
"throwable",
",",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"int",
"fromIndex",
")",
"{",
"return",
"indexOf",
"(",
... | <p>Returns the (zero based) index of the first <code>Throwable</code>
that matches the specified type in the exception chain from
a specified index.
Subclasses of the specified class do match - see
{@link #indexOfThrowable(Throwable, Class)} for the opposite.</p>
<p>A <code>null</code> throwable returns <code>-1</code>.
A <code>null</code> type returns <code>-1</code>.
No match in the chain returns <code>-1</code>.
A negative start index is treated as zero.
A start index greater than the number of throwables returns <code>-1</code>.</p>
@param throwable the throwable to inspect, may be null
@param type the type to search for, subclasses match, null returns -1
@param fromIndex the (zero based) index of the starting position,
negative treated as zero, larger than chain size returns -1
@return the index into the throwable chain, -1 if no match or null input
@since 2.1 | [
"<p",
">",
"Returns",
"the",
"(",
"zero",
"based",
")",
"index",
"of",
"the",
"first",
"<code",
">",
"Throwable<",
"/",
"code",
">",
"that",
"matches",
"the",
"specified",
"type",
"in",
"the",
"exception",
"chain",
"from",
"a",
"specified",
"index",
".",... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java#L384-L387 |
xcesco/kripton | kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java | XMLSerializer.writeAttribute | public void writeAttribute(String attributeName, String value) throws IOException {
this.attribute(null, attributeName, value);
} | java | public void writeAttribute(String attributeName, String value) throws IOException {
this.attribute(null, attributeName, value);
} | [
"public",
"void",
"writeAttribute",
"(",
"String",
"attributeName",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"this",
".",
"attribute",
"(",
"null",
",",
"attributeName",
",",
"value",
")",
";",
"}"
] | Write attribute.
@param attributeName the attribute name
@param value the value
@throws IOException Signals that an I/O exception has occurred. | [
"Write",
"attribute",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java#L1515-L1518 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/values/JcString.java | JcString.trimRight | public JcString trimRight() {
JcString ret = new JcString(null, this,
new FunctionInstance(FUNCTION.String.RTRIM, 1));
QueryRecorder.recordInvocationConditional(this, "trimRight", ret);
return ret;
} | java | public JcString trimRight() {
JcString ret = new JcString(null, this,
new FunctionInstance(FUNCTION.String.RTRIM, 1));
QueryRecorder.recordInvocationConditional(this, "trimRight", ret);
return ret;
} | [
"public",
"JcString",
"trimRight",
"(",
")",
"{",
"JcString",
"ret",
"=",
"new",
"JcString",
"(",
"null",
",",
"this",
",",
"new",
"FunctionInstance",
"(",
"FUNCTION",
".",
"String",
".",
"RTRIM",
",",
"1",
")",
")",
";",
"QueryRecorder",
".",
"recordInv... | <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>return the result of removing trailing white spaces form a string, return a <b>JcString</b></i></div>
<br/> | [
"<div",
"color",
"=",
"red",
"style",
"=",
"font",
"-",
"size",
":",
"24px",
";",
"color",
":",
"red",
">",
"<b",
">",
"<i",
">",
"<u",
">",
"JCYPHER<",
"/",
"u",
">",
"<",
"/",
"i",
">",
"<",
"/",
"b",
">",
"<",
"/",
"div",
">",
"<div",
... | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcString.java#L106-L111 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/management/IntervalHistogram.java | IntervalHistogram.snapshot | public IntervalHistogram snapshot(boolean reset) {
if (reset) {
return new IntervalHistogram(bins, getAndResetHits());
}
return new IntervalHistogram(bins, getHits());
} | java | public IntervalHistogram snapshot(boolean reset) {
if (reset) {
return new IntervalHistogram(bins, getAndResetHits());
}
return new IntervalHistogram(bins, getHits());
} | [
"public",
"IntervalHistogram",
"snapshot",
"(",
"boolean",
"reset",
")",
"{",
"if",
"(",
"reset",
")",
"{",
"return",
"new",
"IntervalHistogram",
"(",
"bins",
",",
"getAndResetHits",
"(",
")",
")",
";",
"}",
"return",
"new",
"IntervalHistogram",
"(",
"bins",... | Clones this histogram and zeroizes out hits afterwards if the 'reset' is
true.
@param reset
zero out hits
@return clone of this histogram's state | [
"Clones",
"this",
"histogram",
"and",
"zeroizes",
"out",
"hits",
"afterwards",
"if",
"the",
"reset",
"is",
"true",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/management/IntervalHistogram.java#L197-L202 |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.fromBytes | public static UTF8String fromBytes(byte[] bytes, int offset, int numBytes) {
if (bytes != null) {
return new UTF8String(bytes, BYTE_ARRAY_OFFSET + offset, numBytes);
} else {
return null;
}
} | java | public static UTF8String fromBytes(byte[] bytes, int offset, int numBytes) {
if (bytes != null) {
return new UTF8String(bytes, BYTE_ARRAY_OFFSET + offset, numBytes);
} else {
return null;
}
} | [
"public",
"static",
"UTF8String",
"fromBytes",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"numBytes",
")",
"{",
"if",
"(",
"bytes",
"!=",
"null",
")",
"{",
"return",
"new",
"UTF8String",
"(",
"bytes",
",",
"BYTE_ARRAY_OFFSET",
"+",... | Creates an UTF8String from byte array, which should be encoded in UTF-8.
Note: `bytes` will be hold by returned UTF8String. | [
"Creates",
"an",
"UTF8String",
"from",
"byte",
"array",
"which",
"should",
"be",
"encoded",
"in",
"UTF",
"-",
"8",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L123-L129 |
davidmoten/grumpy | grumpy-ogc/src/main/java/com/github/davidmoten/grumpy/wms/ImageCache.java | ImageCache.put | public synchronized void put(WmsRequest request, byte[] image) {
synchronized (this) {
String key = getKey(request);
// make sure it's the last on the list of keys so won't be dropped
// from cache
keys.remove(key);
keys.add(key);
if (keys.size() > maxSize)
remove(keys.get(0));
if (maxSize > 0 && layers.containsAll(request.getLayers())) {
cache.put(key, image);
log.info("cached image with key=" + key);
}
}
} | java | public synchronized void put(WmsRequest request, byte[] image) {
synchronized (this) {
String key = getKey(request);
// make sure it's the last on the list of keys so won't be dropped
// from cache
keys.remove(key);
keys.add(key);
if (keys.size() > maxSize)
remove(keys.get(0));
if (maxSize > 0 && layers.containsAll(request.getLayers())) {
cache.put(key, image);
log.info("cached image with key=" + key);
}
}
} | [
"public",
"synchronized",
"void",
"put",
"(",
"WmsRequest",
"request",
",",
"byte",
"[",
"]",
"image",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"String",
"key",
"=",
"getKey",
"(",
"request",
")",
";",
"// make sure it's the last on the list of keys so w... | Sets the cached image for the request.
@param request
the WMS http request
@param image
bytes of the image | [
"Sets",
"the",
"cached",
"image",
"for",
"the",
"request",
"."
] | train | https://github.com/davidmoten/grumpy/blob/f2d03e6b9771f15425fb3f76314837efc08c1233/grumpy-ogc/src/main/java/com/github/davidmoten/grumpy/wms/ImageCache.java#L151-L165 |
js-lib-com/template.xhtml | src/main/java/js/template/xhtml/TextOperator.java | TextOperator.doExec | @Override
protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws IOException, TemplateException {
if (!propertyPath.equals(".") && ConverterRegistry.hasType(scope.getClass())) {
throw new TemplateException("Operand is property path but scope is not an object.");
}
if (element.hasChildren()) {
throw new TemplateException("Illegal TEXT operator on element with children.");
}
Format format = (Format) arguments[0];
String text = content.getString(scope, propertyPath, format);
if (text != null) {
serializer.writeTextContent(text);
}
return null;
} | java | @Override
protected Object doExec(Element element, Object scope, String propertyPath, Object... arguments) throws IOException, TemplateException {
if (!propertyPath.equals(".") && ConverterRegistry.hasType(scope.getClass())) {
throw new TemplateException("Operand is property path but scope is not an object.");
}
if (element.hasChildren()) {
throw new TemplateException("Illegal TEXT operator on element with children.");
}
Format format = (Format) arguments[0];
String text = content.getString(scope, propertyPath, format);
if (text != null) {
serializer.writeTextContent(text);
}
return null;
} | [
"@",
"Override",
"protected",
"Object",
"doExec",
"(",
"Element",
"element",
",",
"Object",
"scope",
",",
"String",
"propertyPath",
",",
"Object",
"...",
"arguments",
")",
"throws",
"IOException",
",",
"TemplateException",
"{",
"if",
"(",
"!",
"propertyPath",
... | Execute TEXT operator. Uses property path to extract content value, convert it to string and set element text content.
Note that this operator operates on element without children. Failing to obey this constraint rise templates exception;
anyway, validation tool catches this condition.
@param element context element,
@param scope scope object,
@param propertyPath property path,
@param arguments optional arguments, {@link Format} instance in this case.
@return always returns null to signal full processing.
@throws IOException if underlying writer fails to write.
@throws TemplateException if context element has children or requested content value is undefined. | [
"Execute",
"TEXT",
"operator",
".",
"Uses",
"property",
"path",
"to",
"extract",
"content",
"value",
"convert",
"it",
"to",
"string",
"and",
"set",
"element",
"text",
"content",
".",
"Note",
"that",
"this",
"operator",
"operates",
"on",
"element",
"without",
... | train | https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/TextOperator.java#L55-L69 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java | JDBCStorageConnection.propertyData | private PropertyData propertyData(QPath parentPath, ResultSet item) throws RepositoryException, SQLException,
IOException
{
String cid = item.getString(COLUMN_ID);
String cname = item.getString(COLUMN_NAME);
int cversion = item.getInt(COLUMN_VERSION);
String cpid = item.getString(COLUMN_PARENTID);
int cptype = item.getInt(COLUMN_PTYPE);
boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
try
{
InternalQName qname = InternalQName.parse(cname);
QPath qpath = QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, qname);
PersistedPropertyData pdata =
new PersistedPropertyData(getIdentifier(cid), qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued,
new ArrayList<ValueData>(), new SimplePersistedSize(0));
return pdata;
}
catch (InvalidItemStateException e)
{
throw new InvalidItemStateException("FATAL: Can't build property path for name " + cname + " id: "
+ getIdentifier(cid) + ". " + e);
}
catch (IllegalNameException e)
{
throw new RepositoryException(e);
}
} | java | private PropertyData propertyData(QPath parentPath, ResultSet item) throws RepositoryException, SQLException,
IOException
{
String cid = item.getString(COLUMN_ID);
String cname = item.getString(COLUMN_NAME);
int cversion = item.getInt(COLUMN_VERSION);
String cpid = item.getString(COLUMN_PARENTID);
int cptype = item.getInt(COLUMN_PTYPE);
boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
try
{
InternalQName qname = InternalQName.parse(cname);
QPath qpath = QPath.makeChildPath(parentPath == null ? traverseQPath(cpid) : parentPath, qname);
PersistedPropertyData pdata =
new PersistedPropertyData(getIdentifier(cid), qpath, getIdentifier(cpid), cversion, cptype, cpmultivalued,
new ArrayList<ValueData>(), new SimplePersistedSize(0));
return pdata;
}
catch (InvalidItemStateException e)
{
throw new InvalidItemStateException("FATAL: Can't build property path for name " + cname + " id: "
+ getIdentifier(cid) + ". " + e);
}
catch (IllegalNameException e)
{
throw new RepositoryException(e);
}
} | [
"private",
"PropertyData",
"propertyData",
"(",
"QPath",
"parentPath",
",",
"ResultSet",
"item",
")",
"throws",
"RepositoryException",
",",
"SQLException",
",",
"IOException",
"{",
"String",
"cid",
"=",
"item",
".",
"getString",
"(",
"COLUMN_ID",
")",
";",
"Stri... | Read property data without value data. For listChildPropertiesData(NodeData).
@param parentPath
- parent path
@param item
database - ResultSet with Item record(s)
@return PropertyData instance
@throws RepositoryException
Repository error
@throws SQLException
database error
@throws IOException
I/O error | [
"Read",
"property",
"data",
"without",
"value",
"data",
".",
"For",
"listChildPropertiesData",
"(",
"NodeData",
")",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java#L2030-L2061 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/Respoke.java | Respoke.postTaskError | public static void postTaskError(final TaskCompletionListener completionListener, final String errorMessage) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != completionListener) {
completionListener.onError(errorMessage);
}
}
});
} | java | public static void postTaskError(final TaskCompletionListener completionListener, final String errorMessage) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != completionListener) {
completionListener.onError(errorMessage);
}
}
});
} | [
"public",
"static",
"void",
"postTaskError",
"(",
"final",
"TaskCompletionListener",
"completionListener",
",",
"final",
"String",
"errorMessage",
")",
"{",
"new",
"Handler",
"(",
"Looper",
".",
"getMainLooper",
"(",
")",
")",
".",
"post",
"(",
"new",
"Runnable"... | A helper function to post an error message to a TaskCompletionListener on the UI thread
@param completionListener The TaskCompletionListener to notify
@param errorMessage The error message to post | [
"A",
"helper",
"function",
"to",
"post",
"an",
"error",
"message",
"to",
"a",
"TaskCompletionListener",
"on",
"the",
"UI",
"thread"
] | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/Respoke.java#L81-L90 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listMultiRolePoolInstanceMetricDefinitionsAsync | public Observable<Page<ResourceMetricDefinitionInner>> listMultiRolePoolInstanceMetricDefinitionsAsync(final String resourceGroupName, final String name, final String instance) {
return listMultiRolePoolInstanceMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name, instance)
.map(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Page<ResourceMetricDefinitionInner>>() {
@Override
public Page<ResourceMetricDefinitionInner> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ResourceMetricDefinitionInner>> listMultiRolePoolInstanceMetricDefinitionsAsync(final String resourceGroupName, final String name, final String instance) {
return listMultiRolePoolInstanceMetricDefinitionsWithServiceResponseAsync(resourceGroupName, name, instance)
.map(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Page<ResourceMetricDefinitionInner>>() {
@Override
public Page<ResourceMetricDefinitionInner> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ResourceMetricDefinitionInner",
">",
">",
"listMultiRolePoolInstanceMetricDefinitionsAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"String",
"instance",
")",
"{",
"return",
... | Get metric definitions for a specific instance of a multi-role pool of an App Service Environment.
Get metric definitions for a specific instance of a multi-role pool of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param instance Name of the instance in the multi-role pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ResourceMetricDefinitionInner> object | [
"Get",
"metric",
"definitions",
"for",
"a",
"specific",
"instance",
"of",
"a",
"multi",
"-",
"role",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"metric",
"definitions",
"for",
"a",
"specific",
"instance",
"of",
"a",
"multi",
"-",
"rol... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L2601-L2609 |
Azure/azure-sdk-for-java | redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/FirewallRulesInner.java | FirewallRulesInner.createOrUpdate | public RedisFirewallRuleInner createOrUpdate(String resourceGroupName, String cacheName, String ruleName, RedisFirewallRuleCreateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, cacheName, ruleName, parameters).toBlocking().single().body();
} | java | public RedisFirewallRuleInner createOrUpdate(String resourceGroupName, String cacheName, String ruleName, RedisFirewallRuleCreateParameters parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, cacheName, ruleName, parameters).toBlocking().single().body();
} | [
"public",
"RedisFirewallRuleInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"cacheName",
",",
"String",
"ruleName",
",",
"RedisFirewallRuleCreateParameters",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourc... | Create or update a redis cache firewall rule.
@param resourceGroupName The name of the resource group.
@param cacheName The name of the Redis cache.
@param ruleName The name of the firewall rule.
@param parameters Parameters supplied to the create or update redis firewall rule operation.
@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 RedisFirewallRuleInner object if successful. | [
"Create",
"or",
"update",
"a",
"redis",
"cache",
"firewall",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/FirewallRulesInner.java#L222-L224 |
azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java | HadoopJobUtils.javaOptStringFromHadoopConfiguration | public static String javaOptStringFromHadoopConfiguration(Configuration conf, String key) {
String value = conf.get(key);
if (value == null) {
throw new RuntimeException(
String.format("Cannot find property [%s], in Hadoop configuration: [%s]",
key, value));
}
return String.format("-D%s=%s", key, value);
} | java | public static String javaOptStringFromHadoopConfiguration(Configuration conf, String key) {
String value = conf.get(key);
if (value == null) {
throw new RuntimeException(
String.format("Cannot find property [%s], in Hadoop configuration: [%s]",
key, value));
}
return String.format("-D%s=%s", key, value);
} | [
"public",
"static",
"String",
"javaOptStringFromHadoopConfiguration",
"(",
"Configuration",
"conf",
",",
"String",
"key",
")",
"{",
"String",
"value",
"=",
"conf",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new"... | <pre>
constructions a javaOpts string based on the Props, and the key given, will return
String.format("-D%s=%s", key, value);
</pre>
@return will return String.format("-D%s=%s", key, value). Throws RuntimeException if props not
present | [
"<pre",
">",
"constructions",
"a",
"javaOpts",
"string",
"based",
"on",
"the",
"Props",
"and",
"the",
"key",
"given",
"will",
"return",
"String",
".",
"format",
"(",
"-",
"D%s",
"=",
"%s",
"key",
"value",
")",
";",
"<",
"/",
"pre",
">"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/HadoopJobUtils.java#L564-L572 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java | AnnotationProxyMaker.generateValue | private Object generateValue(MethodSymbol meth, Attribute attr) {
ValueVisitor vv = new ValueVisitor(meth);
return vv.getValue(attr);
} | java | private Object generateValue(MethodSymbol meth, Attribute attr) {
ValueVisitor vv = new ValueVisitor(meth);
return vv.getValue(attr);
} | [
"private",
"Object",
"generateValue",
"(",
"MethodSymbol",
"meth",
",",
"Attribute",
"attr",
")",
"{",
"ValueVisitor",
"vv",
"=",
"new",
"ValueVisitor",
"(",
"meth",
")",
";",
"return",
"vv",
".",
"getValue",
"(",
"attr",
")",
";",
"}"
] | Converts an element value to its "dynamic proxy return form".
Returns an exception proxy on some errors, but may return null if
a useful exception cannot or should not be generated at this point. | [
"Converts",
"an",
"element",
"value",
"to",
"its",
"dynamic",
"proxy",
"return",
"form",
".",
"Returns",
"an",
"exception",
"proxy",
"on",
"some",
"errors",
"but",
"may",
"return",
"null",
"if",
"a",
"useful",
"exception",
"cannot",
"or",
"should",
"not",
... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java#L143-L146 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/NetworkUtils.java | NetworkUtils.setLearningRate | public static void setLearningRate(ComputationGraph net, String layerName, ISchedule lrSchedule) {
setLearningRate(net, layerName, Double.NaN, lrSchedule, true);
} | java | public static void setLearningRate(ComputationGraph net, String layerName, ISchedule lrSchedule) {
setLearningRate(net, layerName, Double.NaN, lrSchedule, true);
} | [
"public",
"static",
"void",
"setLearningRate",
"(",
"ComputationGraph",
"net",
",",
"String",
"layerName",
",",
"ISchedule",
"lrSchedule",
")",
"{",
"setLearningRate",
"(",
"net",
",",
"layerName",
",",
"Double",
".",
"NaN",
",",
"lrSchedule",
",",
"true",
")"... | Set the learning rate schedule for a single layer in the network to the specified value.<br>
Note also that {@link #setLearningRate(ComputationGraph, ISchedule)} should also be used in preference, when all
layers need to be set to a new LR schedule.<br>
This schedule will replace any/all existing schedules, and also any fixed learning rate values.<br>
Note also that the iteration/epoch counts will <i>not</i> be reset. Use {@link ComputationGraphConfiguration#setIterationCount(int)}
and {@link ComputationGraphConfiguration#setEpochCount(int)} if this is required
@param layerName Name of the layer to set the LR schedule for
@param lrSchedule New learning rate for a single layer | [
"Set",
"the",
"learning",
"rate",
"schedule",
"for",
"a",
"single",
"layer",
"in",
"the",
"network",
"to",
"the",
"specified",
"value",
".",
"<br",
">",
"Note",
"also",
"that",
"{",
"@link",
"#setLearningRate",
"(",
"ComputationGraph",
"ISchedule",
")",
"}",... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/NetworkUtils.java#L313-L315 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/IoTControlManager.java | IoTControlManager.setUsingIq | public IoTSetResponse setUsingIq(FullJid jid, Collection<? extends SetData> data) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
IoTSetRequest request = new IoTSetRequest(data);
request.setTo(jid);
IoTSetResponse response = connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
} | java | public IoTSetResponse setUsingIq(FullJid jid, Collection<? extends SetData> data) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
IoTSetRequest request = new IoTSetRequest(data);
request.setTo(jid);
IoTSetResponse response = connection().createStanzaCollectorAndSend(request).nextResultOrThrow();
return response;
} | [
"public",
"IoTSetResponse",
"setUsingIq",
"(",
"FullJid",
"jid",
",",
"Collection",
"<",
"?",
"extends",
"SetData",
">",
"data",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"IoTSetReq... | Control a thing by sending a collection of {@link SetData} instructions.
@param jid the thing to control.
@param data a collection of {@link SetData} instructions.
@return the {@link IoTSetResponse} if successful.
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException | [
"Control",
"a",
"thing",
"by",
"sending",
"a",
"collection",
"of",
"{",
"@link",
"SetData",
"}",
"instructions",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/IoTControlManager.java#L128-L133 |
UrielCh/ovh-java-sdk | ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java | ApiOvhRouter.serviceName_privateLink_peerServiceName_request_GET | public OvhPrivateLinkRequest serviceName_privateLink_peerServiceName_request_GET(String serviceName, String peerServiceName) throws IOException {
String qPath = "/router/{serviceName}/privateLink/{peerServiceName}/request";
StringBuilder sb = path(qPath, serviceName, peerServiceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrivateLinkRequest.class);
} | java | public OvhPrivateLinkRequest serviceName_privateLink_peerServiceName_request_GET(String serviceName, String peerServiceName) throws IOException {
String qPath = "/router/{serviceName}/privateLink/{peerServiceName}/request";
StringBuilder sb = path(qPath, serviceName, peerServiceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrivateLinkRequest.class);
} | [
"public",
"OvhPrivateLinkRequest",
"serviceName_privateLink_peerServiceName_request_GET",
"(",
"String",
"serviceName",
",",
"String",
"peerServiceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/router/{serviceName}/privateLink/{peerServiceName}/request\"",
";... | Get this object properties
REST: GET /router/{serviceName}/privateLink/{peerServiceName}/request
@param serviceName [required] The internal name of your Router offer
@param peerServiceName [required] Service name of the other side of this link | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java#L375-L380 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java | ProcessContext.createRandomContext | public static ProcessContext createRandomContext(Set<String> activities, int originatorCount, List<String> roles) {
Validate.notNull(activities);
Validate.noNullElements(activities);
Validate.notNegative(originatorCount);
Validate.notNull(roles);
Validate.noNullElements(roles);
ProcessContext newContext = new ProcessContext("Random Context");
newContext.setActivities(activities);
List<String> cOriginators = createSubjectList(originatorCount);
newContext.setSubjects(new HashSet<>(cOriginators));
//Create a new access control model.
newContext.setACModel(RBACModel.createRandomModel(cOriginators, activities, roles));
return newContext;
} | java | public static ProcessContext createRandomContext(Set<String> activities, int originatorCount, List<String> roles) {
Validate.notNull(activities);
Validate.noNullElements(activities);
Validate.notNegative(originatorCount);
Validate.notNull(roles);
Validate.noNullElements(roles);
ProcessContext newContext = new ProcessContext("Random Context");
newContext.setActivities(activities);
List<String> cOriginators = createSubjectList(originatorCount);
newContext.setSubjects(new HashSet<>(cOriginators));
//Create a new access control model.
newContext.setACModel(RBACModel.createRandomModel(cOriginators, activities, roles));
return newContext;
} | [
"public",
"static",
"ProcessContext",
"createRandomContext",
"(",
"Set",
"<",
"String",
">",
"activities",
",",
"int",
"originatorCount",
",",
"List",
"<",
"String",
">",
"roles",
")",
"{",
"Validate",
".",
"notNull",
"(",
"activities",
")",
";",
"Validate",
... | Creates a new context using an RBAC access control model.<br>
Users and permissions to execute transactions are randomly assigned
to the given roles.<br>
Each person is assigned to exactly one role.
@param activities The process activities.
@param originatorCount The number of desired originators.
@param roles The roles to use.
@return A new randomly generated Context. | [
"Creates",
"a",
"new",
"context",
"using",
"an",
"RBAC",
"access",
"control",
"model",
".",
"<br",
">",
"Users",
"and",
"permissions",
"to",
"execute",
"transactions",
"are",
"randomly",
"assigned",
"to",
"the",
"given",
"roles",
".",
"<br",
">",
"Each",
"... | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L961-L975 |
dkmfbk/knowledgestore | ks-core/src/main/java/eu/fbk/knowledgestore/data/Representation.java | Representation.getInputStream | public InputStream getInputStream() {
if (this.data instanceof InputStream) {
return (InputStream) this.data;
} else {
final Reader reader = (Reader) this.data;
return new ReaderInputStream(reader, getCharset());
}
} | java | public InputStream getInputStream() {
if (this.data instanceof InputStream) {
return (InputStream) this.data;
} else {
final Reader reader = (Reader) this.data;
return new ReaderInputStream(reader, getCharset());
}
} | [
"public",
"InputStream",
"getInputStream",
"(",
")",
"{",
"if",
"(",
"this",
".",
"data",
"instanceof",
"InputStream",
")",
"{",
"return",
"(",
"InputStream",
")",
"this",
".",
"data",
";",
"}",
"else",
"{",
"final",
"Reader",
"reader",
"=",
"(",
"Reader... | Returns an {@code InputStream} over the binary data of this representation object.
Conversion from character to byte data, if required, is performed according to the charset
specified by the MIME type metadata property ({@link NIE#MIME_TYPE}).
@return an {@code InputStream} over the binary content of this representation | [
"Returns",
"an",
"{",
"@code",
"InputStream",
"}",
"over",
"the",
"binary",
"data",
"of",
"this",
"representation",
"object",
".",
"Conversion",
"from",
"character",
"to",
"byte",
"data",
"if",
"required",
"is",
"performed",
"according",
"to",
"the",
"charset"... | train | https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-core/src/main/java/eu/fbk/knowledgestore/data/Representation.java#L349-L356 |
apereo/cas | support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/profile/DefaultOAuth20UserProfileDataCreator.java | DefaultOAuth20UserProfileDataCreator.getAccessTokenAuthenticationPrincipal | protected Principal getAccessTokenAuthenticationPrincipal(final AccessToken accessToken, final J2EContext context, final RegisteredService registeredService) {
val currentPrincipal = accessToken.getAuthentication().getPrincipal();
LOGGER.debug("Preparing user profile response based on CAS principal [{}]", currentPrincipal);
val principal = this.scopeToAttributesFilter.filter(accessToken.getService(), currentPrincipal, registeredService, context, accessToken);
LOGGER.debug("Created CAS principal [{}] based on requested/authorized scopes", principal);
return principal;
} | java | protected Principal getAccessTokenAuthenticationPrincipal(final AccessToken accessToken, final J2EContext context, final RegisteredService registeredService) {
val currentPrincipal = accessToken.getAuthentication().getPrincipal();
LOGGER.debug("Preparing user profile response based on CAS principal [{}]", currentPrincipal);
val principal = this.scopeToAttributesFilter.filter(accessToken.getService(), currentPrincipal, registeredService, context, accessToken);
LOGGER.debug("Created CAS principal [{}] based on requested/authorized scopes", principal);
return principal;
} | [
"protected",
"Principal",
"getAccessTokenAuthenticationPrincipal",
"(",
"final",
"AccessToken",
"accessToken",
",",
"final",
"J2EContext",
"context",
",",
"final",
"RegisteredService",
"registeredService",
")",
"{",
"val",
"currentPrincipal",
"=",
"accessToken",
".",
"get... | Gets access token authentication principal.
@param accessToken the access token
@param context the context
@param registeredService the registered service
@return the access token authentication principal | [
"Gets",
"access",
"token",
"authentication",
"principal",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/profile/DefaultOAuth20UserProfileDataCreator.java#L68-L76 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/app/ActivityManagerUtils.java | ActivityManagerUtils.getPackageNameFromPid | public static String getPackageNameFromPid(Context context, int pid) {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> processes = am.getRunningAppProcesses();
for (RunningAppProcessInfo info : processes) {
if (info.pid == pid) {
String[] packages = info.pkgList;
if (packages.length > 0) {
return packages[0];
}
break;
}
}
return null;
} | java | public static String getPackageNameFromPid(Context context, int pid) {
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> processes = am.getRunningAppProcesses();
for (RunningAppProcessInfo info : processes) {
if (info.pid == pid) {
String[] packages = info.pkgList;
if (packages.length > 0) {
return packages[0];
}
break;
}
}
return null;
} | [
"public",
"static",
"String",
"getPackageNameFromPid",
"(",
"Context",
"context",
",",
"int",
"pid",
")",
"{",
"ActivityManager",
"am",
"=",
"(",
"ActivityManager",
")",
"context",
".",
"getSystemService",
"(",
"Context",
".",
"ACTIVITY_SERVICE",
")",
";",
"List... | Get package name of the process id.
@param context the context.
@param pid the process id.
@return the package name for the process id. {@code null} if no process found. | [
"Get",
"package",
"name",
"of",
"the",
"process",
"id",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/ActivityManagerUtils.java#L105-L118 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java | SDValidation.validateNumerical | protected static void validateNumerical(String opName, SDVariable v) {
if (v == null)
return;
if (v.dataType() == DataType.BOOL || v.dataType() == DataType.UTF8)
throw new IllegalStateException("Cannot apply operation \"" + opName + "\" to variable \"" + v.getVarName() + "\" with non-numerical data type " + v.dataType());
} | java | protected static void validateNumerical(String opName, SDVariable v) {
if (v == null)
return;
if (v.dataType() == DataType.BOOL || v.dataType() == DataType.UTF8)
throw new IllegalStateException("Cannot apply operation \"" + opName + "\" to variable \"" + v.getVarName() + "\" with non-numerical data type " + v.dataType());
} | [
"protected",
"static",
"void",
"validateNumerical",
"(",
"String",
"opName",
",",
"SDVariable",
"v",
")",
"{",
"if",
"(",
"v",
"==",
"null",
")",
"return",
";",
"if",
"(",
"v",
".",
"dataType",
"(",
")",
"==",
"DataType",
".",
"BOOL",
"||",
"v",
".",... | Validate that the operation is being applied on a numerical SDVariable (not boolean or utf8).
Some operations (such as sum, norm2, add(Number) etc don't make sense when applied to boolean/utf8 arrays
@param opName Operation name to print in the exception
@param v Variable to perform operation on | [
"Validate",
"that",
"the",
"operation",
"is",
"being",
"applied",
"on",
"a",
"numerical",
"SDVariable",
"(",
"not",
"boolean",
"or",
"utf8",
")",
".",
"Some",
"operations",
"(",
"such",
"as",
"sum",
"norm2",
"add",
"(",
"Number",
")",
"etc",
"don",
"t",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDValidation.java#L20-L25 |
weld/core | impl/src/main/java/org/jboss/weld/interceptor/proxy/AbstractInvocationContext.java | AbstractInvocationContext.isWideningPrimitive | private static boolean isWideningPrimitive(Class<?> argumentClass, Class<?> targetClass) {
return WIDENING_TABLE.containsKey(argumentClass) && WIDENING_TABLE.get(argumentClass).contains(targetClass);
} | java | private static boolean isWideningPrimitive(Class<?> argumentClass, Class<?> targetClass) {
return WIDENING_TABLE.containsKey(argumentClass) && WIDENING_TABLE.get(argumentClass).contains(targetClass);
} | [
"private",
"static",
"boolean",
"isWideningPrimitive",
"(",
"Class",
"<",
"?",
">",
"argumentClass",
",",
"Class",
"<",
"?",
">",
"targetClass",
")",
"{",
"return",
"WIDENING_TABLE",
".",
"containsKey",
"(",
"argumentClass",
")",
"&&",
"WIDENING_TABLE",
".",
"... | Checks that the targetClass is widening the argument class
@param argumentClass
@param targetClass
@return | [
"Checks",
"that",
"the",
"targetClass",
"is",
"widening",
"the",
"argument",
"class"
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/interceptor/proxy/AbstractInvocationContext.java#L114-L116 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java | ConfigUtils.getDouble | public static double getDouble(Config config, String path, double def) {
if (config.hasPath(path)) {
return config.getDouble(path);
}
return def;
} | java | public static double getDouble(Config config, String path, double def) {
if (config.hasPath(path)) {
return config.getDouble(path);
}
return def;
} | [
"public",
"static",
"double",
"getDouble",
"(",
"Config",
"config",
",",
"String",
"path",
",",
"double",
"def",
")",
"{",
"if",
"(",
"config",
".",
"hasPath",
"(",
"path",
")",
")",
"{",
"return",
"config",
".",
"getDouble",
"(",
"path",
")",
";",
"... | Return double value at <code>path</code> if <code>config</code> has path. If not return <code>def</code>
@param config in which the path may be present
@param path key to look for in the config object
@return double value at <code>path</code> if <code>config</code> has path. If not return <code>def</code> | [
"Return",
"double",
"value",
"at",
"<code",
">",
"path<",
"/",
"code",
">",
"if",
"<code",
">",
"config<",
"/",
"code",
">",
"has",
"path",
".",
"If",
"not",
"return",
"<code",
">",
"def<",
"/",
"code",
">"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java#L378-L383 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/android/AuthActivity.java | AuthActivity.makeIntent | public static Intent makeIntent(Context context, String appKey, String desiredUid, String[] alreadyAuthedUids,
String sessionId, String webHost, String apiType) {
if (appKey == null) throw new IllegalArgumentException("'appKey' can't be null");
setAuthParams(appKey, desiredUid, alreadyAuthedUids, sessionId, webHost, apiType);
return new Intent(context, AuthActivity.class);
} | java | public static Intent makeIntent(Context context, String appKey, String desiredUid, String[] alreadyAuthedUids,
String sessionId, String webHost, String apiType) {
if (appKey == null) throw new IllegalArgumentException("'appKey' can't be null");
setAuthParams(appKey, desiredUid, alreadyAuthedUids, sessionId, webHost, apiType);
return new Intent(context, AuthActivity.class);
} | [
"public",
"static",
"Intent",
"makeIntent",
"(",
"Context",
"context",
",",
"String",
"appKey",
",",
"String",
"desiredUid",
",",
"String",
"[",
"]",
"alreadyAuthedUids",
",",
"String",
"sessionId",
",",
"String",
"webHost",
",",
"String",
"apiType",
")",
"{",... | Create an intent which can be sent to this activity to start OAuth 2 authentication.
@param context the source context
@param appKey the consumer key for the app
@param desiredUid Encourage user to authenticate account defined by this uid.
(note that user still can authenticate other accounts).
May be null if no uid desired.
@param alreadyAuthedUids Array of any other uids currently authenticated with this app.
May be null if no uids previously authenticated.
Authentication screen will encourage user to not authorize these
user accounts. (note that user may still authorize the accounts).
@param sessionId The SESSION_ID Extra on an OpenWith intent. null if dAuth
is being launched outside of OpenWith flow
@param webHost the host to use for web authentication, or null for the default
@param apiType an identifier for the type of API being supported, or null for
the default
@return a newly created intent. | [
"Create",
"an",
"intent",
"which",
"can",
"be",
"sent",
"to",
"this",
"activity",
"to",
"start",
"OAuth",
"2",
"authentication",
"."
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/android/AuthActivity.java#L255-L260 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java | GridBagLayoutBuilder.appendLabeledField | public GridBagLayoutBuilder appendLabeledField(String propertyName, final JComponent field,
LabelOrientation labelOrientation) {
return appendLabeledField(propertyName, field, labelOrientation, 1);
} | java | public GridBagLayoutBuilder appendLabeledField(String propertyName, final JComponent field,
LabelOrientation labelOrientation) {
return appendLabeledField(propertyName, field, labelOrientation, 1);
} | [
"public",
"GridBagLayoutBuilder",
"appendLabeledField",
"(",
"String",
"propertyName",
",",
"final",
"JComponent",
"field",
",",
"LabelOrientation",
"labelOrientation",
")",
"{",
"return",
"appendLabeledField",
"(",
"propertyName",
",",
"field",
",",
"labelOrientation",
... | Appends a label and field to the end of the current line.
<p />
The label will be to the left of the field, and be right-justified.
<br />
The field will "grow" horizontally as space allows.
<p />
@param propertyName the name of the property to create the controls for
@return "this" to make it easier to string together append calls | [
"Appends",
"a",
"label",
"and",
"field",
"to",
"the",
"end",
"of",
"the",
"current",
"line",
".",
"<p",
"/",
">"
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java#L267-L270 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspActionElement.java | CmsJspActionElement.getContent | public String getContent(String target, String element, Locale locale) {
I_CmsResourceLoader loader;
CmsFile file;
target = toAbsolute(target);
try {
file = getCmsObject().readFile(target);
loader = OpenCms.getResourceManager().getLoader(file);
} catch (ClassCastException e) {
// no loader implementation found
return CmsMessages.formatUnknownKey(e.getMessage());
} catch (CmsException e) {
// file might not exist or no read permissions
return CmsMessages.formatUnknownKey(e.getMessage());
}
try {
byte[] result = loader.dump(getCmsObject(), file, element, locale, getRequest(), getResponse());
return new String(result, getRequestContext().getEncoding());
} catch (UnsupportedEncodingException uee) {
// encoding unsupported
return CmsMessages.formatUnknownKey(uee.getMessage());
} catch (Throwable t) {
// any other exception, check for hidden root cause first
Throwable cause = CmsFlexController.getThrowable(getRequest());
if (cause == null) {
cause = t;
}
handleException(cause);
return CmsMessages.formatUnknownKey(cause.getMessage());
}
} | java | public String getContent(String target, String element, Locale locale) {
I_CmsResourceLoader loader;
CmsFile file;
target = toAbsolute(target);
try {
file = getCmsObject().readFile(target);
loader = OpenCms.getResourceManager().getLoader(file);
} catch (ClassCastException e) {
// no loader implementation found
return CmsMessages.formatUnknownKey(e.getMessage());
} catch (CmsException e) {
// file might not exist or no read permissions
return CmsMessages.formatUnknownKey(e.getMessage());
}
try {
byte[] result = loader.dump(getCmsObject(), file, element, locale, getRequest(), getResponse());
return new String(result, getRequestContext().getEncoding());
} catch (UnsupportedEncodingException uee) {
// encoding unsupported
return CmsMessages.formatUnknownKey(uee.getMessage());
} catch (Throwable t) {
// any other exception, check for hidden root cause first
Throwable cause = CmsFlexController.getThrowable(getRequest());
if (cause == null) {
cause = t;
}
handleException(cause);
return CmsMessages.formatUnknownKey(cause.getMessage());
}
} | [
"public",
"String",
"getContent",
"(",
"String",
"target",
",",
"String",
"element",
",",
"Locale",
"locale",
")",
"{",
"I_CmsResourceLoader",
"loader",
";",
"CmsFile",
"file",
";",
"target",
"=",
"toAbsolute",
"(",
"target",
")",
";",
"try",
"{",
"file",
... | Returns the processed output of an element within an OpenCms resource.<p>
@param target the target to process
@param element name of the element
@param locale locale of the element
@return the processed output | [
"Returns",
"the",
"processed",
"output",
"of",
"an",
"element",
"within",
"an",
"OpenCms",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspActionElement.java#L230-L262 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseButton.java | HBaseButton.printInputControl | public void printInputControl(PrintWriter out, String strFieldDesc, String strFieldName, String strSize, String strMaxSize, String strValue, String strControlType, int iHtmlAttributes)
{
strControlType = "checkbox";
String strDefault = "";
if (strValue.length() > 0) if (strValue.charAt(0) == 'Y')
strDefault = " checked";
out.println("<td><input type=\"" + strControlType + "\" name=\"" + strFieldName + "\" value=\"Yes\"" + strDefault + "/></td>");
} | java | public void printInputControl(PrintWriter out, String strFieldDesc, String strFieldName, String strSize, String strMaxSize, String strValue, String strControlType, int iHtmlAttributes)
{
strControlType = "checkbox";
String strDefault = "";
if (strValue.length() > 0) if (strValue.charAt(0) == 'Y')
strDefault = " checked";
out.println("<td><input type=\"" + strControlType + "\" name=\"" + strFieldName + "\" value=\"Yes\"" + strDefault + "/></td>");
} | [
"public",
"void",
"printInputControl",
"(",
"PrintWriter",
"out",
",",
"String",
"strFieldDesc",
",",
"String",
"strFieldName",
",",
"String",
"strSize",
",",
"String",
"strMaxSize",
",",
"String",
"strValue",
",",
"String",
"strControlType",
",",
"int",
"iHtmlAtt... | display this field in html input format.
@param out The html out stream.
@param strFieldDesc The field description.
@param strFieldName The field name.
@param strSize The control size.
@param strMaxSize The string max size.
@param strValue The default value.
@param strControlType The control type.
@param iHtmlAttribures The attributes. | [
"display",
"this",
"field",
"in",
"html",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseButton.java#L68-L75 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java | X509CRLEntryImpl.getRevocationReason | public static CRLReason getRevocationReason(X509CRLEntry crlEntry) {
try {
byte[] ext = crlEntry.getExtensionValue("2.5.29.21");
if (ext == null) {
return null;
}
DerValue val = new DerValue(ext);
byte[] data = val.getOctetString();
CRLReasonCodeExtension rcExt =
new CRLReasonCodeExtension(Boolean.FALSE, data);
return rcExt.getReasonCode();
} catch (IOException ioe) {
return null;
}
} | java | public static CRLReason getRevocationReason(X509CRLEntry crlEntry) {
try {
byte[] ext = crlEntry.getExtensionValue("2.5.29.21");
if (ext == null) {
return null;
}
DerValue val = new DerValue(ext);
byte[] data = val.getOctetString();
CRLReasonCodeExtension rcExt =
new CRLReasonCodeExtension(Boolean.FALSE, data);
return rcExt.getReasonCode();
} catch (IOException ioe) {
return null;
}
} | [
"public",
"static",
"CRLReason",
"getRevocationReason",
"(",
"X509CRLEntry",
"crlEntry",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"ext",
"=",
"crlEntry",
".",
"getExtensionValue",
"(",
"\"2.5.29.21\"",
")",
";",
"if",
"(",
"ext",
"==",
"null",
")",
"{",
"re... | This static method is the default implementation of the
getRevocationReason method in X509CRLEntry. | [
"This",
"static",
"method",
"is",
"the",
"default",
"implementation",
"of",
"the",
"getRevocationReason",
"method",
"in",
"X509CRLEntry",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java#L254-L269 |
apache/groovy | src/main/groovy/groovy/lang/GString.java | GString.invokeMethod | @Override
public Object invokeMethod(String name, Object args) {
try {
return super.invokeMethod(name, args);
} catch (MissingMethodException e) {
// lets try invoke the method on the real String
return InvokerHelper.invokeMethod(toString(), name, args);
}
} | java | @Override
public Object invokeMethod(String name, Object args) {
try {
return super.invokeMethod(name, args);
} catch (MissingMethodException e) {
// lets try invoke the method on the real String
return InvokerHelper.invokeMethod(toString(), name, args);
}
} | [
"@",
"Override",
"public",
"Object",
"invokeMethod",
"(",
"String",
"name",
",",
"Object",
"args",
")",
"{",
"try",
"{",
"return",
"super",
".",
"invokeMethod",
"(",
"name",
",",
"args",
")",
";",
"}",
"catch",
"(",
"MissingMethodException",
"e",
")",
"{... | Overloaded to implement duck typing for Strings
so that any method that can't be evaluated on this
object will be forwarded to the toString() object instead. | [
"Overloaded",
"to",
"implement",
"duck",
"typing",
"for",
"Strings",
"so",
"that",
"any",
"method",
"that",
"can",
"t",
"be",
"evaluated",
"on",
"this",
"object",
"will",
"be",
"forwarded",
"to",
"the",
"toString",
"()",
"object",
"instead",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GString.java#L83-L91 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeTraversal.java | NodeTraversal.traverseFunctionOutOfBand | public void traverseFunctionOutOfBand(Node node, AbstractScope<?, ?> scope) {
checkNotNull(scope);
checkState(node.isFunction(), node);
checkNotNull(scope.getRootNode());
initTraversal(node);
curNode = node.getParent();
pushScope(scope, true /* quietly */);
traverseBranch(node, curNode);
popScope(true /* quietly */);
} | java | public void traverseFunctionOutOfBand(Node node, AbstractScope<?, ?> scope) {
checkNotNull(scope);
checkState(node.isFunction(), node);
checkNotNull(scope.getRootNode());
initTraversal(node);
curNode = node.getParent();
pushScope(scope, true /* quietly */);
traverseBranch(node, curNode);
popScope(true /* quietly */);
} | [
"public",
"void",
"traverseFunctionOutOfBand",
"(",
"Node",
"node",
",",
"AbstractScope",
"<",
"?",
",",
"?",
">",
"scope",
")",
"{",
"checkNotNull",
"(",
"scope",
")",
";",
"checkState",
"(",
"node",
".",
"isFunction",
"(",
")",
",",
"node",
")",
";",
... | Traverse a function out-of-band of normal traversal.
@param node The function node.
@param scope The scope the function is contained in. Does not fire enter/exit
callback events for this scope. | [
"Traverse",
"a",
"function",
"out",
"-",
"of",
"-",
"band",
"of",
"normal",
"traversal",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeTraversal.java#L661-L670 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/objectManager/PersistableImpl.java | PersistableImpl.addToStore | public void addToStore(Transaction tran, ObjectStore store) throws PersistenceException, ObjectManagerException, SevereMessageStoreException
{
addToStore(tran, store, this);
} | java | public void addToStore(Transaction tran, ObjectStore store) throws PersistenceException, ObjectManagerException, SevereMessageStoreException
{
addToStore(tran, store, this);
} | [
"public",
"void",
"addToStore",
"(",
"Transaction",
"tran",
",",
"ObjectStore",
"store",
")",
"throws",
"PersistenceException",
",",
"ObjectManagerException",
",",
"SevereMessageStoreException",
"{",
"addToStore",
"(",
"tran",
",",
"store",
",",
"this",
")",
";",
... | Add this Persistable and it's raw data managed object
to the provided transaction.
@param tran The transaction under which the add of this Persistable to
the ObjectStore takes place.
@param store The ObjectStore to add this Persistable to.
@exception ObjectManagerException
@exception PersistenceException
@exception SevereMessageStoreException | [
"Add",
"this",
"Persistable",
"and",
"it",
"s",
"raw",
"data",
"managed",
"object",
"to",
"the",
"provided",
"transaction",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/objectManager/PersistableImpl.java#L316-L319 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.createSitemapSubEntry | public void createSitemapSubEntry(final CmsClientSitemapEntry parent, final String sitemapFolderType) {
CmsSitemapTreeItem item = CmsSitemapTreeItem.getItemById(parent.getId());
AsyncCallback<CmsClientSitemapEntry> callback = new AsyncCallback<CmsClientSitemapEntry>() {
public void onFailure(Throwable caught) {
// do nothing
}
public void onSuccess(CmsClientSitemapEntry result) {
makeNewEntry(parent, new I_CmsSimpleCallback<CmsClientSitemapEntry>() {
public void execute(CmsClientSitemapEntry newEntry) {
newEntry.setResourceTypeName(sitemapFolderType);
createSitemapSubEntry(newEntry, parent.getId(), sitemapFolderType);
}
});
}
};
if (item.getLoadState().equals(LoadState.UNLOADED)) {
getChildren(parent.getId(), true, callback);
} else {
callback.onSuccess(parent);
}
} | java | public void createSitemapSubEntry(final CmsClientSitemapEntry parent, final String sitemapFolderType) {
CmsSitemapTreeItem item = CmsSitemapTreeItem.getItemById(parent.getId());
AsyncCallback<CmsClientSitemapEntry> callback = new AsyncCallback<CmsClientSitemapEntry>() {
public void onFailure(Throwable caught) {
// do nothing
}
public void onSuccess(CmsClientSitemapEntry result) {
makeNewEntry(parent, new I_CmsSimpleCallback<CmsClientSitemapEntry>() {
public void execute(CmsClientSitemapEntry newEntry) {
newEntry.setResourceTypeName(sitemapFolderType);
createSitemapSubEntry(newEntry, parent.getId(), sitemapFolderType);
}
});
}
};
if (item.getLoadState().equals(LoadState.UNLOADED)) {
getChildren(parent.getId(), true, callback);
} else {
callback.onSuccess(parent);
}
} | [
"public",
"void",
"createSitemapSubEntry",
"(",
"final",
"CmsClientSitemapEntry",
"parent",
",",
"final",
"String",
"sitemapFolderType",
")",
"{",
"CmsSitemapTreeItem",
"item",
"=",
"CmsSitemapTreeItem",
".",
"getItemById",
"(",
"parent",
".",
"getId",
"(",
")",
")"... | Creates a new sub-entry which is a subsitemap.<p>
@param parent the parent entry
@param sitemapFolderType the sitemap folder type | [
"Creates",
"a",
"new",
"sub",
"-",
"entry",
"which",
"is",
"a",
"subsitemap",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L608-L635 |
LAW-Unimi/BUbiNG | src/it/unimi/di/law/bubing/util/Util.java | Util.toByteArrayList | public static ByteArrayList toByteArrayList(final String s, final ByteArrayList list) {
list.clear();
list.size(s.length());
final byte[] array = list.elements();
for (int i = list.size(); i-- != 0;) {
assert s.charAt(i) < (char)0x80 : s.charAt(i);
array[i] = (byte)(s.charAt(i) & 0x7F);
}
return list;
} | java | public static ByteArrayList toByteArrayList(final String s, final ByteArrayList list) {
list.clear();
list.size(s.length());
final byte[] array = list.elements();
for (int i = list.size(); i-- != 0;) {
assert s.charAt(i) < (char)0x80 : s.charAt(i);
array[i] = (byte)(s.charAt(i) & 0x7F);
}
return list;
} | [
"public",
"static",
"ByteArrayList",
"toByteArrayList",
"(",
"final",
"String",
"s",
",",
"final",
"ByteArrayList",
"list",
")",
"{",
"list",
".",
"clear",
"(",
")",
";",
"list",
".",
"size",
"(",
"s",
".",
"length",
"(",
")",
")",
";",
"final",
"byte"... | Writes an ASCII string in a {@link ByteArrayList}.
@param s an ASCII string.
@param list a byte list that will contain the byte representation of {@code s}.
@return {@code list}.
@throws AssertionError if assertions are enabled and some character of {@code s} is not ASCII. | [
"Writes",
"an",
"ASCII",
"string",
"in",
"a",
"{",
"@link",
"ByteArrayList",
"}",
"."
] | train | https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/Util.java#L230-L239 |
sd4324530/fastweixin | src/main/java/com/github/sd4324530/fastweixin/api/MaterialAPI.java | MaterialAPI.uploadMaterialFile | public UploadMaterialResponse uploadMaterialFile(File file, String title, String introduction){
UploadMaterialResponse response;
String url = "http://api.weixin.qq.com/cgi-bin/material/add_material?access_token=#";
BaseResponse r;
if(StrUtil.isBlank(title)) {
r = executePost(url, null, file);
}else{
final Map<String, String> param = new HashMap<String, String>();
param.put("title", title);
param.put("introduction", introduction);
r = executePost(url, JSONUtil.toJson(param), file);
}
String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
response = JSONUtil.toBean(resultJson, UploadMaterialResponse.class);
return response;
} | java | public UploadMaterialResponse uploadMaterialFile(File file, String title, String introduction){
UploadMaterialResponse response;
String url = "http://api.weixin.qq.com/cgi-bin/material/add_material?access_token=#";
BaseResponse r;
if(StrUtil.isBlank(title)) {
r = executePost(url, null, file);
}else{
final Map<String, String> param = new HashMap<String, String>();
param.put("title", title);
param.put("introduction", introduction);
r = executePost(url, JSONUtil.toJson(param), file);
}
String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
response = JSONUtil.toBean(resultJson, UploadMaterialResponse.class);
return response;
} | [
"public",
"UploadMaterialResponse",
"uploadMaterialFile",
"(",
"File",
"file",
",",
"String",
"title",
",",
"String",
"introduction",
")",
"{",
"UploadMaterialResponse",
"response",
";",
"String",
"url",
"=",
"\"http://api.weixin.qq.com/cgi-bin/material/add_material?access_to... | 上传永久视频素材文件。
@param file 素材文件
@param title 素材标题
@param introduction 素材描述信息
@return 上传结果 | [
"上传永久视频素材文件。"
] | train | https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/api/MaterialAPI.java#L66-L81 |
elki-project/elki | elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/intrinsic/ISOS.java | ISOS.transformScores | public static DoubleMinMax transformScores(WritableDoubleDataStore scores, DBIDs ids, double logPerp, double phi) {
DoubleMinMax minmax = new DoubleMinMax();
double adj = (1 - phi) / phi;
for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
double or = FastMath.exp(-scores.doubleValue(it) * logPerp) * adj;
double s = 1. / (1 + or);
scores.putDouble(it, s);
minmax.put(s);
}
return minmax;
} | java | public static DoubleMinMax transformScores(WritableDoubleDataStore scores, DBIDs ids, double logPerp, double phi) {
DoubleMinMax minmax = new DoubleMinMax();
double adj = (1 - phi) / phi;
for(DBIDIter it = ids.iter(); it.valid(); it.advance()) {
double or = FastMath.exp(-scores.doubleValue(it) * logPerp) * adj;
double s = 1. / (1 + or);
scores.putDouble(it, s);
minmax.put(s);
}
return minmax;
} | [
"public",
"static",
"DoubleMinMax",
"transformScores",
"(",
"WritableDoubleDataStore",
"scores",
",",
"DBIDs",
"ids",
",",
"double",
"logPerp",
",",
"double",
"phi",
")",
"{",
"DoubleMinMax",
"minmax",
"=",
"new",
"DoubleMinMax",
"(",
")",
";",
"double",
"adj",
... | Transform scores
@param scores Scores to transform
@param ids DBIDs to process
@param logPerp log perplexity
@param phi Expected outlier rate
@return Minimum and maximum scores | [
"Transform",
"scores"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/intrinsic/ISOS.java#L239-L249 |
Jasig/uPortal | uPortal-security/uPortal-security-authn/src/main/java/org/apereo/portal/security/provider/SimpleLdapSecurityContext.java | SimpleLdapSecurityContext.getAttributeValue | private String getAttributeValue(Attributes attrs, int attribute) throws NamingException {
NamingEnumeration values = null;
String aValue = "";
if (!isAttribute(attribute)) return aValue;
Attribute attrib = attrs.get(attributes[attribute]);
if (attrib != null) {
for (values = attrib.getAll(); values.hasMoreElements(); ) {
aValue = (String) values.nextElement();
break; // take only the first attribute value
}
}
return aValue;
} | java | private String getAttributeValue(Attributes attrs, int attribute) throws NamingException {
NamingEnumeration values = null;
String aValue = "";
if (!isAttribute(attribute)) return aValue;
Attribute attrib = attrs.get(attributes[attribute]);
if (attrib != null) {
for (values = attrib.getAll(); values.hasMoreElements(); ) {
aValue = (String) values.nextElement();
break; // take only the first attribute value
}
}
return aValue;
} | [
"private",
"String",
"getAttributeValue",
"(",
"Attributes",
"attrs",
",",
"int",
"attribute",
")",
"throws",
"NamingException",
"{",
"NamingEnumeration",
"values",
"=",
"null",
";",
"String",
"aValue",
"=",
"\"\"",
";",
"if",
"(",
"!",
"isAttribute",
"(",
"at... | Return a single value of an attribute from possibly multiple values, grossly ignoring
anything else. If there are no values, then return an empty string.
@param attrs LDAP query results
@param attribute LDAP attribute we are interested in
@return a single value of the attribute | [
"Return",
"a",
"single",
"value",
"of",
"an",
"attribute",
"from",
"possibly",
"multiple",
"values",
"grossly",
"ignoring",
"anything",
"else",
".",
"If",
"there",
"are",
"no",
"values",
"then",
"return",
"an",
"empty",
"string",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-authn/src/main/java/org/apereo/portal/security/provider/SimpleLdapSecurityContext.java#L203-L215 |
jeremylong/DependencyCheck | ant/src/main/java/org/owasp/dependencycheck/taskdefs/Purge.java | Purge.populateSettings | protected void populateSettings() throws BuildException {
settings = new Settings();
try (InputStream taskProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE)) {
settings.mergeProperties(taskProperties);
} catch (IOException ex) {
final String msg = "Unable to load the dependency-check ant task.properties file.";
if (this.failOnError) {
throw new BuildException(msg, ex);
}
log(msg, ex, Project.MSG_WARN);
}
if (dataDirectory != null) {
settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory);
} else {
final File jarPath = new File(Purge.class.getProtectionDomain().getCodeSource().getLocation().getPath());
final File base = jarPath.getParentFile();
final String sub = settings.getString(Settings.KEYS.DATA_DIRECTORY);
final File dataDir = new File(base, sub);
settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath());
}
} | java | protected void populateSettings() throws BuildException {
settings = new Settings();
try (InputStream taskProperties = this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE)) {
settings.mergeProperties(taskProperties);
} catch (IOException ex) {
final String msg = "Unable to load the dependency-check ant task.properties file.";
if (this.failOnError) {
throw new BuildException(msg, ex);
}
log(msg, ex, Project.MSG_WARN);
}
if (dataDirectory != null) {
settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDirectory);
} else {
final File jarPath = new File(Purge.class.getProtectionDomain().getCodeSource().getLocation().getPath());
final File base = jarPath.getParentFile();
final String sub = settings.getString(Settings.KEYS.DATA_DIRECTORY);
final File dataDir = new File(base, sub);
settings.setString(Settings.KEYS.DATA_DIRECTORY, dataDir.getAbsolutePath());
}
} | [
"protected",
"void",
"populateSettings",
"(",
")",
"throws",
"BuildException",
"{",
"settings",
"=",
"new",
"Settings",
"(",
")",
";",
"try",
"(",
"InputStream",
"taskProperties",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
... | Takes the properties supplied and updates the dependency-check settings.
Additionally, this sets the system properties required to change the
proxy server, port, and connection timeout.
@throws BuildException thrown if the properties file cannot be read. | [
"Takes",
"the",
"properties",
"supplied",
"and",
"updates",
"the",
"dependency",
"-",
"check",
"settings",
".",
"Additionally",
"this",
"sets",
"the",
"system",
"properties",
"required",
"to",
"change",
"the",
"proxy",
"server",
"port",
"and",
"connection",
"tim... | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/ant/src/main/java/org/owasp/dependencycheck/taskdefs/Purge.java#L153-L173 |
VoltDB/voltdb | src/frontend/org/voltdb/sysprocs/saverestore/SnapshotUtil.java | SnapshotUtil.retrieveSnapshotFiles | public static void retrieveSnapshotFiles(
File directory,
Map<String, Snapshot> namedSnapshotMap,
FileFilter filter,
boolean validate,
SnapshotPathType stype,
VoltLogger logger) {
NamedSnapshots namedSnapshots = new NamedSnapshots(namedSnapshotMap, stype);
retrieveSnapshotFilesInternal(directory, namedSnapshots, filter, validate, stype, logger, 0);
} | java | public static void retrieveSnapshotFiles(
File directory,
Map<String, Snapshot> namedSnapshotMap,
FileFilter filter,
boolean validate,
SnapshotPathType stype,
VoltLogger logger) {
NamedSnapshots namedSnapshots = new NamedSnapshots(namedSnapshotMap, stype);
retrieveSnapshotFilesInternal(directory, namedSnapshots, filter, validate, stype, logger, 0);
} | [
"public",
"static",
"void",
"retrieveSnapshotFiles",
"(",
"File",
"directory",
",",
"Map",
"<",
"String",
",",
"Snapshot",
">",
"namedSnapshotMap",
",",
"FileFilter",
"filter",
",",
"boolean",
"validate",
",",
"SnapshotPathType",
"stype",
",",
"VoltLogger",
"logge... | Spider the provided directory applying the provided FileFilter. Optionally validate snapshot
files. Return a summary of partition counts, partition information, files, digests etc.
that can be used to determine if a valid restore plan exists.
@param directory
@param snapshots
@param filter
@param validate | [
"Spider",
"the",
"provided",
"directory",
"applying",
"the",
"provided",
"FileFilter",
".",
"Optionally",
"validate",
"snapshot",
"files",
".",
"Return",
"a",
"summary",
"of",
"partition",
"counts",
"partition",
"information",
"files",
"digests",
"etc",
".",
"that... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/saverestore/SnapshotUtil.java#L799-L809 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ServicesApi.java | ServicesApi.setGitLabCI | public void setGitLabCI(Object projectIdOrPath, String token, String projectCIUrl) throws GitLabApiException {
final Form formData = new Form();
formData.param("token", token);
formData.param("project_url", projectCIUrl);
put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "services", "gitlab-ci");
} | java | public void setGitLabCI(Object projectIdOrPath, String token, String projectCIUrl) throws GitLabApiException {
final Form formData = new Form();
formData.param("token", token);
formData.param("project_url", projectCIUrl);
put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "services", "gitlab-ci");
} | [
"public",
"void",
"setGitLabCI",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"token",
",",
"String",
"projectCIUrl",
")",
"throws",
"GitLabApiException",
"{",
"final",
"Form",
"formData",
"=",
"new",
"Form",
"(",
")",
";",
"formData",
".",
"param",
"(",
... | Activates the gitlab-ci service for a project.
<pre><code>GitLab Endpoint: PUT /projects/:id/services/gitlab-ci</code></pre>
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param token for authentication
@param projectCIUrl URL of the GitLab-CI project
@throws GitLabApiException if any exception occurs
@deprecated No longer supported | [
"Activates",
"the",
"gitlab",
"-",
"ci",
"service",
"for",
"a",
"project",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ServicesApi.java#L33-L38 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/util/chunkcollision/ChunkCollision.java | ChunkCollision.getRayTraceResult | public RayTraceResult getRayTraceResult(World world, Pair<Point, Point> infos, RayTraceResult result, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock)
{
if (infos == null)
return result;
RayTraceResult tmp = new RaytraceChunk(world, infos.getLeft(), infos.getRight()).trace();
result = Raytrace.getClosestHit(Type.BLOCK, infos.getLeft(), result, tmp);
return returnLastUncollidableBlock || result == null || result.typeOfHit == Type.BLOCK ? result : null;
} | java | public RayTraceResult getRayTraceResult(World world, Pair<Point, Point> infos, RayTraceResult result, boolean stopOnLiquid, boolean ignoreBlockWithoutBoundingBox, boolean returnLastUncollidableBlock)
{
if (infos == null)
return result;
RayTraceResult tmp = new RaytraceChunk(world, infos.getLeft(), infos.getRight()).trace();
result = Raytrace.getClosestHit(Type.BLOCK, infos.getLeft(), result, tmp);
return returnLastUncollidableBlock || result == null || result.typeOfHit == Type.BLOCK ? result : null;
} | [
"public",
"RayTraceResult",
"getRayTraceResult",
"(",
"World",
"world",
",",
"Pair",
"<",
"Point",
",",
"Point",
">",
"infos",
",",
"RayTraceResult",
"result",
",",
"boolean",
"stopOnLiquid",
",",
"boolean",
"ignoreBlockWithoutBoundingBox",
",",
"boolean",
"returnLa... | Gets the ray trace result.<br>
Called via ASM from {@link World#rayTraceBlocks(Vec3d, Vec3d, boolean, boolean, boolean)} before each return.
@param world the world
@param result the mop
@return the ray trace result | [
"Gets",
"the",
"ray",
"trace",
"result",
".",
"<br",
">",
"Called",
"via",
"ASM",
"from",
"{",
"@link",
"World#rayTraceBlocks",
"(",
"Vec3d",
"Vec3d",
"boolean",
"boolean",
"boolean",
")",
"}",
"before",
"each",
"return",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunkcollision/ChunkCollision.java#L165-L173 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageUtil.java | ImageUtil.createScaledDownImageCacheFile | public static boolean createScaledDownImageCacheFile(String sourcePath, String cachedFileName) {
File localFile = new File(cachedFileName);
// Retrieve image orientation
int imageOrientation = 0;
try {
ExifInterface exif = new ExifInterface(sourcePath);
imageOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
} catch (IOException e) {
}
// Copy the file contents over.
CountingOutputStream cos = null;
try {
cos = new CountingOutputStream(new BufferedOutputStream(new FileOutputStream(localFile)));
System.gc();
Bitmap smaller = ImageUtil.createScaledBitmapFromLocalImageSource(sourcePath, MAX_SENT_IMAGE_EDGE, MAX_SENT_IMAGE_EDGE, null, imageOrientation);
// TODO: Is JPEG what we want here?
smaller.compress(Bitmap.CompressFormat.JPEG, 95, cos);
cos.flush();
ApptentiveLog.v(UTIL, "Bitmap saved, size = " + (cos.getBytesWritten() / 1024) + "k");
smaller.recycle();
System.gc();
} catch (FileNotFoundException e) {
ApptentiveLog.e(UTIL, e, "File not found while storing image.");
logException(e);
return false;
} catch (Exception e) {
ApptentiveLog.a(UTIL, e, "Error storing image.");
logException(e);
return false;
} finally {
Util.ensureClosed(cos);
}
return true;
} | java | public static boolean createScaledDownImageCacheFile(String sourcePath, String cachedFileName) {
File localFile = new File(cachedFileName);
// Retrieve image orientation
int imageOrientation = 0;
try {
ExifInterface exif = new ExifInterface(sourcePath);
imageOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
} catch (IOException e) {
}
// Copy the file contents over.
CountingOutputStream cos = null;
try {
cos = new CountingOutputStream(new BufferedOutputStream(new FileOutputStream(localFile)));
System.gc();
Bitmap smaller = ImageUtil.createScaledBitmapFromLocalImageSource(sourcePath, MAX_SENT_IMAGE_EDGE, MAX_SENT_IMAGE_EDGE, null, imageOrientation);
// TODO: Is JPEG what we want here?
smaller.compress(Bitmap.CompressFormat.JPEG, 95, cos);
cos.flush();
ApptentiveLog.v(UTIL, "Bitmap saved, size = " + (cos.getBytesWritten() / 1024) + "k");
smaller.recycle();
System.gc();
} catch (FileNotFoundException e) {
ApptentiveLog.e(UTIL, e, "File not found while storing image.");
logException(e);
return false;
} catch (Exception e) {
ApptentiveLog.a(UTIL, e, "Error storing image.");
logException(e);
return false;
} finally {
Util.ensureClosed(cos);
}
return true;
} | [
"public",
"static",
"boolean",
"createScaledDownImageCacheFile",
"(",
"String",
"sourcePath",
",",
"String",
"cachedFileName",
")",
"{",
"File",
"localFile",
"=",
"new",
"File",
"(",
"cachedFileName",
")",
";",
"// Retrieve image orientation",
"int",
"imageOrientation",... | This method creates a cached version of the original image, and compresses it in the process so it doesn't fill up the disk. Therefore, do not use
it to store an exact copy of the file in question.
@param sourcePath can be full file path or content uri string
@param cachedFileName file name of the cache to be created (with full path)
@return true if cache file is created successfully | [
"This",
"method",
"creates",
"a",
"cached",
"version",
"of",
"the",
"original",
"image",
"and",
"compresses",
"it",
"in",
"the",
"process",
"so",
"it",
"doesn",
"t",
"fill",
"up",
"the",
"disk",
".",
"Therefore",
"do",
"not",
"use",
"it",
"to",
"store",
... | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/util/image/ImageUtil.java#L270-L307 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/scope/session/SessionDatasource.java | SessionDatasource.getInstance | public static Session getInstance(String datasourceName, PageContext pc, Log log) throws PageException {
Struct _sct = _loadData(pc, datasourceName, "session", SCOPE_SESSION, log, false);
if (_sct == null) _sct = new StructImpl();
return new SessionDatasource(pc, datasourceName, _sct);
} | java | public static Session getInstance(String datasourceName, PageContext pc, Log log) throws PageException {
Struct _sct = _loadData(pc, datasourceName, "session", SCOPE_SESSION, log, false);
if (_sct == null) _sct = new StructImpl();
return new SessionDatasource(pc, datasourceName, _sct);
} | [
"public",
"static",
"Session",
"getInstance",
"(",
"String",
"datasourceName",
",",
"PageContext",
"pc",
",",
"Log",
"log",
")",
"throws",
"PageException",
"{",
"Struct",
"_sct",
"=",
"_loadData",
"(",
"pc",
",",
"datasourceName",
",",
"\"session\"",
",",
"SCO... | load an new instance of the client datasource scope
@param datasourceName
@param appName
@param pc
@param checkExpires
@return client datasource scope
@throws PageException | [
"load",
"an",
"new",
"instance",
"of",
"the",
"client",
"datasource",
"scope"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/session/SessionDatasource.java#L55-L61 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java | StringUtils.checkNonEmpty | public static String checkNonEmpty(String s, String msg) {
checkArgument(!s.isEmpty(), msg);
return s;
} | java | public static String checkNonEmpty(String s, String msg) {
checkArgument(!s.isEmpty(), msg);
return s;
} | [
"public",
"static",
"String",
"checkNonEmpty",
"(",
"String",
"s",
",",
"String",
"msg",
")",
"{",
"checkArgument",
"(",
"!",
"s",
".",
"isEmpty",
"(",
")",
",",
"msg",
")",
";",
"return",
"s",
";",
"}"
] | Checks that the supplied string is non-empty. If it is empty, an {@link
java.lang.IllegalArgumentException} is thrown with the supplied message. | [
"Checks",
"that",
"the",
"supplied",
"string",
"is",
"non",
"-",
"empty",
".",
"If",
"it",
"is",
"empty",
"an",
"{"
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java#L574-L577 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/img/ImageExtensions.java | ImageExtensions.createPdf | public static void createPdf(final OutputStream result, final List<BufferedImage> images)
throws DocumentException, IOException
{
final Document document = new Document();
PdfWriter.getInstance(document, result);
for (final BufferedImage image : images)
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
final Image img = Image.getInstance(baos.toByteArray());
document.setPageSize(img);
document.newPage();
img.setAbsolutePosition(0, 0);
document.add(img);
}
document.close();
} | java | public static void createPdf(final OutputStream result, final List<BufferedImage> images)
throws DocumentException, IOException
{
final Document document = new Document();
PdfWriter.getInstance(document, result);
for (final BufferedImage image : images)
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
final Image img = Image.getInstance(baos.toByteArray());
document.setPageSize(img);
document.newPage();
img.setAbsolutePosition(0, 0);
document.add(img);
}
document.close();
} | [
"public",
"static",
"void",
"createPdf",
"(",
"final",
"OutputStream",
"result",
",",
"final",
"List",
"<",
"BufferedImage",
">",
"images",
")",
"throws",
"DocumentException",
",",
"IOException",
"{",
"final",
"Document",
"document",
"=",
"new",
"Document",
"(",... | Creates from the given Collection of images an pdf file.
@param result
the output stream from the pdf file where the images shell be written.
@param images
the BufferedImage collection to be written in the pdf file.
@throws DocumentException
is thrown if an error occurs when trying to get an instance of {@link PdfWriter}.
@throws IOException
Signals that an I/O exception has occurred. | [
"Creates",
"from",
"the",
"given",
"Collection",
"of",
"images",
"an",
"pdf",
"file",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/img/ImageExtensions.java#L128-L144 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/js/JSMarshaller.java | JSMarshaller.javaScriptEscape | @Nullable
public static String javaScriptEscape (@Nullable final String sInput)
{
if (StringHelper.hasNoText (sInput))
return sInput;
final char [] aInput = sInput.toCharArray ();
if (!StringHelper.containsAny (aInput, CHARS_TO_MASK))
return sInput;
final char [] ret = new char [aInput.length * 2];
int nIndex = 0;
char cPrevChar = '\u0000';
for (final char cCurrent : aInput)
{
switch (cCurrent)
{
case '"':
case '\'':
case '\\':
case '/':
ret[nIndex++] = MASK_CHAR;
ret[nIndex++] = cCurrent;
break;
case '\t':
ret[nIndex++] = MASK_CHAR;
ret[nIndex++] = 't';
break;
case '\n':
if (cPrevChar != '\r')
{
ret[nIndex++] = MASK_CHAR;
ret[nIndex++] = 'n';
}
break;
case '\r':
ret[nIndex++] = MASK_CHAR;
ret[nIndex++] = 'n';
break;
case '\f':
ret[nIndex++] = MASK_CHAR;
ret[nIndex++] = 'f';
break;
default:
ret[nIndex++] = cCurrent;
break;
}
cPrevChar = cCurrent;
}
return new String (ret, 0, nIndex);
} | java | @Nullable
public static String javaScriptEscape (@Nullable final String sInput)
{
if (StringHelper.hasNoText (sInput))
return sInput;
final char [] aInput = sInput.toCharArray ();
if (!StringHelper.containsAny (aInput, CHARS_TO_MASK))
return sInput;
final char [] ret = new char [aInput.length * 2];
int nIndex = 0;
char cPrevChar = '\u0000';
for (final char cCurrent : aInput)
{
switch (cCurrent)
{
case '"':
case '\'':
case '\\':
case '/':
ret[nIndex++] = MASK_CHAR;
ret[nIndex++] = cCurrent;
break;
case '\t':
ret[nIndex++] = MASK_CHAR;
ret[nIndex++] = 't';
break;
case '\n':
if (cPrevChar != '\r')
{
ret[nIndex++] = MASK_CHAR;
ret[nIndex++] = 'n';
}
break;
case '\r':
ret[nIndex++] = MASK_CHAR;
ret[nIndex++] = 'n';
break;
case '\f':
ret[nIndex++] = MASK_CHAR;
ret[nIndex++] = 'f';
break;
default:
ret[nIndex++] = cCurrent;
break;
}
cPrevChar = cCurrent;
}
return new String (ret, 0, nIndex);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"javaScriptEscape",
"(",
"@",
"Nullable",
"final",
"String",
"sInput",
")",
"{",
"if",
"(",
"StringHelper",
".",
"hasNoText",
"(",
"sInput",
")",
")",
"return",
"sInput",
";",
"final",
"char",
"[",
"]",
"aInpu... | Turn special characters into escaped characters conforming to JavaScript.
Handles complete character set defined in HTML 4.01 recommendation.<br>
Reference: <a href=
"http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Literals#String_Literals"
> Core JavaScript 1.5 Guide </a>
@param sInput
the input string
@return the escaped string | [
"Turn",
"special",
"characters",
"into",
"escaped",
"characters",
"conforming",
"to",
"JavaScript",
".",
"Handles",
"complete",
"character",
"set",
"defined",
"in",
"HTML",
"4",
".",
"01",
"recommendation",
".",
"<br",
">",
"Reference",
":",
"<a",
"href",
"=",... | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/JSMarshaller.java#L114-L165 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/element/NetworkElement.java | NetworkElement.changeProperty | public void changeProperty(String propertyName, Object propertyValue)
throws ShanksException {
this.properties.put(propertyName, propertyValue);
this.checkStatus();
} | java | public void changeProperty(String propertyName, Object propertyValue)
throws ShanksException {
this.properties.put(propertyName, propertyValue);
this.checkStatus();
} | [
"public",
"void",
"changeProperty",
"(",
"String",
"propertyName",
",",
"Object",
"propertyValue",
")",
"throws",
"ShanksException",
"{",
"this",
".",
"properties",
".",
"put",
"(",
"propertyName",
",",
"propertyValue",
")",
";",
"this",
".",
"checkStatus",
"(",... | If the property exists, this method changes it. If not, this method
creates it.
@param propertyName
@param propertyValue
@throws UnsupportedNetworkElementFieldException | [
"If",
"the",
"property",
"exists",
"this",
"method",
"changes",
"it",
".",
"If",
"not",
"this",
"method",
"creates",
"it",
"."
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/element/NetworkElement.java#L253-L257 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java | MmtfUtils.insertSeqResGroup | public static void insertSeqResGroup(Chain chain, Group group, int sequenceIndexId) {
List<Group> seqResGroups = chain.getSeqResGroups();
addGroupAtId(seqResGroups, group, sequenceIndexId);
} | java | public static void insertSeqResGroup(Chain chain, Group group, int sequenceIndexId) {
List<Group> seqResGroups = chain.getSeqResGroups();
addGroupAtId(seqResGroups, group, sequenceIndexId);
} | [
"public",
"static",
"void",
"insertSeqResGroup",
"(",
"Chain",
"chain",
",",
"Group",
"group",
",",
"int",
"sequenceIndexId",
")",
"{",
"List",
"<",
"Group",
">",
"seqResGroups",
"=",
"chain",
".",
"getSeqResGroups",
"(",
")",
";",
"addGroupAtId",
"(",
"seqR... | Insert the group in the given position in the sequence.
@param chain the chain to add the seq res group to
@param group the group to add
@param sequenceIndexId the index to add it in | [
"Insert",
"the",
"group",
"in",
"the",
"given",
"position",
"in",
"the",
"sequence",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L492-L495 |
windup/windup | config/api/src/main/java/org/jboss/windup/config/metadata/TechnologyReference.java | TechnologyReference.parseFromIDAndVersion | public static TechnologyReference parseFromIDAndVersion(String idAndVersion)
{
if (idAndVersion.contains(":"))
{
String tech = StringUtils.substringBefore(idAndVersion, ":");
String versionRangeString = StringUtils.substringAfter(idAndVersion, ":");
if (!versionRangeString.matches("^[(\\[].*[)\\]]"))
versionRangeString = "[" + versionRangeString + "]";
VersionRange versionRange = Versions.parseVersionRange(versionRangeString);
return new TechnologyReference(tech, versionRange);
}
return new TechnologyReference(idAndVersion);
} | java | public static TechnologyReference parseFromIDAndVersion(String idAndVersion)
{
if (idAndVersion.contains(":"))
{
String tech = StringUtils.substringBefore(idAndVersion, ":");
String versionRangeString = StringUtils.substringAfter(idAndVersion, ":");
if (!versionRangeString.matches("^[(\\[].*[)\\]]"))
versionRangeString = "[" + versionRangeString + "]";
VersionRange versionRange = Versions.parseVersionRange(versionRangeString);
return new TechnologyReference(tech, versionRange);
}
return new TechnologyReference(idAndVersion);
} | [
"public",
"static",
"TechnologyReference",
"parseFromIDAndVersion",
"(",
"String",
"idAndVersion",
")",
"{",
"if",
"(",
"idAndVersion",
".",
"contains",
"(",
"\":\"",
")",
")",
"{",
"String",
"tech",
"=",
"StringUtils",
".",
"substringBefore",
"(",
"idAndVersion",... | Parses a {@link TechnologyReference} from a string that is formatted as either
"id" or "id:versionRange". | [
"Parses",
"a",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/metadata/TechnologyReference.java#L62-L75 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/MoveOnSelectHandler.java | MoveOnSelectHandler.init | public void init(Record record, BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource)
{
super.init(record, fldDest, fldSource, convCheckMark, bMoveOnNew, bMoveOnValid, bMoveOnSelect, bMoveOnAdd, bMoveOnUpdate, strSource, bDontMoveNullSource);
} | java | public void init(Record record, BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource)
{
super.init(record, fldDest, fldSource, convCheckMark, bMoveOnNew, bMoveOnValid, bMoveOnSelect, bMoveOnAdd, bMoveOnUpdate, strSource, bDontMoveNullSource);
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"BaseField",
"fldDest",
",",
"BaseField",
"fldSource",
",",
"Converter",
"convCheckMark",
",",
"boolean",
"bMoveOnNew",
",",
"boolean",
"bMoveOnValid",
",",
"boolean",
"bMoveOnSelect",
",",
"boolean",
"bMoveO... | Constructor.
@param pfldDest tour.field.BaseField The destination field.
@param fldSource The source field.
@param pCheckMark If is field if false, don't move the data.
@param bMoveOnNew If true, move on new also.
@param bMoveOnValid If true, move on valid also. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/MoveOnSelectHandler.java#L52-L55 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.