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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
probedock/probedock-java | src/main/java/io/probedock/client/common/utils/PackageMatcher.java | PackageMatcher.match | public static Map.Entry<String, String> match(Map<String, String> categoriesByPackage, String pkg) {
if (categoriesByPackage != null && pkg != null) {
for (Map.Entry<String, String> e : categoriesByPackage.entrySet()) {
if (Minimatch.minimatch(pkg.replaceAll("\\.", "/"), e.getKey().r... | java | public static Map.Entry<String, String> match(Map<String, String> categoriesByPackage, String pkg) {
if (categoriesByPackage != null && pkg != null) {
for (Map.Entry<String, String> e : categoriesByPackage.entrySet()) {
if (Minimatch.minimatch(pkg.replaceAll("\\.", "/"), e.getKey().r... | [
"public",
"static",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"match",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"categoriesByPackage",
",",
"String",
"pkg",
")",
"{",
"if",
"(",
"categoriesByPackage",
"!=",
"null",
"&&",
"pkg",
"!=",
... | Check if there is a pattern in the map that match the given package
@param categoriesByPackage The map of package patterns
@param pkg The package to check against
@return The entry with the corresponding match or null if no match | [
"Check",
"if",
"there",
"is",
"a",
"pattern",
"in",
"the",
"map",
"that",
"match",
"the",
"given",
"package"
] | 92ee6634ba4fe3fdffeb4e202f5372ef947a67c3 | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/common/utils/PackageMatcher.java#L20-L30 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/LastModifiedServlet.java | LastModifiedServlet.getCachedLastModified | private static long getCachedLastModified(ServletContext servletContext, HeaderAndPath hap) {
// Get the cache
@SuppressWarnings("unchecked")
Map<HeaderAndPath,GetLastModifiedCacheValue> cache = (Map<HeaderAndPath,GetLastModifiedCacheValue>)servletContext.getAttribute(GET_LAST_MODIFIED_CACHE_ATTRIBUTE_NAME);
if... | java | private static long getCachedLastModified(ServletContext servletContext, HeaderAndPath hap) {
// Get the cache
@SuppressWarnings("unchecked")
Map<HeaderAndPath,GetLastModifiedCacheValue> cache = (Map<HeaderAndPath,GetLastModifiedCacheValue>)servletContext.getAttribute(GET_LAST_MODIFIED_CACHE_ATTRIBUTE_NAME);
if... | [
"private",
"static",
"long",
"getCachedLastModified",
"(",
"ServletContext",
"servletContext",
",",
"HeaderAndPath",
"hap",
")",
"{",
"// Get the cache",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Map",
"<",
"HeaderAndPath",
",",
"GetLastModifiedCacheValue",
"... | Gets a modified time from either a file or URL.
Caches results for up to a second. | [
"Gets",
"a",
"modified",
"time",
"from",
"either",
"a",
"file",
"or",
"URL",
".",
"Caches",
"results",
"for",
"up",
"to",
"a",
"second",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/LastModifiedServlet.java#L331-L385 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/LastModifiedServlet.java | LastModifiedServlet.getLastModified | public static long getLastModified(ServletContext servletContext, HttpServletRequest request, String path) {
return getLastModified(
servletContext,
request,
path,
FileUtils.getExtension(path)
);
} | java | public static long getLastModified(ServletContext servletContext, HttpServletRequest request, String path) {
return getLastModified(
servletContext,
request,
path,
FileUtils.getExtension(path)
);
} | [
"public",
"static",
"long",
"getLastModified",
"(",
"ServletContext",
"servletContext",
",",
"HttpServletRequest",
"request",
",",
"String",
"path",
")",
"{",
"return",
"getLastModified",
"(",
"servletContext",
",",
"request",
",",
"path",
",",
"FileUtils",
".",
"... | Automatically determines extension from path.
@see #getLastModified(javax.servlet.ServletContext, java.lang.String, java.lang.String) | [
"Automatically",
"determines",
"extension",
"from",
"path",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/LastModifiedServlet.java#L421-L428 | train |
aoindustries/semanticcms-core-sitemap | src/main/java/com/semanticcms/core/sitemap/SiteMapIndexServlet.java | SiteMapIndexServlet.getLastModified | @Override
protected long getLastModified(HttpServletRequest req) {
try {
ReadableInstant mostRecent = null;
for(
Tuple2<Book,ReadableInstant> sitemapBook
: getSitemapBooks(
getServletContext(),
req,
(HttpServletResponse)req.getAttribute(RESPONSE_IN_REQUEST_ATTRIBUTE)
)
) {
Rea... | java | @Override
protected long getLastModified(HttpServletRequest req) {
try {
ReadableInstant mostRecent = null;
for(
Tuple2<Book,ReadableInstant> sitemapBook
: getSitemapBooks(
getServletContext(),
req,
(HttpServletResponse)req.getAttribute(RESPONSE_IN_REQUEST_ATTRIBUTE)
)
) {
Rea... | [
"@",
"Override",
"protected",
"long",
"getLastModified",
"(",
"HttpServletRequest",
"req",
")",
"{",
"try",
"{",
"ReadableInstant",
"mostRecent",
"=",
"null",
";",
"for",
"(",
"Tuple2",
"<",
"Book",
",",
"ReadableInstant",
">",
"sitemapBook",
":",
"getSitemapBoo... | Last modified is known only when the last modified is known for all books,
and it is the most recent of all the per-book last modified. | [
"Last",
"modified",
"is",
"known",
"only",
"when",
"the",
"last",
"modified",
"is",
"known",
"for",
"all",
"books",
"and",
"it",
"is",
"the",
"most",
"recent",
"of",
"all",
"the",
"per",
"-",
"book",
"last",
"modified",
"."
] | 564f77bc8b14572942903126dfd99e400bc11f85 | https://github.com/aoindustries/semanticcms-core-sitemap/blob/564f77bc8b14572942903126dfd99e400bc11f85/src/main/java/com/semanticcms/core/sitemap/SiteMapIndexServlet.java#L318-L348 | train |
aoindustries/semanticcms-core-sitemap | src/main/java/com/semanticcms/core/sitemap/SiteMapIndexServlet.java | SiteMapIndexServlet.hasSiteMapUrl | private static boolean hasSiteMapUrl(
final ServletContext servletContext,
final HttpServletRequest req,
final HttpServletResponse resp,
final SortedSet<View> views,
final Book book,
PageRef pageRef
) throws ServletException, IOException {
Boolean result = CapturePage.traversePagesAnyOrder(
servletCon... | java | private static boolean hasSiteMapUrl(
final ServletContext servletContext,
final HttpServletRequest req,
final HttpServletResponse resp,
final SortedSet<View> views,
final Book book,
PageRef pageRef
) throws ServletException, IOException {
Boolean result = CapturePage.traversePagesAnyOrder(
servletCon... | [
"private",
"static",
"boolean",
"hasSiteMapUrl",
"(",
"final",
"ServletContext",
"servletContext",
",",
"final",
"HttpServletRequest",
"req",
",",
"final",
"HttpServletResponse",
"resp",
",",
"final",
"SortedSet",
"<",
"View",
">",
"views",
",",
"final",
"Book",
"... | Checks if the sitemap has at least one page.
This version implemented as a traversal. | [
"Checks",
"if",
"the",
"sitemap",
"has",
"at",
"least",
"one",
"page",
".",
"This",
"version",
"implemented",
"as",
"a",
"traversal",
"."
] | 564f77bc8b14572942903126dfd99e400bc11f85 | https://github.com/aoindustries/semanticcms-core-sitemap/blob/564f77bc8b14572942903126dfd99e400bc11f85/src/main/java/com/semanticcms/core/sitemap/SiteMapIndexServlet.java#L378-L422 | train |
bremersee/sms | src/main/java/org/bremersee/sms/GoyyaSmsService.java | GoyyaSmsService.getMessageType | protected String getMessageType(final String message) {
if (StringUtils.isBlank(defaultMessageType) || MESSAGE_TYPE_TEXT_VALUE
.equalsIgnoreCase(defaultMessageType)
|| MESSAGE_TYPE_LONG_TEXT_VALUE.equalsIgnoreCase(defaultMessageType)) {
return message.length() > getMaxLengthOfOneSms() ? MESSAG... | java | protected String getMessageType(final String message) {
if (StringUtils.isBlank(defaultMessageType) || MESSAGE_TYPE_TEXT_VALUE
.equalsIgnoreCase(defaultMessageType)
|| MESSAGE_TYPE_LONG_TEXT_VALUE.equalsIgnoreCase(defaultMessageType)) {
return message.length() > getMaxLengthOfOneSms() ? MESSAG... | [
"protected",
"String",
"getMessageType",
"(",
"final",
"String",
"message",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"defaultMessageType",
")",
"||",
"MESSAGE_TYPE_TEXT_VALUE",
".",
"equalsIgnoreCase",
"(",
"defaultMessageType",
")",
"||",
"MESSAGE_T... | Returns the message type.
@param message the message
@return the message type | [
"Returns",
"the",
"message",
"type",
"."
] | 4e5e87ea98616dd316573b544f54cac56750d2f9 | https://github.com/bremersee/sms/blob/4e5e87ea98616dd316573b544f54cac56750d2f9/src/main/java/org/bremersee/sms/GoyyaSmsService.java#L376-L384 | train |
bremersee/sms | src/main/java/org/bremersee/sms/GoyyaSmsService.java | GoyyaSmsService.createSendTime | protected String createSendTime(final Date sendTime) {
if (sendTime == null || new Date(System.currentTimeMillis() + 1000L * 60L).after(sendTime)) {
return null;
}
String customSendTimePattern =
StringUtils.isBlank(this.sendTimePattern) ? DEFAULT_SEND_TIME_PATTERN
: this.sendTimePa... | java | protected String createSendTime(final Date sendTime) {
if (sendTime == null || new Date(System.currentTimeMillis() + 1000L * 60L).after(sendTime)) {
return null;
}
String customSendTimePattern =
StringUtils.isBlank(this.sendTimePattern) ? DEFAULT_SEND_TIME_PATTERN
: this.sendTimePa... | [
"protected",
"String",
"createSendTime",
"(",
"final",
"Date",
"sendTime",
")",
"{",
"if",
"(",
"sendTime",
"==",
"null",
"||",
"new",
"Date",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"1000L",
"*",
"60L",
")",
".",
"after",
"(",
"sendTime"... | Creates the send time URL parameter value.
@param sendTime the send time as {@link Date}
@return the send time URL parameter value | [
"Creates",
"the",
"send",
"time",
"URL",
"parameter",
"value",
"."
] | 4e5e87ea98616dd316573b544f54cac56750d2f9 | https://github.com/bremersee/sms/blob/4e5e87ea98616dd316573b544f54cac56750d2f9/src/main/java/org/bremersee/sms/GoyyaSmsService.java#L392-L402 | train |
bremersee/sms | src/main/java/org/bremersee/sms/GoyyaSmsService.java | GoyyaSmsService.createTrustAllManagers | protected TrustManager[] createTrustAllManagers() {
return new TrustManager[]{
new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] certs, ... | java | protected TrustManager[] createTrustAllManagers() {
return new TrustManager[]{
new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] certs, ... | [
"protected",
"TrustManager",
"[",
"]",
"createTrustAllManagers",
"(",
")",
"{",
"return",
"new",
"TrustManager",
"[",
"]",
"{",
"new",
"X509TrustManager",
"(",
")",
"{",
"@",
"Override",
"public",
"X509Certificate",
"[",
"]",
"getAcceptedIssuers",
"(",
")",
"{... | Creates an array of trust managers which trusts all X509 certificates.
@return the trust manager [ ] | [
"Creates",
"an",
"array",
"of",
"trust",
"managers",
"which",
"trusts",
"all",
"X509",
"certificates",
"."
] | 4e5e87ea98616dd316573b544f54cac56750d2f9 | https://github.com/bremersee/sms/blob/4e5e87ea98616dd316573b544f54cac56750d2f9/src/main/java/org/bremersee/sms/GoyyaSmsService.java#L464-L482 | train |
bremersee/sms | src/main/java/org/bremersee/sms/GoyyaSmsService.java | GoyyaSmsService.encode | private String encode(final String value, final Charset charset) {
if (StringUtils.isBlank(value)) {
return "";
}
try {
return URLEncoder.encode(value, charset.name());
} catch (UnsupportedEncodingException e) {
return value;
}
} | java | private String encode(final String value, final Charset charset) {
if (StringUtils.isBlank(value)) {
return "";
}
try {
return URLEncoder.encode(value, charset.name());
} catch (UnsupportedEncodingException e) {
return value;
}
} | [
"private",
"String",
"encode",
"(",
"final",
"String",
"value",
",",
"final",
"Charset",
"charset",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"value",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"try",
"{",
"return",
"URLEncoder",
".",
"e... | Encode query parameter.
@param value the parameter value
@param charset the charset
@return the encoded parameter value | [
"Encode",
"query",
"parameter",
"."
] | 4e5e87ea98616dd316573b544f54cac56750d2f9 | https://github.com/bremersee/sms/blob/4e5e87ea98616dd316573b544f54cac56750d2f9/src/main/java/org/bremersee/sms/GoyyaSmsService.java#L491-L501 | train |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java | SourceMapGenerator.fromSourceMap | public static SourceMapGenerator fromSourceMap(SourceMapConsumer aSourceMapConsumer) {
String sourceRoot = aSourceMapConsumer.sourceRoot;
SourceMapGenerator generator = new SourceMapGenerator(aSourceMapConsumer.file, sourceRoot);
aSourceMapConsumer.eachMapping().forEach(mapping -> {
... | java | public static SourceMapGenerator fromSourceMap(SourceMapConsumer aSourceMapConsumer) {
String sourceRoot = aSourceMapConsumer.sourceRoot;
SourceMapGenerator generator = new SourceMapGenerator(aSourceMapConsumer.file, sourceRoot);
aSourceMapConsumer.eachMapping().forEach(mapping -> {
... | [
"public",
"static",
"SourceMapGenerator",
"fromSourceMap",
"(",
"SourceMapConsumer",
"aSourceMapConsumer",
")",
"{",
"String",
"sourceRoot",
"=",
"aSourceMapConsumer",
".",
"sourceRoot",
";",
"SourceMapGenerator",
"generator",
"=",
"new",
"SourceMapGenerator",
"(",
"aSour... | Creates a new SourceMapGenerator based on a SourceMapConsumer
@param aSourceMapConsumer
The SourceMap. | [
"Creates",
"a",
"new",
"SourceMapGenerator",
"based",
"on",
"a",
"SourceMapConsumer"
] | 361a99c73d51c11afa5579dd83d477c4d0345599 | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java#L57-L81 | train |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java | SourceMapGenerator.setSourceContent | public void setSourceContent(String aSourceFile, String aSourceContent) {
String source = aSourceFile;
if (this._sourceRoot != null) {
source = Util.relative(this._sourceRoot, source);
}
if (aSourceContent != null) {
// Add the source content to the _sourcesConte... | java | public void setSourceContent(String aSourceFile, String aSourceContent) {
String source = aSourceFile;
if (this._sourceRoot != null) {
source = Util.relative(this._sourceRoot, source);
}
if (aSourceContent != null) {
// Add the source content to the _sourcesConte... | [
"public",
"void",
"setSourceContent",
"(",
"String",
"aSourceFile",
",",
"String",
"aSourceContent",
")",
"{",
"String",
"source",
"=",
"aSourceFile",
";",
"if",
"(",
"this",
".",
"_sourceRoot",
"!=",
"null",
")",
"{",
"source",
"=",
"Util",
".",
"relative",... | Set the source content for a source file. | [
"Set",
"the",
"source",
"content",
"for",
"a",
"source",
"file",
"."
] | 361a99c73d51c11afa5579dd83d477c4d0345599 | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java#L111-L132 | train |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java | SourceMapGenerator.serializeMappings | private String serializeMappings() {
int previousGeneratedColumn = 0;
int previousGeneratedLine = 1;
int previousOriginalColumn = 0;
int previousOriginalLine = 0;
int previousName = 0;
int previousSource = 0;
String result = "";
Mapping mapping;
in... | java | private String serializeMappings() {
int previousGeneratedColumn = 0;
int previousGeneratedLine = 1;
int previousOriginalColumn = 0;
int previousOriginalLine = 0;
int previousName = 0;
int previousSource = 0;
String result = "";
Mapping mapping;
in... | [
"private",
"String",
"serializeMappings",
"(",
")",
"{",
"int",
"previousGeneratedColumn",
"=",
"0",
";",
"int",
"previousGeneratedLine",
"=",
"1",
";",
"int",
"previousOriginalColumn",
"=",
"0",
";",
"int",
"previousOriginalLine",
"=",
"0",
";",
"int",
"previou... | Serialize the accumulated mappings in to the stream of base 64 VLQs specified by the source map format. | [
"Serialize",
"the",
"accumulated",
"mappings",
"in",
"to",
"the",
"stream",
"of",
"base",
"64",
"VLQs",
"specified",
"by",
"the",
"source",
"map",
"format",
"."
] | 361a99c73d51c11afa5579dd83d477c4d0345599 | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java#L221-L275 | train |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java | SourceMapGenerator.toJSON | public SourceMap toJSON() {
SourceMap map = new SourceMap();
map.version = this._version;
map.sources = this._sources.toArray();
map.names = this._names.toArray();
map.mappings = serializeMappings();
map.file = this._file;
map.sourceRoot = this._sourceRoot;
... | java | public SourceMap toJSON() {
SourceMap map = new SourceMap();
map.version = this._version;
map.sources = this._sources.toArray();
map.names = this._names.toArray();
map.mappings = serializeMappings();
map.file = this._file;
map.sourceRoot = this._sourceRoot;
... | [
"public",
"SourceMap",
"toJSON",
"(",
")",
"{",
"SourceMap",
"map",
"=",
"new",
"SourceMap",
"(",
")",
";",
"map",
".",
"version",
"=",
"this",
".",
"_version",
";",
"map",
".",
"sources",
"=",
"this",
".",
"_sources",
".",
"toArray",
"(",
")",
";",
... | Externalize the source map. | [
"Externalize",
"the",
"source",
"map",
"."
] | 361a99c73d51c11afa5579dd83d477c4d0345599 | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java#L292-L304 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/cache/BackgroundCache.java | BackgroundCache.get | public Result<V,E> get(
K key,
Refresher<? super K,? extends V,? extends E> refresher
) {
Result<V,E> result = get(key);
if(result == null) result = put(key, refresher);
return result;
} | java | public Result<V,E> get(
K key,
Refresher<? super K,? extends V,? extends E> refresher
) {
Result<V,E> result = get(key);
if(result == null) result = put(key, refresher);
return result;
} | [
"public",
"Result",
"<",
"V",
",",
"E",
">",
"get",
"(",
"K",
"key",
",",
"Refresher",
"<",
"?",
"super",
"K",
",",
"?",
"extends",
"V",
",",
"?",
"extends",
"E",
">",
"refresher",
")",
"{",
"Result",
"<",
"V",
",",
"E",
">",
"result",
"=",
"... | Gets the value if currently in the cache. If not,
Runs the refresher immediately to obtain the result, then
places an entry into the cache.
@return The result obtained from either the cache or this refresher
@see #get(java.lang.Object)
@see #put(java.lang.Object, com.aoindustries.cache.BackgroundCache.Refresher) | [
"Gets",
"the",
"value",
"if",
"currently",
"in",
"the",
"cache",
".",
"If",
"not",
"Runs",
"the",
"refresher",
"immediately",
"to",
"obtain",
"the",
"result",
"then",
"places",
"an",
"entry",
"into",
"the",
"cache",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/cache/BackgroundCache.java#L288-L295 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/cache/BackgroundCache.java | BackgroundCache.get | public Result<V,E> get(K key) {
CacheEntry entry = map.get(key);
if(entry == null) {
return null;
} else {
return entry.getResult();
}
} | java | public Result<V,E> get(K key) {
CacheEntry entry = map.get(key);
if(entry == null) {
return null;
} else {
return entry.getResult();
}
} | [
"public",
"Result",
"<",
"V",
",",
"E",
">",
"get",
"(",
"K",
"key",
")",
"{",
"CacheEntry",
"entry",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"entry",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
... | Gets a cached result for the given key, null if not cached.
Extends the expiration of the cache entry. | [
"Gets",
"a",
"cached",
"result",
"for",
"the",
"given",
"key",
"null",
"if",
"not",
"cached",
".",
"Extends",
"the",
"expiration",
"of",
"the",
"cache",
"entry",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/cache/BackgroundCache.java#L301-L308 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/cache/BackgroundCache.java | BackgroundCache.put | public Result<V,E> put(
K key,
Refresher<? super K,? extends V,? extends E> refresher
) {
Result<V,E> result = runRefresher(refresher, key);
put(key, refresher, result);
return result;
} | java | public Result<V,E> put(
K key,
Refresher<? super K,? extends V,? extends E> refresher
) {
Result<V,E> result = runRefresher(refresher, key);
put(key, refresher, result);
return result;
} | [
"public",
"Result",
"<",
"V",
",",
"E",
">",
"put",
"(",
"K",
"key",
",",
"Refresher",
"<",
"?",
"super",
"K",
",",
"?",
"extends",
"V",
",",
"?",
"extends",
"E",
">",
"refresher",
")",
"{",
"Result",
"<",
"V",
",",
"E",
">",
"result",
"=",
"... | Runs the refresher immediately to obtain the result, then
places an entry into the cache, replacing any existing entry under this key.
@return The result obtained from this refresher | [
"Runs",
"the",
"refresher",
"immediately",
"to",
"obtain",
"the",
"result",
"then",
"places",
"an",
"entry",
"into",
"the",
"cache",
"replacing",
"any",
"existing",
"entry",
"under",
"this",
"key",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/cache/BackgroundCache.java#L333-L340 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/cache/BackgroundCache.java | BackgroundCache.put | public void put(
K key,
Refresher<? super K,? extends V,? extends E> refresher,
V value
) {
put(key, refresher, new Result<V,E>(value));
} | java | public void put(
K key,
Refresher<? super K,? extends V,? extends E> refresher,
V value
) {
put(key, refresher, new Result<V,E>(value));
} | [
"public",
"void",
"put",
"(",
"K",
"key",
",",
"Refresher",
"<",
"?",
"super",
"K",
",",
"?",
"extends",
"V",
",",
"?",
"extends",
"E",
">",
"refresher",
",",
"V",
"value",
")",
"{",
"put",
"(",
"key",
",",
"refresher",
",",
"new",
"Result",
"<",... | Places a result into the cache, replacing any existing entry under this key. | [
"Places",
"a",
"result",
"into",
"the",
"cache",
"replacing",
"any",
"existing",
"entry",
"under",
"this",
"key",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/cache/BackgroundCache.java#L345-L351 | train |
aoindustries/semanticcms-core-taglib | src/main/java/com/semanticcms/core/taglib/NavigationTreeTag.java | NavigationTreeTag.doTag | @Override
public void doTag() throws JspTagException, IOException {
try {
final PageContext pageContext = (PageContext)getJspContext();
NavigationTreeRenderer.writeNavigationTree(
pageContext.getServletContext(),
pageContext.getELContext(),
(HttpServletRequest)pageContext.getRequest(),
(HttpSer... | java | @Override
public void doTag() throws JspTagException, IOException {
try {
final PageContext pageContext = (PageContext)getJspContext();
NavigationTreeRenderer.writeNavigationTree(
pageContext.getServletContext(),
pageContext.getELContext(),
(HttpServletRequest)pageContext.getRequest(),
(HttpSer... | [
"@",
"Override",
"public",
"void",
"doTag",
"(",
")",
"throws",
"JspTagException",
",",
"IOException",
"{",
"try",
"{",
"final",
"PageContext",
"pageContext",
"=",
"(",
"PageContext",
")",
"getJspContext",
"(",
")",
";",
"NavigationTreeRenderer",
".",
"writeNavi... | Creates the nested <ul> and <li> tags used by TreeView.
The first level is expanded.
<a href="http://developer.yahoo.com/yui/treeview/#start">http://developer.yahoo.com/yui/treeview/#start</a> | [
"Creates",
"the",
"nested",
"<",
";",
"ul>",
";",
"and",
"<",
";",
"li>",
";",
"tags",
"used",
"by",
"TreeView",
".",
"The",
"first",
"level",
"is",
"expanded",
"."
] | 2e6c5dd3b1299c6cc6a87a335302460c5c69c539 | https://github.com/aoindustries/semanticcms-core-taglib/blob/2e6c5dd3b1299c6cc6a87a335302460c5c69c539/src/main/java/com/semanticcms/core/taglib/NavigationTreeTag.java#L103-L129 | train |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/BasicSourceMapConsumer.java | BasicSourceMapConsumer.fromSourceMap | public static BasicSourceMapConsumer fromSourceMap(SourceMapGenerator aSourceMap) {
BasicSourceMapConsumer smc = new BasicSourceMapConsumer();
ArraySet<String> names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
ArraySet<String> sources = smc._sources = ArraySet.fromArra... | java | public static BasicSourceMapConsumer fromSourceMap(SourceMapGenerator aSourceMap) {
BasicSourceMapConsumer smc = new BasicSourceMapConsumer();
ArraySet<String> names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
ArraySet<String> sources = smc._sources = ArraySet.fromArra... | [
"public",
"static",
"BasicSourceMapConsumer",
"fromSourceMap",
"(",
"SourceMapGenerator",
"aSourceMap",
")",
"{",
"BasicSourceMapConsumer",
"smc",
"=",
"new",
"BasicSourceMapConsumer",
"(",
")",
";",
"ArraySet",
"<",
"String",
">",
"names",
"=",
"smc",
".",
"_names"... | Create a BasicSourceMapConsumer from a SourceMapGenerator.
@param SourceMapGenerator
aSourceMap The source map that will be consumed.
@returns BasicSourceMapConsumer | [
"Create",
"a",
"BasicSourceMapConsumer",
"from",
"a",
"SourceMapGenerator",
"."
] | 361a99c73d51c11afa5579dd83d477c4d0345599 | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/BasicSourceMapConsumer.java#L115-L155 | train |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/BasicSourceMapConsumer.java | BasicSourceMapConsumer.computeColumnSpans | void computeColumnSpans() {
for (int index = 0; index < _generatedMappings().size(); ++index) {
ParsedMapping mapping = _generatedMappings().get(index);
// Mappings do not contain a field for the last generated columnt. We
// can come up with an optimistic estimate, however,... | java | void computeColumnSpans() {
for (int index = 0; index < _generatedMappings().size(); ++index) {
ParsedMapping mapping = _generatedMappings().get(index);
// Mappings do not contain a field for the last generated columnt. We
// can come up with an optimistic estimate, however,... | [
"void",
"computeColumnSpans",
"(",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"_generatedMappings",
"(",
")",
".",
"size",
"(",
")",
";",
"++",
"index",
")",
"{",
"ParsedMapping",
"mapping",
"=",
"_generatedMappings",
"(",
")",
... | Compute the last column for each generated mapping. The last column is inclusive. | [
"Compute",
"the",
"last",
"column",
"for",
"each",
"generated",
"mapping",
".",
"The",
"last",
"column",
"is",
"inclusive",
"."
] | 361a99c73d51c11afa5579dd83d477c4d0345599 | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/BasicSourceMapConsumer.java#L280-L300 | train |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/BasicSourceMapConsumer.java | BasicSourceMapConsumer.hasContentsOfAllSources | @Override
public boolean hasContentsOfAllSources() {
if (sourcesContent == null) {
return false;
}
return this.sourcesContent.size() >= this._sources.size() && !this.sourcesContent.stream().anyMatch(sc -> sc == null);
} | java | @Override
public boolean hasContentsOfAllSources() {
if (sourcesContent == null) {
return false;
}
return this.sourcesContent.size() >= this._sources.size() && !this.sourcesContent.stream().anyMatch(sc -> sc == null);
} | [
"@",
"Override",
"public",
"boolean",
"hasContentsOfAllSources",
"(",
")",
"{",
"if",
"(",
"sourcesContent",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"this",
".",
"sourcesContent",
".",
"size",
"(",
")",
">=",
"this",
".",
"_sources",... | Return true if we have the source content for every source in the source map, false otherwise. | [
"Return",
"true",
"if",
"we",
"have",
"the",
"source",
"content",
"for",
"every",
"source",
"in",
"the",
"source",
"map",
"false",
"otherwise",
"."
] | 361a99c73d51c11afa5579dd83d477c4d0345599 | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/BasicSourceMapConsumer.java#L358-L364 | train |
probedock/probedock-java | src/main/java/io/probedock/client/common/model/v1/ModelFactory.java | ModelFactory.createFingerprint | public static String createFingerprint(Class cl, Method m) {
return FingerprintGenerator.fingerprint(cl, m);
} | java | public static String createFingerprint(Class cl, Method m) {
return FingerprintGenerator.fingerprint(cl, m);
} | [
"public",
"static",
"String",
"createFingerprint",
"(",
"Class",
"cl",
",",
"Method",
"m",
")",
"{",
"return",
"FingerprintGenerator",
".",
"fingerprint",
"(",
"cl",
",",
"m",
")",
";",
"}"
] | Create fingerprint for java test method
@param cl The test class
@param m The test method
@return The fingerprint generated | [
"Create",
"fingerprint",
"for",
"java",
"test",
"method"
] | 92ee6634ba4fe3fdffeb4e202f5372ef947a67c3 | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/common/model/v1/ModelFactory.java#L32-L34 | train |
probedock/probedock-java | src/main/java/io/probedock/client/common/model/v1/ModelFactory.java | ModelFactory.enrichContext | public static void enrichContext(Context context) {
context.setPostProperty(Context.MEMORY_TOTAL, Runtime.getRuntime().totalMemory());
context.setPostProperty(Context.MEMORY_FREE, Runtime.getRuntime().freeMemory());
context.setPostProperty(Context.MEMORY_USED, Runtime.getRuntime().totalMemory() - Runtime.getRunti... | java | public static void enrichContext(Context context) {
context.setPostProperty(Context.MEMORY_TOTAL, Runtime.getRuntime().totalMemory());
context.setPostProperty(Context.MEMORY_FREE, Runtime.getRuntime().freeMemory());
context.setPostProperty(Context.MEMORY_USED, Runtime.getRuntime().totalMemory() - Runtime.getRunti... | [
"public",
"static",
"void",
"enrichContext",
"(",
"Context",
"context",
")",
"{",
"context",
".",
"setPostProperty",
"(",
"Context",
".",
"MEMORY_TOTAL",
",",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"totalMemory",
"(",
")",
")",
";",
"context",
".",
"... | Enrich a context | [
"Enrich",
"a",
"context"
] | 92ee6634ba4fe3fdffeb4e202f5372ef947a67c3 | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/common/model/v1/ModelFactory.java#L100-L104 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/version/PropertiesVersions.java | PropertiesVersions.getVersion | public Version getVersion(String product) throws IllegalArgumentException {
String three = properties.getProperty(product);
if(three==null) throw new IllegalArgumentException(accessor.getMessage("PropertiesVersions.getVersion.productNotFound", product));
return Version.valueOf(three+"."+getBuild());
} | java | public Version getVersion(String product) throws IllegalArgumentException {
String three = properties.getProperty(product);
if(three==null) throw new IllegalArgumentException(accessor.getMessage("PropertiesVersions.getVersion.productNotFound", product));
return Version.valueOf(three+"."+getBuild());
} | [
"public",
"Version",
"getVersion",
"(",
"String",
"product",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"three",
"=",
"properties",
".",
"getProperty",
"(",
"product",
")",
";",
"if",
"(",
"three",
"==",
"null",
")",
"throw",
"new",
"IllegalArgu... | Gets the version number for the provided product. | [
"Gets",
"the",
"version",
"number",
"for",
"the",
"provided",
"product",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/version/PropertiesVersions.java#L73-L77 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/version/PropertiesVersions.java | PropertiesVersions.getBuild | public int getBuild() throws IllegalArgumentException {
String build = properties.getProperty("build.number");
if(build==null) throw new IllegalArgumentException(accessor.getMessage("PropertiesVersions.getVersion.buildNotFound"));
return Integer.parseInt(build);
} | java | public int getBuild() throws IllegalArgumentException {
String build = properties.getProperty("build.number");
if(build==null) throw new IllegalArgumentException(accessor.getMessage("PropertiesVersions.getVersion.buildNotFound"));
return Integer.parseInt(build);
} | [
"public",
"int",
"getBuild",
"(",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"build",
"=",
"properties",
".",
"getProperty",
"(",
"\"build.number\"",
")",
";",
"if",
"(",
"build",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",... | Gets the build number that is applied to all products. | [
"Gets",
"the",
"build",
"number",
"that",
"is",
"applied",
"to",
"all",
"products",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/version/PropertiesVersions.java#L82-L86 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/io/FilesystemIterator.java | FilesystemIterator.getNextFiles | public int getNextFiles(final File[] files, final int batchSize) throws IOException {
int c=0;
while(c<batchSize) {
File file=getNextFile();
if(file==null) break;
files[c++]=file;
}
return c;
} | java | public int getNextFiles(final File[] files, final int batchSize) throws IOException {
int c=0;
while(c<batchSize) {
File file=getNextFile();
if(file==null) break;
files[c++]=file;
}
return c;
} | [
"public",
"int",
"getNextFiles",
"(",
"final",
"File",
"[",
"]",
"files",
",",
"final",
"int",
"batchSize",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"0",
";",
"while",
"(",
"c",
"<",
"batchSize",
")",
"{",
"File",
"file",
"=",
"getNextFile",... | Gets the next files, up to batchSize.
@return the number of files in the array, zero (0) indicates iteration has completed
@throws java.io.IOException | [
"Gets",
"the",
"next",
"files",
"up",
"to",
"batchSize",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/FilesystemIterator.java#L260-L268 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/io/FilesystemIterator.java | FilesystemIterator.isFilesystemRoot | protected boolean isFilesystemRoot(String filename) throws IOException {
String[] roots=getFilesystemRoots();
for(int c=0, len=roots.length;c<len;c++) {
if(roots[c].equals(filename)) return true;
}
return false;
} | java | protected boolean isFilesystemRoot(String filename) throws IOException {
String[] roots=getFilesystemRoots();
for(int c=0, len=roots.length;c<len;c++) {
if(roots[c].equals(filename)) return true;
}
return false;
} | [
"protected",
"boolean",
"isFilesystemRoot",
"(",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"roots",
"=",
"getFilesystemRoots",
"(",
")",
";",
"for",
"(",
"int",
"c",
"=",
"0",
",",
"len",
"=",
"roots",
".",
"length",
";... | Determines if a path is a possible file system root | [
"Determines",
"if",
"a",
"path",
"is",
"a",
"possible",
"file",
"system",
"root"
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/FilesystemIterator.java#L293-L299 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/io/FilesystemIterator.java | FilesystemIterator.getBestRule | private FilesystemIteratorRule getBestRule(final String filename) {
String longestPrefix = null;
FilesystemIteratorRule rule = null;
// First search the path and all of its parents for the first regular rule
String path = filename;
while(true) {
// Check the current path for an exact match
//System.out.... | java | private FilesystemIteratorRule getBestRule(final String filename) {
String longestPrefix = null;
FilesystemIteratorRule rule = null;
// First search the path and all of its parents for the first regular rule
String path = filename;
while(true) {
// Check the current path for an exact match
//System.out.... | [
"private",
"FilesystemIteratorRule",
"getBestRule",
"(",
"final",
"String",
"filename",
")",
"{",
"String",
"longestPrefix",
"=",
"null",
";",
"FilesystemIteratorRule",
"rule",
"=",
"null",
";",
"// First search the path and all of its parents for the first regular rule",
"St... | Gets the rule that best suits the provided filename. The rule is the longer
rule between the regular rules and the prefix rules.
The regular rules are scanned first by looking through the filename and then
all parents up to the root for the first match. These use Map lookups in the
set of rules so this should still ... | [
"Gets",
"the",
"rule",
"that",
"best",
"suits",
"the",
"provided",
"filename",
".",
"The",
"rule",
"is",
"the",
"longer",
"rule",
"between",
"the",
"regular",
"rules",
"and",
"the",
"prefix",
"rules",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/FilesystemIterator.java#L326-L372 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/ServletContextCache.java | ServletContextCache.getCache | public static ServletContextCache getCache(ServletContext servletContext) {
ServletContextCache cache = (ServletContextCache)servletContext.getAttribute(ATTRIBUTE_KEY);
if(cache == null) {
// It is possible this is called during context initialization before the listener
cache = new ServletContextCache(servle... | java | public static ServletContextCache getCache(ServletContext servletContext) {
ServletContextCache cache = (ServletContextCache)servletContext.getAttribute(ATTRIBUTE_KEY);
if(cache == null) {
// It is possible this is called during context initialization before the listener
cache = new ServletContextCache(servle... | [
"public",
"static",
"ServletContextCache",
"getCache",
"(",
"ServletContext",
"servletContext",
")",
"{",
"ServletContextCache",
"cache",
"=",
"(",
"ServletContextCache",
")",
"servletContext",
".",
"getAttribute",
"(",
"ATTRIBUTE_KEY",
")",
";",
"if",
"(",
"cache",
... | Gets or creates the cache for the provided servlet context. | [
"Gets",
"or",
"creates",
"the",
"cache",
"for",
"the",
"provided",
"servlet",
"context",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/ServletContextCache.java#L52-L63 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/ServletContextCache.java | ServletContextCache.getResource | public URL getResource(String path) throws MalformedURLException {
Result<URL,MalformedURLException> result = getResourceCache.get(path, getResourceRefresher);
MalformedURLException exception = result.getException();
if(exception != null) throw exception;
return result.getValue();
} | java | public URL getResource(String path) throws MalformedURLException {
Result<URL,MalformedURLException> result = getResourceCache.get(path, getResourceRefresher);
MalformedURLException exception = result.getException();
if(exception != null) throw exception;
return result.getValue();
} | [
"public",
"URL",
"getResource",
"(",
"String",
"path",
")",
"throws",
"MalformedURLException",
"{",
"Result",
"<",
"URL",
",",
"MalformedURLException",
">",
"result",
"=",
"getResourceCache",
".",
"get",
"(",
"path",
",",
"getResourceRefresher",
")",
";",
"Malfo... | Gets the possibly cached URL. This URL is not copied and caller should not fiddle with
its state. Thank you Java for this not being immutable.
@see ServletContext#getResource(java.lang.String) | [
"Gets",
"the",
"possibly",
"cached",
"URL",
".",
"This",
"URL",
"is",
"not",
"copied",
"and",
"caller",
"should",
"not",
"fiddle",
"with",
"its",
"state",
".",
"Thank",
"you",
"Java",
"for",
"this",
"not",
"being",
"immutable",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/ServletContextCache.java#L98-L103 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/SortedIntArrayList.java | SortedIntArrayList.binarySearch | protected int binarySearch(int value) {
int left = 0;
int right = size-1;
while(left <= right) {
int mid = (left + right)>>1;
int midValue = elementData[mid];
if(value==midValue) return mid;
if(value<midValue) right = mid-1;
else left = mid+1;
}
return -(left+1);
} | java | protected int binarySearch(int value) {
int left = 0;
int right = size-1;
while(left <= right) {
int mid = (left + right)>>1;
int midValue = elementData[mid];
if(value==midValue) return mid;
if(value<midValue) right = mid-1;
else left = mid+1;
}
return -(left+1);
} | [
"protected",
"int",
"binarySearch",
"(",
"int",
"value",
")",
"{",
"int",
"left",
"=",
"0",
";",
"int",
"right",
"=",
"size",
"-",
"1",
";",
"while",
"(",
"left",
"<=",
"right",
")",
"{",
"int",
"mid",
"=",
"(",
"left",
"+",
"right",
")",
">>",
... | Performs a binary search for the provide value.
It will return any matching element, not necessarily
the first or the last. | [
"Performs",
"a",
"binary",
"search",
"for",
"the",
"provide",
"value",
".",
"It",
"will",
"return",
"any",
"matching",
"element",
"not",
"necessarily",
"the",
"first",
"or",
"the",
"last",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/SortedIntArrayList.java#L62-L73 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/SortedIntArrayList.java | SortedIntArrayList.indexOf | @Override
public int indexOf(int elem) {
// Find the location to insert the object at
int pos=binarySearch(elem);
// Not found
if(pos<0) return -1;
// Found one, iterate backwards to the first one
while(pos>0 && elementData[pos-1]==elem) pos--;
return pos;
} | java | @Override
public int indexOf(int elem) {
// Find the location to insert the object at
int pos=binarySearch(elem);
// Not found
if(pos<0) return -1;
// Found one, iterate backwards to the first one
while(pos>0 && elementData[pos-1]==elem) pos--;
return pos;
} | [
"@",
"Override",
"public",
"int",
"indexOf",
"(",
"int",
"elem",
")",
"{",
"// Find the location to insert the object at",
"int",
"pos",
"=",
"binarySearch",
"(",
"elem",
")",
";",
"// Not found",
"if",
"(",
"pos",
"<",
"0",
")",
"return",
"-",
"1",
";",
"... | Searches for the first occurrence of the given value.
@param elem the value
@return the index of the first occurrence of the argument in this
list; returns <tt>-1</tt> if the object is not found. | [
"Searches",
"for",
"the",
"first",
"occurrence",
"of",
"the",
"given",
"value",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/SortedIntArrayList.java#L82-L93 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/SortedIntArrayList.java | SortedIntArrayList.add | @Override
public boolean add(int o) {
// Shortcut for empty
int mySize=size();
if(mySize==0) {
super.add(o);
} else {
// Shortcut for adding to end (makes imports of already-sorted data operate at constant-time instead of logarithmic complexity)
if(o>=elementData[mySize-1]) {
super.add(o);
} el... | java | @Override
public boolean add(int o) {
// Shortcut for empty
int mySize=size();
if(mySize==0) {
super.add(o);
} else {
// Shortcut for adding to end (makes imports of already-sorted data operate at constant-time instead of logarithmic complexity)
if(o>=elementData[mySize-1]) {
super.add(o);
} el... | [
"@",
"Override",
"public",
"boolean",
"add",
"(",
"int",
"o",
")",
"{",
"// Shortcut for empty",
"int",
"mySize",
"=",
"size",
"(",
")",
";",
"if",
"(",
"mySize",
"==",
"0",
")",
"{",
"super",
".",
"add",
"(",
"o",
")",
";",
"}",
"else",
"{",
"//... | Adds the specified element in sorted position within this list.
@param o element to be appended to this list.
@return <tt>true</tt> (as per the general contract of Collection.add). | [
"Adds",
"the",
"specified",
"element",
"in",
"sorted",
"position",
"within",
"this",
"list",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/SortedIntArrayList.java#L130-L153 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/SortedIntArrayList.java | SortedIntArrayList.addAll | @Override
public boolean addAll(Collection<? extends Integer> c) {
Iterator<? extends Integer> iter=c.iterator();
boolean didOne=false;
while(iter.hasNext()) {
add(iter.next().intValue());
didOne=true;
}
return didOne;
} | java | @Override
public boolean addAll(Collection<? extends Integer> c) {
Iterator<? extends Integer> iter=c.iterator();
boolean didOne=false;
while(iter.hasNext()) {
add(iter.next().intValue());
didOne=true;
}
return didOne;
} | [
"@",
"Override",
"public",
"boolean",
"addAll",
"(",
"Collection",
"<",
"?",
"extends",
"Integer",
">",
"c",
")",
"{",
"Iterator",
"<",
"?",
"extends",
"Integer",
">",
"iter",
"=",
"c",
".",
"iterator",
"(",
")",
";",
"boolean",
"didOne",
"=",
"false",... | Adds all of the elements in the specified Collection and sorts during
the add. This may operate slowly as it is the same as individual
calls to the add method. | [
"Adds",
"all",
"of",
"the",
"elements",
"in",
"the",
"specified",
"Collection",
"and",
"sorts",
"during",
"the",
"add",
".",
"This",
"may",
"operate",
"slowly",
"as",
"it",
"is",
"the",
"same",
"as",
"individual",
"calls",
"to",
"the",
"add",
"method",
"... | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/SortedIntArrayList.java#L188-L197 | train |
bremersee/sms | src/main/java/org/bremersee/sms/model/SmsSendResponseDto.java | SmsSendResponseDto.isSuccessfullySent | @XmlElement(name = "successfullySent", required = true)
@JsonProperty(value = "successfullySent", required = true)
public boolean isSuccessfullySent() {
return successfullySent;
} | java | @XmlElement(name = "successfullySent", required = true)
@JsonProperty(value = "successfullySent", required = true)
public boolean isSuccessfullySent() {
return successfullySent;
} | [
"@",
"XmlElement",
"(",
"name",
"=",
"\"successfullySent\"",
",",
"required",
"=",
"true",
")",
"@",
"JsonProperty",
"(",
"value",
"=",
"\"successfullySent\"",
",",
"required",
"=",
"true",
")",
"public",
"boolean",
"isSuccessfullySent",
"(",
")",
"{",
"return... | Is successfully sent boolean.
@return the boolean | [
"Is",
"successfully",
"sent",
"boolean",
"."
] | 4e5e87ea98616dd316573b544f54cac56750d2f9 | https://github.com/bremersee/sms/blob/4e5e87ea98616dd316573b544f54cac56750d2f9/src/main/java/org/bremersee/sms/model/SmsSendResponseDto.java#L136-L140 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/persistent/LargeMappedPersistentBuffer.java | LargeMappedPersistentBuffer.get | @Override
// @NotThreadSafe
public byte get(long position) throws IOException {
return mappedBuffers.get(getBufferNum(position)).get(getIndex(position));
} | java | @Override
// @NotThreadSafe
public byte get(long position) throws IOException {
return mappedBuffers.get(getBufferNum(position)).get(getIndex(position));
} | [
"@",
"Override",
"// @NotThreadSafe",
"public",
"byte",
"get",
"(",
"long",
"position",
")",
"throws",
"IOException",
"{",
"return",
"mappedBuffers",
".",
"get",
"(",
"getBufferNum",
"(",
"position",
")",
")",
".",
"get",
"(",
"getIndex",
"(",
"position",
")... | Gets a single byte from the buffer. | [
"Gets",
"a",
"single",
"byte",
"from",
"the",
"buffer",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/persistent/LargeMappedPersistentBuffer.java#L251-L255 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/Includer.java | Includer.dispatchInclude | public static void dispatchInclude(RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SkipPageException {
final boolean isOutmostInclude = request.getAttribute(IS_INCLUDED_REQUEST_ATTRIBUTE_NAME) == null;
if(logger.isLoggable(Level.FINE)) lo... | java | public static void dispatchInclude(RequestDispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SkipPageException {
final boolean isOutmostInclude = request.getAttribute(IS_INCLUDED_REQUEST_ATTRIBUTE_NAME) == null;
if(logger.isLoggable(Level.FINE)) lo... | [
"public",
"static",
"void",
"dispatchInclude",
"(",
"RequestDispatcher",
"dispatcher",
",",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
",",
"SkipPageException",
"{",
"final",
"boolean",
... | Performs the actual include, supporting propagation of SkipPageException and sendError. | [
"Performs",
"the",
"actual",
"include",
"supporting",
"propagation",
"of",
"SkipPageException",
"and",
"sendError",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/Includer.java#L82-L121 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/Includer.java | Includer.setLocation | public static void setLocation(HttpServletRequest request, HttpServletResponse response, String location) {
if(request.getAttribute(IS_INCLUDED_REQUEST_ATTRIBUTE_NAME) == null) {
// Not included, setHeader directly
response.setHeader("Location", location);
} else {
// Is included, set attribute so top leve... | java | public static void setLocation(HttpServletRequest request, HttpServletResponse response, String location) {
if(request.getAttribute(IS_INCLUDED_REQUEST_ATTRIBUTE_NAME) == null) {
// Not included, setHeader directly
response.setHeader("Location", location);
} else {
// Is included, set attribute so top leve... | [
"public",
"static",
"void",
"setLocation",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"location",
")",
"{",
"if",
"(",
"request",
".",
"getAttribute",
"(",
"IS_INCLUDED_REQUEST_ATTRIBUTE_NAME",
")",
"==",
"null",
")"... | Sets a Location header. When not in an included page, calls setHeader directly.
When inside of an include will set request attribute so outermost include can call setHeader. | [
"Sets",
"a",
"Location",
"header",
".",
"When",
"not",
"in",
"an",
"included",
"page",
"calls",
"setHeader",
"directly",
".",
"When",
"inside",
"of",
"an",
"include",
"will",
"set",
"request",
"attribute",
"so",
"outermost",
"include",
"can",
"call",
"setHea... | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/Includer.java#L127-L135 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/Includer.java | Includer.sendError | public static void sendError(HttpServletRequest request, HttpServletResponse response, int status, String message) throws IOException {
if(request.getAttribute(IS_INCLUDED_REQUEST_ATTRIBUTE_NAME) == null) {
// Not included, sendError directly
if(message == null) {
response.sendError(status);
} else {
... | java | public static void sendError(HttpServletRequest request, HttpServletResponse response, int status, String message) throws IOException {
if(request.getAttribute(IS_INCLUDED_REQUEST_ATTRIBUTE_NAME) == null) {
// Not included, sendError directly
if(message == null) {
response.sendError(status);
} else {
... | [
"public",
"static",
"void",
"sendError",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"int",
"status",
",",
"String",
"message",
")",
"throws",
"IOException",
"{",
"if",
"(",
"request",
".",
"getAttribute",
"(",
"IS_INCLUDED_R... | Sends an error. When not in an included page, calls sendError directly.
When inside of an include will set request attribute so outermost include can call sendError. | [
"Sends",
"an",
"error",
".",
"When",
"not",
"in",
"an",
"included",
"page",
"calls",
"sendError",
"directly",
".",
"When",
"inside",
"of",
"an",
"include",
"will",
"set",
"request",
"attribute",
"so",
"outermost",
"include",
"can",
"call",
"sendError",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/Includer.java#L141-L154 | train |
probedock/probedock-junit | src/main/java/io/probedock/client/junit/AbstractProbeListener.java | AbstractProbeListener.createAndlogStackTrace | protected String createAndlogStackTrace(Failure failure) {
StringBuilder sb = new StringBuilder();
if (failure.getMessage() != null && !failure.getMessage().isEmpty()) {
sb.append("Failure message: ").append(failure.getMessage());
}
if (failure.getException() != null) {
... | java | protected String createAndlogStackTrace(Failure failure) {
StringBuilder sb = new StringBuilder();
if (failure.getMessage() != null && !failure.getMessage().isEmpty()) {
sb.append("Failure message: ").append(failure.getMessage());
}
if (failure.getException() != null) {
... | [
"protected",
"String",
"createAndlogStackTrace",
"(",
"Failure",
"failure",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"failure",
".",
"getMessage",
"(",
")",
"!=",
"null",
"&&",
"!",
"failure",
".",
"getMessage",... | Build a stack trace string
@param failure The failure to get the exceptions and so on
@return The stack trace stringified | [
"Build",
"a",
"stack",
"trace",
"string"
] | a2163dfcb10e94f30d5cd20bca6c62e6e3cd1d46 | https://github.com/probedock/probedock-junit/blob/a2163dfcb10e94f30d5cd20bca6c62e6e3cd1d46/src/main/java/io/probedock/client/junit/AbstractProbeListener.java#L176-L210 | train |
probedock/probedock-junit | src/main/java/io/probedock/client/junit/AbstractProbeListener.java | AbstractProbeListener.getFingerprint | protected final String getFingerprint(Description description) {
return TestResultDataUtils.getFingerprint(description.getTestClass(), description.getMethodName());
} | java | protected final String getFingerprint(Description description) {
return TestResultDataUtils.getFingerprint(description.getTestClass(), description.getMethodName());
} | [
"protected",
"final",
"String",
"getFingerprint",
"(",
"Description",
"description",
")",
"{",
"return",
"TestResultDataUtils",
".",
"getFingerprint",
"(",
"description",
".",
"getTestClass",
"(",
")",
",",
"description",
".",
"getMethodName",
"(",
")",
")",
";",
... | Retrieve the fingerprint of a test based on its description
@param description The description
@return The fingerprint | [
"Retrieve",
"the",
"fingerprint",
"of",
"a",
"test",
"based",
"on",
"its",
"description"
] | a2163dfcb10e94f30d5cd20bca6c62e6e3cd1d46 | https://github.com/probedock/probedock-junit/blob/a2163dfcb10e94f30d5cd20bca6c62e6e3cd1d46/src/main/java/io/probedock/client/junit/AbstractProbeListener.java#L218-L220 | train |
probedock/probedock-junit | src/main/java/io/probedock/client/junit/AbstractProbeListener.java | AbstractProbeListener.getPackage | protected final String getPackage(Class cls) {
return cls.getPackage() != null ? cls.getPackage().getName() : "defaultPackage";
} | java | protected final String getPackage(Class cls) {
return cls.getPackage() != null ? cls.getPackage().getName() : "defaultPackage";
} | [
"protected",
"final",
"String",
"getPackage",
"(",
"Class",
"cls",
")",
"{",
"return",
"cls",
".",
"getPackage",
"(",
")",
"!=",
"null",
"?",
"cls",
".",
"getPackage",
"(",
")",
".",
"getName",
"(",
")",
":",
"\"defaultPackage\"",
";",
"}"
] | Retrieve the package name if available, if not, default package name is used.
@param cls The class to extract the package name
@return The package name if found, "defaultPackage" if not found | [
"Retrieve",
"the",
"package",
"name",
"if",
"available",
"if",
"not",
"default",
"package",
"name",
"is",
"used",
"."
] | a2163dfcb10e94f30d5cd20bca6c62e6e3cd1d46 | https://github.com/probedock/probedock-junit/blob/a2163dfcb10e94f30d5cd20bca6c62e6e3cd1d46/src/main/java/io/probedock/client/junit/AbstractProbeListener.java#L237-L239 | train |
probedock/probedock-java | src/main/java/io/probedock/client/common/utils/Inflector.java | Inflector.getHumanName | public static String getHumanName(String methodName) {
char[] name = methodName.toCharArray();
StringBuilder humanName = new StringBuilder();
boolean digit = false;
boolean upper = true;
int upCount = 0;
for (int i = 0; i < name.length; i++) {
if (i == 0) {... | java | public static String getHumanName(String methodName) {
char[] name = methodName.toCharArray();
StringBuilder humanName = new StringBuilder();
boolean digit = false;
boolean upper = true;
int upCount = 0;
for (int i = 0; i < name.length; i++) {
if (i == 0) {... | [
"public",
"static",
"String",
"getHumanName",
"(",
"String",
"methodName",
")",
"{",
"char",
"[",
"]",
"name",
"=",
"methodName",
".",
"toCharArray",
"(",
")",
";",
"StringBuilder",
"humanName",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"digit",... | Create a human name from a method name
@param methodName The method name to get a human name
@return The human name created | [
"Create",
"a",
"human",
"name",
"from",
"a",
"method",
"name"
] | 92ee6634ba4fe3fdffeb4e202f5372ef947a67c3 | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/common/utils/Inflector.java#L60-L100 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/sort/IntegerRadixSort.java | IntegerRadixSort.waitForAll | private static void waitForAll(Iterable<? extends Future<?>> futures) throws InterruptedException, ExecutionException {
for(Future<?> future : futures) {
future.get();
}
} | java | private static void waitForAll(Iterable<? extends Future<?>> futures) throws InterruptedException, ExecutionException {
for(Future<?> future : futures) {
future.get();
}
} | [
"private",
"static",
"void",
"waitForAll",
"(",
"Iterable",
"<",
"?",
"extends",
"Future",
"<",
"?",
">",
">",
"futures",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"for",
"(",
"Future",
"<",
"?",
">",
"future",
":",
"futures",
... | Waits for all futures to complete, discarding any results.
Note: This method is cloned from ConcurrentUtils.java to avoid package dependency. | [
"Waits",
"for",
"all",
"futures",
"to",
"complete",
"discarding",
"any",
"results",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/sort/IntegerRadixSort.java#L142-L146 | train |
aoindustries/ao-messaging-api | src/main/java/com/aoindustries/messaging/StringMessage.java | StringMessage.decode | public static StringMessage decode(ByteArray encodedMessage) {
if(encodedMessage.size == 0) return EMPTY_STRING_MESSAGE;
return new StringMessage(new String(encodedMessage.array, 0, encodedMessage.size, CHARSET));
} | java | public static StringMessage decode(ByteArray encodedMessage) {
if(encodedMessage.size == 0) return EMPTY_STRING_MESSAGE;
return new StringMessage(new String(encodedMessage.array, 0, encodedMessage.size, CHARSET));
} | [
"public",
"static",
"StringMessage",
"decode",
"(",
"ByteArray",
"encodedMessage",
")",
"{",
"if",
"(",
"encodedMessage",
".",
"size",
"==",
"0",
")",
"return",
"EMPTY_STRING_MESSAGE",
";",
"return",
"new",
"StringMessage",
"(",
"new",
"String",
"(",
"encodedMes... | UTF-8 decodes the message. | [
"UTF",
"-",
"8",
"decodes",
"the",
"message",
"."
] | dbe4d3baefcc846f99b7eeab42646057e99729f0 | https://github.com/aoindustries/ao-messaging-api/blob/dbe4d3baefcc846f99b7eeab42646057e99729f0/src/main/java/com/aoindustries/messaging/StringMessage.java#L40-L44 | train |
aoindustries/ao-messaging-api | src/main/java/com/aoindustries/messaging/StringMessage.java | StringMessage.encodeAsByteArray | @Override
public ByteArray encodeAsByteArray() {
if(message.isEmpty()) return ByteArray.EMPTY_BYTE_ARRAY;
return new ByteArray(message.getBytes(CHARSET));
} | java | @Override
public ByteArray encodeAsByteArray() {
if(message.isEmpty()) return ByteArray.EMPTY_BYTE_ARRAY;
return new ByteArray(message.getBytes(CHARSET));
} | [
"@",
"Override",
"public",
"ByteArray",
"encodeAsByteArray",
"(",
")",
"{",
"if",
"(",
"message",
".",
"isEmpty",
"(",
")",
")",
"return",
"ByteArray",
".",
"EMPTY_BYTE_ARRAY",
";",
"return",
"new",
"ByteArray",
"(",
"message",
".",
"getBytes",
"(",
"CHARSET... | UTF-8 encodes the message. | [
"UTF",
"-",
"8",
"encodes",
"the",
"message",
"."
] | dbe4d3baefcc846f99b7eeab42646057e99729f0 | https://github.com/aoindustries/ao-messaging-api/blob/dbe4d3baefcc846f99b7eeab42646057e99729f0/src/main/java/com/aoindustries/messaging/StringMessage.java#L87-L92 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/io/CompressedDataInputStream.java | CompressedDataInputStream.readCompressedInt | public static int readCompressedInt(InputStream in) throws IOException {
int b1=in.read();
if(b1==-1) throw new EOFException();
if((b1&0x80)!=0) {
// 31 bit
int b2=in.read();
if(b2==-1) throw new EOFException();
int b3=in.read();
if(b3==-1) throw new EOFException();
int b4=in.read();
if(b4==-... | java | public static int readCompressedInt(InputStream in) throws IOException {
int b1=in.read();
if(b1==-1) throw new EOFException();
if((b1&0x80)!=0) {
// 31 bit
int b2=in.read();
if(b2==-1) throw new EOFException();
int b3=in.read();
if(b3==-1) throw new EOFException();
int b4=in.read();
if(b4==-... | [
"public",
"static",
"int",
"readCompressedInt",
"(",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"int",
"b1",
"=",
"in",
".",
"read",
"(",
")",
";",
"if",
"(",
"b1",
"==",
"-",
"1",
")",
"throw",
"new",
"EOFException",
"(",
")",
";",
"if"... | Reads a compressed integer from the stream.
The 31 bit pattern is as follows:
<pre>
5 bit - 000SXXXX
13 bit - 001SXXXX XXXXXXXX
22 bit - 01SXXXXX XXXXXXXX XXXXXXXX
31 bit - 1SXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
</pre>
@exception EOFException if the end of file is reached | [
"Reads",
"a",
"compressed",
"integer",
"from",
"the",
"stream",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/CompressedDataInputStream.java#L54-L100 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/io/CompressedDataInputStream.java | CompressedDataInputStream.readLongUTF | public String readLongUTF() throws IOException {
int length = readCompressedInt();
StringBuilder SB = new StringBuilder(length);
for(int position = 0; position<length; position+=20480) {
int expectedLen = length - position;
if(expectedLen>20480) expectedLen = 20480;
String block = readUTF();
if(block.... | java | public String readLongUTF() throws IOException {
int length = readCompressedInt();
StringBuilder SB = new StringBuilder(length);
for(int position = 0; position<length; position+=20480) {
int expectedLen = length - position;
if(expectedLen>20480) expectedLen = 20480;
String block = readUTF();
if(block.... | [
"public",
"String",
"readLongUTF",
"(",
")",
"throws",
"IOException",
"{",
"int",
"length",
"=",
"readCompressedInt",
"(",
")",
";",
"StringBuilder",
"SB",
"=",
"new",
"StringBuilder",
"(",
"length",
")",
";",
"for",
"(",
"int",
"position",
"=",
"0",
";",
... | Reads a string of any length. | [
"Reads",
"a",
"string",
"of",
"any",
"length",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/CompressedDataInputStream.java#L173-L185 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/swing/SynchronizingMutableTreeNode.java | SynchronizingMutableTreeNode.synchronize | public void synchronize(DefaultTreeModel treeModel, Tree<E> tree) throws IOException, SQLException {
assert SwingUtilities.isEventDispatchThread() : ApplicationResources.accessor.getMessage("assert.notRunningInSwingEventThread");
synchronize(treeModel, tree.getRootNodes());
} | java | public void synchronize(DefaultTreeModel treeModel, Tree<E> tree) throws IOException, SQLException {
assert SwingUtilities.isEventDispatchThread() : ApplicationResources.accessor.getMessage("assert.notRunningInSwingEventThread");
synchronize(treeModel, tree.getRootNodes());
} | [
"public",
"void",
"synchronize",
"(",
"DefaultTreeModel",
"treeModel",
",",
"Tree",
"<",
"E",
">",
"tree",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"assert",
"SwingUtilities",
".",
"isEventDispatchThread",
"(",
")",
":",
"ApplicationResources",
".",... | Synchronizes the children of this node with the roots of the provided
tree while adding and removing only a minimum number of nodes.
Comparisons are performed using equals on the value objects. This must
be called from the Swing event dispatch thread. | [
"Synchronizes",
"the",
"children",
"of",
"this",
"node",
"with",
"the",
"roots",
"of",
"the",
"provided",
"tree",
"while",
"adding",
"and",
"removing",
"only",
"a",
"minimum",
"number",
"of",
"nodes",
".",
"Comparisons",
"are",
"performed",
"using",
"equals",
... | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/swing/SynchronizingMutableTreeNode.java#L69-L72 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/swing/SynchronizingMutableTreeNode.java | SynchronizingMutableTreeNode.synchronize | @SuppressWarnings("unchecked")
public void synchronize(DefaultTreeModel treeModel, List<Node<E>> children) throws IOException, SQLException {
assert SwingUtilities.isEventDispatchThread() : ApplicationResources.accessor.getMessage("assert.notRunningInSwingEventThread");
if(children==null) {
// No children allow... | java | @SuppressWarnings("unchecked")
public void synchronize(DefaultTreeModel treeModel, List<Node<E>> children) throws IOException, SQLException {
assert SwingUtilities.isEventDispatchThread() : ApplicationResources.accessor.getMessage("assert.notRunningInSwingEventThread");
if(children==null) {
// No children allow... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"synchronize",
"(",
"DefaultTreeModel",
"treeModel",
",",
"List",
"<",
"Node",
"<",
"E",
">",
">",
"children",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"assert",
"SwingUtilities... | Synchronizes the children of this node with the provided children
while adding and removing only a minimum number of nodes.
Comparisons are performed using equals on the value objects. This must
be called from the Swing event dispatch thread.
@param children If children is null, then doesn't allow children. | [
"Synchronizes",
"the",
"children",
"of",
"this",
"node",
"with",
"the",
"provided",
"children",
"while",
"adding",
"and",
"removing",
"only",
"a",
"minimum",
"number",
"of",
"nodes",
".",
"Comparisons",
"are",
"performed",
"using",
"equals",
"on",
"the",
"valu... | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/swing/SynchronizingMutableTreeNode.java#L82-L141 | train |
aoindustries/semanticcms-core-model | src/main/java/com/semanticcms/core/model/Page.java | Page.checkDates | private void checkDates() {
DateTime created = this.dateCreated;
DateTime published = this.datePublished;
DateTime modified = this.dateModified;
DateTime reviewed = this.dateReviewed;
if(
created != null
&& published != null
&& published.compareTo(created) < 0
) throw new IllegalArgumentException("... | java | private void checkDates() {
DateTime created = this.dateCreated;
DateTime published = this.datePublished;
DateTime modified = this.dateModified;
DateTime reviewed = this.dateReviewed;
if(
created != null
&& published != null
&& published.compareTo(created) < 0
) throw new IllegalArgumentException("... | [
"private",
"void",
"checkDates",
"(",
")",
"{",
"DateTime",
"created",
"=",
"this",
".",
"dateCreated",
";",
"DateTime",
"published",
"=",
"this",
".",
"datePublished",
";",
"DateTime",
"modified",
"=",
"this",
".",
"dateModified",
";",
"DateTime",
"reviewed",... | Checks the dates for consistency. | [
"Checks",
"the",
"dates",
"for",
"consistency",
"."
] | 14bdbe3f3d69b2b337129c5b1afcaa9e87cb5624 | https://github.com/aoindustries/semanticcms-core-model/blob/14bdbe3f3d69b2b337129c5b1afcaa9e87cb5624/src/main/java/com/semanticcms/core/model/Page.java#L233-L253 | train |
aoindustries/semanticcms-core-model | src/main/java/com/semanticcms/core/model/Page.java | Page.getElementsById | public Map<String,Element> getElementsById() {
synchronized(lock) {
if(elementsById == null) return Collections.emptyMap();
if(frozen) return elementsById;
return AoCollections.unmodifiableCopyMap(elementsById);
}
} | java | public Map<String,Element> getElementsById() {
synchronized(lock) {
if(elementsById == null) return Collections.emptyMap();
if(frozen) return elementsById;
return AoCollections.unmodifiableCopyMap(elementsById);
}
} | [
"public",
"Map",
"<",
"String",
",",
"Element",
">",
"getElementsById",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"elementsById",
"==",
"null",
")",
"return",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"if",
"(",
"frozen",
")... | Gets the elements indexed by id, in no particular order.
Note, while the page is being created, elements with automatic IDs will not be in
this map. However, once frozen, every element will have an ID.
@see #freeze() | [
"Gets",
"the",
"elements",
"indexed",
"by",
"id",
"in",
"no",
"particular",
"order",
".",
"Note",
"while",
"the",
"page",
"is",
"being",
"created",
"elements",
"with",
"automatic",
"IDs",
"will",
"not",
"be",
"in",
"this",
"map",
".",
"However",
"once",
... | 14bdbe3f3d69b2b337129c5b1afcaa9e87cb5624 | https://github.com/aoindustries/semanticcms-core-model/blob/14bdbe3f3d69b2b337129c5b1afcaa9e87cb5624/src/main/java/com/semanticcms/core/model/Page.java#L428-L434 | train |
aoindustries/semanticcms-core-model | src/main/java/com/semanticcms/core/model/Page.java | Page.getGeneratedIds | public Set<String> getGeneratedIds() {
synchronized(lock) {
if(generatedIds == null) return Collections.emptySet();
if(frozen) return generatedIds;
return AoCollections.unmodifiableCopySet(generatedIds);
}
} | java | public Set<String> getGeneratedIds() {
synchronized(lock) {
if(generatedIds == null) return Collections.emptySet();
if(frozen) return generatedIds;
return AoCollections.unmodifiableCopySet(generatedIds);
}
} | [
"public",
"Set",
"<",
"String",
">",
"getGeneratedIds",
"(",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"generatedIds",
"==",
"null",
")",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"if",
"(",
"frozen",
")",
"return",
"ge... | Gets which element IDs were generated. | [
"Gets",
"which",
"element",
"IDs",
"were",
"generated",
"."
] | 14bdbe3f3d69b2b337129c5b1afcaa9e87cb5624 | https://github.com/aoindustries/semanticcms-core-model/blob/14bdbe3f3d69b2b337129c5b1afcaa9e87cb5624/src/main/java/com/semanticcms/core/model/Page.java#L439-L445 | train |
aoindustries/semanticcms-core-model | src/main/java/com/semanticcms/core/model/Page.java | Page.addElement | public void addElement(Element element) {
synchronized(lock) {
checkNotFrozen();
element.setPage(this);
// elements
if(elements == null) elements = new ArrayList<>();
elements.add(element);
// elementsById
addToElementsById(element, false);
}
} | java | public void addElement(Element element) {
synchronized(lock) {
checkNotFrozen();
element.setPage(this);
// elements
if(elements == null) elements = new ArrayList<>();
elements.add(element);
// elementsById
addToElementsById(element, false);
}
} | [
"public",
"void",
"addElement",
"(",
"Element",
"element",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"checkNotFrozen",
"(",
")",
";",
"element",
".",
"setPage",
"(",
"this",
")",
";",
"// elements",
"if",
"(",
"elements",
"==",
"null",
")",
"eleme... | Adds an element to this page. | [
"Adds",
"an",
"element",
"to",
"this",
"page",
"."
] | 14bdbe3f3d69b2b337129c5b1afcaa9e87cb5624 | https://github.com/aoindustries/semanticcms-core-model/blob/14bdbe3f3d69b2b337129c5b1afcaa9e87cb5624/src/main/java/com/semanticcms/core/model/Page.java#L450-L460 | train |
NessComputing/components-ness-jms | src/main/java/com/nesscomputing/jms/JmsUtils.java | JmsUtils.closeQuietly | public static void closeQuietly(final MessageConsumer consumer)
{
if (consumer != null) {
try {
consumer.close();
}
catch (JMSException je) {
if (je.getCause() instanceof InterruptedException) {
LOG.trace("ActiveMQ caugh... | java | public static void closeQuietly(final MessageConsumer consumer)
{
if (consumer != null) {
try {
consumer.close();
}
catch (JMSException je) {
if (je.getCause() instanceof InterruptedException) {
LOG.trace("ActiveMQ caugh... | [
"public",
"static",
"void",
"closeQuietly",
"(",
"final",
"MessageConsumer",
"consumer",
")",
"{",
"if",
"(",
"consumer",
"!=",
"null",
")",
"{",
"try",
"{",
"consumer",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JMSException",
"je",
")",
"{",
"i... | Close a message consumer.
@param consumer | [
"Close",
"a",
"message",
"consumer",
"."
] | 29e0d320ada3a1a375483437a9f3ff629822b714 | https://github.com/NessComputing/components-ness-jms/blob/29e0d320ada3a1a375483437a9f3ff629822b714/src/main/java/com/nesscomputing/jms/JmsUtils.java#L44-L62 | train |
NessComputing/components-ness-jms | src/main/java/com/nesscomputing/jms/JmsUtils.java | JmsUtils.closeQuietly | public static void closeQuietly(final MessageProducer producer)
{
if (producer != null) {
try {
producer.close();
}
catch (JMSException je) {
if (je.getCause() instanceof InterruptedException) {
LOG.trace("ActiveMQ caugh... | java | public static void closeQuietly(final MessageProducer producer)
{
if (producer != null) {
try {
producer.close();
}
catch (JMSException je) {
if (je.getCause() instanceof InterruptedException) {
LOG.trace("ActiveMQ caugh... | [
"public",
"static",
"void",
"closeQuietly",
"(",
"final",
"MessageProducer",
"producer",
")",
"{",
"if",
"(",
"producer",
"!=",
"null",
")",
"{",
"try",
"{",
"producer",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"JMSException",
"je",
")",
"{",
"i... | Close a message producer.
@param producer | [
"Close",
"a",
"message",
"producer",
"."
] | 29e0d320ada3a1a375483437a9f3ff629822b714 | https://github.com/NessComputing/components-ness-jms/blob/29e0d320ada3a1a375483437a9f3ff629822b714/src/main/java/com/nesscomputing/jms/JmsUtils.java#L69-L87 | train |
aoindustries/ao-messaging-api | src/main/java/com/aoindustries/messaging/ByteArrayMessage.java | ByteArrayMessage.decode | public static ByteArrayMessage decode(String encodedMessage) {
if(encodedMessage.isEmpty()) return EMPTY_BYTE_ARRAY_MESSAGE;
return new ByteArrayMessage(Base64Coder.decode(encodedMessage));
} | java | public static ByteArrayMessage decode(String encodedMessage) {
if(encodedMessage.isEmpty()) return EMPTY_BYTE_ARRAY_MESSAGE;
return new ByteArrayMessage(Base64Coder.decode(encodedMessage));
} | [
"public",
"static",
"ByteArrayMessage",
"decode",
"(",
"String",
"encodedMessage",
")",
"{",
"if",
"(",
"encodedMessage",
".",
"isEmpty",
"(",
")",
")",
"return",
"EMPTY_BYTE_ARRAY_MESSAGE",
";",
"return",
"new",
"ByteArrayMessage",
"(",
"Base64Coder",
".",
"decod... | base-64 decodes the message. | [
"base",
"-",
"64",
"decodes",
"the",
"message",
"."
] | dbe4d3baefcc846f99b7eeab42646057e99729f0 | https://github.com/aoindustries/ao-messaging-api/blob/dbe4d3baefcc846f99b7eeab42646057e99729f0/src/main/java/com/aoindustries/messaging/ByteArrayMessage.java#L37-L41 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/ws/WsEncoder.java | WsEncoder.encode | public static String encode(String value) {
if(value==null) return null;
StringBuilder encoded=null;
int len=value.length();
for(int c=0;c<len;c++) {
char ch=value.charAt(c);
if(
(ch<' ' && ch!='\n' && ch!='\r')
|| ch=='\\'
) {
if(encoded==null) {
encoded=new StringBuilder();
if(... | java | public static String encode(String value) {
if(value==null) return null;
StringBuilder encoded=null;
int len=value.length();
for(int c=0;c<len;c++) {
char ch=value.charAt(c);
if(
(ch<' ' && ch!='\n' && ch!='\r')
|| ch=='\\'
) {
if(encoded==null) {
encoded=new StringBuilder();
if(... | [
"public",
"static",
"String",
"encode",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"StringBuilder",
"encoded",
"=",
"null",
";",
"int",
"len",
"=",
"value",
".",
"length",
"(",
")",
";",
"for",
"("... | Encodes string for binary transparency over SOAP. | [
"Encodes",
"string",
"for",
"binary",
"transparency",
"over",
"SOAP",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/ws/WsEncoder.java#L64-L98 | train |
buschmais/jqa-javaee6-plugin | src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/XmlDescriptorHelper.java | XmlDescriptorHelper.createDescription | public static DescriptionDescriptor createDescription(DescriptionType descriptionType, Store store) {
DescriptionDescriptor descriptionDescriptor = store.create(DescriptionDescriptor.class);
descriptionDescriptor.setLang(descriptionType.getLang());
descriptionDescriptor.setValue(descriptionType.... | java | public static DescriptionDescriptor createDescription(DescriptionType descriptionType, Store store) {
DescriptionDescriptor descriptionDescriptor = store.create(DescriptionDescriptor.class);
descriptionDescriptor.setLang(descriptionType.getLang());
descriptionDescriptor.setValue(descriptionType.... | [
"public",
"static",
"DescriptionDescriptor",
"createDescription",
"(",
"DescriptionType",
"descriptionType",
",",
"Store",
"store",
")",
"{",
"DescriptionDescriptor",
"descriptionDescriptor",
"=",
"store",
".",
"create",
"(",
"DescriptionDescriptor",
".",
"class",
")",
... | Create a description descriptor.
@param descriptionType
The XML description type.
@param store
The store.
@return The description descriptor. | [
"Create",
"a",
"description",
"descriptor",
"."
] | f5776604d9255206807e5aca90b8767bde494e14 | https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/XmlDescriptorHelper.java#L22-L27 | train |
buschmais/jqa-javaee6-plugin | src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/XmlDescriptorHelper.java | XmlDescriptorHelper.createIcon | public static IconDescriptor createIcon(IconType iconType, Store store) {
IconDescriptor iconDescriptor = store.create(IconDescriptor.class);
iconDescriptor.setLang(iconType.getLang());
PathType largeIcon = iconType.getLargeIcon();
if (largeIcon != null) {
iconDescriptor.setL... | java | public static IconDescriptor createIcon(IconType iconType, Store store) {
IconDescriptor iconDescriptor = store.create(IconDescriptor.class);
iconDescriptor.setLang(iconType.getLang());
PathType largeIcon = iconType.getLargeIcon();
if (largeIcon != null) {
iconDescriptor.setL... | [
"public",
"static",
"IconDescriptor",
"createIcon",
"(",
"IconType",
"iconType",
",",
"Store",
"store",
")",
"{",
"IconDescriptor",
"iconDescriptor",
"=",
"store",
".",
"create",
"(",
"IconDescriptor",
".",
"class",
")",
";",
"iconDescriptor",
".",
"setLang",
"(... | Create an icon descriptor.
@param iconType
The XML icon type.
@param store
The store
@return The icon descriptor. | [
"Create",
"an",
"icon",
"descriptor",
"."
] | f5776604d9255206807e5aca90b8767bde494e14 | https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/XmlDescriptorHelper.java#L38-L50 | train |
buschmais/jqa-javaee6-plugin | src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/XmlDescriptorHelper.java | XmlDescriptorHelper.createDisplayName | public static DisplayNameDescriptor createDisplayName(DisplayNameType displayNameType, Store store) {
DisplayNameDescriptor displayNameDescriptor = store.create(DisplayNameDescriptor.class);
displayNameDescriptor.setLang(displayNameType.getLang());
displayNameDescriptor.setValue(displayNameType.... | java | public static DisplayNameDescriptor createDisplayName(DisplayNameType displayNameType, Store store) {
DisplayNameDescriptor displayNameDescriptor = store.create(DisplayNameDescriptor.class);
displayNameDescriptor.setLang(displayNameType.getLang());
displayNameDescriptor.setValue(displayNameType.... | [
"public",
"static",
"DisplayNameDescriptor",
"createDisplayName",
"(",
"DisplayNameType",
"displayNameType",
",",
"Store",
"store",
")",
"{",
"DisplayNameDescriptor",
"displayNameDescriptor",
"=",
"store",
".",
"create",
"(",
"DisplayNameDescriptor",
".",
"class",
")",
... | Create a display name descriptor.
@param displayNameType
The XML display name type.
@param store
The store.
@return The display name descriptor. | [
"Create",
"a",
"display",
"name",
"descriptor",
"."
] | f5776604d9255206807e5aca90b8767bde494e14 | https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/XmlDescriptorHelper.java#L61-L66 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/ServletUtil.java | ServletUtil.getRequestEncoding | public static String getRequestEncoding(ServletRequest request) {
String requestEncoding = request.getCharacterEncoding();
return requestEncoding != null ? requestEncoding : DEFAULT_REQUEST_ENCODING;
} | java | public static String getRequestEncoding(ServletRequest request) {
String requestEncoding = request.getCharacterEncoding();
return requestEncoding != null ? requestEncoding : DEFAULT_REQUEST_ENCODING;
} | [
"public",
"static",
"String",
"getRequestEncoding",
"(",
"ServletRequest",
"request",
")",
"{",
"String",
"requestEncoding",
"=",
"request",
".",
"getCharacterEncoding",
"(",
")",
";",
"return",
"requestEncoding",
"!=",
"null",
"?",
"requestEncoding",
":",
"DEFAULT_... | Gets the request encoding or ISO-8859-1 when not available. | [
"Gets",
"the",
"request",
"encoding",
"or",
"ISO",
"-",
"8859",
"-",
"1",
"when",
"not",
"available",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L80-L83 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/ServletUtil.java | ServletUtil.getAbsoluteURL | public static void getAbsoluteURL(HttpServletRequest request, String relPath, Appendable out) throws IOException {
out.append(request.isSecure() ? "https://" : "http://");
out.append(request.getServerName());
int port = request.getServerPort();
if(port!=(request.isSecure() ? 443 : 80)) out.append(':').append(In... | java | public static void getAbsoluteURL(HttpServletRequest request, String relPath, Appendable out) throws IOException {
out.append(request.isSecure() ? "https://" : "http://");
out.append(request.getServerName());
int port = request.getServerPort();
if(port!=(request.isSecure() ? 443 : 80)) out.append(':').append(In... | [
"public",
"static",
"void",
"getAbsoluteURL",
"(",
"HttpServletRequest",
"request",
",",
"String",
"relPath",
",",
"Appendable",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"append",
"(",
"request",
".",
"isSecure",
"(",
")",
"?",
"\"https://\"",
":"... | Gets an absolute URL for the given context-relative path. This includes
protocol, port, context path, and relative path.
No URL rewriting is performed. | [
"Gets",
"an",
"absolute",
"URL",
"for",
"the",
"given",
"context",
"-",
"relative",
"path",
".",
"This",
"includes",
"protocol",
"port",
"context",
"path",
"and",
"relative",
"path",
".",
"No",
"URL",
"rewriting",
"is",
"performed",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L265-L272 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/ServletUtil.java | ServletUtil.getRedirectLocation | public static String getRedirectLocation(
HttpServletRequest request,
HttpServletResponse response,
String servletPath,
String href
) throws MalformedURLException, UnsupportedEncodingException {
// Convert page-relative paths to context-relative path, resolving ./ and ../
href = getAbsolutePath(servletPath... | java | public static String getRedirectLocation(
HttpServletRequest request,
HttpServletResponse response,
String servletPath,
String href
) throws MalformedURLException, UnsupportedEncodingException {
// Convert page-relative paths to context-relative path, resolving ./ and ../
href = getAbsolutePath(servletPath... | [
"public",
"static",
"String",
"getRedirectLocation",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"servletPath",
",",
"String",
"href",
")",
"throws",
"MalformedURLException",
",",
"UnsupportedEncodingException",
"{",
"// Co... | Gets the absolute URL that should be used for a redirect.
@param href The absolute, context-relative, or page-relative path to redirect to.
The following actions are performed on the provided href:
<ol>
<li>Convert page-relative paths to context-relative path, resolving ./ and ../</li>
<li>Encode URL path elements (... | [
"Gets",
"the",
"absolute",
"URL",
"that",
"should",
"be",
"used",
"for",
"a",
"redirect",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L306-L325 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/ServletUtil.java | ServletUtil.sendRedirect | public static void sendRedirect(
HttpServletResponse response,
String location,
int status
) throws IllegalStateException, IOException {
// Response must not be committed
if(response.isCommitted()) throw new IllegalStateException("Unable to redirect: Response already committed");
response.setHeader("Locat... | java | public static void sendRedirect(
HttpServletResponse response,
String location,
int status
) throws IllegalStateException, IOException {
// Response must not be committed
if(response.isCommitted()) throw new IllegalStateException("Unable to redirect: Response already committed");
response.setHeader("Locat... | [
"public",
"static",
"void",
"sendRedirect",
"(",
"HttpServletResponse",
"response",
",",
"String",
"location",
",",
"int",
"status",
")",
"throws",
"IllegalStateException",
",",
"IOException",
"{",
"// Response must not be committed",
"if",
"(",
"response",
".",
"isCo... | Sends a redirect to the provided absolute URL location.
@see #getRedirectLocation(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.String) | [
"Sends",
"a",
"redirect",
"to",
"the",
"provided",
"absolute",
"URL",
"location",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L332-L342 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/ServletUtil.java | ServletUtil.sendRedirect | public static void sendRedirect(
HttpServletRequest request,
HttpServletResponse response,
String href,
int status
) throws IllegalStateException, IOException {
sendRedirect(
response,
getRedirectLocation(
request,
response,
request.getServletPath(),
href
),
status
);
} | java | public static void sendRedirect(
HttpServletRequest request,
HttpServletResponse response,
String href,
int status
) throws IllegalStateException, IOException {
sendRedirect(
response,
getRedirectLocation(
request,
response,
request.getServletPath(),
href
),
status
);
} | [
"public",
"static",
"void",
"sendRedirect",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"href",
",",
"int",
"status",
")",
"throws",
"IllegalStateException",
",",
"IOException",
"{",
"sendRedirect",
"(",
"response",
"... | Sends a redirect with relative paths determined from the request servlet path.
@see #getRedirectLocation(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.String) for transformations applied to the href | [
"Sends",
"a",
"redirect",
"with",
"relative",
"paths",
"determined",
"from",
"the",
"request",
"servlet",
"path",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L349-L365 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/ServletUtil.java | ServletUtil.getContextRequestUri | public static String getContextRequestUri(HttpServletRequest request) {
String requestUri = request.getRequestURI();
String contextPath = request.getContextPath();
int cpLen = contextPath.length();
if(cpLen > 0) {
assert requestUri.startsWith(contextPath);
return requestUri.substring(cpLen);
} else {
... | java | public static String getContextRequestUri(HttpServletRequest request) {
String requestUri = request.getRequestURI();
String contextPath = request.getContextPath();
int cpLen = contextPath.length();
if(cpLen > 0) {
assert requestUri.startsWith(contextPath);
return requestUri.substring(cpLen);
} else {
... | [
"public",
"static",
"String",
"getContextRequestUri",
"(",
"HttpServletRequest",
"request",
")",
"{",
"String",
"requestUri",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",
"String",
"contextPath",
"=",
"request",
".",
"getContextPath",
"(",
")",
";",
"int... | Gets the current request URI in context-relative form. The contextPath stripped. | [
"Gets",
"the",
"current",
"request",
"URI",
"in",
"context",
"-",
"relative",
"form",
".",
"The",
"contextPath",
"stripped",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L370-L380 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/ServletUtil.java | ServletUtil.doOptions | public static <S extends HttpServlet> void doOptions(
HttpServletResponse response,
Class<S> stopClass,
Class<? extends S> thisClass,
String doGet,
String doPost,
String doPut,
String doDelete,
Class<?>[] paramTypes
) {
boolean ALLOW_GET = false;
boolean ALLOW_HEAD = false;
boolean ALLOW_POST = f... | java | public static <S extends HttpServlet> void doOptions(
HttpServletResponse response,
Class<S> stopClass,
Class<? extends S> thisClass,
String doGet,
String doPost,
String doPut,
String doDelete,
Class<?>[] paramTypes
) {
boolean ALLOW_GET = false;
boolean ALLOW_HEAD = false;
boolean ALLOW_POST = f... | [
"public",
"static",
"<",
"S",
"extends",
"HttpServlet",
">",
"void",
"doOptions",
"(",
"HttpServletResponse",
"response",
",",
"Class",
"<",
"S",
">",
"stopClass",
",",
"Class",
"<",
"?",
"extends",
"S",
">",
"thisClass",
",",
"String",
"doGet",
",",
"Stri... | A reusable doOptions implementation for servlets. | [
"A",
"reusable",
"doOptions",
"implementation",
"for",
"servlets",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L416-L481 | train |
NessComputing/components-ness-httpserver | src/main/java/com/nesscomputing/httpserver/HttpConnector.java | HttpConnector.getPort | public int getPort()
{
if (port != 0) {
return port;
}
else {
final Connector connector = connectorHolder.get();
if (connector != null) {
Preconditions.checkState(connector.getLocalPort() > 0, "no port was set and the connector is not yet s... | java | public int getPort()
{
if (port != 0) {
return port;
}
else {
final Connector connector = connectorHolder.get();
if (connector != null) {
Preconditions.checkState(connector.getLocalPort() > 0, "no port was set and the connector is not yet s... | [
"public",
"int",
"getPort",
"(",
")",
"{",
"if",
"(",
"port",
"!=",
"0",
")",
"{",
"return",
"port",
";",
"}",
"else",
"{",
"final",
"Connector",
"connector",
"=",
"connectorHolder",
".",
"get",
"(",
")",
";",
"if",
"(",
"connector",
"!=",
"null",
... | Returns the system port for this connector. | [
"Returns",
"the",
"system",
"port",
"for",
"this",
"connector",
"."
] | 6a26bb852e8408e3499ad5d139961cdc6a96e857 | https://github.com/NessComputing/components-ness-httpserver/blob/6a26bb852e8408e3499ad5d139961cdc6a96e857/src/main/java/com/nesscomputing/httpserver/HttpConnector.java#L74-L89 | train |
aoindustries/semanticcms-openfile-servlet | src/main/java/com/semanticcms/openfile/servlet/OpenFile.java | OpenFile.isAllowed | public static boolean isAllowed(ServletContext servletContext, ServletRequest request) {
return
Boolean.parseBoolean(servletContext.getInitParameter(ENABLE_INIT_PARAM))
&& isAllowedAddr(request.getRemoteAddr())
;
} | java | public static boolean isAllowed(ServletContext servletContext, ServletRequest request) {
return
Boolean.parseBoolean(servletContext.getInitParameter(ENABLE_INIT_PARAM))
&& isAllowedAddr(request.getRemoteAddr())
;
} | [
"public",
"static",
"boolean",
"isAllowed",
"(",
"ServletContext",
"servletContext",
",",
"ServletRequest",
"request",
")",
"{",
"return",
"Boolean",
".",
"parseBoolean",
"(",
"servletContext",
".",
"getInitParameter",
"(",
"ENABLE_INIT_PARAM",
")",
")",
"&&",
"isAl... | Checks if the given request is allowed to open files on the server.
The servlet init param must have it enabled, as well as be from an allowed IP. | [
"Checks",
"if",
"the",
"given",
"request",
"is",
"allowed",
"to",
"open",
"files",
"on",
"the",
"server",
".",
"The",
"servlet",
"init",
"param",
"must",
"have",
"it",
"enabled",
"as",
"well",
"as",
"be",
"from",
"an",
"allowed",
"IP",
"."
] | d22b2580b57708311949ac1088e3275355774921 | https://github.com/aoindustries/semanticcms-openfile-servlet/blob/d22b2580b57708311949ac1088e3275355774921/src/main/java/com/semanticcms/openfile/servlet/OpenFile.java#L70-L75 | train |
aoindustries/semanticcms-openfile-servlet | src/main/java/com/semanticcms/openfile/servlet/OpenFile.java | OpenFile.addFileOpener | public static void addFileOpener(ServletContext servletContext, FileOpener fileOpener, String ... extensions) {
synchronized(fileOpenersLock) {
@SuppressWarnings("unchecked")
Map<String,FileOpener> fileOpeners = (Map<String,FileOpener>)servletContext.getAttribute(FILE_OPENERS_REQUEST_ATTRIBUTE_NAME);
if(file... | java | public static void addFileOpener(ServletContext servletContext, FileOpener fileOpener, String ... extensions) {
synchronized(fileOpenersLock) {
@SuppressWarnings("unchecked")
Map<String,FileOpener> fileOpeners = (Map<String,FileOpener>)servletContext.getAttribute(FILE_OPENERS_REQUEST_ATTRIBUTE_NAME);
if(file... | [
"public",
"static",
"void",
"addFileOpener",
"(",
"ServletContext",
"servletContext",
",",
"FileOpener",
"fileOpener",
",",
"String",
"...",
"extensions",
")",
"{",
"synchronized",
"(",
"fileOpenersLock",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",... | Registers a file opener.
@param extensions The simple extensions, in lowercase, not including the dot, such as "dia" | [
"Registers",
"a",
"file",
"opener",
"."
] | d22b2580b57708311949ac1088e3275355774921 | https://github.com/aoindustries/semanticcms-openfile-servlet/blob/d22b2580b57708311949ac1088e3275355774921/src/main/java/com/semanticcms/openfile/servlet/OpenFile.java#L115-L128 | train |
aoindustries/semanticcms-openfile-servlet | src/main/java/com/semanticcms/openfile/servlet/OpenFile.java | OpenFile.removeFileOpener | public static void removeFileOpener(ServletContext servletContext, String ... extensions) {
synchronized(fileOpenersLock) {
@SuppressWarnings("unchecked")
Map<String,FileOpener> fileOpeners = (Map<String,FileOpener>)servletContext.getAttribute(FILE_OPENERS_REQUEST_ATTRIBUTE_NAME);
if(fileOpeners != null) {
... | java | public static void removeFileOpener(ServletContext servletContext, String ... extensions) {
synchronized(fileOpenersLock) {
@SuppressWarnings("unchecked")
Map<String,FileOpener> fileOpeners = (Map<String,FileOpener>)servletContext.getAttribute(FILE_OPENERS_REQUEST_ATTRIBUTE_NAME);
if(fileOpeners != null) {
... | [
"public",
"static",
"void",
"removeFileOpener",
"(",
"ServletContext",
"servletContext",
",",
"String",
"...",
"extensions",
")",
"{",
"synchronized",
"(",
"fileOpenersLock",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Map",
"<",
"String",
",",
... | Removes file openers.
@param extensions The simple extensions, in lowercase, not including the dot, such as "dia" | [
"Removes",
"file",
"openers",
"."
] | d22b2580b57708311949ac1088e3275355774921 | https://github.com/aoindustries/semanticcms-openfile-servlet/blob/d22b2580b57708311949ac1088e3275355774921/src/main/java/com/semanticcms/openfile/servlet/OpenFile.java#L135-L148 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/Cookies.java | Cookies.addCookie | public static void addCookie(
HttpServletRequest request,
HttpServletResponse response,
String cookieName,
String value,
String comment,
int maxAge,
boolean secure,
boolean contextOnlyPath
) {
Cookie newCookie = new Cookie(cookieName, value);
if(comment!=null) newCookie.setComment(comment);
newCo... | java | public static void addCookie(
HttpServletRequest request,
HttpServletResponse response,
String cookieName,
String value,
String comment,
int maxAge,
boolean secure,
boolean contextOnlyPath
) {
Cookie newCookie = new Cookie(cookieName, value);
if(comment!=null) newCookie.setComment(comment);
newCo... | [
"public",
"static",
"void",
"addCookie",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"cookieName",
",",
"String",
"value",
",",
"String",
"comment",
",",
"int",
"maxAge",
",",
"boolean",
"secure",
",",
"boolean",
... | Adds a cookie. | [
"Adds",
"a",
"cookie",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/Cookies.java#L43-L66 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/Cookies.java | Cookies.removeCookie | public static void removeCookie(
HttpServletRequest request,
HttpServletResponse response,
String cookieName,
boolean secure,
boolean contextOnlyPath
) {
addCookie(request, response, cookieName, "Removed", null, 0, secure, contextOnlyPath);
} | java | public static void removeCookie(
HttpServletRequest request,
HttpServletResponse response,
String cookieName,
boolean secure,
boolean contextOnlyPath
) {
addCookie(request, response, cookieName, "Removed", null, 0, secure, contextOnlyPath);
} | [
"public",
"static",
"void",
"removeCookie",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"String",
"cookieName",
",",
"boolean",
"secure",
",",
"boolean",
"contextOnlyPath",
")",
"{",
"addCookie",
"(",
"request",
",",
"response"... | Removes a cookie by adding it with maxAge of zero. | [
"Removes",
"a",
"cookie",
"by",
"adding",
"it",
"with",
"maxAge",
"of",
"zero",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/Cookies.java#L85-L93 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/table/Column.java | Column.compareTo | @Override
public int compareTo(Column o) {
int diff = name.compareToIgnoreCase(o.name);
if(diff!=0) return diff;
return name.compareTo(o.name);
} | java | @Override
public int compareTo(Column o) {
int diff = name.compareToIgnoreCase(o.name);
if(diff!=0) return diff;
return name.compareTo(o.name);
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"Column",
"o",
")",
"{",
"int",
"diff",
"=",
"name",
".",
"compareToIgnoreCase",
"(",
"o",
".",
"name",
")",
";",
"if",
"(",
"diff",
"!=",
"0",
")",
"return",
"diff",
";",
"return",
"name",
".",
"... | Ordered by column name only. | [
"Ordered",
"by",
"column",
"name",
"only",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/table/Column.java#L61-L66 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/md5/MD5InputStream.java | MD5InputStream.read | @Override
public int read() throws IOException {
int c = in.read();
if (c == -1) return -1;
md5.Update(c);
return c;
} | java | @Override
public int read() throws IOException {
int c = in.read();
if (c == -1) return -1;
md5.Update(c);
return c;
} | [
"@",
"Override",
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"in",
".",
"read",
"(",
")",
";",
"if",
"(",
"c",
"==",
"-",
"1",
")",
"return",
"-",
"1",
";",
"md5",
".",
"Update",
"(",
"c",
")",
";",
"retu... | Read a byte of data.
@see java.io.FilterInputStream | [
"Read",
"a",
"byte",
"of",
"data",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/md5/MD5InputStream.java#L102-L110 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/md5/MD5InputStream.java | MD5InputStream.read | @Override
public int read (byte bytes[], int offset, int length) throws IOException {
int r;
if ((r = in.read(bytes, offset, length)) == -1) return -1;
md5.Update(bytes, offset, r);
return r;
} | java | @Override
public int read (byte bytes[], int offset, int length) throws IOException {
int r;
if ((r = in.read(bytes, offset, length)) == -1) return -1;
md5.Update(bytes, offset, r);
return r;
} | [
"@",
"Override",
"public",
"int",
"read",
"(",
"byte",
"bytes",
"[",
"]",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"int",
"r",
";",
"if",
"(",
"(",
"r",
"=",
"in",
".",
"read",
"(",
"bytes",
",",
"offset",
",... | Reads into an array of bytes. | [
"Reads",
"into",
"an",
"array",
"of",
"bytes",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/md5/MD5InputStream.java#L115-L124 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/i18n/EditableResourceBundleSet.java | EditableResourceBundleSet.addBundle | void addBundle(EditableResourceBundle bundle) {
Locale locale = bundle.getBundleLocale();
if(!locales.contains(locale)) throw new AssertionError("locale not in locales: "+locale);
bundles.put(locale, bundle);
} | java | void addBundle(EditableResourceBundle bundle) {
Locale locale = bundle.getBundleLocale();
if(!locales.contains(locale)) throw new AssertionError("locale not in locales: "+locale);
bundles.put(locale, bundle);
} | [
"void",
"addBundle",
"(",
"EditableResourceBundle",
"bundle",
")",
"{",
"Locale",
"locale",
"=",
"bundle",
".",
"getBundleLocale",
"(",
")",
";",
"if",
"(",
"!",
"locales",
".",
"contains",
"(",
"locale",
")",
")",
"throw",
"new",
"AssertionError",
"(",
"\... | The constructor of EditableResourceBundle adds itself here. | [
"The",
"constructor",
"of",
"EditableResourceBundle",
"adds",
"itself",
"here",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/i18n/EditableResourceBundleSet.java#L75-L79 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/util/i18n/EditableResourceBundleSet.java | EditableResourceBundleSet.getResourceBundle | public EditableResourceBundle getResourceBundle(Locale locale) {
EditableResourceBundle localeBundle = bundles.get(locale);
if(localeBundle==null) {
ResourceBundle resourceBundle = ResourceBundle.getBundle(baseName, locale);
if(!resourceBundle.getLocale().equals(locale)) throw new AssertionError("ResourceBund... | java | public EditableResourceBundle getResourceBundle(Locale locale) {
EditableResourceBundle localeBundle = bundles.get(locale);
if(localeBundle==null) {
ResourceBundle resourceBundle = ResourceBundle.getBundle(baseName, locale);
if(!resourceBundle.getLocale().equals(locale)) throw new AssertionError("ResourceBund... | [
"public",
"EditableResourceBundle",
"getResourceBundle",
"(",
"Locale",
"locale",
")",
"{",
"EditableResourceBundle",
"localeBundle",
"=",
"bundles",
".",
"get",
"(",
"locale",
")",
";",
"if",
"(",
"localeBundle",
"==",
"null",
")",
"{",
"ResourceBundle",
"resourc... | Gets the editable bundle for the provided locale. | [
"Gets",
"the",
"editable",
"bundle",
"for",
"the",
"provided",
"locale",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/i18n/EditableResourceBundleSet.java#L95-L107 | train |
probedock/probedock-java | src/main/java/io/probedock/client/utils/EnvironmentUtils.java | EnvironmentUtils.getEnvironmentBoolean | public static Boolean getEnvironmentBoolean(String name, Boolean defaultValue) {
if (envVars == null) {
throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentBoolean.");
}
String value = getEnvironmentString(name, null);
if (val... | java | public static Boolean getEnvironmentBoolean(String name, Boolean defaultValue) {
if (envVars == null) {
throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentBoolean.");
}
String value = getEnvironmentString(name, null);
if (val... | [
"public",
"static",
"Boolean",
"getEnvironmentBoolean",
"(",
"String",
"name",
",",
"Boolean",
"defaultValue",
")",
"{",
"if",
"(",
"envVars",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The environment vars must be provided before calling g... | Retrieve boolean value for the environment variable name
@param name The name of the variable without prefix
@param defaultValue The default value if not found
@return The value found, or the default if not found | [
"Retrieve",
"boolean",
"value",
"for",
"the",
"environment",
"variable",
"name"
] | 92ee6634ba4fe3fdffeb4e202f5372ef947a67c3 | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/utils/EnvironmentUtils.java#L32-L45 | train |
probedock/probedock-java | src/main/java/io/probedock/client/utils/EnvironmentUtils.java | EnvironmentUtils.getEnvironmentInteger | public static Integer getEnvironmentInteger(String name, Integer defaultValue) {
if (envVars == null) {
throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentInteger.");
}
String value = getEnvironmentString(name, null);
if (val... | java | public static Integer getEnvironmentInteger(String name, Integer defaultValue) {
if (envVars == null) {
throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentInteger.");
}
String value = getEnvironmentString(name, null);
if (val... | [
"public",
"static",
"Integer",
"getEnvironmentInteger",
"(",
"String",
"name",
",",
"Integer",
"defaultValue",
")",
"{",
"if",
"(",
"envVars",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The environment vars must be provided before calling g... | Retrieve integer value for the environment variable name
@param name The name of the variable without prefix
@param defaultValue The default value if not found
@return The value found, or the default if not found | [
"Retrieve",
"integer",
"value",
"for",
"the",
"environment",
"variable",
"name"
] | 92ee6634ba4fe3fdffeb4e202f5372ef947a67c3 | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/utils/EnvironmentUtils.java#L54-L67 | train |
probedock/probedock-java | src/main/java/io/probedock/client/utils/EnvironmentUtils.java | EnvironmentUtils.getEnvironmentString | public static String getEnvironmentString(String name, String defaultValue) {
if (envVars == null) {
throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentString.");
}
return envVars.get(ENV_PREFIX + name) != null ? envVars.get(ENV_PREFI... | java | public static String getEnvironmentString(String name, String defaultValue) {
if (envVars == null) {
throw new IllegalStateException("The environment vars must be provided before calling getEnvironmentString.");
}
return envVars.get(ENV_PREFIX + name) != null ? envVars.get(ENV_PREFI... | [
"public",
"static",
"String",
"getEnvironmentString",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"envVars",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"The environment vars must be provided before calling getE... | Retrieve string value for the environment variable name
@param name The name of the variable without prefix
@param defaultValue The default value if not found
@return The value found, or the default if not found | [
"Retrieve",
"string",
"value",
"for",
"the",
"environment",
"variable",
"name"
] | 92ee6634ba4fe3fdffeb4e202f5372ef947a67c3 | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/utils/EnvironmentUtils.java#L76-L82 | train |
aoindustries/ao-messaging-api | src/main/java/com/aoindustries/messaging/MultiMessage.java | MultiMessage.encodeAsString | @Override
public String encodeAsString() throws IOException {
final int size = messages.size();
if(size == 0) return "";
StringBuilder sb = new StringBuilder();
sb.append(size).append(DELIMITER);
int count = 0;
for(Message message : messages) {
count++;
String str = message.encodeAsString();
sb
... | java | @Override
public String encodeAsString() throws IOException {
final int size = messages.size();
if(size == 0) return "";
StringBuilder sb = new StringBuilder();
sb.append(size).append(DELIMITER);
int count = 0;
for(Message message : messages) {
count++;
String str = message.encodeAsString();
sb
... | [
"@",
"Override",
"public",
"String",
"encodeAsString",
"(",
")",
"throws",
"IOException",
"{",
"final",
"int",
"size",
"=",
"messages",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"\"\"",
";",
"StringBuilder",
"sb",
"=",
"n... | Encodes the messages into a single string. | [
"Encodes",
"the",
"messages",
"into",
"a",
"single",
"string",
"."
] | dbe4d3baefcc846f99b7eeab42646057e99729f0 | https://github.com/aoindustries/ao-messaging-api/blob/dbe4d3baefcc846f99b7eeab42646057e99729f0/src/main/java/com/aoindustries/messaging/MultiMessage.java#L191-L211 | train |
aoindustries/ao-messaging-api | src/main/java/com/aoindustries/messaging/MultiMessage.java | MultiMessage.encodeAsByteArray | @Override
public ByteArray encodeAsByteArray() throws IOException {
final int size = messages.size();
if(size == 0) return ByteArray.EMPTY_BYTE_ARRAY;
AoByteArrayOutputStream bout = new AoByteArrayOutputStream();
try {
try (DataOutputStream out = new DataOutputStream(bout)) {
out.writeInt(size);
in... | java | @Override
public ByteArray encodeAsByteArray() throws IOException {
final int size = messages.size();
if(size == 0) return ByteArray.EMPTY_BYTE_ARRAY;
AoByteArrayOutputStream bout = new AoByteArrayOutputStream();
try {
try (DataOutputStream out = new DataOutputStream(bout)) {
out.writeInt(size);
in... | [
"@",
"Override",
"public",
"ByteArray",
"encodeAsByteArray",
"(",
")",
"throws",
"IOException",
"{",
"final",
"int",
"size",
"=",
"messages",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"ByteArray",
".",
"EMPTY_BYTE_ARRAY",
";"... | Encodes the messages into a single ByteArray.
There is likely a more efficient implementation that reads-through, but this
is a simple implementation. | [
"Encodes",
"the",
"messages",
"into",
"a",
"single",
"ByteArray",
".",
"There",
"is",
"likely",
"a",
"more",
"efficient",
"implementation",
"that",
"reads",
"-",
"through",
"but",
"this",
"is",
"a",
"simple",
"implementation",
"."
] | dbe4d3baefcc846f99b7eeab42646057e99729f0 | https://github.com/aoindustries/ao-messaging-api/blob/dbe4d3baefcc846f99b7eeab42646057e99729f0/src/main/java/com/aoindustries/messaging/MultiMessage.java#L218-L242 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/io/FifoFile.java | FifoFile.setLength | protected void setLength(long length) throws IOException {
if(length<0) throw new IllegalArgumentException("Invalid length: "+length);
synchronized(this) {
file.seek(8);
file.writeLong(length);
if(length==0) setFirstIndex(0);
}
} | java | protected void setLength(long length) throws IOException {
if(length<0) throw new IllegalArgumentException("Invalid length: "+length);
synchronized(this) {
file.seek(8);
file.writeLong(length);
if(length==0) setFirstIndex(0);
}
} | [
"protected",
"void",
"setLength",
"(",
"long",
"length",
")",
"throws",
"IOException",
"{",
"if",
"(",
"length",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid length: \"",
"+",
"length",
")",
";",
"synchronized",
"(",
"this",
")",
... | Sets the number of bytes currently contained by the FIFO. | [
"Sets",
"the",
"number",
"of",
"bytes",
"currently",
"contained",
"by",
"the",
"FIFO",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/io/FifoFile.java#L141-L148 | train |
NessComputing/components-ness-httpserver | src/main/java/com/nesscomputing/httpserver/jetty/TransparentCompressionFilter.java | TransparentCompressionFilter.isExcludedPath | private boolean isExcludedPath(String requestURI)
{
if (requestURI == null)
return false;
if (_excludedPaths != null)
{
for (String excludedPath : _excludedPaths)
{
if (requestURI.startsWith(excludedPath))
{
... | java | private boolean isExcludedPath(String requestURI)
{
if (requestURI == null)
return false;
if (_excludedPaths != null)
{
for (String excludedPath : _excludedPaths)
{
if (requestURI.startsWith(excludedPath))
{
... | [
"private",
"boolean",
"isExcludedPath",
"(",
"String",
"requestURI",
")",
"{",
"if",
"(",
"requestURI",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"_excludedPaths",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"excludedPath",
":",
"_excludedPaths... | Checks to see if the path is excluded
@param requestURI
the request uri
@return boolean true if excluded | [
"Checks",
"to",
"see",
"if",
"the",
"path",
"is",
"excluded"
] | 6a26bb852e8408e3499ad5d139961cdc6a96e857 | https://github.com/NessComputing/components-ness-httpserver/blob/6a26bb852e8408e3499ad5d139961cdc6a96e857/src/main/java/com/nesscomputing/httpserver/jetty/TransparentCompressionFilter.java#L362-L387 | train |
probedock/probedock-java | src/main/java/io/probedock/client/core/filters/FilterUtils.java | FilterUtils.isRunnable | @SuppressWarnings("unchecked")
public static boolean isRunnable(Class cl, Method method, List<FilterDefinition> filters) {
// Get the ROX annotations
ProbeTest mAnnotation = method.getAnnotation(ProbeTest.class);
ProbeTestClass cAnnotation = method.getDeclaringClass().getAnnotation(ProbeTest... | java | @SuppressWarnings("unchecked")
public static boolean isRunnable(Class cl, Method method, List<FilterDefinition> filters) {
// Get the ROX annotations
ProbeTest mAnnotation = method.getAnnotation(ProbeTest.class);
ProbeTestClass cAnnotation = method.getDeclaringClass().getAnnotation(ProbeTest... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"boolean",
"isRunnable",
"(",
"Class",
"cl",
",",
"Method",
"method",
",",
"List",
"<",
"FilterDefinition",
">",
"filters",
")",
"{",
"// Get the ROX annotations",
"ProbeTest",
"mAnnotation",
... | Define if a test is runnable or not based on a method and class
@param cl Class
@param method The method
@param filters The filters to apply
@return True if the test can be run | [
"Define",
"if",
"a",
"test",
"is",
"runnable",
"or",
"not",
"based",
"on",
"a",
"method",
"and",
"class"
] | 92ee6634ba4fe3fdffeb4e202f5372ef947a67c3 | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/core/filters/FilterUtils.java#L44-L57 | train |
probedock/probedock-java | src/main/java/io/probedock/client/common/config/Configuration.java | Configuration.readUid | private String readUid(File uidFile) {
String uid = null;
// Try to read the shared UID
try (BufferedReader br = new BufferedReader(new FileReader(uidFile))) {
String line;
while ((line = br.readLine()) != null) {
uid = line;
}
} catc... | java | private String readUid(File uidFile) {
String uid = null;
// Try to read the shared UID
try (BufferedReader br = new BufferedReader(new FileReader(uidFile))) {
String line;
while ((line = br.readLine()) != null) {
uid = line;
}
} catc... | [
"private",
"String",
"readUid",
"(",
"File",
"uidFile",
")",
"{",
"String",
"uid",
"=",
"null",
";",
"// Try to read the shared UID",
"try",
"(",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"uidFile",
")",
")",
")",
"... | Read a UID file
@param uidFile The UID file to read
@return The UID read | [
"Read",
"a",
"UID",
"file"
] | 92ee6634ba4fe3fdffeb4e202f5372ef947a67c3 | https://github.com/probedock/probedock-java/blob/92ee6634ba4fe3fdffeb4e202f5372ef947a67c3/src/main/java/io/probedock/client/common/config/Configuration.java#L450-L464 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/version/Version.java | Version.getInstance | public static Version getInstance(
int major,
int minor,
int release,
int build
) {
return new Version(major, minor, release, build);
} | java | public static Version getInstance(
int major,
int minor,
int release,
int build
) {
return new Version(major, minor, release, build);
} | [
"public",
"static",
"Version",
"getInstance",
"(",
"int",
"major",
",",
"int",
"minor",
",",
"int",
"release",
",",
"int",
"build",
")",
"{",
"return",
"new",
"Version",
"(",
"major",
",",
"minor",
",",
"release",
",",
"build",
")",
";",
"}"
] | Gets a version number instance from its component parts. | [
"Gets",
"a",
"version",
"number",
"instance",
"from",
"its",
"component",
"parts",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/version/Version.java#L37-L44 | train |
aoindustries/aocode-public | src/main/java/com/aoindustries/version/Version.java | Version.valueOf | public static Version valueOf(String version) throws IllegalArgumentException {
NullArgumentException.checkNotNull(version, "version");
int dot1Pos = version.indexOf('.');
if(dot1Pos==-1) throw new IllegalArgumentException(version);
int dot2Pos = version.indexOf('.', dot1Pos+1);
if(dot2Pos==-1) throw new Ille... | java | public static Version valueOf(String version) throws IllegalArgumentException {
NullArgumentException.checkNotNull(version, "version");
int dot1Pos = version.indexOf('.');
if(dot1Pos==-1) throw new IllegalArgumentException(version);
int dot2Pos = version.indexOf('.', dot1Pos+1);
if(dot2Pos==-1) throw new Ille... | [
"public",
"static",
"Version",
"valueOf",
"(",
"String",
"version",
")",
"throws",
"IllegalArgumentException",
"{",
"NullArgumentException",
".",
"checkNotNull",
"(",
"version",
",",
"\"version\"",
")",
";",
"int",
"dot1Pos",
"=",
"version",
".",
"indexOf",
"(",
... | Parses a version number from its string representation.
@see #toString() | [
"Parses",
"a",
"version",
"number",
"from",
"its",
"string",
"representation",
"."
] | c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3 | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/version/Version.java#L51-L65 | train |
NessComputing/components-ness-config | src/main/java/com/nesscomputing/config/Config.java | Config.getConfig | public static Config getConfig()
{
final Configuration systemConfig = new SystemConfiguration();
final String configName = systemConfig.getString(CONFIG_PROPERTY_NAME);
final String configLocation = systemConfig.getString(CONFIG_LOCATION_PROPERTY_NAME);
Preconditions.checkState(confi... | java | public static Config getConfig()
{
final Configuration systemConfig = new SystemConfiguration();
final String configName = systemConfig.getString(CONFIG_PROPERTY_NAME);
final String configLocation = systemConfig.getString(CONFIG_LOCATION_PROPERTY_NAME);
Preconditions.checkState(confi... | [
"public",
"static",
"Config",
"getConfig",
"(",
")",
"{",
"final",
"Configuration",
"systemConfig",
"=",
"new",
"SystemConfiguration",
"(",
")",
";",
"final",
"String",
"configName",
"=",
"systemConfig",
".",
"getString",
"(",
"CONFIG_PROPERTY_NAME",
")",
";",
"... | Loads the configuration. The no-args method uses system properties to determine which configurations
to load.
-Dness.config=x/y/z defines a hierarchy of configurations from general
to detail.
The ness.config.location variable must be set.
If the ness.config variable is unset, the default value "default" is used.
@th... | [
"Loads",
"the",
"configuration",
".",
"The",
"no",
"-",
"args",
"method",
"uses",
"system",
"properties",
"to",
"determine",
"which",
"configurations",
"to",
"load",
"."
] | eb9b37327a9e612a097f1258eb09d288f475e2cb | https://github.com/NessComputing/components-ness-config/blob/eb9b37327a9e612a097f1258eb09d288f475e2cb/src/main/java/com/nesscomputing/config/Config.java#L143-L151 | train |
NessComputing/components-ness-config | src/main/java/com/nesscomputing/config/Config.java | Config.getConfig | public static Config getConfig(@Nonnull final URI configLocation, @Nullable final String configName)
{
final ConfigFactory configFactory = new ConfigFactory(configLocation, configName);
return new Config(configFactory.load());
} | java | public static Config getConfig(@Nonnull final URI configLocation, @Nullable final String configName)
{
final ConfigFactory configFactory = new ConfigFactory(configLocation, configName);
return new Config(configFactory.load());
} | [
"public",
"static",
"Config",
"getConfig",
"(",
"@",
"Nonnull",
"final",
"URI",
"configLocation",
",",
"@",
"Nullable",
"final",
"String",
"configName",
")",
"{",
"final",
"ConfigFactory",
"configFactory",
"=",
"new",
"ConfigFactory",
"(",
"configLocation",
",",
... | Load Configuration, using the supplied URI as base. The loaded configuration can be overridden using
system properties. | [
"Load",
"Configuration",
"using",
"the",
"supplied",
"URI",
"as",
"base",
".",
"The",
"loaded",
"configuration",
"can",
"be",
"overridden",
"using",
"system",
"properties",
"."
] | eb9b37327a9e612a097f1258eb09d288f475e2cb | https://github.com/NessComputing/components-ness-config/blob/eb9b37327a9e612a097f1258eb09d288f475e2cb/src/main/java/com/nesscomputing/config/Config.java#L157-L161 | train |
NessComputing/components-ness-config | src/main/java/com/nesscomputing/config/Config.java | Config.getOverriddenConfig | public static Config getOverriddenConfig(@Nonnull final Config config, @Nullable final AbstractConfiguration ... overrideConfigurations)
{
if (overrideConfigurations == null || overrideConfigurations.length == 0) {
return config;
}
final CombinedConfiguration cc = new CombinedCo... | java | public static Config getOverriddenConfig(@Nonnull final Config config, @Nullable final AbstractConfiguration ... overrideConfigurations)
{
if (overrideConfigurations == null || overrideConfigurations.length == 0) {
return config;
}
final CombinedConfiguration cc = new CombinedCo... | [
"public",
"static",
"Config",
"getOverriddenConfig",
"(",
"@",
"Nonnull",
"final",
"Config",
"config",
",",
"@",
"Nullable",
"final",
"AbstractConfiguration",
"...",
"overrideConfigurations",
")",
"{",
"if",
"(",
"overrideConfigurations",
"==",
"null",
"||",
"overri... | Create a new configuration object from an existing object using overrides. If no overrides are passed in, the same object is returned.
the | [
"Create",
"a",
"new",
"configuration",
"object",
"from",
"an",
"existing",
"object",
"using",
"overrides",
".",
"If",
"no",
"overrides",
"are",
"passed",
"in",
"the",
"same",
"object",
"is",
"returned",
"."
] | eb9b37327a9e612a097f1258eb09d288f475e2cb | https://github.com/NessComputing/components-ness-config/blob/eb9b37327a9e612a097f1258eb09d288f475e2cb/src/main/java/com/nesscomputing/config/Config.java#L168-L213 | train |
attribyte/metrics-reporting | src/main/java/org/attribyte/metrics/Reporting.java | Reporting.start | public int start() throws Exception {
if(isStarted.compareAndSet(false, true)) {
try {
for(Reporter reporter : reporters) {
reporter.start();
}
} catch(Exception e) {
stop();
throw e;
}
}
return reporters.size();... | java | public int start() throws Exception {
if(isStarted.compareAndSet(false, true)) {
try {
for(Reporter reporter : reporters) {
reporter.start();
}
} catch(Exception e) {
stop();
throw e;
}
}
return reporters.size();... | [
"public",
"int",
"start",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"isStarted",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"try",
"{",
"for",
"(",
"Reporter",
"reporter",
":",
"reporters",
")",
"{",
"reporter",
".",
"start"... | Starts all reporters.
@return The number of configured reporters.
@throws Exception on start error. | [
"Starts",
"all",
"reporters",
"."
] | f7420264cc124598dc93aedbd902267dab2d1c02 | https://github.com/attribyte/metrics-reporting/blob/f7420264cc124598dc93aedbd902267dab2d1c02/src/main/java/org/attribyte/metrics/Reporting.java#L88-L100 | train |
attribyte/metrics-reporting | src/main/java/org/attribyte/metrics/Reporting.java | Reporting.stop | public void stop() {
if(isStarted.compareAndSet(true, false)) {
for(Reporter reporter : reporters) {
reporter.stop();
}
}
} | java | public void stop() {
if(isStarted.compareAndSet(true, false)) {
for(Reporter reporter : reporters) {
reporter.stop();
}
}
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"isStarted",
".",
"compareAndSet",
"(",
"true",
",",
"false",
")",
")",
"{",
"for",
"(",
"Reporter",
"reporter",
":",
"reporters",
")",
"{",
"reporter",
".",
"stop",
"(",
")",
";",
"}",
"}",
"}"
] | Stops all reporting. | [
"Stops",
"all",
"reporting",
"."
] | f7420264cc124598dc93aedbd902267dab2d1c02 | https://github.com/attribyte/metrics-reporting/blob/f7420264cc124598dc93aedbd902267dab2d1c02/src/main/java/org/attribyte/metrics/Reporting.java#L105-L111 | train |
bremersee/sms | src/main/java/org/bremersee/sms/ExtensionUtils.java | ExtensionUtils.xmlNodeToObject | public static <T> T xmlNodeToObject(final Node node, final Class<T> valueType,
final JAXBContext jaxbContext)
throws JAXBException {
if (node == null) {
return null;
}
Validate.notNull(valueType, "valueType must not be null");
if (jaxbContext == null) {
return valueType.cast(get... | java | public static <T> T xmlNodeToObject(final Node node, final Class<T> valueType,
final JAXBContext jaxbContext)
throws JAXBException {
if (node == null) {
return null;
}
Validate.notNull(valueType, "valueType must not be null");
if (jaxbContext == null) {
return valueType.cast(get... | [
"public",
"static",
"<",
"T",
">",
"T",
"xmlNodeToObject",
"(",
"final",
"Node",
"node",
",",
"final",
"Class",
"<",
"T",
">",
"valueType",
",",
"final",
"JAXBContext",
"jaxbContext",
")",
"throws",
"JAXBException",
"{",
"if",
"(",
"node",
"==",
"null",
... | Transforms a XML node into an object.
@param <T> the type parameter
@param node the XML node
@param valueType the class of the target object
@param jaxbContext the {@link JAXBContext} (can be null)
@return the target object
@throws JAXBException if transformation fails | [
"Transforms",
"a",
"XML",
"node",
"into",
"an",
"object",
"."
] | 4e5e87ea98616dd316573b544f54cac56750d2f9 | https://github.com/bremersee/sms/blob/4e5e87ea98616dd316573b544f54cac56750d2f9/src/main/java/org/bremersee/sms/ExtensionUtils.java#L109-L121 | train |
bremersee/sms | src/main/java/org/bremersee/sms/ExtensionUtils.java | ExtensionUtils.jsonMapToObject | public static <T> T jsonMapToObject(final Map<String, Object> map, final Class<T> valueType,
final ObjectMapper objectMapper) throws IOException {
if (map == null) {
return null;
}
Validate.notNull(valueType, "valueType must not be null");
if (objectMapper == null) {
return DEFAULT_OBJ... | java | public static <T> T jsonMapToObject(final Map<String, Object> map, final Class<T> valueType,
final ObjectMapper objectMapper) throws IOException {
if (map == null) {
return null;
}
Validate.notNull(valueType, "valueType must not be null");
if (objectMapper == null) {
return DEFAULT_OBJ... | [
"public",
"static",
"<",
"T",
">",
"T",
"jsonMapToObject",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
",",
"final",
"Class",
"<",
"T",
">",
"valueType",
",",
"final",
"ObjectMapper",
"objectMapper",
")",
"throws",
"IOException",
"{",
... | Transforms a JSON map into an object.
@param <T> the type parameter
@param map the JSON map
@param valueType the class of the target object
@param objectMapper the JSON object mapper (can be null)
@return the target object
@throws IOException if transformation fails | [
"Transforms",
"a",
"JSON",
"map",
"into",
"an",
"object",
"."
] | 4e5e87ea98616dd316573b544f54cac56750d2f9 | https://github.com/bremersee/sms/blob/4e5e87ea98616dd316573b544f54cac56750d2f9/src/main/java/org/bremersee/sms/ExtensionUtils.java#L133-L144 | train |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/ArraySet.java | ArraySet.fromArray | static <T> ArraySet<T> fromArray(List<T> aArray, Boolean aAllowDuplicates) {
ArraySet<T> set = new ArraySet<>();
for (int i = 0, len = aArray.size(); i < len; i++) {
set.add(aArray.get(i), aAllowDuplicates);
}
return set;
} | java | static <T> ArraySet<T> fromArray(List<T> aArray, Boolean aAllowDuplicates) {
ArraySet<T> set = new ArraySet<>();
for (int i = 0, len = aArray.size(); i < len; i++) {
set.add(aArray.get(i), aAllowDuplicates);
}
return set;
} | [
"static",
"<",
"T",
">",
"ArraySet",
"<",
"T",
">",
"fromArray",
"(",
"List",
"<",
"T",
">",
"aArray",
",",
"Boolean",
"aAllowDuplicates",
")",
"{",
"ArraySet",
"<",
"T",
">",
"set",
"=",
"new",
"ArraySet",
"<>",
"(",
")",
";",
"for",
"(",
"int",
... | Static method for creating ArraySet instances from an existing array. | [
"Static",
"method",
"for",
"creating",
"ArraySet",
"instances",
"from",
"an",
"existing",
"array",
"."
] | 361a99c73d51c11afa5579dd83d477c4d0345599 | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/ArraySet.java#L40-L46 | train |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/ArraySet.java | ArraySet.indexOf | Integer indexOf(T t) {
if (t == null) {
return null;
}
Integer i = _set.get(t);
if (i == null) {
return -1;
}
return i;
} | java | Integer indexOf(T t) {
if (t == null) {
return null;
}
Integer i = _set.get(t);
if (i == null) {
return -1;
}
return i;
} | [
"Integer",
"indexOf",
"(",
"T",
"t",
")",
"{",
"if",
"(",
"t",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Integer",
"i",
"=",
"_set",
".",
"get",
"(",
"t",
")",
";",
"if",
"(",
"i",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",... | What is the index of the given string in the array?
@param String
aStr | [
"What",
"is",
"the",
"index",
"of",
"the",
"given",
"string",
"in",
"the",
"array?"
] | 361a99c73d51c11afa5579dd83d477c4d0345599 | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/ArraySet.java#L100-L109 | train |
nlalevee/jsourcemap | jsourcemap/src/java/org/hibnet/jsourcemap/ArraySet.java | ArraySet.at | T at(Integer i) {
if (i == null) {
return null;
}
if (i >= _array.size()) {
return null;
}
return _array.get(i);
} | java | T at(Integer i) {
if (i == null) {
return null;
}
if (i >= _array.size()) {
return null;
}
return _array.get(i);
} | [
"T",
"at",
"(",
"Integer",
"i",
")",
"{",
"if",
"(",
"i",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"i",
">=",
"_array",
".",
"size",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"_array",
".",
"get",
"(",
... | What is the element at the given index?
@param Number
aIdx | [
"What",
"is",
"the",
"element",
"at",
"the",
"given",
"index?"
] | 361a99c73d51c11afa5579dd83d477c4d0345599 | https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/ArraySet.java#L117-L125 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.