repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorHS.java | RegisterWebAppVisitorHS.convertInitParams | public static Dictionary<String, String> convertInitParams(
final WebAppInitParam[] initParams) {
if (initParams == null || initParams.length == 0) {
return null;
}
Hashtable<String, String> dictionary = new Hashtable<>();
for (WebAppInitParam initParam : initParams) {
dictionary.put(initParam.g... | java | public static Dictionary<String, String> convertInitParams(
final WebAppInitParam[] initParams) {
if (initParams == null || initParams.length == 0) {
return null;
}
Hashtable<String, String> dictionary = new Hashtable<>();
for (WebAppInitParam initParam : initParams) {
dictionary.put(initParam.g... | [
"public",
"static",
"Dictionary",
"<",
"String",
",",
"String",
">",
"convertInitParams",
"(",
"final",
"WebAppInitParam",
"[",
"]",
"initParams",
")",
"{",
"if",
"(",
"initParams",
"==",
"null",
"||",
"initParams",
".",
"length",
"==",
"0",
")",
"{",
"ret... | Converts an array of init params to a Dictionary.
@param initParams array to be converted
@return Dictionary of init params | [
"Converts",
"an",
"array",
"of",
"init",
"params",
"to",
"a",
"Dictionary",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/RegisterWebAppVisitorHS.java#L235-L245 | train |
ops4j/org.ops4j.pax.web | pax-web-runtime/src/main/java/org/ops4j/pax/web/service/internal/Activator.java | Activator.createManagedService | private void createManagedService(final BundleContext context) {
ManagedService service = this::scheduleUpdateConfig;
final Dictionary<String, String> props = new Hashtable<>();
props.put(Constants.SERVICE_PID, org.ops4j.pax.web.service.WebContainerConstants.PID);
context.registerService(ManagedService.class, s... | java | private void createManagedService(final BundleContext context) {
ManagedService service = this::scheduleUpdateConfig;
final Dictionary<String, String> props = new Hashtable<>();
props.put(Constants.SERVICE_PID, org.ops4j.pax.web.service.WebContainerConstants.PID);
context.registerService(ManagedService.class, s... | [
"private",
"void",
"createManagedService",
"(",
"final",
"BundleContext",
"context",
")",
"{",
"ManagedService",
"service",
"=",
"this",
"::",
"scheduleUpdateConfig",
";",
"final",
"Dictionary",
"<",
"String",
",",
"String",
">",
"props",
"=",
"new",
"Hashtable",
... | Registers a managed service to listen on configuration updates.
@param context bundle context to use for registration | [
"Registers",
"a",
"managed",
"service",
"to",
"listen",
"on",
"configuration",
"updates",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-runtime/src/main/java/org/ops4j/pax/web/service/internal/Activator.java#L261-L277 | train |
ops4j/org.ops4j.pax.web | pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServletModel.java | ServletModel.validateAlias | private static String validateAlias(final String alias) {
NullArgumentException.validateNotNull(alias, "Alias");
if (!alias.startsWith("/")) {
throw new IllegalArgumentException(
"Alias does not start with slash (/)");
}
// "/" must be allowed
if (alias.length() > 1 && alias.endsWith("/")) {
throw ... | java | private static String validateAlias(final String alias) {
NullArgumentException.validateNotNull(alias, "Alias");
if (!alias.startsWith("/")) {
throw new IllegalArgumentException(
"Alias does not start with slash (/)");
}
// "/" must be allowed
if (alias.length() > 1 && alias.endsWith("/")) {
throw ... | [
"private",
"static",
"String",
"validateAlias",
"(",
"final",
"String",
"alias",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"alias",
",",
"\"Alias\"",
")",
";",
"if",
"(",
"!",
"alias",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"... | Validates that aan alias conforms to OSGi specs requirements. See OSGi R4
Http Service specs for details about alias validation.
@param alias to validate
@return received alias if validation succeeds
@throws IllegalArgumentException if validation fails | [
"Validates",
"that",
"aan",
"alias",
"conforms",
"to",
"OSGi",
"specs",
"requirements",
".",
"See",
"OSGi",
"R4",
"Http",
"Service",
"specs",
"for",
"details",
"about",
"alias",
"validation",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServletModel.java#L163-L174 | train |
ops4j/org.ops4j.pax.web | pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServletModel.java | ServletModel.aliasAsUrlPattern | private static String aliasAsUrlPattern(final String alias) {
String urlPattern = alias;
if (urlPattern != null && !urlPattern.equals("/")
&& !urlPattern.contains("*")) {
if (urlPattern.endsWith("/")) {
urlPattern = urlPattern + "*";
} else {
urlPattern = urlPattern + "/*";
}
}
return urlPa... | java | private static String aliasAsUrlPattern(final String alias) {
String urlPattern = alias;
if (urlPattern != null && !urlPattern.equals("/")
&& !urlPattern.contains("*")) {
if (urlPattern.endsWith("/")) {
urlPattern = urlPattern + "*";
} else {
urlPattern = urlPattern + "/*";
}
}
return urlPa... | [
"private",
"static",
"String",
"aliasAsUrlPattern",
"(",
"final",
"String",
"alias",
")",
"{",
"String",
"urlPattern",
"=",
"alias",
";",
"if",
"(",
"urlPattern",
"!=",
"null",
"&&",
"!",
"urlPattern",
".",
"equals",
"(",
"\"/\"",
")",
"&&",
"!",
"urlPatte... | Transforms an alias into a url pattern.
@param alias to transform
@return url pattern | [
"Transforms",
"an",
"alias",
"into",
"a",
"url",
"pattern",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-spi/src/main/java/org/ops4j/pax/web/service/spi/model/ServletModel.java#L182-L193 | train |
ops4j/org.ops4j.pax.web | pax-web-runtime/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceStopped.java | HttpServiceStopped.registerServlet | @Override
public void registerServlet(Class<? extends Servlet> servletClass,
String[] urlPatterns, Dictionary<String, ?> initParams,
HttpContext httpContext) throws ServletException {
LOG.warn("Http service has already been stopped");
} | java | @Override
public void registerServlet(Class<? extends Servlet> servletClass,
String[] urlPatterns, Dictionary<String, ?> initParams,
HttpContext httpContext) throws ServletException {
LOG.warn("Http service has already been stopped");
} | [
"@",
"Override",
"public",
"void",
"registerServlet",
"(",
"Class",
"<",
"?",
"extends",
"Servlet",
">",
"servletClass",
",",
"String",
"[",
"]",
"urlPatterns",
",",
"Dictionary",
"<",
"String",
",",
"?",
">",
"initParams",
",",
"HttpContext",
"httpContext",
... | Does nothing.
@see org.ops4j.pax.web.service.WebContainer#registerServlet(java.lang.Class,
java.lang.String[], java.util.Dictionary,
org.osgi.service.http.HttpContext) | [
"Does",
"nothing",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-runtime/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceStopped.java#L166-L171 | train |
ops4j/org.ops4j.pax.web | pax-web-resources/pax-web-resources-jsf/src/main/java/org/ops4j/pax/web/resources/jsf/OsgiResourceHandler.java | OsgiResourceHandler.createResourceIdentifier | private String createResourceIdentifier(final String localePrefix, final String resourceName, final String resourceVersion, final String libraryName, final String libraryVersion) {
final StringBuilder sb = new StringBuilder();
if (StringUtils.isNotBlank(localePrefix)) {
sb.append(localePrefix).append(PATH_SEPAR... | java | private String createResourceIdentifier(final String localePrefix, final String resourceName, final String resourceVersion, final String libraryName, final String libraryVersion) {
final StringBuilder sb = new StringBuilder();
if (StringUtils.isNotBlank(localePrefix)) {
sb.append(localePrefix).append(PATH_SEPAR... | [
"private",
"String",
"createResourceIdentifier",
"(",
"final",
"String",
"localePrefix",
",",
"final",
"String",
"resourceName",
",",
"final",
"String",
"resourceVersion",
",",
"final",
"String",
"libraryName",
",",
"final",
"String",
"libraryVersion",
")",
"{",
"fi... | Creates an ResourceIdentifier according to chapter 2.6.1.3 from the JSF 2.2 specification
@param localePrefix locale to use for the resource, optional
@param resourceName name of the resource
@param resourceVersion resource-version, optional
@param libraryName library-name, optional
@param libraryVersion li... | [
"Creates",
"an",
"ResourceIdentifier",
"according",
"to",
"chapter",
"2",
".",
"6",
".",
"1",
".",
"3",
"from",
"the",
"JSF",
"2",
".",
"2",
"specification"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-resources/pax-web-resources-jsf/src/main/java/org/ops4j/pax/web/resources/jsf/OsgiResourceHandler.java#L421-L438 | train |
ops4j/org.ops4j.pax.web | pax-web-deployer/src/main/java/org/ops4j/pax/web/deployer/internal/DeployerUtils.java | DeployerUtils.extractNameVersionType | public static String[] extractNameVersionType(String url) {
Matcher m = ARTIFACT_MATCHER.matcher(url);
if (!m.matches()) {
return new String[]{url.split("\\.")[0], DEFAULT_VERSION};
} else {
//CHECKSTYLE:OFF
StringBuilder v = new StringBuilder();
String d1 = m.group(1);
String d2 = m.group(2);
S... | java | public static String[] extractNameVersionType(String url) {
Matcher m = ARTIFACT_MATCHER.matcher(url);
if (!m.matches()) {
return new String[]{url.split("\\.")[0], DEFAULT_VERSION};
} else {
//CHECKSTYLE:OFF
StringBuilder v = new StringBuilder();
String d1 = m.group(1);
String d2 = m.group(2);
S... | [
"public",
"static",
"String",
"[",
"]",
"extractNameVersionType",
"(",
"String",
"url",
")",
"{",
"Matcher",
"m",
"=",
"ARTIFACT_MATCHER",
".",
"matcher",
"(",
"url",
")",
";",
"if",
"(",
"!",
"m",
".",
"matches",
"(",
")",
")",
"{",
"return",
"new",
... | Heuristic to compute the name and version of a file given it's name on
disk
@param url the name of the file
@return the name and version of that file | [
"Heuristic",
"to",
"compute",
"the",
"name",
"and",
"version",
"of",
"a",
"file",
"given",
"it",
"s",
"name",
"on",
"disk"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-deployer/src/main/java/org/ops4j/pax/web/deployer/internal/DeployerUtils.java#L52-L89 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/UnregisterWebAppVisitorHS.java | UnregisterWebAppVisitorHS.visit | public void visit(final WebAppServlet webAppServlet) {
//CHECKSTYLE:OFF
NullArgumentException.validateNotNull(webAppServlet, "Web app servlet");
final String[] aliases = webAppServlet.getAliases();
if (aliases != null && aliases.length > 0) {
for (String alias : aliases) {
try {
httpService.u... | java | public void visit(final WebAppServlet webAppServlet) {
//CHECKSTYLE:OFF
NullArgumentException.validateNotNull(webAppServlet, "Web app servlet");
final String[] aliases = webAppServlet.getAliases();
if (aliases != null && aliases.length > 0) {
for (String alias : aliases) {
try {
httpService.u... | [
"public",
"void",
"visit",
"(",
"final",
"WebAppServlet",
"webAppServlet",
")",
"{",
"//CHECKSTYLE:OFF\r",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAppServlet",
",",
"\"Web app servlet\"",
")",
";",
"final",
"String",
"[",
"]",
"aliases",
"=",
"webA... | Unregisters servlet from http context.
@throws NullArgumentException if servlet is null
@see WebAppVisitor#visit(WebAppServlet) | [
"Unregisters",
"servlet",
"from",
"http",
"context",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/UnregisterWebAppVisitorHS.java#L80-L97 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java | WebApp.addServletMapping | public void addServletMapping(final WebAppServletMapping servletMapping) {
NullArgumentException
.validateNotNull(servletMapping, "Servlet mapping");
NullArgumentException.validateNotNull(servletMapping.getServletName(),
"Servlet name");
NullArgumentException.validateNotNull(servletMapping.getUrlPattern()... | java | public void addServletMapping(final WebAppServletMapping servletMapping) {
NullArgumentException
.validateNotNull(servletMapping, "Servlet mapping");
NullArgumentException.validateNotNull(servletMapping.getServletName(),
"Servlet name");
NullArgumentException.validateNotNull(servletMapping.getUrlPattern()... | [
"public",
"void",
"addServletMapping",
"(",
"final",
"WebAppServletMapping",
"servletMapping",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"servletMapping",
",",
"\"Servlet mapping\"",
")",
";",
"NullArgumentException",
".",
"validateNotNull",
"(",
"se... | Add a servlet mapping.
@param servletMapping to add
@throws NullArgumentException if servlet mapping, servlet name or url pattern is null | [
"Add",
"a",
"servlet",
"mapping",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java#L311-L332 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java | WebApp.getServletMappings | public List<WebAppServletMapping> getServletMappings(
final String servletName) {
final Set<WebAppServletMapping> webAppServletMappings = servletMappings
.get(servletName);
if (webAppServletMappings == null) {
return new ArrayList<>();
}
return new ArrayList<>(webAppServletMappings);
} | java | public List<WebAppServletMapping> getServletMappings(
final String servletName) {
final Set<WebAppServletMapping> webAppServletMappings = servletMappings
.get(servletName);
if (webAppServletMappings == null) {
return new ArrayList<>();
}
return new ArrayList<>(webAppServletMappings);
} | [
"public",
"List",
"<",
"WebAppServletMapping",
">",
"getServletMappings",
"(",
"final",
"String",
"servletName",
")",
"{",
"final",
"Set",
"<",
"WebAppServletMapping",
">",
"webAppServletMappings",
"=",
"servletMappings",
".",
"get",
"(",
"servletName",
")",
";",
... | Returns a servlet mapping by servlet name.
@param servletName servlet name
@return array of servlet mappings for requested servlet name | [
"Returns",
"a",
"servlet",
"mapping",
"by",
"servlet",
"name",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java#L340-L348 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java | WebApp.addFilter | public void addFilter(final WebAppFilter filter) {
NullArgumentException.validateNotNull(filter, "Filter");
NullArgumentException.validateNotNull(filter.getFilterName(),
"Filter name");
NullArgumentException.validateNotNull(filter.getFilterClass(),
"Filter class");
filters.put(filter.getFilterName(), fi... | java | public void addFilter(final WebAppFilter filter) {
NullArgumentException.validateNotNull(filter, "Filter");
NullArgumentException.validateNotNull(filter.getFilterName(),
"Filter name");
NullArgumentException.validateNotNull(filter.getFilterClass(),
"Filter class");
filters.put(filter.getFilterName(), fi... | [
"public",
"void",
"addFilter",
"(",
"final",
"WebAppFilter",
"filter",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"filter",
",",
"\"Filter\"",
")",
";",
"NullArgumentException",
".",
"validateNotNull",
"(",
"filter",
".",
"getFilterName",
"(",
... | Add a filter.
@param filter to add
@throws NullArgumentException if filter, filter name or filter class is null | [
"Add",
"a",
"filter",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java#L356-L376 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java | WebApp.addFilterMapping | public void addFilterMapping(final WebAppFilterMapping filterMapping) {
NullArgumentException.validateNotNull(filterMapping, "Filter mapping");
NullArgumentException.validateNotNull(filterMapping.getFilterName(),
"Filter name");
final String filterName = filterMapping.getFilterName();
if (!orderedFilters.c... | java | public void addFilterMapping(final WebAppFilterMapping filterMapping) {
NullArgumentException.validateNotNull(filterMapping, "Filter mapping");
NullArgumentException.validateNotNull(filterMapping.getFilterName(),
"Filter name");
final String filterName = filterMapping.getFilterName();
if (!orderedFilters.c... | [
"public",
"void",
"addFilterMapping",
"(",
"final",
"WebAppFilterMapping",
"filterMapping",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"filterMapping",
",",
"\"Filter mapping\"",
")",
";",
"NullArgumentException",
".",
"validateNotNull",
"(",
"filterM... | Add a filter mapping.
@param filterMapping to add
@throws NullArgumentException if filter mapping or filter name is null | [
"Add",
"a",
"filter",
"mapping",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java#L384-L418 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java | WebApp.getFilterMappings | public List<WebAppFilterMapping> getFilterMappings(final String filterName) {
final Set<WebAppFilterMapping> webAppFilterMappings = filterMappings
.get(filterName);
if (webAppFilterMappings == null) {
return new ArrayList<>();
}
return new ArrayList<>(webAppFilterMappings);
} | java | public List<WebAppFilterMapping> getFilterMappings(final String filterName) {
final Set<WebAppFilterMapping> webAppFilterMappings = filterMappings
.get(filterName);
if (webAppFilterMappings == null) {
return new ArrayList<>();
}
return new ArrayList<>(webAppFilterMappings);
} | [
"public",
"List",
"<",
"WebAppFilterMapping",
">",
"getFilterMappings",
"(",
"final",
"String",
"filterName",
")",
"{",
"final",
"Set",
"<",
"WebAppFilterMapping",
">",
"webAppFilterMappings",
"=",
"filterMappings",
".",
"get",
"(",
"filterName",
")",
";",
"if",
... | Returns filter mappings by filter name.
@param filterName filter name
@return array of filter mappings for requested filter name | [
"Returns",
"filter",
"mappings",
"by",
"filter",
"name",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java#L426-L433 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java | WebApp.addErrorPage | public void addErrorPage(final WebAppErrorPage errorPage) {
NullArgumentException.validateNotNull(errorPage, "Error page");
if (errorPage.getErrorCode() == null
&& errorPage.getExceptionType() == null) {
throw new NullPointerException(
"At least one of error type or exception code must be set");
}
e... | java | public void addErrorPage(final WebAppErrorPage errorPage) {
NullArgumentException.validateNotNull(errorPage, "Error page");
if (errorPage.getErrorCode() == null
&& errorPage.getExceptionType() == null) {
throw new NullPointerException(
"At least one of error type or exception code must be set");
}
e... | [
"public",
"void",
"addErrorPage",
"(",
"final",
"WebAppErrorPage",
"errorPage",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"errorPage",
",",
"\"Error page\"",
")",
";",
"if",
"(",
"errorPage",
".",
"getErrorCode",
"(",
")",
"==",
"null",
"&&... | Add an error page.
@param errorPage to add
@throws NullArgumentException if error page is null or both error type and exception code
is null | [
"Add",
"an",
"error",
"page",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java#L457-L465 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java | WebApp.addContextParam | public void addContextParam(final WebAppInitParam contextParam) {
NullArgumentException.validateNotNull(contextParam, "Context param");
NullArgumentException.validateNotNull(contextParam.getParamName(),
"Context param name");
NullArgumentException.validateNotNull(contextParam.getParamValue(),
"Context par... | java | public void addContextParam(final WebAppInitParam contextParam) {
NullArgumentException.validateNotNull(contextParam, "Context param");
NullArgumentException.validateNotNull(contextParam.getParamName(),
"Context param name");
NullArgumentException.validateNotNull(contextParam.getParamValue(),
"Context par... | [
"public",
"void",
"addContextParam",
"(",
"final",
"WebAppInitParam",
"contextParam",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"contextParam",
",",
"\"Context param\"",
")",
";",
"NullArgumentException",
".",
"validateNotNull",
"(",
"contextParam",
... | Add a context param.
@param contextParam to add
@throws NullArgumentException if context param, param name or param value is null | [
"Add",
"a",
"context",
"param",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java#L493-L500 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java | WebApp.addMimeMapping | public void addMimeMapping(final WebAppMimeMapping mimeMapping) {
NullArgumentException.validateNotNull(mimeMapping, "Mime mapping");
NullArgumentException.validateNotNull(mimeMapping.getExtension(),
"Mime mapping extension");
NullArgumentException.validateNotNull(mimeMapping.getMimeType(),
"Mime mapping ... | java | public void addMimeMapping(final WebAppMimeMapping mimeMapping) {
NullArgumentException.validateNotNull(mimeMapping, "Mime mapping");
NullArgumentException.validateNotNull(mimeMapping.getExtension(),
"Mime mapping extension");
NullArgumentException.validateNotNull(mimeMapping.getMimeType(),
"Mime mapping ... | [
"public",
"void",
"addMimeMapping",
"(",
"final",
"WebAppMimeMapping",
"mimeMapping",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"mimeMapping",
",",
"\"Mime mapping\"",
")",
";",
"NullArgumentException",
".",
"validateNotNull",
"(",
"mimeMapping",
"... | Add a mime mapping.
@param mimeMapping to add
@throws NullArgumentException if mime mapping, extension or mime type is null | [
"Add",
"a",
"mime",
"mapping",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java#L517-L524 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java | WebApp.addLoginConfig | public void addLoginConfig(final WebAppLoginConfig webApploginConfig) {
NullArgumentException
.validateNotNull(webApploginConfig, "Login Config");
NullArgumentException.validateNotNull(
webApploginConfig.getAuthMethod(),
"Login Config Authorization Method");
// NullArgumentException.validateNotNull(lo... | java | public void addLoginConfig(final WebAppLoginConfig webApploginConfig) {
NullArgumentException
.validateNotNull(webApploginConfig, "Login Config");
NullArgumentException.validateNotNull(
webApploginConfig.getAuthMethod(),
"Login Config Authorization Method");
// NullArgumentException.validateNotNull(lo... | [
"public",
"void",
"addLoginConfig",
"(",
"final",
"WebAppLoginConfig",
"webApploginConfig",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webApploginConfig",
",",
"\"Login Config\"",
")",
";",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAp... | Adds a login config
@param webApploginConfig | [
"Adds",
"a",
"login",
"config"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java#L570-L579 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java | WebApp.accept | public void accept(final WebAppVisitor visitor) {
visitor.visit(this); // First do everything else
for (WebAppListener listener : listeners) {
visitor.visit(listener);
}
if (!filters.isEmpty()) {
// first visit the filters with a filter mapping in mapping order
final List<WebAppFilter> remainingFilter... | java | public void accept(final WebAppVisitor visitor) {
visitor.visit(this); // First do everything else
for (WebAppListener listener : listeners) {
visitor.visit(listener);
}
if (!filters.isEmpty()) {
// first visit the filters with a filter mapping in mapping order
final List<WebAppFilter> remainingFilter... | [
"public",
"void",
"accept",
"(",
"final",
"WebAppVisitor",
"visitor",
")",
"{",
"visitor",
".",
"visit",
"(",
"this",
")",
";",
"// First do everything else",
"for",
"(",
"WebAppListener",
"listener",
":",
"listeners",
")",
"{",
"visitor",
".",
"visit",
"(",
... | Accepts a visitor for inner elements.
@param visitor visitor | [
"Accepts",
"a",
"visitor",
"for",
"inner",
"elements",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/model/WebApp.java#L620-L659 | train |
ops4j/org.ops4j.pax.web | pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerWrapper.java | JettyServerWrapper.configureSecurity | private void configureSecurity(ServletContextHandler context, String realmName, String authMethod,
String formLoginPage, String formErrorPage) {
final SecurityHandler securityHandler = context.getSecurityHandler();
Authenticator authenticator = null;
if (authMethod == null) {
LOG.warn("UNKNOWN AUTH... | java | private void configureSecurity(ServletContextHandler context, String realmName, String authMethod,
String formLoginPage, String formErrorPage) {
final SecurityHandler securityHandler = context.getSecurityHandler();
Authenticator authenticator = null;
if (authMethod == null) {
LOG.warn("UNKNOWN AUTH... | [
"private",
"void",
"configureSecurity",
"(",
"ServletContextHandler",
"context",
",",
"String",
"realmName",
",",
"String",
"authMethod",
",",
"String",
"formLoginPage",
",",
"String",
"formErrorPage",
")",
"{",
"final",
"SecurityHandler",
"securityHandler",
"=",
"con... | Sets the security authentication method and the realm name on the
security handler. This has to be done before the context is started.
@param context
@param realmName
@param authMethod
@param formLoginPage
@param formErrorPage | [
"Sets",
"the",
"security",
"authentication",
"method",
"and",
"the",
"realm",
"name",
"on",
"the",
"security",
"handler",
".",
"This",
"has",
"to",
"be",
"done",
"before",
"the",
"context",
"is",
"started",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/JettyServerWrapper.java#L478-L517 | train |
ops4j/org.ops4j.pax.web | pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/CertificateValidator.java | CertificateValidator.validate | public void validate( KeyStore keyStore ) throws CertificateException
{
try
{
Enumeration<String> aliases = keyStore.aliases();
for ( ; aliases.hasMoreElements(); )
{
String alias = aliases.nextElement();
validate(keyStore,alias);
}
... | java | public void validate( KeyStore keyStore ) throws CertificateException
{
try
{
Enumeration<String> aliases = keyStore.aliases();
for ( ; aliases.hasMoreElements(); )
{
String alias = aliases.nextElement();
validate(keyStore,alias);
}
... | [
"public",
"void",
"validate",
"(",
"KeyStore",
"keyStore",
")",
"throws",
"CertificateException",
"{",
"try",
"{",
"Enumeration",
"<",
"String",
">",
"aliases",
"=",
"keyStore",
".",
"aliases",
"(",
")",
";",
"for",
"(",
";",
"aliases",
".",
"hasMoreElements... | validates all aliases inside of a given keystore
@param keyStore the keystore to validate
@throws CertificateException if keystore error and unable to validate | [
"validates",
"all",
"aliases",
"inside",
"of",
"a",
"given",
"keystore"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/CertificateValidator.java#L94-L112 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/UnregisterWebAppVisitorWC.java | UnregisterWebAppVisitorWC.visit | public void visit(final WebAppServlet webAppServlet) {
NullArgumentException.validateNotNull(webAppServlet, "Web app servlet");
Class<? extends Servlet> servletClass = webAppServlet
.getServletClass();
if (servletClass == null && webAppServlet.getServletClassName() != null) {
try {
servletClass =... | java | public void visit(final WebAppServlet webAppServlet) {
NullArgumentException.validateNotNull(webAppServlet, "Web app servlet");
Class<? extends Servlet> servletClass = webAppServlet
.getServletClass();
if (servletClass == null && webAppServlet.getServletClassName() != null) {
try {
servletClass =... | [
"public",
"void",
"visit",
"(",
"final",
"WebAppServlet",
"webAppServlet",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAppServlet",
",",
"\"Web app servlet\"",
")",
";",
"Class",
"<",
"?",
"extends",
"Servlet",
">",
"servletClass",
"=",
"we... | Unregisters servlet from web container.
@throws NullArgumentException if servlet is null
@see WebAppVisitor#visit(WebAppServlet) | [
"Unregisters",
"servlet",
"from",
"web",
"container",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/UnregisterWebAppVisitorWC.java#L117-L140 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/UnregisterWebAppVisitorWC.java | UnregisterWebAppVisitorWC.visit | public void visit(final WebAppFilter webAppFilter) {
NullArgumentException.validateNotNull(webAppFilter, "Web app filter");
String filterName = webAppFilter.getFilterName();
if (filterName != null) {
//CHECKSTYLE:OFF
try {
webContainer.unregisterFilter(filterName);
} catch (Exception ignore)... | java | public void visit(final WebAppFilter webAppFilter) {
NullArgumentException.validateNotNull(webAppFilter, "Web app filter");
String filterName = webAppFilter.getFilterName();
if (filterName != null) {
//CHECKSTYLE:OFF
try {
webContainer.unregisterFilter(filterName);
} catch (Exception ignore)... | [
"public",
"void",
"visit",
"(",
"final",
"WebAppFilter",
"webAppFilter",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAppFilter",
",",
"\"Web app filter\"",
")",
";",
"String",
"filterName",
"=",
"webAppFilter",
".",
"getFilterName",
"(",
")",... | Unregisters filter from web container.
@throws NullArgumentException if filter is null
@see WebAppVisitor#visit(WebAppFilter) | [
"Unregisters",
"filter",
"from",
"web",
"container",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/UnregisterWebAppVisitorWC.java#L148-L161 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/UnregisterWebAppVisitorWC.java | UnregisterWebAppVisitorWC.visit | public void visit(final WebAppListener webAppListener) {
NullArgumentException.validateNotNull(webAppListener,
"Web app listener");
final EventListener listener = webAppListener.getListener();
if (listener != null) {
//CHECKSTYLE:OFF
try {
webContainer.unregisterEventListener(listener);
}... | java | public void visit(final WebAppListener webAppListener) {
NullArgumentException.validateNotNull(webAppListener,
"Web app listener");
final EventListener listener = webAppListener.getListener();
if (listener != null) {
//CHECKSTYLE:OFF
try {
webContainer.unregisterEventListener(listener);
}... | [
"public",
"void",
"visit",
"(",
"final",
"WebAppListener",
"webAppListener",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAppListener",
",",
"\"Web app listener\"",
")",
";",
"final",
"EventListener",
"listener",
"=",
"webAppListener",
".",
"get... | Unregisters listeners from web container.
@throws NullArgumentException if listener is null
@see WebAppVisitor#visit(WebAppListener) | [
"Unregisters",
"listeners",
"from",
"web",
"container",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/UnregisterWebAppVisitorWC.java#L169-L182 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/UnregisterWebAppVisitorWC.java | UnregisterWebAppVisitorWC.visit | public void visit(final WebAppErrorPage webAppErrorPage) {
NullArgumentException.validateNotNull(webAppErrorPage,
"Web app error page");
//CHECKSTYLE:OFF
try {
webContainer.unregisterErrorPage(webAppErrorPage.getError(),
httpContext);
} catch (Exception ignore) {
LOG.warn("Unregistration ... | java | public void visit(final WebAppErrorPage webAppErrorPage) {
NullArgumentException.validateNotNull(webAppErrorPage,
"Web app error page");
//CHECKSTYLE:OFF
try {
webContainer.unregisterErrorPage(webAppErrorPage.getError(),
httpContext);
} catch (Exception ignore) {
LOG.warn("Unregistration ... | [
"public",
"void",
"visit",
"(",
"final",
"WebAppErrorPage",
"webAppErrorPage",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webAppErrorPage",
",",
"\"Web app error page\"",
")",
";",
"//CHECKSTYLE:OFF\r",
"try",
"{",
"webContainer",
".",
"unregisterE... | Unregisters error pages from web container.
@throws NullArgumentException if error page is null
@see WebAppVisitor#visit(WebAppErrorPage) | [
"Unregisters",
"error",
"pages",
"from",
"web",
"container",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/UnregisterWebAppVisitorWC.java#L190-L201 | train |
ops4j/org.ops4j.pax.web | pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/HttpServiceContext.java | HttpServiceContext.addEventListener | @Override
public void addEventListener(final EventListener listener) {
super.addEventListener(listener);
if ((listener instanceof HttpSessionActivationListener)
|| (listener instanceof HttpSessionAttributeListener)
|| (listener instanceof HttpSessionBindingListener)
|| (listener instanceof HttpSessionL... | java | @Override
public void addEventListener(final EventListener listener) {
super.addEventListener(listener);
if ((listener instanceof HttpSessionActivationListener)
|| (listener instanceof HttpSessionAttributeListener)
|| (listener instanceof HttpSessionBindingListener)
|| (listener instanceof HttpSessionL... | [
"@",
"Override",
"public",
"void",
"addEventListener",
"(",
"final",
"EventListener",
"listener",
")",
"{",
"super",
".",
"addEventListener",
"(",
"listener",
")",
";",
"if",
"(",
"(",
"listener",
"instanceof",
"HttpSessionActivationListener",
")",
"||",
"(",
"l... | If the listener is a servlet context listener and the context is already
started, notify the servlet context listener about the fact that context
is started. This has to be done separately as the listener could be added
after the context is already started, case when servlet context listeners
are not notified anymore.
... | [
"If",
"the",
"listener",
"is",
"a",
"servlet",
"context",
"listener",
"and",
"the",
"context",
"is",
"already",
"started",
"notify",
"the",
"servlet",
"context",
"listener",
"about",
"the",
"fact",
"that",
"context",
"is",
"started",
".",
"This",
"has",
"to"... | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/HttpServiceContext.java#L325-L337 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppHttpContext.java | WebAppHttpContext.getResource | public URL getResource(final String name) {
final String normalizedName = Path.normalizeResourcePath(rootPath
+ (name.startsWith("/") ? "" : "/") + name).trim();
log.debug("Searching bundle " + bundle
+ " for resource [{}], normalized to [{}]", name,
normalizedName);
URL url = resourceCach... | java | public URL getResource(final String name) {
final String normalizedName = Path.normalizeResourcePath(rootPath
+ (name.startsWith("/") ? "" : "/") + name).trim();
log.debug("Searching bundle " + bundle
+ " for resource [{}], normalized to [{}]", name,
normalizedName);
URL url = resourceCach... | [
"public",
"URL",
"getResource",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"String",
"normalizedName",
"=",
"Path",
".",
"normalizeResourcePath",
"(",
"rootPath",
"+",
"(",
"name",
".",
"startsWith",
"(",
"\"/\"",
")",
"?",
"\"\"",
":",
"\"/\"",
")... | Searches for the resource in the bundle that published the service.
@see org.osgi.service.http.HttpContext#getResource(String) | [
"Searches",
"for",
"the",
"resource",
"in",
"the",
"bundle",
"that",
"published",
"the",
"service",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppHttpContext.java#L129-L170 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppHttpContext.java | WebAppHttpContext.getMimeType | public String getMimeType(final String name) {
String mimeType = null;
if (name != null && name.length() > 0 && name.contains(".")) {
final String[] segments = name.split("\\.");
mimeType = mimeMappings.get(segments[segments.length - 1]);
}
if (mimeType == null) {
mimeType = httpContext.getMimeT... | java | public String getMimeType(final String name) {
String mimeType = null;
if (name != null && name.length() > 0 && name.contains(".")) {
final String[] segments = name.split("\\.");
mimeType = mimeMappings.get(segments[segments.length - 1]);
}
if (mimeType == null) {
mimeType = httpContext.getMimeT... | [
"public",
"String",
"getMimeType",
"(",
"final",
"String",
"name",
")",
"{",
"String",
"mimeType",
"=",
"null",
";",
"if",
"(",
"name",
"!=",
"null",
"&&",
"name",
".",
"length",
"(",
")",
">",
"0",
"&&",
"name",
".",
"contains",
"(",
"\".\"",
")",
... | Find the mime type in the mime mappings. If not found delegate to wrapped
http context.
@see org.osgi.service.http.HttpContext#getMimeType(String) | [
"Find",
"the",
"mime",
"type",
"in",
"the",
"mime",
"mappings",
".",
"If",
"not",
"found",
"delegate",
"to",
"wrapped",
"http",
"context",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppHttpContext.java#L178-L188 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisher.java | WebAppPublisher.publish | public void publish(final WebApp webApp) {
NullArgumentException.validateNotNull(webApp, "Web app");
LOG.debug("Publishing web application [{}]", webApp);
final BundleContext webAppBundleContext = BundleUtils
.getBundleContext(webApp.getBundle());
if (webAppBundleContext != null) {
try {
Filte... | java | public void publish(final WebApp webApp) {
NullArgumentException.validateNotNull(webApp, "Web app");
LOG.debug("Publishing web application [{}]", webApp);
final BundleContext webAppBundleContext = BundleUtils
.getBundleContext(webApp.getBundle());
if (webAppBundleContext != null) {
try {
Filte... | [
"public",
"void",
"publish",
"(",
"final",
"WebApp",
"webApp",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webApp",
",",
"\"Web app\"",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Publishing web application [{}]\"",
",",
"webApp",
")",
";",
"fina... | Publish a web application.
@param webApp web application to be published.
@throws NullArgumentException if web app is null | [
"Publish",
"a",
"web",
"application",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisher.java#L82-L107 | train |
ops4j/org.ops4j.pax.web | pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisher.java | WebAppPublisher.unpublish | public void unpublish(final WebApp webApp) {
NullArgumentException.validateNotNull(webApp, "Web app");
LOG.debug("Unpublishing web application [{}]", webApp);
final ServiceTracker<WebAppDependencyHolder, WebAppDependencyHolder> tracker = webApps
.remove(webApp);
if (tracker != null) {
tracker.close... | java | public void unpublish(final WebApp webApp) {
NullArgumentException.validateNotNull(webApp, "Web app");
LOG.debug("Unpublishing web application [{}]", webApp);
final ServiceTracker<WebAppDependencyHolder, WebAppDependencyHolder> tracker = webApps
.remove(webApp);
if (tracker != null) {
tracker.close... | [
"public",
"void",
"unpublish",
"(",
"final",
"WebApp",
"webApp",
")",
"{",
"NullArgumentException",
".",
"validateNotNull",
"(",
"webApp",
",",
"\"Web app\"",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Unpublishing web application [{}]\"",
",",
"webApp",
")",
";",
"... | Unpublish a web application.
@param webApp web aplication to be unpublished
@throws NullArgumentException if web app is null | [
"Unpublish",
"a",
"web",
"application",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-extender-war/src/main/java/org/ops4j/pax/web/extender/war/internal/WebAppPublisher.java#L115-L123 | train |
ops4j/org.ops4j.pax.web | pax-web-runtime/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceStarted.java | HttpServiceStarted.registerServlet | @Override
public void registerServlet(final String alias, final Servlet servlet,
@SuppressWarnings("rawtypes") final Dictionary initParams,
final HttpContext httpContext) throws ServletException,
NamespaceException {
synchronized (lock) {
this.registerServlet(alias, servlet, initParams, null, n... | java | @Override
public void registerServlet(final String alias, final Servlet servlet,
@SuppressWarnings("rawtypes") final Dictionary initParams,
final HttpContext httpContext) throws ServletException,
NamespaceException {
synchronized (lock) {
this.registerServlet(alias, servlet, initParams, null, n... | [
"@",
"Override",
"public",
"void",
"registerServlet",
"(",
"final",
"String",
"alias",
",",
"final",
"Servlet",
"servlet",
",",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"final",
"Dictionary",
"initParams",
",",
"final",
"HttpContext",
"httpContext",
")",... | From Http Service - cannot fix generics until underlying Http Service is
corrected | [
"From",
"Http",
"Service",
"-",
"cannot",
"fix",
"generics",
"until",
"underlying",
"Http",
"Service",
"is",
"corrected"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-runtime/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceStarted.java#L200-L209 | train |
ops4j/org.ops4j.pax.web | pax-web-runtime/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceStarted.java | HttpServiceStarted.withWhiteboardDtoService | private <T> T withWhiteboardDtoService(Function<WhiteboardDtoService, T> function) {
final BundleContext bundleContext = serviceBundle.getBundleContext();
ServiceReference<WhiteboardDtoService> ref = bundleContext.getServiceReference(WhiteboardDtoService.class);
if (ref != null) {
WhiteboardDtoService service ... | java | private <T> T withWhiteboardDtoService(Function<WhiteboardDtoService, T> function) {
final BundleContext bundleContext = serviceBundle.getBundleContext();
ServiceReference<WhiteboardDtoService> ref = bundleContext.getServiceReference(WhiteboardDtoService.class);
if (ref != null) {
WhiteboardDtoService service ... | [
"private",
"<",
"T",
">",
"T",
"withWhiteboardDtoService",
"(",
"Function",
"<",
"WhiteboardDtoService",
",",
"T",
">",
"function",
")",
"{",
"final",
"BundleContext",
"bundleContext",
"=",
"serviceBundle",
".",
"getBundleContext",
"(",
")",
";",
"ServiceReference... | WhiteboardDtoService is registered as DS component. Should be removed if this class gets full DS support
@param function a function which is applied against WhiteboardDtoService
@param <T> Type of the functions return value
@return value provided by given function | [
"WhiteboardDtoService",
"is",
"registered",
"as",
"DS",
"component",
".",
"Should",
"be",
"removed",
"if",
"this",
"class",
"gets",
"full",
"DS",
"support"
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-runtime/src/main/java/org/ops4j/pax/web/service/internal/HttpServiceStarted.java#L1443-L1457 | train |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/InstanceManager.java | InstanceManager.preDestroy | protected void preDestroy(Object instance, final Class<?> clazz)
throws IllegalAccessException, InvocationTargetException {
Class<?> superClass = clazz.getSuperclass();
if (superClass != Object.class) {
preDestroy(instance, superClass);
}
// At the end the postconstruct annotated
// method is invoked
... | java | protected void preDestroy(Object instance, final Class<?> clazz)
throws IllegalAccessException, InvocationTargetException {
Class<?> superClass = clazz.getSuperclass();
if (superClass != Object.class) {
preDestroy(instance, superClass);
}
// At the end the postconstruct annotated
// method is invoked
... | [
"protected",
"void",
"preDestroy",
"(",
"Object",
"instance",
",",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"Class",
"<",
"?",
">",
"superClass",
"=",
"clazz",
".",
"getSuperclass",... | Call preDestroy method on the specified instance recursively from deepest
superclass to actual class.
@param instance object to call preDestroy methods on
@param clazz (super) class to examine for preDestroy annotation.
@throws IllegalAccessException if preDestroy method is inaccessible.
@throw... | [
"Call",
"preDestroy",
"method",
"on",
"the",
"specified",
"instance",
"recursively",
"from",
"deepest",
"superclass",
"to",
"actual",
"class",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/InstanceManager.java#L108-L136 | train |
ops4j/org.ops4j.pax.web | pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/InstanceManager.java | InstanceManager.populateAnnotationsCache | protected void populateAnnotationsCache(Class<?> clazz,
Map<String, String> injections) throws IllegalAccessException,
InvocationTargetException {
while (clazz != null) {
List<AnnotationCacheEntry> annotations = null;
synchronized (annotationCache) {
annotations = annotationCache.get(clazz);
... | java | protected void populateAnnotationsCache(Class<?> clazz,
Map<String, String> injections) throws IllegalAccessException,
InvocationTargetException {
while (clazz != null) {
List<AnnotationCacheEntry> annotations = null;
synchronized (annotationCache) {
annotations = annotationCache.get(clazz);
... | [
"protected",
"void",
"populateAnnotationsCache",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Map",
"<",
"String",
",",
"String",
">",
"injections",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"while",
"(",
"clazz",
"!=",
"null... | Make sure that the annotations cache has been populated for the provided
class.
@param clazz clazz to populate annotations for
@param injections map of injections for this class from xml deployment
descriptor
@throws IllegalAccessException if injection target is inaccessible
@throws java.lang... | [
"Make",
"sure",
"that",
"the",
"annotations",
"cache",
"has",
"been",
"populated",
"for",
"the",
"provided",
"class",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jsp/src/main/java/org/ops4j/pax/web/jsp/InstanceManager.java#L148-L215 | train |
ops4j/org.ops4j.pax.web | pax-web-resources/pax-web-resources-jsf/src/main/java/org/ops4j/pax/web/resources/jsf/internal/ResourceHandlerUtils.java | ResourceHandlerUtils.pipeBytes | public static int pipeBytes(InputStream in, OutputStream out, byte[] buffer) throws IOException {
int count = 0;
int length;
while ((length = (in.read(buffer))) >= 0) {
out.write(buffer, 0, length);
count += length;
}
return count;
} | java | public static int pipeBytes(InputStream in, OutputStream out, byte[] buffer) throws IOException {
int count = 0;
int length;
while ((length = (in.read(buffer))) >= 0) {
out.write(buffer, 0, length);
count += length;
}
return count;
} | [
"public",
"static",
"int",
"pipeBytes",
"(",
"InputStream",
"in",
",",
"OutputStream",
"out",
",",
"byte",
"[",
"]",
"buffer",
")",
"throws",
"IOException",
"{",
"int",
"count",
"=",
"0",
";",
"int",
"length",
";",
"while",
"(",
"(",
"length",
"=",
"("... | Reads the specified input stream into the provided byte array storage and
writes it to the output stream. | [
"Reads",
"the",
"specified",
"input",
"stream",
"into",
"the",
"provided",
"byte",
"array",
"storage",
"and",
"writes",
"it",
"to",
"the",
"output",
"stream",
"."
] | 9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2 | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-resources/pax-web-resources-jsf/src/main/java/org/ops4j/pax/web/resources/jsf/internal/ResourceHandlerUtils.java#L203-L212 | train |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java | DeploymentScenario.managedDeployments | private List<Deployment> managedDeployments(List<Deployment> deployments) {
List<Deployment> managed = new ArrayList<Deployment>();
for (Deployment deployment : deployments) {
if (deployment.getDescription().managed()) {
managed.add(deployment);
}
}
... | java | private List<Deployment> managedDeployments(List<Deployment> deployments) {
List<Deployment> managed = new ArrayList<Deployment>();
for (Deployment deployment : deployments) {
if (deployment.getDescription().managed()) {
managed.add(deployment);
}
}
... | [
"private",
"List",
"<",
"Deployment",
">",
"managedDeployments",
"(",
"List",
"<",
"Deployment",
">",
"deployments",
")",
"{",
"List",
"<",
"Deployment",
">",
"managed",
"=",
"new",
"ArrayList",
"<",
"Deployment",
">",
"(",
")",
";",
"for",
"(",
"Deploymen... | Filters the List of Deployments and returns the ones that are Managed deployments.
@param deployments
List to filter
@return Filtered list | [
"Filters",
"the",
"List",
"of",
"Deployments",
"and",
"returns",
"the",
"ones",
"that",
"are",
"Managed",
"deployments",
"."
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java#L208-L216 | train |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java | DeploymentScenario.defaultDeployments | private List<Deployment> defaultDeployments(List<Deployment> deployments) {
List<Deployment> defaults = new ArrayList<Deployment>();
for (Deployment deployment : deployments) {
if (deployment.getDescription().getName().equals(DeploymentTargetDescription.DEFAULT.getName())) {
... | java | private List<Deployment> defaultDeployments(List<Deployment> deployments) {
List<Deployment> defaults = new ArrayList<Deployment>();
for (Deployment deployment : deployments) {
if (deployment.getDescription().getName().equals(DeploymentTargetDescription.DEFAULT.getName())) {
... | [
"private",
"List",
"<",
"Deployment",
">",
"defaultDeployments",
"(",
"List",
"<",
"Deployment",
">",
"deployments",
")",
"{",
"List",
"<",
"Deployment",
">",
"defaults",
"=",
"new",
"ArrayList",
"<",
"Deployment",
">",
"(",
")",
";",
"for",
"(",
"Deployme... | Filters the List of Deployments and returns the ones that are DEFAULT deployments.
@param deployments
List to filter
@return Filtered list | [
"Filters",
"the",
"List",
"of",
"Deployments",
"and",
"returns",
"the",
"ones",
"that",
"are",
"DEFAULT",
"deployments",
"."
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java#L226-L234 | train |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java | DeploymentScenario.archiveDeployments | private List<Deployment> archiveDeployments(List<Deployment> deployments) {
List<Deployment> archives = new ArrayList<Deployment>();
for (Deployment deployment : deployments) {
if (deployment.getDescription().isArchiveDeployment()) {
archives.add(deployment);
}
... | java | private List<Deployment> archiveDeployments(List<Deployment> deployments) {
List<Deployment> archives = new ArrayList<Deployment>();
for (Deployment deployment : deployments) {
if (deployment.getDescription().isArchiveDeployment()) {
archives.add(deployment);
}
... | [
"private",
"List",
"<",
"Deployment",
">",
"archiveDeployments",
"(",
"List",
"<",
"Deployment",
">",
"deployments",
")",
"{",
"List",
"<",
"Deployment",
">",
"archives",
"=",
"new",
"ArrayList",
"<",
"Deployment",
">",
"(",
")",
";",
"for",
"(",
"Deployme... | Filters the List of Deployments and returns the ones that are Archive deployments.
@param deployments
List to filter
@return Filtered list | [
"Filters",
"the",
"List",
"of",
"Deployments",
"and",
"returns",
"the",
"ones",
"that",
"are",
"Archive",
"deployments",
"."
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java#L244-L252 | train |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java | DeploymentScenario.findMatchingDeployment | private Deployment findMatchingDeployment(DeploymentTargetDescription target) {
List<Deployment> matching = findMatchingDeployments(target);
if (matching.size() == 0) {
return null;
}
if (matching.size() == 1) {
return matching.get(0);
}
// if mul... | java | private Deployment findMatchingDeployment(DeploymentTargetDescription target) {
List<Deployment> matching = findMatchingDeployments(target);
if (matching.size() == 0) {
return null;
}
if (matching.size() == 1) {
return matching.get(0);
}
// if mul... | [
"private",
"Deployment",
"findMatchingDeployment",
"(",
"DeploymentTargetDescription",
"target",
")",
"{",
"List",
"<",
"Deployment",
">",
"matching",
"=",
"findMatchingDeployments",
"(",
"target",
")",
";",
"if",
"(",
"matching",
".",
"size",
"(",
")",
"==",
"0... | Validation, names except DEFAULT should be unique. See constructor | [
"Validation",
"names",
"except",
"DEFAULT",
"should",
"be",
"unique",
".",
"See",
"constructor"
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java#L257-L268 | train |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java | DeploymentScenario.validateNotSameNameAndTypeOfDeployment | private void validateNotSameNameAndTypeOfDeployment(DeploymentDescription deployment) {
for (Deployment existing : deployments) {
if (existing.getDescription().getName().equals(deployment.getName())) {
if (
(existing.getDescription().isArchiveDeployment() && deplo... | java | private void validateNotSameNameAndTypeOfDeployment(DeploymentDescription deployment) {
for (Deployment existing : deployments) {
if (existing.getDescription().getName().equals(deployment.getName())) {
if (
(existing.getDescription().isArchiveDeployment() && deplo... | [
"private",
"void",
"validateNotSameNameAndTypeOfDeployment",
"(",
"DeploymentDescription",
"deployment",
")",
"{",
"for",
"(",
"Deployment",
"existing",
":",
"deployments",
")",
"{",
"if",
"(",
"existing",
".",
"getDescription",
"(",
")",
".",
"getName",
"(",
")",... | Validate that a deployment of same type is not already added | [
"Validate",
"that",
"a",
"deployment",
"of",
"same",
"type",
"is",
"not",
"already",
"added"
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java#L283-L294 | train |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java | DeploymentScenario.validateNotSameArchiveAndSameTarget | private void validateNotSameArchiveAndSameTarget(DeploymentDescription deployment) {
if (!deployment.isArchiveDeployment()) {
return;
}
for (Deployment existing : archiveDeployments(deployments)) {
if (existing.getDescription().getArchive().getName().equals(deployment.get... | java | private void validateNotSameArchiveAndSameTarget(DeploymentDescription deployment) {
if (!deployment.isArchiveDeployment()) {
return;
}
for (Deployment existing : archiveDeployments(deployments)) {
if (existing.getDescription().getArchive().getName().equals(deployment.get... | [
"private",
"void",
"validateNotSameArchiveAndSameTarget",
"(",
"DeploymentDescription",
"deployment",
")",
"{",
"if",
"(",
"!",
"deployment",
".",
"isArchiveDeployment",
"(",
")",
")",
"{",
"return",
";",
"}",
"for",
"(",
"Deployment",
"existing",
":",
"archiveDep... | Validate that a deployment with a archive of the same name does not have the same taget | [
"Validate",
"that",
"a",
"deployment",
"with",
"a",
"archive",
"of",
"the",
"same",
"name",
"does",
"not",
"have",
"the",
"same",
"taget"
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/DeploymentScenario.java#L299-L317 | train |
arquillian/arquillian-core | junit/core/src/main/java/org/jboss/arquillian/junit/RulesEnricher.java | RulesEnricher.getRuleInstances | private List<Object> getRuleInstances(Object testInstance) throws Exception {
List<Object> ruleInstances = new ArrayList<Object>();
List<Field> fieldsWithRuleAnnotation =
SecurityActions.getFieldsWithAnnotation(testInstance.getClass(), Rule.class);
if (fieldsWithRuleAnnotation.isEmp... | java | private List<Object> getRuleInstances(Object testInstance) throws Exception {
List<Object> ruleInstances = new ArrayList<Object>();
List<Field> fieldsWithRuleAnnotation =
SecurityActions.getFieldsWithAnnotation(testInstance.getClass(), Rule.class);
if (fieldsWithRuleAnnotation.isEmp... | [
"private",
"List",
"<",
"Object",
">",
"getRuleInstances",
"(",
"Object",
"testInstance",
")",
"throws",
"Exception",
"{",
"List",
"<",
"Object",
">",
"ruleInstances",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"List",
"<",
"Field",
">",
... | Retrieves instances of the TestRule and MethodRule classes | [
"Retrieves",
"instances",
"of",
"the",
"TestRule",
"and",
"MethodRule",
"classes"
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/junit/core/src/main/java/org/jboss/arquillian/junit/RulesEnricher.java#L94-L120 | train |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java | Validate.notNull | public static void notNull(final Object obj, final String message) throws IllegalArgumentException {
if (obj == null) {
throw new IllegalArgumentException(message);
}
} | java | public static void notNull(final Object obj, final String message) throws IllegalArgumentException {
if (obj == null) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"notNull",
"(",
"final",
"Object",
"obj",
",",
"final",
"String",
"message",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
... | Checks that object is not null, throws exception if it is.
@param obj
The object to check
@param message
The exception message
@throws IllegalArgumentException
Thrown if obj is null | [
"Checks",
"that",
"object",
"is",
"not",
"null",
"throws",
"exception",
"if",
"it",
"is",
"."
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java#L85-L89 | train |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java | Validate.notNullOrEmpty | public static void notNullOrEmpty(final String string, final String message) throws IllegalArgumentException {
if (string == null || string.length() == 0) {
throw new IllegalArgumentException(message);
}
} | java | public static void notNullOrEmpty(final String string, final String message) throws IllegalArgumentException {
if (string == null || string.length() == 0) {
throw new IllegalArgumentException(message);
}
} | [
"public",
"static",
"void",
"notNullOrEmpty",
"(",
"final",
"String",
"string",
",",
"final",
"String",
"message",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"string",
"==",
"null",
"||",
"string",
".",
"length",
"(",
")",
"==",
"0",
")",
"... | Checks that the specified String is not null or empty,
throws exception if it is.
@param string
The object to check
@param message
The exception message
@throws IllegalArgumentException
Thrown if obj is null | [
"Checks",
"that",
"the",
"specified",
"String",
"is",
"not",
"null",
"or",
"empty",
"throws",
"exception",
"if",
"it",
"is",
"."
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java#L103-L107 | train |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java | Validate.stateNotNull | public static void stateNotNull(final Object obj, final String message) throws IllegalStateException {
if (obj == null) {
throw new IllegalStateException(message);
}
} | java | public static void stateNotNull(final Object obj, final String message) throws IllegalStateException {
if (obj == null) {
throw new IllegalStateException(message);
}
} | [
"public",
"static",
"void",
"stateNotNull",
"(",
"final",
"Object",
"obj",
",",
"final",
"String",
"message",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"message",
")",
... | Checks that obj is not null, throws exception if it is.
@param obj
The object to check
@param message
The exception message
@throws IllegalStateException
Thrown if obj is null | [
"Checks",
"that",
"obj",
"is",
"not",
"null",
"throws",
"exception",
"if",
"it",
"is",
"."
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java#L120-L124 | train |
arquillian/arquillian-core | container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java | Validate.configurationDirectoryExists | public static void configurationDirectoryExists(final String string, final String message)
throws ConfigurationException {
if (string == null || string.length() == 0 || new File(string).isDirectory() == false) {
throw new ConfigurationException(message);
}
} | java | public static void configurationDirectoryExists(final String string, final String message)
throws ConfigurationException {
if (string == null || string.length() == 0 || new File(string).isDirectory() == false) {
throw new ConfigurationException(message);
}
} | [
"public",
"static",
"void",
"configurationDirectoryExists",
"(",
"final",
"String",
"string",
",",
"final",
"String",
"message",
")",
"throws",
"ConfigurationException",
"{",
"if",
"(",
"string",
"==",
"null",
"||",
"string",
".",
"length",
"(",
")",
"==",
"0"... | Checks that string is not null and not empty and it represents a path to a valid directory
@param string
The path to check
@param message
The exception message
@throws ConfigurationException
Thrown if string is empty, null or it does not represent a path the a valid directory | [
"Checks",
"that",
"string",
"is",
"not",
"null",
"and",
"not",
"empty",
"and",
"it",
"represents",
"a",
"path",
"to",
"a",
"valid",
"directory"
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/spi/src/main/java/org/jboss/arquillian/container/spi/client/deployment/Validate.java#L137-L142 | train |
arquillian/arquillian-core | container/impl-base/src/main/java/org/jboss/arquillian/container/impl/MapObject.java | MapObject.convert | private static Object convert(Class<?> clazz, String value) {
/* TODO create a new Converter class and move this method there for reuse */
if (Integer.class.equals(clazz) || int.class.equals(clazz)) {
return Integer.valueOf(value);
} else if (Double.class.equals(clazz) || double.class... | java | private static Object convert(Class<?> clazz, String value) {
/* TODO create a new Converter class and move this method there for reuse */
if (Integer.class.equals(clazz) || int.class.equals(clazz)) {
return Integer.valueOf(value);
} else if (Double.class.equals(clazz) || double.class... | [
"private",
"static",
"Object",
"convert",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"value",
")",
"{",
"/* TODO create a new Converter class and move this method there for reuse */",
"if",
"(",
"Integer",
".",
"class",
".",
"equals",
"(",
"clazz",
")",
... | Converts a String value to the specified class. | [
"Converts",
"a",
"String",
"value",
"to",
"the",
"specified",
"class",
"."
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/impl-base/src/main/java/org/jboss/arquillian/container/impl/MapObject.java#L94-L108 | train |
arquillian/arquillian-core | core/impl-base/src/main/java/org/jboss/arquillian/core/impl/ObserverImpl.java | ObserverImpl.resolveArguments | private Object[] resolveArguments(Manager manager, Object event) {
final Class<?>[] argumentTypes = getMethod().getParameterTypes();
int numberOfArguments = argumentTypes.length;
// we know that the first Argument is always the Event, and it will be there else this wouldn't be a Observer method... | java | private Object[] resolveArguments(Manager manager, Object event) {
final Class<?>[] argumentTypes = getMethod().getParameterTypes();
int numberOfArguments = argumentTypes.length;
// we know that the first Argument is always the Event, and it will be there else this wouldn't be a Observer method... | [
"private",
"Object",
"[",
"]",
"resolveArguments",
"(",
"Manager",
"manager",
",",
"Object",
"event",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"argumentTypes",
"=",
"getMethod",
"(",
")",
".",
"getParameterTypes",
"(",
")",
";",
"int",
"numbe... | Resolve all Observer method arguments. Unresolved argument types wil be null. | [
"Resolve",
"all",
"Observer",
"method",
"arguments",
".",
"Unresolved",
"argument",
"types",
"wil",
"be",
"null",
"."
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/core/impl-base/src/main/java/org/jboss/arquillian/core/impl/ObserverImpl.java#L128-L145 | train |
arquillian/arquillian-core | core/impl-base/src/main/java/org/jboss/arquillian/core/impl/ObserverImpl.java | ObserverImpl.containsNull | private boolean containsNull(Object[] arguments) {
for (Object argument : arguments) {
if (argument == null) {
return true;
}
}
return false;
} | java | private boolean containsNull(Object[] arguments) {
for (Object argument : arguments) {
if (argument == null) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"containsNull",
"(",
"Object",
"[",
"]",
"arguments",
")",
"{",
"for",
"(",
"Object",
"argument",
":",
"arguments",
")",
"{",
"if",
"(",
"argument",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
... | Check that all arguments were resolved. Do not invoke if not. | [
"Check",
"that",
"all",
"arguments",
"were",
"resolved",
".",
"Do",
"not",
"invoke",
"if",
"not",
"."
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/core/impl-base/src/main/java/org/jboss/arquillian/core/impl/ObserverImpl.java#L150-L157 | train |
arquillian/arquillian-core | container/impl-base/src/main/java/org/jboss/arquillian/container/impl/client/container/ContainerRegistryCreator.java | ContainerRegistryCreator.validateConfiguration | private void validateConfiguration(ArquillianDescriptor desc) {
Object defaultConfig = null;
// verify only one container is marked as default
for (ContainerDef container : desc.getContainers()) {
if (container.isDefault()) {
if (defaultConfig != null) {
... | java | private void validateConfiguration(ArquillianDescriptor desc) {
Object defaultConfig = null;
// verify only one container is marked as default
for (ContainerDef container : desc.getContainers()) {
if (container.isDefault()) {
if (defaultConfig != null) {
... | [
"private",
"void",
"validateConfiguration",
"(",
"ArquillianDescriptor",
"desc",
")",
"{",
"Object",
"defaultConfig",
"=",
"null",
";",
"// verify only one container is marked as default",
"for",
"(",
"ContainerDef",
"container",
":",
"desc",
".",
"getContainers",
"(",
... | Validate that the Configuration given is sane
@param desc
The read Descriptor | [
"Validate",
"that",
"the",
"Configuration",
"given",
"is",
"sane"
] | a85b91789b80cc77e0f0c2e2abac65c2255c0a81 | https://github.com/arquillian/arquillian-core/blob/a85b91789b80cc77e0f0c2e2abac65c2255c0a81/container/impl-base/src/main/java/org/jboss/arquillian/container/impl/client/container/ContainerRegistryCreator.java#L125-L171 | train |
camunda/camunda-commons | utils/src/main/java/org/camunda/commons/utils/IoUtil.java | IoUtil.fileAsString | public static String fileAsString(String filename) {
File classpathFile = getClasspathFile(filename);
return fileAsString(classpathFile);
} | java | public static String fileAsString(String filename) {
File classpathFile = getClasspathFile(filename);
return fileAsString(classpathFile);
} | [
"public",
"static",
"String",
"fileAsString",
"(",
"String",
"filename",
")",
"{",
"File",
"classpathFile",
"=",
"getClasspathFile",
"(",
"filename",
")",
";",
"return",
"fileAsString",
"(",
"classpathFile",
")",
";",
"}"
] | Returns the content of a file with specified filename
@param filename name of the file to load
@return Content of the file as {@link String} | [
"Returns",
"the",
"content",
"of",
"a",
"file",
"with",
"specified",
"filename"
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/utils/src/main/java/org/camunda/commons/utils/IoUtil.java#L119-L122 | train |
camunda/camunda-commons | utils/src/main/java/org/camunda/commons/utils/IoUtil.java | IoUtil.fileAsStream | public static InputStream fileAsStream(String filename) {
File classpathFile = getClasspathFile(filename);
return fileAsStream(classpathFile);
} | java | public static InputStream fileAsStream(String filename) {
File classpathFile = getClasspathFile(filename);
return fileAsStream(classpathFile);
} | [
"public",
"static",
"InputStream",
"fileAsStream",
"(",
"String",
"filename",
")",
"{",
"File",
"classpathFile",
"=",
"getClasspathFile",
"(",
"filename",
")",
";",
"return",
"fileAsStream",
"(",
"classpathFile",
")",
";",
"}"
] | Returns the input stream of a file with specified filename
@param filename the name of a {@link File} to load
@return the file content as input stream
@throws IoUtilException if the file cannot be loaded | [
"Returns",
"the",
"input",
"stream",
"of",
"a",
"file",
"with",
"specified",
"filename"
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/utils/src/main/java/org/camunda/commons/utils/IoUtil.java#L160-L163 | train |
camunda/camunda-commons | utils/src/main/java/org/camunda/commons/utils/IoUtil.java | IoUtil.fileAsStream | public static InputStream fileAsStream(File file) {
try {
return new BufferedInputStream(new FileInputStream(file));
} catch(FileNotFoundException e) {
throw LOG.fileNotFoundException(file.getAbsolutePath(), e);
}
} | java | public static InputStream fileAsStream(File file) {
try {
return new BufferedInputStream(new FileInputStream(file));
} catch(FileNotFoundException e) {
throw LOG.fileNotFoundException(file.getAbsolutePath(), e);
}
} | [
"public",
"static",
"InputStream",
"fileAsStream",
"(",
"File",
"file",
")",
"{",
"try",
"{",
"return",
"new",
"BufferedInputStream",
"(",
"new",
"FileInputStream",
"(",
"file",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"throw... | Returns the input stream of a file.
@param file the {@link File} to load
@return the file content as input stream
@throws IoUtilException if the file cannot be loaded | [
"Returns",
"the",
"input",
"stream",
"of",
"a",
"file",
"."
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/utils/src/main/java/org/camunda/commons/utils/IoUtil.java#L172-L178 | train |
camunda/camunda-commons | utils/src/main/java/org/camunda/commons/utils/StringUtil.java | StringUtil.join | public static String join(String delimiter, String... parts) {
if (parts == null) {
return null;
}
if (delimiter == null) {
delimiter = "";
}
StringBuilder stringBuilder = new StringBuilder();
for (int i=0; i < parts.length; i++) {
if (i > 0) {
stringBuilder.append(de... | java | public static String join(String delimiter, String... parts) {
if (parts == null) {
return null;
}
if (delimiter == null) {
delimiter = "";
}
StringBuilder stringBuilder = new StringBuilder();
for (int i=0; i < parts.length; i++) {
if (i > 0) {
stringBuilder.append(de... | [
"public",
"static",
"String",
"join",
"(",
"String",
"delimiter",
",",
"String",
"...",
"parts",
")",
"{",
"if",
"(",
"parts",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"delimiter",
"==",
"null",
")",
"{",
"delimiter",
"=",
"\"\"... | Joins a list of Strings to a single one.
@param delimiter the delimiter between the joined parts
@param parts the parts to join
@return the joined String or null if parts was null | [
"Joins",
"a",
"list",
"of",
"Strings",
"to",
"a",
"single",
"one",
"."
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/utils/src/main/java/org/camunda/commons/utils/StringUtil.java#L71-L88 | train |
camunda/camunda-commons | logging/src/main/java/org/camunda/commons/logging/BaseLogger.java | BaseLogger.logDebug | protected void logDebug(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isDebugEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.debug(msg, parameters);
}
} | java | protected void logDebug(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isDebugEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.debug(msg, parameters);
}
} | [
"protected",
"void",
"logDebug",
"(",
"String",
"id",
",",
"String",
"messageTemplate",
",",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"delegateLogger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"String",
"msg",
"=",
"formatMessageTemplate",
"(",
... | Logs a 'DEBUG' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters | [
"Logs",
"a",
"DEBUG",
"message"
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java#L115-L120 | train |
camunda/camunda-commons | logging/src/main/java/org/camunda/commons/logging/BaseLogger.java | BaseLogger.logInfo | protected void logInfo(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isInfoEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.info(msg, parameters);
}
} | java | protected void logInfo(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isInfoEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.info(msg, parameters);
}
} | [
"protected",
"void",
"logInfo",
"(",
"String",
"id",
",",
"String",
"messageTemplate",
",",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"delegateLogger",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"String",
"msg",
"=",
"formatMessageTemplate",
"(",
"i... | Logs an 'INFO' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters | [
"Logs",
"an",
"INFO",
"message"
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java#L129-L134 | train |
camunda/camunda-commons | logging/src/main/java/org/camunda/commons/logging/BaseLogger.java | BaseLogger.logWarn | protected void logWarn(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isWarnEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.warn(msg, parameters);
}
} | java | protected void logWarn(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isWarnEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.warn(msg, parameters);
}
} | [
"protected",
"void",
"logWarn",
"(",
"String",
"id",
",",
"String",
"messageTemplate",
",",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"delegateLogger",
".",
"isWarnEnabled",
"(",
")",
")",
"{",
"String",
"msg",
"=",
"formatMessageTemplate",
"(",
"i... | Logs an 'WARN' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters | [
"Logs",
"an",
"WARN",
"message"
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java#L143-L148 | train |
camunda/camunda-commons | logging/src/main/java/org/camunda/commons/logging/BaseLogger.java | BaseLogger.logError | protected void logError(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isErrorEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.error(msg, parameters);
}
} | java | protected void logError(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isErrorEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.error(msg, parameters);
}
} | [
"protected",
"void",
"logError",
"(",
"String",
"id",
",",
"String",
"messageTemplate",
",",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"delegateLogger",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"String",
"msg",
"=",
"formatMessageTemplate",
"(",
... | Logs an 'ERROR' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters | [
"Logs",
"an",
"ERROR",
"message"
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java#L157-L162 | train |
camunda/camunda-commons | logging/src/main/java/org/camunda/commons/logging/BaseLogger.java | BaseLogger.formatMessageTemplate | protected String formatMessageTemplate(String id, String messageTemplate) {
return projectCode + "-" + componentId + id + " " + messageTemplate;
} | java | protected String formatMessageTemplate(String id, String messageTemplate) {
return projectCode + "-" + componentId + id + " " + messageTemplate;
} | [
"protected",
"String",
"formatMessageTemplate",
"(",
"String",
"id",
",",
"String",
"messageTemplate",
")",
"{",
"return",
"projectCode",
"+",
"\"-\"",
"+",
"componentId",
"+",
"id",
"+",
"\" \"",
"+",
"messageTemplate",
";",
"}"
] | Formats a message template
@param id the id of the message
@param messageTemplate the message template to use
@return the formatted template | [
"Formats",
"a",
"message",
"template"
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java#L200-L202 | train |
camunda/camunda-commons | logging/src/main/java/org/camunda/commons/logging/BaseLogger.java | BaseLogger.exceptionMessage | protected String exceptionMessage(String id, String messageTemplate, Object... parameters) {
String formattedTemplate = formatMessageTemplate(id, messageTemplate);
if(parameters == null || parameters.length == 0) {
return formattedTemplate;
} else {
return MessageFormatter.arrayFormat(formatted... | java | protected String exceptionMessage(String id, String messageTemplate, Object... parameters) {
String formattedTemplate = formatMessageTemplate(id, messageTemplate);
if(parameters == null || parameters.length == 0) {
return formattedTemplate;
} else {
return MessageFormatter.arrayFormat(formatted... | [
"protected",
"String",
"exceptionMessage",
"(",
"String",
"id",
",",
"String",
"messageTemplate",
",",
"Object",
"...",
"parameters",
")",
"{",
"String",
"formattedTemplate",
"=",
"formatMessageTemplate",
"(",
"id",
",",
"messageTemplate",
")",
";",
"if",
"(",
"... | Prepares an exception message
@param id the id of the message
@param messageTemplate the message template to use
@param parameters the parameters for the message (optional)
@return the prepared exception message | [
"Prepares",
"an",
"exception",
"message"
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java#L213-L222 | train |
camunda/camunda-commons | utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java | EnsureUtil.ensureNotNull | public static void ensureNotNull(String parameterName, Object value) {
if(value == null) {
throw LOG.parameterIsNullException(parameterName);
}
} | java | public static void ensureNotNull(String parameterName, Object value) {
if(value == null) {
throw LOG.parameterIsNullException(parameterName);
}
} | [
"public",
"static",
"void",
"ensureNotNull",
"(",
"String",
"parameterName",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"LOG",
".",
"parameterIsNullException",
"(",
"parameterName",
")",
";",
"}",
"}"
] | Ensures that the parameter is not null.
@param parameterName the parameter name
@param value the value to ensure to be not null
@throws IllegalArgumentException if the parameter value is null | [
"Ensures",
"that",
"the",
"parameter",
"is",
"not",
"null",
"."
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java#L33-L37 | train |
camunda/camunda-commons | utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java | EnsureUtil.ensureParamInstanceOf | @SuppressWarnings("unchecked")
public static <T> T ensureParamInstanceOf(String objectName, Object object, Class<T> type) {
if(type.isAssignableFrom(object.getClass())) {
return (T) object;
} else {
throw LOG.unsupportedParameterType(objectName, object, type);
}
} | java | @SuppressWarnings("unchecked")
public static <T> T ensureParamInstanceOf(String objectName, Object object, Class<T> type) {
if(type.isAssignableFrom(object.getClass())) {
return (T) object;
} else {
throw LOG.unsupportedParameterType(objectName, object, type);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"ensureParamInstanceOf",
"(",
"String",
"objectName",
",",
"Object",
"object",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"if",
"(",
"type",
".",
"isAssignableF... | Ensure the object is of a given type and return the casted object
@param objectName the name of the parameter
@param object the parameter value
@param type the expected type
@return the parameter casted to the requested type
@throws IllegalArgumentException in case object cannot be casted to type | [
"Ensure",
"the",
"object",
"is",
"of",
"a",
"given",
"type",
"and",
"return",
"the",
"casted",
"object"
] | bd3195db47c92c25717288fe9e6735f8e882f247 | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java#L48-L55 | train |
Syncleus/aparapi | src/main/java/com/aparapi/Range.java | Range.getFactors | private static int[] getFactors(int _value, int _max) {
final int factors[] = new int[MAX_GROUP_SIZE];
int factorIdx = 0;
for (int possibleFactor = 1; possibleFactor <= _max; possibleFactor++) {
if ((_value % possibleFactor) == 0) {
factors[factorIdx++] = possibleFactor;
... | java | private static int[] getFactors(int _value, int _max) {
final int factors[] = new int[MAX_GROUP_SIZE];
int factorIdx = 0;
for (int possibleFactor = 1; possibleFactor <= _max; possibleFactor++) {
if ((_value % possibleFactor) == 0) {
factors[factorIdx++] = possibleFactor;
... | [
"private",
"static",
"int",
"[",
"]",
"getFactors",
"(",
"int",
"_value",
",",
"int",
"_max",
")",
"{",
"final",
"int",
"factors",
"[",
"]",
"=",
"new",
"int",
"[",
"MAX_GROUP_SIZE",
"]",
";",
"int",
"factorIdx",
"=",
"0",
";",
"for",
"(",
"int",
"... | Determine the set of factors for a given value.
@param _value The value we wish to factorize.
@param _max an upper bound on the value that can be chosen
@return and array of factors of _value | [
"Determine",
"the",
"set",
"of",
"factors",
"for",
"a",
"given",
"value",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/Range.java#L130-L141 | train |
Syncleus/aparapi | src/main/java/com/aparapi/Range.java | Range.getNumGroups | public int getNumGroups(int _dim) {
return (_dim == 0 ? (globalSize_0 / localSize_0) : (_dim == 1 ? (globalSize_1 / localSize_1) : (globalSize_2 / localSize_2)));
} | java | public int getNumGroups(int _dim) {
return (_dim == 0 ? (globalSize_0 / localSize_0) : (_dim == 1 ? (globalSize_1 / localSize_1) : (globalSize_2 / localSize_2)));
} | [
"public",
"int",
"getNumGroups",
"(",
"int",
"_dim",
")",
"{",
"return",
"(",
"_dim",
"==",
"0",
"?",
"(",
"globalSize_0",
"/",
"localSize_0",
")",
":",
"(",
"_dim",
"==",
"1",
"?",
"(",
"globalSize_1",
"/",
"localSize_1",
")",
":",
"(",
"globalSize_2"... | Get the number of groups for the given dimension.
<p>
This will essentially return globalXXXX/localXXXX for the given dimension (width, height, depth)
@param _dim The dim we are interested in 0, 1 or 2
@return the number of groups for the given dimension. | [
"Get",
"the",
"number",
"of",
"groups",
"for",
"the",
"given",
"dimension",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/Range.java#L475-L477 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java | KernelDeviceProfile.getElapsedTimeCurrentThread | public double getElapsedTimeCurrentThread(int stage) {
if (stage == ProfilingEvent.START.ordinal()) {
return 0;
}
Accumulator acc = getAccForThread();
return acc == null ? Double.NaN : (acc.currentTimes[stage] - acc.currentTimes[stage - 1]) / MILLION;
} | java | public double getElapsedTimeCurrentThread(int stage) {
if (stage == ProfilingEvent.START.ordinal()) {
return 0;
}
Accumulator acc = getAccForThread();
return acc == null ? Double.NaN : (acc.currentTimes[stage] - acc.currentTimes[stage - 1]) / MILLION;
} | [
"public",
"double",
"getElapsedTimeCurrentThread",
"(",
"int",
"stage",
")",
"{",
"if",
"(",
"stage",
"==",
"ProfilingEvent",
".",
"START",
".",
"ordinal",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"Accumulator",
"acc",
"=",
"getAccForThread",
"(",
")",... | Elapsed time for a single event only and for the current thread, i.e. since the previous stage rather than from the start. | [
"Elapsed",
"time",
"for",
"a",
"single",
"event",
"only",
"and",
"for",
"the",
"current",
"thread",
"i",
".",
"e",
".",
"since",
"the",
"previous",
"stage",
"rather",
"than",
"from",
"the",
"start",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java#L204-L212 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java | KernelDeviceProfile.getCumulativeElapsedTimeCurrrentThread | public double getCumulativeElapsedTimeCurrrentThread(ProfilingEvent stage) {
Accumulator acc = getAccForThread();
return acc == null ? Double.NaN : acc.accumulatedTimes[stage.ordinal()] / MILLION;
} | java | public double getCumulativeElapsedTimeCurrrentThread(ProfilingEvent stage) {
Accumulator acc = getAccForThread();
return acc == null ? Double.NaN : acc.accumulatedTimes[stage.ordinal()] / MILLION;
} | [
"public",
"double",
"getCumulativeElapsedTimeCurrrentThread",
"(",
"ProfilingEvent",
"stage",
")",
"{",
"Accumulator",
"acc",
"=",
"getAccForThread",
"(",
")",
";",
"return",
"acc",
"==",
"null",
"?",
"Double",
".",
"NaN",
":",
"acc",
".",
"accumulatedTimes",
"[... | Elapsed time for a single event only, i.e. since the previous stage rather than from the start, summed over all executions,
for the current thread, if it has executed the kernel on the device assigned to this KernelDeviceProfile instance.
@param stage the event stage | [
"Elapsed",
"time",
"for",
"a",
"single",
"event",
"only",
"i",
".",
"e",
".",
"since",
"the",
"previous",
"stage",
"rather",
"than",
"from",
"the",
"start",
"summed",
"over",
"all",
"executions",
"for",
"the",
"current",
"thread",
"if",
"it",
"has",
"exe... | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java#L257-L261 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java | KernelDeviceProfile.getCumulativeElapsedTimeAllCurrentThread | public double getCumulativeElapsedTimeAllCurrentThread() {
double sum = 0;
Accumulator acc = getAccForThread();
if (acc == null) {
return sum;
}
for (int i = 1; i <= ProfilingEvent.EXECUTED.ordinal(); ++i) {
sum += acc.accumulatedTimes[i];
}
return sum;
} | java | public double getCumulativeElapsedTimeAllCurrentThread() {
double sum = 0;
Accumulator acc = getAccForThread();
if (acc == null) {
return sum;
}
for (int i = 1; i <= ProfilingEvent.EXECUTED.ordinal(); ++i) {
sum += acc.accumulatedTimes[i];
}
return sum;
} | [
"public",
"double",
"getCumulativeElapsedTimeAllCurrentThread",
"(",
")",
"{",
"double",
"sum",
"=",
"0",
";",
"Accumulator",
"acc",
"=",
"getAccForThread",
"(",
")",
";",
"if",
"(",
"acc",
"==",
"null",
")",
"{",
"return",
"sum",
";",
"}",
"for",
"(",
"... | Elapsed time of entire execution, summed over all executions, for the current thread,
if it has executed the kernel on the device assigned to this KernelDeviceProfile instance. | [
"Elapsed",
"time",
"of",
"entire",
"execution",
"summed",
"over",
"all",
"executions",
"for",
"the",
"current",
"thread",
"if",
"it",
"has",
"executed",
"the",
"kernel",
"on",
"the",
"device",
"assigned",
"to",
"this",
"KernelDeviceProfile",
"instance",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java#L267-L280 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java | KernelDeviceProfile.getElapsedTimeLastThread | public double getElapsedTimeLastThread(int stage) {
if (stage == ProfilingEvent.START.ordinal()) {
return 0;
}
Accumulator acc = lastAccumulator.get();
return acc == null ? Double.NaN : (acc.currentTimes[stage] - acc.currentTimes[stage - 1]) / MILLION;
} | java | public double getElapsedTimeLastThread(int stage) {
if (stage == ProfilingEvent.START.ordinal()) {
return 0;
}
Accumulator acc = lastAccumulator.get();
return acc == null ? Double.NaN : (acc.currentTimes[stage] - acc.currentTimes[stage - 1]) / MILLION;
} | [
"public",
"double",
"getElapsedTimeLastThread",
"(",
"int",
"stage",
")",
"{",
"if",
"(",
"stage",
"==",
"ProfilingEvent",
".",
"START",
".",
"ordinal",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"Accumulator",
"acc",
"=",
"lastAccumulator",
".",
"get",
... | Elapsed time for a single event only and for the last thread that finished executing a kernel,
i.e. single event only - since the previous stage rather than from the start.
@param stage the event stage | [
"Elapsed",
"time",
"for",
"a",
"single",
"event",
"only",
"and",
"for",
"the",
"last",
"thread",
"that",
"finished",
"executing",
"a",
"kernel",
"i",
".",
"e",
".",
"single",
"event",
"only",
"-",
"since",
"the",
"previous",
"stage",
"rather",
"than",
"f... | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java#L287-L295 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java | KernelDeviceProfile.getCumulativeElapsedTimeGlobal | public double getCumulativeElapsedTimeGlobal(ProfilingEvent stage) {
final long[] accumulatedTimesHolder = new long[NUM_EVENTS];
globalAcc.consultAccumulatedTimes(accumulatedTimesHolder);
return accumulatedTimesHolder[stage.ordinal()] / MILLION;
} | java | public double getCumulativeElapsedTimeGlobal(ProfilingEvent stage) {
final long[] accumulatedTimesHolder = new long[NUM_EVENTS];
globalAcc.consultAccumulatedTimes(accumulatedTimesHolder);
return accumulatedTimesHolder[stage.ordinal()] / MILLION;
} | [
"public",
"double",
"getCumulativeElapsedTimeGlobal",
"(",
"ProfilingEvent",
"stage",
")",
"{",
"final",
"long",
"[",
"]",
"accumulatedTimesHolder",
"=",
"new",
"long",
"[",
"NUM_EVENTS",
"]",
";",
"globalAcc",
".",
"consultAccumulatedTimes",
"(",
"accumulatedTimesHol... | Elapsed time for a single event only, i.e. since the previous stage rather than from the start, summed over all executions,
for the last thread that executed this KernelDeviceProfile instance respective kernel and device.
@param stage the event stage | [
"Elapsed",
"time",
"for",
"a",
"single",
"event",
"only",
"i",
".",
"e",
".",
"since",
"the",
"previous",
"stage",
"rather",
"than",
"from",
"the",
"start",
"summed",
"over",
"all",
"executions",
"for",
"the",
"last",
"thread",
"that",
"executed",
"this",
... | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java#L316-L321 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java | KernelDeviceProfile.getCumulativeElapsedTimeAllGlobal | public double getCumulativeElapsedTimeAllGlobal() {
final long[] accumulatedTimesHolder = new long[NUM_EVENTS];
globalAcc.consultAccumulatedTimes(accumulatedTimesHolder);
double sum = 0;
for (int i = 1; i <= ProfilingEvent.EXECUTED.ordinal(); ++i) {
sum += accumulatedTimesHolder[i];
}
... | java | public double getCumulativeElapsedTimeAllGlobal() {
final long[] accumulatedTimesHolder = new long[NUM_EVENTS];
globalAcc.consultAccumulatedTimes(accumulatedTimesHolder);
double sum = 0;
for (int i = 1; i <= ProfilingEvent.EXECUTED.ordinal(); ++i) {
sum += accumulatedTimesHolder[i];
}
... | [
"public",
"double",
"getCumulativeElapsedTimeAllGlobal",
"(",
")",
"{",
"final",
"long",
"[",
"]",
"accumulatedTimesHolder",
"=",
"new",
"long",
"[",
"NUM_EVENTS",
"]",
";",
"globalAcc",
".",
"consultAccumulatedTimes",
"(",
"accumulatedTimesHolder",
")",
";",
"doubl... | Elapsed time of entire execution, summed over all executions, for all the threads,
that executed the kernel on this device. | [
"Elapsed",
"time",
"of",
"entire",
"execution",
"summed",
"over",
"all",
"executions",
"for",
"all",
"the",
"threads",
"that",
"executed",
"the",
"kernel",
"on",
"this",
"device",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelDeviceProfile.java#L327-L336 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/model/ClassModel.java | ClassModel.isSuperClass | public boolean isSuperClass(String otherClassName) {
if (getClassWeAreModelling().getName().equals(otherClassName)) {
return true;
} else if (superClazz != null) {
return superClazz.isSuperClass(otherClassName);
} else {
return false;
}
} | java | public boolean isSuperClass(String otherClassName) {
if (getClassWeAreModelling().getName().equals(otherClassName)) {
return true;
} else if (superClazz != null) {
return superClazz.isSuperClass(otherClassName);
} else {
return false;
}
} | [
"public",
"boolean",
"isSuperClass",
"(",
"String",
"otherClassName",
")",
"{",
"if",
"(",
"getClassWeAreModelling",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"otherClassName",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"... | Determine if this is the superclass of some other named class.
@param otherClassName The name of the class to compare against
@return true if 'this' a superclass of another named class | [
"Determine",
"if",
"this",
"is",
"the",
"superclass",
"of",
"some",
"other",
"named",
"class",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/model/ClassModel.java#L223-L231 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/model/ClassModel.java | ClassModel.isSuperClass | public boolean isSuperClass(Class<?> other) {
Class<?> s = other.getSuperclass();
while (s != null) {
if ((getClassWeAreModelling() == s) || (getClassWeAreModelling().getName().equals(s.getName()))) {
return true;
}
s = s.getSuperclass();
}
return false;
... | java | public boolean isSuperClass(Class<?> other) {
Class<?> s = other.getSuperclass();
while (s != null) {
if ((getClassWeAreModelling() == s) || (getClassWeAreModelling().getName().equals(s.getName()))) {
return true;
}
s = s.getSuperclass();
}
return false;
... | [
"public",
"boolean",
"isSuperClass",
"(",
"Class",
"<",
"?",
">",
"other",
")",
"{",
"Class",
"<",
"?",
">",
"s",
"=",
"other",
".",
"getSuperclass",
"(",
")",
";",
"while",
"(",
"s",
"!=",
"null",
")",
"{",
"if",
"(",
"(",
"getClassWeAreModelling",
... | Determine if this is the superclass of some other class.
@param other The class to compare against
@return true if 'this' a superclass of another class | [
"Determine",
"if",
"this",
"is",
"the",
"superclass",
"of",
"some",
"other",
"class",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/model/ClassModel.java#L239-L248 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/model/ClassModel.java | ClassModel.getPrivateMemorySize | public Integer getPrivateMemorySize(String fieldName) throws ClassParseException {
if (CacheEnabler.areCachesEnabled())
return privateMemorySizes.computeIfAbsent(fieldName);
return computePrivateMemorySize(fieldName);
} | java | public Integer getPrivateMemorySize(String fieldName) throws ClassParseException {
if (CacheEnabler.areCachesEnabled())
return privateMemorySizes.computeIfAbsent(fieldName);
return computePrivateMemorySize(fieldName);
} | [
"public",
"Integer",
"getPrivateMemorySize",
"(",
"String",
"fieldName",
")",
"throws",
"ClassParseException",
"{",
"if",
"(",
"CacheEnabler",
".",
"areCachesEnabled",
"(",
")",
")",
"return",
"privateMemorySizes",
".",
"computeIfAbsent",
"(",
"fieldName",
")",
";",... | If a field does not satisfy the private memory conditions, null, otherwise the size of private memory required. | [
"If",
"a",
"field",
"does",
"not",
"satisfy",
"the",
"private",
"memory",
"conditions",
"null",
"otherwise",
"the",
"size",
"of",
"private",
"memory",
"required",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/model/ClassModel.java#L315-L319 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/model/ClassModel.java | ClassModel.getMethod | public ClassModelMethod getMethod(MethodEntry _methodEntry, boolean _isSpecial) {
final String entryClassNameInDotForm = _methodEntry.getClassEntry().getNameUTF8Entry().getUTF8().replace('/', '.');
// Shortcut direct calls to supers to allow "foo() { super.foo() }" type stuff to work
if (_isSpecial &... | java | public ClassModelMethod getMethod(MethodEntry _methodEntry, boolean _isSpecial) {
final String entryClassNameInDotForm = _methodEntry.getClassEntry().getNameUTF8Entry().getUTF8().replace('/', '.');
// Shortcut direct calls to supers to allow "foo() { super.foo() }" type stuff to work
if (_isSpecial &... | [
"public",
"ClassModelMethod",
"getMethod",
"(",
"MethodEntry",
"_methodEntry",
",",
"boolean",
"_isSpecial",
")",
"{",
"final",
"String",
"entryClassNameInDotForm",
"=",
"_methodEntry",
".",
"getClassEntry",
"(",
")",
".",
"getNameUTF8Entry",
"(",
")",
".",
"getUTF8... | Look up a ConstantPool MethodEntry and return the corresponding Method.
@param _methodEntry The ConstantPool MethodEntry we want.
@param _isSpecial True if we wish to delegate to super (to support <code>super.foo()</code>)
@return The Method or null if we fail to locate a given method. | [
"Look",
"up",
"a",
"ConstantPool",
"MethodEntry",
"and",
"return",
"the",
"corresponding",
"Method",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/model/ClassModel.java#L2957-L2975 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/model/ClassModel.java | ClassModel.getMethodModel | public MethodModel getMethodModel(String _name, String _signature) throws AparapiException {
if (CacheEnabler.areCachesEnabled())
return methodModelCache.computeIfAbsent(MethodKey.of(_name, _signature));
else {
final ClassModelMethod method = getMethod(_name, _signature);
return n... | java | public MethodModel getMethodModel(String _name, String _signature) throws AparapiException {
if (CacheEnabler.areCachesEnabled())
return methodModelCache.computeIfAbsent(MethodKey.of(_name, _signature));
else {
final ClassModelMethod method = getMethod(_name, _signature);
return n... | [
"public",
"MethodModel",
"getMethodModel",
"(",
"String",
"_name",
",",
"String",
"_signature",
")",
"throws",
"AparapiException",
"{",
"if",
"(",
"CacheEnabler",
".",
"areCachesEnabled",
"(",
")",
")",
"return",
"methodModelCache",
".",
"computeIfAbsent",
"(",
"M... | Create a MethodModel for a given method name and signature.
@param _name
@param _signature
@return
@throws AparapiException | [
"Create",
"a",
"MethodModel",
"for",
"a",
"given",
"method",
"name",
"and",
"signature",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/model/ClassModel.java#L2993-L3000 | train |
Syncleus/aparapi | src/main/java/com/aparapi/ProfileReport.java | ProfileReport.setProfileReport | public void setProfileReport(final long reportId, final long[] _currentTimes) {
id = reportId;
System.arraycopy(_currentTimes, 0, currentTimes, 0, NUM_EVENTS);
} | java | public void setProfileReport(final long reportId, final long[] _currentTimes) {
id = reportId;
System.arraycopy(_currentTimes, 0, currentTimes, 0, NUM_EVENTS);
} | [
"public",
"void",
"setProfileReport",
"(",
"final",
"long",
"reportId",
",",
"final",
"long",
"[",
"]",
"_currentTimes",
")",
"{",
"id",
"=",
"reportId",
";",
"System",
".",
"arraycopy",
"(",
"_currentTimes",
",",
"0",
",",
"currentTimes",
",",
"0",
",",
... | Sets specific report data.
@param reportId the unique identifier for this report (the identifier is unique within the <kernel,device> tuple)
@param _currentTimes the profiling data | [
"Sets",
"specific",
"report",
"data",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/ProfileReport.java#L53-L56 | train |
Syncleus/aparapi | src/main/java/com/aparapi/ProfileReport.java | ProfileReport.getElapsedTime | public double getElapsedTime(int stage) {
if (stage == ProfilingEvent.START.ordinal()) {
return 0;
}
return (currentTimes[stage] - currentTimes[stage - 1]) / MILLION;
} | java | public double getElapsedTime(int stage) {
if (stage == ProfilingEvent.START.ordinal()) {
return 0;
}
return (currentTimes[stage] - currentTimes[stage - 1]) / MILLION;
} | [
"public",
"double",
"getElapsedTime",
"(",
"int",
"stage",
")",
"{",
"if",
"(",
"stage",
"==",
"ProfilingEvent",
".",
"START",
".",
"ordinal",
"(",
")",
")",
"{",
"return",
"0",
";",
"}",
"return",
"(",
"currentTimes",
"[",
"stage",
"]",
"-",
"currentT... | Elapsed time for a single event only, i.e. since the previous stage rather than from the start. | [
"Elapsed",
"time",
"for",
"a",
"single",
"event",
"only",
"i",
".",
"e",
".",
"since",
"the",
"previous",
"stage",
"rather",
"than",
"from",
"the",
"start",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/ProfileReport.java#L118-L123 | train |
Syncleus/aparapi | src/main/java/com/aparapi/device/OpenCLDevice.java | OpenCLDevice.configure | public void configure() {
if (configurator != null && !underConfiguration.get() &&
underConfiguration.compareAndSet(false, true)) {
try {
configurator.configure(this);
} finally {
underConfiguration.set(false);
}
}
} | java | public void configure() {
if (configurator != null && !underConfiguration.get() &&
underConfiguration.compareAndSet(false, true)) {
try {
configurator.configure(this);
} finally {
underConfiguration.set(false);
}
}
} | [
"public",
"void",
"configure",
"(",
")",
"{",
"if",
"(",
"configurator",
"!=",
"null",
"&&",
"!",
"underConfiguration",
".",
"get",
"(",
")",
"&&",
"underConfiguration",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"try",
"{",
"configu... | Called by the underlying Aparapi OpenCL platform, upon device
detection. | [
"Called",
"by",
"the",
"underlying",
"Aparapi",
"OpenCL",
"platform",
"upon",
"device",
"detection",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/device/OpenCLDevice.java#L148-L157 | train |
Syncleus/aparapi | src/main/java/com/aparapi/device/OpenCLDevice.java | OpenCLDevice.listDevices | public static List<OpenCLDevice> listDevices(TYPE type) {
final OpenCLPlatform platform = new OpenCLPlatform(0, null, null, null);
final ArrayList<OpenCLDevice> results = new ArrayList<>();
for (final OpenCLPlatform p : platform.getOpenCLPlatforms()) {
for (final OpenCLDevice device : p.getO... | java | public static List<OpenCLDevice> listDevices(TYPE type) {
final OpenCLPlatform platform = new OpenCLPlatform(0, null, null, null);
final ArrayList<OpenCLDevice> results = new ArrayList<>();
for (final OpenCLPlatform p : platform.getOpenCLPlatforms()) {
for (final OpenCLDevice device : p.getO... | [
"public",
"static",
"List",
"<",
"OpenCLDevice",
">",
"listDevices",
"(",
"TYPE",
"type",
")",
"{",
"final",
"OpenCLPlatform",
"platform",
"=",
"new",
"OpenCLPlatform",
"(",
"0",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"final",
"ArrayList",
"<",
... | List OpenCLDevices of a given TYPE, or all OpenCLDevices if type == null. | [
"List",
"OpenCLDevices",
"of",
"a",
"given",
"TYPE",
"or",
"all",
"OpenCLDevices",
"if",
"type",
"==",
"null",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/device/OpenCLDevice.java#L513-L526 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelProfile.java | KernelProfile.onStart | void onStart(Device device) {
KernelDeviceProfile currentDeviceProfile = deviceProfiles.get(device);
if (currentDeviceProfile == null) {
currentDeviceProfile = new KernelDeviceProfile(this, kernelClass, device);
KernelDeviceProfile existingProfile = deviceProfiles.putIfAbsent(device, cu... | java | void onStart(Device device) {
KernelDeviceProfile currentDeviceProfile = deviceProfiles.get(device);
if (currentDeviceProfile == null) {
currentDeviceProfile = new KernelDeviceProfile(this, kernelClass, device);
KernelDeviceProfile existingProfile = deviceProfiles.putIfAbsent(device, cu... | [
"void",
"onStart",
"(",
"Device",
"device",
")",
"{",
"KernelDeviceProfile",
"currentDeviceProfile",
"=",
"deviceProfiles",
".",
"get",
"(",
"device",
")",
";",
"if",
"(",
"currentDeviceProfile",
"==",
"null",
")",
"{",
"currentDeviceProfile",
"=",
"new",
"Kerne... | Starts a profiling information gathering sequence for the current thread invoking this method
regarding the specified execution device.
@param device | [
"Starts",
"a",
"profiling",
"information",
"gathering",
"sequence",
"for",
"the",
"current",
"thread",
"invoking",
"this",
"method",
"regarding",
"the",
"specified",
"execution",
"device",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelProfile.java#L76-L88 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelProfile.java | KernelProfile.onEvent | void onEvent(Device device, ProfilingEvent event) {
if (event == null) {
logger.log(Level.WARNING, "Discarding profiling event " + event + " for null device, for Kernel class: " + kernelClass.getName());
return;
}
final KernelDeviceProfile deviceProfile = deviceProfiles.get(device);
switch (event... | java | void onEvent(Device device, ProfilingEvent event) {
if (event == null) {
logger.log(Level.WARNING, "Discarding profiling event " + event + " for null device, for Kernel class: " + kernelClass.getName());
return;
}
final KernelDeviceProfile deviceProfile = deviceProfiles.get(device);
switch (event... | [
"void",
"onEvent",
"(",
"Device",
"device",
",",
"ProfilingEvent",
"event",
")",
"{",
"if",
"(",
"event",
"==",
"null",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"Discarding profiling event \"",
"+",
"event",
"+",
"\" for null devi... | Updates the profiling information for the current thread invoking this method regarding
the specified execution device.
@param device the device where the kernel is/was executed
@param event the event for which the profiling information is being updated | [
"Updates",
"the",
"profiling",
"information",
"for",
"the",
"current",
"thread",
"invoking",
"this",
"method",
"regarding",
"the",
"specified",
"execution",
"device",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelProfile.java#L97-L122 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/writer/KernelWriter.java | KernelWriter.convertType | @Override public String convertType(String _typeDesc, boolean useClassModel, boolean isLocal) {
if (_typeDesc.equals("Z") || _typeDesc.equals("boolean")) {
return (cvtBooleanToChar);
} else if (_typeDesc.equals("[Z") || _typeDesc.equals("boolean[]")) {
return isLocal ? (cvtBooleanArrayToCh... | java | @Override public String convertType(String _typeDesc, boolean useClassModel, boolean isLocal) {
if (_typeDesc.equals("Z") || _typeDesc.equals("boolean")) {
return (cvtBooleanToChar);
} else if (_typeDesc.equals("[Z") || _typeDesc.equals("boolean[]")) {
return isLocal ? (cvtBooleanArrayToCh... | [
"@",
"Override",
"public",
"String",
"convertType",
"(",
"String",
"_typeDesc",
",",
"boolean",
"useClassModel",
",",
"boolean",
"isLocal",
")",
"{",
"if",
"(",
"_typeDesc",
".",
"equals",
"(",
"\"Z\"",
")",
"||",
"_typeDesc",
".",
"equals",
"(",
"\"boolean\... | These three convert functions are here to perform
any type conversion that may be required between
Java and OpenCL.
@param _typeDesc
String in the Java JNI notation, [I, etc
@return Suitably converted string, "char*", etc | [
"These",
"three",
"convert",
"functions",
"are",
"here",
"to",
"perform",
"any",
"type",
"conversion",
"that",
"may",
"be",
"required",
"between",
"Java",
"and",
"OpenCL",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/writer/KernelWriter.java#L176-L209 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelRunner.java | KernelRunner.getClassModelFromArg | private ClassModel getClassModelFromArg(KernelArg arg, final Class<?> arrayClass) {
ClassModel c = null;
if (arg.getObjArrayElementModel() == null) {
final String tmp = arrayClass.getName().substring(2).replace('/', '.');
final String arrayClassInDotForm = tmp.substring(0, tmp.length() - 1)... | java | private ClassModel getClassModelFromArg(KernelArg arg, final Class<?> arrayClass) {
ClassModel c = null;
if (arg.getObjArrayElementModel() == null) {
final String tmp = arrayClass.getName().substring(2).replace('/', '.');
final String arrayClassInDotForm = tmp.substring(0, tmp.length() - 1)... | [
"private",
"ClassModel",
"getClassModelFromArg",
"(",
"KernelArg",
"arg",
",",
"final",
"Class",
"<",
"?",
">",
"arrayClass",
")",
"{",
"ClassModel",
"c",
"=",
"null",
";",
"if",
"(",
"arg",
".",
"getObjArrayElementModel",
"(",
")",
"==",
"null",
")",
"{",... | Helper method to retrieve the class model from a kernel argument.
@param arg the kernel argument
@param arrayClass the array Java class for the argument
@return the Aparapi ClassModel instance. | [
"Helper",
"method",
"to",
"retrieve",
"the",
"class",
"model",
"from",
"a",
"kernel",
"argument",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelRunner.java#L763-L782 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelRunner.java | KernelRunner.allocateArrayBufferIfFirstTimeOrArrayChanged | public boolean allocateArrayBufferIfFirstTimeOrArrayChanged(KernelArg arg, Object newRef,
final int objArraySize, final int totalStructSize, final int totalBufferSize) {
boolean didReallocate = false;
if ((arg.getObjArrayBuffer() == null) || (newRef != arg.getArray())) {
final ByteBuffer st... | java | public boolean allocateArrayBufferIfFirstTimeOrArrayChanged(KernelArg arg, Object newRef,
final int objArraySize, final int totalStructSize, final int totalBufferSize) {
boolean didReallocate = false;
if ((arg.getObjArrayBuffer() == null) || (newRef != arg.getArray())) {
final ByteBuffer st... | [
"public",
"boolean",
"allocateArrayBufferIfFirstTimeOrArrayChanged",
"(",
"KernelArg",
"arg",
",",
"Object",
"newRef",
",",
"final",
"int",
"objArraySize",
",",
"final",
"int",
"totalStructSize",
",",
"final",
"int",
"totalBufferSize",
")",
"{",
"boolean",
"didRealloc... | Helper method that manages the memory allocation for storing the kernel argument data,
so that the data can be exchanged between the host and the OpenCL device.
@param arg the kernel argument
@param newRef the actual Java data instance
@param objArraySize the number of elements in the Java array
@param totalStructSize ... | [
"Helper",
"method",
"that",
"manages",
"the",
"memory",
"allocation",
"for",
"storing",
"the",
"kernel",
"argument",
"data",
"so",
"that",
"the",
"data",
"can",
"be",
"exchanged",
"between",
"the",
"host",
"and",
"the",
"OpenCL",
"device",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelRunner.java#L795-L813 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelPreferences.java | KernelPreferences.isDeviceAmongPreferredDevices | public boolean isDeviceAmongPreferredDevices(Device device) {
maybeSetUpDefaultPreferredDevices();
boolean result = false;
synchronized (this) {
result = preferredDevices.get().contains(device);
}
return result;
} | java | public boolean isDeviceAmongPreferredDevices(Device device) {
maybeSetUpDefaultPreferredDevices();
boolean result = false;
synchronized (this) {
result = preferredDevices.get().contains(device);
}
return result;
} | [
"public",
"boolean",
"isDeviceAmongPreferredDevices",
"(",
"Device",
"device",
")",
"{",
"maybeSetUpDefaultPreferredDevices",
"(",
")",
";",
"boolean",
"result",
"=",
"false",
";",
"synchronized",
"(",
"this",
")",
"{",
"result",
"=",
"preferredDevices",
".",
"get... | Validates if the specified devices is among the preferred devices for executing the kernel associated with the current
kernel preferences.
@param device the device to be tested
@return <ul><li>true, if specified device is among the preferred devices</li>
<li>false, otherwise</li></ul> | [
"Validates",
"if",
"the",
"specified",
"devices",
"is",
"among",
"the",
"preferred",
"devices",
"for",
"executing",
"the",
"kernel",
"associated",
"with",
"the",
"current",
"kernel",
"preferences",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelPreferences.java#L71-L80 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/opencl/OpenCLKernel.java | OpenCLKernel.createKernel | public static OpenCLKernel createKernel(OpenCLProgram _program, String _kernelName, List<OpenCLArgDescriptor> _args) {
final OpenCLArgDescriptor[] argArray = _args.toArray(new OpenCLArgDescriptor[0]);
final OpenCLKernel oclk = new OpenCLKernel().createKernelJNI(_program, _kernelName, argArray);
for (f... | java | public static OpenCLKernel createKernel(OpenCLProgram _program, String _kernelName, List<OpenCLArgDescriptor> _args) {
final OpenCLArgDescriptor[] argArray = _args.toArray(new OpenCLArgDescriptor[0]);
final OpenCLKernel oclk = new OpenCLKernel().createKernelJNI(_program, _kernelName, argArray);
for (f... | [
"public",
"static",
"OpenCLKernel",
"createKernel",
"(",
"OpenCLProgram",
"_program",
",",
"String",
"_kernelName",
",",
"List",
"<",
"OpenCLArgDescriptor",
">",
"_args",
")",
"{",
"final",
"OpenCLArgDescriptor",
"[",
"]",
"argArray",
"=",
"_args",
".",
"toArray",... | This method is used to create a new Kernel from JNI
@param _program
@param _kernelName
@param _args
@return | [
"This",
"method",
"is",
"used",
"to",
"create",
"a",
"new",
"Kernel",
"from",
"JNI"
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/opencl/OpenCLKernel.java#L58-L65 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/instruction/ExpressionList.java | ExpressionList.doesNotContainContinueOrBreak | public boolean doesNotContainContinueOrBreak(Instruction _start, Instruction _extent) {
boolean ok = true;
boolean breakOrContinue = false;
for (Instruction i = _start; i != null; i = i.getNextExpr()) {
if (i.isBranch()) {
if (i.asBranch().isForwardUnconditional() && i.asBranch().... | java | public boolean doesNotContainContinueOrBreak(Instruction _start, Instruction _extent) {
boolean ok = true;
boolean breakOrContinue = false;
for (Instruction i = _start; i != null; i = i.getNextExpr()) {
if (i.isBranch()) {
if (i.asBranch().isForwardUnconditional() && i.asBranch().... | [
"public",
"boolean",
"doesNotContainContinueOrBreak",
"(",
"Instruction",
"_start",
",",
"Instruction",
"_extent",
")",
"{",
"boolean",
"ok",
"=",
"true",
";",
"boolean",
"breakOrContinue",
"=",
"false",
";",
"for",
"(",
"Instruction",
"i",
"=",
"_start",
";",
... | Determine whether the sequence of instructions from _start to _extent is free of branches which extend beyond _extent.
As a side effect, if we find a possible branch it is likely a break or continue so we mark the conditional as such.
@param _start
@param _extent
@return | [
"Determine",
"whether",
"the",
"sequence",
"of",
"instructions",
"from",
"_start",
"to",
"_extent",
"is",
"free",
"of",
"branches",
"which",
"extend",
"beyond",
"_extent",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/instruction/ExpressionList.java#L127-L150 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/instruction/ExpressionList.java | ExpressionList.add | public Instruction add(Instruction _instruction) {
if (head == null) {
head = _instruction;
} else {
_instruction.setPrevExpr(tail);
tail.setNextExpr(_instruction);
}
tail = _instruction;
logger.log(Level.FINE, "After PUSH of " + _instruction + " tail=" + tail... | java | public Instruction add(Instruction _instruction) {
if (head == null) {
head = _instruction;
} else {
_instruction.setPrevExpr(tail);
tail.setNextExpr(_instruction);
}
tail = _instruction;
logger.log(Level.FINE, "After PUSH of " + _instruction + " tail=" + tail... | [
"public",
"Instruction",
"add",
"(",
"Instruction",
"_instruction",
")",
"{",
"if",
"(",
"head",
"==",
"null",
")",
"{",
"head",
"=",
"_instruction",
";",
"}",
"else",
"{",
"_instruction",
".",
"setPrevExpr",
"(",
"tail",
")",
";",
"tail",
".",
"setNextE... | Add this instruction to the end of the list.
@param _instruction
@return The instruction we added | [
"Add",
"this",
"instruction",
"to",
"the",
"end",
"of",
"the",
"list",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/instruction/ExpressionList.java#L209-L222 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/instruction/ExpressionList.java | ExpressionList.replaceInclusive | public void replaceInclusive(Instruction _head, Instruction _tail, Instruction _newOne) {
_newOne.setNextExpr(null);
_newOne.setPrevExpr(null);
final Instruction prevHead = _head.getPrevExpr();
if (_tail == null) {
// this is the new tail
_newOne.setPrevExpr(prevHead);
... | java | public void replaceInclusive(Instruction _head, Instruction _tail, Instruction _newOne) {
_newOne.setNextExpr(null);
_newOne.setPrevExpr(null);
final Instruction prevHead = _head.getPrevExpr();
if (_tail == null) {
// this is the new tail
_newOne.setPrevExpr(prevHead);
... | [
"public",
"void",
"replaceInclusive",
"(",
"Instruction",
"_head",
",",
"Instruction",
"_tail",
",",
"Instruction",
"_newOne",
")",
"{",
"_newOne",
".",
"setNextExpr",
"(",
"null",
")",
";",
"_newOne",
".",
"setPrevExpr",
"(",
"null",
")",
";",
"final",
"Ins... | Inclusive replace between _head and _tail with _newOne.
<pre>
| | --> | | ---> ... ---> | | ---> | |
| prev | | _head | | _tail | | next |
| | <-- | | <--- ... <----| | <--- | |
</pre>
To
<pre>
| | --> | | ---> | |
| prev | | _new... | [
"Inclusive",
"replace",
"between",
"_head",
"and",
"_tail",
"with",
"_newOne",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/instruction/ExpressionList.java#L271-L307 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/kernel/KernelManager.java | KernelManager.sharedKernelInstance | public static <T extends Kernel> T sharedKernelInstance(Class<T> kernelClass) {
return instance().getSharedKernelInstance(kernelClass);
} | java | public static <T extends Kernel> T sharedKernelInstance(Class<T> kernelClass) {
return instance().getSharedKernelInstance(kernelClass);
} | [
"public",
"static",
"<",
"T",
"extends",
"Kernel",
">",
"T",
"sharedKernelInstance",
"(",
"Class",
"<",
"T",
">",
"kernelClass",
")",
"{",
"return",
"instance",
"(",
")",
".",
"getSharedKernelInstance",
"(",
"kernelClass",
")",
";",
"}"
] | This method returns a shared instance of a given Kernel subclass. The kernelClass needs a no-args constructor, which
need not be public.
<p>Each new Kernel instance requires a new JNIContext, the creation of which is expensive. There is apparently no simple solution by which a cached JNIContext can be reused
for all i... | [
"This",
"method",
"returns",
"a",
"shared",
"instance",
"of",
"a",
"given",
"Kernel",
"subclass",
".",
"The",
"kernelClass",
"needs",
"a",
"no",
"-",
"args",
"constructor",
"which",
"need",
"not",
"be",
"public",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/kernel/KernelManager.java#L95-L97 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/model/MethodModel.java | MethodModel.deoptimizeReverseBranches | public void deoptimizeReverseBranches() {
for (Instruction instruction = pcHead; instruction != null; instruction = instruction.getNextPC()) {
if (instruction.isBranch()) {
final Branch branch = instruction.asBranch();
if (branch.isReverse()) {
final Instruction ta... | java | public void deoptimizeReverseBranches() {
for (Instruction instruction = pcHead; instruction != null; instruction = instruction.getNextPC()) {
if (instruction.isBranch()) {
final Branch branch = instruction.asBranch();
if (branch.isReverse()) {
final Instruction ta... | [
"public",
"void",
"deoptimizeReverseBranches",
"(",
")",
"{",
"for",
"(",
"Instruction",
"instruction",
"=",
"pcHead",
";",
"instruction",
"!=",
"null",
";",
"instruction",
"=",
"instruction",
".",
"getNextPC",
"(",
")",
")",
"{",
"if",
"(",
"instruction",
"... | Javac optimizes some branches to avoid goto->goto, branch->goto etc.
This method specifically deals with reverse branches which are the result of such optimisations.
<code><pre>
</pre></code> | [
"Javac",
"optimizes",
"some",
"branches",
"to",
"avoid",
"goto",
"-",
">",
"goto",
"branch",
"-",
">",
"goto",
"etc",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/model/MethodModel.java#L337-L353 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/model/MethodModel.java | MethodModel.checkForSetter | void checkForSetter(Map<Integer, Instruction> pcMap) throws ClassParseException {
final String methodName = getMethod().getName();
if (methodName.startsWith("set")) {
final String rawVarNameCandidate = methodName.substring(3);
final String firstLetter = rawVarNameCandidate.substring(0, 1).... | java | void checkForSetter(Map<Integer, Instruction> pcMap) throws ClassParseException {
final String methodName = getMethod().getName();
if (methodName.startsWith("set")) {
final String rawVarNameCandidate = methodName.substring(3);
final String firstLetter = rawVarNameCandidate.substring(0, 1).... | [
"void",
"checkForSetter",
"(",
"Map",
"<",
"Integer",
",",
"Instruction",
">",
"pcMap",
")",
"throws",
"ClassParseException",
"{",
"final",
"String",
"methodName",
"=",
"getMethod",
"(",
")",
".",
"getName",
"(",
")",
";",
"if",
"(",
"methodName",
".",
"st... | Determine if this method is a setter and record the accessed field if so | [
"Determine",
"if",
"this",
"method",
"is",
"a",
"setter",
"and",
"record",
"the",
"accessed",
"field",
"if",
"so"
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/model/MethodModel.java#L1398-L1448 | train |
Syncleus/aparapi | src/main/java/com/aparapi/internal/util/Reflection.java | Reflection.getSimpleName | public static String getSimpleName(Class<?> klass) {
String simpleName = klass.getSimpleName();
if (simpleName.isEmpty()) {
String fullName = klass.getName();
int index = fullName.lastIndexOf('.');
simpleName = (index < 0) ? fullName : fullName.substring(index + 1);
}
... | java | public static String getSimpleName(Class<?> klass) {
String simpleName = klass.getSimpleName();
if (simpleName.isEmpty()) {
String fullName = klass.getName();
int index = fullName.lastIndexOf('.');
simpleName = (index < 0) ? fullName : fullName.substring(index + 1);
}
... | [
"public",
"static",
"String",
"getSimpleName",
"(",
"Class",
"<",
"?",
">",
"klass",
")",
"{",
"String",
"simpleName",
"=",
"klass",
".",
"getSimpleName",
"(",
")",
";",
"if",
"(",
"simpleName",
".",
"isEmpty",
"(",
")",
")",
"{",
"String",
"fullName",
... | Avoids getting dumb empty names for anonymous inners. | [
"Avoids",
"getting",
"dumb",
"empty",
"names",
"for",
"anonymous",
"inners",
"."
] | 6d5892c8e69854b3968c541023de37cf4762bd24 | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/util/Reflection.java#L24-L32 | train |
easymock/objenesis | tck/src/main/java/org/objenesis/tck/AbstractLoader.java | AbstractLoader.loadFromResource | public void loadFromResource(String resource, Candidate.CandidateType type) throws IOException {
InputStream candidatesConfig = classloader.getResourceAsStream(resource);
if(candidatesConfig == null) {
throw new IOException("Resource '" + resource + "' not found");
}
try {
load... | java | public void loadFromResource(String resource, Candidate.CandidateType type) throws IOException {
InputStream candidatesConfig = classloader.getResourceAsStream(resource);
if(candidatesConfig == null) {
throw new IOException("Resource '" + resource + "' not found");
}
try {
load... | [
"public",
"void",
"loadFromResource",
"(",
"String",
"resource",
",",
"Candidate",
".",
"CandidateType",
"type",
")",
"throws",
"IOException",
"{",
"InputStream",
"candidatesConfig",
"=",
"classloader",
".",
"getResourceAsStream",
"(",
"resource",
")",
";",
"if",
... | Load a candidate property file
@param resource File name
@param type Type of the candidate loaded from the stream
@throws IOException If there's problem reading the file | [
"Load",
"a",
"candidate",
"property",
"file"
] | 8f601c8ba1aa20bbc640e2c2bc48d55df52c489f | https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/tck/src/main/java/org/objenesis/tck/AbstractLoader.java#L103-L114 | train |
easymock/objenesis | tck/src/main/java/org/objenesis/tck/Main.java | Main.main | public static void main(String[] args) {
TextReporter reporter = new TextReporter(System.out, System.err);
run(reporter);
if(reporter.hasErrors()) {
System.exit(1);
}
} | java | public static void main(String[] args) {
TextReporter reporter = new TextReporter(System.out, System.err);
run(reporter);
if(reporter.hasErrors()) {
System.exit(1);
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"TextReporter",
"reporter",
"=",
"new",
"TextReporter",
"(",
"System",
".",
"out",
",",
"System",
".",
"err",
")",
";",
"run",
"(",
"reporter",
")",
";",
"if",
"(",
"repor... | Main class of the TCK. Can also be called as a normal method from an application server.
@param args No parameters are required | [
"Main",
"class",
"of",
"the",
"TCK",
".",
"Can",
"also",
"be",
"called",
"as",
"a",
"normal",
"method",
"from",
"an",
"application",
"server",
"."
] | 8f601c8ba1aa20bbc640e2c2bc48d55df52c489f | https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/tck/src/main/java/org/objenesis/tck/Main.java#L35-L44 | train |
easymock/objenesis | tck/src/main/java/org/objenesis/tck/Main.java | Main.run | public static void run(Reporter reporter) {
TCK tck = new TCK(new ObjenesisStd(), new ObjenesisSerializer(), reporter);
tck.runTests();
} | java | public static void run(Reporter reporter) {
TCK tck = new TCK(new ObjenesisStd(), new ObjenesisSerializer(), reporter);
tck.runTests();
} | [
"public",
"static",
"void",
"run",
"(",
"Reporter",
"reporter",
")",
"{",
"TCK",
"tck",
"=",
"new",
"TCK",
"(",
"new",
"ObjenesisStd",
"(",
")",
",",
"new",
"ObjenesisSerializer",
"(",
")",
",",
"reporter",
")",
";",
"tck",
".",
"runTests",
"(",
")",
... | Run the full test suite using standard Objenesis instances
@param reporter result are recorded in the reporter | [
"Run",
"the",
"full",
"test",
"suite",
"using",
"standard",
"Objenesis",
"instances"
] | 8f601c8ba1aa20bbc640e2c2bc48d55df52c489f | https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/tck/src/main/java/org/objenesis/tck/Main.java#L51-L54 | train |
easymock/objenesis | tck/src/main/java/org/objenesis/tck/search/ClassEnumerator.java | ClassEnumerator.getClassesForPackage | public static SortedSet<String> getClassesForPackage(Package pkg, ClassLoader classLoader) {
SortedSet<String> classes = new TreeSet<>(new Comparator<String>() {
public int compare(String o1, String o2) {
String simpleName1 = getSimpleName(o1);
String simpleName2 = getSimp... | java | public static SortedSet<String> getClassesForPackage(Package pkg, ClassLoader classLoader) {
SortedSet<String> classes = new TreeSet<>(new Comparator<String>() {
public int compare(String o1, String o2) {
String simpleName1 = getSimpleName(o1);
String simpleName2 = getSimp... | [
"public",
"static",
"SortedSet",
"<",
"String",
">",
"getClassesForPackage",
"(",
"Package",
"pkg",
",",
"ClassLoader",
"classLoader",
")",
"{",
"SortedSet",
"<",
"String",
">",
"classes",
"=",
"new",
"TreeSet",
"<>",
"(",
"new",
"Comparator",
"<",
"String",
... | Return all the classes in this package recursively.
@param pkg the searched package
@param classLoader class loader where to look for classes
@return list of full class names | [
"Return",
"all",
"the",
"classes",
"in",
"this",
"package",
"recursively",
"."
] | 8f601c8ba1aa20bbc640e2c2bc48d55df52c489f | https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/tck/src/main/java/org/objenesis/tck/search/ClassEnumerator.java#L97-L131 | train |
easymock/objenesis | main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java | ClassDefinitionUtils.readClass | public static byte[] readClass(String className) throws IOException {
// convert to a resource
className = ClassUtils.classNameToResource(className);
byte[] b = new byte[2500]; // I'm assuming that I'm reading class that are not too big
int length;
try (InputStream in = ClassDefinitionU... | java | public static byte[] readClass(String className) throws IOException {
// convert to a resource
className = ClassUtils.classNameToResource(className);
byte[] b = new byte[2500]; // I'm assuming that I'm reading class that are not too big
int length;
try (InputStream in = ClassDefinitionU... | [
"public",
"static",
"byte",
"[",
"]",
"readClass",
"(",
"String",
"className",
")",
"throws",
"IOException",
"{",
"// convert to a resource",
"className",
"=",
"ClassUtils",
".",
"classNameToResource",
"(",
"className",
")",
";",
"byte",
"[",
"]",
"b",
"=",
"n... | Read the bytes of a class from the classpath
@param className full class name including the package
@return the bytes representing the class
@throws IllegalArgumentException if the class is longer than 2500 bytes
@throws IOException if we fail to read the class | [
"Read",
"the",
"bytes",
"of",
"a",
"class",
"from",
"the",
"classpath"
] | 8f601c8ba1aa20bbc640e2c2bc48d55df52c489f | https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java#L105-L124 | train |
easymock/objenesis | main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java | ClassDefinitionUtils.writeClass | public static void writeClass(String fileName, byte[] bytes) throws IOException {
try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) {
out.write(bytes);
}
} | java | public static void writeClass(String fileName, byte[] bytes) throws IOException {
try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName))) {
out.write(bytes);
}
} | [
"public",
"static",
"void",
"writeClass",
"(",
"String",
"fileName",
",",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IOException",
"{",
"try",
"(",
"BufferedOutputStream",
"out",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"fileName"... | Write all class bytes to a file.
@param fileName file where the bytes will be written
@param bytes bytes representing the class
@throws IOException if we fail to write the class | [
"Write",
"all",
"class",
"bytes",
"to",
"a",
"file",
"."
] | 8f601c8ba1aa20bbc640e2c2bc48d55df52c489f | https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/main/src/main/java/org/objenesis/instantiator/util/ClassDefinitionUtils.java#L133-L137 | train |
easymock/objenesis | main/src/main/java/org/objenesis/instantiator/util/ClassUtils.java | ClassUtils.getExistingClass | @SuppressWarnings("unchecked")
public static <T> Class<T> getExistingClass(ClassLoader classLoader, String className) {
try {
return (Class<T>) Class.forName(className, true, classLoader);
}
catch (ClassNotFoundException e) {
return null;
}
} | java | @SuppressWarnings("unchecked")
public static <T> Class<T> getExistingClass(ClassLoader classLoader, String className) {
try {
return (Class<T>) Class.forName(className, true, classLoader);
}
catch (ClassNotFoundException e) {
return null;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"getExistingClass",
"(",
"ClassLoader",
"classLoader",
",",
"String",
"className",
")",
"{",
"try",
"{",
"return",
"(",
"Class",
"<",
"T",
">",
... | Check if this class already exists in the class loader and return it if it does
@param <T> type of the class returned
@param classLoader Class loader where to search the class
@param className Class name with full path
@return the class if it already exists or null | [
"Check",
"if",
"this",
"class",
"already",
"exists",
"in",
"the",
"class",
"loader",
"and",
"return",
"it",
"if",
"it",
"does"
] | 8f601c8ba1aa20bbc640e2c2bc48d55df52c489f | https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/main/src/main/java/org/objenesis/instantiator/util/ClassUtils.java#L60-L68 | train |
easymock/objenesis | tck/src/main/java/org/objenesis/tck/TCK.java | TCK.registerCandidate | public void registerCandidate(Class<?> candidateClass, String description, Candidate.CandidateType type) {
Candidate candidate = new Candidate(candidateClass, description, type);
int index = candidates.indexOf(candidate);
if(index >= 0) {
Candidate existingCandidate = candidates.get(index);
... | java | public void registerCandidate(Class<?> candidateClass, String description, Candidate.CandidateType type) {
Candidate candidate = new Candidate(candidateClass, description, type);
int index = candidates.indexOf(candidate);
if(index >= 0) {
Candidate existingCandidate = candidates.get(index);
... | [
"public",
"void",
"registerCandidate",
"(",
"Class",
"<",
"?",
">",
"candidateClass",
",",
"String",
"description",
",",
"Candidate",
".",
"CandidateType",
"type",
")",
"{",
"Candidate",
"candidate",
"=",
"new",
"Candidate",
"(",
"candidateClass",
",",
"descript... | Register a candidate class to attempt to instantiate.
@param candidateClass Class to attempt to instantiate
@param description Description of the class | [
"Register",
"a",
"candidate",
"class",
"to",
"attempt",
"to",
"instantiate",
"."
] | 8f601c8ba1aa20bbc640e2c2bc48d55df52c489f | https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/tck/src/main/java/org/objenesis/tck/TCK.java#L91-L104 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.