repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/impl/EntryWrappingInterceptor.java | EntryWrappingInterceptor.setSkipRemoteGetsAndInvokeNextForManyEntriesCommand | protected Object setSkipRemoteGetsAndInvokeNextForManyEntriesCommand(InvocationContext ctx, WriteCommand command) {
return invokeNextThenApply(ctx, command, applyAndFixVersionForMany);
} | java | protected Object setSkipRemoteGetsAndInvokeNextForManyEntriesCommand(InvocationContext ctx, WriteCommand command) {
return invokeNextThenApply(ctx, command, applyAndFixVersionForMany);
} | [
"protected",
"Object",
"setSkipRemoteGetsAndInvokeNextForManyEntriesCommand",
"(",
"InvocationContext",
"ctx",
",",
"WriteCommand",
"command",
")",
"{",
"return",
"invokeNextThenApply",
"(",
"ctx",
",",
"command",
",",
"applyAndFixVersionForMany",
")",
";",
"}"
] | Locks the value for the keys accessed by the command to avoid being override from a remote get. | [
"Locks",
"the",
"value",
"for",
"the",
"keys",
"accessed",
"by",
"the",
"command",
"to",
"avoid",
"being",
"override",
"from",
"a",
"remote",
"get",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/impl/EntryWrappingInterceptor.java#L643-L645 |
Codearte/catch-exception | catch-throwable/src/main/java/com/googlecode/catchexception/throwable/apis/CatchThrowableHamcrestMatchers.java | CatchThrowableHamcrestMatchers.hasMessageThat | public static <T extends Throwable> org.hamcrest.Matcher<T> hasMessageThat(Matcher<String> stringMatcher) {
return new ThrowableMessageMatcher<>(stringMatcher);
} | java | public static <T extends Throwable> org.hamcrest.Matcher<T> hasMessageThat(Matcher<String> stringMatcher) {
return new ThrowableMessageMatcher<>(stringMatcher);
} | [
"public",
"static",
"<",
"T",
"extends",
"Throwable",
">",
"org",
".",
"hamcrest",
".",
"Matcher",
"<",
"T",
">",
"hasMessageThat",
"(",
"Matcher",
"<",
"String",
">",
"stringMatcher",
")",
"{",
"return",
"new",
"ThrowableMessageMatcher",
"<>",
"(",
"stringM... | EXAMPLES:
<code>assertThat(caughtThrowable(), hasMessageThat(is("Index: 9, Size: 9")));
assertThat(caughtThrowable(), hasMessageThat(containsString("Index: 9"))); // using JUnitMatchers
assertThat(caughtThrowable(), hasMessageThat(containsPattern("Index: \\d+"))); // using Mockito's Find</code>
@param <T>
the throwable subclass
@param stringMatcher
a string matcher
@return Returns a matcher that matches an throwable if the given string matcher matches the throwable message. | [
"EXAMPLES",
":",
"<code",
">",
"assertThat",
"(",
"caughtThrowable",
"()",
"hasMessageThat",
"(",
"is",
"(",
"Index",
":",
"9",
"Size",
":",
"9",
")))",
";",
"assertThat",
"(",
"caughtThrowable",
"()",
"hasMessageThat",
"(",
"containsString",
"(",
"Index",
"... | train | https://github.com/Codearte/catch-exception/blob/8cfb1c0a68661ef622011484ff0061b41796b165/catch-throwable/src/main/java/com/googlecode/catchexception/throwable/apis/CatchThrowableHamcrestMatchers.java#L80-L82 |
windup/windup | utils/src/main/java/org/jboss/windup/util/Logging.java | Logging.printMap | public static String printMap(Map<? extends Object, ? extends Object> tagCountForAllApps, boolean valueFirst)
{
StringBuilder sb = new StringBuilder();
for (Map.Entry<? extends Object, ? extends Object> e : tagCountForAllApps.entrySet())
{
sb.append(" ");
sb.append(valueFirst ? e.getValue() : e.getKey());
sb.append(": ");
sb.append(valueFirst ? e.getKey() : e.getValue());
sb.append(Util.NL);
}
return sb.toString();
} | java | public static String printMap(Map<? extends Object, ? extends Object> tagCountForAllApps, boolean valueFirst)
{
StringBuilder sb = new StringBuilder();
for (Map.Entry<? extends Object, ? extends Object> e : tagCountForAllApps.entrySet())
{
sb.append(" ");
sb.append(valueFirst ? e.getValue() : e.getKey());
sb.append(": ");
sb.append(valueFirst ? e.getKey() : e.getValue());
sb.append(Util.NL);
}
return sb.toString();
} | [
"public",
"static",
"String",
"printMap",
"(",
"Map",
"<",
"?",
"extends",
"Object",
",",
"?",
"extends",
"Object",
">",
"tagCountForAllApps",
",",
"boolean",
"valueFirst",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
... | Formats a Map to a String, each entry as one line, using toString() of keys and values. | [
"Formats",
"a",
"Map",
"to",
"a",
"String",
"each",
"entry",
"as",
"one",
"line",
"using",
"toString",
"()",
"of",
"keys",
"and",
"values",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/utils/src/main/java/org/jboss/windup/util/Logging.java#L24-L36 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/core/download/BaseImageDownloader.java | BaseImageDownloader.createConnection | protected HttpURLConnection createConnection(String url, Object extra) throws IOException {
String encodedUrl = Uri.encode(url, ALLOWED_URI_CHARS);
HttpURLConnection conn = (HttpURLConnection) new URL(encodedUrl).openConnection();
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
return conn;
} | java | protected HttpURLConnection createConnection(String url, Object extra) throws IOException {
String encodedUrl = Uri.encode(url, ALLOWED_URI_CHARS);
HttpURLConnection conn = (HttpURLConnection) new URL(encodedUrl).openConnection();
conn.setConnectTimeout(connectTimeout);
conn.setReadTimeout(readTimeout);
return conn;
} | [
"protected",
"HttpURLConnection",
"createConnection",
"(",
"String",
"url",
",",
"Object",
"extra",
")",
"throws",
"IOException",
"{",
"String",
"encodedUrl",
"=",
"Uri",
".",
"encode",
"(",
"url",
",",
"ALLOWED_URI_CHARS",
")",
";",
"HttpURLConnection",
"conn",
... | Create {@linkplain HttpURLConnection HTTP connection} for incoming URL
@param url URL to connect to
@param extra Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForDownloader(Object)
DisplayImageOptions.extraForDownloader(Object)}; can be null
@return {@linkplain HttpURLConnection Connection} for incoming URL. Connection isn't established so it still configurable.
@throws IOException if some I/O error occurs during network request or if no InputStream could be created for
URL. | [
"Create",
"{",
"@linkplain",
"HttpURLConnection",
"HTTP",
"connection",
"}",
"for",
"incoming",
"URL"
] | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/download/BaseImageDownloader.java#L158-L164 |
ben-manes/caffeine | caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java | BoundedLocalCache.expireAfterCreate | long expireAfterCreate(@Nullable K key, @Nullable V value, Expiry<K, V> expiry, long now) {
if (expiresVariable() && (key != null) && (value != null)) {
long duration = expiry.expireAfterCreate(key, value, now);
return isAsync ? (now + duration) : (now + Math.min(duration, MAXIMUM_EXPIRY));
}
return 0L;
} | java | long expireAfterCreate(@Nullable K key, @Nullable V value, Expiry<K, V> expiry, long now) {
if (expiresVariable() && (key != null) && (value != null)) {
long duration = expiry.expireAfterCreate(key, value, now);
return isAsync ? (now + duration) : (now + Math.min(duration, MAXIMUM_EXPIRY));
}
return 0L;
} | [
"long",
"expireAfterCreate",
"(",
"@",
"Nullable",
"K",
"key",
",",
"@",
"Nullable",
"V",
"value",
",",
"Expiry",
"<",
"K",
",",
"V",
">",
"expiry",
",",
"long",
"now",
")",
"{",
"if",
"(",
"expiresVariable",
"(",
")",
"&&",
"(",
"key",
"!=",
"null... | Returns the expiration time for the entry after being created.
@param key the key of the entry that was created
@param value the value of the entry that was created
@param expiry the calculator for the expiration time
@param now the current time, in nanoseconds
@return the expiration time | [
"Returns",
"the",
"expiration",
"time",
"for",
"the",
"entry",
"after",
"being",
"created",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1210-L1216 |
iipc/webarchive-commons | src/main/java/org/archive/net/PublicSuffixes.java | PublicSuffixes.readPublishedFileToSurtTrie | protected static Node readPublishedFileToSurtTrie(BufferedReader reader) throws IOException {
// initializing with empty Alt list prevents empty pattern from being
// created for the first addBranch()
Node alt = new Node(null, new ArrayList<Node>());
String line;
while ((line = reader.readLine()) != null) {
// discard whitespace, empty lines, comments, exceptions
line = line.trim();
if (line.length() == 0 || line.startsWith("//")) continue;
// discard utf8 notation after entry
line = line.split("\\s+")[0];
// TODO: maybe we don't need to create lower-cased String
line = line.toLowerCase();
// SURT-order domain segments
String[] segs = line.split("\\.");
StringBuilder sb = new StringBuilder();
for (int i = segs.length - 1; i >= 0; i--) {
if (segs[i].length() == 0) continue;
sb.append(segs[i]).append(',');
}
alt.addBranch(sb.toString());
}
return alt;
} | java | protected static Node readPublishedFileToSurtTrie(BufferedReader reader) throws IOException {
// initializing with empty Alt list prevents empty pattern from being
// created for the first addBranch()
Node alt = new Node(null, new ArrayList<Node>());
String line;
while ((line = reader.readLine()) != null) {
// discard whitespace, empty lines, comments, exceptions
line = line.trim();
if (line.length() == 0 || line.startsWith("//")) continue;
// discard utf8 notation after entry
line = line.split("\\s+")[0];
// TODO: maybe we don't need to create lower-cased String
line = line.toLowerCase();
// SURT-order domain segments
String[] segs = line.split("\\.");
StringBuilder sb = new StringBuilder();
for (int i = segs.length - 1; i >= 0; i--) {
if (segs[i].length() == 0) continue;
sb.append(segs[i]).append(',');
}
alt.addBranch(sb.toString());
}
return alt;
} | [
"protected",
"static",
"Node",
"readPublishedFileToSurtTrie",
"(",
"BufferedReader",
"reader",
")",
"throws",
"IOException",
"{",
"// initializing with empty Alt list prevents empty pattern from being",
"// created for the first addBranch()",
"Node",
"alt",
"=",
"new",
"Node",
"(... | Reads a file of the format promulgated by publicsuffix.org, ignoring
comments and '!' exceptions/notations, converting domain segments to
SURT-ordering. Leaves glob-style '*' wildcarding in place. Returns root
node of SURT-ordered prefix tree.
@param reader
@return root of prefix tree node.
@throws IOException | [
"Reads",
"a",
"file",
"of",
"the",
"format",
"promulgated",
"by",
"publicsuffix",
".",
"org",
"ignoring",
"comments",
"and",
"!",
"exceptions",
"/",
"notations",
"converting",
"domain",
"segments",
"to",
"SURT",
"-",
"ordering",
".",
"Leaves",
"glob",
"-",
"... | train | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/net/PublicSuffixes.java#L210-L233 |
sputnikdev/bluetooth-utils | src/main/java/org/sputnikdev/bluetooth/URL.java | URL.getDeviceURL | public URL getDeviceURL() {
return new URL(this.protocol, this.adapterAddress, this.deviceAddress, this.deviceAttributes, null, null, null);
} | java | public URL getDeviceURL() {
return new URL(this.protocol, this.adapterAddress, this.deviceAddress, this.deviceAttributes, null, null, null);
} | [
"public",
"URL",
"getDeviceURL",
"(",
")",
"{",
"return",
"new",
"URL",
"(",
"this",
".",
"protocol",
",",
"this",
".",
"adapterAddress",
",",
"this",
".",
"deviceAddress",
",",
"this",
".",
"deviceAttributes",
",",
"null",
",",
"null",
",",
"null",
")",... | Returns a copy of a given URL truncated to its device component.
Service, characteristic and field components will be null.
@return a copy of a given URL truncated to the device component | [
"Returns",
"a",
"copy",
"of",
"a",
"given",
"URL",
"truncated",
"to",
"its",
"device",
"component",
".",
"Service",
"characteristic",
"and",
"field",
"components",
"will",
"be",
"null",
"."
] | train | https://github.com/sputnikdev/bluetooth-utils/blob/794e4a8644c1eed54cd043de2bc967f4ef58acca/src/main/java/org/sputnikdev/bluetooth/URL.java#L341-L343 |
gallandarakhneorg/afc | advanced/bootique/bootique-log4j/src/main/java/org/arakhne/afc/bootique/log4j/modules/Log4jIntegrationModule.java | Log4jIntegrationModule.getLog4jIntegrationConfig | @SuppressWarnings("static-method")
@Provides
@Singleton
public Log4jIntegrationConfig getLog4jIntegrationConfig(ConfigurationFactory configFactory, Injector injector) {
final Log4jIntegrationConfig config = Log4jIntegrationConfig.getConfiguration(configFactory);
injector.injectMembers(config);
return config;
} | java | @SuppressWarnings("static-method")
@Provides
@Singleton
public Log4jIntegrationConfig getLog4jIntegrationConfig(ConfigurationFactory configFactory, Injector injector) {
final Log4jIntegrationConfig config = Log4jIntegrationConfig.getConfiguration(configFactory);
injector.injectMembers(config);
return config;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"@",
"Provides",
"@",
"Singleton",
"public",
"Log4jIntegrationConfig",
"getLog4jIntegrationConfig",
"(",
"ConfigurationFactory",
"configFactory",
",",
"Injector",
"injector",
")",
"{",
"final",
"Log4jIntegrationConfig"... | Replies the instance of the log4j integration configuration..
@param configFactory accessor to the bootique factory.
@param injector the current injector.
@return the configuration accessor. | [
"Replies",
"the",
"instance",
"of",
"the",
"log4j",
"integration",
"configuration",
".."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-log4j/src/main/java/org/arakhne/afc/bootique/log4j/modules/Log4jIntegrationModule.java#L74-L81 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java | StatsConfigHelper.getTranslatedStatsName | public static String getTranslatedStatsName(String statsName, String statsType) {
return getTranslatedStatsName(statsName, statsType, Locale.getDefault());
} | java | public static String getTranslatedStatsName(String statsName, String statsType) {
return getTranslatedStatsName(statsName, statsType, Locale.getDefault());
} | [
"public",
"static",
"String",
"getTranslatedStatsName",
"(",
"String",
"statsName",
",",
"String",
"statsType",
")",
"{",
"return",
"getTranslatedStatsName",
"(",
"statsName",
",",
"statsType",
",",
"Locale",
".",
"getDefault",
"(",
")",
")",
";",
"}"
] | Method to translate the Stats instance/group name. Used by Admin Console | [
"Method",
"to",
"translate",
"the",
"Stats",
"instance",
"/",
"group",
"name",
".",
"Used",
"by",
"Admin",
"Console"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java#L185-L187 |
powermock/powermock | powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java | SuppressCode.suppressSpecificConstructor | public static synchronized void suppressSpecificConstructor(Class<?> clazz, Class<?>... parameterTypes) {
MockRepository.addConstructorToSuppress(Whitebox.getConstructor(clazz, parameterTypes));
} | java | public static synchronized void suppressSpecificConstructor(Class<?> clazz, Class<?>... parameterTypes) {
MockRepository.addConstructorToSuppress(Whitebox.getConstructor(clazz, parameterTypes));
} | [
"public",
"static",
"synchronized",
"void",
"suppressSpecificConstructor",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"MockRepository",
".",
"addConstructorToSuppress",
"(",
"Whitebox",
".",
"getConstructo... | This method can be used to suppress the code in a specific constructor.
@param clazz
The class where the constructor is located.
@param parameterTypes
The parameter types of the constructor to suppress. | [
"This",
"method",
"can",
"be",
"used",
"to",
"suppress",
"the",
"code",
"in",
"a",
"specific",
"constructor",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java#L52-L54 |
probedock/probedock-rt-java | src/main/java/io/probedock/rt/client/Connector.java | Connector.notifyEnd | public void notifyEnd(String projectApiId, String projectVersion, String category, long duration) {
try {
if (isStarted()) {
JSONObject endNotification = new JSONObject().
put("project", new JSONObject().
put("apiId", projectApiId).
put("version", projectVersion)
).
put("category", category).
put("duration", duration);
socket.emit("run:end", endNotification);
}
else {
LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the end notification");
}
}
catch (Exception e) {
LOGGER.log(Level.INFO, "Unable to send the end notification to the agent. Cause: " + e.getMessage());
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception:", e);
}
}
} | java | public void notifyEnd(String projectApiId, String projectVersion, String category, long duration) {
try {
if (isStarted()) {
JSONObject endNotification = new JSONObject().
put("project", new JSONObject().
put("apiId", projectApiId).
put("version", projectVersion)
).
put("category", category).
put("duration", duration);
socket.emit("run:end", endNotification);
}
else {
LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the end notification");
}
}
catch (Exception e) {
LOGGER.log(Level.INFO, "Unable to send the end notification to the agent. Cause: " + e.getMessage());
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception:", e);
}
}
} | [
"public",
"void",
"notifyEnd",
"(",
"String",
"projectApiId",
",",
"String",
"projectVersion",
",",
"String",
"category",
",",
"long",
"duration",
")",
"{",
"try",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"JSONObject",
"endNotification",
"=",
"new",
... | Send a ending notification to the agent
@param projectApiId The project API ID
@param projectVersion The project version
@param category The category
@param duration The duration of the test run | [
"Send",
"a",
"ending",
"notification",
"to",
"the",
"agent"
] | train | https://github.com/probedock/probedock-rt-java/blob/67b44b64303b15eb2d4808f9560a1c9554ccf3ba/src/main/java/io/probedock/rt/client/Connector.java#L132-L156 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java | TileSystem.QuadKeyToTileXY | public static Point QuadKeyToTileXY(final String quadKey, final Point reuse) {
final Point out = reuse == null ? new Point() : reuse;
if (quadKey == null || quadKey.length() == 0) {
throw new IllegalArgumentException("Invalid QuadKey: " + quadKey);
}
int tileX = 0;
int tileY = 0;
final int zoom = quadKey.length();
for (int i = 0 ; i < zoom; i++) {
final int value = 1 << i;
switch (quadKey.charAt(zoom - i - 1)) {
case '0':
break;
case '1':
tileX += value;
break;
case '2':
tileY += value;
break;
case '3':
tileX += value;
tileY += value;
break;
default:
throw new IllegalArgumentException("Invalid QuadKey: " + quadKey);
}
}
out.x = tileX;
out.y = tileY;
return out;
} | java | public static Point QuadKeyToTileXY(final String quadKey, final Point reuse) {
final Point out = reuse == null ? new Point() : reuse;
if (quadKey == null || quadKey.length() == 0) {
throw new IllegalArgumentException("Invalid QuadKey: " + quadKey);
}
int tileX = 0;
int tileY = 0;
final int zoom = quadKey.length();
for (int i = 0 ; i < zoom; i++) {
final int value = 1 << i;
switch (quadKey.charAt(zoom - i - 1)) {
case '0':
break;
case '1':
tileX += value;
break;
case '2':
tileY += value;
break;
case '3':
tileX += value;
tileY += value;
break;
default:
throw new IllegalArgumentException("Invalid QuadKey: " + quadKey);
}
}
out.x = tileX;
out.y = tileY;
return out;
} | [
"public",
"static",
"Point",
"QuadKeyToTileXY",
"(",
"final",
"String",
"quadKey",
",",
"final",
"Point",
"reuse",
")",
"{",
"final",
"Point",
"out",
"=",
"reuse",
"==",
"null",
"?",
"new",
"Point",
"(",
")",
":",
"reuse",
";",
"if",
"(",
"quadKey",
"=... | Use {@link MapTileIndex#getX(long)} and {@link MapTileIndex#getY(long)} instead
Quadkey principles can be found at https://msdn.microsoft.com/en-us/library/bb259689.aspx | [
"Use",
"{"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java#L362-L392 |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/TimeSensor.java | TimeSensor.setLoop | public void setLoop(boolean doLoop, GVRContext gvrContext) {
if (this.loop != doLoop ) {
// a change in the loop
for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) {
if (doLoop) gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.REPEATED);
else gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.ONCE);
}
// be sure to start the animations if loop is true
if ( doLoop ) {
for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) {
gvrKeyFrameAnimation.start(gvrContext.getAnimationEngine() );
}
}
this.loop = doLoop;
}
} | java | public void setLoop(boolean doLoop, GVRContext gvrContext) {
if (this.loop != doLoop ) {
// a change in the loop
for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) {
if (doLoop) gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.REPEATED);
else gvrKeyFrameAnimation.setRepeatMode(GVRRepeatMode.ONCE);
}
// be sure to start the animations if loop is true
if ( doLoop ) {
for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) {
gvrKeyFrameAnimation.start(gvrContext.getAnimationEngine() );
}
}
this.loop = doLoop;
}
} | [
"public",
"void",
"setLoop",
"(",
"boolean",
"doLoop",
",",
"GVRContext",
"gvrContext",
")",
"{",
"if",
"(",
"this",
".",
"loop",
"!=",
"doLoop",
")",
"{",
"// a change in the loop",
"for",
"(",
"GVRNodeAnimation",
"gvrKeyFrameAnimation",
":",
"gvrKeyFrameAnimatio... | SetLoop will either set the GVRNodeAnimation's Repeat Mode to REPEATED if loop is true.
or it will set the GVRNodeAnimation's Repeat Mode to ONCE if loop is false
if loop is set to TRUE, when it was previously FALSE, then start the Animation.
@param doLoop
@param gvrContext | [
"SetLoop",
"will",
"either",
"set",
"the",
"GVRNodeAnimation",
"s",
"Repeat",
"Mode",
"to",
"REPEATED",
"if",
"loop",
"is",
"true",
".",
"or",
"it",
"will",
"set",
"the",
"GVRNodeAnimation",
"s",
"Repeat",
"Mode",
"to",
"ONCE",
"if",
"loop",
"is",
"false",... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/TimeSensor.java#L96-L111 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallGateway | public static GatewayBean unmarshallGateway(Map<String, Object> source) {
if (source == null) {
return null;
}
GatewayBean bean = new GatewayBean();
bean.setId(asString(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setType(asEnum(source.get("type"), GatewayType.class));
bean.setConfiguration(asString(source.get("configuration")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setModifiedBy(asString(source.get("modifiedBy")));
bean.setModifiedOn(asDate(source.get("modifiedOn")));
postMarshall(bean);
return bean;
} | java | public static GatewayBean unmarshallGateway(Map<String, Object> source) {
if (source == null) {
return null;
}
GatewayBean bean = new GatewayBean();
bean.setId(asString(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setType(asEnum(source.get("type"), GatewayType.class));
bean.setConfiguration(asString(source.get("configuration")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
bean.setModifiedBy(asString(source.get("modifiedBy")));
bean.setModifiedOn(asDate(source.get("modifiedOn")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"GatewayBean",
"unmarshallGateway",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"GatewayBean",
"bean",
"=",
"new",
"GatewayBean",
"(",
")"... | Unmarshals the given map source into a bean.
@param source the source
@return the gateway bean | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L701-L717 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java | Levenshtein.sorensenDice | public static <T extends Levenshtein> T sorensenDice(String baseTarget, String compareTarget) {
return sorensenDice(baseTarget, compareTarget, null);
} | java | public static <T extends Levenshtein> T sorensenDice(String baseTarget, String compareTarget) {
return sorensenDice(baseTarget, compareTarget, null);
} | [
"public",
"static",
"<",
"T",
"extends",
"Levenshtein",
">",
"T",
"sorensenDice",
"(",
"String",
"baseTarget",
",",
"String",
"compareTarget",
")",
"{",
"return",
"sorensenDice",
"(",
"baseTarget",
",",
"compareTarget",
",",
"null",
")",
";",
"}"
] | Returns a new Sorensen-Dice coefficient instance with compare target string
@see SorensenDice
@param baseTarget
@param compareTarget
@return | [
"Returns",
"a",
"new",
"Sorensen",
"-",
"Dice",
"coefficient",
"instance",
"with",
"compare",
"target",
"string"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java#L295-L297 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/facade/JRebirthEventBase.java | JRebirthEventBase.parseString | private void parseString(final String eventSerialized) {
final StringTokenizer st = new StringTokenizer(eventSerialized, ClassUtility.SEPARATOR);
if (st.countTokens() >= 5) {
sequence(Integer.parseInt(st.nextToken()))
.eventType(JRebirthEventType.valueOf(st.nextToken()))
.source(st.nextToken())
.target(st.nextToken())
.eventData(st.nextToken());
}
} | java | private void parseString(final String eventSerialized) {
final StringTokenizer st = new StringTokenizer(eventSerialized, ClassUtility.SEPARATOR);
if (st.countTokens() >= 5) {
sequence(Integer.parseInt(st.nextToken()))
.eventType(JRebirthEventType.valueOf(st.nextToken()))
.source(st.nextToken())
.target(st.nextToken())
.eventData(st.nextToken());
}
} | [
"private",
"void",
"parseString",
"(",
"final",
"String",
"eventSerialized",
")",
"{",
"final",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"eventSerialized",
",",
"ClassUtility",
".",
"SEPARATOR",
")",
";",
"if",
"(",
"st",
".",
"countTokens",
... | Parse the serialized string.
@param eventSerialized the serialized string | [
"Parse",
"the",
"serialized",
"string",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/facade/JRebirthEventBase.java#L181-L190 |
amzn/ion-java | src/com/amazon/ion/impl/bin/IonRawBinaryWriter.java | IonRawBinaryWriter.writeBytes | public void writeBytes(byte[] data, int offset, int length) throws IOException
{
prepareValue();
updateLength(length);
buffer.writeBytes(data, offset, length);
finishValue();
} | java | public void writeBytes(byte[] data, int offset, int length) throws IOException
{
prepareValue();
updateLength(length);
buffer.writeBytes(data, offset, length);
finishValue();
} | [
"public",
"void",
"writeBytes",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"prepareValue",
"(",
")",
";",
"updateLength",
"(",
"length",
")",
";",
"buffer",
".",
"writeBytes",
"(",
"data"... | Writes a raw value into the buffer, updating lengths appropriately.
<p>
The implication here is that the caller is dumping some valid Ion payload with the correct context. | [
"Writes",
"a",
"raw",
"value",
"into",
"the",
"buffer",
"updating",
"lengths",
"appropriately",
".",
"<p",
">",
"The",
"implication",
"here",
"is",
"that",
"the",
"caller",
"is",
"dumping",
"some",
"valid",
"Ion",
"payload",
"with",
"the",
"correct",
"contex... | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/bin/IonRawBinaryWriter.java#L1468-L1474 |
lucee/Lucee | core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java | ResourceUtil.getResource | public static Resource getResource(PageContext pc, PageSource ps) throws PageException {
return ps.getResourceTranslated(pc);
} | java | public static Resource getResource(PageContext pc, PageSource ps) throws PageException {
return ps.getResourceTranslated(pc);
} | [
"public",
"static",
"Resource",
"getResource",
"(",
"PageContext",
"pc",
",",
"PageSource",
"ps",
")",
"throws",
"PageException",
"{",
"return",
"ps",
".",
"getResourceTranslated",
"(",
"pc",
")",
";",
"}"
] | if the pageSource is based on a archive, translate the source to a zip:// Resource
@return return the Resource matching this PageSource
@param pc the Page Context Object
@deprecated use instead <code>PageSource.getResourceTranslated(PageContext)</code> | [
"if",
"the",
"pageSource",
"is",
"based",
"on",
"a",
"archive",
"translate",
"the",
"source",
"to",
"a",
"zip",
":",
"//",
"Resource"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1410-L1412 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java | FlowController.invokeActionMethod | protected ActionForward invokeActionMethod( Method method, Object arg )
throws Exception
{
return invokeActionMethod( method, arg, getRequest(), getActionMapping() );
} | java | protected ActionForward invokeActionMethod( Method method, Object arg )
throws Exception
{
return invokeActionMethod( method, arg, getRequest(), getActionMapping() );
} | [
"protected",
"ActionForward",
"invokeActionMethod",
"(",
"Method",
"method",
",",
"Object",
"arg",
")",
"throws",
"Exception",
"{",
"return",
"invokeActionMethod",
"(",
"method",
",",
"arg",
",",
"getRequest",
"(",
")",
",",
"getActionMapping",
"(",
")",
")",
... | Invoke the given action handler method, passing it an argument if appropriate.
@param method the action handler method to invoke.
@param arg the form-bean to pass; may be <code>null</code>.
@return the ActionForward returned by the action handler method.
@throws Exception if an Exception was raised in user code. | [
"Invoke",
"the",
"given",
"action",
"handler",
"method",
"passing",
"it",
"an",
"argument",
"if",
"appropriate",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L842-L846 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/query/thesis/AbstractScaleThesisQueryPageHandler.java | AbstractScaleThesisQueryPageHandler.synchronizeField | protected void synchronizeField(Map<String, String> settings, QueryPage queryPage, QueryOption optionsOption, String fieldName, String fieldCaption, Boolean mandatory) {
List<String> options = QueryPageUtils.parseSerializedList(settings.get(optionsOption.getName()));
synchronizeField(queryPage, options, fieldName, fieldCaption, mandatory);
} | java | protected void synchronizeField(Map<String, String> settings, QueryPage queryPage, QueryOption optionsOption, String fieldName, String fieldCaption, Boolean mandatory) {
List<String> options = QueryPageUtils.parseSerializedList(settings.get(optionsOption.getName()));
synchronizeField(queryPage, options, fieldName, fieldCaption, mandatory);
} | [
"protected",
"void",
"synchronizeField",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"settings",
",",
"QueryPage",
"queryPage",
",",
"QueryOption",
"optionsOption",
",",
"String",
"fieldName",
",",
"String",
"fieldCaption",
",",
"Boolean",
"mandatory",
")",
"... | Synchronizes field meta. Should not be used when field already contains replies
@param settings settings map
@param queryPage query page
@param optionsOption page option
@param fieldName field name
@param fieldCaption field caption
@param mandatory whether field is mandatory | [
"Synchronizes",
"field",
"meta",
".",
"Should",
"not",
"be",
"used",
"when",
"field",
"already",
"contains",
"replies"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/query/thesis/AbstractScaleThesisQueryPageHandler.java#L131-L134 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/tenancy/configuration/DurationHelper.java | DurationHelper.getDurationByTimeValues | public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
} | java | public static Duration getDurationByTimeValues(final long hours, final long minutes, final long seconds) {
return Duration.ofHours(hours).plusMinutes(minutes).plusSeconds(seconds);
} | [
"public",
"static",
"Duration",
"getDurationByTimeValues",
"(",
"final",
"long",
"hours",
",",
"final",
"long",
"minutes",
",",
"final",
"long",
"seconds",
")",
"{",
"return",
"Duration",
".",
"ofHours",
"(",
"hours",
")",
".",
"plusMinutes",
"(",
"minutes",
... | converts values of time constants to a Duration object..
@param hours
count of hours
@param minutes
count of minutes
@param seconds
count of seconds
@return duration | [
"converts",
"values",
"of",
"time",
"constants",
"to",
"a",
"Duration",
"object",
".."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/tenancy/configuration/DurationHelper.java#L118-L120 |
nextreports/nextreports-engine | src/ro/nextreports/engine/exporter/XlsxExporter.java | XlsxExporter.updateSubreportBandElementStyle | private XSSFCellStyle updateSubreportBandElementStyle(XSSFCellStyle cellStyle, BandElement bandElement, Object value, int gridRow, int gridColumn, int colSpan) {
if (subreportCellStyle == null) {
return cellStyle;
}
if (gridColumn == 0) {
cellStyle.setBorderLeft(subreportCellStyle.getBorderLeft());
cellStyle.setLeftBorderColor(subreportCellStyle.getLeftBorderColor());
} else if (gridColumn+colSpan-1 == bean.getReportLayout().getColumnCount()-1) {
cellStyle.setBorderRight(subreportCellStyle.getBorderRight());
cellStyle.setRightBorderColor(subreportCellStyle.getRightBorderColor());
}
if (pageRow == 0) {
cellStyle.setBorderTop(subreportCellStyle.getBorderTop());
cellStyle.setTopBorderColor(subreportCellStyle.getTopBorderColor());
} else if ( (pageRow+1) == getRowsCount()) {
cellStyle.setBorderBottom(subreportCellStyle.getBorderBottom());
cellStyle.setBottomBorderColor(subreportCellStyle.getBottomBorderColor());
}
return cellStyle;
} | java | private XSSFCellStyle updateSubreportBandElementStyle(XSSFCellStyle cellStyle, BandElement bandElement, Object value, int gridRow, int gridColumn, int colSpan) {
if (subreportCellStyle == null) {
return cellStyle;
}
if (gridColumn == 0) {
cellStyle.setBorderLeft(subreportCellStyle.getBorderLeft());
cellStyle.setLeftBorderColor(subreportCellStyle.getLeftBorderColor());
} else if (gridColumn+colSpan-1 == bean.getReportLayout().getColumnCount()-1) {
cellStyle.setBorderRight(subreportCellStyle.getBorderRight());
cellStyle.setRightBorderColor(subreportCellStyle.getRightBorderColor());
}
if (pageRow == 0) {
cellStyle.setBorderTop(subreportCellStyle.getBorderTop());
cellStyle.setTopBorderColor(subreportCellStyle.getTopBorderColor());
} else if ( (pageRow+1) == getRowsCount()) {
cellStyle.setBorderBottom(subreportCellStyle.getBorderBottom());
cellStyle.setBottomBorderColor(subreportCellStyle.getBottomBorderColor());
}
return cellStyle;
} | [
"private",
"XSSFCellStyle",
"updateSubreportBandElementStyle",
"(",
"XSSFCellStyle",
"cellStyle",
",",
"BandElement",
"bandElement",
",",
"Object",
"value",
",",
"int",
"gridRow",
",",
"int",
"gridColumn",
",",
"int",
"colSpan",
")",
"{",
"if",
"(",
"subreportCellSt... | If a border style is set on a ReportBandElement we must apply it to all subreport cells | [
"If",
"a",
"border",
"style",
"is",
"set",
"on",
"a",
"ReportBandElement",
"we",
"must",
"apply",
"it",
"to",
"all",
"subreport",
"cells"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/exporter/XlsxExporter.java#L470-L492 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterServiceImpl.java | ClusterServiceImpl.shouldAcceptMastership | private boolean shouldAcceptMastership(MemberMap memberMap, MemberImpl candidate) {
assert lock.isHeldByCurrentThread() : "Called without holding cluster service lock!";
for (MemberImpl member : memberMap.headMemberSet(candidate, false)) {
if (!membershipManager.isMemberSuspected(member.getAddress())) {
if (logger.isFineEnabled()) {
logger.fine("Should not accept mastership claim of " + candidate + ", because " + member
+ " is not suspected at the moment and is before than " + candidate + " in the member list.");
}
return false;
}
}
return true;
} | java | private boolean shouldAcceptMastership(MemberMap memberMap, MemberImpl candidate) {
assert lock.isHeldByCurrentThread() : "Called without holding cluster service lock!";
for (MemberImpl member : memberMap.headMemberSet(candidate, false)) {
if (!membershipManager.isMemberSuspected(member.getAddress())) {
if (logger.isFineEnabled()) {
logger.fine("Should not accept mastership claim of " + candidate + ", because " + member
+ " is not suspected at the moment and is before than " + candidate + " in the member list.");
}
return false;
}
}
return true;
} | [
"private",
"boolean",
"shouldAcceptMastership",
"(",
"MemberMap",
"memberMap",
",",
"MemberImpl",
"candidate",
")",
"{",
"assert",
"lock",
".",
"isHeldByCurrentThread",
"(",
")",
":",
"\"Called without holding cluster service lock!\"",
";",
"for",
"(",
"MemberImpl",
"me... | mastership is accepted when all members before the candidate is suspected | [
"mastership",
"is",
"accepted",
"when",
"all",
"members",
"before",
"the",
"candidate",
"is",
"suspected"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/cluster/impl/ClusterServiceImpl.java#L285-L298 |
dyu/protostuff-1.0.x | protostuff-core/src/main/java/com/dyuproject/protostuff/ProtostuffIOUtil.java | ProtostuffIOUtil.writeListTo | public static <T> int writeListTo(final OutputStream out, final List<T> messages,
final Schema<T> schema, final LinkedBuffer buffer) throws IOException
{
if(buffer.start != buffer.offset)
throw new IllegalArgumentException("Buffer previously used and had not been reset.");
final int size = messages.size();
if(size == 0)
return 0;
final ProtostuffOutput output = new ProtostuffOutput(buffer, out);
output.sink.writeVarInt32(size, output, buffer);
for(T m : messages)
{
schema.writeTo(output, m);
output.sink.writeByte((byte)WireFormat.WIRETYPE_TAIL_DELIMITER, output,
buffer);
}
LinkedBuffer.writeTo(out, buffer);
return output.size;
} | java | public static <T> int writeListTo(final OutputStream out, final List<T> messages,
final Schema<T> schema, final LinkedBuffer buffer) throws IOException
{
if(buffer.start != buffer.offset)
throw new IllegalArgumentException("Buffer previously used and had not been reset.");
final int size = messages.size();
if(size == 0)
return 0;
final ProtostuffOutput output = new ProtostuffOutput(buffer, out);
output.sink.writeVarInt32(size, output, buffer);
for(T m : messages)
{
schema.writeTo(output, m);
output.sink.writeByte((byte)WireFormat.WIRETYPE_TAIL_DELIMITER, output,
buffer);
}
LinkedBuffer.writeTo(out, buffer);
return output.size;
} | [
"public",
"static",
"<",
"T",
">",
"int",
"writeListTo",
"(",
"final",
"OutputStream",
"out",
",",
"final",
"List",
"<",
"T",
">",
"messages",
",",
"final",
"Schema",
"<",
"T",
">",
"schema",
",",
"final",
"LinkedBuffer",
"buffer",
")",
"throws",
"IOExce... | Serializes the {@code messages} (delimited) into an {@link OutputStream}
using the given schema.
@return the bytes written | [
"Serializes",
"the",
"{",
"@code",
"messages",
"}",
"(",
"delimited",
")",
"into",
"an",
"{",
"@link",
"OutputStream",
"}",
"using",
"the",
"given",
"schema",
"."
] | train | https://github.com/dyu/protostuff-1.0.x/blob/d7c964ec20da3fe44699d86ee95c2677ddffde96/protostuff-core/src/main/java/com/dyuproject/protostuff/ProtostuffIOUtil.java#L277-L300 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcUtil.java | JdbcUtil.queryJsonObject | public static JSONObject queryJsonObject(final String sql, final List<Object> paramList, final Connection connection,
final String tableName, final boolean isDebug) throws SQLException, JSONException, RepositoryException {
return queryJson(sql, paramList, connection, true, tableName, isDebug);
} | java | public static JSONObject queryJsonObject(final String sql, final List<Object> paramList, final Connection connection,
final String tableName, final boolean isDebug) throws SQLException, JSONException, RepositoryException {
return queryJson(sql, paramList, connection, true, tableName, isDebug);
} | [
"public",
"static",
"JSONObject",
"queryJsonObject",
"(",
"final",
"String",
"sql",
",",
"final",
"List",
"<",
"Object",
">",
"paramList",
",",
"final",
"Connection",
"connection",
",",
"final",
"String",
"tableName",
",",
"final",
"boolean",
"isDebug",
")",
"... | queryJsonObject.
@param sql sql
@param paramList paramList
@param connection connection
@param tableName tableName
@param isDebug the specified debug flag
@return JSONObject only one record.
@throws SQLException SQLException
@throws JSONException JSONException
@throws RepositoryException repositoryException | [
"queryJsonObject",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcUtil.java#L110-L113 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java | ODataRendererUtils.checkNotNull | public static <T> T checkNotNull(T reference, String message, Object... args) {
if (reference == null) {
throw new IllegalArgumentException(String.format(message, args));
}
return reference;
} | java | public static <T> T checkNotNull(T reference, String message, Object... args) {
if (reference == null) {
throw new IllegalArgumentException(String.format(message, args));
}
return reference;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"T",
"reference",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".... | Check if the reference is not null.
This differs from Guava that throws Illegal Argument Exception + message.
@param reference reference
@param message error message
@param args arguments
@param <T> type
@return reference or exception | [
"Check",
"if",
"the",
"reference",
"is",
"not",
"null",
".",
"This",
"differs",
"from",
"Guava",
"that",
"throws",
"Illegal",
"Argument",
"Exception",
"+",
"message",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java#L122-L127 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/DrizzleResultSet.java | DrizzleResultSet.getTime | public Time getTime(final int columnIndex, final Calendar cal) throws SQLException {
return getValueObject(columnIndex).getTime(cal);
} | java | public Time getTime(final int columnIndex, final Calendar cal) throws SQLException {
return getValueObject(columnIndex).getTime(cal);
} | [
"public",
"Time",
"getTime",
"(",
"final",
"int",
"columnIndex",
",",
"final",
"Calendar",
"cal",
")",
"throws",
"SQLException",
"{",
"return",
"getValueObject",
"(",
"columnIndex",
")",
".",
"getTime",
"(",
"cal",
")",
";",
"}"
] | Retrieves the value of the designated column in the current row of this <code>ResultSet</code> object as a
<code>java.sql.Time</code> object in the Java programming language. This method uses the given calendar to
construct an appropriate millisecond value for the time if the underlying database does not store timezone
information.
@param columnIndex the first column is 1, the second is 2, ...
@param cal the <code>java.util.Calendar</code> object to use in constructing the time
@return the column value as a <code>java.sql.Time</code> object; if the value is SQL <code>NULL</code>, the value
returned is <code>null</code> in the Java programming language
@throws java.sql.SQLException if the columnIndex is not valid; if a database access error occurs or this method
is called on a closed result set
@since 1.2 | [
"Retrieves",
"the",
"value",
"of",
"the",
"designated",
"column",
"in",
"the",
"current",
"row",
"of",
"this",
"<code",
">",
"ResultSet<",
"/",
"code",
">",
"object",
"as",
"a",
"<code",
">",
"java",
".",
"sql",
".",
"Time<",
"/",
"code",
">",
"object"... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleResultSet.java#L2123-L2125 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java | BackupLongTermRetentionPoliciesInner.createOrUpdate | public BackupLongTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body();
} | java | public BackupLongTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, BackupLongTermRetentionPolicyInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).toBlocking().last().body();
} | [
"public",
"BackupLongTermRetentionPolicyInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"BackupLongTermRetentionPolicyInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",... | Creates or updates a database backup long term retention policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database
@param parameters The required parameters to update a backup long term retention policy
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BackupLongTermRetentionPolicyInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"database",
"backup",
"long",
"term",
"retention",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionPoliciesInner.java#L182-L184 |
banq/jdonframework | src/main/java/com/jdon/util/MultiHashMap.java | MultiHashMap.get | public Object get(Object key,Object subKey){
HashMap a = (HashMap)super.get(key);
if(a!=null){
Object b=a.get(subKey);
return b;
}
return null;
} | java | public Object get(Object key,Object subKey){
HashMap a = (HashMap)super.get(key);
if(a!=null){
Object b=a.get(subKey);
return b;
}
return null;
} | [
"public",
"Object",
"get",
"(",
"Object",
"key",
",",
"Object",
"subKey",
")",
"{",
"HashMap",
"a",
"=",
"(",
"HashMap",
")",
"super",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"a",
"!=",
"null",
")",
"{",
"Object",
"b",
"=",
"a",
".",
"get"... | Returns the value to which this map maps the specified key and subKey. Returns null if the map contains no mapping
for this key and subKey. A return value of null does not necessarily indicate that the map contains no mapping
for the key and subKey; it's also possible that the map explicitly maps the key to null.
The containsKey operation may be used to distinguish these two cases.
@param key whose associated value is to be returned.
@param subKey whose associated value is to be returned
@return the value to which this map maps the specified key. | [
"Returns",
"the",
"value",
"to",
"which",
"this",
"map",
"maps",
"the",
"specified",
"key",
"and",
"subKey",
".",
"Returns",
"null",
"if",
"the",
"map",
"contains",
"no",
"mapping",
"for",
"this",
"key",
"and",
"subKey",
".",
"A",
"return",
"value",
"of"... | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/MultiHashMap.java#L51-L58 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/current_timezone.java | current_timezone.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
current_timezone_responses result = (current_timezone_responses) service.get_payload_formatter().string_to_resource(current_timezone_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.current_timezone_response_array);
}
current_timezone[] result_current_timezone = new current_timezone[result.current_timezone_response_array.length];
for(int i = 0; i < result.current_timezone_response_array.length; i++)
{
result_current_timezone[i] = result.current_timezone_response_array[i].current_timezone[0];
}
return result_current_timezone;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
current_timezone_responses result = (current_timezone_responses) service.get_payload_formatter().string_to_resource(current_timezone_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.current_timezone_response_array);
}
current_timezone[] result_current_timezone = new current_timezone[result.current_timezone_response_array.length];
for(int i = 0; i < result.current_timezone_response_array.length; i++)
{
result_current_timezone[i] = result.current_timezone_response_array[i].current_timezone[0];
}
return result_current_timezone;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"current_timezone_responses",
"result",
"=",
"(",
"current_timezone_responses",
")",
"service",
".",
"get_payl... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/current_timezone.java#L203-L220 |
yoojia/NextInputs-Android | inputs/src/main/java/com/github/yoojia/inputs/Texts.java | Texts.regexMatch | public static boolean regexMatch(String input, String regex) {
return Pattern.compile(regex).matcher(input).matches();
} | java | public static boolean regexMatch(String input, String regex) {
return Pattern.compile(regex).matcher(input).matches();
} | [
"public",
"static",
"boolean",
"regexMatch",
"(",
"String",
"input",
",",
"String",
"regex",
")",
"{",
"return",
"Pattern",
".",
"compile",
"(",
"regex",
")",
".",
"matcher",
"(",
"input",
")",
".",
"matches",
"(",
")",
";",
"}"
] | If input matched regex
@param input Input String
@param regex Regex
@return is matched | [
"If",
"input",
"matched",
"regex"
] | train | https://github.com/yoojia/NextInputs-Android/blob/9ca90cf47e84c41ac226d04694194334d2923252/inputs/src/main/java/com/github/yoojia/inputs/Texts.java#L27-L29 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java | AbstractValidate.matchesPattern | public CharSequence matchesPattern(final CharSequence input, final String pattern, final String message, final Object... values) {
if (!Pattern.matches(pattern, input)) {
fail(String.format(message, values));
}
return input;
} | java | public CharSequence matchesPattern(final CharSequence input, final String pattern, final String message, final Object... values) {
if (!Pattern.matches(pattern, input)) {
fail(String.format(message, values));
}
return input;
} | [
"public",
"CharSequence",
"matchesPattern",
"(",
"final",
"CharSequence",
"input",
",",
"final",
"String",
"pattern",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"!",
"Pattern",
".",
"matches",
"(",
"patte... | <p>Validate that the specified argument character sequence matches the specified regular expression pattern; otherwise throwing an exception with the specified message.</p>
<pre>Validate.matchesPattern("hi", "[a-z]*", "%s does not match %s", "hi" "[a-z]*");</pre>
<p>The syntax of the pattern is the one used in the {@link java.util.regex.Pattern} class.</p>
@param input
the character sequence to validate, not null
@param pattern
the regular expression pattern, not null
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@return the input
@throws IllegalArgumentValidationException
if the character sequence does not match the pattern
@see #matchesPattern(CharSequence, String) | [
"<p",
">",
"Validate",
"that",
"the",
"specified",
"argument",
"character",
"sequence",
"matches",
"the",
"specified",
"regular",
"expression",
"pattern",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"<",
"/",
"p",... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L1197-L1202 |
stephenc/simple-java-mail | src/main/java/org/codemonkey/simplejavamail/Email.java | Email.addRecipient | public void addRecipient(final String name, final String address, final RecipientType type) {
recipients.add(new Recipient(name, address, type));
} | java | public void addRecipient(final String name, final String address, final RecipientType type) {
recipients.add(new Recipient(name, address, type));
} | [
"public",
"void",
"addRecipient",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"address",
",",
"final",
"RecipientType",
"type",
")",
"{",
"recipients",
".",
"add",
"(",
"new",
"Recipient",
"(",
"name",
",",
"address",
",",
"type",
")",
")",
"... | Adds a new {@link Recipient} to the list on account of name, address and recipient type (eg.
{@link RecipientType#CC}).
@param name The name of the recipient.
@param address The emailadres of the recipient.
@param type The type of receiver (eg. {@link RecipientType#CC}).
@see #recipients
@see Recipient
@see RecipientType | [
"Adds",
"a",
"new",
"{",
"@link",
"Recipient",
"}",
"to",
"the",
"list",
"on",
"account",
"of",
"name",
"address",
"and",
"recipient",
"type",
"(",
"eg",
".",
"{",
"@link",
"RecipientType#CC",
"}",
")",
"."
] | train | https://github.com/stephenc/simple-java-mail/blob/8c5897e6bbc23c11e7c7eb5064f407625c653923/src/main/java/org/codemonkey/simplejavamail/Email.java#L100-L102 |
aws/aws-sdk-java | aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/GetFolderResult.java | GetFolderResult.withCustomMetadata | public GetFolderResult withCustomMetadata(java.util.Map<String, String> customMetadata) {
setCustomMetadata(customMetadata);
return this;
} | java | public GetFolderResult withCustomMetadata(java.util.Map<String, String> customMetadata) {
setCustomMetadata(customMetadata);
return this;
} | [
"public",
"GetFolderResult",
"withCustomMetadata",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"customMetadata",
")",
"{",
"setCustomMetadata",
"(",
"customMetadata",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The custom metadata on the folder.
</p>
@param customMetadata
The custom metadata on the folder.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"custom",
"metadata",
"on",
"the",
"folder",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/GetFolderResult.java#L114-L117 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/monitoring/internal/AsynchronousAgentDispatcher.java | AsynchronousAgentDispatcher.addWriteTask | public void addWriteTask(MonitoringEvent event, DatagramChannel channel, int maxSize) {
if (!initialized) {
throw new IllegalStateException("Dispatcher is not initialized!");
}
tasks.add(new WriteTask(event, channel, maxSize));
} | java | public void addWriteTask(MonitoringEvent event, DatagramChannel channel, int maxSize) {
if (!initialized) {
throw new IllegalStateException("Dispatcher is not initialized!");
}
tasks.add(new WriteTask(event, channel, maxSize));
} | [
"public",
"void",
"addWriteTask",
"(",
"MonitoringEvent",
"event",
",",
"DatagramChannel",
"channel",
",",
"int",
"maxSize",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Dispatcher is not initialized!\"",
")",
... | Add a task to asynchronously write {@code event} to the {@code channel}
if its serialized form does not exceed {@code maxSize}.
@param event The event to write.
@param channel The channel to write to.
@param maxSize The maximum allowed size for the serialized {@code event}.
@throws IllegalStateException If this dispatcher has not yet been
initialized via {@link #init()}. | [
"Add",
"a",
"task",
"to",
"asynchronously",
"write",
"{",
"@code",
"event",
"}",
"to",
"the",
"{",
"@code",
"channel",
"}",
"if",
"its",
"serialized",
"form",
"does",
"not",
"exceed",
"{",
"@code",
"maxSize",
"}",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/monitoring/internal/AsynchronousAgentDispatcher.java#L79-L84 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.getDisplayLanguageWithDialect | public static String getDisplayLanguageWithDialect(String localeID, String displayLocaleID) {
return getDisplayLanguageInternal(new ULocale(localeID), new ULocale(displayLocaleID),
true);
} | java | public static String getDisplayLanguageWithDialect(String localeID, String displayLocaleID) {
return getDisplayLanguageInternal(new ULocale(localeID), new ULocale(displayLocaleID),
true);
} | [
"public",
"static",
"String",
"getDisplayLanguageWithDialect",
"(",
"String",
"localeID",
",",
"String",
"displayLocaleID",
")",
"{",
"return",
"getDisplayLanguageInternal",
"(",
"new",
"ULocale",
"(",
"localeID",
")",
",",
"new",
"ULocale",
"(",
"displayLocaleID",
... | <strong>[icu]</strong> Returns a locale's language localized for display in the provided locale.
If a dialect name is present in the data, then it is returned.
This is a cover for the ICU4C API.
@param localeID the id of the locale whose language will be displayed
@param displayLocaleID the id of the locale in which to display the name.
@return the localized language name. | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"a",
"locale",
"s",
"language",
"localized",
"for",
"display",
"in",
"the",
"provided",
"locale",
".",
"If",
"a",
"dialect",
"name",
"is",
"present",
"in",
"the",
"data",
"then",
"it"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1436-L1439 |
ziccardi/jnrpe | jnrpe-lib/src/main/java/it/jnrpe/ReturnValue.java | ReturnValue.withPerformanceData | public ReturnValue withPerformanceData(final Metric metric, final UnitOfMeasure uom, final String warningRange,
final String criticalRange) {
performanceDataList.add(new PerformanceData(metric, uom, warningRange, criticalRange));
return this;
} | java | public ReturnValue withPerformanceData(final Metric metric, final UnitOfMeasure uom, final String warningRange,
final String criticalRange) {
performanceDataList.add(new PerformanceData(metric, uom, warningRange, criticalRange));
return this;
} | [
"public",
"ReturnValue",
"withPerformanceData",
"(",
"final",
"Metric",
"metric",
",",
"final",
"UnitOfMeasure",
"uom",
",",
"final",
"String",
"warningRange",
",",
"final",
"String",
"criticalRange",
")",
"{",
"performanceDataList",
".",
"add",
"(",
"new",
"Perfo... | Adds performance data to the plugin result. Thos data will be added to
the output formatted as specified in Nagios specifications
(http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN201)
@param metric
The metric relative to this result
@param uom
The Unit Of Measure
@param warningRange
The warning threshold used to check this metric (can be null)
@param criticalRange
The critical threshold used to check this value (can be null)
@return this | [
"Adds",
"performance",
"data",
"to",
"the",
"plugin",
"result",
".",
"Thos",
"data",
"will",
"be",
"added",
"to",
"the",
"output",
"formatted",
"as",
"specified",
"in",
"Nagios",
"specifications",
"(",
"http",
":",
"//",
"nagiosplug",
".",
"sourceforge",
"."... | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/ReturnValue.java#L237-L241 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java | AnycastOutputHandler.writtenStartedFlush | public final void writtenStartedFlush(AOStream stream, Item startedFlushItem)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writtenStartedFlush");
String key =
SIMPUtils.getRemoteGetKey(stream.getRemoteMEUuid(), stream.getGatheringTargetDestUuid());
StreamInfo sinfo = streamTable.get(key);
if ((sinfo != null) && sinfo.streamId.equals(stream.streamId))
{
synchronized (sinfo)
{
sinfo.item = (AOStartedFlushItem) startedFlushItem;
}
}
else
{
// this should not occur
// log error and throw exception
SIErrorException e = new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.impl.AnycastOutputHandler",
"1:2858:1.89.4.1" },
null));
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writtenStartedFlush",
"1:2865:1.89.4.1",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.impl.AnycastOutputHandler",
"1:2872:1.89.4.1" });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writtenStartedFlush", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writtenStartedFlush");
} | java | public final void writtenStartedFlush(AOStream stream, Item startedFlushItem)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "writtenStartedFlush");
String key =
SIMPUtils.getRemoteGetKey(stream.getRemoteMEUuid(), stream.getGatheringTargetDestUuid());
StreamInfo sinfo = streamTable.get(key);
if ((sinfo != null) && sinfo.streamId.equals(stream.streamId))
{
synchronized (sinfo)
{
sinfo.item = (AOStartedFlushItem) startedFlushItem;
}
}
else
{
// this should not occur
// log error and throw exception
SIErrorException e = new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.impl.AnycastOutputHandler",
"1:2858:1.89.4.1" },
null));
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AnycastOutputHandler.writtenStartedFlush",
"1:2865:1.89.4.1",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.impl.AnycastOutputHandler",
"1:2872:1.89.4.1" });
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writtenStartedFlush", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "writtenStartedFlush");
} | [
"public",
"final",
"void",
"writtenStartedFlush",
"(",
"AOStream",
"stream",
",",
"Item",
"startedFlushItem",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
... | Callback when the Item that records that flush has been started has been committed to persistent storage
@param stream The stream making this call
@param startedFlushItem The item written | [
"Callback",
"when",
"the",
"Item",
"that",
"records",
"that",
"flush",
"has",
"been",
"started",
"has",
"been",
"committed",
"to",
"persistent",
"storage"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L2789-L2835 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/tools/IonizationPotentialTool.java | IonizationPotentialTool.predictIP | public static double predictIP(IAtomContainer container, IAtom atom) throws CDKException {
double value = 0;
// at least one lone pair orbital is necessary to ionize
if (container.getConnectedLonePairsCount(atom) == 0) return value;
// control if the IAtom belongs in some family
if (familyHalogen(atom))
value = getDTHalogenF(getQSARs(container, atom));
else if (familyOxygen(atom))
value = getDTOxygenF(getQSARs(container, atom));
else if (familyNitrogen(atom)) value = getDTNitrogenF(getQSARs(container, atom));
return value;
} | java | public static double predictIP(IAtomContainer container, IAtom atom) throws CDKException {
double value = 0;
// at least one lone pair orbital is necessary to ionize
if (container.getConnectedLonePairsCount(atom) == 0) return value;
// control if the IAtom belongs in some family
if (familyHalogen(atom))
value = getDTHalogenF(getQSARs(container, atom));
else if (familyOxygen(atom))
value = getDTOxygenF(getQSARs(container, atom));
else if (familyNitrogen(atom)) value = getDTNitrogenF(getQSARs(container, atom));
return value;
} | [
"public",
"static",
"double",
"predictIP",
"(",
"IAtomContainer",
"container",
",",
"IAtom",
"atom",
")",
"throws",
"CDKException",
"{",
"double",
"value",
"=",
"0",
";",
"// at least one lone pair orbital is necessary to ionize",
"if",
"(",
"container",
".",
"getConn... | Method which is predict the Ionization Potential from given atom.
@param container The IAtomContainer where is contained the IAtom
@param atom The IAtom to prediction the IP
@return The value in eV | [
"Method",
"which",
"is",
"predict",
"the",
"Ionization",
"Potential",
"from",
"given",
"atom",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/tools/IonizationPotentialTool.java#L70-L84 |
perwendel/spark | src/main/java/spark/FilterImpl.java | FilterImpl.create | static FilterImpl create(final String path, final Filter filter) {
return create(path, DEFAULT_ACCEPT_TYPE, filter);
} | java | static FilterImpl create(final String path, final Filter filter) {
return create(path, DEFAULT_ACCEPT_TYPE, filter);
} | [
"static",
"FilterImpl",
"create",
"(",
"final",
"String",
"path",
",",
"final",
"Filter",
"filter",
")",
"{",
"return",
"create",
"(",
"path",
",",
"DEFAULT_ACCEPT_TYPE",
",",
"filter",
")",
";",
"}"
] | Wraps the filter in FilterImpl
@param path the path
@param filter the filter
@return the wrapped route | [
"Wraps",
"the",
"filter",
"in",
"FilterImpl"
] | train | https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/FilterImpl.java#L54-L56 |
icode/ameba | src/main/java/ameba/db/ebean/filter/CommonExprTransformer.java | CommonExprTransformer.fillArgs | public static void fillArgs(String operator, Val<Expression>[] args, ExpressionList<?> et) {
for (Val<Expression> val : args) {
if (val.object() instanceof Expression) {
et.add(val.expr());
} else {
throw new QuerySyntaxException(Messages.get("dsl.arguments.error3", operator));
}
}
} | java | public static void fillArgs(String operator, Val<Expression>[] args, ExpressionList<?> et) {
for (Val<Expression> val : args) {
if (val.object() instanceof Expression) {
et.add(val.expr());
} else {
throw new QuerySyntaxException(Messages.get("dsl.arguments.error3", operator));
}
}
} | [
"public",
"static",
"void",
"fillArgs",
"(",
"String",
"operator",
",",
"Val",
"<",
"Expression",
">",
"[",
"]",
"args",
",",
"ExpressionList",
"<",
"?",
">",
"et",
")",
"{",
"for",
"(",
"Val",
"<",
"Expression",
">",
"val",
":",
"args",
")",
"{",
... | <p>fillArgs.</p>
@param operator a {@link java.lang.String} object.
@param args an array of {@link ameba.db.dsl.QueryExprMeta.Val} objects.
@param et a {@link io.ebean.ExpressionList} object. | [
"<p",
">",
"fillArgs",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/filter/CommonExprTransformer.java#L47-L55 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchIndex.java | CmsSearchIndex.getMultiTermQueryFilter | protected Query getMultiTermQueryFilter(String field, List<String> terms) {
return getMultiTermQueryFilter(field, null, terms);
} | java | protected Query getMultiTermQueryFilter(String field, List<String> terms) {
return getMultiTermQueryFilter(field, null, terms);
} | [
"protected",
"Query",
"getMultiTermQueryFilter",
"(",
"String",
"field",
",",
"List",
"<",
"String",
">",
"terms",
")",
"{",
"return",
"getMultiTermQueryFilter",
"(",
"field",
",",
"null",
",",
"terms",
")",
";",
"}"
] | Returns a cached Lucene term query filter for the given field and terms.<p>
@param field the field to use
@param terms the term to use
@return a cached Lucene term query filter for the given field and terms | [
"Returns",
"a",
"cached",
"Lucene",
"term",
"query",
"filter",
"for",
"the",
"given",
"field",
"and",
"terms",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchIndex.java#L1620-L1623 |
mgm-tp/jfunk | jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ExtendedProperties.java | ExtendedProperties.get | public String get(final Object key, final boolean process) {
String value = propsMap.get(key);
if (process) {
value = processPropertyValue(value);
}
return value == null && defaults != null ? defaults.get(key) : value;
} | java | public String get(final Object key, final boolean process) {
String value = propsMap.get(key);
if (process) {
value = processPropertyValue(value);
}
return value == null && defaults != null ? defaults.get(key) : value;
} | [
"public",
"String",
"get",
"(",
"final",
"Object",
"key",
",",
"final",
"boolean",
"process",
")",
"{",
"String",
"value",
"=",
"propsMap",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"process",
")",
"{",
"value",
"=",
"processPropertyValue",
"(",
"va... | Looks up a property. Recursively checks the defaults if necessary. If the property is found
as a system property, this value will be used.
@param key
The property key
@param process
If {@code true}, the looked-up value is passed to
{@link #processPropertyValue(String)}, and the processed result is returned.
@return The property value, or {@code null} if the property is not found | [
"Looks",
"up",
"a",
"property",
".",
"Recursively",
"checks",
"the",
"defaults",
"if",
"necessary",
".",
"If",
"the",
"property",
"is",
"found",
"as",
"a",
"system",
"property",
"this",
"value",
"will",
"be",
"used",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/util/ExtendedProperties.java#L167-L173 |
hazelcast/hazelcast-kubernetes | src/main/java/com/hazelcast/kubernetes/RestClient.java | RestClient.buildSslSocketFactory | private SSLSocketFactory buildSslSocketFactory() {
try {
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(null, null);
keyStore.setCertificateEntry("ca", generateCertificate());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(keyStore);
SSLContext context = SSLContext.getInstance("TLSv1.2");
context.init(null, tmf.getTrustManagers(), null);
return context.getSocketFactory();
} catch (Exception e) {
throw new KubernetesClientException("Failure in generating SSLSocketFactory", e);
}
} | java | private SSLSocketFactory buildSslSocketFactory() {
try {
KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(null, null);
keyStore.setCertificateEntry("ca", generateCertificate());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(keyStore);
SSLContext context = SSLContext.getInstance("TLSv1.2");
context.init(null, tmf.getTrustManagers(), null);
return context.getSocketFactory();
} catch (Exception e) {
throw new KubernetesClientException("Failure in generating SSLSocketFactory", e);
}
} | [
"private",
"SSLSocketFactory",
"buildSslSocketFactory",
"(",
")",
"{",
"try",
"{",
"KeyStore",
"keyStore",
"=",
"KeyStore",
".",
"getInstance",
"(",
"KeyStore",
".",
"getDefaultType",
"(",
")",
")",
";",
"keyStore",
".",
"load",
"(",
"null",
",",
"null",
")"... | Builds SSL Socket Factory with the public CA Certificate from Kubernetes Master. | [
"Builds",
"SSL",
"Socket",
"Factory",
"with",
"the",
"public",
"CA",
"Certificate",
"from",
"Kubernetes",
"Master",
"."
] | train | https://github.com/hazelcast/hazelcast-kubernetes/blob/b1144067addf56d1446a9e1007f5cb3290b86815/src/main/java/com/hazelcast/kubernetes/RestClient.java#L174-L190 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java | WPanelTypeExample.buildSubordinates | private void buildSubordinates() {
WSubordinateControl control = new WSubordinateControl();
Rule rule = new Rule();
rule.setCondition(new Equal(panelType, WPanel.Type.HEADER));
rule.addActionOnTrue(new Show(showUtilBarField));
rule.addActionOnTrue(new Show(showMenuField));
rule.addActionOnTrue(new Hide(contentField));
rule.addActionOnFalse(new Hide(showUtilBarField));
rule.addActionOnFalse(new Hide(showMenuField));
rule.addActionOnFalse(new Show(contentField));
control.addRule(rule);
rule = new Rule();
rule.setCondition(
new Or(
new Equal(panelType, WPanel.Type.CHROME),
new Equal(panelType, WPanel.Type.ACTION),
new Equal(panelType, WPanel.Type.HEADER)
));
rule.addActionOnTrue(new Show(headingField));
rule.addActionOnFalse(new Hide(headingField));
control.addRule(rule);
add(control);
} | java | private void buildSubordinates() {
WSubordinateControl control = new WSubordinateControl();
Rule rule = new Rule();
rule.setCondition(new Equal(panelType, WPanel.Type.HEADER));
rule.addActionOnTrue(new Show(showUtilBarField));
rule.addActionOnTrue(new Show(showMenuField));
rule.addActionOnTrue(new Hide(contentField));
rule.addActionOnFalse(new Hide(showUtilBarField));
rule.addActionOnFalse(new Hide(showMenuField));
rule.addActionOnFalse(new Show(contentField));
control.addRule(rule);
rule = new Rule();
rule.setCondition(
new Or(
new Equal(panelType, WPanel.Type.CHROME),
new Equal(panelType, WPanel.Type.ACTION),
new Equal(panelType, WPanel.Type.HEADER)
));
rule.addActionOnTrue(new Show(headingField));
rule.addActionOnFalse(new Hide(headingField));
control.addRule(rule);
add(control);
} | [
"private",
"void",
"buildSubordinates",
"(",
")",
"{",
"WSubordinateControl",
"control",
"=",
"new",
"WSubordinateControl",
"(",
")",
";",
"Rule",
"rule",
"=",
"new",
"Rule",
"(",
")",
";",
"rule",
".",
"setCondition",
"(",
"new",
"Equal",
"(",
"panelType",
... | The subordinate controls used to show/hide parts of the configuration options based on the selected WPanel Type. | [
"The",
"subordinate",
"controls",
"used",
"to",
"show",
"/",
"hide",
"parts",
"of",
"the",
"configuration",
"options",
"based",
"on",
"the",
"selected",
"WPanel",
"Type",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WPanelTypeExample.java#L263-L285 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/SerializationUtils.java | SerializationUtils.serializeState | public static <T extends State> void serializeState(FileSystem fs, Path jobStateFilePath, T state)
throws IOException {
serializeState(fs, jobStateFilePath, state, fs.getDefaultReplication(jobStateFilePath));
} | java | public static <T extends State> void serializeState(FileSystem fs, Path jobStateFilePath, T state)
throws IOException {
serializeState(fs, jobStateFilePath, state, fs.getDefaultReplication(jobStateFilePath));
} | [
"public",
"static",
"<",
"T",
"extends",
"State",
">",
"void",
"serializeState",
"(",
"FileSystem",
"fs",
",",
"Path",
"jobStateFilePath",
",",
"T",
"state",
")",
"throws",
"IOException",
"{",
"serializeState",
"(",
"fs",
",",
"jobStateFilePath",
",",
"state",... | Serialize a {@link State} instance to a file.
@param fs the {@link FileSystem} instance for creating the file
@param jobStateFilePath the path to the file
@param state the {@link State} to serialize
@param <T> the {@link State} object type
@throws IOException if it fails to serialize the {@link State} instance | [
"Serialize",
"a",
"{",
"@link",
"State",
"}",
"instance",
"to",
"a",
"file",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/SerializationUtils.java#L141-L144 |
alkacon/opencms-core | src/org/opencms/ui/apps/logfile/CmsLogChannelTable.java | CmsLogChannelTable.changeLoggerLevel | void changeLoggerLevel(LoggerLevel clickedLevel, Set<Logger> clickedLogger) {
for (Logger logger : clickedLogger) {
@SuppressWarnings("resource")
LoggerContext context = logger.getContext();
Configuration config = context.getConfiguration();
LoggerConfig loggerConfig = config.getLoggerConfig(logger.getName());
LoggerConfig specificConfig = loggerConfig;
if (!loggerConfig.getName().equals(logger.getName())) {
specificConfig = new LoggerConfig(logger.getName(), clickedLevel.getLevel(), true);
specificConfig.setParent(loggerConfig);
config.addLogger(logger.getName(), specificConfig);
}
specificConfig.setLevel(clickedLevel.getLevel());
context.updateLoggers();
}
updateLevel();
} | java | void changeLoggerLevel(LoggerLevel clickedLevel, Set<Logger> clickedLogger) {
for (Logger logger : clickedLogger) {
@SuppressWarnings("resource")
LoggerContext context = logger.getContext();
Configuration config = context.getConfiguration();
LoggerConfig loggerConfig = config.getLoggerConfig(logger.getName());
LoggerConfig specificConfig = loggerConfig;
if (!loggerConfig.getName().equals(logger.getName())) {
specificConfig = new LoggerConfig(logger.getName(), clickedLevel.getLevel(), true);
specificConfig.setParent(loggerConfig);
config.addLogger(logger.getName(), specificConfig);
}
specificConfig.setLevel(clickedLevel.getLevel());
context.updateLoggers();
}
updateLevel();
} | [
"void",
"changeLoggerLevel",
"(",
"LoggerLevel",
"clickedLevel",
",",
"Set",
"<",
"Logger",
">",
"clickedLogger",
")",
"{",
"for",
"(",
"Logger",
"logger",
":",
"clickedLogger",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"LoggerContext",
"conte... | Sets a given Level to a Set of Loggers.<p>
@param clickedLevel to be set
@param clickedLogger to get level changed | [
"Sets",
"a",
"given",
"Level",
"to",
"a",
"Set",
"of",
"Loggers",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/logfile/CmsLogChannelTable.java#L504-L521 |
apollographql/apollo-android | apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java | ResponseField.forBoolean | public static ResponseField forBoolean(String responseName, String fieldName, Map<String, Object> arguments,
boolean optional, List<Condition> conditions) {
return new ResponseField(Type.BOOLEAN, responseName, fieldName, arguments, optional, conditions);
} | java | public static ResponseField forBoolean(String responseName, String fieldName, Map<String, Object> arguments,
boolean optional, List<Condition> conditions) {
return new ResponseField(Type.BOOLEAN, responseName, fieldName, arguments, optional, conditions);
} | [
"public",
"static",
"ResponseField",
"forBoolean",
"(",
"String",
"responseName",
",",
"String",
"fieldName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"arguments",
",",
"boolean",
"optional",
",",
"List",
"<",
"Condition",
">",
"conditions",
")",
"{",
... | Factory method for creating a Field instance representing {@link Type#BOOLEAN}.
@param responseName alias for the result of a field
@param fieldName name of the field in the GraphQL operation
@param arguments arguments to be passed along with the field
@param optional whether the arguments passed along are optional or required
@param conditions list of conditions for this field
@return Field instance representing {@link Type#BOOLEAN} | [
"Factory",
"method",
"for",
"creating",
"a",
"Field",
"instance",
"representing",
"{",
"@link",
"Type#BOOLEAN",
"}",
"."
] | train | https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java#L100-L103 |
foundation-runtime/logging | logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java | TransactionLogger.addTimePerComponent | private static void addTimePerComponent(HashMap<String, Long> mapComponentTimes, Component component) {
Long currentTimeOfComponent = 0L;
String key = component.getComponentType();
if (mapComponentTimes.containsKey(key)) {
currentTimeOfComponent = mapComponentTimes.get(key);
}
//when transactions are run in parallel, we should log the longest transaction only to avoid that
//for ex 'Total time' would be 100ms and transactions in parallel to hornetQ will be 2000ms
Long maxTime = Math.max(component.getTime(), currentTimeOfComponent);
mapComponentTimes.put(key, maxTime);
} | java | private static void addTimePerComponent(HashMap<String, Long> mapComponentTimes, Component component) {
Long currentTimeOfComponent = 0L;
String key = component.getComponentType();
if (mapComponentTimes.containsKey(key)) {
currentTimeOfComponent = mapComponentTimes.get(key);
}
//when transactions are run in parallel, we should log the longest transaction only to avoid that
//for ex 'Total time' would be 100ms and transactions in parallel to hornetQ will be 2000ms
Long maxTime = Math.max(component.getTime(), currentTimeOfComponent);
mapComponentTimes.put(key, maxTime);
} | [
"private",
"static",
"void",
"addTimePerComponent",
"(",
"HashMap",
"<",
"String",
",",
"Long",
">",
"mapComponentTimes",
",",
"Component",
"component",
")",
"{",
"Long",
"currentTimeOfComponent",
"=",
"0L",
";",
"String",
"key",
"=",
"component",
".",
"getCompo... | Add component processing time to given map
@param mapComponentTimes
@param component | [
"Add",
"component",
"processing",
"time",
"to",
"given",
"map"
] | train | https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-api/src/main/java/com/cisco/oss/foundation/logging/transactions/TransactionLogger.java#L446-L456 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java | ExpressRouteCrossConnectionsInner.getByResourceGroupAsync | public Observable<ExpressRouteCrossConnectionInner> getByResourceGroupAsync(String resourceGroupName, String crossConnectionName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, crossConnectionName).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionInner>, ExpressRouteCrossConnectionInner>() {
@Override
public ExpressRouteCrossConnectionInner call(ServiceResponse<ExpressRouteCrossConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCrossConnectionInner> getByResourceGroupAsync(String resourceGroupName, String crossConnectionName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, crossConnectionName).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionInner>, ExpressRouteCrossConnectionInner>() {
@Override
public ExpressRouteCrossConnectionInner call(ServiceResponse<ExpressRouteCrossConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCrossConnectionInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"crossConn... | Gets details about the specified ExpressRouteCrossConnection.
@param resourceGroupName The name of the resource group (peering location of the circuit).
@param crossConnectionName The name of the ExpressRouteCrossConnection (service key of the circuit).
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCrossConnectionInner object | [
"Gets",
"details",
"about",
"the",
"specified",
"ExpressRouteCrossConnection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L384-L391 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java | ReplyFactory.addReceiptTemplate | public static ReceiptTemplateBuilder addReceiptTemplate(
String recipientName, String orderNumber, String currency,
String paymentMethod) {
return new ReceiptTemplateBuilder(recipientName, orderNumber, currency,
paymentMethod);
} | java | public static ReceiptTemplateBuilder addReceiptTemplate(
String recipientName, String orderNumber, String currency,
String paymentMethod) {
return new ReceiptTemplateBuilder(recipientName, orderNumber, currency,
paymentMethod);
} | [
"public",
"static",
"ReceiptTemplateBuilder",
"addReceiptTemplate",
"(",
"String",
"recipientName",
",",
"String",
"orderNumber",
",",
"String",
"currency",
",",
"String",
"paymentMethod",
")",
"{",
"return",
"new",
"ReceiptTemplateBuilder",
"(",
"recipientName",
",",
... | Adds a Receipt Template to the response.
@param recipientName
the recipient name. It can't be empty.
@param orderNumber
the order number. It can't be empty and it must be unique for
each user.
@param currency
the currency for order. It can't be empty.
@param paymentMethod
the payment method details. This can be a custom string. ex:
"Visa 1234". You may insert an arbitrary string here but we
recommend providing enough information for the person to
decipher which payment method and account they used (e.g., the
name of the payment method and partial account number). It
can't be empty.
@return a builder for the response.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/receipt-template"
> Facebook's Messenger Platform Receipt Template Documentation</a> | [
"Adds",
"a",
"Receipt",
"Template",
"to",
"the",
"response",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ReplyFactory.java#L404-L409 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java | VirtualWANsInner.createOrUpdate | public VirtualWANInner createOrUpdate(String resourceGroupName, String virtualWANName, VirtualWANInner wANParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWANName, wANParameters).toBlocking().last().body();
} | java | public VirtualWANInner createOrUpdate(String resourceGroupName, String virtualWANName, VirtualWANInner wANParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWANName, wANParameters).toBlocking().last().body();
} | [
"public",
"VirtualWANInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualWANName",
",",
"VirtualWANInner",
"wANParameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualWANName",
",",
"... | Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN.
@param resourceGroupName The resource group name of the VirtualWan.
@param virtualWANName The name of the VirtualWAN being created or updated.
@param wANParameters Parameters supplied to create or update VirtualWAN.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VirtualWANInner object if successful. | [
"Creates",
"a",
"VirtualWAN",
"resource",
"if",
"it",
"doesn",
"t",
"exist",
"else",
"updates",
"the",
"existing",
"VirtualWAN",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java#L211-L213 |
kohsuke/args4j | args4j/src/org/kohsuke/args4j/spi/OptionHandler.java | OptionHandler.getNameAndMeta | public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) {
String str = option.isArgument() ? "" : option.toString();
String meta = getMetaVariable(rb);
if (meta != null) {
if (str.length() > 0) {
str += properties.getOptionValueDelimiter();
}
str += meta;
}
return str;
} | java | public final String getNameAndMeta(ResourceBundle rb, ParserProperties properties) {
String str = option.isArgument() ? "" : option.toString();
String meta = getMetaVariable(rb);
if (meta != null) {
if (str.length() > 0) {
str += properties.getOptionValueDelimiter();
}
str += meta;
}
return str;
} | [
"public",
"final",
"String",
"getNameAndMeta",
"(",
"ResourceBundle",
"rb",
",",
"ParserProperties",
"properties",
")",
"{",
"String",
"str",
"=",
"option",
".",
"isArgument",
"(",
")",
"?",
"\"\"",
":",
"option",
".",
"toString",
"(",
")",
";",
"String",
... | Get string representing usage for this option, of the form "name metaval" or "name=metaval,
e.g. "--foo VALUE" or "--foo=VALUE"
@param rb ResourceBundle to get localized version of meta string
@param properties
Affects the formatting behaviours. | [
"Get",
"string",
"representing",
"usage",
"for",
"this",
"option",
"of",
"the",
"form",
"name",
"metaval",
"or",
"name",
"=",
"metaval",
"e",
".",
"g",
".",
"--",
"foo",
"VALUE",
"or",
"--",
"foo",
"=",
"VALUE"
] | train | https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/spi/OptionHandler.java#L110-L120 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/PartitionInput.java | PartitionInput.withParameters | public PartitionInput withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | java | public PartitionInput withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | [
"public",
"PartitionInput",
"withParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"setParameters",
"(",
"parameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
These key-value pairs define partition parameters.
</p>
@param parameters
These key-value pairs define partition parameters.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"These",
"key",
"-",
"value",
"pairs",
"define",
"partition",
"parameters",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/PartitionInput.java#L256-L259 |
apache/incubator-shardingsphere | sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/execute/result/QueryResultUtil.java | QueryResultUtil.getValue | public static Object getValue(final ResultSet resultSet, final int columnIndex) throws SQLException {
Object result = getValueByColumnType(resultSet, columnIndex);
return resultSet.wasNull() ? null : result;
} | java | public static Object getValue(final ResultSet resultSet, final int columnIndex) throws SQLException {
Object result = getValueByColumnType(resultSet, columnIndex);
return resultSet.wasNull() ? null : result;
} | [
"public",
"static",
"Object",
"getValue",
"(",
"final",
"ResultSet",
"resultSet",
",",
"final",
"int",
"columnIndex",
")",
"throws",
"SQLException",
"{",
"Object",
"result",
"=",
"getValueByColumnType",
"(",
"resultSet",
",",
"columnIndex",
")",
";",
"return",
"... | Get value.
@param resultSet result set
@param columnIndex column index of value
@return {@code null} if the column is SQL {@code NULL}, otherwise the value of column
@throws SQLException SQL exception | [
"Get",
"value",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/execute/result/QueryResultUtil.java#L40-L43 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java | JavacParser.memberReferenceSuffix | JCExpression memberReferenceSuffix(JCExpression t) {
int pos1 = token.pos;
accept(COLCOL);
return memberReferenceSuffix(pos1, t);
} | java | JCExpression memberReferenceSuffix(JCExpression t) {
int pos1 = token.pos;
accept(COLCOL);
return memberReferenceSuffix(pos1, t);
} | [
"JCExpression",
"memberReferenceSuffix",
"(",
"JCExpression",
"t",
")",
"{",
"int",
"pos1",
"=",
"token",
".",
"pos",
";",
"accept",
"(",
"COLCOL",
")",
";",
"return",
"memberReferenceSuffix",
"(",
"pos1",
",",
"t",
")",
";",
"}"
] | MemberReferenceSuffix = "::" [TypeArguments] Ident
| "::" [TypeArguments] "new" | [
"MemberReferenceSuffix",
"=",
"::",
"[",
"TypeArguments",
"]",
"Ident",
"|",
"::",
"[",
"TypeArguments",
"]",
"new"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L2042-L2046 |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/JumblrClient.java | JumblrClient.postDelete | public void postDelete(String blogName, Long postId) {
Map<String, String> map = new HashMap<String, String>();
map.put("id", postId.toString());
requestBuilder.post(JumblrClient.blogPath(blogName, "/post/delete"), map);
} | java | public void postDelete(String blogName, Long postId) {
Map<String, String> map = new HashMap<String, String>();
map.put("id", postId.toString());
requestBuilder.post(JumblrClient.blogPath(blogName, "/post/delete"), map);
} | [
"public",
"void",
"postDelete",
"(",
"String",
"blogName",
",",
"Long",
"postId",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"map",
".",
"put",
"(",
"\"id\"",
... | Delete a given post
@param blogName the name of the blog the post is in
@param postId the id of the post to delete | [
"Delete",
"a",
"given",
"post"
] | train | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L328-L332 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.directories_cities_GET | public ArrayList<OvhCity> directories_cities_GET(OvhNumberCountryEnum country, String zipCode) throws IOException {
String qPath = "/telephony/directories/cities";
StringBuilder sb = path(qPath);
query(sb, "country", country);
query(sb, "zipCode", zipCode);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t23);
} | java | public ArrayList<OvhCity> directories_cities_GET(OvhNumberCountryEnum country, String zipCode) throws IOException {
String qPath = "/telephony/directories/cities";
StringBuilder sb = path(qPath);
query(sb, "country", country);
query(sb, "zipCode", zipCode);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t23);
} | [
"public",
"ArrayList",
"<",
"OvhCity",
">",
"directories_cities_GET",
"(",
"OvhNumberCountryEnum",
"country",
",",
"String",
"zipCode",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/directories/cities\"",
";",
"StringBuilder",
"sb",
"=",
"pa... | Get city informations from a zip code
REST: GET /telephony/directories/cities
@param country [required] The country of the city
@param zipCode [required] The zip code of the city | [
"Get",
"city",
"informations",
"from",
"a",
"zip",
"code"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8695-L8702 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.getNameReferenceCount | static int getNameReferenceCount(Node node, String name) {
return getCount(node, new MatchNameNode(name), Predicates.alwaysTrue());
} | java | static int getNameReferenceCount(Node node, String name) {
return getCount(node, new MatchNameNode(name), Predicates.alwaysTrue());
} | [
"static",
"int",
"getNameReferenceCount",
"(",
"Node",
"node",
",",
"String",
"name",
")",
"{",
"return",
"getCount",
"(",
"node",
",",
"new",
"MatchNameNode",
"(",
"name",
")",
",",
"Predicates",
".",
"alwaysTrue",
"(",
")",
")",
";",
"}"
] | Finds the number of times a simple name is referenced within the node tree. | [
"Finds",
"the",
"number",
"of",
"times",
"a",
"simple",
"name",
"is",
"referenced",
"within",
"the",
"node",
"tree",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L4667-L4669 |
VoltDB/voltdb | third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java | Util.makeFileLoggerURL | public static URI makeFileLoggerURL(File dataDir, File dataLogDir){
return URI.create(makeURIString(dataDir.getPath(),dataLogDir.getPath(),null));
} | java | public static URI makeFileLoggerURL(File dataDir, File dataLogDir){
return URI.create(makeURIString(dataDir.getPath(),dataLogDir.getPath(),null));
} | [
"public",
"static",
"URI",
"makeFileLoggerURL",
"(",
"File",
"dataDir",
",",
"File",
"dataLogDir",
")",
"{",
"return",
"URI",
".",
"create",
"(",
"makeURIString",
"(",
"dataDir",
".",
"getPath",
"(",
")",
",",
"dataLogDir",
".",
"getPath",
"(",
")",
",",
... | Given two directory files the method returns a well-formed
logfile provider URI. This method is for backward compatibility with the
existing code that only supports logfile persistence and expects these two
parameters passed either on the command-line or in the configuration file.
@param dataDir snapshot directory
@param dataLogDir transaction log directory
@return logfile provider URI | [
"Given",
"two",
"directory",
"files",
"the",
"method",
"returns",
"a",
"well",
"-",
"formed",
"logfile",
"provider",
"URI",
".",
"This",
"method",
"is",
"for",
"backward",
"compatibility",
"with",
"the",
"existing",
"code",
"that",
"only",
"supports",
"logfile... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/persistence/Util.java#L73-L75 |
mojohaus/xml-maven-plugin | src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHandler.java | IndentCheckSaxHandler.endElement | @Override
public void endElement( String uri, String localName, String qName )
throws SAXException
{
flushCharacters();
if ( stack.isEmpty() )
{
throw new IllegalStateException( "Stack must not be empty when closing the element " + qName
+ " around line " + locator.getLineNumber() + " and column " + locator.getColumnNumber() );
}
IndentCheckSaxHandler.ElementEntry startEntry = stack.pop();
int indentDiff = lastIndent.size - startEntry.expectedIndent.size;
int expectedIndent = startEntry.expectedIndent.size;
if ( lastIndent.lineNumber != startEntry.foundIndent.lineNumber && indentDiff != 0 )
{
/*
* diff should be zero unless we are on the same line as start element
*/
int opValue = expectedIndent - lastIndent.size;
String op = opValue > 0 ? "Insert" : "Delete";
String units = opValue == 1 ? "space" : "spaces";
String message = op + " " + Math.abs( opValue ) + " " + units + ". Expected " + expectedIndent + " found "
+ lastIndent.size + " spaces before end element </" + qName + ">";
XmlFormatViolation violation =
new XmlFormatViolation( file, locator.getLineNumber(), locator.getColumnNumber(), message );
violationHandler.handle( violation );
}
} | java | @Override
public void endElement( String uri, String localName, String qName )
throws SAXException
{
flushCharacters();
if ( stack.isEmpty() )
{
throw new IllegalStateException( "Stack must not be empty when closing the element " + qName
+ " around line " + locator.getLineNumber() + " and column " + locator.getColumnNumber() );
}
IndentCheckSaxHandler.ElementEntry startEntry = stack.pop();
int indentDiff = lastIndent.size - startEntry.expectedIndent.size;
int expectedIndent = startEntry.expectedIndent.size;
if ( lastIndent.lineNumber != startEntry.foundIndent.lineNumber && indentDiff != 0 )
{
/*
* diff should be zero unless we are on the same line as start element
*/
int opValue = expectedIndent - lastIndent.size;
String op = opValue > 0 ? "Insert" : "Delete";
String units = opValue == 1 ? "space" : "spaces";
String message = op + " " + Math.abs( opValue ) + " " + units + ". Expected " + expectedIndent + " found "
+ lastIndent.size + " spaces before end element </" + qName + ">";
XmlFormatViolation violation =
new XmlFormatViolation( file, locator.getLineNumber(), locator.getColumnNumber(), message );
violationHandler.handle( violation );
}
} | [
"@",
"Override",
"public",
"void",
"endElement",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"qName",
")",
"throws",
"SAXException",
"{",
"flushCharacters",
"(",
")",
";",
"if",
"(",
"stack",
".",
"isEmpty",
"(",
")",
")",
"{",
"thro... | Checks indentation for an end element.
@see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String,
org.xml.sax.Attributes) | [
"Checks",
"indentation",
"for",
"an",
"end",
"element",
"."
] | train | https://github.com/mojohaus/xml-maven-plugin/blob/161edde37bbfe7a472369a9675c44d91ec24561d/src/main/java/org/codehaus/mojo/xml/format/IndentCheckSaxHandler.java#L143-L170 |
jwtk/jjwt | api/src/main/java/io/jsonwebtoken/lang/Strings.java | Strings.endsWithIgnoreCase | public static boolean endsWithIgnoreCase(String str, String suffix) {
if (str == null || suffix == null) {
return false;
}
if (str.endsWith(suffix)) {
return true;
}
if (str.length() < suffix.length()) {
return false;
}
String lcStr = str.substring(str.length() - suffix.length()).toLowerCase();
String lcSuffix = suffix.toLowerCase();
return lcStr.equals(lcSuffix);
} | java | public static boolean endsWithIgnoreCase(String str, String suffix) {
if (str == null || suffix == null) {
return false;
}
if (str.endsWith(suffix)) {
return true;
}
if (str.length() < suffix.length()) {
return false;
}
String lcStr = str.substring(str.length() - suffix.length()).toLowerCase();
String lcSuffix = suffix.toLowerCase();
return lcStr.equals(lcSuffix);
} | [
"public",
"static",
"boolean",
"endsWithIgnoreCase",
"(",
"String",
"str",
",",
"String",
"suffix",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"suffix",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"str",
".",
"endsWith",
"(",
... | Test if the given String ends with the specified suffix,
ignoring upper/lower case.
@param str the String to check
@param suffix the suffix to look for
@see java.lang.String#endsWith | [
"Test",
"if",
"the",
"given",
"String",
"ends",
"with",
"the",
"specified",
"suffix",
"ignoring",
"upper",
"/",
"lower",
"case",
"."
] | train | https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Strings.java#L319-L333 |
Netflix/zeno | src/main/java/com/netflix/zeno/genericobject/DiffHtmlGenerator.java | DiffHtmlGenerator.generateDiff | public String generateDiff(String objectType, Object from, Object to) {
GenericObject fromGenericObject = from == null ? null : genericObjectFramework.serialize(from, objectType);
GenericObject toGenericObject = to == null ? null : genericObjectFramework.serialize(to, objectType);
return generateDiff(fromGenericObject, toGenericObject);
} | java | public String generateDiff(String objectType, Object from, Object to) {
GenericObject fromGenericObject = from == null ? null : genericObjectFramework.serialize(from, objectType);
GenericObject toGenericObject = to == null ? null : genericObjectFramework.serialize(to, objectType);
return generateDiff(fromGenericObject, toGenericObject);
} | [
"public",
"String",
"generateDiff",
"(",
"String",
"objectType",
",",
"Object",
"from",
",",
"Object",
"to",
")",
"{",
"GenericObject",
"fromGenericObject",
"=",
"from",
"==",
"null",
"?",
"null",
":",
"genericObjectFramework",
".",
"serialize",
"(",
"from",
"... | Generate the HTML difference between two objects.
@param objectType - The NFTypeSerializer name of the objects
@param from - The first object to diff
@param to - The second object to diff
@return | [
"Generate",
"the",
"HTML",
"difference",
"between",
"two",
"objects",
"."
] | train | https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/main/java/com/netflix/zeno/genericobject/DiffHtmlGenerator.java#L65-L70 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listWorkerPoolInstanceMetricsAsync | public Observable<Page<ResourceMetricInner>> listWorkerPoolInstanceMetricsAsync(final String resourceGroupName, final String name, final String workerPoolName, final String instance) {
return listWorkerPoolInstanceMetricsWithServiceResponseAsync(resourceGroupName, name, workerPoolName, instance)
.map(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Page<ResourceMetricInner>>() {
@Override
public Page<ResourceMetricInner> call(ServiceResponse<Page<ResourceMetricInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ResourceMetricInner>> listWorkerPoolInstanceMetricsAsync(final String resourceGroupName, final String name, final String workerPoolName, final String instance) {
return listWorkerPoolInstanceMetricsWithServiceResponseAsync(resourceGroupName, name, workerPoolName, instance)
.map(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Page<ResourceMetricInner>>() {
@Override
public Page<ResourceMetricInner> call(ServiceResponse<Page<ResourceMetricInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ResourceMetricInner",
">",
">",
"listWorkerPoolInstanceMetricsAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"String",
"workerPoolName",
",",
"final",
"String",
"instance",
... | Get metrics for a specific instance of a worker pool of an App Service Environment.
Get metrics for a specific instance of a worker pool of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@param instance Name of the instance in the worker pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ResourceMetricInner> object | [
"Get",
"metrics",
"for",
"a",
"specific",
"instance",
"of",
"a",
"worker",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"metrics",
"for",
"a",
"specific",
"instance",
"of",
"a",
"worker",
"pool",
"of",
"an",
"App",
"Service",
"Environme... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5685-L5693 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/data/clock/Day.java | Day.getNthOfMonth | public static Day getNthOfMonth(int n, int dayOfWeek, int month, int year)
{
// Validate the dayOfWeek argument
if (dayOfWeek < 0 || dayOfWeek > 6)
throw new IllegalArgumentException("Invalid day of week: " + dayOfWeek);
LocalDateTime localDateTime = LocalDateTime.of(year, month, 0, 0, 0);
return new Day(localDateTime
.with(TemporalAdjusters
.next(DayOfWeek.of(dayOfWeek)))
.toLocalDate());
} | java | public static Day getNthOfMonth(int n, int dayOfWeek, int month, int year)
{
// Validate the dayOfWeek argument
if (dayOfWeek < 0 || dayOfWeek > 6)
throw new IllegalArgumentException("Invalid day of week: " + dayOfWeek);
LocalDateTime localDateTime = LocalDateTime.of(year, month, 0, 0, 0);
return new Day(localDateTime
.with(TemporalAdjusters
.next(DayOfWeek.of(dayOfWeek)))
.toLocalDate());
} | [
"public",
"static",
"Day",
"getNthOfMonth",
"(",
"int",
"n",
",",
"int",
"dayOfWeek",
",",
"int",
"month",
",",
"int",
"year",
")",
"{",
"// Validate the dayOfWeek argument\r",
"if",
"(",
"dayOfWeek",
"<",
"0",
"||",
"dayOfWeek",
">",
"6",
")",
"throw",
"n... | Find the n'th xxxxday of s specified month (for instance find 1st sunday
of May 2006; findNthOfMonth (1, Calendar.SUNDAY, Calendar.MAY, 2006);
Return null if the specified day doesn't exists.
@param n Nth day to look for.
@param dayOfWeek Day to look for (Calendar.XXXDAY).
@param month Month to check (Calendar.XXX).
@param year Year to check.
@return Required Day (or null if non-existent)
@throws IllegalArgumentException if dyaOfWeek parameter
doesn't represent a valid day. | [
"Find",
"the",
"n",
"th",
"xxxxday",
"of",
"s",
"specified",
"month",
"(",
"for",
"instance",
"find",
"1st",
"sunday",
"of",
"May",
"2006",
";",
"findNthOfMonth",
"(",
"1",
"Calendar",
".",
"SUNDAY",
"Calendar",
".",
"MAY",
"2006",
")",
";",
"Return",
... | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/data/clock/Day.java#L563-L574 |
Graylog2/graylog2-server | graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java | Indices.exists | public boolean exists(String indexName) {
try {
final JestResult result = jestClient.execute(new GetSettings.Builder().addIndex(indexName).build());
return result.isSucceeded() && Iterators.contains(result.getJsonObject().fieldNames(), indexName);
} catch (IOException e) {
throw new ElasticsearchException("Couldn't check existence of index " + indexName, e);
}
} | java | public boolean exists(String indexName) {
try {
final JestResult result = jestClient.execute(new GetSettings.Builder().addIndex(indexName).build());
return result.isSucceeded() && Iterators.contains(result.getJsonObject().fieldNames(), indexName);
} catch (IOException e) {
throw new ElasticsearchException("Couldn't check existence of index " + indexName, e);
}
} | [
"public",
"boolean",
"exists",
"(",
"String",
"indexName",
")",
"{",
"try",
"{",
"final",
"JestResult",
"result",
"=",
"jestClient",
".",
"execute",
"(",
"new",
"GetSettings",
".",
"Builder",
"(",
")",
".",
"addIndex",
"(",
"indexName",
")",
".",
"build",
... | Check if a given name is an existing index.
@param indexName Name of the index to check presence for.
@return {@code true} if indexName is an existing index, {@code false} if it is non-existing or an alias. | [
"Check",
"if",
"a",
"given",
"name",
"is",
"an",
"existing",
"index",
"."
] | train | https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/indexer/indices/Indices.java#L275-L282 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-filter/xwiki-commons-filter-xml/src/main/java/org/xwiki/filter/xml/internal/output/FilterStreamXMLStreamWriter.java | FilterStreamXMLStreamWriter.writeStartDocument | public void writeStartDocument(String encoding, String version) throws FilterException
{
try {
this.writer.writeStartDocument(encoding, version);
} catch (XMLStreamException e) {
throw new FilterException("Failed to write start document", e);
}
} | java | public void writeStartDocument(String encoding, String version) throws FilterException
{
try {
this.writer.writeStartDocument(encoding, version);
} catch (XMLStreamException e) {
throw new FilterException("Failed to write start document", e);
}
} | [
"public",
"void",
"writeStartDocument",
"(",
"String",
"encoding",
",",
"String",
"version",
")",
"throws",
"FilterException",
"{",
"try",
"{",
"this",
".",
"writer",
".",
"writeStartDocument",
"(",
"encoding",
",",
"version",
")",
";",
"}",
"catch",
"(",
"X... | Write the XML Declaration.
@param encoding the XML version
@param version the XML encoding
@throws FilterException | [
"Write",
"the",
"XML",
"Declaration",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-filter/xwiki-commons-filter-xml/src/main/java/org/xwiki/filter/xml/internal/output/FilterStreamXMLStreamWriter.java#L108-L115 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java | MiniCluster.createRpcService | protected RpcService createRpcService(
AkkaRpcServiceConfiguration akkaRpcServiceConfig,
boolean remoteEnabled,
String bindAddress) {
final Config akkaConfig;
if (remoteEnabled) {
akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration(), bindAddress, 0);
} else {
akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration());
}
final Config effectiveAkkaConfig = AkkaUtils.testDispatcherConfig().withFallback(akkaConfig);
final ActorSystem actorSystem = AkkaUtils.createActorSystem(effectiveAkkaConfig);
return new AkkaRpcService(actorSystem, akkaRpcServiceConfig);
} | java | protected RpcService createRpcService(
AkkaRpcServiceConfiguration akkaRpcServiceConfig,
boolean remoteEnabled,
String bindAddress) {
final Config akkaConfig;
if (remoteEnabled) {
akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration(), bindAddress, 0);
} else {
akkaConfig = AkkaUtils.getAkkaConfig(akkaRpcServiceConfig.getConfiguration());
}
final Config effectiveAkkaConfig = AkkaUtils.testDispatcherConfig().withFallback(akkaConfig);
final ActorSystem actorSystem = AkkaUtils.createActorSystem(effectiveAkkaConfig);
return new AkkaRpcService(actorSystem, akkaRpcServiceConfig);
} | [
"protected",
"RpcService",
"createRpcService",
"(",
"AkkaRpcServiceConfiguration",
"akkaRpcServiceConfig",
",",
"boolean",
"remoteEnabled",
",",
"String",
"bindAddress",
")",
"{",
"final",
"Config",
"akkaConfig",
";",
"if",
"(",
"remoteEnabled",
")",
"{",
"akkaConfig",
... | Factory method to instantiate the RPC service.
@param akkaRpcServiceConfig
The default RPC timeout for asynchronous "ask" requests.
@param remoteEnabled
True, if the RPC service should be reachable from other (remote) RPC services.
@param bindAddress
The address to bind the RPC service to. Only relevant when "remoteEnabled" is true.
@return The instantiated RPC service | [
"Factory",
"method",
"to",
"instantiate",
"the",
"RPC",
"service",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java#L715-L733 |
graknlabs/grakn | server/src/graql/gremlin/sets/EquivalentFragmentSets.java | EquivalentFragmentSets.rolePlayer | public static EquivalentFragmentSet rolePlayer(VarProperty varProperty, Variable relation, Variable edge, Variable rolePlayer, @Nullable Variable role, @Nullable ImmutableSet<Label> roleLabels, @Nullable ImmutableSet<Label> relTypeLabels) {
return new AutoValue_RolePlayerFragmentSet(varProperty, relation, edge, rolePlayer, role, roleLabels, relTypeLabels);
} | java | public static EquivalentFragmentSet rolePlayer(VarProperty varProperty, Variable relation, Variable edge, Variable rolePlayer, @Nullable Variable role, @Nullable ImmutableSet<Label> roleLabels, @Nullable ImmutableSet<Label> relTypeLabels) {
return new AutoValue_RolePlayerFragmentSet(varProperty, relation, edge, rolePlayer, role, roleLabels, relTypeLabels);
} | [
"public",
"static",
"EquivalentFragmentSet",
"rolePlayer",
"(",
"VarProperty",
"varProperty",
",",
"Variable",
"relation",
",",
"Variable",
"edge",
",",
"Variable",
"rolePlayer",
",",
"@",
"Nullable",
"Variable",
"role",
",",
"@",
"Nullable",
"ImmutableSet",
"<",
... | Describes the edge connecting a {@link Relation} to a role-player.
<p>
Can be constrained with information about the possible {@link Role}s or {@link RelationType}s. | [
"Describes",
"the",
"edge",
"connecting",
"a",
"{",
"@link",
"Relation",
"}",
"to",
"a",
"role",
"-",
"player",
".",
"<p",
">",
"Can",
"be",
"constrained",
"with",
"information",
"about",
"the",
"possible",
"{",
"@link",
"Role",
"}",
"s",
"or",
"{",
"@... | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/sets/EquivalentFragmentSets.java#L72-L74 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/callsite/CallSiteArray.java | CallSiteArray.createPojoSite | private static CallSite createPojoSite(CallSite callSite, Object receiver, Object[] args) {
final Class klazz = receiver.getClass();
MetaClass metaClass = InvokerHelper.getMetaClass(receiver);
if (!GroovyCategorySupport.hasCategoryInCurrentThread() && metaClass instanceof MetaClassImpl) {
final MetaClassImpl mci = (MetaClassImpl) metaClass;
final ClassInfo info = mci.getTheCachedClass().classInfo;
if (info.hasPerInstanceMetaClasses()) {
return new PerInstancePojoMetaClassSite(callSite, info);
} else {
return mci.createPojoCallSite(callSite, receiver, args);
}
}
ClassInfo info = ClassInfo.getClassInfo(klazz);
if (info.hasPerInstanceMetaClasses())
return new PerInstancePojoMetaClassSite(callSite, info);
else
return new PojoMetaClassSite(callSite, metaClass);
} | java | private static CallSite createPojoSite(CallSite callSite, Object receiver, Object[] args) {
final Class klazz = receiver.getClass();
MetaClass metaClass = InvokerHelper.getMetaClass(receiver);
if (!GroovyCategorySupport.hasCategoryInCurrentThread() && metaClass instanceof MetaClassImpl) {
final MetaClassImpl mci = (MetaClassImpl) metaClass;
final ClassInfo info = mci.getTheCachedClass().classInfo;
if (info.hasPerInstanceMetaClasses()) {
return new PerInstancePojoMetaClassSite(callSite, info);
} else {
return mci.createPojoCallSite(callSite, receiver, args);
}
}
ClassInfo info = ClassInfo.getClassInfo(klazz);
if (info.hasPerInstanceMetaClasses())
return new PerInstancePojoMetaClassSite(callSite, info);
else
return new PojoMetaClassSite(callSite, metaClass);
} | [
"private",
"static",
"CallSite",
"createPojoSite",
"(",
"CallSite",
"callSite",
",",
"Object",
"receiver",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"final",
"Class",
"klazz",
"=",
"receiver",
".",
"getClass",
"(",
")",
";",
"MetaClass",
"metaClass",
"=",
... | otherwise or if method doesn't exist we make call via POJO meta class | [
"otherwise",
"or",
"if",
"method",
"doesn",
"t",
"exist",
"we",
"make",
"call",
"via",
"POJO",
"meta",
"class"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/callsite/CallSiteArray.java#L122-L140 |
tomgibara/bits | src/main/java/com/tomgibara/bits/BitVector.java | BitVector.fromBigInteger | public static BitVector fromBigInteger(BigInteger bigInt, int size) {
if (bigInt == null) throw new IllegalArgumentException();
if (size < 0) throw new IllegalArgumentException();
return fromBigIntegerImpl(bigInt, size);
} | java | public static BitVector fromBigInteger(BigInteger bigInt, int size) {
if (bigInt == null) throw new IllegalArgumentException();
if (size < 0) throw new IllegalArgumentException();
return fromBigIntegerImpl(bigInt, size);
} | [
"public",
"static",
"BitVector",
"fromBigInteger",
"(",
"BigInteger",
"bigInt",
",",
"int",
"size",
")",
"{",
"if",
"(",
"bigInt",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"if",
"(",
"size",
"<",
"0",
")",
"throw",
"n... | Creates a {@link BitVector} from a <code>BigInteger</code>. The bits of
the integer copied into the new bit vector. The size of the returned
{@link BitVector} is the specified <code>size</code>. If the size exceeds
<code>bigInt.bitLength()</code> then the most significant bits are padded
with ones if the integer is negative and zeros otherwise. Negative values
are recorded using 2's complement encoding.
@param bigInt
a big integer
@param size
the size of the {@link BitVector} to create
@return a {@link BitVector} initialized with the bits of the big integer
@see #fromBigInteger(BigInteger)
@see Bits#asStore(BigInteger) | [
"Creates",
"a",
"{",
"@link",
"BitVector",
"}",
"from",
"a",
"<code",
">",
"BigInteger<",
"/",
"code",
">",
".",
"The",
"bits",
"of",
"the",
"integer",
"copied",
"into",
"the",
"new",
"bit",
"vector",
".",
"The",
"size",
"of",
"the",
"returned",
"{",
... | train | https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/BitVector.java#L136-L141 |
sniggle/simple-pgp | simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java | IOUtils.copy | public static void copy(InputStream inputStream, final OutputStream outputStream, byte[] buffer, final StreamHandler addtionalHandling) throws IOException {
LOGGER.trace("copy(InputStream, OutputStream, byte[], StreamHandler)");
LOGGER.debug("buffer size: {} bytes", (buffer!=null) ? buffer.length : "null");
process(inputStream, new StreamHandler() {
@Override
public void handleStreamBuffer(byte[] buffer, int offset, int length) throws IOException {
outputStream.write(buffer, offset, length);
if( addtionalHandling != null ) {
addtionalHandling.handleStreamBuffer(buffer, offset, length);
}
}
}, buffer);
} | java | public static void copy(InputStream inputStream, final OutputStream outputStream, byte[] buffer, final StreamHandler addtionalHandling) throws IOException {
LOGGER.trace("copy(InputStream, OutputStream, byte[], StreamHandler)");
LOGGER.debug("buffer size: {} bytes", (buffer!=null) ? buffer.length : "null");
process(inputStream, new StreamHandler() {
@Override
public void handleStreamBuffer(byte[] buffer, int offset, int length) throws IOException {
outputStream.write(buffer, offset, length);
if( addtionalHandling != null ) {
addtionalHandling.handleStreamBuffer(buffer, offset, length);
}
}
}, buffer);
} | [
"public",
"static",
"void",
"copy",
"(",
"InputStream",
"inputStream",
",",
"final",
"OutputStream",
"outputStream",
",",
"byte",
"[",
"]",
"buffer",
",",
"final",
"StreamHandler",
"addtionalHandling",
")",
"throws",
"IOException",
"{",
"LOGGER",
".",
"trace",
"... | copies the input stream to the output stream using a custom buffer size and applying additional stream handling
@param inputStream
the source stream
@param outputStream
the target stream
@param buffer
the custom buffer
@param addtionalHandling
a stream handler that allows additional handling of the stream
@throws IOException | [
"copies",
"the",
"input",
"stream",
"to",
"the",
"output",
"stream",
"using",
"a",
"custom",
"buffer",
"size",
"and",
"applying",
"additional",
"stream",
"handling"
] | train | https://github.com/sniggle/simple-pgp/blob/2ab83e4d370b8189f767d8e4e4c7e6020e60fbe3/simple-pgp-api/src/main/java/me/sniggle/pgp/crypt/internal/io/IOUtils.java#L88-L101 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java | NotificationHubsInner.deleteAuthorizationRuleAsync | public Observable<Void> deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName) {
return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteAuthorizationRuleAsync(String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName) {
return deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteAuthorizationRuleAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
",",
"String",
"notificationHubName",
",",
"String",
"authorizationRuleName",
")",
"{",
"return",
"deleteAuthorizationRuleWithServic... | Deletes a notificationHub authorization rule.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@param notificationHubName The notification hub name.
@param authorizationRuleName Authorization Rule Name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Deletes",
"a",
"notificationHub",
"authorization",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L1038-L1045 |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java | FedoraTypesUtils.getPropertyType | public static Optional<Integer> getPropertyType(final Node node, final String propertyName)
throws RepositoryException {
LOGGER.debug("Getting type of property: {} from node: {}", propertyName, node);
return getDefinitionForPropertyName(node, propertyName).map(PropertyDefinition::getRequiredType);
} | java | public static Optional<Integer> getPropertyType(final Node node, final String propertyName)
throws RepositoryException {
LOGGER.debug("Getting type of property: {} from node: {}", propertyName, node);
return getDefinitionForPropertyName(node, propertyName).map(PropertyDefinition::getRequiredType);
} | [
"public",
"static",
"Optional",
"<",
"Integer",
">",
"getPropertyType",
"(",
"final",
"Node",
"node",
",",
"final",
"String",
"propertyName",
")",
"throws",
"RepositoryException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Getting type of property: {} from node: {}\"",
",",... | Get the JCR property type ID for a given property name. If unsure, mark
it as UNDEFINED.
@param node the JCR node to add the property on
@param propertyName the property name
@return a PropertyType value
@throws RepositoryException if repository exception occurred | [
"Get",
"the",
"JCR",
"property",
"type",
"ID",
"for",
"a",
"given",
"property",
"name",
".",
"If",
"unsure",
"mark",
"it",
"as",
"UNDEFINED",
"."
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/utils/FedoraTypesUtils.java#L258-L262 |
gdx-libs/gdx-autumn | src/com/github/czyzby/autumn/context/ContextInitializer.java | ContextInitializer.addIfNotNull | protected <Type> void addIfNotNull(final Array<Type> array, final Type object) {
if (object != null) {
array.add(object);
}
} | java | protected <Type> void addIfNotNull(final Array<Type> array, final Type object) {
if (object != null) {
array.add(object);
}
} | [
"protected",
"<",
"Type",
">",
"void",
"addIfNotNull",
"(",
"final",
"Array",
"<",
"Type",
">",
"array",
",",
"final",
"Type",
"object",
")",
"{",
"if",
"(",
"object",
"!=",
"null",
")",
"{",
"array",
".",
"add",
"(",
"object",
")",
";",
"}",
"}"
] | Simple array utility.
@param array will contain the object if it's not null.
@param object if not null, will be added to the array.
@param <Type> type of values stored in the array. | [
"Simple",
"array",
"utility",
"."
] | train | https://github.com/gdx-libs/gdx-autumn/blob/75a7d8e0c838b69a06ae847f5a3c13a3bcd1d914/src/com/github/czyzby/autumn/context/ContextInitializer.java#L394-L398 |
JavaMoney/jsr354-api | src/main/java/javax/money/Monetary.java | Monetary.isRoundingAvailable | public static boolean isRoundingAvailable(CurrencyUnit currencyUnit, String... providers) {
return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available."))
.isRoundingAvailable(currencyUnit, providers);
} | java | public static boolean isRoundingAvailable(CurrencyUnit currencyUnit, String... providers) {
return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow(
() -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available."))
.isRoundingAvailable(currencyUnit, providers);
} | [
"public",
"static",
"boolean",
"isRoundingAvailable",
"(",
"CurrencyUnit",
"currencyUnit",
",",
"String",
"...",
"providers",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"monetaryRoundingsSingletonSpi",
"(",
")",
")",
".",
"orElseThrow",
"(",
"(",
")",... | Checks if a {@link MonetaryRounding} is available given a roundingId.
@param currencyUnit The currency, which determines the required scale. As {@link java.math.RoundingMode},
by default, {@link java.math.RoundingMode#HALF_UP} is used.
@param providers the providers and ordering to be used. By default providers and ordering as defined in
#getDefaultProviders is used.
@return true, if a corresponding {@link javax.money.MonetaryRounding} is available.
@throws IllegalArgumentException if no such rounding is registered using a
{@link javax.money.spi.RoundingProviderSpi} instance. | [
"Checks",
"if",
"a",
"{",
"@link",
"MonetaryRounding",
"}",
"is",
"available",
"given",
"a",
"roundingId",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L219-L223 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.createClosedListEntityRoleAsync | public Observable<UUID> createClosedListEntityRoleAsync(UUID appId, String versionId, UUID entityId, CreateClosedListEntityRoleOptionalParameter createClosedListEntityRoleOptionalParameter) {
return createClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createClosedListEntityRoleOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
} | java | public Observable<UUID> createClosedListEntityRoleAsync(UUID appId, String versionId, UUID entityId, CreateClosedListEntityRoleOptionalParameter createClosedListEntityRoleOptionalParameter) {
return createClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createClosedListEntityRoleOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"UUID",
">",
"createClosedListEntityRoleAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"CreateClosedListEntityRoleOptionalParameter",
"createClosedListEntityRoleOptionalParameter",
")",
"{",
"return",
"cr... | Create an entity role for an entity in the application.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity model ID.
@param createClosedListEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object | [
"Create",
"an",
"entity",
"role",
"for",
"an",
"entity",
"in",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L8341-L8348 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Stream.java | Stream.mapToInt | @NotNull
public IntStream mapToInt(@NotNull final ToIntFunction<? super T> mapper) {
return new IntStream(params, new ObjMapToInt<T>(iterator, mapper));
} | java | @NotNull
public IntStream mapToInt(@NotNull final ToIntFunction<? super T> mapper) {
return new IntStream(params, new ObjMapToInt<T>(iterator, mapper));
} | [
"@",
"NotNull",
"public",
"IntStream",
"mapToInt",
"(",
"@",
"NotNull",
"final",
"ToIntFunction",
"<",
"?",
"super",
"T",
">",
"mapper",
")",
"{",
"return",
"new",
"IntStream",
"(",
"params",
",",
"new",
"ObjMapToInt",
"<",
"T",
">",
"(",
"iterator",
","... | Returns {@code IntStream} with elements that obtained by applying the given function.
<p>This is an intermediate operation.
@param mapper the mapper function used to apply to each element
@return the new {@code IntStream}
@see #map(com.annimon.stream.function.Function) | [
"Returns",
"{",
"@code",
"IntStream",
"}",
"with",
"elements",
"that",
"obtained",
"by",
"applying",
"the",
"given",
"function",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Stream.java#L811-L814 |
apache/incubator-shardingsphere | sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/GeneratedKey.java | GeneratedKey.getGenerateKey | public static Optional<GeneratedKey> getGenerateKey(final ShardingRule shardingRule, final List<Object> parameters, final InsertStatement insertStatement) {
Optional<String> generateKeyColumnName = shardingRule.findGenerateKeyColumnName(insertStatement.getTables().getSingleTableName());
if (!generateKeyColumnName.isPresent()) {
return Optional.absent();
}
return isContainsGenerateKeyColumn(insertStatement, generateKeyColumnName.get())
? findGeneratedKey(parameters, insertStatement, generateKeyColumnName.get()) : Optional.of(createGeneratedKey(shardingRule, insertStatement, generateKeyColumnName.get()));
} | java | public static Optional<GeneratedKey> getGenerateKey(final ShardingRule shardingRule, final List<Object> parameters, final InsertStatement insertStatement) {
Optional<String> generateKeyColumnName = shardingRule.findGenerateKeyColumnName(insertStatement.getTables().getSingleTableName());
if (!generateKeyColumnName.isPresent()) {
return Optional.absent();
}
return isContainsGenerateKeyColumn(insertStatement, generateKeyColumnName.get())
? findGeneratedKey(parameters, insertStatement, generateKeyColumnName.get()) : Optional.of(createGeneratedKey(shardingRule, insertStatement, generateKeyColumnName.get()));
} | [
"public",
"static",
"Optional",
"<",
"GeneratedKey",
">",
"getGenerateKey",
"(",
"final",
"ShardingRule",
"shardingRule",
",",
"final",
"List",
"<",
"Object",
">",
"parameters",
",",
"final",
"InsertStatement",
"insertStatement",
")",
"{",
"Optional",
"<",
"String... | Get generate key.
@param shardingRule sharding rule
@param parameters SQL parameters
@param insertStatement insert statement
@return generate key | [
"Get",
"generate",
"key",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-optimize/src/main/java/org/apache/shardingsphere/core/optimize/GeneratedKey.java#L60-L67 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/GVRNewWrapperProvider.java | GVRNewWrapperProvider.wrapQuaternion | @Override
public Quaternionf wrapQuaternion(ByteBuffer buffer, int offset) {
float w = buffer.getFloat(offset);
float x = buffer.getFloat(offset + 4);
float y = buffer.getFloat(offset + 8);
float z = buffer.getFloat(offset + 12);
return new Quaternionf(x, y, z, w);
} | java | @Override
public Quaternionf wrapQuaternion(ByteBuffer buffer, int offset) {
float w = buffer.getFloat(offset);
float x = buffer.getFloat(offset + 4);
float y = buffer.getFloat(offset + 8);
float z = buffer.getFloat(offset + 12);
return new Quaternionf(x, y, z, w);
} | [
"@",
"Override",
"public",
"Quaternionf",
"wrapQuaternion",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"offset",
")",
"{",
"float",
"w",
"=",
"buffer",
".",
"getFloat",
"(",
"offset",
")",
";",
"float",
"x",
"=",
"buffer",
".",
"getFloat",
"(",
"offset",
"... | Wraps a quaternion.
<p>
A quaternion consists of 4 float values (w,x,y,z) starting from
offset
@param buffer
the buffer to wrap
@param offset
the offset into buffer
@return the wrapped quaternion | [
"Wraps",
"a",
"quaternion",
".",
"<p",
">"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/GVRNewWrapperProvider.java#L59-L66 |
networknt/light-4j | utility/src/main/java/com/networknt/utility/RegExUtils.java | RegExUtils.removeFirst | public static String removeFirst(final String text, final Pattern regex) {
return replaceFirst(text, regex, StringUtils.EMPTY);
} | java | public static String removeFirst(final String text, final Pattern regex) {
return replaceFirst(text, regex, StringUtils.EMPTY);
} | [
"public",
"static",
"String",
"removeFirst",
"(",
"final",
"String",
"text",
",",
"final",
"Pattern",
"regex",
")",
"{",
"return",
"replaceFirst",
"(",
"text",
",",
"regex",
",",
"StringUtils",
".",
"EMPTY",
")",
";",
"}"
] | <p>Removes the first substring of the text string that matches the given regular expression pattern.</p>
This method is a {@code null} safe equivalent to:
<ul>
<li>{@code pattern.matcher(text).replaceFirst(StringUtils.EMPTY)}</li>
</ul>
<p>A {@code null} reference passed to this method is a no-op.</p>
<pre>
StringUtils.removeFirst(null, *) = null
StringUtils.removeFirst("any", (Pattern) null) = "any"
StringUtils.removeFirst("any", Pattern.compile("")) = "any"
StringUtils.removeFirst("any", Pattern.compile(".*")) = ""
StringUtils.removeFirst("any", Pattern.compile(".+")) = ""
StringUtils.removeFirst("abc", Pattern.compile(".?")) = "bc"
StringUtils.removeFirst("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\n<__>B"
StringUtils.removeFirst("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
StringUtils.removeFirst("ABCabc123", Pattern.compile("[a-z]")) = "ABCbc123"
StringUtils.removeFirst("ABCabc123abc", Pattern.compile("[a-z]+")) = "ABC123abc"
</pre>
@param text text to remove from, may be null
@param regex the regular expression pattern to which this string is to be matched
@return the text with the first replacement processed,
{@code null} if null String input
@see #replaceFirst(String, Pattern, String)
@see java.util.regex.Matcher#replaceFirst(String)
@see java.util.regex.Pattern | [
"<p",
">",
"Removes",
"the",
"first",
"substring",
"of",
"the",
"text",
"string",
"that",
"matches",
"the",
"given",
"regular",
"expression",
"pattern",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/RegExUtils.java#L142-L144 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java | JsonUtil.put | public static void put(Writer writer, byte value) throws IOException {
writer.write(String.valueOf(value));
} | java | public static void put(Writer writer, byte value) throws IOException {
writer.write(String.valueOf(value));
} | [
"public",
"static",
"void",
"put",
"(",
"Writer",
"writer",
",",
"byte",
"value",
")",
"throws",
"IOException",
"{",
"writer",
".",
"write",
"(",
"String",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}"
] | Writes the given value with the given writer.
@param writer
@param value
@throws IOException
@author vvakame | [
"Writes",
"the",
"given",
"value",
"with",
"the",
"given",
"writer",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L234-L236 |
pdef/pdef-java | pdef/src/main/java/io/pdef/rpc/HttpUrlConnectionRpcSession.java | HttpUrlConnectionRpcSession.sendPostData | protected void sendPostData(final HttpURLConnection connection, final RpcRequest request)
throws IOException {
String post = buildParamsQuery(request.getPost());
byte[] data = post.getBytes(UTF8);
connection.setRequestProperty(CONTENT_TYPE_HEADER, APPLICATION_X_WWW_FORM_URLENCODED);
connection.setRequestProperty(CONTENT_LENGTH_HEADER, String.valueOf(data.length));
OutputStream out = new BufferedOutputStream(connection.getOutputStream());
try {
out.write(data);
} finally {
closeLogExc(out);
}
} | java | protected void sendPostData(final HttpURLConnection connection, final RpcRequest request)
throws IOException {
String post = buildParamsQuery(request.getPost());
byte[] data = post.getBytes(UTF8);
connection.setRequestProperty(CONTENT_TYPE_HEADER, APPLICATION_X_WWW_FORM_URLENCODED);
connection.setRequestProperty(CONTENT_LENGTH_HEADER, String.valueOf(data.length));
OutputStream out = new BufferedOutputStream(connection.getOutputStream());
try {
out.write(data);
} finally {
closeLogExc(out);
}
} | [
"protected",
"void",
"sendPostData",
"(",
"final",
"HttpURLConnection",
"connection",
",",
"final",
"RpcRequest",
"request",
")",
"throws",
"IOException",
"{",
"String",
"post",
"=",
"buildParamsQuery",
"(",
"request",
".",
"getPost",
"(",
")",
")",
";",
"byte",... | Sets the connection content-type and content-length and sends the post data. | [
"Sets",
"the",
"connection",
"content",
"-",
"type",
"and",
"content",
"-",
"length",
"and",
"sends",
"the",
"post",
"data",
"."
] | train | https://github.com/pdef/pdef-java/blob/7776c44d1aab0f3dbf7267b0c32b8f9282fe6167/pdef/src/main/java/io/pdef/rpc/HttpUrlConnectionRpcSession.java#L120-L133 |
bluelinelabs/Conductor | conductor/src/main/java/com/bluelinelabs/conductor/Controller.java | Controller.requestPermissions | @TargetApi(Build.VERSION_CODES.M)
public final void requestPermissions(@NonNull final String[] permissions, final int requestCode) {
requestedPermissions.addAll(Arrays.asList(permissions));
executeWithRouter(new RouterRequiringFunc() {
@Override public void execute() { router.requestPermissions(instanceId, permissions, requestCode); }
});
} | java | @TargetApi(Build.VERSION_CODES.M)
public final void requestPermissions(@NonNull final String[] permissions, final int requestCode) {
requestedPermissions.addAll(Arrays.asList(permissions));
executeWithRouter(new RouterRequiringFunc() {
@Override public void execute() { router.requestPermissions(instanceId, permissions, requestCode); }
});
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"M",
")",
"public",
"final",
"void",
"requestPermissions",
"(",
"@",
"NonNull",
"final",
"String",
"[",
"]",
"permissions",
",",
"final",
"int",
"requestCode",
")",
"{",
"requestedPermissions",
".",
... | Calls requestPermission(String[], int) from this Controller's host Activity. Results for this request,
including {@link #shouldShowRequestPermissionRationale(String)} and
{@link #onRequestPermissionsResult(int, String[], int[])} will be forwarded back to this Controller by the system. | [
"Calls",
"requestPermission",
"(",
"String",
"[]",
"int",
")",
"from",
"this",
"Controller",
"s",
"host",
"Activity",
".",
"Results",
"for",
"this",
"request",
"including",
"{"
] | train | https://github.com/bluelinelabs/Conductor/blob/94c9121bb16f93b481954513a8e3905846829fb2/conductor/src/main/java/com/bluelinelabs/conductor/Controller.java#L563-L570 |
acromusashi/acromusashi-stream | src/main/java/acromusashi/stream/bolt/hdfs/HdfsOutputSwitcher.java | HdfsOutputSwitcher.append | public void append(String target, long nowTime) throws IOException
{
if (this.nextSwitchTime <= nowTime)
{
switchWriter(nowTime);
}
this.currentWriter.append(target);
} | java | public void append(String target, long nowTime) throws IOException
{
if (this.nextSwitchTime <= nowTime)
{
switchWriter(nowTime);
}
this.currentWriter.append(target);
} | [
"public",
"void",
"append",
"(",
"String",
"target",
",",
"long",
"nowTime",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"nextSwitchTime",
"<=",
"nowTime",
")",
"{",
"switchWriter",
"(",
"nowTime",
")",
";",
"}",
"this",
".",
"currentWriter"... | メッセージをHDFSに出力する。
@param target 出力内容
@param nowTime 出力時刻
@throws IOException 入出力エラー発生時 | [
"メッセージをHDFSに出力する。"
] | train | https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bolt/hdfs/HdfsOutputSwitcher.java#L136-L144 |
basho/riak-java-client | src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java | AnnotationUtil.getKey | public static <T> BinaryValue getKey(T domainObject, BinaryValue defaultKey)
{
BinaryValue key = getKey(domainObject);
if (key == null)
{
key = defaultKey;
}
return key;
} | java | public static <T> BinaryValue getKey(T domainObject, BinaryValue defaultKey)
{
BinaryValue key = getKey(domainObject);
if (key == null)
{
key = defaultKey;
}
return key;
} | [
"public",
"static",
"<",
"T",
">",
"BinaryValue",
"getKey",
"(",
"T",
"domainObject",
",",
"BinaryValue",
"defaultKey",
")",
"{",
"BinaryValue",
"key",
"=",
"getKey",
"(",
"domainObject",
")",
";",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"key",
"=",
... | Attempts to get a key from <code>domainObject</code> by looking for a
{@literal @RiakKey} annotated member. If non-present it simply returns
<code>defaultKey</code>
@param <T> the type of <code>domainObject</code>
@param domainObject the object to search for a key
@param defaultKey the pass through value that will get returned if no key
found on <code>domainObject</code>
@return either the value found on <code>domainObject</code>;s
{@literal @RiakKey} member or <code>defaultkey</code> | [
"Attempts",
"to",
"get",
"a",
"key",
"from",
"<code",
">",
"domainObject<",
"/",
"code",
">",
"by",
"looking",
"for",
"a",
"{",
"@literal",
"@RiakKey",
"}",
"annotated",
"member",
".",
"If",
"non",
"-",
"present",
"it",
"simply",
"returns",
"<code",
">",... | train | https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java#L65-L73 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java | Utils.readPropertiesFileQuietly | public static Properties readPropertiesFileQuietly( File file, Logger logger ) {
Properties result = new Properties();
try {
if( file != null && file.exists())
result = readPropertiesFile( file );
} catch( Exception e ) {
logger.severe( "Properties file " + file + " could not be read." );
logException( logger, e );
}
return result;
} | java | public static Properties readPropertiesFileQuietly( File file, Logger logger ) {
Properties result = new Properties();
try {
if( file != null && file.exists())
result = readPropertiesFile( file );
} catch( Exception e ) {
logger.severe( "Properties file " + file + " could not be read." );
logException( logger, e );
}
return result;
} | [
"public",
"static",
"Properties",
"readPropertiesFileQuietly",
"(",
"File",
"file",
",",
"Logger",
"logger",
")",
"{",
"Properties",
"result",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"if",
"(",
"file",
"!=",
"null",
"&&",
"file",
".",
"exists"... | Reads properties from a file but does not throw any error in case of problem.
@param file a properties file (can be null)
@param logger a logger (not null)
@return a {@link Properties} instance (never null) | [
"Reads",
"properties",
"from",
"a",
"file",
"but",
"does",
"not",
"throw",
"any",
"error",
"in",
"case",
"of",
"problem",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/Utils.java#L555-L568 |
jcuda/jnvgraph | JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java | JNvgraph.nvgraphContractGraph | public static int nvgraphContractGraph(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
nvgraphGraphDescr contrdescrG,
Pointer aggregates,
long numaggregates,
int VertexCombineOp,
int VertexReduceOp,
int EdgeCombineOp,
int EdgeReduceOp,
int flag)
{
return checkResult(nvgraphContractGraphNative(handle, descrG, contrdescrG, aggregates, numaggregates, VertexCombineOp, VertexReduceOp, EdgeCombineOp, EdgeReduceOp, flag));
} | java | public static int nvgraphContractGraph(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
nvgraphGraphDescr contrdescrG,
Pointer aggregates,
long numaggregates,
int VertexCombineOp,
int VertexReduceOp,
int EdgeCombineOp,
int EdgeReduceOp,
int flag)
{
return checkResult(nvgraphContractGraphNative(handle, descrG, contrdescrG, aggregates, numaggregates, VertexCombineOp, VertexReduceOp, EdgeCombineOp, EdgeReduceOp, flag));
} | [
"public",
"static",
"int",
"nvgraphContractGraph",
"(",
"nvgraphHandle",
"handle",
",",
"nvgraphGraphDescr",
"descrG",
",",
"nvgraphGraphDescr",
"contrdescrG",
",",
"Pointer",
"aggregates",
",",
"long",
"numaggregates",
",",
"int",
"VertexCombineOp",
",",
"int",
"Vert... | <pre>
nvGRAPH contraction
given array of agregates contract graph with
given (Combine, Reduce) operators for Vertex Set
and Edge Set;
</pre> | [
"<pre",
">",
"nvGRAPH",
"contraction",
"given",
"array",
"of",
"agregates",
"contract",
"graph",
"with",
"given",
"(",
"Combine",
"Reduce",
")",
"operators",
"for",
"Vertex",
"Set",
"and",
"Edge",
"Set",
";",
"<",
"/",
"pre",
">"
] | train | https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L678-L691 |
michael-rapp/AndroidPreferenceActivity | example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java | AppearancePreferenceFragment.createNavigationWidthChangeListener | private OnPreferenceChangeListener createNavigationWidthChangeListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
int width = Integer.valueOf((String) newValue);
((PreferenceActivity) getActivity())
.setNavigationWidth(dpToPixels(getActivity(), width));
return true;
}
};
} | java | private OnPreferenceChangeListener createNavigationWidthChangeListener() {
return new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
int width = Integer.valueOf((String) newValue);
((PreferenceActivity) getActivity())
.setNavigationWidth(dpToPixels(getActivity(), width));
return true;
}
};
} | [
"private",
"OnPreferenceChangeListener",
"createNavigationWidthChangeListener",
"(",
")",
"{",
"return",
"new",
"OnPreferenceChangeListener",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"onPreferenceChange",
"(",
"final",
"Preference",
"preference",
",",
"final",... | Creates and returns a listener, which allows to adapt the width of the navigation, when the
value of the corresponding preference has been changed.
@return The listener, which has been created, as an instance of the type {@link
OnPreferenceChangeListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"adapt",
"the",
"width",
"of",
"the",
"navigation",
"when",
"the",
"value",
"of",
"the",
"corresponding",
"preference",
"has",
"been",
"changed",
"."
] | train | https://github.com/michael-rapp/AndroidPreferenceActivity/blob/0fcde73815b4b3bf6bcb36acd3d5733e301bbba5/example/src/main/java/de/mrapp/android/preference/activity/example/fragment/AppearancePreferenceFragment.java#L87-L99 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/connector/filesystem/FileSystemConnector.java | FileSystemConnector.idFor | protected String idFor( File file ) {
String path = file.getAbsolutePath();
if (!path.startsWith(directoryAbsolutePath)) {
if (directory.getAbsolutePath().equals(path)) {
// This is the root
return DELIMITER;
}
String msg = JcrI18n.fileConnectorNodeIdentifierIsNotWithinScopeOfConnector.text(getSourceName(), directoryPath, path);
throw new DocumentStoreException(path, msg);
}
String id = path.substring(directoryAbsolutePathLength);
id = id.replaceAll(Pattern.quote(FILE_SEPARATOR), DELIMITER);
assert id.startsWith(DELIMITER);
return id;
} | java | protected String idFor( File file ) {
String path = file.getAbsolutePath();
if (!path.startsWith(directoryAbsolutePath)) {
if (directory.getAbsolutePath().equals(path)) {
// This is the root
return DELIMITER;
}
String msg = JcrI18n.fileConnectorNodeIdentifierIsNotWithinScopeOfConnector.text(getSourceName(), directoryPath, path);
throw new DocumentStoreException(path, msg);
}
String id = path.substring(directoryAbsolutePathLength);
id = id.replaceAll(Pattern.quote(FILE_SEPARATOR), DELIMITER);
assert id.startsWith(DELIMITER);
return id;
} | [
"protected",
"String",
"idFor",
"(",
"File",
"file",
")",
"{",
"String",
"path",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"if",
"(",
"!",
"path",
".",
"startsWith",
"(",
"directoryAbsolutePath",
")",
")",
"{",
"if",
"(",
"directory",
".",
"g... | Utility method for determining the node identifier for the supplied file. Subclasses may override this method to change the
format of the identifiers, but in that case should also override the {@link #fileFor(String)},
{@link #isContentNode(String)}, and {@link #isRoot(String)} methods.
@param file the file; may not be null
@return the node identifier; never null
@see #isRoot(String)
@see #isContentNode(String)
@see #fileFor(String) | [
"Utility",
"method",
"for",
"determining",
"the",
"node",
"identifier",
"for",
"the",
"supplied",
"file",
".",
"Subclasses",
"may",
"override",
"this",
"method",
"to",
"change",
"the",
"format",
"of",
"the",
"identifiers",
"but",
"in",
"that",
"case",
"should"... | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/connector/filesystem/FileSystemConnector.java#L363-L377 |
apache/incubator-gobblin | gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/source/jdbc/SqlQueryUtils.java | SqlQueryUtils.addPredicate | public static String addPredicate(String query, String predicateCond) {
if (Strings.isNullOrEmpty(predicateCond)) {
return query;
}
String normalizedQuery = query.toLowerCase().trim();
checkArgument(normalizedQuery.contains(" from "),
"query does not contain 'from': " + query);
checkArgument(! normalizedQuery.contains(" by "),
"query contains 'order by' or 'group by': " + query);
checkArgument(! normalizedQuery.contains(" having "),
"query contains 'having': " + query);
checkArgument(! normalizedQuery.contains(" limit "),
"query contains 'limit': " + query);
String keyword = " where ";
if (normalizedQuery.contains(keyword)) {
keyword = " and ";
}
query = query + keyword + "(" + predicateCond + ")";
return query;
} | java | public static String addPredicate(String query, String predicateCond) {
if (Strings.isNullOrEmpty(predicateCond)) {
return query;
}
String normalizedQuery = query.toLowerCase().trim();
checkArgument(normalizedQuery.contains(" from "),
"query does not contain 'from': " + query);
checkArgument(! normalizedQuery.contains(" by "),
"query contains 'order by' or 'group by': " + query);
checkArgument(! normalizedQuery.contains(" having "),
"query contains 'having': " + query);
checkArgument(! normalizedQuery.contains(" limit "),
"query contains 'limit': " + query);
String keyword = " where ";
if (normalizedQuery.contains(keyword)) {
keyword = " and ";
}
query = query + keyword + "(" + predicateCond + ")";
return query;
} | [
"public",
"static",
"String",
"addPredicate",
"(",
"String",
"query",
",",
"String",
"predicateCond",
")",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"predicateCond",
")",
")",
"{",
"return",
"query",
";",
"}",
"String",
"normalizedQuery",
"=",
"q... | Add a new predicate(filter condition) to the query. The method will add a "where" clause if
none exists. Otherwise, it will add the condition as a conjunction (and).
<b>Note that this method is rather limited. It works only if there are no other clauses after
"where"</b>
@param query the query string to modify
@param predicateCond the predicate to add to the query
@return query the new query string
@throws IllegalArgumentException if the predicate cannot be added because of additional clauses | [
"Add",
"a",
"new",
"predicate",
"(",
"filter",
"condition",
")",
"to",
"the",
"query",
".",
"The",
"method",
"will",
"add",
"a",
"where",
"clause",
"if",
"none",
"exists",
".",
"Otherwise",
"it",
"will",
"add",
"the",
"condition",
"as",
"a",
"conjunction... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/source/jdbc/SqlQueryUtils.java#L43-L63 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/KeyDecoder.java | KeyDecoder.decodeFloatObjDesc | public static Float decodeFloatObjDesc(byte[] src, int srcOffset)
throws CorruptEncodingException
{
int bits = DataDecoder.decodeFloatBits(src, srcOffset);
if (bits >= 0) {
bits ^= 0x7fffffff;
}
return bits == 0x7fffffff ? null : Float.intBitsToFloat(bits);
} | java | public static Float decodeFloatObjDesc(byte[] src, int srcOffset)
throws CorruptEncodingException
{
int bits = DataDecoder.decodeFloatBits(src, srcOffset);
if (bits >= 0) {
bits ^= 0x7fffffff;
}
return bits == 0x7fffffff ? null : Float.intBitsToFloat(bits);
} | [
"public",
"static",
"Float",
"decodeFloatObjDesc",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcOffset",
")",
"throws",
"CorruptEncodingException",
"{",
"int",
"bits",
"=",
"DataDecoder",
".",
"decodeFloatBits",
"(",
"src",
",",
"srcOffset",
")",
";",
"if",
... | Decodes a Float object from exactly 4 bytes.
@param src source of encoded bytes
@param srcOffset offset into source array
@return Float object or null | [
"Decodes",
"a",
"Float",
"object",
"from",
"exactly",
"4",
"bytes",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L293-L301 |
JetBrains/xodus | openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java | EnvironmentConfig.setGcStartIn | public EnvironmentConfig setGcStartIn(final int startInMillis) throws InvalidSettingException {
if (startInMillis < 0) {
throw new InvalidSettingException("GC can't be postponed for that number of milliseconds: " + startInMillis);
}
return setSetting(GC_START_IN, startInMillis);
} | java | public EnvironmentConfig setGcStartIn(final int startInMillis) throws InvalidSettingException {
if (startInMillis < 0) {
throw new InvalidSettingException("GC can't be postponed for that number of milliseconds: " + startInMillis);
}
return setSetting(GC_START_IN, startInMillis);
} | [
"public",
"EnvironmentConfig",
"setGcStartIn",
"(",
"final",
"int",
"startInMillis",
")",
"throws",
"InvalidSettingException",
"{",
"if",
"(",
"startInMillis",
"<",
"0",
")",
"{",
"throw",
"new",
"InvalidSettingException",
"(",
"\"GC can't be postponed for that number of ... | Sets the number of milliseconds which the database garbage collector is postponed for after the
{@linkplain Environment} is created. Default value is {@code 10000}.
<p>Mutable at runtime: no
@param startInMillis number of milliseconds which the database garbage collector should be postponed for after the
{@linkplain Environment} is created
@return this {@code EnvironmentConfig} instance
@throws InvalidSettingException {@code startInMillis} is negative | [
"Sets",
"the",
"number",
"of",
"milliseconds",
"which",
"the",
"database",
"garbage",
"collector",
"is",
"postponed",
"for",
"after",
"the",
"{",
"@linkplain",
"Environment",
"}",
"is",
"created",
".",
"Default",
"value",
"is",
"{",
"@code",
"10000",
"}",
".... | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/openAPI/src/main/java/jetbrains/exodus/env/EnvironmentConfig.java#L1822-L1827 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureMetric.java | SceneStructureMetric.setCamera | public void setCamera(int which , boolean fixed , BundleAdjustmentCamera model ) {
cameras[which].known = fixed;
cameras[which].model = model;
} | java | public void setCamera(int which , boolean fixed , BundleAdjustmentCamera model ) {
cameras[which].known = fixed;
cameras[which].model = model;
} | [
"public",
"void",
"setCamera",
"(",
"int",
"which",
",",
"boolean",
"fixed",
",",
"BundleAdjustmentCamera",
"model",
")",
"{",
"cameras",
"[",
"which",
"]",
".",
"known",
"=",
"fixed",
";",
"cameras",
"[",
"which",
"]",
".",
"model",
"=",
"model",
";",
... | Specifies the camera model being used.
@param which Which camera is being specified
@param fixed If these parameters are constant or not
@param model The camera model | [
"Specifies",
"the",
"camera",
"model",
"being",
"used",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureMetric.java#L135-L138 |
datacleaner/DataCleaner | components/pattern-finder/src/main/java/org/datacleaner/beans/stringpattern/PatternFinder.java | PatternFinder.run | public void run(final R row, final String value, final int distinctCount) {
final List<Token> tokens;
try {
tokens = _tokenizer.tokenize(value);
} catch (final RuntimeException e) {
throw new IllegalStateException("Error occurred while tokenizing value: " + value, e);
}
final String patternCode = getPatternCode(tokens);
final Collection<TokenPattern> patterns = getOrCreatePatterns(patternCode);
// lock on "patterns" since it is going to be the same collection for
// all matching pattern codes.
synchronized (patterns) {
boolean match = false;
for (final TokenPattern pattern : patterns) {
if (pattern.match(tokens)) {
storeMatch(pattern, row, value, distinctCount);
match = true;
break;
}
}
if (!match) {
final TokenPattern pattern;
try {
pattern = new TokenPatternImpl(value, tokens, _configuration);
} catch (final RuntimeException e) {
throw new IllegalStateException("Error occurred while creating pattern for: " + tokens, e);
}
storeNewPattern(pattern, row, value, distinctCount);
patterns.add(pattern);
}
}
} | java | public void run(final R row, final String value, final int distinctCount) {
final List<Token> tokens;
try {
tokens = _tokenizer.tokenize(value);
} catch (final RuntimeException e) {
throw new IllegalStateException("Error occurred while tokenizing value: " + value, e);
}
final String patternCode = getPatternCode(tokens);
final Collection<TokenPattern> patterns = getOrCreatePatterns(patternCode);
// lock on "patterns" since it is going to be the same collection for
// all matching pattern codes.
synchronized (patterns) {
boolean match = false;
for (final TokenPattern pattern : patterns) {
if (pattern.match(tokens)) {
storeMatch(pattern, row, value, distinctCount);
match = true;
break;
}
}
if (!match) {
final TokenPattern pattern;
try {
pattern = new TokenPatternImpl(value, tokens, _configuration);
} catch (final RuntimeException e) {
throw new IllegalStateException("Error occurred while creating pattern for: " + tokens, e);
}
storeNewPattern(pattern, row, value, distinctCount);
patterns.add(pattern);
}
}
} | [
"public",
"void",
"run",
"(",
"final",
"R",
"row",
",",
"final",
"String",
"value",
",",
"final",
"int",
"distinctCount",
")",
"{",
"final",
"List",
"<",
"Token",
">",
"tokens",
";",
"try",
"{",
"tokens",
"=",
"_tokenizer",
".",
"tokenize",
"(",
"value... | This method should be invoked by the user of the PatternFinder. Invoke it
for each value in your dataset. Repeated values are handled correctly but
if available it is more efficient to handle only the distinct values and
their corresponding distinct counts.
@param row
the row containing the value
@param value
the string value to be tokenized and matched against other
patterns
@param distinctCount
the count of the value | [
"This",
"method",
"should",
"be",
"invoked",
"by",
"the",
"user",
"of",
"the",
"PatternFinder",
".",
"Invoke",
"it",
"for",
"each",
"value",
"in",
"your",
"dataset",
".",
"Repeated",
"values",
"are",
"handled",
"correctly",
"but",
"if",
"available",
"it",
... | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/components/pattern-finder/src/main/java/org/datacleaner/beans/stringpattern/PatternFinder.java#L71-L106 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/PluginGroup.java | PluginGroup.loadPlugins | @Nullable
static PluginGroup loadPlugins(ClassLoader classLoader, PluginTarget target, CentralDogmaConfig config) {
requireNonNull(classLoader, "classLoader");
requireNonNull(target, "target");
requireNonNull(config, "config");
final ServiceLoader<Plugin> loader = ServiceLoader.load(Plugin.class, classLoader);
final Builder<Plugin> plugins = new Builder<>();
for (Plugin plugin : loader) {
if (target == plugin.target() && plugin.isEnabled(config)) {
plugins.add(plugin);
}
}
final List<Plugin> list = plugins.build();
if (list.isEmpty()) {
return null;
}
return new PluginGroup(list, Executors.newSingleThreadExecutor(new DefaultThreadFactory(
"plugins-for-" + target.name().toLowerCase().replace("_", "-"), true)));
} | java | @Nullable
static PluginGroup loadPlugins(ClassLoader classLoader, PluginTarget target, CentralDogmaConfig config) {
requireNonNull(classLoader, "classLoader");
requireNonNull(target, "target");
requireNonNull(config, "config");
final ServiceLoader<Plugin> loader = ServiceLoader.load(Plugin.class, classLoader);
final Builder<Plugin> plugins = new Builder<>();
for (Plugin plugin : loader) {
if (target == plugin.target() && plugin.isEnabled(config)) {
plugins.add(plugin);
}
}
final List<Plugin> list = plugins.build();
if (list.isEmpty()) {
return null;
}
return new PluginGroup(list, Executors.newSingleThreadExecutor(new DefaultThreadFactory(
"plugins-for-" + target.name().toLowerCase().replace("_", "-"), true)));
} | [
"@",
"Nullable",
"static",
"PluginGroup",
"loadPlugins",
"(",
"ClassLoader",
"classLoader",
",",
"PluginTarget",
"target",
",",
"CentralDogmaConfig",
"config",
")",
"{",
"requireNonNull",
"(",
"classLoader",
",",
"\"classLoader\"",
")",
";",
"requireNonNull",
"(",
"... | Returns a new {@link PluginGroup} which holds the {@link Plugin}s loaded from the classpath.
{@code null} is returned if there is no {@link Plugin} whose target equals to the specified
{@code target}.
@param classLoader which is used to load the {@link Plugin}s
@param target the {@link PluginTarget} which would be loaded | [
"Returns",
"a",
"new",
"{",
"@link",
"PluginGroup",
"}",
"which",
"holds",
"the",
"{",
"@link",
"Plugin",
"}",
"s",
"loaded",
"from",
"the",
"classpath",
".",
"{",
"@code",
"null",
"}",
"is",
"returned",
"if",
"there",
"is",
"no",
"{",
"@link",
"Plugin... | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/PluginGroup.java#L75-L96 |
dnsjava/dnsjava | org/xbill/DNS/ReverseMap.java | ReverseMap.fromAddress | public static Name
fromAddress(String addr, int family) throws UnknownHostException {
byte [] array = Address.toByteArray(addr, family);
if (array == null)
throw new UnknownHostException("Invalid IP address");
return fromAddress(array);
} | java | public static Name
fromAddress(String addr, int family) throws UnknownHostException {
byte [] array = Address.toByteArray(addr, family);
if (array == null)
throw new UnknownHostException("Invalid IP address");
return fromAddress(array);
} | [
"public",
"static",
"Name",
"fromAddress",
"(",
"String",
"addr",
",",
"int",
"family",
")",
"throws",
"UnknownHostException",
"{",
"byte",
"[",
"]",
"array",
"=",
"Address",
".",
"toByteArray",
"(",
"addr",
",",
"family",
")",
";",
"if",
"(",
"array",
"... | Creates a reverse map name corresponding to an address contained in
a String.
@param addr The address from which to build a name.
@return The name corresponding to the address in the reverse map.
@throws UnknownHostException The string does not contain a valid address. | [
"Creates",
"a",
"reverse",
"map",
"name",
"corresponding",
"to",
"an",
"address",
"contained",
"in",
"a",
"String",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/ReverseMap.java#L105-L111 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.sismember | @Override
public Boolean sismember(final byte[] key, final byte[] member) {
checkIsInMultiOrPipeline();
client.sismember(key, member);
return client.getIntegerReply() == 1;
} | java | @Override
public Boolean sismember(final byte[] key, final byte[] member) {
checkIsInMultiOrPipeline();
client.sismember(key, member);
return client.getIntegerReply() == 1;
} | [
"@",
"Override",
"public",
"Boolean",
"sismember",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"member",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"sismember",
"(",
"key",
",",
"member",
")",
";",
"r... | Return true if member is a member of the set stored at key, otherwise false is returned.
<p>
Time complexity O(1)
@param key
@param member
@return Boolean reply, specifically: true if the element is a member of the set false if the element
is not a member of the set OR if the key does not exist | [
"Return",
"true",
"if",
"member",
"is",
"a",
"member",
"of",
"the",
"set",
"stored",
"at",
"key",
"otherwise",
"false",
"is",
"returned",
".",
"<p",
">",
"Time",
"complexity",
"O",
"(",
"1",
")"
] | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1496-L1501 |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/msg/ModbusRequestBuilder.java | ModbusRequestBuilder.buildDiagnostics | public ModbusRequest buildDiagnostics(DiagnosticsSubFunctionCode subFunctionCode, int serverAddress, int data) throws ModbusNumberException {
DiagnosticsRequest request = new DiagnosticsRequest();
request.setServerAddress(serverAddress);
request.setSubFunctionCode(subFunctionCode);
request.setSubFunctionData(data);
return request;
} | java | public ModbusRequest buildDiagnostics(DiagnosticsSubFunctionCode subFunctionCode, int serverAddress, int data) throws ModbusNumberException {
DiagnosticsRequest request = new DiagnosticsRequest();
request.setServerAddress(serverAddress);
request.setSubFunctionCode(subFunctionCode);
request.setSubFunctionData(data);
return request;
} | [
"public",
"ModbusRequest",
"buildDiagnostics",
"(",
"DiagnosticsSubFunctionCode",
"subFunctionCode",
",",
"int",
"serverAddress",
",",
"int",
"data",
")",
"throws",
"ModbusNumberException",
"{",
"DiagnosticsRequest",
"request",
"=",
"new",
"DiagnosticsRequest",
"(",
")",
... | The function uses a sub-function code field in the query to define the type of test to
be performed. The server echoes both the function code and sub-function code in a normal
response. Some of the diagnostics cause data to be returned from the remote device in the
data field of a normal response.
@param subFunctionCode a sub-function code
@param serverAddress a slave address
@param data request data field
@return DiagnosticsRequest instance
@throws ModbusNumberException if server address is in-valid
@see DiagnosticsRequest
@see DiagnosticsSubFunctionCode | [
"The",
"function",
"uses",
"a",
"sub",
"-",
"function",
"code",
"field",
"in",
"the",
"query",
"to",
"define",
"the",
"type",
"of",
"test",
"to",
"be",
"performed",
".",
"The",
"server",
"echoes",
"both",
"the",
"function",
"code",
"and",
"sub",
"-",
"... | train | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/msg/ModbusRequestBuilder.java#L185-L191 |
geomajas/geomajas-project-hammer-gwt | hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerWidget.java | HammerWidget.setOption | @Api
public <T> void setOption(GestureOption<T> option, T value) {
hammertime.setOption(option, value);
} | java | @Api
public <T> void setOption(GestureOption<T> option, T value) {
hammertime.setOption(option, value);
} | [
"@",
"Api",
"public",
"<",
"T",
">",
"void",
"setOption",
"(",
"GestureOption",
"<",
"T",
">",
"option",
",",
"T",
"value",
")",
"{",
"hammertime",
".",
"setOption",
"(",
"option",
",",
"value",
")",
";",
"}"
] | Change initial settings of this widget.
@param option {@link org.geomajas.hammergwt.client.option.GestureOption}
@param value T look at {@link org.geomajas.hammergwt.client.option.GestureOptions}
interface for all possible types
@param <T>
@since 1.0.0 | [
"Change",
"initial",
"settings",
"of",
"this",
"widget",
"."
] | train | https://github.com/geomajas/geomajas-project-hammer-gwt/blob/bc764171bed55e5a9eced72f0078ec22b8105b62/hammer-gwt/src/main/java/org/geomajas/hammergwt/client/HammerWidget.java#L81-L84 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.