repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
PinaeOS/nala | src/main/java/org/pinae/nala/xb/Xml.java | Xml.toObject | public static Object toObject(String xml, String encoding, Class<?> cls) throws UnmarshalException {
"""
将XML文件绑定为对象
@param xml XML字符串
@param encoding XML文件编码, 例如UTF-8, GBK
@param cls 绑定目标类
@return 绑定后的对象
@throws UnmarshalException 解组异常
"""
if (xml == null || xml.trim().equals("")) {
throw new UnmarshalException("XML String is Empty");
}
Object object = null;
Unmarshaller bind = null;
try {
bind = new XmlUnmarshaller(new ByteArrayInputStream(xml.getBytes(encoding)));
} catch (UnsupportedEncodingException e) {
throw new UnmarshalException(e);
}
if (bind != null) {
bind.setRootClass(cls);
object = bind.unmarshal();
}
return object;
} | java | public static Object toObject(String xml, String encoding, Class<?> cls) throws UnmarshalException {
if (xml == null || xml.trim().equals("")) {
throw new UnmarshalException("XML String is Empty");
}
Object object = null;
Unmarshaller bind = null;
try {
bind = new XmlUnmarshaller(new ByteArrayInputStream(xml.getBytes(encoding)));
} catch (UnsupportedEncodingException e) {
throw new UnmarshalException(e);
}
if (bind != null) {
bind.setRootClass(cls);
object = bind.unmarshal();
}
return object;
} | [
"public",
"static",
"Object",
"toObject",
"(",
"String",
"xml",
",",
"String",
"encoding",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"throws",
"UnmarshalException",
"{",
"if",
"(",
"xml",
"==",
"null",
"||",
"xml",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"throw",
"new",
"UnmarshalException",
"(",
"\"XML String is Empty\"",
")",
";",
"}",
"Object",
"object",
"=",
"null",
";",
"Unmarshaller",
"bind",
"=",
"null",
";",
"try",
"{",
"bind",
"=",
"new",
"XmlUnmarshaller",
"(",
"new",
"ByteArrayInputStream",
"(",
"xml",
".",
"getBytes",
"(",
"encoding",
")",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"UnmarshalException",
"(",
"e",
")",
";",
"}",
"if",
"(",
"bind",
"!=",
"null",
")",
"{",
"bind",
".",
"setRootClass",
"(",
"cls",
")",
";",
"object",
"=",
"bind",
".",
"unmarshal",
"(",
")",
";",
"}",
"return",
"object",
";",
"}"
] | 将XML文件绑定为对象
@param xml XML字符串
@param encoding XML文件编码, 例如UTF-8, GBK
@param cls 绑定目标类
@return 绑定后的对象
@throws UnmarshalException 解组异常 | [
"将XML文件绑定为对象"
] | train | https://github.com/PinaeOS/nala/blob/2047ade4af197cec938278d300d111ea94af6fbf/src/main/java/org/pinae/nala/xb/Xml.java#L53-L75 |
jenkinsci/jenkins | core/src/main/java/hudson/tasks/BuildWrapper.java | BuildWrapper.decorateLauncher | public Launcher decorateLauncher(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, RunnerAbortedException {
"""
Provides an opportunity for a {@link BuildWrapper} to decorate a {@link Launcher} to be used in the build.
<p>
This hook is called very early on in the build (even before {@link #setUp(AbstractBuild, Launcher, BuildListener)} is invoked.)
The typical use of {@link Launcher} decoration involves in modifying the environment that processes run,
such as the use of sudo/pfexec/chroot, or manipulating environment variables.
<p>
The default implementation is no-op, which just returns the {@code launcher} parameter as-is.
@param build
The build in progress for which this {@link BuildWrapper} is called. Never null.
@param launcher
The default launcher. Never null. This method is expected to wrap this launcher.
This makes sure that when multiple {@link BuildWrapper}s attempt to decorate the same launcher
it will sort of work. But if you are developing a plugin where such collision is not a concern,
you can also simply discard this {@link Launcher} and create an entirely different {@link Launcher}
and return it, too.
@param listener
Connected to the build output. Never null. Can be used for error reporting.
@return
Must not be null. If a fatal error happens, throw an exception.
@throws RunnerAbortedException
If a fatal error is detected but the implementation handled it gracefully, throw this exception
to suppress stack trace.
@since 1.280
@see LauncherDecorator
"""
return launcher;
} | java | public Launcher decorateLauncher(AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, RunnerAbortedException {
return launcher;
} | [
"public",
"Launcher",
"decorateLauncher",
"(",
"AbstractBuild",
"build",
",",
"Launcher",
"launcher",
",",
"BuildListener",
"listener",
")",
"throws",
"IOException",
",",
"InterruptedException",
",",
"RunnerAbortedException",
"{",
"return",
"launcher",
";",
"}"
] | Provides an opportunity for a {@link BuildWrapper} to decorate a {@link Launcher} to be used in the build.
<p>
This hook is called very early on in the build (even before {@link #setUp(AbstractBuild, Launcher, BuildListener)} is invoked.)
The typical use of {@link Launcher} decoration involves in modifying the environment that processes run,
such as the use of sudo/pfexec/chroot, or manipulating environment variables.
<p>
The default implementation is no-op, which just returns the {@code launcher} parameter as-is.
@param build
The build in progress for which this {@link BuildWrapper} is called. Never null.
@param launcher
The default launcher. Never null. This method is expected to wrap this launcher.
This makes sure that when multiple {@link BuildWrapper}s attempt to decorate the same launcher
it will sort of work. But if you are developing a plugin where such collision is not a concern,
you can also simply discard this {@link Launcher} and create an entirely different {@link Launcher}
and return it, too.
@param listener
Connected to the build output. Never null. Can be used for error reporting.
@return
Must not be null. If a fatal error happens, throw an exception.
@throws RunnerAbortedException
If a fatal error is detected but the implementation handled it gracefully, throw this exception
to suppress stack trace.
@since 1.280
@see LauncherDecorator | [
"Provides",
"an",
"opportunity",
"for",
"a",
"{",
"@link",
"BuildWrapper",
"}",
"to",
"decorate",
"a",
"{",
"@link",
"Launcher",
"}",
"to",
"be",
"used",
"in",
"the",
"build",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/tasks/BuildWrapper.java#L187-L189 |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java | AbstractEpollStreamChannel.doWriteSingle | protected int doWriteSingle(ChannelOutboundBuffer in) throws Exception {
"""
Attempt to write a single object.
@param in the collection which contains objects to write.
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but
no data was accepted</li>
</ul>
@throws Exception If an I/O error occurs.
"""
// The outbound buffer contains only one message or it contains a file region.
Object msg = in.current();
if (msg instanceof ByteBuf) {
return writeBytes(in, (ByteBuf) msg);
} else if (msg instanceof DefaultFileRegion) {
return writeDefaultFileRegion(in, (DefaultFileRegion) msg);
} else if (msg instanceof FileRegion) {
return writeFileRegion(in, (FileRegion) msg);
} else if (msg instanceof SpliceOutTask) {
if (!((SpliceOutTask) msg).spliceOut()) {
return WRITE_STATUS_SNDBUF_FULL;
}
in.remove();
return 1;
} else {
// Should never reach here.
throw new Error();
}
} | java | protected int doWriteSingle(ChannelOutboundBuffer in) throws Exception {
// The outbound buffer contains only one message or it contains a file region.
Object msg = in.current();
if (msg instanceof ByteBuf) {
return writeBytes(in, (ByteBuf) msg);
} else if (msg instanceof DefaultFileRegion) {
return writeDefaultFileRegion(in, (DefaultFileRegion) msg);
} else if (msg instanceof FileRegion) {
return writeFileRegion(in, (FileRegion) msg);
} else if (msg instanceof SpliceOutTask) {
if (!((SpliceOutTask) msg).spliceOut()) {
return WRITE_STATUS_SNDBUF_FULL;
}
in.remove();
return 1;
} else {
// Should never reach here.
throw new Error();
}
} | [
"protected",
"int",
"doWriteSingle",
"(",
"ChannelOutboundBuffer",
"in",
")",
"throws",
"Exception",
"{",
"// The outbound buffer contains only one message or it contains a file region.",
"Object",
"msg",
"=",
"in",
".",
"current",
"(",
")",
";",
"if",
"(",
"msg",
"instanceof",
"ByteBuf",
")",
"{",
"return",
"writeBytes",
"(",
"in",
",",
"(",
"ByteBuf",
")",
"msg",
")",
";",
"}",
"else",
"if",
"(",
"msg",
"instanceof",
"DefaultFileRegion",
")",
"{",
"return",
"writeDefaultFileRegion",
"(",
"in",
",",
"(",
"DefaultFileRegion",
")",
"msg",
")",
";",
"}",
"else",
"if",
"(",
"msg",
"instanceof",
"FileRegion",
")",
"{",
"return",
"writeFileRegion",
"(",
"in",
",",
"(",
"FileRegion",
")",
"msg",
")",
";",
"}",
"else",
"if",
"(",
"msg",
"instanceof",
"SpliceOutTask",
")",
"{",
"if",
"(",
"!",
"(",
"(",
"SpliceOutTask",
")",
"msg",
")",
".",
"spliceOut",
"(",
")",
")",
"{",
"return",
"WRITE_STATUS_SNDBUF_FULL",
";",
"}",
"in",
".",
"remove",
"(",
")",
";",
"return",
"1",
";",
"}",
"else",
"{",
"// Should never reach here.",
"throw",
"new",
"Error",
"(",
")",
";",
"}",
"}"
] | Attempt to write a single object.
@param in the collection which contains objects to write.
@return The value that should be decremented from the write quantum which starts at
{@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows:
<ul>
<li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content)
is encountered</li>
<li>1 - if a single call to write data was made to the OS</li>
<li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but
no data was accepted</li>
</ul>
@throws Exception If an I/O error occurs. | [
"Attempt",
"to",
"write",
"a",
"single",
"object",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java#L476-L495 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/ApplicationServiceClient.java | ApplicationServiceClient.createApplication | public final Application createApplication(String parent, Application application) {
"""
Creates a new application entity.
<p>Sample code:
<pre><code>
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
Application application = Application.newBuilder().build();
Application response = applicationServiceClient.createApplication(parent.toString(), application);
}
</code></pre>
@param parent Required.
<p>Resource name of the profile under which the application is created.
<p>The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for
example, "projects/test-project/tenants/test-tenant/profiles/test-profile".
@param application Required.
<p>The application to be created.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
CreateApplicationRequest request =
CreateApplicationRequest.newBuilder().setParent(parent).setApplication(application).build();
return createApplication(request);
} | java | public final Application createApplication(String parent, Application application) {
CreateApplicationRequest request =
CreateApplicationRequest.newBuilder().setParent(parent).setApplication(application).build();
return createApplication(request);
} | [
"public",
"final",
"Application",
"createApplication",
"(",
"String",
"parent",
",",
"Application",
"application",
")",
"{",
"CreateApplicationRequest",
"request",
"=",
"CreateApplicationRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
")",
".",
"setApplication",
"(",
"application",
")",
".",
"build",
"(",
")",
";",
"return",
"createApplication",
"(",
"request",
")",
";",
"}"
] | Creates a new application entity.
<p>Sample code:
<pre><code>
try (ApplicationServiceClient applicationServiceClient = ApplicationServiceClient.create()) {
ProfileName parent = ProfileName.of("[PROJECT]", "[TENANT]", "[PROFILE]");
Application application = Application.newBuilder().build();
Application response = applicationServiceClient.createApplication(parent.toString(), application);
}
</code></pre>
@param parent Required.
<p>Resource name of the profile under which the application is created.
<p>The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for
example, "projects/test-project/tenants/test-tenant/profiles/test-profile".
@param application Required.
<p>The application to be created.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"new",
"application",
"entity",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/ApplicationServiceClient.java#L214-L219 |
Bandwidth/java-bandwidth | src/main/java/com/bandwidth/sdk/model/AvailableNumber.java | AvailableNumber.searchLocal | public static List<AvailableNumber> searchLocal(final BandwidthClient client, final Map<String, Object>params)
throws Exception {
"""
Convenience factory method to return local numbers based on a given search criteria for a given client
@param client the client
@param params the params
@return the list
@throws IOException unexpected error.
"""
final String tollFreeUri = BandwidthConstants.AVAILABLE_NUMBERS_LOCAL_URI_PATH;
final JSONArray array = toJSONArray(client.get(tollFreeUri, params));
final List<AvailableNumber> numbers = new ArrayList<AvailableNumber>();
for (final Object obj : array) {
numbers.add(new AvailableNumber(client, (JSONObject) obj));
}
return numbers;
} | java | public static List<AvailableNumber> searchLocal(final BandwidthClient client, final Map<String, Object>params)
throws Exception {
final String tollFreeUri = BandwidthConstants.AVAILABLE_NUMBERS_LOCAL_URI_PATH;
final JSONArray array = toJSONArray(client.get(tollFreeUri, params));
final List<AvailableNumber> numbers = new ArrayList<AvailableNumber>();
for (final Object obj : array) {
numbers.add(new AvailableNumber(client, (JSONObject) obj));
}
return numbers;
} | [
"public",
"static",
"List",
"<",
"AvailableNumber",
">",
"searchLocal",
"(",
"final",
"BandwidthClient",
"client",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"throws",
"Exception",
"{",
"final",
"String",
"tollFreeUri",
"=",
"BandwidthConstants",
".",
"AVAILABLE_NUMBERS_LOCAL_URI_PATH",
";",
"final",
"JSONArray",
"array",
"=",
"toJSONArray",
"(",
"client",
".",
"get",
"(",
"tollFreeUri",
",",
"params",
")",
")",
";",
"final",
"List",
"<",
"AvailableNumber",
">",
"numbers",
"=",
"new",
"ArrayList",
"<",
"AvailableNumber",
">",
"(",
")",
";",
"for",
"(",
"final",
"Object",
"obj",
":",
"array",
")",
"{",
"numbers",
".",
"add",
"(",
"new",
"AvailableNumber",
"(",
"client",
",",
"(",
"JSONObject",
")",
"obj",
")",
")",
";",
"}",
"return",
"numbers",
";",
"}"
] | Convenience factory method to return local numbers based on a given search criteria for a given client
@param client the client
@param params the params
@return the list
@throws IOException unexpected error. | [
"Convenience",
"factory",
"method",
"to",
"return",
"local",
"numbers",
"based",
"on",
"a",
"given",
"search",
"criteria",
"for",
"a",
"given",
"client"
] | train | https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/AvailableNumber.java#L114-L125 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/core/util/MimeTypeUtil.java | MimeTypeUtil.getMimeType | public static String getMimeType(String name, Property property, String defaultValue) {
"""
Detects the mime type of a binary property in the context of the nodes name.
@param name the name of the node which defines the binary resource (probably a file name)
@param property the binary property (for stream parsing)
@param defaultValue the default value if the detection has no useful result
@return the detected mime type or the default value given
"""
MimeType mimeType = getMimeType(name, property);
return mimeType != null ? mimeType.toString() : defaultValue;
} | java | public static String getMimeType(String name, Property property, String defaultValue) {
MimeType mimeType = getMimeType(name, property);
return mimeType != null ? mimeType.toString() : defaultValue;
} | [
"public",
"static",
"String",
"getMimeType",
"(",
"String",
"name",
",",
"Property",
"property",
",",
"String",
"defaultValue",
")",
"{",
"MimeType",
"mimeType",
"=",
"getMimeType",
"(",
"name",
",",
"property",
")",
";",
"return",
"mimeType",
"!=",
"null",
"?",
"mimeType",
".",
"toString",
"(",
")",
":",
"defaultValue",
";",
"}"
] | Detects the mime type of a binary property in the context of the nodes name.
@param name the name of the node which defines the binary resource (probably a file name)
@param property the binary property (for stream parsing)
@param defaultValue the default value if the detection has no useful result
@return the detected mime type or the default value given | [
"Detects",
"the",
"mime",
"type",
"of",
"a",
"binary",
"property",
"in",
"the",
"context",
"of",
"the",
"nodes",
"name",
"."
] | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/MimeTypeUtil.java#L72-L75 |
apache/flink | flink-core/src/main/java/org/apache/flink/util/Preconditions.java | Preconditions.checkState | public static void checkState(boolean condition, @Nullable Object errorMessage) {
"""
Checks the given boolean condition, and throws an {@code IllegalStateException} if
the condition is not met (evaluates to {@code false}). The exception will have the
given error message.
@param condition The condition to check
@param errorMessage The message for the {@code IllegalStateException} that is thrown if the check fails.
@throws IllegalStateException Thrown, if the condition is violated.
"""
if (!condition) {
throw new IllegalStateException(String.valueOf(errorMessage));
}
} | java | public static void checkState(boolean condition, @Nullable Object errorMessage) {
if (!condition) {
throw new IllegalStateException(String.valueOf(errorMessage));
}
} | [
"public",
"static",
"void",
"checkState",
"(",
"boolean",
"condition",
",",
"@",
"Nullable",
"Object",
"errorMessage",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"valueOf",
"(",
"errorMessage",
")",
")",
";",
"}",
"}"
] | Checks the given boolean condition, and throws an {@code IllegalStateException} if
the condition is not met (evaluates to {@code false}). The exception will have the
given error message.
@param condition The condition to check
@param errorMessage The message for the {@code IllegalStateException} that is thrown if the check fails.
@throws IllegalStateException Thrown, if the condition is violated. | [
"Checks",
"the",
"given",
"boolean",
"condition",
"and",
"throws",
"an",
"{",
"@code",
"IllegalStateException",
"}",
"if",
"the",
"condition",
"is",
"not",
"met",
"(",
"evaluates",
"to",
"{",
"@code",
"false",
"}",
")",
".",
"The",
"exception",
"will",
"have",
"the",
"given",
"error",
"message",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/Preconditions.java#L193-L197 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/io/Tokenizer.java | Tokenizer.addColumn | private void addColumn(final List<String> columns, String line, int charIndex) {
"""
Adds the currentColumn to columns list managing the case with currentColumn.length() == 0
It was introduced to manage the emptyColumnParsing.
@param columns
@param line
@param charIndex
"""
if(currentColumn.length() > 0){
columns.add(currentColumn.toString());
}
else{
int previousCharIndex = charIndex - 1;
boolean availableCharacters = previousCharIndex >= 0 ;
boolean previousCharIsQuote = availableCharacters && line.charAt(previousCharIndex) == quoteChar;
String noValue = ( (previousCharIsQuote) && emptyColumnParsing.equals(EmptyColumnParsing.ParseEmptyColumnsAsEmptyString)) ? "" : null;
columns.add(noValue);
}
} | java | private void addColumn(final List<String> columns, String line, int charIndex) {
if(currentColumn.length() > 0){
columns.add(currentColumn.toString());
}
else{
int previousCharIndex = charIndex - 1;
boolean availableCharacters = previousCharIndex >= 0 ;
boolean previousCharIsQuote = availableCharacters && line.charAt(previousCharIndex) == quoteChar;
String noValue = ( (previousCharIsQuote) && emptyColumnParsing.equals(EmptyColumnParsing.ParseEmptyColumnsAsEmptyString)) ? "" : null;
columns.add(noValue);
}
} | [
"private",
"void",
"addColumn",
"(",
"final",
"List",
"<",
"String",
">",
"columns",
",",
"String",
"line",
",",
"int",
"charIndex",
")",
"{",
"if",
"(",
"currentColumn",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"columns",
".",
"add",
"(",
"currentColumn",
".",
"toString",
"(",
")",
")",
";",
"}",
"else",
"{",
"int",
"previousCharIndex",
"=",
"charIndex",
"-",
"1",
";",
"boolean",
"availableCharacters",
"=",
"previousCharIndex",
">=",
"0",
";",
"boolean",
"previousCharIsQuote",
"=",
"availableCharacters",
"&&",
"line",
".",
"charAt",
"(",
"previousCharIndex",
")",
"==",
"quoteChar",
";",
"String",
"noValue",
"=",
"(",
"(",
"previousCharIsQuote",
")",
"&&",
"emptyColumnParsing",
".",
"equals",
"(",
"EmptyColumnParsing",
".",
"ParseEmptyColumnsAsEmptyString",
")",
")",
"?",
"\"\"",
":",
"null",
";",
"columns",
".",
"add",
"(",
"noValue",
")",
";",
"}",
"}"
] | Adds the currentColumn to columns list managing the case with currentColumn.length() == 0
It was introduced to manage the emptyColumnParsing.
@param columns
@param line
@param charIndex | [
"Adds",
"the",
"currentColumn",
"to",
"columns",
"list",
"managing",
"the",
"case",
"with",
"currentColumn",
".",
"length",
"()",
"==",
"0",
"It",
"was",
"introduced",
"to",
"manage",
"the",
"emptyColumnParsing",
"."
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/io/Tokenizer.java#L314-L326 |
Samsung/GearVRf | GVRf/Extensions/3DCursor/IODevices/io_template/src/main/java/com/sample/template/TemplateDevice.java | TemplateDevice.processPosition | public void processPosition(float x, float y, float z) {
"""
This is a convenience wrapper around the {@link #setPosition(float, float, float)} call.
This method applies the cameras model matrix to the x, y, z to give relative positions
with respect to the camera rig.
This call is made from the native layer.
@param x normalized values for the x axis. This values is adjusted for the frustum in this
method.
@param y normalized values for the y axis. This values is adjusted for the frustum in this
method.
@param z normalized values for the z axis. This values is multiplied by {@link #MAX_DEPTH}
for the absolute position.
"""
GVRScene scene = context.getMainScene();
if (scene != null) {
float depth = z * MAX_DEPTH;
float frustumWidth, frustumHeight;
// calculate the frustum using the aspect ratio and FOV
// http://docs.unity3d.com/Manual/FrustumSizeAtDistance.html
float aspectRatio = scene.getMainCameraRig().getCenterCamera()
.getAspectRatio();
float fovY = scene.getMainCameraRig().getCenterCamera()
.getFovY();
float frustumHeightMultiplier = (float) Math
.tan(Math.toRadians(fovY / 2)) * 2.0f;
frustumHeight = frustumHeightMultiplier * depth;
frustumWidth = frustumHeight * aspectRatio;
Matrix4f viewMatrix = scene.getMainCameraRig().getHeadTransform()
.getModelMatrix4f();
Vector3f position = new Vector3f(frustumWidth * -x,
frustumHeight * -y, depth);
position.mulPoint(viewMatrix);
setPosition(position.x, position.y, position.z);
}
} | java | public void processPosition(float x, float y, float z) {
GVRScene scene = context.getMainScene();
if (scene != null) {
float depth = z * MAX_DEPTH;
float frustumWidth, frustumHeight;
// calculate the frustum using the aspect ratio and FOV
// http://docs.unity3d.com/Manual/FrustumSizeAtDistance.html
float aspectRatio = scene.getMainCameraRig().getCenterCamera()
.getAspectRatio();
float fovY = scene.getMainCameraRig().getCenterCamera()
.getFovY();
float frustumHeightMultiplier = (float) Math
.tan(Math.toRadians(fovY / 2)) * 2.0f;
frustumHeight = frustumHeightMultiplier * depth;
frustumWidth = frustumHeight * aspectRatio;
Matrix4f viewMatrix = scene.getMainCameraRig().getHeadTransform()
.getModelMatrix4f();
Vector3f position = new Vector3f(frustumWidth * -x,
frustumHeight * -y, depth);
position.mulPoint(viewMatrix);
setPosition(position.x, position.y, position.z);
}
} | [
"public",
"void",
"processPosition",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"GVRScene",
"scene",
"=",
"context",
".",
"getMainScene",
"(",
")",
";",
"if",
"(",
"scene",
"!=",
"null",
")",
"{",
"float",
"depth",
"=",
"z",
"*",
"MAX_DEPTH",
";",
"float",
"frustumWidth",
",",
"frustumHeight",
";",
"// calculate the frustum using the aspect ratio and FOV",
"// http://docs.unity3d.com/Manual/FrustumSizeAtDistance.html",
"float",
"aspectRatio",
"=",
"scene",
".",
"getMainCameraRig",
"(",
")",
".",
"getCenterCamera",
"(",
")",
".",
"getAspectRatio",
"(",
")",
";",
"float",
"fovY",
"=",
"scene",
".",
"getMainCameraRig",
"(",
")",
".",
"getCenterCamera",
"(",
")",
".",
"getFovY",
"(",
")",
";",
"float",
"frustumHeightMultiplier",
"=",
"(",
"float",
")",
"Math",
".",
"tan",
"(",
"Math",
".",
"toRadians",
"(",
"fovY",
"/",
"2",
")",
")",
"*",
"2.0f",
";",
"frustumHeight",
"=",
"frustumHeightMultiplier",
"*",
"depth",
";",
"frustumWidth",
"=",
"frustumHeight",
"*",
"aspectRatio",
";",
"Matrix4f",
"viewMatrix",
"=",
"scene",
".",
"getMainCameraRig",
"(",
")",
".",
"getHeadTransform",
"(",
")",
".",
"getModelMatrix4f",
"(",
")",
";",
"Vector3f",
"position",
"=",
"new",
"Vector3f",
"(",
"frustumWidth",
"*",
"-",
"x",
",",
"frustumHeight",
"*",
"-",
"y",
",",
"depth",
")",
";",
"position",
".",
"mulPoint",
"(",
"viewMatrix",
")",
";",
"setPosition",
"(",
"position",
".",
"x",
",",
"position",
".",
"y",
",",
"position",
".",
"z",
")",
";",
"}",
"}"
] | This is a convenience wrapper around the {@link #setPosition(float, float, float)} call.
This method applies the cameras model matrix to the x, y, z to give relative positions
with respect to the camera rig.
This call is made from the native layer.
@param x normalized values for the x axis. This values is adjusted for the frustum in this
method.
@param y normalized values for the y axis. This values is adjusted for the frustum in this
method.
@param z normalized values for the z axis. This values is multiplied by {@link #MAX_DEPTH}
for the absolute position. | [
"This",
"is",
"a",
"convenience",
"wrapper",
"around",
"the",
"{",
"@link",
"#setPosition",
"(",
"float",
"float",
"float",
")",
"}",
"call",
".",
"This",
"method",
"applies",
"the",
"cameras",
"model",
"matrix",
"to",
"the",
"x",
"y",
"z",
"to",
"give",
"relative",
"positions",
"with",
"respect",
"to",
"the",
"camera",
"rig",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/io_template/src/main/java/com/sample/template/TemplateDevice.java#L114-L137 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/grpc/DataMessageServerStreamObserver.java | DataMessageServerStreamObserver.onNext | public void onNext(DataMessage<T, DataBuffer> value) {
"""
Receives a message with data buffer from the stream.
@param value the value passed to the stream
"""
DataBuffer buffer = value.getBuffer();
if (buffer != null) {
mBufferRepository.offerBuffer(buffer, value.getMessage());
}
mObserver.onNext(value.getMessage());
} | java | public void onNext(DataMessage<T, DataBuffer> value) {
DataBuffer buffer = value.getBuffer();
if (buffer != null) {
mBufferRepository.offerBuffer(buffer, value.getMessage());
}
mObserver.onNext(value.getMessage());
} | [
"public",
"void",
"onNext",
"(",
"DataMessage",
"<",
"T",
",",
"DataBuffer",
">",
"value",
")",
"{",
"DataBuffer",
"buffer",
"=",
"value",
".",
"getBuffer",
"(",
")",
";",
"if",
"(",
"buffer",
"!=",
"null",
")",
"{",
"mBufferRepository",
".",
"offerBuffer",
"(",
"buffer",
",",
"value",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"mObserver",
".",
"onNext",
"(",
"value",
".",
"getMessage",
"(",
")",
")",
";",
"}"
] | Receives a message with data buffer from the stream.
@param value the value passed to the stream | [
"Receives",
"a",
"message",
"with",
"data",
"buffer",
"from",
"the",
"stream",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/grpc/DataMessageServerStreamObserver.java#L49-L55 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/ModifyingCollectionWithItself.java | ModifyingCollectionWithItself.matchMethodInvocation | @Override
public Description matchMethodInvocation(MethodInvocationTree t, VisitorState state) {
"""
Matches calls to addAll, containsAll, removeAll, and retainAll on itself
"""
if (IS_COLLECTION_MODIFIED_WITH_ITSELF.matches(t, state)) {
return describe(t, state);
}
return Description.NO_MATCH;
} | java | @Override
public Description matchMethodInvocation(MethodInvocationTree t, VisitorState state) {
if (IS_COLLECTION_MODIFIED_WITH_ITSELF.matches(t, state)) {
return describe(t, state);
}
return Description.NO_MATCH;
} | [
"@",
"Override",
"public",
"Description",
"matchMethodInvocation",
"(",
"MethodInvocationTree",
"t",
",",
"VisitorState",
"state",
")",
"{",
"if",
"(",
"IS_COLLECTION_MODIFIED_WITH_ITSELF",
".",
"matches",
"(",
"t",
",",
"state",
")",
")",
"{",
"return",
"describe",
"(",
"t",
",",
"state",
")",
";",
"}",
"return",
"Description",
".",
"NO_MATCH",
";",
"}"
] | Matches calls to addAll, containsAll, removeAll, and retainAll on itself | [
"Matches",
"calls",
"to",
"addAll",
"containsAll",
"removeAll",
"and",
"retainAll",
"on",
"itself"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ModifyingCollectionWithItself.java#L78-L84 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java | PersistenceBrokerImpl.storeReferences | private void storeReferences(Object obj, ClassDescriptor cld, boolean insert, boolean ignoreReferences) {
"""
Store all object references that <b>obj</b> points to.
All objects which we have a FK pointing to (Via ReferenceDescriptors) will be
stored if auto-update is true <b>AND</b> the member field containing the object
reference is NOT null.
With flag <em>ignoreReferences</em> the storing/linking
of references can be suppressed (independent of the used auto-update setting),
except {@link org.apache.ojb.broker.metadata.SuperReferenceDescriptor}
these kind of reference (descriptor) will always be performed.
@param obj Object which we will store references for
"""
// get all members of obj that are references and store them
Collection listRds = cld.getObjectReferenceDescriptors();
// return if nothing to do
if(listRds == null || listRds.size() == 0)
{
return;
}
Iterator i = listRds.iterator();
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
/*
arminw: the super-references (used for table per subclass inheritance) must
be performed in any case. The "normal" 1:1 references can be ignored when
flag "ignoreReferences" is set
*/
if((!ignoreReferences && rds.getCascadingStore() != ObjectReferenceDescriptor.CASCADE_NONE)
|| rds.isSuperReferenceDescriptor())
{
storeAndLinkOneToOne(false, obj, cld, rds, insert);
}
}
} | java | private void storeReferences(Object obj, ClassDescriptor cld, boolean insert, boolean ignoreReferences)
{
// get all members of obj that are references and store them
Collection listRds = cld.getObjectReferenceDescriptors();
// return if nothing to do
if(listRds == null || listRds.size() == 0)
{
return;
}
Iterator i = listRds.iterator();
while (i.hasNext())
{
ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next();
/*
arminw: the super-references (used for table per subclass inheritance) must
be performed in any case. The "normal" 1:1 references can be ignored when
flag "ignoreReferences" is set
*/
if((!ignoreReferences && rds.getCascadingStore() != ObjectReferenceDescriptor.CASCADE_NONE)
|| rds.isSuperReferenceDescriptor())
{
storeAndLinkOneToOne(false, obj, cld, rds, insert);
}
}
} | [
"private",
"void",
"storeReferences",
"(",
"Object",
"obj",
",",
"ClassDescriptor",
"cld",
",",
"boolean",
"insert",
",",
"boolean",
"ignoreReferences",
")",
"{",
"// get all members of obj that are references and store them",
"Collection",
"listRds",
"=",
"cld",
".",
"getObjectReferenceDescriptors",
"(",
")",
";",
"// return if nothing to do",
"if",
"(",
"listRds",
"==",
"null",
"||",
"listRds",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"Iterator",
"i",
"=",
"listRds",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"i",
".",
"hasNext",
"(",
")",
")",
"{",
"ObjectReferenceDescriptor",
"rds",
"=",
"(",
"ObjectReferenceDescriptor",
")",
"i",
".",
"next",
"(",
")",
";",
"/*\n arminw: the super-references (used for table per subclass inheritance) must\n be performed in any case. The \"normal\" 1:1 references can be ignored when\n flag \"ignoreReferences\" is set\n */",
"if",
"(",
"(",
"!",
"ignoreReferences",
"&&",
"rds",
".",
"getCascadingStore",
"(",
")",
"!=",
"ObjectReferenceDescriptor",
".",
"CASCADE_NONE",
")",
"||",
"rds",
".",
"isSuperReferenceDescriptor",
"(",
")",
")",
"{",
"storeAndLinkOneToOne",
"(",
"false",
",",
"obj",
",",
"cld",
",",
"rds",
",",
"insert",
")",
";",
"}",
"}",
"}"
] | Store all object references that <b>obj</b> points to.
All objects which we have a FK pointing to (Via ReferenceDescriptors) will be
stored if auto-update is true <b>AND</b> the member field containing the object
reference is NOT null.
With flag <em>ignoreReferences</em> the storing/linking
of references can be suppressed (independent of the used auto-update setting),
except {@link org.apache.ojb.broker.metadata.SuperReferenceDescriptor}
these kind of reference (descriptor) will always be performed.
@param obj Object which we will store references for | [
"Store",
"all",
"object",
"references",
"that",
"<b",
">",
"obj<",
"/",
"b",
">",
"points",
"to",
".",
"All",
"objects",
"which",
"we",
"have",
"a",
"FK",
"pointing",
"to",
"(",
"Via",
"ReferenceDescriptors",
")",
"will",
"be",
"stored",
"if",
"auto",
"-",
"update",
"is",
"true",
"<b",
">",
"AND<",
"/",
"b",
">",
"the",
"member",
"field",
"containing",
"the",
"object",
"reference",
"is",
"NOT",
"null",
".",
"With",
"flag",
"<em",
">",
"ignoreReferences<",
"/",
"em",
">",
"the",
"storing",
"/",
"linking",
"of",
"references",
"can",
"be",
"suppressed",
"(",
"independent",
"of",
"the",
"used",
"auto",
"-",
"update",
"setting",
")",
"except",
"{",
"@link",
"org",
".",
"apache",
".",
"ojb",
".",
"broker",
".",
"metadata",
".",
"SuperReferenceDescriptor",
"}",
"these",
"kind",
"of",
"reference",
"(",
"descriptor",
")",
"will",
"always",
"be",
"performed",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L963-L987 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/ObjectGraphDump.java | ObjectGraphDump.readField | private Object readField(final Field field, final Object obj) {
"""
Reads the contents of a field.
@param field the field definition.
@param obj the object to read the value from.
@return the value of the field in the given object.
"""
try {
return field.get(obj);
} catch (IllegalAccessException e) {
// Should not happen as we've called Field.setAccessible(true).
LOG.error("Failed to read " + field.getName() + " of " + obj.getClass().getName(), e);
}
return null;
} | java | private Object readField(final Field field, final Object obj) {
try {
return field.get(obj);
} catch (IllegalAccessException e) {
// Should not happen as we've called Field.setAccessible(true).
LOG.error("Failed to read " + field.getName() + " of " + obj.getClass().getName(), e);
}
return null;
} | [
"private",
"Object",
"readField",
"(",
"final",
"Field",
"field",
",",
"final",
"Object",
"obj",
")",
"{",
"try",
"{",
"return",
"field",
".",
"get",
"(",
"obj",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"// Should not happen as we've called Field.setAccessible(true).",
"LOG",
".",
"error",
"(",
"\"Failed to read \"",
"+",
"field",
".",
"getName",
"(",
")",
"+",
"\" of \"",
"+",
"obj",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Reads the contents of a field.
@param field the field definition.
@param obj the object to read the value from.
@return the value of the field in the given object. | [
"Reads",
"the",
"contents",
"of",
"a",
"field",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/ObjectGraphDump.java#L189-L198 |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java | OrmLiteDefaultContentProvider.onInsertCompleted | protected void onInsertCompleted(Uri result, Uri uri, MatcherPattern target, InsertParameters parameter) {
"""
This method is called after the onInsert processing has been handled. If you're a need,
you can override this method.
@param result
This is the return value of onInsert method.
@param uri
This is the Uri of target.
@param target
This is identical to the argument of onInsert method.
It is MatcherPattern objects that match to evaluate Uri by UriMatcher. You can
access information in the tables and columns, ContentUri, MimeType etc.
@param parameter
This is identical to the argument of onInsert method.
Arguments passed to the insert() method.
@since 1.0.4
"""
this.getContext().getContentResolver().notifyChange(result, null);
} | java | protected void onInsertCompleted(Uri result, Uri uri, MatcherPattern target, InsertParameters parameter) {
this.getContext().getContentResolver().notifyChange(result, null);
} | [
"protected",
"void",
"onInsertCompleted",
"(",
"Uri",
"result",
",",
"Uri",
"uri",
",",
"MatcherPattern",
"target",
",",
"InsertParameters",
"parameter",
")",
"{",
"this",
".",
"getContext",
"(",
")",
".",
"getContentResolver",
"(",
")",
".",
"notifyChange",
"(",
"result",
",",
"null",
")",
";",
"}"
] | This method is called after the onInsert processing has been handled. If you're a need,
you can override this method.
@param result
This is the return value of onInsert method.
@param uri
This is the Uri of target.
@param target
This is identical to the argument of onInsert method.
It is MatcherPattern objects that match to evaluate Uri by UriMatcher. You can
access information in the tables and columns, ContentUri, MimeType etc.
@param parameter
This is identical to the argument of onInsert method.
Arguments passed to the insert() method.
@since 1.0.4 | [
"This",
"method",
"is",
"called",
"after",
"the",
"onInsert",
"processing",
"has",
"been",
"handled",
".",
"If",
"you",
"re",
"a",
"need",
"you",
"can",
"override",
"this",
"method",
"."
] | train | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L238-L240 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.create | public FSDataOutputStream create(Path f) throws IOException {
"""
Opens an FSDataOutputStream at the indicated Path.
Files are overwritten by default.
"""
return create(f, CreateOptions.writeOptions(true, null));
} | java | public FSDataOutputStream create(Path f) throws IOException {
return create(f, CreateOptions.writeOptions(true, null));
} | [
"public",
"FSDataOutputStream",
"create",
"(",
"Path",
"f",
")",
"throws",
"IOException",
"{",
"return",
"create",
"(",
"f",
",",
"CreateOptions",
".",
"writeOptions",
"(",
"true",
",",
"null",
")",
")",
";",
"}"
] | Opens an FSDataOutputStream at the indicated Path.
Files are overwritten by default. | [
"Opens",
"an",
"FSDataOutputStream",
"at",
"the",
"indicated",
"Path",
".",
"Files",
"are",
"overwritten",
"by",
"default",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L465-L467 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/pubmed/ManualDescriptor.java | ManualDescriptor.setChemicalList | public void setChemicalList(int i, Chemical v) {
"""
indexed setter for chemicalList - sets an indexed value - A collection of objects of type uima.julielab.uima.Chemical, O
@generated
@param i index in the array to set
@param v value to set into the array
"""
if (ManualDescriptor_Type.featOkTst && ((ManualDescriptor_Type)jcasType).casFeat_chemicalList == null)
jcasType.jcas.throwFeatMissing("chemicalList", "de.julielab.jules.types.pubmed.ManualDescriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_chemicalList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_chemicalList), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setChemicalList(int i, Chemical v) {
if (ManualDescriptor_Type.featOkTst && ((ManualDescriptor_Type)jcasType).casFeat_chemicalList == null)
jcasType.jcas.throwFeatMissing("chemicalList", "de.julielab.jules.types.pubmed.ManualDescriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_chemicalList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((ManualDescriptor_Type)jcasType).casFeatCode_chemicalList), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setChemicalList",
"(",
"int",
"i",
",",
"Chemical",
"v",
")",
"{",
"if",
"(",
"ManualDescriptor_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"ManualDescriptor_Type",
")",
"jcasType",
")",
".",
"casFeat_chemicalList",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"chemicalList\"",
",",
"\"de.julielab.jules.types.pubmed.ManualDescriptor\"",
")",
";",
"jcasType",
".",
"jcas",
".",
"checkArrayBounds",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"ManualDescriptor_Type",
")",
"jcasType",
")",
".",
"casFeatCode_chemicalList",
")",
",",
"i",
")",
";",
"jcasType",
".",
"ll_cas",
".",
"ll_setRefArrayValue",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"ManualDescriptor_Type",
")",
"jcasType",
")",
".",
"casFeatCode_chemicalList",
")",
",",
"i",
",",
"jcasType",
".",
"ll_cas",
".",
"ll_getFSRef",
"(",
"v",
")",
")",
";",
"}"
] | indexed setter for chemicalList - sets an indexed value - A collection of objects of type uima.julielab.uima.Chemical, O
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"chemicalList",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"A",
"collection",
"of",
"objects",
"of",
"type",
"uima",
".",
"julielab",
".",
"uima",
".",
"Chemical",
"O"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/pubmed/ManualDescriptor.java#L165-L169 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ClassAvailableTransformer.java | ClassAvailableTransformer.transformCandidate | byte[] transformCandidate(byte[] classfileBuffer) {
"""
Inject the byte code required to call the {@code processCandidate} proxy
after class initialization.
@param classfileBuffer the source class file
@return the modified class file
"""
// reader --> serial version uid adder --> process candidate hook adapter --> tracing --> writer
ClassReader reader = new ClassReader(classfileBuffer);
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS);
ClassVisitor visitor = writer;
StringWriter stringWriter = null;
if (tc.isDumpEnabled()) {
stringWriter = new StringWriter();
visitor = new CheckClassAdapter(visitor);
visitor = new TraceClassVisitor(visitor, new PrintWriter(stringWriter));
}
visitor = new ClassAvailableHookClassAdapter(visitor);
visitor = new SerialVersionUIDAdder(visitor);
// Process the class
reader.accept(visitor, 0);
if (stringWriter != null && tc.isDumpEnabled()) {
Tr.dump(tc, "Transformed class", stringWriter);
}
return writer.toByteArray();
} | java | byte[] transformCandidate(byte[] classfileBuffer) {
// reader --> serial version uid adder --> process candidate hook adapter --> tracing --> writer
ClassReader reader = new ClassReader(classfileBuffer);
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS);
ClassVisitor visitor = writer;
StringWriter stringWriter = null;
if (tc.isDumpEnabled()) {
stringWriter = new StringWriter();
visitor = new CheckClassAdapter(visitor);
visitor = new TraceClassVisitor(visitor, new PrintWriter(stringWriter));
}
visitor = new ClassAvailableHookClassAdapter(visitor);
visitor = new SerialVersionUIDAdder(visitor);
// Process the class
reader.accept(visitor, 0);
if (stringWriter != null && tc.isDumpEnabled()) {
Tr.dump(tc, "Transformed class", stringWriter);
}
return writer.toByteArray();
} | [
"byte",
"[",
"]",
"transformCandidate",
"(",
"byte",
"[",
"]",
"classfileBuffer",
")",
"{",
"// reader --> serial version uid adder --> process candidate hook adapter --> tracing --> writer",
"ClassReader",
"reader",
"=",
"new",
"ClassReader",
"(",
"classfileBuffer",
")",
";",
"ClassWriter",
"writer",
"=",
"new",
"ClassWriter",
"(",
"reader",
",",
"ClassWriter",
".",
"COMPUTE_MAXS",
")",
";",
"ClassVisitor",
"visitor",
"=",
"writer",
";",
"StringWriter",
"stringWriter",
"=",
"null",
";",
"if",
"(",
"tc",
".",
"isDumpEnabled",
"(",
")",
")",
"{",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"visitor",
"=",
"new",
"CheckClassAdapter",
"(",
"visitor",
")",
";",
"visitor",
"=",
"new",
"TraceClassVisitor",
"(",
"visitor",
",",
"new",
"PrintWriter",
"(",
"stringWriter",
")",
")",
";",
"}",
"visitor",
"=",
"new",
"ClassAvailableHookClassAdapter",
"(",
"visitor",
")",
";",
"visitor",
"=",
"new",
"SerialVersionUIDAdder",
"(",
"visitor",
")",
";",
"// Process the class",
"reader",
".",
"accept",
"(",
"visitor",
",",
"0",
")",
";",
"if",
"(",
"stringWriter",
"!=",
"null",
"&&",
"tc",
".",
"isDumpEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"dump",
"(",
"tc",
",",
"\"Transformed class\"",
",",
"stringWriter",
")",
";",
"}",
"return",
"writer",
".",
"toByteArray",
"(",
")",
";",
"}"
] | Inject the byte code required to call the {@code processCandidate} proxy
after class initialization.
@param classfileBuffer the source class file
@return the modified class file | [
"Inject",
"the",
"byte",
"code",
"required",
"to",
"call",
"the",
"{",
"@code",
"processCandidate",
"}",
"proxy",
"after",
"class",
"initialization",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/monitor/internal/bci/ClassAvailableTransformer.java#L106-L129 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/KeyDecoder.java | KeyDecoder.decodeShortDesc | public static short decodeShortDesc(byte[] src, int srcOffset)
throws CorruptEncodingException {
"""
Decodes a signed short from exactly 2 bytes, as encoded for descending
order.
@param src source of encoded bytes
@param srcOffset offset into source array
@return signed short value
"""
try {
return (short)(((src[srcOffset] << 8) | (src[srcOffset + 1] & 0xff)) ^ 0x7fff);
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | java | public static short decodeShortDesc(byte[] src, int srcOffset)
throws CorruptEncodingException
{
try {
return (short)(((src[srcOffset] << 8) | (src[srcOffset + 1] & 0xff)) ^ 0x7fff);
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | [
"public",
"static",
"short",
"decodeShortDesc",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcOffset",
")",
"throws",
"CorruptEncodingException",
"{",
"try",
"{",
"return",
"(",
"short",
")",
"(",
"(",
"(",
"src",
"[",
"srcOffset",
"]",
"<<",
"8",
")",
"|",
"(",
"src",
"[",
"srcOffset",
"+",
"1",
"]",
"&",
"0xff",
")",
")",
"^",
"0x7fff",
")",
";",
"}",
"catch",
"(",
"IndexOutOfBoundsException",
"e",
")",
"{",
"throw",
"new",
"CorruptEncodingException",
"(",
"null",
",",
"e",
")",
";",
"}",
"}"
] | Decodes a signed short from exactly 2 bytes, as encoded for descending
order.
@param src source of encoded bytes
@param srcOffset offset into source array
@return signed short value | [
"Decodes",
"a",
"signed",
"short",
"from",
"exactly",
"2",
"bytes",
"as",
"encoded",
"for",
"descending",
"order",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L156-L164 |
geomajas/geomajas-project-client-gwt | plugin/editing/editing-gwt/src/main/java/org/geomajas/plugin/editing/gwt/client/gfx/GeometryRendererImpl.java | GeometryRendererImpl.getOrCreateGroup | private Composite getOrCreateGroup(Object parent, String name) {
"""
Used in creating the "edges", "selection" and "vertices" groups for LineStrings and LinearRings.
"""
if (groups.containsKey(name)) {
return groups.get(name);
}
Composite group = new Composite(name);
mapWidget.getVectorContext().drawGroup(parent, group);
groups.put(name, group);
return group;
} | java | private Composite getOrCreateGroup(Object parent, String name) {
if (groups.containsKey(name)) {
return groups.get(name);
}
Composite group = new Composite(name);
mapWidget.getVectorContext().drawGroup(parent, group);
groups.put(name, group);
return group;
} | [
"private",
"Composite",
"getOrCreateGroup",
"(",
"Object",
"parent",
",",
"String",
"name",
")",
"{",
"if",
"(",
"groups",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"return",
"groups",
".",
"get",
"(",
"name",
")",
";",
"}",
"Composite",
"group",
"=",
"new",
"Composite",
"(",
"name",
")",
";",
"mapWidget",
".",
"getVectorContext",
"(",
")",
".",
"drawGroup",
"(",
"parent",
",",
"group",
")",
";",
"groups",
".",
"put",
"(",
"name",
",",
"group",
")",
";",
"return",
"group",
";",
"}"
] | Used in creating the "edges", "selection" and "vertices" groups for LineStrings and LinearRings. | [
"Used",
"in",
"creating",
"the",
"edges",
"selection",
"and",
"vertices",
"groups",
"for",
"LineStrings",
"and",
"LinearRings",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-gwt/src/main/java/org/geomajas/plugin/editing/gwt/client/gfx/GeometryRendererImpl.java#L776-L784 |
aehrc/snorocket | snorocket-core/src/main/java/au/csiro/snorocket/core/SnorocketReasoner.java | SnorocketReasoner.getInferredAxioms | public Collection<Axiom> getInferredAxioms() {
"""
Ideally we'd return some kind of normal form axioms here. However, in
the presence of GCIs this is not well defined (as far as I know -
Michael).
<p>
Instead, we will return stated form axioms for Sufficient conditions
(i.e. for INamedConcept on the RHS), and SNOMED CT DNF-based axioms for
Necessary conditions. The former is just a filter over the stated axioms,
the latter requires looking at the Taxonomy and inferred relationships.
<p>
Note that there will be <i>virtual</i> INamedConcepts that need to be
skipped/expanded and redundant IExistentials that need to be filtered.
@return
"""
final Collection<Axiom> inferred = new HashSet<>();
if(!isClassified) classify();
if (!no.isTaxonomyComputed()) {
log.info("Building taxonomy");
no.buildTaxonomy();
}
final Map<String, Node> taxonomy = no.getTaxonomy();
final IConceptMap<Context> contextIndex = no.getContextIndex();
final IntIterator itr = contextIndex.keyIterator();
while (itr.hasNext()) {
final int key = itr.next();
final String id = factory.lookupConceptId(key).toString();
if (factory.isVirtualConcept(key) || NamedConcept.BOTTOM.equals(id)) {
continue;
}
Concept rhs = getNecessary(contextIndex, taxonomy, key);
final Concept lhs = new NamedConcept(id);
if (!lhs.equals(rhs) && !rhs.equals(NamedConcept.TOP_CONCEPT)) { // skip trivial axioms
inferred.add(new ConceptInclusion(lhs, rhs));
}
}
return inferred;
} | java | public Collection<Axiom> getInferredAxioms() {
final Collection<Axiom> inferred = new HashSet<>();
if(!isClassified) classify();
if (!no.isTaxonomyComputed()) {
log.info("Building taxonomy");
no.buildTaxonomy();
}
final Map<String, Node> taxonomy = no.getTaxonomy();
final IConceptMap<Context> contextIndex = no.getContextIndex();
final IntIterator itr = contextIndex.keyIterator();
while (itr.hasNext()) {
final int key = itr.next();
final String id = factory.lookupConceptId(key).toString();
if (factory.isVirtualConcept(key) || NamedConcept.BOTTOM.equals(id)) {
continue;
}
Concept rhs = getNecessary(contextIndex, taxonomy, key);
final Concept lhs = new NamedConcept(id);
if (!lhs.equals(rhs) && !rhs.equals(NamedConcept.TOP_CONCEPT)) { // skip trivial axioms
inferred.add(new ConceptInclusion(lhs, rhs));
}
}
return inferred;
} | [
"public",
"Collection",
"<",
"Axiom",
">",
"getInferredAxioms",
"(",
")",
"{",
"final",
"Collection",
"<",
"Axiom",
">",
"inferred",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"if",
"(",
"!",
"isClassified",
")",
"classify",
"(",
")",
";",
"if",
"(",
"!",
"no",
".",
"isTaxonomyComputed",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Building taxonomy\"",
")",
";",
"no",
".",
"buildTaxonomy",
"(",
")",
";",
"}",
"final",
"Map",
"<",
"String",
",",
"Node",
">",
"taxonomy",
"=",
"no",
".",
"getTaxonomy",
"(",
")",
";",
"final",
"IConceptMap",
"<",
"Context",
">",
"contextIndex",
"=",
"no",
".",
"getContextIndex",
"(",
")",
";",
"final",
"IntIterator",
"itr",
"=",
"contextIndex",
".",
"keyIterator",
"(",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"final",
"int",
"key",
"=",
"itr",
".",
"next",
"(",
")",
";",
"final",
"String",
"id",
"=",
"factory",
".",
"lookupConceptId",
"(",
"key",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"factory",
".",
"isVirtualConcept",
"(",
"key",
")",
"||",
"NamedConcept",
".",
"BOTTOM",
".",
"equals",
"(",
"id",
")",
")",
"{",
"continue",
";",
"}",
"Concept",
"rhs",
"=",
"getNecessary",
"(",
"contextIndex",
",",
"taxonomy",
",",
"key",
")",
";",
"final",
"Concept",
"lhs",
"=",
"new",
"NamedConcept",
"(",
"id",
")",
";",
"if",
"(",
"!",
"lhs",
".",
"equals",
"(",
"rhs",
")",
"&&",
"!",
"rhs",
".",
"equals",
"(",
"NamedConcept",
".",
"TOP_CONCEPT",
")",
")",
"{",
"// skip trivial axioms",
"inferred",
".",
"add",
"(",
"new",
"ConceptInclusion",
"(",
"lhs",
",",
"rhs",
")",
")",
";",
"}",
"}",
"return",
"inferred",
";",
"}"
] | Ideally we'd return some kind of normal form axioms here. However, in
the presence of GCIs this is not well defined (as far as I know -
Michael).
<p>
Instead, we will return stated form axioms for Sufficient conditions
(i.e. for INamedConcept on the RHS), and SNOMED CT DNF-based axioms for
Necessary conditions. The former is just a filter over the stated axioms,
the latter requires looking at the Taxonomy and inferred relationships.
<p>
Note that there will be <i>virtual</i> INamedConcepts that need to be
skipped/expanded and redundant IExistentials that need to be filtered.
@return | [
"Ideally",
"we",
"d",
"return",
"some",
"kind",
"of",
"normal",
"form",
"axioms",
"here",
".",
"However",
"in",
"the",
"presence",
"of",
"GCIs",
"this",
"is",
"not",
"well",
"defined",
"(",
"as",
"far",
"as",
"I",
"know",
"-",
"Michael",
")",
".",
"<p",
">",
"Instead",
"we",
"will",
"return",
"stated",
"form",
"axioms",
"for",
"Sufficient",
"conditions",
"(",
"i",
".",
"e",
".",
"for",
"INamedConcept",
"on",
"the",
"RHS",
")",
"and",
"SNOMED",
"CT",
"DNF",
"-",
"based",
"axioms",
"for",
"Necessary",
"conditions",
".",
"The",
"former",
"is",
"just",
"a",
"filter",
"over",
"the",
"stated",
"axioms",
"the",
"latter",
"requires",
"looking",
"at",
"the",
"Taxonomy",
"and",
"inferred",
"relationships",
".",
"<p",
">",
"Note",
"that",
"there",
"will",
"be",
"<i",
">",
"virtual<",
"/",
"i",
">",
"INamedConcepts",
"that",
"need",
"to",
"be",
"skipped",
"/",
"expanded",
"and",
"redundant",
"IExistentials",
"that",
"need",
"to",
"be",
"filtered",
"."
] | train | https://github.com/aehrc/snorocket/blob/e33c1e216f8a66d6502e3a14e80876811feedd8b/snorocket-core/src/main/java/au/csiro/snorocket/core/SnorocketReasoner.java#L289-L319 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/runtime/cli/PublicMethodsCliObjectFactory.java | PublicMethodsCliObjectFactory.applyCommandLineOptions | public void applyCommandLineOptions(CommandLine cli, T embeddedGobblin) {
"""
For each method for which the helper created an {@link Option} and for which the input {@link CommandLine} contains
that option, this method will automatically call the method on the input object with the correct
arguments.
"""
try {
for (Option option : cli.getOptions()) {
if (!this.methodsMap.containsKey(option.getOpt())) {
// Option added by cli driver itself.
continue;
}
if (option.hasArg()) {
this.methodsMap.get(option.getOpt()).invoke(embeddedGobblin, option.getValue());
} else {
this.methodsMap.get(option.getOpt()).invoke(embeddedGobblin);
}
}
} catch (IllegalAccessException | InvocationTargetException exc) {
throw new RuntimeException("Could not apply options to " + embeddedGobblin.getClass().getName(), exc);
}
} | java | public void applyCommandLineOptions(CommandLine cli, T embeddedGobblin) {
try {
for (Option option : cli.getOptions()) {
if (!this.methodsMap.containsKey(option.getOpt())) {
// Option added by cli driver itself.
continue;
}
if (option.hasArg()) {
this.methodsMap.get(option.getOpt()).invoke(embeddedGobblin, option.getValue());
} else {
this.methodsMap.get(option.getOpt()).invoke(embeddedGobblin);
}
}
} catch (IllegalAccessException | InvocationTargetException exc) {
throw new RuntimeException("Could not apply options to " + embeddedGobblin.getClass().getName(), exc);
}
} | [
"public",
"void",
"applyCommandLineOptions",
"(",
"CommandLine",
"cli",
",",
"T",
"embeddedGobblin",
")",
"{",
"try",
"{",
"for",
"(",
"Option",
"option",
":",
"cli",
".",
"getOptions",
"(",
")",
")",
"{",
"if",
"(",
"!",
"this",
".",
"methodsMap",
".",
"containsKey",
"(",
"option",
".",
"getOpt",
"(",
")",
")",
")",
"{",
"// Option added by cli driver itself.",
"continue",
";",
"}",
"if",
"(",
"option",
".",
"hasArg",
"(",
")",
")",
"{",
"this",
".",
"methodsMap",
".",
"get",
"(",
"option",
".",
"getOpt",
"(",
")",
")",
".",
"invoke",
"(",
"embeddedGobblin",
",",
"option",
".",
"getValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"methodsMap",
".",
"get",
"(",
"option",
".",
"getOpt",
"(",
")",
")",
".",
"invoke",
"(",
"embeddedGobblin",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"InvocationTargetException",
"exc",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Could not apply options to \"",
"+",
"embeddedGobblin",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"exc",
")",
";",
"}",
"}"
] | For each method for which the helper created an {@link Option} and for which the input {@link CommandLine} contains
that option, this method will automatically call the method on the input object with the correct
arguments. | [
"For",
"each",
"method",
"for",
"which",
"the",
"helper",
"created",
"an",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/runtime/cli/PublicMethodsCliObjectFactory.java#L140-L156 |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.compare | @Override
public int compare(JTAResource o1, JTAResource o2) {
"""
Comparator returning 0 should leave elements in list alone, preserving original order.
"""
if (tc.isEntryEnabled())
Tr.entry(tc, "compare", new Object[] { o1, o2, this });
int result = 0;
int p1 = o1.getPriority();
int p2 = o2.getPriority();
if (p1 < p2)
result = 1;
else if (p1 > p2)
result = -1;
if (tc.isEntryEnabled())
Tr.exit(tc, "compare", result);
return result;
} | java | @Override
public int compare(JTAResource o1, JTAResource o2) {
if (tc.isEntryEnabled())
Tr.entry(tc, "compare", new Object[] { o1, o2, this });
int result = 0;
int p1 = o1.getPriority();
int p2 = o2.getPriority();
if (p1 < p2)
result = 1;
else if (p1 > p2)
result = -1;
if (tc.isEntryEnabled())
Tr.exit(tc, "compare", result);
return result;
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"JTAResource",
"o1",
",",
"JTAResource",
"o2",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"compare\"",
",",
"new",
"Object",
"[",
"]",
"{",
"o1",
",",
"o2",
",",
"this",
"}",
")",
";",
"int",
"result",
"=",
"0",
";",
"int",
"p1",
"=",
"o1",
".",
"getPriority",
"(",
")",
";",
"int",
"p2",
"=",
"o2",
".",
"getPriority",
"(",
")",
";",
"if",
"(",
"p1",
"<",
"p2",
")",
"result",
"=",
"1",
";",
"else",
"if",
"(",
"p1",
">",
"p2",
")",
"result",
"=",
"-",
"1",
";",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"compare\"",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Comparator returning 0 should leave elements in list alone, preserving original order. | [
"Comparator",
"returning",
"0",
"should",
"leave",
"elements",
"in",
"list",
"alone",
"preserving",
"original",
"order",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L2631-L2645 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeCheck.java | TypeCheck.visitAssign | private void visitAssign(NodeTraversal t, Node assign) {
"""
Visits an assignment <code>lvalue = rvalue</code>. If the
<code>lvalue</code> is a prototype modification, we change the schema
of the object type it is referring to.
@param t the traversal
@param assign the assign node
(<code>assign.isAssign()</code> is an implicit invariant)
"""
JSDocInfo info = assign.getJSDocInfo();
Node lvalue = assign.getFirstChild();
Node rvalue = assign.getLastChild();
JSType rightType = getJSType(rvalue);
checkCanAssignToWithScope(t, assign, lvalue, rightType, info, "assignment");
ensureTyped(assign, rightType);
} | java | private void visitAssign(NodeTraversal t, Node assign) {
JSDocInfo info = assign.getJSDocInfo();
Node lvalue = assign.getFirstChild();
Node rvalue = assign.getLastChild();
JSType rightType = getJSType(rvalue);
checkCanAssignToWithScope(t, assign, lvalue, rightType, info, "assignment");
ensureTyped(assign, rightType);
} | [
"private",
"void",
"visitAssign",
"(",
"NodeTraversal",
"t",
",",
"Node",
"assign",
")",
"{",
"JSDocInfo",
"info",
"=",
"assign",
".",
"getJSDocInfo",
"(",
")",
";",
"Node",
"lvalue",
"=",
"assign",
".",
"getFirstChild",
"(",
")",
";",
"Node",
"rvalue",
"=",
"assign",
".",
"getLastChild",
"(",
")",
";",
"JSType",
"rightType",
"=",
"getJSType",
"(",
"rvalue",
")",
";",
"checkCanAssignToWithScope",
"(",
"t",
",",
"assign",
",",
"lvalue",
",",
"rightType",
",",
"info",
",",
"\"assignment\"",
")",
";",
"ensureTyped",
"(",
"assign",
",",
"rightType",
")",
";",
"}"
] | Visits an assignment <code>lvalue = rvalue</code>. If the
<code>lvalue</code> is a prototype modification, we change the schema
of the object type it is referring to.
@param t the traversal
@param assign the assign node
(<code>assign.isAssign()</code> is an implicit invariant) | [
"Visits",
"an",
"assignment",
"<code",
">",
"lvalue",
"=",
"rvalue<",
"/",
"code",
">",
".",
"If",
"the",
"<code",
">",
"lvalue<",
"/",
"code",
">",
"is",
"a",
"prototype",
"modification",
"we",
"change",
"the",
"schema",
"of",
"the",
"object",
"type",
"it",
"is",
"referring",
"to",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeCheck.java#L1095-L1103 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.expectStrictNew | public static synchronized <T> IExpectationSetters<T> expectStrictNew(Class<T> type, Object... arguments)
throws Exception {
"""
Allows specifying expectations on new invocations. For example you might
want to throw an exception or return a mock.
<p/>
This method checks the order of constructor invocations.
<p/>
Note that you must replay the class when using this method since this
behavior is part of the class mock.
"""
return doExpectNew(type, new StrictMockStrategy(), null, arguments);
} | java | public static synchronized <T> IExpectationSetters<T> expectStrictNew(Class<T> type, Object... arguments)
throws Exception {
return doExpectNew(type, new StrictMockStrategy(), null, arguments);
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"IExpectationSetters",
"<",
"T",
">",
"expectStrictNew",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Object",
"...",
"arguments",
")",
"throws",
"Exception",
"{",
"return",
"doExpectNew",
"(",
"type",
",",
"new",
"StrictMockStrategy",
"(",
")",
",",
"null",
",",
"arguments",
")",
";",
"}"
] | Allows specifying expectations on new invocations. For example you might
want to throw an exception or return a mock.
<p/>
This method checks the order of constructor invocations.
<p/>
Note that you must replay the class when using this method since this
behavior is part of the class mock. | [
"Allows",
"specifying",
"expectations",
"on",
"new",
"invocations",
".",
"For",
"example",
"you",
"might",
"want",
"to",
"throw",
"an",
"exception",
"or",
"return",
"a",
"mock",
".",
"<p",
"/",
">",
"This",
"method",
"checks",
"the",
"order",
"of",
"constructor",
"invocations",
".",
"<p",
"/",
">",
"Note",
"that",
"you",
"must",
"replay",
"the",
"class",
"when",
"using",
"this",
"method",
"since",
"this",
"behavior",
"is",
"part",
"of",
"the",
"class",
"mock",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L1697-L1700 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2018_03_31_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_03_31_preview/implementation/TasksInner.java | TasksInner.createOrUpdateAsync | public Observable<ProjectTaskInner> createOrUpdateAsync(String groupName, String serviceName, String projectName, String taskName, ProjectTaskInner parameters) {
"""
Create or update task.
The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one.
@param groupName Name of the resource group
@param serviceName Name of the service
@param projectName Name of the project
@param taskName Name of the Task
@param parameters Information about the task
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ProjectTaskInner object
"""
return createOrUpdateWithServiceResponseAsync(groupName, serviceName, projectName, taskName, parameters).map(new Func1<ServiceResponse<ProjectTaskInner>, ProjectTaskInner>() {
@Override
public ProjectTaskInner call(ServiceResponse<ProjectTaskInner> response) {
return response.body();
}
});
} | java | public Observable<ProjectTaskInner> createOrUpdateAsync(String groupName, String serviceName, String projectName, String taskName, ProjectTaskInner parameters) {
return createOrUpdateWithServiceResponseAsync(groupName, serviceName, projectName, taskName, parameters).map(new Func1<ServiceResponse<ProjectTaskInner>, ProjectTaskInner>() {
@Override
public ProjectTaskInner call(ServiceResponse<ProjectTaskInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ProjectTaskInner",
">",
"createOrUpdateAsync",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
",",
"String",
"projectName",
",",
"String",
"taskName",
",",
"ProjectTaskInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
",",
"projectName",
",",
"taskName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ProjectTaskInner",
">",
",",
"ProjectTaskInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ProjectTaskInner",
"call",
"(",
"ServiceResponse",
"<",
"ProjectTaskInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Create or update task.
The tasks resource is a nested, proxy-only resource representing work performed by a DMS instance. The PUT method creates a new task or updates an existing one, although since tasks have no mutable custom properties, there is little reason to update an existing one.
@param groupName Name of the resource group
@param serviceName Name of the service
@param projectName Name of the project
@param taskName Name of the Task
@param parameters Information about the task
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ProjectTaskInner object | [
"Create",
"or",
"update",
"task",
".",
"The",
"tasks",
"resource",
"is",
"a",
"nested",
"proxy",
"-",
"only",
"resource",
"representing",
"work",
"performed",
"by",
"a",
"DMS",
"instance",
".",
"The",
"PUT",
"method",
"creates",
"a",
"new",
"task",
"or",
"updates",
"an",
"existing",
"one",
"although",
"since",
"tasks",
"have",
"no",
"mutable",
"custom",
"properties",
"there",
"is",
"little",
"reason",
"to",
"update",
"an",
"existing",
"one",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2018_03_31_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_03_31_preview/implementation/TasksInner.java#L414-L421 |
h2oai/h2o-3 | h2o-core/src/main/java/water/ExternalFrameWriterClient.java | ExternalFrameWriterClient.createChunks | public void createChunks(String frameKey, byte[] expectedTypes, int chunkId, int totalNumRows, int[] maxVecSizes) throws IOException {
"""
Create chunks on the h2o backend. This method creates chunk in en empty frame.
@param frameKey name of the frame
@param expectedTypes expected types
@param chunkId chunk index
@param totalNumRows total number of rows which is about to be sent
"""
ab.put1(ExternalFrameHandler.INIT_BYTE);
ab.put1(ExternalFrameHandler.CREATE_FRAME);
ab.putStr(frameKey);
this.expectedTypes = expectedTypes;
ab.putA1(expectedTypes);
ab.putA4(maxVecSizes);
ab.putInt(totalNumRows);
ab.putInt(chunkId);
writeToChannel(ab, channel);
} | java | public void createChunks(String frameKey, byte[] expectedTypes, int chunkId, int totalNumRows, int[] maxVecSizes) throws IOException {
ab.put1(ExternalFrameHandler.INIT_BYTE);
ab.put1(ExternalFrameHandler.CREATE_FRAME);
ab.putStr(frameKey);
this.expectedTypes = expectedTypes;
ab.putA1(expectedTypes);
ab.putA4(maxVecSizes);
ab.putInt(totalNumRows);
ab.putInt(chunkId);
writeToChannel(ab, channel);
} | [
"public",
"void",
"createChunks",
"(",
"String",
"frameKey",
",",
"byte",
"[",
"]",
"expectedTypes",
",",
"int",
"chunkId",
",",
"int",
"totalNumRows",
",",
"int",
"[",
"]",
"maxVecSizes",
")",
"throws",
"IOException",
"{",
"ab",
".",
"put1",
"(",
"ExternalFrameHandler",
".",
"INIT_BYTE",
")",
";",
"ab",
".",
"put1",
"(",
"ExternalFrameHandler",
".",
"CREATE_FRAME",
")",
";",
"ab",
".",
"putStr",
"(",
"frameKey",
")",
";",
"this",
".",
"expectedTypes",
"=",
"expectedTypes",
";",
"ab",
".",
"putA1",
"(",
"expectedTypes",
")",
";",
"ab",
".",
"putA4",
"(",
"maxVecSizes",
")",
";",
"ab",
".",
"putInt",
"(",
"totalNumRows",
")",
";",
"ab",
".",
"putInt",
"(",
"chunkId",
")",
";",
"writeToChannel",
"(",
"ab",
",",
"channel",
")",
";",
"}"
] | Create chunks on the h2o backend. This method creates chunk in en empty frame.
@param frameKey name of the frame
@param expectedTypes expected types
@param chunkId chunk index
@param totalNumRows total number of rows which is about to be sent | [
"Create",
"chunks",
"on",
"the",
"h2o",
"backend",
".",
"This",
"method",
"creates",
"chunk",
"in",
"en",
"empty",
"frame",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/ExternalFrameWriterClient.java#L76-L86 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/lib/ClosableCharArrayWriter.java | ClosableCharArrayWriter.toCharArrayReader | public synchronized CharArrayReader toCharArrayReader()
throws IOException {
"""
Performs an effecient (zero-copy) conversion of the character data
accumulated in this writer to a reader. <p>
To ensure the integrity of the resulting reader, {@link #free()
free} is invoked upon this writer as a side-effect.
@return a reader representing this writer's accumulated
character data
@throws java.io.IOException if an I/O error occurs.
In particular, an <tt>IOException</tt> may be thrown
if this writer has been {@link #free() freed}.
"""
checkFreed();
CharArrayReader reader = new CharArrayReader(buf, 0, count);
//System.out.println("toCharArrayReader::buf.length: " + buf.length);
free();
return reader;
} | java | public synchronized CharArrayReader toCharArrayReader()
throws IOException {
checkFreed();
CharArrayReader reader = new CharArrayReader(buf, 0, count);
//System.out.println("toCharArrayReader::buf.length: " + buf.length);
free();
return reader;
} | [
"public",
"synchronized",
"CharArrayReader",
"toCharArrayReader",
"(",
")",
"throws",
"IOException",
"{",
"checkFreed",
"(",
")",
";",
"CharArrayReader",
"reader",
"=",
"new",
"CharArrayReader",
"(",
"buf",
",",
"0",
",",
"count",
")",
";",
"//System.out.println(\"toCharArrayReader::buf.length: \" + buf.length);",
"free",
"(",
")",
";",
"return",
"reader",
";",
"}"
] | Performs an effecient (zero-copy) conversion of the character data
accumulated in this writer to a reader. <p>
To ensure the integrity of the resulting reader, {@link #free()
free} is invoked upon this writer as a side-effect.
@return a reader representing this writer's accumulated
character data
@throws java.io.IOException if an I/O error occurs.
In particular, an <tt>IOException</tt> may be thrown
if this writer has been {@link #free() freed}. | [
"Performs",
"an",
"effecient",
"(",
"zero",
"-",
"copy",
")",
"conversion",
"of",
"the",
"character",
"data",
"accumulated",
"in",
"this",
"writer",
"to",
"a",
"reader",
".",
"<p",
">"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/ClosableCharArrayWriter.java#L354-L365 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/indexing/BranchUniversalObject.java | BranchUniversalObject.userCompletedAction | @SuppressWarnings("deprecation")
public void userCompletedAction(BRANCH_STANDARD_EVENT action, HashMap<String, String> metadata) {
"""
<p>
Method to report user actions happened on this BUO. Use this method to report the user actions for analytics purpose.
</p>
@param action A {@link BRANCH_STANDARD_EVENT }with value of user action name. See {@link BRANCH_STANDARD_EVENT} for Branch defined user events.
@param metadata A HashMap containing any additional metadata need to add to this user event
"""
userCompletedAction(action.getName(), metadata);
} | java | @SuppressWarnings("deprecation")
public void userCompletedAction(BRANCH_STANDARD_EVENT action, HashMap<String, String> metadata) {
userCompletedAction(action.getName(), metadata);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"void",
"userCompletedAction",
"(",
"BRANCH_STANDARD_EVENT",
"action",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"metadata",
")",
"{",
"userCompletedAction",
"(",
"action",
".",
"getName",
"(",
")",
",",
"metadata",
")",
";",
"}"
] | <p>
Method to report user actions happened on this BUO. Use this method to report the user actions for analytics purpose.
</p>
@param action A {@link BRANCH_STANDARD_EVENT }with value of user action name. See {@link BRANCH_STANDARD_EVENT} for Branch defined user events.
@param metadata A HashMap containing any additional metadata need to add to this user event | [
"<p",
">",
"Method",
"to",
"report",
"user",
"actions",
"happened",
"on",
"this",
"BUO",
".",
"Use",
"this",
"method",
"to",
"report",
"the",
"user",
"actions",
"for",
"analytics",
"purpose",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/indexing/BranchUniversalObject.java#L383-L386 |
alexvasilkov/GestureViews | library/src/main/java/com/alexvasilkov/gestures/animation/ViewPosition.java | ViewPosition.apply | public static boolean apply(@NonNull ViewPosition pos, @NonNull View view) {
"""
Computes view position and stores it in given {@code pos}. Note, that view should be already
attached and laid out before calling this method.
@param pos Output position
@param view View for which we want to get on-screen location
@return true if view position is changed, false otherwise
"""
return pos.init(view);
} | java | public static boolean apply(@NonNull ViewPosition pos, @NonNull View view) {
return pos.init(view);
} | [
"public",
"static",
"boolean",
"apply",
"(",
"@",
"NonNull",
"ViewPosition",
"pos",
",",
"@",
"NonNull",
"View",
"view",
")",
"{",
"return",
"pos",
".",
"init",
"(",
"view",
")",
";",
"}"
] | Computes view position and stores it in given {@code pos}. Note, that view should be already
attached and laid out before calling this method.
@param pos Output position
@param view View for which we want to get on-screen location
@return true if view position is changed, false otherwise | [
"Computes",
"view",
"position",
"and",
"stores",
"it",
"in",
"given",
"{",
"@code",
"pos",
"}",
".",
"Note",
"that",
"view",
"should",
"be",
"already",
"attached",
"and",
"laid",
"out",
"before",
"calling",
"this",
"method",
"."
] | train | https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/animation/ViewPosition.java#L158-L160 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java | DirectoryConnection.setDirectoryUser | public void setDirectoryUser(String userName, String password) {
"""
Change the Directory Authentication.
It will reopen session use the new authentication.
If failed, need to close the session.
@param userName
@param password
"""
this.authData = generateDirectoryAuthData(userName, password);
if(getStatus().isConnected()){
ErrorCode ec = sendConnectProtocol(this.getConnectTimeOut());
if(ErrorCode.SESSION_EXPIRED.equals(ec)){
LOGGER.info("Session Expired, cleanup the client session.");
closeSession();
} else if(! ErrorCode.OK.equals(ec)){
reopenSession();
}
}
} | java | public void setDirectoryUser(String userName, String password){
this.authData = generateDirectoryAuthData(userName, password);
if(getStatus().isConnected()){
ErrorCode ec = sendConnectProtocol(this.getConnectTimeOut());
if(ErrorCode.SESSION_EXPIRED.equals(ec)){
LOGGER.info("Session Expired, cleanup the client session.");
closeSession();
} else if(! ErrorCode.OK.equals(ec)){
reopenSession();
}
}
} | [
"public",
"void",
"setDirectoryUser",
"(",
"String",
"userName",
",",
"String",
"password",
")",
"{",
"this",
".",
"authData",
"=",
"generateDirectoryAuthData",
"(",
"userName",
",",
"password",
")",
";",
"if",
"(",
"getStatus",
"(",
")",
".",
"isConnected",
"(",
")",
")",
"{",
"ErrorCode",
"ec",
"=",
"sendConnectProtocol",
"(",
"this",
".",
"getConnectTimeOut",
"(",
")",
")",
";",
"if",
"(",
"ErrorCode",
".",
"SESSION_EXPIRED",
".",
"equals",
"(",
"ec",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Session Expired, cleanup the client session.\"",
")",
";",
"closeSession",
"(",
")",
";",
"}",
"else",
"if",
"(",
"!",
"ErrorCode",
".",
"OK",
".",
"equals",
"(",
"ec",
")",
")",
"{",
"reopenSession",
"(",
")",
";",
"}",
"}",
"}"
] | Change the Directory Authentication.
It will reopen session use the new authentication.
If failed, need to close the session.
@param userName
@param password | [
"Change",
"the",
"Directory",
"Authentication",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java#L598-L609 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/MustBeClosedChecker.java | MustBeClosedChecker.matchMethod | @Override
public Description matchMethod(MethodTree tree, VisitorState state) {
"""
Check that the {@link MustBeClosed} annotation is only used for constructors of AutoCloseables
and methods that return an AutoCloseable.
"""
if (!HAS_MUST_BE_CLOSED_ANNOTATION.matches(tree, state)) {
// Ignore methods and constructors that are not annotated with {@link MustBeClosed}.
return NO_MATCH;
}
boolean isAConstructor = methodIsConstructor().matches(tree, state);
if (isAConstructor && !AUTO_CLOSEABLE_CONSTRUCTOR_MATCHER.matches(tree, state)) {
return buildDescription(tree)
.setMessage("MustBeClosed should only annotate constructors of AutoCloseables.")
.build();
}
if (!isAConstructor && !METHOD_RETURNS_AUTO_CLOSEABLE_MATCHER.matches(tree, state)) {
return buildDescription(tree)
.setMessage("MustBeClosed should only annotate methods that return an AutoCloseable.")
.build();
}
return NO_MATCH;
} | java | @Override
public Description matchMethod(MethodTree tree, VisitorState state) {
if (!HAS_MUST_BE_CLOSED_ANNOTATION.matches(tree, state)) {
// Ignore methods and constructors that are not annotated with {@link MustBeClosed}.
return NO_MATCH;
}
boolean isAConstructor = methodIsConstructor().matches(tree, state);
if (isAConstructor && !AUTO_CLOSEABLE_CONSTRUCTOR_MATCHER.matches(tree, state)) {
return buildDescription(tree)
.setMessage("MustBeClosed should only annotate constructors of AutoCloseables.")
.build();
}
if (!isAConstructor && !METHOD_RETURNS_AUTO_CLOSEABLE_MATCHER.matches(tree, state)) {
return buildDescription(tree)
.setMessage("MustBeClosed should only annotate methods that return an AutoCloseable.")
.build();
}
return NO_MATCH;
} | [
"@",
"Override",
"public",
"Description",
"matchMethod",
"(",
"MethodTree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"if",
"(",
"!",
"HAS_MUST_BE_CLOSED_ANNOTATION",
".",
"matches",
"(",
"tree",
",",
"state",
")",
")",
"{",
"// Ignore methods and constructors that are not annotated with {@link MustBeClosed}.",
"return",
"NO_MATCH",
";",
"}",
"boolean",
"isAConstructor",
"=",
"methodIsConstructor",
"(",
")",
".",
"matches",
"(",
"tree",
",",
"state",
")",
";",
"if",
"(",
"isAConstructor",
"&&",
"!",
"AUTO_CLOSEABLE_CONSTRUCTOR_MATCHER",
".",
"matches",
"(",
"tree",
",",
"state",
")",
")",
"{",
"return",
"buildDescription",
"(",
"tree",
")",
".",
"setMessage",
"(",
"\"MustBeClosed should only annotate constructors of AutoCloseables.\"",
")",
".",
"build",
"(",
")",
";",
"}",
"if",
"(",
"!",
"isAConstructor",
"&&",
"!",
"METHOD_RETURNS_AUTO_CLOSEABLE_MATCHER",
".",
"matches",
"(",
"tree",
",",
"state",
")",
")",
"{",
"return",
"buildDescription",
"(",
"tree",
")",
".",
"setMessage",
"(",
"\"MustBeClosed should only annotate methods that return an AutoCloseable.\"",
")",
".",
"build",
"(",
")",
";",
"}",
"return",
"NO_MATCH",
";",
"}"
] | Check that the {@link MustBeClosed} annotation is only used for constructors of AutoCloseables
and methods that return an AutoCloseable. | [
"Check",
"that",
"the",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/MustBeClosedChecker.java#L82-L102 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java | UCharacterName.getGroupName | public synchronized String getGroupName(int ch, int choice) {
"""
Gets the group name of the character
@param ch character to get the group name
@param choice name choice selector to choose a unicode 1.0 or newer name
"""
// gets the msb
int msb = getCodepointMSB(ch);
int group = getGroup(ch);
// return this if it is an exact match
if (msb == m_groupinfo_[group * m_groupsize_]) {
int index = getGroupLengths(group, m_groupoffsets_,
m_grouplengths_);
int offset = ch & GROUP_MASK_;
return getGroupName(index + m_groupoffsets_[offset],
m_grouplengths_[offset], choice);
}
return null;
} | java | public synchronized String getGroupName(int ch, int choice)
{
// gets the msb
int msb = getCodepointMSB(ch);
int group = getGroup(ch);
// return this if it is an exact match
if (msb == m_groupinfo_[group * m_groupsize_]) {
int index = getGroupLengths(group, m_groupoffsets_,
m_grouplengths_);
int offset = ch & GROUP_MASK_;
return getGroupName(index + m_groupoffsets_[offset],
m_grouplengths_[offset], choice);
}
return null;
} | [
"public",
"synchronized",
"String",
"getGroupName",
"(",
"int",
"ch",
",",
"int",
"choice",
")",
"{",
"// gets the msb",
"int",
"msb",
"=",
"getCodepointMSB",
"(",
"ch",
")",
";",
"int",
"group",
"=",
"getGroup",
"(",
"ch",
")",
";",
"// return this if it is an exact match",
"if",
"(",
"msb",
"==",
"m_groupinfo_",
"[",
"group",
"*",
"m_groupsize_",
"]",
")",
"{",
"int",
"index",
"=",
"getGroupLengths",
"(",
"group",
",",
"m_groupoffsets_",
",",
"m_grouplengths_",
")",
";",
"int",
"offset",
"=",
"ch",
"&",
"GROUP_MASK_",
";",
"return",
"getGroupName",
"(",
"index",
"+",
"m_groupoffsets_",
"[",
"offset",
"]",
",",
"m_grouplengths_",
"[",
"offset",
"]",
",",
"choice",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Gets the group name of the character
@param ch character to get the group name
@param choice name choice selector to choose a unicode 1.0 or newer name | [
"Gets",
"the",
"group",
"name",
"of",
"the",
"character"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java#L507-L523 |
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.getEntityRolesAsync | public Observable<List<EntityRole>> getEntityRolesAsync(UUID appId, String versionId, UUID entityId) {
"""
Get All Entity Roles for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId entity Id
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<EntityRole> object
"""
return getEntityRolesWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() {
@Override
public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) {
return response.body();
}
});
} | java | public Observable<List<EntityRole>> getEntityRolesAsync(UUID appId, String versionId, UUID entityId) {
return getEntityRolesWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() {
@Override
public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"EntityRole",
">",
">",
"getEntityRolesAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
")",
"{",
"return",
"getEntityRolesWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"List",
"<",
"EntityRole",
">",
">",
",",
"List",
"<",
"EntityRole",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"EntityRole",
">",
"call",
"(",
"ServiceResponse",
"<",
"List",
"<",
"EntityRole",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Get All Entity Roles for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId entity Id
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<EntityRole> object | [
"Get",
"All",
"Entity",
"Roles",
"for",
"a",
"given",
"entity",
"."
] | 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#L7686-L7693 |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/dynamic/JarXtractor.java | JarXtractor.extract | public static boolean extract(File jarFile, File newJar, String[] includePrefixes, String[] excludePrefixes) throws IOException {
"""
Creates a jar file that contains only classes with specified prefix. Note
that new jar is created in the same directory as the original jar
(hopefully the user has write permission).
Returns true if classes with the given prefix are detected.
@throws IOException
if a file is not found or there is some error during
read/write operations
"""
boolean isSomethingExtracted = false;
if (!jarFile.exists()) {
Log.w("Jar file does not exists at: " + jarFile.getAbsolutePath());
return isSomethingExtracted;
}
ZipInputStream zis = new ZipInputStream(new FileInputStream(jarFile));
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(newJar));
for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()) {
String name = entry.getName().replaceAll("/", ".").replace(".class", "");
boolean isStartsWith = startsWith(name, includePrefixes) && !startsWith(name, excludePrefixes);
isSomethingExtracted = isSomethingExtracted || isStartsWith;
if (isStartsWith || name.startsWith("META-INF")) {
zos.putNextEntry(new ZipEntry(entry.getName()));
int data;
while ((data = zis.read()) != -1) {
zos.write(data);
}
zos.closeEntry();
}
}
zis.close();
try {
zos.close();
} catch (ZipException e) {
System.out.println("No classes in the original jar matched the prefix");
}
return isSomethingExtracted;
} | java | public static boolean extract(File jarFile, File newJar, String[] includePrefixes, String[] excludePrefixes) throws IOException {
boolean isSomethingExtracted = false;
if (!jarFile.exists()) {
Log.w("Jar file does not exists at: " + jarFile.getAbsolutePath());
return isSomethingExtracted;
}
ZipInputStream zis = new ZipInputStream(new FileInputStream(jarFile));
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(newJar));
for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()) {
String name = entry.getName().replaceAll("/", ".").replace(".class", "");
boolean isStartsWith = startsWith(name, includePrefixes) && !startsWith(name, excludePrefixes);
isSomethingExtracted = isSomethingExtracted || isStartsWith;
if (isStartsWith || name.startsWith("META-INF")) {
zos.putNextEntry(new ZipEntry(entry.getName()));
int data;
while ((data = zis.read()) != -1) {
zos.write(data);
}
zos.closeEntry();
}
}
zis.close();
try {
zos.close();
} catch (ZipException e) {
System.out.println("No classes in the original jar matched the prefix");
}
return isSomethingExtracted;
} | [
"public",
"static",
"boolean",
"extract",
"(",
"File",
"jarFile",
",",
"File",
"newJar",
",",
"String",
"[",
"]",
"includePrefixes",
",",
"String",
"[",
"]",
"excludePrefixes",
")",
"throws",
"IOException",
"{",
"boolean",
"isSomethingExtracted",
"=",
"false",
";",
"if",
"(",
"!",
"jarFile",
".",
"exists",
"(",
")",
")",
"{",
"Log",
".",
"w",
"(",
"\"Jar file does not exists at: \"",
"+",
"jarFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"return",
"isSomethingExtracted",
";",
"}",
"ZipInputStream",
"zis",
"=",
"new",
"ZipInputStream",
"(",
"new",
"FileInputStream",
"(",
"jarFile",
")",
")",
";",
"ZipOutputStream",
"zos",
"=",
"new",
"ZipOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"newJar",
")",
")",
";",
"for",
"(",
"ZipEntry",
"entry",
"=",
"zis",
".",
"getNextEntry",
"(",
")",
";",
"entry",
"!=",
"null",
";",
"entry",
"=",
"zis",
".",
"getNextEntry",
"(",
")",
")",
"{",
"String",
"name",
"=",
"entry",
".",
"getName",
"(",
")",
".",
"replaceAll",
"(",
"\"/\"",
",",
"\".\"",
")",
".",
"replace",
"(",
"\".class\"",
",",
"\"\"",
")",
";",
"boolean",
"isStartsWith",
"=",
"startsWith",
"(",
"name",
",",
"includePrefixes",
")",
"&&",
"!",
"startsWith",
"(",
"name",
",",
"excludePrefixes",
")",
";",
"isSomethingExtracted",
"=",
"isSomethingExtracted",
"||",
"isStartsWith",
";",
"if",
"(",
"isStartsWith",
"||",
"name",
".",
"startsWith",
"(",
"\"META-INF\"",
")",
")",
"{",
"zos",
".",
"putNextEntry",
"(",
"new",
"ZipEntry",
"(",
"entry",
".",
"getName",
"(",
")",
")",
")",
";",
"int",
"data",
";",
"while",
"(",
"(",
"data",
"=",
"zis",
".",
"read",
"(",
")",
")",
"!=",
"-",
"1",
")",
"{",
"zos",
".",
"write",
"(",
"data",
")",
";",
"}",
"zos",
".",
"closeEntry",
"(",
")",
";",
"}",
"}",
"zis",
".",
"close",
"(",
")",
";",
"try",
"{",
"zos",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"ZipException",
"e",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"No classes in the original jar matched the prefix\"",
")",
";",
"}",
"return",
"isSomethingExtracted",
";",
"}"
] | Creates a jar file that contains only classes with specified prefix. Note
that new jar is created in the same directory as the original jar
(hopefully the user has write permission).
Returns true if classes with the given prefix are detected.
@throws IOException
if a file is not found or there is some error during
read/write operations | [
"Creates",
"a",
"jar",
"file",
"that",
"contains",
"only",
"classes",
"with",
"specified",
"prefix",
".",
"Note",
"that",
"new",
"jar",
"is",
"created",
"in",
"the",
"same",
"directory",
"as",
"the",
"original",
"jar",
"(",
"hopefully",
"the",
"user",
"has",
"write",
"permission",
")",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/dynamic/JarXtractor.java#L55-L84 |
alkacon/opencms-core | src/org/opencms/ui/login/CmsInactiveUserMessages.java | CmsInactiveUserMessages.getMessage | public static String getMessage(String key, Locale locale) {
"""
Gets the message for the given key and locale.<p>
@param key the key
@param locale the locale
@return the localized text
"""
ResourceBundle bundle = null;
try {
bundle = CmsResourceBundleLoader.getBundle("org.opencms.inactiveusers.custom", locale);
return bundle.getString(key);
} catch (MissingResourceException e) {
LOG.info("Customization bundle not found: org.opencms.inactiveusers.custom", e);
bundle = CmsResourceBundleLoader.getBundle("org.opencms.ui.messages", locale);
return bundle.getString(key);
}
} | java | public static String getMessage(String key, Locale locale) {
ResourceBundle bundle = null;
try {
bundle = CmsResourceBundleLoader.getBundle("org.opencms.inactiveusers.custom", locale);
return bundle.getString(key);
} catch (MissingResourceException e) {
LOG.info("Customization bundle not found: org.opencms.inactiveusers.custom", e);
bundle = CmsResourceBundleLoader.getBundle("org.opencms.ui.messages", locale);
return bundle.getString(key);
}
} | [
"public",
"static",
"String",
"getMessage",
"(",
"String",
"key",
",",
"Locale",
"locale",
")",
"{",
"ResourceBundle",
"bundle",
"=",
"null",
";",
"try",
"{",
"bundle",
"=",
"CmsResourceBundleLoader",
".",
"getBundle",
"(",
"\"org.opencms.inactiveusers.custom\"",
",",
"locale",
")",
";",
"return",
"bundle",
".",
"getString",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"MissingResourceException",
"e",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Customization bundle not found: org.opencms.inactiveusers.custom\"",
",",
"e",
")",
";",
"bundle",
"=",
"CmsResourceBundleLoader",
".",
"getBundle",
"(",
"\"org.opencms.ui.messages\"",
",",
"locale",
")",
";",
"return",
"bundle",
".",
"getString",
"(",
"key",
")",
";",
"}",
"}"
] | Gets the message for the given key and locale.<p>
@param key the key
@param locale the locale
@return the localized text | [
"Gets",
"the",
"message",
"for",
"the",
"given",
"key",
"and",
"locale",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsInactiveUserMessages.java#L69-L80 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java | ExpressRouteConnectionsInner.beginCreateOrUpdate | public ExpressRouteConnectionInner beginCreateOrUpdate(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
"""
Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRouteConnectionInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).toBlocking().single().body();
} | java | public ExpressRouteConnectionInner beginCreateOrUpdate(String resourceGroupName, String expressRouteGatewayName, String connectionName, ExpressRouteConnectionInner putExpressRouteConnectionParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters).toBlocking().single().body();
} | [
"public",
"ExpressRouteConnectionInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRouteGatewayName",
",",
"String",
"connectionName",
",",
"ExpressRouteConnectionInner",
"putExpressRouteConnectionParameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"expressRouteGatewayName",
",",
"connectionName",
",",
"putExpressRouteConnectionParameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit.
@param resourceGroupName The name of the resource group.
@param expressRouteGatewayName The name of the ExpressRoute gateway.
@param connectionName The name of the connection subresource.
@param putExpressRouteConnectionParameters Parameters required in an ExpressRouteConnection PUT operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRouteConnectionInner object if successful. | [
"Creates",
"a",
"connection",
"between",
"an",
"ExpressRoute",
"gateway",
"and",
"an",
"ExpressRoute",
"circuit",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteConnectionsInner.java#L178-L180 |
aws/aws-sdk-java | jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathContainsFunction.java | JmesPathContainsFunction.doesStringContain | private static BooleanNode doesStringContain(JsonNode subject, JsonNode search) {
"""
If the provided subject is a string, this function returns
true if the string contains the provided search argument.
@param subject String
@param search JmesPath expression
@return True string contains search;
False otherwise
"""
if (subject.asText().contains(search.asText())) {
return BooleanNode.TRUE;
}
return BooleanNode.FALSE;
} | java | private static BooleanNode doesStringContain(JsonNode subject, JsonNode search) {
if (subject.asText().contains(search.asText())) {
return BooleanNode.TRUE;
}
return BooleanNode.FALSE;
} | [
"private",
"static",
"BooleanNode",
"doesStringContain",
"(",
"JsonNode",
"subject",
",",
"JsonNode",
"search",
")",
"{",
"if",
"(",
"subject",
".",
"asText",
"(",
")",
".",
"contains",
"(",
"search",
".",
"asText",
"(",
")",
")",
")",
"{",
"return",
"BooleanNode",
".",
"TRUE",
";",
"}",
"return",
"BooleanNode",
".",
"FALSE",
";",
"}"
] | If the provided subject is a string, this function returns
true if the string contains the provided search argument.
@param subject String
@param search JmesPath expression
@return True string contains search;
False otherwise | [
"If",
"the",
"provided",
"subject",
"is",
"a",
"string",
"this",
"function",
"returns",
"true",
"if",
"the",
"string",
"contains",
"the",
"provided",
"search",
"argument",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathContainsFunction.java#L99-L104 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/parser/PdfContentReaderTool.java | PdfContentReaderTool.listContentStreamForPage | static public void listContentStreamForPage(PdfReader reader, int pageNum, PrintWriter out) throws IOException {
"""
Writes information about a specific page from PdfReader to the specified output stream.
@since 2.1.5
@param reader the PdfReader to read the page content from
@param pageNum the page number to read
@param out the output stream to send the content to
@throws IOException
"""
out.println("==============Page " + pageNum + "====================");
out.println("- - - - - Dictionary - - - - - -");
PdfDictionary pageDictionary = reader.getPageN(pageNum);
out.println(getDictionaryDetail(pageDictionary));
out.println("- - - - - Content Stream - - - - - -");
RandomAccessFileOrArray f = reader.getSafeFile();
byte[] contentBytes = reader.getPageContent(pageNum, f);
f.close();
InputStream is = new ByteArrayInputStream(contentBytes);
int ch;
while ((ch = is.read()) != -1){
out.print((char)ch);
}
out.println("- - - - - Text Extraction - - - - - -");
PdfTextExtractor extractor = new PdfTextExtractor(reader);
String extractedText = extractor.getTextFromPage(pageNum);
if (extractedText.length() != 0)
out.println(extractedText);
else
out.println("No text found on page " + pageNum);
out.println();
} | java | static public void listContentStreamForPage(PdfReader reader, int pageNum, PrintWriter out) throws IOException {
out.println("==============Page " + pageNum + "====================");
out.println("- - - - - Dictionary - - - - - -");
PdfDictionary pageDictionary = reader.getPageN(pageNum);
out.println(getDictionaryDetail(pageDictionary));
out.println("- - - - - Content Stream - - - - - -");
RandomAccessFileOrArray f = reader.getSafeFile();
byte[] contentBytes = reader.getPageContent(pageNum, f);
f.close();
InputStream is = new ByteArrayInputStream(contentBytes);
int ch;
while ((ch = is.read()) != -1){
out.print((char)ch);
}
out.println("- - - - - Text Extraction - - - - - -");
PdfTextExtractor extractor = new PdfTextExtractor(reader);
String extractedText = extractor.getTextFromPage(pageNum);
if (extractedText.length() != 0)
out.println(extractedText);
else
out.println("No text found on page " + pageNum);
out.println();
} | [
"static",
"public",
"void",
"listContentStreamForPage",
"(",
"PdfReader",
"reader",
",",
"int",
"pageNum",
",",
"PrintWriter",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"println",
"(",
"\"==============Page \"",
"+",
"pageNum",
"+",
"\"====================\"",
")",
";",
"out",
".",
"println",
"(",
"\"- - - - - Dictionary - - - - - -\"",
")",
";",
"PdfDictionary",
"pageDictionary",
"=",
"reader",
".",
"getPageN",
"(",
"pageNum",
")",
";",
"out",
".",
"println",
"(",
"getDictionaryDetail",
"(",
"pageDictionary",
")",
")",
";",
"out",
".",
"println",
"(",
"\"- - - - - Content Stream - - - - - -\"",
")",
";",
"RandomAccessFileOrArray",
"f",
"=",
"reader",
".",
"getSafeFile",
"(",
")",
";",
"byte",
"[",
"]",
"contentBytes",
"=",
"reader",
".",
"getPageContent",
"(",
"pageNum",
",",
"f",
")",
";",
"f",
".",
"close",
"(",
")",
";",
"InputStream",
"is",
"=",
"new",
"ByteArrayInputStream",
"(",
"contentBytes",
")",
";",
"int",
"ch",
";",
"while",
"(",
"(",
"ch",
"=",
"is",
".",
"read",
"(",
")",
")",
"!=",
"-",
"1",
")",
"{",
"out",
".",
"print",
"(",
"(",
"char",
")",
"ch",
")",
";",
"}",
"out",
".",
"println",
"(",
"\"- - - - - Text Extraction - - - - - -\"",
")",
";",
"PdfTextExtractor",
"extractor",
"=",
"new",
"PdfTextExtractor",
"(",
"reader",
")",
";",
"String",
"extractedText",
"=",
"extractor",
".",
"getTextFromPage",
"(",
"pageNum",
")",
";",
"if",
"(",
"extractedText",
".",
"length",
"(",
")",
"!=",
"0",
")",
"out",
".",
"println",
"(",
"extractedText",
")",
";",
"else",
"out",
".",
"println",
"(",
"\"No text found on page \"",
"+",
"pageNum",
")",
";",
"out",
".",
"println",
"(",
")",
";",
"}"
] | Writes information about a specific page from PdfReader to the specified output stream.
@since 2.1.5
@param reader the PdfReader to read the page content from
@param pageNum the page number to read
@param out the output stream to send the content to
@throws IOException | [
"Writes",
"information",
"about",
"a",
"specific",
"page",
"from",
"PdfReader",
"to",
"the",
"specified",
"output",
"stream",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/parser/PdfContentReaderTool.java#L126-L154 |
jurmous/etcd4j | src/main/java/mousio/etcd4j/EtcdClient.java | EtcdClient.getSelfStats | public EtcdSelfStatsResponse getSelfStats() {
"""
Get the Self Statistics of Etcd
@return EtcdSelfStatsResponse
"""
try {
return new EtcdSelfStatsRequest(this.client, retryHandler).send().get();
} catch (IOException | EtcdException | EtcdAuthenticationException | TimeoutException e) {
return null;
}
} | java | public EtcdSelfStatsResponse getSelfStats() {
try {
return new EtcdSelfStatsRequest(this.client, retryHandler).send().get();
} catch (IOException | EtcdException | EtcdAuthenticationException | TimeoutException e) {
return null;
}
} | [
"public",
"EtcdSelfStatsResponse",
"getSelfStats",
"(",
")",
"{",
"try",
"{",
"return",
"new",
"EtcdSelfStatsRequest",
"(",
"this",
".",
"client",
",",
"retryHandler",
")",
".",
"send",
"(",
")",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"|",
"EtcdException",
"|",
"EtcdAuthenticationException",
"|",
"TimeoutException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Get the Self Statistics of Etcd
@return EtcdSelfStatsResponse | [
"Get",
"the",
"Self",
"Statistics",
"of",
"Etcd"
] | train | https://github.com/jurmous/etcd4j/blob/ffb1d574cf85bbab025dd566ce250f1860bbcbc7/src/main/java/mousio/etcd4j/EtcdClient.java#L145-L151 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java | XMLUtil.getText | @Pure
public static String getText(Node document, String... path) {
"""
Replies the text inside the node at the specified path.
<p>The path is an ordered list of tag's names and ended by the name of
the desired node.
Be careful about the fact that the names are case sensitives.
@param document is the XML document to explore.
@param path is the list of names. This path may be empty.
@return the text or <code>null</code> if the node was not found in the document or the text
inside was empty.
"""
assert document != null : AssertMessages.notNullParameter(0);
Node parentNode = getNodeFromPath(document, path);
if (parentNode == null) {
parentNode = document;
}
final StringBuilder text = new StringBuilder();
final NodeList children = parentNode.getChildNodes();
final int len = children.getLength();
for (int i = 0; i < len; ++i) {
final Node child = children.item(i);
if (child instanceof Text) {
text.append(((Text) child).getWholeText());
}
}
if (text.length() > 0) {
return text.toString();
}
return null;
} | java | @Pure
public static String getText(Node document, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
Node parentNode = getNodeFromPath(document, path);
if (parentNode == null) {
parentNode = document;
}
final StringBuilder text = new StringBuilder();
final NodeList children = parentNode.getChildNodes();
final int len = children.getLength();
for (int i = 0; i < len; ++i) {
final Node child = children.item(i);
if (child instanceof Text) {
text.append(((Text) child).getWholeText());
}
}
if (text.length() > 0) {
return text.toString();
}
return null;
} | [
"@",
"Pure",
"public",
"static",
"String",
"getText",
"(",
"Node",
"document",
",",
"String",
"...",
"path",
")",
"{",
"assert",
"document",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
";",
"Node",
"parentNode",
"=",
"getNodeFromPath",
"(",
"document",
",",
"path",
")",
";",
"if",
"(",
"parentNode",
"==",
"null",
")",
"{",
"parentNode",
"=",
"document",
";",
"}",
"final",
"StringBuilder",
"text",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"NodeList",
"children",
"=",
"parentNode",
".",
"getChildNodes",
"(",
")",
";",
"final",
"int",
"len",
"=",
"children",
".",
"getLength",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"final",
"Node",
"child",
"=",
"children",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"child",
"instanceof",
"Text",
")",
"{",
"text",
".",
"append",
"(",
"(",
"(",
"Text",
")",
"child",
")",
".",
"getWholeText",
"(",
")",
")",
";",
"}",
"}",
"if",
"(",
"text",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"return",
"text",
".",
"toString",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Replies the text inside the node at the specified path.
<p>The path is an ordered list of tag's names and ended by the name of
the desired node.
Be careful about the fact that the names are case sensitives.
@param document is the XML document to explore.
@param path is the list of names. This path may be empty.
@return the text or <code>null</code> if the node was not found in the document or the text
inside was empty. | [
"Replies",
"the",
"text",
"inside",
"the",
"node",
"at",
"the",
"specified",
"path",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1674-L1694 |
apereo/cas | support/cas-server-support-saml/src/main/java/org/apereo/cas/support/saml/authentication/SamlResponseBuilder.java | SamlResponseBuilder.setStatusRequestDenied | public void setStatusRequestDenied(final Response response, final String description) {
"""
Sets status request denied.
@param response the response
@param description the description
"""
response.setStatus(this.samlObjectBuilder.newStatus(StatusCode.REQUEST_DENIED, description));
} | java | public void setStatusRequestDenied(final Response response, final String description) {
response.setStatus(this.samlObjectBuilder.newStatus(StatusCode.REQUEST_DENIED, description));
} | [
"public",
"void",
"setStatusRequestDenied",
"(",
"final",
"Response",
"response",
",",
"final",
"String",
"description",
")",
"{",
"response",
".",
"setStatus",
"(",
"this",
".",
"samlObjectBuilder",
".",
"newStatus",
"(",
"StatusCode",
".",
"REQUEST_DENIED",
",",
"description",
")",
")",
";",
"}"
] | Sets status request denied.
@param response the response
@param description the description | [
"Sets",
"status",
"request",
"denied",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml/src/main/java/org/apereo/cas/support/saml/authentication/SamlResponseBuilder.java#L64-L66 |
stephenc/redmine-java-api | src/main/java/org/redmine/ta/internal/RedmineJSONParser.java | RedmineJSONParser.getDateOrNull | private static Date getDateOrNull(JSONObject obj, String field)
throws JSONException {
"""
Fetches an optional date from an object.
@param obj
object to get a field from.
@param field
field to get a value from.
@throws RedmineFormatException
if value is not valid
"""
String dateStr = JsonInput.getStringOrNull(obj, field);
if (dateStr == null)
return null;
try {
if (dateStr.length() >= 5 && dateStr.charAt(4) == '/') {
return RedmineDateUtils.FULL_DATE_FORMAT.get().parse(dateStr);
}
if (dateStr.endsWith("Z")) {
dateStr = dateStr.substring(0, dateStr.length() - 1)
+ "GMT-00:00";
} else {
final int inset = 6;
if (dateStr.length() <= inset)
throw new JSONException("Bad date value " + dateStr);
String s0 = dateStr.substring(0, dateStr.length() - inset);
String s1 = dateStr.substring(dateStr.length() - inset,
dateStr.length());
dateStr = s0 + "GMT" + s1;
}
return RedmineDateUtils.FULL_DATE_FORMAT_V2.get().parse(dateStr);
} catch (ParseException e) {
throw new JSONException("Bad date value " + dateStr);
}
} | java | private static Date getDateOrNull(JSONObject obj, String field)
throws JSONException {
String dateStr = JsonInput.getStringOrNull(obj, field);
if (dateStr == null)
return null;
try {
if (dateStr.length() >= 5 && dateStr.charAt(4) == '/') {
return RedmineDateUtils.FULL_DATE_FORMAT.get().parse(dateStr);
}
if (dateStr.endsWith("Z")) {
dateStr = dateStr.substring(0, dateStr.length() - 1)
+ "GMT-00:00";
} else {
final int inset = 6;
if (dateStr.length() <= inset)
throw new JSONException("Bad date value " + dateStr);
String s0 = dateStr.substring(0, dateStr.length() - inset);
String s1 = dateStr.substring(dateStr.length() - inset,
dateStr.length());
dateStr = s0 + "GMT" + s1;
}
return RedmineDateUtils.FULL_DATE_FORMAT_V2.get().parse(dateStr);
} catch (ParseException e) {
throw new JSONException("Bad date value " + dateStr);
}
} | [
"private",
"static",
"Date",
"getDateOrNull",
"(",
"JSONObject",
"obj",
",",
"String",
"field",
")",
"throws",
"JSONException",
"{",
"String",
"dateStr",
"=",
"JsonInput",
".",
"getStringOrNull",
"(",
"obj",
",",
"field",
")",
";",
"if",
"(",
"dateStr",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"if",
"(",
"dateStr",
".",
"length",
"(",
")",
">=",
"5",
"&&",
"dateStr",
".",
"charAt",
"(",
"4",
")",
"==",
"'",
"'",
")",
"{",
"return",
"RedmineDateUtils",
".",
"FULL_DATE_FORMAT",
".",
"get",
"(",
")",
".",
"parse",
"(",
"dateStr",
")",
";",
"}",
"if",
"(",
"dateStr",
".",
"endsWith",
"(",
"\"Z\"",
")",
")",
"{",
"dateStr",
"=",
"dateStr",
".",
"substring",
"(",
"0",
",",
"dateStr",
".",
"length",
"(",
")",
"-",
"1",
")",
"+",
"\"GMT-00:00\"",
";",
"}",
"else",
"{",
"final",
"int",
"inset",
"=",
"6",
";",
"if",
"(",
"dateStr",
".",
"length",
"(",
")",
"<=",
"inset",
")",
"throw",
"new",
"JSONException",
"(",
"\"Bad date value \"",
"+",
"dateStr",
")",
";",
"String",
"s0",
"=",
"dateStr",
".",
"substring",
"(",
"0",
",",
"dateStr",
".",
"length",
"(",
")",
"-",
"inset",
")",
";",
"String",
"s1",
"=",
"dateStr",
".",
"substring",
"(",
"dateStr",
".",
"length",
"(",
")",
"-",
"inset",
",",
"dateStr",
".",
"length",
"(",
")",
")",
";",
"dateStr",
"=",
"s0",
"+",
"\"GMT\"",
"+",
"s1",
";",
"}",
"return",
"RedmineDateUtils",
".",
"FULL_DATE_FORMAT_V2",
".",
"get",
"(",
")",
".",
"parse",
"(",
"dateStr",
")",
";",
"}",
"catch",
"(",
"ParseException",
"e",
")",
"{",
"throw",
"new",
"JSONException",
"(",
"\"Bad date value \"",
"+",
"dateStr",
")",
";",
"}",
"}"
] | Fetches an optional date from an object.
@param obj
object to get a field from.
@param field
field to get a value from.
@throws RedmineFormatException
if value is not valid | [
"Fetches",
"an",
"optional",
"date",
"from",
"an",
"object",
"."
] | train | https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/RedmineJSONParser.java#L549-L574 |
damianszczepanik/cucumber-reporting | src/main/java/net/masterthought/cucumber/ReportBuilder.java | ReportBuilder.generateReports | public Reportable generateReports() {
"""
Parses provided files and generates the report. When generating process fails
report with information about error is provided.
@return stats for the generated report
"""
Trends trends = null;
try {
// first copy static resources so ErrorPage is displayed properly
copyStaticResources();
// create directory for embeddings before files are generated
createEmbeddingsDirectory();
// add metadata info sourced from files
reportParser.parseClassificationsFiles(configuration.getClassificationFiles());
// parse json files for results
List<Feature> features = reportParser.parseJsonFiles(jsonFiles);
reportResult = new ReportResult(features, configuration);
Reportable reportable = reportResult.getFeatureReport();
if (configuration.isTrendsAvailable()) {
// prepare data required by generators, collect generators and generate pages
trends = updateAndSaveTrends(reportable);
}
// Collect and generate pages in a single pass
generatePages(trends);
return reportable;
// whatever happens we want to provide at least error page instead of incomplete report or exception
} catch (Exception e) {
generateErrorPage(e);
// update trends so there is information in history that the build failed
// if trends was not created then something went wrong
// and information about build failure should be saved
if (!wasTrendsFileSaved && configuration.isTrendsAvailable()) {
Reportable reportable = new EmptyReportable();
updateAndSaveTrends(reportable);
}
// something went wrong, don't pass result that might be incomplete
return null;
}
} | java | public Reportable generateReports() {
Trends trends = null;
try {
// first copy static resources so ErrorPage is displayed properly
copyStaticResources();
// create directory for embeddings before files are generated
createEmbeddingsDirectory();
// add metadata info sourced from files
reportParser.parseClassificationsFiles(configuration.getClassificationFiles());
// parse json files for results
List<Feature> features = reportParser.parseJsonFiles(jsonFiles);
reportResult = new ReportResult(features, configuration);
Reportable reportable = reportResult.getFeatureReport();
if (configuration.isTrendsAvailable()) {
// prepare data required by generators, collect generators and generate pages
trends = updateAndSaveTrends(reportable);
}
// Collect and generate pages in a single pass
generatePages(trends);
return reportable;
// whatever happens we want to provide at least error page instead of incomplete report or exception
} catch (Exception e) {
generateErrorPage(e);
// update trends so there is information in history that the build failed
// if trends was not created then something went wrong
// and information about build failure should be saved
if (!wasTrendsFileSaved && configuration.isTrendsAvailable()) {
Reportable reportable = new EmptyReportable();
updateAndSaveTrends(reportable);
}
// something went wrong, don't pass result that might be incomplete
return null;
}
} | [
"public",
"Reportable",
"generateReports",
"(",
")",
"{",
"Trends",
"trends",
"=",
"null",
";",
"try",
"{",
"// first copy static resources so ErrorPage is displayed properly",
"copyStaticResources",
"(",
")",
";",
"// create directory for embeddings before files are generated",
"createEmbeddingsDirectory",
"(",
")",
";",
"// add metadata info sourced from files",
"reportParser",
".",
"parseClassificationsFiles",
"(",
"configuration",
".",
"getClassificationFiles",
"(",
")",
")",
";",
"// parse json files for results",
"List",
"<",
"Feature",
">",
"features",
"=",
"reportParser",
".",
"parseJsonFiles",
"(",
"jsonFiles",
")",
";",
"reportResult",
"=",
"new",
"ReportResult",
"(",
"features",
",",
"configuration",
")",
";",
"Reportable",
"reportable",
"=",
"reportResult",
".",
"getFeatureReport",
"(",
")",
";",
"if",
"(",
"configuration",
".",
"isTrendsAvailable",
"(",
")",
")",
"{",
"// prepare data required by generators, collect generators and generate pages",
"trends",
"=",
"updateAndSaveTrends",
"(",
"reportable",
")",
";",
"}",
"// Collect and generate pages in a single pass",
"generatePages",
"(",
"trends",
")",
";",
"return",
"reportable",
";",
"// whatever happens we want to provide at least error page instead of incomplete report or exception",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"generateErrorPage",
"(",
"e",
")",
";",
"// update trends so there is information in history that the build failed",
"// if trends was not created then something went wrong",
"// and information about build failure should be saved",
"if",
"(",
"!",
"wasTrendsFileSaved",
"&&",
"configuration",
".",
"isTrendsAvailable",
"(",
")",
")",
"{",
"Reportable",
"reportable",
"=",
"new",
"EmptyReportable",
"(",
")",
";",
"updateAndSaveTrends",
"(",
"reportable",
")",
";",
"}",
"// something went wrong, don't pass result that might be incomplete",
"return",
"null",
";",
"}",
"}"
] | Parses provided files and generates the report. When generating process fails
report with information about error is provided.
@return stats for the generated report | [
"Parses",
"provided",
"files",
"and",
"generates",
"the",
"report",
".",
"When",
"generating",
"process",
"fails",
"report",
"with",
"information",
"about",
"error",
"is",
"provided",
"."
] | train | https://github.com/damianszczepanik/cucumber-reporting/blob/9ffe0d4a9c0aec161b0988a930a8312ba36dc742/src/main/java/net/masterthought/cucumber/ReportBuilder.java#L74-L117 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/utils/DbcHelper.java | DbcHelper.getConnection | public static Connection getConnection(String dataSourceName, boolean startTransaction)
throws SQLException {
"""
Obtains a JDBC connection from a named data-source (start a new
transaction if specified).
<p>
Note: call {@link #returnConnection(Connection)} to return the connection
back to the pool. Do NOT use {@code Connection.clode()}.
</p>
@param dataSourceName
@param startTransaction
@return
@throws SQLException
"""
Map<String, OpenConnStats> statsMap = openConnStats.get();
OpenConnStats connStats = statsMap.get(dataSourceName);
Connection conn;
if (connStats == null) {
// no existing connection, obtain a new one
DataSource ds = getJdbcDataSource(dataSourceName);
conn = ds != null ? ds.getConnection() : null;
if (conn == null) {
return null;
}
openConnDsName.get().put(conn, dataSourceName);
connStats = new OpenConnStats();
connStats.conn = conn;
// connStats.dsName = dataSourceName;
statsMap.put(dataSourceName, connStats);
if (!startTransaction) {
connStats.inTransaction = false;
conn.setAutoCommit(true);
}
} else {
conn = connStats.conn;
}
connStats.counter.incrementAndGet();
if (startTransaction) {
startTransaction(conn);
}
return conn;
} | java | public static Connection getConnection(String dataSourceName, boolean startTransaction)
throws SQLException {
Map<String, OpenConnStats> statsMap = openConnStats.get();
OpenConnStats connStats = statsMap.get(dataSourceName);
Connection conn;
if (connStats == null) {
// no existing connection, obtain a new one
DataSource ds = getJdbcDataSource(dataSourceName);
conn = ds != null ? ds.getConnection() : null;
if (conn == null) {
return null;
}
openConnDsName.get().put(conn, dataSourceName);
connStats = new OpenConnStats();
connStats.conn = conn;
// connStats.dsName = dataSourceName;
statsMap.put(dataSourceName, connStats);
if (!startTransaction) {
connStats.inTransaction = false;
conn.setAutoCommit(true);
}
} else {
conn = connStats.conn;
}
connStats.counter.incrementAndGet();
if (startTransaction) {
startTransaction(conn);
}
return conn;
} | [
"public",
"static",
"Connection",
"getConnection",
"(",
"String",
"dataSourceName",
",",
"boolean",
"startTransaction",
")",
"throws",
"SQLException",
"{",
"Map",
"<",
"String",
",",
"OpenConnStats",
">",
"statsMap",
"=",
"openConnStats",
".",
"get",
"(",
")",
";",
"OpenConnStats",
"connStats",
"=",
"statsMap",
".",
"get",
"(",
"dataSourceName",
")",
";",
"Connection",
"conn",
";",
"if",
"(",
"connStats",
"==",
"null",
")",
"{",
"// no existing connection, obtain a new one",
"DataSource",
"ds",
"=",
"getJdbcDataSource",
"(",
"dataSourceName",
")",
";",
"conn",
"=",
"ds",
"!=",
"null",
"?",
"ds",
".",
"getConnection",
"(",
")",
":",
"null",
";",
"if",
"(",
"conn",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"openConnDsName",
".",
"get",
"(",
")",
".",
"put",
"(",
"conn",
",",
"dataSourceName",
")",
";",
"connStats",
"=",
"new",
"OpenConnStats",
"(",
")",
";",
"connStats",
".",
"conn",
"=",
"conn",
";",
"// connStats.dsName = dataSourceName;",
"statsMap",
".",
"put",
"(",
"dataSourceName",
",",
"connStats",
")",
";",
"if",
"(",
"!",
"startTransaction",
")",
"{",
"connStats",
".",
"inTransaction",
"=",
"false",
";",
"conn",
".",
"setAutoCommit",
"(",
"true",
")",
";",
"}",
"}",
"else",
"{",
"conn",
"=",
"connStats",
".",
"conn",
";",
"}",
"connStats",
".",
"counter",
".",
"incrementAndGet",
"(",
")",
";",
"if",
"(",
"startTransaction",
")",
"{",
"startTransaction",
"(",
"conn",
")",
";",
"}",
"return",
"conn",
";",
"}"
] | Obtains a JDBC connection from a named data-source (start a new
transaction if specified).
<p>
Note: call {@link #returnConnection(Connection)} to return the connection
back to the pool. Do NOT use {@code Connection.clode()}.
</p>
@param dataSourceName
@param startTransaction
@return
@throws SQLException | [
"Obtains",
"a",
"JDBC",
"connection",
"from",
"a",
"named",
"data",
"-",
"source",
"(",
"start",
"a",
"new",
"transaction",
"if",
"specified",
")",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/utils/DbcHelper.java#L117-L151 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java | QueryReferenceBroker.getCollectionByQuery | public Collection getCollectionByQuery(Query query, boolean lazy) throws PersistenceBrokerException {
"""
retrieve a collection of itemClass Objects matching the Query query
"""
// thma: the following cast is safe because:
// 1. ManageableVector implements Collection (will be returned if lazy == false)
// 2. CollectionProxy implements Collection (will be returned if lazy == true)
return (Collection) getCollectionByQuery(RemovalAwareCollection.class, query, lazy);
} | java | public Collection getCollectionByQuery(Query query, boolean lazy) throws PersistenceBrokerException
{
// thma: the following cast is safe because:
// 1. ManageableVector implements Collection (will be returned if lazy == false)
// 2. CollectionProxy implements Collection (will be returned if lazy == true)
return (Collection) getCollectionByQuery(RemovalAwareCollection.class, query, lazy);
} | [
"public",
"Collection",
"getCollectionByQuery",
"(",
"Query",
"query",
",",
"boolean",
"lazy",
")",
"throws",
"PersistenceBrokerException",
"{",
"// thma: the following cast is safe because:\r",
"// 1. ManageableVector implements Collection (will be returned if lazy == false)\r",
"// 2. CollectionProxy implements Collection (will be returned if lazy == true)\r",
"return",
"(",
"Collection",
")",
"getCollectionByQuery",
"(",
"RemovalAwareCollection",
".",
"class",
",",
"query",
",",
"lazy",
")",
";",
"}"
] | retrieve a collection of itemClass Objects matching the Query query | [
"retrieve",
"a",
"collection",
"of",
"itemClass",
"Objects",
"matching",
"the",
"Query",
"query"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L284-L290 |
centic9/commons-dost | src/main/java/org/dstadler/commons/http/NanoHTTPD.java | NanoHTTPD.encodeUri | private String encodeUri( String uri ) {
"""
URL-encodes everything between '/'-characters.
Encodes spaces as '%20' instead of '+'.
"""
StringBuilder newUri = new StringBuilder();
StringTokenizer st = new StringTokenizer( uri, "/ ", true );
while ( st.hasMoreTokens())
{
String tok = st.nextToken();
if ( tok.equals( "/" )) {
newUri.append('/');
} else if ( tok.equals( " " )) {
newUri.append("%20");
} else {
try {
newUri.append(URLEncoder.encode( tok, "UTF-8" ));
} catch ( UnsupportedEncodingException uee ) { // NOPMD - imported code
// imported code
}
}
}
return newUri.toString();
} | java | private String encodeUri( String uri )
{
StringBuilder newUri = new StringBuilder();
StringTokenizer st = new StringTokenizer( uri, "/ ", true );
while ( st.hasMoreTokens())
{
String tok = st.nextToken();
if ( tok.equals( "/" )) {
newUri.append('/');
} else if ( tok.equals( " " )) {
newUri.append("%20");
} else {
try {
newUri.append(URLEncoder.encode( tok, "UTF-8" ));
} catch ( UnsupportedEncodingException uee ) { // NOPMD - imported code
// imported code
}
}
}
return newUri.toString();
} | [
"private",
"String",
"encodeUri",
"(",
"String",
"uri",
")",
"{",
"StringBuilder",
"newUri",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"uri",
",",
"\"/ \"",
",",
"true",
")",
";",
"while",
"(",
"st",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"String",
"tok",
"=",
"st",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"tok",
".",
"equals",
"(",
"\"/\"",
")",
")",
"{",
"newUri",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"if",
"(",
"tok",
".",
"equals",
"(",
"\" \"",
")",
")",
"{",
"newUri",
".",
"append",
"(",
"\"%20\"",
")",
";",
"}",
"else",
"{",
"try",
"{",
"newUri",
".",
"append",
"(",
"URLEncoder",
".",
"encode",
"(",
"tok",
",",
"\"UTF-8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"uee",
")",
"{",
"// NOPMD - imported code",
"// imported code",
"}",
"}",
"}",
"return",
"newUri",
".",
"toString",
"(",
")",
";",
"}"
] | URL-encodes everything between '/'-characters.
Encodes spaces as '%20' instead of '+'. | [
"URL",
"-",
"encodes",
"everything",
"between",
"/",
"-",
"characters",
".",
"Encodes",
"spaces",
"as",
"%20",
"instead",
"of",
"+",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/http/NanoHTTPD.java#L648-L668 |
jamesagnew/hapi-fhir | hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/Period.java | Period.setEnd | public Period setEnd( Date theDate, TemporalPrecisionEnum thePrecision) {
"""
Sets the value for <b>end</b> ()
<p>
<b>Definition:</b>
The end of the period. The boundary is inclusive.
</p>
"""
end = new DateTimeType(theDate, thePrecision);
return this;
} | java | public Period setEnd( Date theDate, TemporalPrecisionEnum thePrecision) {
end = new DateTimeType(theDate, thePrecision);
return this;
} | [
"public",
"Period",
"setEnd",
"(",
"Date",
"theDate",
",",
"TemporalPrecisionEnum",
"thePrecision",
")",
"{",
"end",
"=",
"new",
"DateTimeType",
"(",
"theDate",
",",
"thePrecision",
")",
";",
"return",
"this",
";",
"}"
] | Sets the value for <b>end</b> ()
<p>
<b>Definition:</b>
The end of the period. The boundary is inclusive.
</p> | [
"Sets",
"the",
"value",
"for",
"<b",
">",
"end<",
"/",
"b",
">",
"()"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/Period.java#L190-L193 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/OntRelationMention.java | OntRelationMention.setRangeList | public void setRangeList(int i, Annotation v) {
"""
indexed setter for rangeList - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array
"""
if (OntRelationMention_Type.featOkTst && ((OntRelationMention_Type)jcasType).casFeat_rangeList == null)
jcasType.jcas.throwFeatMissing("rangeList", "de.julielab.jules.types.OntRelationMention");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_rangeList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_rangeList), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setRangeList(int i, Annotation v) {
if (OntRelationMention_Type.featOkTst && ((OntRelationMention_Type)jcasType).casFeat_rangeList == null)
jcasType.jcas.throwFeatMissing("rangeList", "de.julielab.jules.types.OntRelationMention");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_rangeList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_rangeList), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setRangeList",
"(",
"int",
"i",
",",
"Annotation",
"v",
")",
"{",
"if",
"(",
"OntRelationMention_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"OntRelationMention_Type",
")",
"jcasType",
")",
".",
"casFeat_rangeList",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"throwFeatMissing",
"(",
"\"rangeList\"",
",",
"\"de.julielab.jules.types.OntRelationMention\"",
")",
";",
"jcasType",
".",
"jcas",
".",
"checkArrayBounds",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"OntRelationMention_Type",
")",
"jcasType",
")",
".",
"casFeatCode_rangeList",
")",
",",
"i",
")",
";",
"jcasType",
".",
"ll_cas",
".",
"ll_setRefArrayValue",
"(",
"jcasType",
".",
"ll_cas",
".",
"ll_getRefValue",
"(",
"addr",
",",
"(",
"(",
"OntRelationMention_Type",
")",
"jcasType",
")",
".",
"casFeatCode_rangeList",
")",
",",
"i",
",",
"jcasType",
".",
"ll_cas",
".",
"ll_getFSRef",
"(",
"v",
")",
")",
";",
"}"
] | indexed setter for rangeList - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"rangeList",
"-",
"sets",
"an",
"indexed",
"value",
"-"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/OntRelationMention.java#L204-L208 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/util/StringHelper.java | StringHelper.makeFormattedString | public static String makeFormattedString(String aAttrName, Object aObj) {
"""
Overloaded method with <code>aPrependSeparator = true</code>.
@see #makeFormattedString(String, Object, boolean)
@param aAttrName A String attribute name value.
@param aObj An Object value.
@return A formatted String.
"""
return makeFormattedString(aAttrName, aObj, true);
} | java | public static String makeFormattedString(String aAttrName, Object aObj) {
return makeFormattedString(aAttrName, aObj, true);
} | [
"public",
"static",
"String",
"makeFormattedString",
"(",
"String",
"aAttrName",
",",
"Object",
"aObj",
")",
"{",
"return",
"makeFormattedString",
"(",
"aAttrName",
",",
"aObj",
",",
"true",
")",
";",
"}"
] | Overloaded method with <code>aPrependSeparator = true</code>.
@see #makeFormattedString(String, Object, boolean)
@param aAttrName A String attribute name value.
@param aObj An Object value.
@return A formatted String. | [
"Overloaded",
"method",
"with",
"<code",
">",
"aPrependSeparator",
"=",
"true<",
"/",
"code",
">",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/StringHelper.java#L720-L722 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.withdrawal_withdrawalId_payment_GET | public OvhPayment withdrawal_withdrawalId_payment_GET(String withdrawalId) throws IOException {
"""
Get this object properties
REST: GET /me/withdrawal/{withdrawalId}/payment
@param withdrawalId [required]
"""
String qPath = "/me/withdrawal/{withdrawalId}/payment";
StringBuilder sb = path(qPath, withdrawalId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPayment.class);
} | java | public OvhPayment withdrawal_withdrawalId_payment_GET(String withdrawalId) throws IOException {
String qPath = "/me/withdrawal/{withdrawalId}/payment";
StringBuilder sb = path(qPath, withdrawalId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPayment.class);
} | [
"public",
"OvhPayment",
"withdrawal_withdrawalId_payment_GET",
"(",
"String",
"withdrawalId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/withdrawal/{withdrawalId}/payment\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"withdrawalId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhPayment",
".",
"class",
")",
";",
"}"
] | Get this object properties
REST: GET /me/withdrawal/{withdrawalId}/payment
@param withdrawalId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4332-L4337 |
andi12/msbuild-maven-plugin | msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/VersionInfoMojo.java | VersionInfoMojo.writeVersionInfoTemplateToTempFile | private File writeVersionInfoTemplateToTempFile() throws MojoExecutionException {
"""
Write the default .rc template file to a temporary file and return it
@return a File pointing to the temporary file
@throws MojoExecutionException if there is an IOException
"""
try
{
final File versionInfoSrc = File.createTempFile( "msbuild-maven-plugin_" + MOJO_NAME, null );
InputStream is = getClass().getResourceAsStream( DEFAULT_VERSION_INFO_TEMPLATE );
FileOutputStream dest = new FileOutputStream( versionInfoSrc );
byte[] buffer = new byte[1024];
int read = -1;
while ( ( read = is.read( buffer ) ) != -1 )
{
dest.write( buffer, 0, read );
}
dest.close();
return versionInfoSrc;
}
catch ( IOException ioe )
{
String msg = "Failed to create temporary version file";
getLog().error( msg, ioe );
throw new MojoExecutionException( msg, ioe );
}
} | java | private File writeVersionInfoTemplateToTempFile() throws MojoExecutionException
{
try
{
final File versionInfoSrc = File.createTempFile( "msbuild-maven-plugin_" + MOJO_NAME, null );
InputStream is = getClass().getResourceAsStream( DEFAULT_VERSION_INFO_TEMPLATE );
FileOutputStream dest = new FileOutputStream( versionInfoSrc );
byte[] buffer = new byte[1024];
int read = -1;
while ( ( read = is.read( buffer ) ) != -1 )
{
dest.write( buffer, 0, read );
}
dest.close();
return versionInfoSrc;
}
catch ( IOException ioe )
{
String msg = "Failed to create temporary version file";
getLog().error( msg, ioe );
throw new MojoExecutionException( msg, ioe );
}
} | [
"private",
"File",
"writeVersionInfoTemplateToTempFile",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"try",
"{",
"final",
"File",
"versionInfoSrc",
"=",
"File",
".",
"createTempFile",
"(",
"\"msbuild-maven-plugin_\"",
"+",
"MOJO_NAME",
",",
"null",
")",
";",
"InputStream",
"is",
"=",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"DEFAULT_VERSION_INFO_TEMPLATE",
")",
";",
"FileOutputStream",
"dest",
"=",
"new",
"FileOutputStream",
"(",
"versionInfoSrc",
")",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"int",
"read",
"=",
"-",
"1",
";",
"while",
"(",
"(",
"read",
"=",
"is",
".",
"read",
"(",
"buffer",
")",
")",
"!=",
"-",
"1",
")",
"{",
"dest",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"read",
")",
";",
"}",
"dest",
".",
"close",
"(",
")",
";",
"return",
"versionInfoSrc",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"String",
"msg",
"=",
"\"Failed to create temporary version file\"",
";",
"getLog",
"(",
")",
".",
"error",
"(",
"msg",
",",
"ioe",
")",
";",
"throw",
"new",
"MojoExecutionException",
"(",
"msg",
",",
"ioe",
")",
";",
"}",
"}"
] | Write the default .rc template file to a temporary file and return it
@return a File pointing to the temporary file
@throws MojoExecutionException if there is an IOException | [
"Write",
"the",
"default",
".",
"rc",
"template",
"file",
"to",
"a",
"temporary",
"file",
"and",
"return",
"it"
] | train | https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/VersionInfoMojo.java#L167-L191 |
pac4j/pac4j | pac4j-core/src/main/java/org/pac4j/core/context/ContextHelper.java | ContextHelper.getCookie | public static Cookie getCookie(final Collection<Cookie> cookies, final String name) {
"""
Get a specific cookie by its name.
@param cookies provided cookies
@param name the name of the cookie
@return the cookie
"""
if (cookies != null) {
for (final Cookie cookie : cookies) {
if (cookie != null && CommonHelper.areEquals(name, cookie.getName())) {
return cookie;
}
}
}
return null;
} | java | public static Cookie getCookie(final Collection<Cookie> cookies, final String name) {
if (cookies != null) {
for (final Cookie cookie : cookies) {
if (cookie != null && CommonHelper.areEquals(name, cookie.getName())) {
return cookie;
}
}
}
return null;
} | [
"public",
"static",
"Cookie",
"getCookie",
"(",
"final",
"Collection",
"<",
"Cookie",
">",
"cookies",
",",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"cookies",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"Cookie",
"cookie",
":",
"cookies",
")",
"{",
"if",
"(",
"cookie",
"!=",
"null",
"&&",
"CommonHelper",
".",
"areEquals",
"(",
"name",
",",
"cookie",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"cookie",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Get a specific cookie by its name.
@param cookies provided cookies
@param name the name of the cookie
@return the cookie | [
"Get",
"a",
"specific",
"cookie",
"by",
"its",
"name",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/context/ContextHelper.java#L22-L31 |
openbase/jul | communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java | AbstractRemoteClient.addHandler | public void addHandler(final Handler handler, final boolean wait) throws InterruptedException, CouldNotPerformException {
"""
Method adds an handler to the internal rsb listener.
@param handler
@param wait
@throws InterruptedException
@throws CouldNotPerformException
"""
try {
listener.addHandler(handler, wait);
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not register Handler!", ex);
}
} | java | public void addHandler(final Handler handler, final boolean wait) throws InterruptedException, CouldNotPerformException {
try {
listener.addHandler(handler, wait);
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not register Handler!", ex);
}
} | [
"public",
"void",
"addHandler",
"(",
"final",
"Handler",
"handler",
",",
"final",
"boolean",
"wait",
")",
"throws",
"InterruptedException",
",",
"CouldNotPerformException",
"{",
"try",
"{",
"listener",
".",
"addHandler",
"(",
"handler",
",",
"wait",
")",
";",
"}",
"catch",
"(",
"CouldNotPerformException",
"ex",
")",
"{",
"throw",
"new",
"CouldNotPerformException",
"(",
"\"Could not register Handler!\"",
",",
"ex",
")",
";",
"}",
"}"
] | Method adds an handler to the internal rsb listener.
@param handler
@param wait
@throws InterruptedException
@throws CouldNotPerformException | [
"Method",
"adds",
"an",
"handler",
"to",
"the",
"internal",
"rsb",
"listener",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java#L358-L364 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Treap.java | Treap.addElement | public int addElement(int element, int treap) {
"""
Adds new element to the treap. Allows duplicates to be added.
"""
int treap_;
if (treap == -1) {
if (m_defaultTreap == nullNode())
m_defaultTreap = createTreap(-1);
treap_ = m_defaultTreap;
} else {
treap_ = treap;
}
return addElement_(element, 0, treap_);
} | java | public int addElement(int element, int treap) {
int treap_;
if (treap == -1) {
if (m_defaultTreap == nullNode())
m_defaultTreap = createTreap(-1);
treap_ = m_defaultTreap;
} else {
treap_ = treap;
}
return addElement_(element, 0, treap_);
} | [
"public",
"int",
"addElement",
"(",
"int",
"element",
",",
"int",
"treap",
")",
"{",
"int",
"treap_",
";",
"if",
"(",
"treap",
"==",
"-",
"1",
")",
"{",
"if",
"(",
"m_defaultTreap",
"==",
"nullNode",
"(",
")",
")",
"m_defaultTreap",
"=",
"createTreap",
"(",
"-",
"1",
")",
";",
"treap_",
"=",
"m_defaultTreap",
";",
"}",
"else",
"{",
"treap_",
"=",
"treap",
";",
"}",
"return",
"addElement_",
"(",
"element",
",",
"0",
",",
"treap_",
")",
";",
"}"
] | Adds new element to the treap. Allows duplicates to be added. | [
"Adds",
"new",
"element",
"to",
"the",
"treap",
".",
"Allows",
"duplicates",
"to",
"be",
"added",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Treap.java#L128-L139 |
SQLDroid/SQLDroid | src/main/java/org/sqldroid/SQLiteDatabase.java | SQLiteDatabase.changedRowCount | public int changedRowCount () {
"""
The count of changed rows. On JNA platforms, this is a call to sqlite3_changes
On Android, it's a convoluted call to a package-private method (or, if that fails, the
response is '1'.
"""
if ( getChangedRowCount == null ) {
try { // JNA/J2SE compatibility method.
getChangedRowCount = sqliteDatabase.getClass().getMethod("changedRowCount", (Class<?>[])null);
} catch ( Exception any ) {
try {
// Android
getChangedRowCount = sqliteDatabase.getClass().getDeclaredMethod("lastChangeCount", (Class<?>[])null);
getChangedRowCount.setAccessible(true);
} catch (Exception e) {
// ignore
}
}
}
if ( getChangedRowCount != null ) {
try {
return ((Integer)getChangedRowCount.invoke(sqliteDatabase, (Object[])null)).intValue();
} catch (Exception e) {
// ignore
}
}
return 1; // assume that the insert/update succeeded in changing exactly one row (terrible assumption, but I have nothing better).
} | java | public int changedRowCount () {
if ( getChangedRowCount == null ) {
try { // JNA/J2SE compatibility method.
getChangedRowCount = sqliteDatabase.getClass().getMethod("changedRowCount", (Class<?>[])null);
} catch ( Exception any ) {
try {
// Android
getChangedRowCount = sqliteDatabase.getClass().getDeclaredMethod("lastChangeCount", (Class<?>[])null);
getChangedRowCount.setAccessible(true);
} catch (Exception e) {
// ignore
}
}
}
if ( getChangedRowCount != null ) {
try {
return ((Integer)getChangedRowCount.invoke(sqliteDatabase, (Object[])null)).intValue();
} catch (Exception e) {
// ignore
}
}
return 1; // assume that the insert/update succeeded in changing exactly one row (terrible assumption, but I have nothing better).
} | [
"public",
"int",
"changedRowCount",
"(",
")",
"{",
"if",
"(",
"getChangedRowCount",
"==",
"null",
")",
"{",
"try",
"{",
"// JNA/J2SE compatibility method.",
"getChangedRowCount",
"=",
"sqliteDatabase",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"changedRowCount\"",
",",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
")",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"any",
")",
"{",
"try",
"{",
"// Android",
"getChangedRowCount",
"=",
"sqliteDatabase",
".",
"getClass",
"(",
")",
".",
"getDeclaredMethod",
"(",
"\"lastChangeCount\"",
",",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
")",
"null",
")",
";",
"getChangedRowCount",
".",
"setAccessible",
"(",
"true",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// ignore",
"}",
"}",
"}",
"if",
"(",
"getChangedRowCount",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"(",
"(",
"Integer",
")",
"getChangedRowCount",
".",
"invoke",
"(",
"sqliteDatabase",
",",
"(",
"Object",
"[",
"]",
")",
"null",
")",
")",
".",
"intValue",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// ignore",
"}",
"}",
"return",
"1",
";",
"// assume that the insert/update succeeded in changing exactly one row (terrible assumption, but I have nothing better).",
"}"
] | The count of changed rows. On JNA platforms, this is a call to sqlite3_changes
On Android, it's a convoluted call to a package-private method (or, if that fails, the
response is '1'. | [
"The",
"count",
"of",
"changed",
"rows",
".",
"On",
"JNA",
"platforms",
"this",
"is",
"a",
"call",
"to",
"sqlite3_changes",
"On",
"Android",
"it",
"s",
"a",
"convoluted",
"call",
"to",
"a",
"package",
"-",
"private",
"method",
"(",
"or",
"if",
"that",
"fails",
"the",
"response",
"is",
"1",
"."
] | train | https://github.com/SQLDroid/SQLDroid/blob/4fb38ee40338673cb0205044571e4379573762c4/src/main/java/org/sqldroid/SQLiteDatabase.java#L254-L276 |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/simple/SimpleBase.java | SimpleBase.isIdentical | public boolean isIdentical(T a, double tol) {
"""
Checks to see if matrix 'a' is the same as this matrix within the specified
tolerance.
@param a The matrix it is being compared against.
@param tol How similar they must be to be equals.
@return If they are equal within tolerance of each other.
"""
if( a.getType() != getType() )
return false;
return ops.isIdentical(mat,a.mat,tol);
} | java | public boolean isIdentical(T a, double tol) {
if( a.getType() != getType() )
return false;
return ops.isIdentical(mat,a.mat,tol);
} | [
"public",
"boolean",
"isIdentical",
"(",
"T",
"a",
",",
"double",
"tol",
")",
"{",
"if",
"(",
"a",
".",
"getType",
"(",
")",
"!=",
"getType",
"(",
")",
")",
"return",
"false",
";",
"return",
"ops",
".",
"isIdentical",
"(",
"mat",
",",
"a",
".",
"mat",
",",
"tol",
")",
";",
"}"
] | Checks to see if matrix 'a' is the same as this matrix within the specified
tolerance.
@param a The matrix it is being compared against.
@param tol How similar they must be to be equals.
@return If they are equal within tolerance of each other. | [
"Checks",
"to",
"see",
"if",
"matrix",
"a",
"is",
"the",
"same",
"as",
"this",
"matrix",
"within",
"the",
"specified",
"tolerance",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/simple/SimpleBase.java#L904-L908 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.getLogger | public static Logger getLogger(String name, String suffix) {
"""
Get a Logger instance given the logger name with the given suffix.
<p/>
<p>This will include a logger separator between logger name and suffix.
@param name the logger name
@param suffix a suffix to append to the logger name
@return the logger
"""
return getLogger(name == null || name.length() == 0 ? suffix : name + "." + suffix);
} | java | public static Logger getLogger(String name, String suffix) {
return getLogger(name == null || name.length() == 0 ? suffix : name + "." + suffix);
} | [
"public",
"static",
"Logger",
"getLogger",
"(",
"String",
"name",
",",
"String",
"suffix",
")",
"{",
"return",
"getLogger",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"length",
"(",
")",
"==",
"0",
"?",
"suffix",
":",
"name",
"+",
"\".\"",
"+",
"suffix",
")",
";",
"}"
] | Get a Logger instance given the logger name with the given suffix.
<p/>
<p>This will include a logger separator between logger name and suffix.
@param name the logger name
@param suffix a suffix to append to the logger name
@return the logger | [
"Get",
"a",
"Logger",
"instance",
"given",
"the",
"logger",
"name",
"with",
"the",
"given",
"suffix",
".",
"<p",
"/",
">",
"<p",
">",
"This",
"will",
"include",
"a",
"logger",
"separator",
"between",
"logger",
"name",
"and",
"suffix",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L2469-L2471 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java | DateTimeUtils.addDays | public static Calendar addDays(Calendar origin, int value) {
"""
Add/Subtract the specified amount of days to the given {@link Calendar}.
<p>
The returned {@link Calendar} has its fields synced.
</p>
@param origin
@param value
@return
@since 0.9.2
"""
Calendar cal = sync((Calendar) origin.clone());
cal.add(Calendar.DATE, value);
return sync(cal);
} | java | public static Calendar addDays(Calendar origin, int value) {
Calendar cal = sync((Calendar) origin.clone());
cal.add(Calendar.DATE, value);
return sync(cal);
} | [
"public",
"static",
"Calendar",
"addDays",
"(",
"Calendar",
"origin",
",",
"int",
"value",
")",
"{",
"Calendar",
"cal",
"=",
"sync",
"(",
"(",
"Calendar",
")",
"origin",
".",
"clone",
"(",
")",
")",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
"DATE",
",",
"value",
")",
";",
"return",
"sync",
"(",
"cal",
")",
";",
"}"
] | Add/Subtract the specified amount of days to the given {@link Calendar}.
<p>
The returned {@link Calendar} has its fields synced.
</p>
@param origin
@param value
@return
@since 0.9.2 | [
"Add",
"/",
"Subtract",
"the",
"specified",
"amount",
"of",
"days",
"to",
"the",
"given",
"{",
"@link",
"Calendar",
"}",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java#L576-L580 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java | NormalizerSerializer.write | public void write(@NonNull Normalizer normalizer, @NonNull File file) throws IOException {
"""
Serialize a normalizer to the given file
@param normalizer the normalizer
@param file the destination file
@throws IOException
"""
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(file))) {
write(normalizer, out);
}
} | java | public void write(@NonNull Normalizer normalizer, @NonNull File file) throws IOException {
try (OutputStream out = new BufferedOutputStream(new FileOutputStream(file))) {
write(normalizer, out);
}
} | [
"public",
"void",
"write",
"(",
"@",
"NonNull",
"Normalizer",
"normalizer",
",",
"@",
"NonNull",
"File",
"file",
")",
"throws",
"IOException",
"{",
"try",
"(",
"OutputStream",
"out",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
")",
"{",
"write",
"(",
"normalizer",
",",
"out",
")",
";",
"}",
"}"
] | Serialize a normalizer to the given file
@param normalizer the normalizer
@param file the destination file
@throws IOException | [
"Serialize",
"a",
"normalizer",
"to",
"the",
"given",
"file"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/serializer/NormalizerSerializer.java#L46-L50 |
h2oai/h2o-2 | src/main/java/water/fvec/NewChunk.java | NewChunk.set_impl | @Override boolean set_impl(int i, long l) {
"""
in-range and refer to the inflated values of the original Chunk.
"""
if( _ds != null ) return set_impl(i,(double)l);
if(_sparseLen != _len){ // sparse?
int idx = Arrays.binarySearch(_id,0,_sparseLen,i);
if(idx >= 0)i = idx;
else cancel_sparse(); // for now don't bother setting the sparse value
}
_ls[i]=l; _xs[i]=0;
_naCnt = -1;
return true;
} | java | @Override boolean set_impl(int i, long l) {
if( _ds != null ) return set_impl(i,(double)l);
if(_sparseLen != _len){ // sparse?
int idx = Arrays.binarySearch(_id,0,_sparseLen,i);
if(idx >= 0)i = idx;
else cancel_sparse(); // for now don't bother setting the sparse value
}
_ls[i]=l; _xs[i]=0;
_naCnt = -1;
return true;
} | [
"@",
"Override",
"boolean",
"set_impl",
"(",
"int",
"i",
",",
"long",
"l",
")",
"{",
"if",
"(",
"_ds",
"!=",
"null",
")",
"return",
"set_impl",
"(",
"i",
",",
"(",
"double",
")",
"l",
")",
";",
"if",
"(",
"_sparseLen",
"!=",
"_len",
")",
"{",
"// sparse?",
"int",
"idx",
"=",
"Arrays",
".",
"binarySearch",
"(",
"_id",
",",
"0",
",",
"_sparseLen",
",",
"i",
")",
";",
"if",
"(",
"idx",
">=",
"0",
")",
"i",
"=",
"idx",
";",
"else",
"cancel_sparse",
"(",
")",
";",
"// for now don't bother setting the sparse value",
"}",
"_ls",
"[",
"i",
"]",
"=",
"l",
";",
"_xs",
"[",
"i",
"]",
"=",
"0",
";",
"_naCnt",
"=",
"-",
"1",
";",
"return",
"true",
";",
"}"
] | in-range and refer to the inflated values of the original Chunk. | [
"in",
"-",
"range",
"and",
"refer",
"to",
"the",
"inflated",
"values",
"of",
"the",
"original",
"Chunk",
"."
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/NewChunk.java#L976-L986 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java | AbstractHttpTransport.createFeatureListResource | protected IResource createFeatureListResource(List<String> list, URI uri, long lastmod) {
"""
Creates an {@link IResource} object for the dependent feature list AMD
module
@param list
the dependent features list
@param uri
the resource URI
@param lastmod
the last modified time of the resource
@return the {@link IResource} object for the module
"""
JSONArray json;
try {
json = new JSONArray(new ArrayList<String>(dependentFeatures));
} catch (JSONException ex) {
return new ExceptionResource(uri, lastmod, new IOException(ex));
}
StringBuffer sb = new StringBuffer();
sb.append(FEATURE_LIST_PRELUDE).append(json).append(FEATURE_LIST_PROLOGUE);
IResource result = new StringResource(sb.toString(), uri, lastmod);
return result;
} | java | protected IResource createFeatureListResource(List<String> list, URI uri, long lastmod) {
JSONArray json;
try {
json = new JSONArray(new ArrayList<String>(dependentFeatures));
} catch (JSONException ex) {
return new ExceptionResource(uri, lastmod, new IOException(ex));
}
StringBuffer sb = new StringBuffer();
sb.append(FEATURE_LIST_PRELUDE).append(json).append(FEATURE_LIST_PROLOGUE);
IResource result = new StringResource(sb.toString(), uri, lastmod);
return result;
} | [
"protected",
"IResource",
"createFeatureListResource",
"(",
"List",
"<",
"String",
">",
"list",
",",
"URI",
"uri",
",",
"long",
"lastmod",
")",
"{",
"JSONArray",
"json",
";",
"try",
"{",
"json",
"=",
"new",
"JSONArray",
"(",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"dependentFeatures",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"ex",
")",
"{",
"return",
"new",
"ExceptionResource",
"(",
"uri",
",",
"lastmod",
",",
"new",
"IOException",
"(",
"ex",
")",
")",
";",
"}",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sb",
".",
"append",
"(",
"FEATURE_LIST_PRELUDE",
")",
".",
"append",
"(",
"json",
")",
".",
"append",
"(",
"FEATURE_LIST_PROLOGUE",
")",
";",
"IResource",
"result",
"=",
"new",
"StringResource",
"(",
"sb",
".",
"toString",
"(",
")",
",",
"uri",
",",
"lastmod",
")",
";",
"return",
"result",
";",
"}"
] | Creates an {@link IResource} object for the dependent feature list AMD
module
@param list
the dependent features list
@param uri
the resource URI
@param lastmod
the last modified time of the resource
@return the {@link IResource} object for the module | [
"Creates",
"an",
"{",
"@link",
"IResource",
"}",
"object",
"for",
"the",
"dependent",
"feature",
"list",
"AMD",
"module"
] | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/AbstractHttpTransport.java#L1090-L1101 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.getDHOffset2 | protected int getDHOffset2(byte[] handshake, int bufferOffset) {
"""
Returns the DH byte offset.
@param handshake handshake sequence
@param bufferOffset buffer offset
@return dh offset
"""
bufferOffset += 768;
int offset = handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
int res = (offset % 632) + 8;
if (res + KEY_LENGTH > 767) {
log.error("Invalid DH offset");
}
return res;
} | java | protected int getDHOffset2(byte[] handshake, int bufferOffset) {
bufferOffset += 768;
int offset = handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
int res = (offset % 632) + 8;
if (res + KEY_LENGTH > 767) {
log.error("Invalid DH offset");
}
return res;
} | [
"protected",
"int",
"getDHOffset2",
"(",
"byte",
"[",
"]",
"handshake",
",",
"int",
"bufferOffset",
")",
"{",
"bufferOffset",
"+=",
"768",
";",
"int",
"offset",
"=",
"handshake",
"[",
"bufferOffset",
"]",
"&",
"0xff",
";",
"bufferOffset",
"++",
";",
"offset",
"+=",
"handshake",
"[",
"bufferOffset",
"]",
"&",
"0xff",
";",
"bufferOffset",
"++",
";",
"offset",
"+=",
"handshake",
"[",
"bufferOffset",
"]",
"&",
"0xff",
";",
"bufferOffset",
"++",
";",
"offset",
"+=",
"handshake",
"[",
"bufferOffset",
"]",
"&",
"0xff",
";",
"int",
"res",
"=",
"(",
"offset",
"%",
"632",
")",
"+",
"8",
";",
"if",
"(",
"res",
"+",
"KEY_LENGTH",
">",
"767",
")",
"{",
"log",
".",
"error",
"(",
"\"Invalid DH offset\"",
")",
";",
"}",
"return",
"res",
";",
"}"
] | Returns the DH byte offset.
@param handshake handshake sequence
@param bufferOffset buffer offset
@return dh offset | [
"Returns",
"the",
"DH",
"byte",
"offset",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L467-L481 |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/security/OSecurityManager.java | OSecurityManager.digest2String | public String digest2String(final String iInput, final boolean iIncludeAlgorithm) {
"""
Hashes the input string.
@param iInput
String to hash
@param iIncludeAlgorithm
Include the algorithm used or not
@return
"""
final StringBuilder buffer = new StringBuilder();
if (iIncludeAlgorithm)
buffer.append(ALGORITHM_PREFIX);
buffer.append(OSecurityManager.instance().digest2String(iInput));
return buffer.toString();
} | java | public String digest2String(final String iInput, final boolean iIncludeAlgorithm) {
final StringBuilder buffer = new StringBuilder();
if (iIncludeAlgorithm)
buffer.append(ALGORITHM_PREFIX);
buffer.append(OSecurityManager.instance().digest2String(iInput));
return buffer.toString();
} | [
"public",
"String",
"digest2String",
"(",
"final",
"String",
"iInput",
",",
"final",
"boolean",
"iIncludeAlgorithm",
")",
"{",
"final",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"iIncludeAlgorithm",
")",
"buffer",
".",
"append",
"(",
"ALGORITHM_PREFIX",
")",
";",
"buffer",
".",
"append",
"(",
"OSecurityManager",
".",
"instance",
"(",
")",
".",
"digest2String",
"(",
"iInput",
")",
")",
";",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] | Hashes the input string.
@param iInput
String to hash
@param iIncludeAlgorithm
Include the algorithm used or not
@return | [
"Hashes",
"the",
"input",
"string",
"."
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/security/OSecurityManager.java#L77-L85 |
JOML-CI/JOML | src/org/joml/Vector3d.java | Vector3d.set | public Vector3d set(int index, ByteBuffer buffer) {
"""
Read this vector from the supplied {@link ByteBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given ByteBuffer.
@param index
the absolute position into the ByteBuffer
@param buffer
values will be read in <code>x, y, z</code> order
@return this
"""
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | java | public Vector3d set(int index, ByteBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | [
"public",
"Vector3d",
"set",
"(",
"int",
"index",
",",
"ByteBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"get",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"this",
";",
"}"
] | Read this vector from the supplied {@link ByteBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given ByteBuffer.
@param index
the absolute position into the ByteBuffer
@param buffer
values will be read in <code>x, y, z</code> order
@return this | [
"Read",
"this",
"vector",
"from",
"the",
"supplied",
"{",
"@link",
"ByteBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
".",
"<p",
">",
"This",
"method",
"will",
"not",
"increment",
"the",
"position",
"of",
"the",
"given",
"ByteBuffer",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3d.java#L390-L393 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java | SeaGlassLookAndFeel.getPaintingInsets | public static Insets getPaintingInsets(SynthContext state, Insets insets) {
"""
A convenience method to return where the foreground should be painted for
the Component identified by the passed in AbstractSynthContext.
@param state the SynthContext representing the current state.
@param insets an Insets object to be filled with the painting insets.
@return the insets object passed in and filled with the painting insets.
"""
if (state.getRegion().isSubregion()) {
insets = state.getStyle().getInsets(state, insets);
} else {
insets = state.getComponent().getInsets(insets);
}
return insets;
} | java | public static Insets getPaintingInsets(SynthContext state, Insets insets) {
if (state.getRegion().isSubregion()) {
insets = state.getStyle().getInsets(state, insets);
} else {
insets = state.getComponent().getInsets(insets);
}
return insets;
} | [
"public",
"static",
"Insets",
"getPaintingInsets",
"(",
"SynthContext",
"state",
",",
"Insets",
"insets",
")",
"{",
"if",
"(",
"state",
".",
"getRegion",
"(",
")",
".",
"isSubregion",
"(",
")",
")",
"{",
"insets",
"=",
"state",
".",
"getStyle",
"(",
")",
".",
"getInsets",
"(",
"state",
",",
"insets",
")",
";",
"}",
"else",
"{",
"insets",
"=",
"state",
".",
"getComponent",
"(",
")",
".",
"getInsets",
"(",
"insets",
")",
";",
"}",
"return",
"insets",
";",
"}"
] | A convenience method to return where the foreground should be painted for
the Component identified by the passed in AbstractSynthContext.
@param state the SynthContext representing the current state.
@param insets an Insets object to be filled with the painting insets.
@return the insets object passed in and filled with the painting insets. | [
"A",
"convenience",
"method",
"to",
"return",
"where",
"the",
"foreground",
"should",
"be",
"painted",
"for",
"the",
"Component",
"identified",
"by",
"the",
"passed",
"in",
"AbstractSynthContext",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2522-L2530 |
dbracewell/mango | src/main/java/com/davidbracewell/conversion/Val.java | Val.asMap | public <K, V> Map<K, V> asMap(Class<K> keyClass, Class<V> valueClass) {
"""
Converts the object to a map
@param <K> the type parameter
@param <V> the type parameter
@param keyClass The key class
@param valueClass The value class
@return the object as a map
"""
return asMap(HashMap.class, keyClass, valueClass);
} | java | public <K, V> Map<K, V> asMap(Class<K> keyClass, Class<V> valueClass) {
return asMap(HashMap.class, keyClass, valueClass);
} | [
"public",
"<",
"K",
",",
"V",
">",
"Map",
"<",
"K",
",",
"V",
">",
"asMap",
"(",
"Class",
"<",
"K",
">",
"keyClass",
",",
"Class",
"<",
"V",
">",
"valueClass",
")",
"{",
"return",
"asMap",
"(",
"HashMap",
".",
"class",
",",
"keyClass",
",",
"valueClass",
")",
";",
"}"
] | Converts the object to a map
@param <K> the type parameter
@param <V> the type parameter
@param keyClass The key class
@param valueClass The value class
@return the object as a map | [
"Converts",
"the",
"object",
"to",
"a",
"map"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/conversion/Val.java#L143-L145 |
YahooArchive/samoa | samoa-threads/src/main/java/com/yahoo/labs/samoa/topology/impl/ThreadsProcessingItem.java | ThreadsProcessingItem.setupInstances | public void setupInstances() {
"""
/*
Setup the replicas of this PI.
This should be called after the topology is set up (all Processors and PIs are
setup and connected to the respective streams) and before events are sent.
"""
this.piInstances = new ArrayList<ThreadsProcessingItemInstance>(this.getParallelism());
for (int i=0; i<this.getParallelism(); i++) {
Processor newProcessor = this.getProcessor().newProcessor(this.getProcessor());
newProcessor.onCreate(i + 1);
this.piInstances.add(new ThreadsProcessingItemInstance(newProcessor, this.offset + i));
}
} | java | public void setupInstances() {
this.piInstances = new ArrayList<ThreadsProcessingItemInstance>(this.getParallelism());
for (int i=0; i<this.getParallelism(); i++) {
Processor newProcessor = this.getProcessor().newProcessor(this.getProcessor());
newProcessor.onCreate(i + 1);
this.piInstances.add(new ThreadsProcessingItemInstance(newProcessor, this.offset + i));
}
} | [
"public",
"void",
"setupInstances",
"(",
")",
"{",
"this",
".",
"piInstances",
"=",
"new",
"ArrayList",
"<",
"ThreadsProcessingItemInstance",
">",
"(",
"this",
".",
"getParallelism",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"getParallelism",
"(",
")",
";",
"i",
"++",
")",
"{",
"Processor",
"newProcessor",
"=",
"this",
".",
"getProcessor",
"(",
")",
".",
"newProcessor",
"(",
"this",
".",
"getProcessor",
"(",
")",
")",
";",
"newProcessor",
".",
"onCreate",
"(",
"i",
"+",
"1",
")",
";",
"this",
".",
"piInstances",
".",
"add",
"(",
"new",
"ThreadsProcessingItemInstance",
"(",
"newProcessor",
",",
"this",
".",
"offset",
"+",
"i",
")",
")",
";",
"}",
"}"
] | /*
Setup the replicas of this PI.
This should be called after the topology is set up (all Processors and PIs are
setup and connected to the respective streams) and before events are sent. | [
"/",
"*",
"Setup",
"the",
"replicas",
"of",
"this",
"PI",
".",
"This",
"should",
"be",
"called",
"after",
"the",
"topology",
"is",
"set",
"up",
"(",
"all",
"Processors",
"and",
"PIs",
"are",
"setup",
"and",
"connected",
"to",
"the",
"respective",
"streams",
")",
"and",
"before",
"events",
"are",
"sent",
"."
] | train | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-threads/src/main/java/com/yahoo/labs/samoa/topology/impl/ThreadsProcessingItem.java#L92-L99 |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.putCharLittleEndian | public final void putCharLittleEndian(int index, char value) {
"""
Writes the given character (16 bit, 2 bytes) to the given position in little-endian
byte order. This method's speed depends on the system's native byte order, and it
is possibly slower than {@link #putChar(int, char)}. For most cases (such as
transient storage in memory or serialization for I/O and network),
it suffices to know that the byte order in which the value is written is the same as the
one in which it is read, and {@link #putChar(int, char)} is the preferable choice.
@param index The position at which the value will be written.
@param value The char value to be written.
@throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2.
"""
if (LITTLE_ENDIAN) {
putChar(index, value);
} else {
putChar(index, Character.reverseBytes(value));
}
} | java | public final void putCharLittleEndian(int index, char value) {
if (LITTLE_ENDIAN) {
putChar(index, value);
} else {
putChar(index, Character.reverseBytes(value));
}
} | [
"public",
"final",
"void",
"putCharLittleEndian",
"(",
"int",
"index",
",",
"char",
"value",
")",
"{",
"if",
"(",
"LITTLE_ENDIAN",
")",
"{",
"putChar",
"(",
"index",
",",
"value",
")",
";",
"}",
"else",
"{",
"putChar",
"(",
"index",
",",
"Character",
".",
"reverseBytes",
"(",
"value",
")",
")",
";",
"}",
"}"
] | Writes the given character (16 bit, 2 bytes) to the given position in little-endian
byte order. This method's speed depends on the system's native byte order, and it
is possibly slower than {@link #putChar(int, char)}. For most cases (such as
transient storage in memory or serialization for I/O and network),
it suffices to know that the byte order in which the value is written is the same as the
one in which it is read, and {@link #putChar(int, char)} is the preferable choice.
@param index The position at which the value will be written.
@param value The char value to be written.
@throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2. | [
"Writes",
"the",
"given",
"character",
"(",
"16",
"bit",
"2",
"bytes",
")",
"to",
"the",
"given",
"position",
"in",
"little",
"-",
"endian",
"byte",
"order",
".",
"This",
"method",
"s",
"speed",
"depends",
"on",
"the",
"system",
"s",
"native",
"byte",
"order",
"and",
"it",
"is",
"possibly",
"slower",
"than",
"{",
"@link",
"#putChar",
"(",
"int",
"char",
")",
"}",
".",
"For",
"most",
"cases",
"(",
"such",
"as",
"transient",
"storage",
"in",
"memory",
"or",
"serialization",
"for",
"I",
"/",
"O",
"and",
"network",
")",
"it",
"suffices",
"to",
"know",
"that",
"the",
"byte",
"order",
"in",
"which",
"the",
"value",
"is",
"written",
"is",
"the",
"same",
"as",
"the",
"one",
"in",
"which",
"it",
"is",
"read",
"and",
"{",
"@link",
"#putChar",
"(",
"int",
"char",
")",
"}",
"is",
"the",
"preferable",
"choice",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L515-L521 |
jboss/jboss-jstl-api_spec | src/main/java/javax/servlet/jsp/jstl/sql/ResultSupport.java | ResultSupport.toResult | public static Result toResult(ResultSet rs, int maxRows) {
"""
Converts <code>maxRows</code> of a <code>ResultSet</code> object to a
<code>Result</code> object.
@param rs the <code>ResultSet</code> object
@param maxRows the maximum number of rows to be cached into the <code>Result</code> object.
@return The <code>Result</code> object created from the <code>ResultSet</code>,
limited by <code>maxRows</code>
"""
try {
return new ResultImpl(rs, -1, maxRows);
} catch (SQLException ex) {
return null;
}
} | java | public static Result toResult(ResultSet rs, int maxRows) {
try {
return new ResultImpl(rs, -1, maxRows);
} catch (SQLException ex) {
return null;
}
} | [
"public",
"static",
"Result",
"toResult",
"(",
"ResultSet",
"rs",
",",
"int",
"maxRows",
")",
"{",
"try",
"{",
"return",
"new",
"ResultImpl",
"(",
"rs",
",",
"-",
"1",
",",
"maxRows",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Converts <code>maxRows</code> of a <code>ResultSet</code> object to a
<code>Result</code> object.
@param rs the <code>ResultSet</code> object
@param maxRows the maximum number of rows to be cached into the <code>Result</code> object.
@return The <code>Result</code> object created from the <code>ResultSet</code>,
limited by <code>maxRows</code> | [
"Converts",
"<code",
">",
"maxRows<",
"/",
"code",
">",
"of",
"a",
"<code",
">",
"ResultSet<",
"/",
"code",
">",
"object",
"to",
"a",
"<code",
">",
"Result<",
"/",
"code",
">",
"object",
"."
] | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/javax/servlet/jsp/jstl/sql/ResultSupport.java#L60-L66 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java | CommerceSubscriptionEntryPersistenceImpl.findBySubscriptionStatus | @Override
public List<CommerceSubscriptionEntry> findBySubscriptionStatus(
int subscriptionStatus, int start, int end) {
"""
Returns a range of all the commerce subscription entries where subscriptionStatus = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceSubscriptionEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param subscriptionStatus the subscription status
@param start the lower bound of the range of commerce subscription entries
@param end the upper bound of the range of commerce subscription entries (not inclusive)
@return the range of matching commerce subscription entries
"""
return findBySubscriptionStatus(subscriptionStatus, start, end, null);
} | java | @Override
public List<CommerceSubscriptionEntry> findBySubscriptionStatus(
int subscriptionStatus, int start, int end) {
return findBySubscriptionStatus(subscriptionStatus, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceSubscriptionEntry",
">",
"findBySubscriptionStatus",
"(",
"int",
"subscriptionStatus",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findBySubscriptionStatus",
"(",
"subscriptionStatus",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce subscription entries where subscriptionStatus = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceSubscriptionEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param subscriptionStatus the subscription status
@param start the lower bound of the range of commerce subscription entries
@param end the upper bound of the range of commerce subscription entries (not inclusive)
@return the range of matching commerce subscription entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"subscription",
"entries",
"where",
"subscriptionStatus",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java#L2070-L2074 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseSparseNDArrayCOO.java | BaseSparseNDArrayCOO.checkBufferCoherence | protected void checkBufferCoherence() {
"""
Check that the length of indices and values are coherent and matches the rank of the matrix.
"""
if (values.length() < length){
throw new IllegalStateException("nnz is larger than capacity of buffers");
}
if (values.length() * rank() != indices.length()){
throw new IllegalArgumentException("Sizes of values, indices and shape are incoherent.");
}
} | java | protected void checkBufferCoherence(){
if (values.length() < length){
throw new IllegalStateException("nnz is larger than capacity of buffers");
}
if (values.length() * rank() != indices.length()){
throw new IllegalArgumentException("Sizes of values, indices and shape are incoherent.");
}
} | [
"protected",
"void",
"checkBufferCoherence",
"(",
")",
"{",
"if",
"(",
"values",
".",
"length",
"(",
")",
"<",
"length",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"nnz is larger than capacity of buffers\"",
")",
";",
"}",
"if",
"(",
"values",
".",
"length",
"(",
")",
"*",
"rank",
"(",
")",
"!=",
"indices",
".",
"length",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Sizes of values, indices and shape are incoherent.\"",
")",
";",
"}",
"}"
] | Check that the length of indices and values are coherent and matches the rank of the matrix. | [
"Check",
"that",
"the",
"length",
"of",
"indices",
"and",
"values",
"are",
"coherent",
"and",
"matches",
"the",
"rank",
"of",
"the",
"matrix",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseSparseNDArrayCOO.java#L143-L151 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java | StepPattern.fixupVariables | public void fixupVariables(java.util.Vector vars, int globalsSize) {
"""
This function is used to fixup variables from QNames to stack frame
indexes at stylesheet build time.
@param vars List of QNames that correspond to variables. This list
should be searched backwards for the first qualified name that
corresponds to the variable reference qname. The position of the
QName in the vector from the start of the vector will be its position
in the stack frame (but variables above the globalsTop value will need
to be offset to the current stack frame).
@param globalsSize The number of variables in the global variable area.
"""
super.fixupVariables(vars, globalsSize);
if (null != m_predicates)
{
for (int i = 0; i < m_predicates.length; i++)
{
m_predicates[i].fixupVariables(vars, globalsSize);
}
}
if (null != m_relativePathPattern)
{
m_relativePathPattern.fixupVariables(vars, globalsSize);
}
} | java | public void fixupVariables(java.util.Vector vars, int globalsSize)
{
super.fixupVariables(vars, globalsSize);
if (null != m_predicates)
{
for (int i = 0; i < m_predicates.length; i++)
{
m_predicates[i].fixupVariables(vars, globalsSize);
}
}
if (null != m_relativePathPattern)
{
m_relativePathPattern.fixupVariables(vars, globalsSize);
}
} | [
"public",
"void",
"fixupVariables",
"(",
"java",
".",
"util",
".",
"Vector",
"vars",
",",
"int",
"globalsSize",
")",
"{",
"super",
".",
"fixupVariables",
"(",
"vars",
",",
"globalsSize",
")",
";",
"if",
"(",
"null",
"!=",
"m_predicates",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_predicates",
".",
"length",
";",
"i",
"++",
")",
"{",
"m_predicates",
"[",
"i",
"]",
".",
"fixupVariables",
"(",
"vars",
",",
"globalsSize",
")",
";",
"}",
"}",
"if",
"(",
"null",
"!=",
"m_relativePathPattern",
")",
"{",
"m_relativePathPattern",
".",
"fixupVariables",
"(",
"vars",
",",
"globalsSize",
")",
";",
"}",
"}"
] | This function is used to fixup variables from QNames to stack frame
indexes at stylesheet build time.
@param vars List of QNames that correspond to variables. This list
should be searched backwards for the first qualified name that
corresponds to the variable reference qname. The position of the
QName in the vector from the start of the vector will be its position
in the stack frame (but variables above the globalsTop value will need
to be offset to the current stack frame).
@param globalsSize The number of variables in the global variable area. | [
"This",
"function",
"is",
"used",
"to",
"fixup",
"variables",
"from",
"QNames",
"to",
"stack",
"frame",
"indexes",
"at",
"stylesheet",
"build",
"time",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java#L158-L175 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/resourceIndex/ResourceIndexImpl.java | ResourceIndexImpl.updateTriples | private void updateTriples(Set<Triple> set, boolean delete)
throws ResourceIndexException {
"""
Applies the given adds or deletes to the triplestore. If _syncUpdates is
true, changes will be flushed before returning.
"""
try {
if (delete) {
_writer.delete(getTripleIterator(set), _syncUpdates);
} else {
_writer.add(getTripleIterator(set), _syncUpdates);
}
} catch (Exception e) {
throw new ResourceIndexException("Error updating triples", e);
}
} | java | private void updateTriples(Set<Triple> set, boolean delete)
throws ResourceIndexException {
try {
if (delete) {
_writer.delete(getTripleIterator(set), _syncUpdates);
} else {
_writer.add(getTripleIterator(set), _syncUpdates);
}
} catch (Exception e) {
throw new ResourceIndexException("Error updating triples", e);
}
} | [
"private",
"void",
"updateTriples",
"(",
"Set",
"<",
"Triple",
">",
"set",
",",
"boolean",
"delete",
")",
"throws",
"ResourceIndexException",
"{",
"try",
"{",
"if",
"(",
"delete",
")",
"{",
"_writer",
".",
"delete",
"(",
"getTripleIterator",
"(",
"set",
")",
",",
"_syncUpdates",
")",
";",
"}",
"else",
"{",
"_writer",
".",
"add",
"(",
"getTripleIterator",
"(",
"set",
")",
",",
"_syncUpdates",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"ResourceIndexException",
"(",
"\"Error updating triples\"",
",",
"e",
")",
";",
"}",
"}"
] | Applies the given adds or deletes to the triplestore. If _syncUpdates is
true, changes will be flushed before returning. | [
"Applies",
"the",
"given",
"adds",
"or",
"deletes",
"to",
"the",
"triplestore",
".",
"If",
"_syncUpdates",
"is",
"true",
"changes",
"will",
"be",
"flushed",
"before",
"returning",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/resourceIndex/ResourceIndexImpl.java#L159-L170 |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/AttributeValidator.java | AttributeValidator.validateMappedBy | private static void validateMappedBy(Attribute attr, Attribute mappedByAttr) {
"""
Validate whether the mappedBy attribute is part of the referenced entity.
@param attr attribute
@param mappedByAttr mappedBy attribute
@throws MolgenisDataException if mappedBy is an attribute that is not part of the referenced
entity
"""
if (mappedByAttr != null) {
if (!isSingleReferenceType(mappedByAttr)) {
throw new MolgenisDataException(
format(
"Invalid mappedBy attribute [%s] data type [%s].",
mappedByAttr.getName(), mappedByAttr.getDataType()));
}
Attribute refAttr = attr.getRefEntity().getAttribute(mappedByAttr.getName());
if (refAttr == null) {
throw new MolgenisDataException(
format(
"mappedBy attribute [%s] is not part of entity [%s].",
mappedByAttr.getName(), attr.getRefEntity().getId()));
}
}
} | java | private static void validateMappedBy(Attribute attr, Attribute mappedByAttr) {
if (mappedByAttr != null) {
if (!isSingleReferenceType(mappedByAttr)) {
throw new MolgenisDataException(
format(
"Invalid mappedBy attribute [%s] data type [%s].",
mappedByAttr.getName(), mappedByAttr.getDataType()));
}
Attribute refAttr = attr.getRefEntity().getAttribute(mappedByAttr.getName());
if (refAttr == null) {
throw new MolgenisDataException(
format(
"mappedBy attribute [%s] is not part of entity [%s].",
mappedByAttr.getName(), attr.getRefEntity().getId()));
}
}
} | [
"private",
"static",
"void",
"validateMappedBy",
"(",
"Attribute",
"attr",
",",
"Attribute",
"mappedByAttr",
")",
"{",
"if",
"(",
"mappedByAttr",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"isSingleReferenceType",
"(",
"mappedByAttr",
")",
")",
"{",
"throw",
"new",
"MolgenisDataException",
"(",
"format",
"(",
"\"Invalid mappedBy attribute [%s] data type [%s].\"",
",",
"mappedByAttr",
".",
"getName",
"(",
")",
",",
"mappedByAttr",
".",
"getDataType",
"(",
")",
")",
")",
";",
"}",
"Attribute",
"refAttr",
"=",
"attr",
".",
"getRefEntity",
"(",
")",
".",
"getAttribute",
"(",
"mappedByAttr",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"refAttr",
"==",
"null",
")",
"{",
"throw",
"new",
"MolgenisDataException",
"(",
"format",
"(",
"\"mappedBy attribute [%s] is not part of entity [%s].\"",
",",
"mappedByAttr",
".",
"getName",
"(",
")",
",",
"attr",
".",
"getRefEntity",
"(",
")",
".",
"getId",
"(",
")",
")",
")",
";",
"}",
"}",
"}"
] | Validate whether the mappedBy attribute is part of the referenced entity.
@param attr attribute
@param mappedByAttr mappedBy attribute
@throws MolgenisDataException if mappedBy is an attribute that is not part of the referenced
entity | [
"Validate",
"whether",
"the",
"mappedBy",
"attribute",
"is",
"part",
"of",
"the",
"referenced",
"entity",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/AttributeValidator.java#L296-L313 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/script/Script.java | Script.getNumberOfBytesRequiredToSpend | public int getNumberOfBytesRequiredToSpend(@Nullable ECKey pubKey, @Nullable Script redeemScript) {
"""
Returns number of bytes required to spend this script. It accepts optional ECKey and redeemScript that may
be required for certain types of script to estimate target size.
"""
if (ScriptPattern.isP2SH(this)) {
// scriptSig: <sig> [sig] [sig...] <redeemscript>
checkArgument(redeemScript != null, "P2SH script requires redeemScript to be spent");
return redeemScript.getNumberOfSignaturesRequiredToSpend() * SIG_SIZE + redeemScript.getProgram().length;
} else if (ScriptPattern.isSentToMultisig(this)) {
// scriptSig: OP_0 <sig> [sig] [sig...]
return getNumberOfSignaturesRequiredToSpend() * SIG_SIZE + 1;
} else if (ScriptPattern.isP2PK(this)) {
// scriptSig: <sig>
return SIG_SIZE;
} else if (ScriptPattern.isP2PKH(this)) {
// scriptSig: <sig> <pubkey>
int uncompressedPubKeySize = 65; // very conservative
return SIG_SIZE + (pubKey != null ? pubKey.getPubKey().length : uncompressedPubKeySize);
} else if (ScriptPattern.isP2WPKH(this)) {
// scriptSig is empty
// witness: <sig> <pubKey>
int compressedPubKeySize = 33;
return SIG_SIZE + (pubKey != null ? pubKey.getPubKey().length : compressedPubKeySize);
} else {
throw new IllegalStateException("Unsupported script type");
}
} | java | public int getNumberOfBytesRequiredToSpend(@Nullable ECKey pubKey, @Nullable Script redeemScript) {
if (ScriptPattern.isP2SH(this)) {
// scriptSig: <sig> [sig] [sig...] <redeemscript>
checkArgument(redeemScript != null, "P2SH script requires redeemScript to be spent");
return redeemScript.getNumberOfSignaturesRequiredToSpend() * SIG_SIZE + redeemScript.getProgram().length;
} else if (ScriptPattern.isSentToMultisig(this)) {
// scriptSig: OP_0 <sig> [sig] [sig...]
return getNumberOfSignaturesRequiredToSpend() * SIG_SIZE + 1;
} else if (ScriptPattern.isP2PK(this)) {
// scriptSig: <sig>
return SIG_SIZE;
} else if (ScriptPattern.isP2PKH(this)) {
// scriptSig: <sig> <pubkey>
int uncompressedPubKeySize = 65; // very conservative
return SIG_SIZE + (pubKey != null ? pubKey.getPubKey().length : uncompressedPubKeySize);
} else if (ScriptPattern.isP2WPKH(this)) {
// scriptSig is empty
// witness: <sig> <pubKey>
int compressedPubKeySize = 33;
return SIG_SIZE + (pubKey != null ? pubKey.getPubKey().length : compressedPubKeySize);
} else {
throw new IllegalStateException("Unsupported script type");
}
} | [
"public",
"int",
"getNumberOfBytesRequiredToSpend",
"(",
"@",
"Nullable",
"ECKey",
"pubKey",
",",
"@",
"Nullable",
"Script",
"redeemScript",
")",
"{",
"if",
"(",
"ScriptPattern",
".",
"isP2SH",
"(",
"this",
")",
")",
"{",
"// scriptSig: <sig> [sig] [sig...] <redeemscript>",
"checkArgument",
"(",
"redeemScript",
"!=",
"null",
",",
"\"P2SH script requires redeemScript to be spent\"",
")",
";",
"return",
"redeemScript",
".",
"getNumberOfSignaturesRequiredToSpend",
"(",
")",
"*",
"SIG_SIZE",
"+",
"redeemScript",
".",
"getProgram",
"(",
")",
".",
"length",
";",
"}",
"else",
"if",
"(",
"ScriptPattern",
".",
"isSentToMultisig",
"(",
"this",
")",
")",
"{",
"// scriptSig: OP_0 <sig> [sig] [sig...]",
"return",
"getNumberOfSignaturesRequiredToSpend",
"(",
")",
"*",
"SIG_SIZE",
"+",
"1",
";",
"}",
"else",
"if",
"(",
"ScriptPattern",
".",
"isP2PK",
"(",
"this",
")",
")",
"{",
"// scriptSig: <sig>",
"return",
"SIG_SIZE",
";",
"}",
"else",
"if",
"(",
"ScriptPattern",
".",
"isP2PKH",
"(",
"this",
")",
")",
"{",
"// scriptSig: <sig> <pubkey>",
"int",
"uncompressedPubKeySize",
"=",
"65",
";",
"// very conservative",
"return",
"SIG_SIZE",
"+",
"(",
"pubKey",
"!=",
"null",
"?",
"pubKey",
".",
"getPubKey",
"(",
")",
".",
"length",
":",
"uncompressedPubKeySize",
")",
";",
"}",
"else",
"if",
"(",
"ScriptPattern",
".",
"isP2WPKH",
"(",
"this",
")",
")",
"{",
"// scriptSig is empty",
"// witness: <sig> <pubKey>",
"int",
"compressedPubKeySize",
"=",
"33",
";",
"return",
"SIG_SIZE",
"+",
"(",
"pubKey",
"!=",
"null",
"?",
"pubKey",
".",
"getPubKey",
"(",
")",
".",
"length",
":",
"compressedPubKeySize",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Unsupported script type\"",
")",
";",
"}",
"}"
] | Returns number of bytes required to spend this script. It accepts optional ECKey and redeemScript that may
be required for certain types of script to estimate target size. | [
"Returns",
"number",
"of",
"bytes",
"required",
"to",
"spend",
"this",
"script",
".",
"It",
"accepts",
"optional",
"ECKey",
"and",
"redeemScript",
"that",
"may",
"be",
"required",
"for",
"certain",
"types",
"of",
"script",
"to",
"estimate",
"target",
"size",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L611-L634 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/util/concurrent/UnsynchronizedRateLimiter.java | UnsynchronizedRateLimiter.tryAcquire | public boolean tryAcquire(int permits, long timeout, TimeUnit unit) {
"""
Acquires the given number of permits from this {@code UnsynchronizedRateLimiter} if it can be obtained
without exceeding the specified {@code timeout}, or returns {@code false}
immediately (without waiting) if the permits would not have been granted
before the timeout expired.
@param permits the number of permits to acquire
@param timeout the maximum time to wait for the permits
@param unit the time unit of the timeout argument
@return {@code true} if the permits were acquired, {@code false} otherwise
"""
long timeoutMicros = unit.toMicros(timeout);
checkPermits(permits);
long microsToWait;
long nowMicros = readSafeMicros();
if (nextFreeTicketMicros > nowMicros + timeoutMicros) {
return false;
} else {
microsToWait = reserveNextTicket(permits, nowMicros);
}
ticker.sleepMicrosUninterruptibly(microsToWait);
return true;
} | java | public boolean tryAcquire(int permits, long timeout, TimeUnit unit) {
long timeoutMicros = unit.toMicros(timeout);
checkPermits(permits);
long microsToWait;
long nowMicros = readSafeMicros();
if (nextFreeTicketMicros > nowMicros + timeoutMicros) {
return false;
} else {
microsToWait = reserveNextTicket(permits, nowMicros);
}
ticker.sleepMicrosUninterruptibly(microsToWait);
return true;
} | [
"public",
"boolean",
"tryAcquire",
"(",
"int",
"permits",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"long",
"timeoutMicros",
"=",
"unit",
".",
"toMicros",
"(",
"timeout",
")",
";",
"checkPermits",
"(",
"permits",
")",
";",
"long",
"microsToWait",
";",
"long",
"nowMicros",
"=",
"readSafeMicros",
"(",
")",
";",
"if",
"(",
"nextFreeTicketMicros",
">",
"nowMicros",
"+",
"timeoutMicros",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"microsToWait",
"=",
"reserveNextTicket",
"(",
"permits",
",",
"nowMicros",
")",
";",
"}",
"ticker",
".",
"sleepMicrosUninterruptibly",
"(",
"microsToWait",
")",
";",
"return",
"true",
";",
"}"
] | Acquires the given number of permits from this {@code UnsynchronizedRateLimiter} if it can be obtained
without exceeding the specified {@code timeout}, or returns {@code false}
immediately (without waiting) if the permits would not have been granted
before the timeout expired.
@param permits the number of permits to acquire
@param timeout the maximum time to wait for the permits
@param unit the time unit of the timeout argument
@return {@code true} if the permits were acquired, {@code false} otherwise | [
"Acquires",
"the",
"given",
"number",
"of",
"permits",
"from",
"this",
"{",
"@code",
"UnsynchronizedRateLimiter",
"}",
"if",
"it",
"can",
"be",
"obtained",
"without",
"exceeding",
"the",
"specified",
"{",
"@code",
"timeout",
"}",
"or",
"returns",
"{",
"@code",
"false",
"}",
"immediately",
"(",
"without",
"waiting",
")",
"if",
"the",
"permits",
"would",
"not",
"have",
"been",
"granted",
"before",
"the",
"timeout",
"expired",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/UnsynchronizedRateLimiter.java#L479-L491 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/macro/SarlProcessorInstanceForJvmTypeProvider.java | SarlProcessorInstanceForJvmTypeProvider.filterActiveProcessorType | public static JvmType filterActiveProcessorType(JvmType type, CommonTypeComputationServices services) {
"""
Filter the type in order to create the correct processor.
@param type the type of the processor specified into the {@code @Active} annotation.
@param services the type services of the framework.
@return the real type of the processor to instance.
"""
if (AccessorsProcessor.class.getName().equals(type.getQualifiedName())) {
return services.getTypeReferences().findDeclaredType(SarlAccessorsProcessor.class, type);
}
return type;
} | java | public static JvmType filterActiveProcessorType(JvmType type, CommonTypeComputationServices services) {
if (AccessorsProcessor.class.getName().equals(type.getQualifiedName())) {
return services.getTypeReferences().findDeclaredType(SarlAccessorsProcessor.class, type);
}
return type;
} | [
"public",
"static",
"JvmType",
"filterActiveProcessorType",
"(",
"JvmType",
"type",
",",
"CommonTypeComputationServices",
"services",
")",
"{",
"if",
"(",
"AccessorsProcessor",
".",
"class",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"type",
".",
"getQualifiedName",
"(",
")",
")",
")",
"{",
"return",
"services",
".",
"getTypeReferences",
"(",
")",
".",
"findDeclaredType",
"(",
"SarlAccessorsProcessor",
".",
"class",
",",
"type",
")",
";",
"}",
"return",
"type",
";",
"}"
] | Filter the type in order to create the correct processor.
@param type the type of the processor specified into the {@code @Active} annotation.
@param services the type services of the framework.
@return the real type of the processor to instance. | [
"Filter",
"the",
"type",
"in",
"order",
"to",
"create",
"the",
"correct",
"processor",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/macro/SarlProcessorInstanceForJvmTypeProvider.java#L59-L64 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.unwrapKeyAsync | public ServiceFuture<KeyOperationResult> unwrapKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value, final ServiceCallback<KeyOperationResult> serviceCallback) {
"""
Unwraps a symmetric key using the specified key that was initially used for wrapping that key.
The UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/unwrapKey permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key.
@param keyVersion The version of the key.
@param algorithm algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'
@param value the Base64Url value
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
"""
return ServiceFuture.fromResponse(unwrapKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value), serviceCallback);
} | java | public ServiceFuture<KeyOperationResult> unwrapKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value, final ServiceCallback<KeyOperationResult> serviceCallback) {
return ServiceFuture.fromResponse(unwrapKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"KeyOperationResult",
">",
"unwrapKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
",",
"String",
"keyVersion",
",",
"JsonWebKeyEncryptionAlgorithm",
"algorithm",
",",
"byte",
"[",
"]",
"value",
",",
"final",
"ServiceCallback",
"<",
"KeyOperationResult",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"unwrapKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
",",
"keyVersion",
",",
"algorithm",
",",
"value",
")",
",",
"serviceCallback",
")",
";",
"}"
] | Unwraps a symmetric key using the specified key that was initially used for wrapping that key.
The UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/unwrapKey permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key.
@param keyVersion The version of the key.
@param algorithm algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'
@param value the Base64Url value
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Unwraps",
"a",
"symmetric",
"key",
"using",
"the",
"specified",
"key",
"that",
"was",
"initially",
"used",
"for",
"wrapping",
"that",
"key",
".",
"The",
"UNWRAP",
"operation",
"supports",
"decryption",
"of",
"a",
"symmetric",
"key",
"using",
"the",
"target",
"key",
"encryption",
"key",
".",
"This",
"operation",
"is",
"the",
"reverse",
"of",
"the",
"WRAP",
"operation",
".",
"The",
"UNWRAP",
"operation",
"applies",
"to",
"asymmetric",
"and",
"symmetric",
"keys",
"stored",
"in",
"Azure",
"Key",
"Vault",
"since",
"it",
"uses",
"the",
"private",
"portion",
"of",
"the",
"key",
".",
"This",
"operation",
"requires",
"the",
"keys",
"/",
"unwrapKey",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L2731-L2733 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java | Workgroup.joinQueue | public void joinQueue(Form answerForm, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
<p>Joins the workgroup queue to wait to be routed to an agent. After joining
the queue, queue status events will be sent to indicate the user's position and
estimated time left in the queue. Once joining the queue, there are three ways
the user can leave the queue: <ul>
<li>The user is routed to an agent, which triggers a GroupChat invitation.
<li>The user asks to leave the queue by calling the {@link #departQueue} method.
<li>A server error occurs, or an administrator explicitly removes the user
from the queue.
</ul>
A user cannot request to join the queue again if already in the queue. Therefore,
this method will throw an IllegalStateException if the user is already in the queue.<p>
Some servers may be configured to require certain meta-data in order to
join the queue.<p>
The server tracks the conversations that a user has with agents over time. By
default, that tracking is done using the user's JID. However, this is not always
possible. For example, when the user is logged in anonymously using a web client.
In that case the user ID might be a randomly generated value put into a persistent
cookie or a username obtained via the session. When specified, that userID will
be used instead of the user's JID to track conversations. The server will ignore a
manually specified userID if the user's connection to the server is not anonymous.
@param answerForm the completed form associated with the join request.
@param userID String that represents the ID of the user when using anonymous sessions
or <tt>null</tt> if a userID should not be used.
@throws XMPPErrorException if an error occurred joining the queue. An error may indicate
that a connection failure occurred or that the server explicitly rejected the
request to join the queue.
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
"""
// If already in the queue ignore the join request.
if (inQueue) {
throw new IllegalStateException("Already in queue " + workgroupJID);
}
JoinQueuePacket joinPacket = new JoinQueuePacket(workgroupJID, answerForm, userID);
connection.createStanzaCollectorAndSend(joinPacket).nextResultOrThrow();
// Notify listeners that we've joined the queue.
fireQueueJoinedEvent();
} | java | public void joinQueue(Form answerForm, Jid userID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// If already in the queue ignore the join request.
if (inQueue) {
throw new IllegalStateException("Already in queue " + workgroupJID);
}
JoinQueuePacket joinPacket = new JoinQueuePacket(workgroupJID, answerForm, userID);
connection.createStanzaCollectorAndSend(joinPacket).nextResultOrThrow();
// Notify listeners that we've joined the queue.
fireQueueJoinedEvent();
} | [
"public",
"void",
"joinQueue",
"(",
"Form",
"answerForm",
",",
"Jid",
"userID",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// If already in the queue ignore the join request.",
"if",
"(",
"inQueue",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Already in queue \"",
"+",
"workgroupJID",
")",
";",
"}",
"JoinQueuePacket",
"joinPacket",
"=",
"new",
"JoinQueuePacket",
"(",
"workgroupJID",
",",
"answerForm",
",",
"userID",
")",
";",
"connection",
".",
"createStanzaCollectorAndSend",
"(",
"joinPacket",
")",
".",
"nextResultOrThrow",
"(",
")",
";",
"// Notify listeners that we've joined the queue.",
"fireQueueJoinedEvent",
"(",
")",
";",
"}"
] | <p>Joins the workgroup queue to wait to be routed to an agent. After joining
the queue, queue status events will be sent to indicate the user's position and
estimated time left in the queue. Once joining the queue, there are three ways
the user can leave the queue: <ul>
<li>The user is routed to an agent, which triggers a GroupChat invitation.
<li>The user asks to leave the queue by calling the {@link #departQueue} method.
<li>A server error occurs, or an administrator explicitly removes the user
from the queue.
</ul>
A user cannot request to join the queue again if already in the queue. Therefore,
this method will throw an IllegalStateException if the user is already in the queue.<p>
Some servers may be configured to require certain meta-data in order to
join the queue.<p>
The server tracks the conversations that a user has with agents over time. By
default, that tracking is done using the user's JID. However, this is not always
possible. For example, when the user is logged in anonymously using a web client.
In that case the user ID might be a randomly generated value put into a persistent
cookie or a username obtained via the session. When specified, that userID will
be used instead of the user's JID to track conversations. The server will ignore a
manually specified userID if the user's connection to the server is not anonymous.
@param answerForm the completed form associated with the join request.
@param userID String that represents the ID of the user when using anonymous sessions
or <tt>null</tt> if a userID should not be used.
@throws XMPPErrorException if an error occurred joining the queue. An error may indicate
that a connection failure occurred or that the server explicitly rejected the
request to join the queue.
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"<p",
">",
"Joins",
"the",
"workgroup",
"queue",
"to",
"wait",
"to",
"be",
"routed",
"to",
"an",
"agent",
".",
"After",
"joining",
"the",
"queue",
"queue",
"status",
"events",
"will",
"be",
"sent",
"to",
"indicate",
"the",
"user",
"s",
"position",
"and",
"estimated",
"time",
"left",
"in",
"the",
"queue",
".",
"Once",
"joining",
"the",
"queue",
"there",
"are",
"three",
"ways",
"the",
"user",
"can",
"leave",
"the",
"queue",
":",
"<ul",
">"
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java#L345-L356 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/corpus/dictionary/TFDictionary.java | TFDictionary.combine | public int combine(TFDictionary dictionary, int limit, boolean add) {
"""
合并自己(主词典)和某个词频词典
@param dictionary 某个词频词典
@param limit 如果该词频词典试图引入一个词语,其词频不得超过此limit(如果不需要使用limit功能,可以传入Integer.MAX_VALUE)
@param add 设为true则是词频叠加模式,否则是词频覆盖模式
@return 词条的增量
"""
int preSize = trie.size();
for (Map.Entry<String, TermFrequency> entry : dictionary.trie.entrySet())
{
TermFrequency termFrequency = trie.get(entry.getKey());
if (termFrequency == null)
{
trie.put(entry.getKey(), new TermFrequency(entry.getKey(), Math.min(limit, entry.getValue().getValue())));
}
else
{
if (add)
{
termFrequency.setValue(termFrequency.getValue() + Math.min(limit, entry.getValue().getValue()));
}
}
}
return trie.size() - preSize;
} | java | public int combine(TFDictionary dictionary, int limit, boolean add)
{
int preSize = trie.size();
for (Map.Entry<String, TermFrequency> entry : dictionary.trie.entrySet())
{
TermFrequency termFrequency = trie.get(entry.getKey());
if (termFrequency == null)
{
trie.put(entry.getKey(), new TermFrequency(entry.getKey(), Math.min(limit, entry.getValue().getValue())));
}
else
{
if (add)
{
termFrequency.setValue(termFrequency.getValue() + Math.min(limit, entry.getValue().getValue()));
}
}
}
return trie.size() - preSize;
} | [
"public",
"int",
"combine",
"(",
"TFDictionary",
"dictionary",
",",
"int",
"limit",
",",
"boolean",
"add",
")",
"{",
"int",
"preSize",
"=",
"trie",
".",
"size",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"TermFrequency",
">",
"entry",
":",
"dictionary",
".",
"trie",
".",
"entrySet",
"(",
")",
")",
"{",
"TermFrequency",
"termFrequency",
"=",
"trie",
".",
"get",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"if",
"(",
"termFrequency",
"==",
"null",
")",
"{",
"trie",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"new",
"TermFrequency",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"Math",
".",
"min",
"(",
"limit",
",",
"entry",
".",
"getValue",
"(",
")",
".",
"getValue",
"(",
")",
")",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"add",
")",
"{",
"termFrequency",
".",
"setValue",
"(",
"termFrequency",
".",
"getValue",
"(",
")",
"+",
"Math",
".",
"min",
"(",
"limit",
",",
"entry",
".",
"getValue",
"(",
")",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
"return",
"trie",
".",
"size",
"(",
")",
"-",
"preSize",
";",
"}"
] | 合并自己(主词典)和某个词频词典
@param dictionary 某个词频词典
@param limit 如果该词频词典试图引入一个词语,其词频不得超过此limit(如果不需要使用limit功能,可以传入Integer.MAX_VALUE)
@param add 设为true则是词频叠加模式,否则是词频覆盖模式
@return 词条的增量 | [
"合并自己(主词典)和某个词频词典"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/corpus/dictionary/TFDictionary.java#L55-L74 |
camunda/camunda-commons | logging/src/main/java/org/camunda/commons/logging/BaseLogger.java | BaseLogger.logError | protected void logError(String id, String messageTemplate, Object... parameters) {
"""
Logs an 'ERROR' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters
"""
if(delegateLogger.isErrorEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.error(msg, parameters);
}
} | java | protected void logError(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isErrorEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.error(msg, parameters);
}
} | [
"protected",
"void",
"logError",
"(",
"String",
"id",
",",
"String",
"messageTemplate",
",",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"delegateLogger",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"String",
"msg",
"=",
"formatMessageTemplate",
"(",
"id",
",",
"messageTemplate",
")",
";",
"delegateLogger",
".",
"error",
"(",
"msg",
",",
"parameters",
")",
";",
"}",
"}"
] | Logs an 'ERROR' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters | [
"Logs",
"an",
"ERROR",
"message"
] | train | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java#L157-L162 |
GoogleCloudPlatform/bigdata-interop | util/src/main/java/com/google/cloud/hadoop/util/AbstractGoogleAsyncWriteChannel.java | AbstractGoogleAsyncWriteChannel.waitForCompletionAndThrowIfUploadFailed | private S waitForCompletionAndThrowIfUploadFailed() throws IOException {
"""
Throws if upload operation failed. Propagates any errors.
@throws IOException on IO error
"""
try {
return uploadOperation.get();
} catch (InterruptedException e) {
// If we were interrupted, we need to cancel the upload operation.
uploadOperation.cancel(true);
IOException exception = new ClosedByInterruptException();
exception.addSuppressed(e);
throw exception;
} catch (ExecutionException e) {
if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
}
throw new IOException("Upload failed", e.getCause());
}
} | java | private S waitForCompletionAndThrowIfUploadFailed() throws IOException {
try {
return uploadOperation.get();
} catch (InterruptedException e) {
// If we were interrupted, we need to cancel the upload operation.
uploadOperation.cancel(true);
IOException exception = new ClosedByInterruptException();
exception.addSuppressed(e);
throw exception;
} catch (ExecutionException e) {
if (e.getCause() instanceof Error) {
throw (Error) e.getCause();
}
throw new IOException("Upload failed", e.getCause());
}
} | [
"private",
"S",
"waitForCompletionAndThrowIfUploadFailed",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"uploadOperation",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"// If we were interrupted, we need to cancel the upload operation.",
"uploadOperation",
".",
"cancel",
"(",
"true",
")",
";",
"IOException",
"exception",
"=",
"new",
"ClosedByInterruptException",
"(",
")",
";",
"exception",
".",
"addSuppressed",
"(",
"e",
")",
";",
"throw",
"exception",
";",
"}",
"catch",
"(",
"ExecutionException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getCause",
"(",
")",
"instanceof",
"Error",
")",
"{",
"throw",
"(",
"Error",
")",
"e",
".",
"getCause",
"(",
")",
";",
"}",
"throw",
"new",
"IOException",
"(",
"\"Upload failed\"",
",",
"e",
".",
"getCause",
"(",
")",
")",
";",
"}",
"}"
] | Throws if upload operation failed. Propagates any errors.
@throws IOException on IO error | [
"Throws",
"if",
"upload",
"operation",
"failed",
".",
"Propagates",
"any",
"errors",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/AbstractGoogleAsyncWriteChannel.java#L300-L315 |
netty/netty | common/src/main/java/io/netty/util/concurrent/DefaultPromise.java | DefaultPromise.notifyProgressiveListeners | @SuppressWarnings("unchecked")
void notifyProgressiveListeners(final long progress, final long total) {
"""
Notify all progressive listeners.
<p>
No attempt is made to ensure notification order if multiple calls are made to this method before
the original invocation completes.
<p>
This will do an iteration over all listeners to get all of type {@link GenericProgressiveFutureListener}s.
@param progress the new progress.
@param total the total progress.
"""
final Object listeners = progressiveListeners();
if (listeners == null) {
return;
}
final ProgressiveFuture<V> self = (ProgressiveFuture<V>) this;
EventExecutor executor = executor();
if (executor.inEventLoop()) {
if (listeners instanceof GenericProgressiveFutureListener[]) {
notifyProgressiveListeners0(
self, (GenericProgressiveFutureListener<?>[]) listeners, progress, total);
} else {
notifyProgressiveListener0(
self, (GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners, progress, total);
}
} else {
if (listeners instanceof GenericProgressiveFutureListener[]) {
final GenericProgressiveFutureListener<?>[] array =
(GenericProgressiveFutureListener<?>[]) listeners;
safeExecute(executor, new Runnable() {
@Override
public void run() {
notifyProgressiveListeners0(self, array, progress, total);
}
});
} else {
final GenericProgressiveFutureListener<ProgressiveFuture<V>> l =
(GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners;
safeExecute(executor, new Runnable() {
@Override
public void run() {
notifyProgressiveListener0(self, l, progress, total);
}
});
}
}
} | java | @SuppressWarnings("unchecked")
void notifyProgressiveListeners(final long progress, final long total) {
final Object listeners = progressiveListeners();
if (listeners == null) {
return;
}
final ProgressiveFuture<V> self = (ProgressiveFuture<V>) this;
EventExecutor executor = executor();
if (executor.inEventLoop()) {
if (listeners instanceof GenericProgressiveFutureListener[]) {
notifyProgressiveListeners0(
self, (GenericProgressiveFutureListener<?>[]) listeners, progress, total);
} else {
notifyProgressiveListener0(
self, (GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners, progress, total);
}
} else {
if (listeners instanceof GenericProgressiveFutureListener[]) {
final GenericProgressiveFutureListener<?>[] array =
(GenericProgressiveFutureListener<?>[]) listeners;
safeExecute(executor, new Runnable() {
@Override
public void run() {
notifyProgressiveListeners0(self, array, progress, total);
}
});
} else {
final GenericProgressiveFutureListener<ProgressiveFuture<V>> l =
(GenericProgressiveFutureListener<ProgressiveFuture<V>>) listeners;
safeExecute(executor, new Runnable() {
@Override
public void run() {
notifyProgressiveListener0(self, l, progress, total);
}
});
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"void",
"notifyProgressiveListeners",
"(",
"final",
"long",
"progress",
",",
"final",
"long",
"total",
")",
"{",
"final",
"Object",
"listeners",
"=",
"progressiveListeners",
"(",
")",
";",
"if",
"(",
"listeners",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"ProgressiveFuture",
"<",
"V",
">",
"self",
"=",
"(",
"ProgressiveFuture",
"<",
"V",
">",
")",
"this",
";",
"EventExecutor",
"executor",
"=",
"executor",
"(",
")",
";",
"if",
"(",
"executor",
".",
"inEventLoop",
"(",
")",
")",
"{",
"if",
"(",
"listeners",
"instanceof",
"GenericProgressiveFutureListener",
"[",
"]",
")",
"{",
"notifyProgressiveListeners0",
"(",
"self",
",",
"(",
"GenericProgressiveFutureListener",
"<",
"?",
">",
"[",
"]",
")",
"listeners",
",",
"progress",
",",
"total",
")",
";",
"}",
"else",
"{",
"notifyProgressiveListener0",
"(",
"self",
",",
"(",
"GenericProgressiveFutureListener",
"<",
"ProgressiveFuture",
"<",
"V",
">",
">",
")",
"listeners",
",",
"progress",
",",
"total",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"listeners",
"instanceof",
"GenericProgressiveFutureListener",
"[",
"]",
")",
"{",
"final",
"GenericProgressiveFutureListener",
"<",
"?",
">",
"[",
"]",
"array",
"=",
"(",
"GenericProgressiveFutureListener",
"<",
"?",
">",
"[",
"]",
")",
"listeners",
";",
"safeExecute",
"(",
"executor",
",",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"notifyProgressiveListeners0",
"(",
"self",
",",
"array",
",",
"progress",
",",
"total",
")",
";",
"}",
"}",
")",
";",
"}",
"else",
"{",
"final",
"GenericProgressiveFutureListener",
"<",
"ProgressiveFuture",
"<",
"V",
">",
">",
"l",
"=",
"(",
"GenericProgressiveFutureListener",
"<",
"ProgressiveFuture",
"<",
"V",
">",
">",
")",
"listeners",
";",
"safeExecute",
"(",
"executor",
",",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"notifyProgressiveListener0",
"(",
"self",
",",
"l",
",",
"progress",
",",
"total",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
"}"
] | Notify all progressive listeners.
<p>
No attempt is made to ensure notification order if multiple calls are made to this method before
the original invocation completes.
<p>
This will do an iteration over all listeners to get all of type {@link GenericProgressiveFutureListener}s.
@param progress the new progress.
@param total the total progress. | [
"Notify",
"all",
"progressive",
"listeners",
".",
"<p",
">",
"No",
"attempt",
"is",
"made",
"to",
"ensure",
"notification",
"order",
"if",
"multiple",
"calls",
"are",
"made",
"to",
"this",
"method",
"before",
"the",
"original",
"invocation",
"completes",
".",
"<p",
">",
"This",
"will",
"do",
"an",
"iteration",
"over",
"all",
"listeners",
"to",
"get",
"all",
"of",
"type",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/DefaultPromise.java#L641-L680 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/PostParameterHelper.java | PostParameterHelper.saveToSession | private void saveToSession(HttpServletRequest req, String reqURL, Map params) {
"""
Save POST parameters (reqURL, parameters) to a session
@param req
@param reqURL
@param params
"""
HttpSession postparamsession = req.getSession(true);
if (postparamsession != null && params != null && !params.isEmpty()) {
postparamsession.setAttribute(INITIAL_URL, reqURL);
postparamsession.setAttribute(PARAM_NAMES, null);
postparamsession.setAttribute(PARAM_VALUES, params);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "URL saved: " + reqURL.toString());
}
}
} | java | private void saveToSession(HttpServletRequest req, String reqURL, Map params) {
HttpSession postparamsession = req.getSession(true);
if (postparamsession != null && params != null && !params.isEmpty()) {
postparamsession.setAttribute(INITIAL_URL, reqURL);
postparamsession.setAttribute(PARAM_NAMES, null);
postparamsession.setAttribute(PARAM_VALUES, params);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "URL saved: " + reqURL.toString());
}
}
} | [
"private",
"void",
"saveToSession",
"(",
"HttpServletRequest",
"req",
",",
"String",
"reqURL",
",",
"Map",
"params",
")",
"{",
"HttpSession",
"postparamsession",
"=",
"req",
".",
"getSession",
"(",
"true",
")",
";",
"if",
"(",
"postparamsession",
"!=",
"null",
"&&",
"params",
"!=",
"null",
"&&",
"!",
"params",
".",
"isEmpty",
"(",
")",
")",
"{",
"postparamsession",
".",
"setAttribute",
"(",
"INITIAL_URL",
",",
"reqURL",
")",
";",
"postparamsession",
".",
"setAttribute",
"(",
"PARAM_NAMES",
",",
"null",
")",
";",
"postparamsession",
".",
"setAttribute",
"(",
"PARAM_VALUES",
",",
"params",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"URL saved: \"",
"+",
"reqURL",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Save POST parameters (reqURL, parameters) to a session
@param req
@param reqURL
@param params | [
"Save",
"POST",
"parameters",
"(",
"reqURL",
"parameters",
")",
"to",
"a",
"session"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/PostParameterHelper.java#L168-L178 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java | JDBCStorableGenerator.getConnection | private LocalVariable getConnection(CodeBuilder b, LocalVariable capVar) {
"""
Generates code to get connection from JDBCConnectionCapability and store
it in a local variable.
@param capVar reference to JDBCConnectionCapability
"""
b.loadLocal(capVar);
b.invokeInterface(TypeDesc.forClass(JDBCConnectionCapability.class),
"getConnection", TypeDesc.forClass(Connection.class), null);
LocalVariable conVar = b.createLocalVariable("con", TypeDesc.forClass(Connection.class));
b.storeLocal(conVar);
return conVar;
} | java | private LocalVariable getConnection(CodeBuilder b, LocalVariable capVar) {
b.loadLocal(capVar);
b.invokeInterface(TypeDesc.forClass(JDBCConnectionCapability.class),
"getConnection", TypeDesc.forClass(Connection.class), null);
LocalVariable conVar = b.createLocalVariable("con", TypeDesc.forClass(Connection.class));
b.storeLocal(conVar);
return conVar;
} | [
"private",
"LocalVariable",
"getConnection",
"(",
"CodeBuilder",
"b",
",",
"LocalVariable",
"capVar",
")",
"{",
"b",
".",
"loadLocal",
"(",
"capVar",
")",
";",
"b",
".",
"invokeInterface",
"(",
"TypeDesc",
".",
"forClass",
"(",
"JDBCConnectionCapability",
".",
"class",
")",
",",
"\"getConnection\"",
",",
"TypeDesc",
".",
"forClass",
"(",
"Connection",
".",
"class",
")",
",",
"null",
")",
";",
"LocalVariable",
"conVar",
"=",
"b",
".",
"createLocalVariable",
"(",
"\"con\"",
",",
"TypeDesc",
".",
"forClass",
"(",
"Connection",
".",
"class",
")",
")",
";",
"b",
".",
"storeLocal",
"(",
"conVar",
")",
";",
"return",
"conVar",
";",
"}"
] | Generates code to get connection from JDBCConnectionCapability and store
it in a local variable.
@param capVar reference to JDBCConnectionCapability | [
"Generates",
"code",
"to",
"get",
"connection",
"from",
"JDBCConnectionCapability",
"and",
"store",
"it",
"in",
"a",
"local",
"variable",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java#L1363-L1370 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.resumeDomainStream | public ResumeDomainStreamResponse resumeDomainStream(String domain, String app, String stream) {
"""
Get detail of stream in the live stream service.
@param domain The requested domain which the specific stream belongs to
@param app The requested app which the specific stream belongs to
@param stream The requested stream to resume
@return the response
"""
ResumeDomainStreamRequest request = new ResumeDomainStreamRequest();
request.withDomain(domain).withApp(app).withStream(stream);
return resumeDomainStream(request);
} | java | public ResumeDomainStreamResponse resumeDomainStream(String domain, String app, String stream) {
ResumeDomainStreamRequest request = new ResumeDomainStreamRequest();
request.withDomain(domain).withApp(app).withStream(stream);
return resumeDomainStream(request);
} | [
"public",
"ResumeDomainStreamResponse",
"resumeDomainStream",
"(",
"String",
"domain",
",",
"String",
"app",
",",
"String",
"stream",
")",
"{",
"ResumeDomainStreamRequest",
"request",
"=",
"new",
"ResumeDomainStreamRequest",
"(",
")",
";",
"request",
".",
"withDomain",
"(",
"domain",
")",
".",
"withApp",
"(",
"app",
")",
".",
"withStream",
"(",
"stream",
")",
";",
"return",
"resumeDomainStream",
"(",
"request",
")",
";",
"}"
] | Get detail of stream in the live stream service.
@param domain The requested domain which the specific stream belongs to
@param app The requested app which the specific stream belongs to
@param stream The requested stream to resume
@return the response | [
"Get",
"detail",
"of",
"stream",
"in",
"the",
"live",
"stream",
"service",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1556-L1560 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java | Bytes.compareTo | public static int compareTo(final byte [] left, final byte [] right) {
"""
Lexicographically compare two arrays.
@param left left operand
@param right right operand
@return 0 if equal, < 0 if left is less than right, etc.
"""
return LexicographicalComparerHolder.BEST_COMPARER.
compareTo(left, 0, left.length, right, 0, right.length);
} | java | public static int compareTo(final byte [] left, final byte [] right) {
return LexicographicalComparerHolder.BEST_COMPARER.
compareTo(left, 0, left.length, right, 0, right.length);
} | [
"public",
"static",
"int",
"compareTo",
"(",
"final",
"byte",
"[",
"]",
"left",
",",
"final",
"byte",
"[",
"]",
"right",
")",
"{",
"return",
"LexicographicalComparerHolder",
".",
"BEST_COMPARER",
".",
"compareTo",
"(",
"left",
",",
"0",
",",
"left",
".",
"length",
",",
"right",
",",
"0",
",",
"right",
".",
"length",
")",
";",
"}"
] | Lexicographically compare two arrays.
@param left left operand
@param right right operand
@return 0 if equal, < 0 if left is less than right, etc. | [
"Lexicographically",
"compare",
"two",
"arrays",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L758-L761 |
threerings/narya | core/src/main/java/com/threerings/crowd/server/PlaceManager.java | PlaceManager.addOccupantInfo | protected void addOccupantInfo (BodyObject body, OccupantInfo info) {
"""
Adds this occupant's info to the {@link PlaceObject}. This is called in a transaction on the
place object so if a derived class needs to add additional information for an occupant it
should override this method. It may opt to add the information before calling super if it
wishes to rely on its information being configured when {@link #bodyEntered} is called.
"""
// clone the canonical copy and insert it into the DSet
_plobj.addToOccupantInfo(info);
// add the body oid to our place object's occupant list
_plobj.addToOccupants(body.getOid());
} | java | protected void addOccupantInfo (BodyObject body, OccupantInfo info)
{
// clone the canonical copy and insert it into the DSet
_plobj.addToOccupantInfo(info);
// add the body oid to our place object's occupant list
_plobj.addToOccupants(body.getOid());
} | [
"protected",
"void",
"addOccupantInfo",
"(",
"BodyObject",
"body",
",",
"OccupantInfo",
"info",
")",
"{",
"// clone the canonical copy and insert it into the DSet",
"_plobj",
".",
"addToOccupantInfo",
"(",
"info",
")",
";",
"// add the body oid to our place object's occupant list",
"_plobj",
".",
"addToOccupants",
"(",
"body",
".",
"getOid",
"(",
")",
")",
";",
"}"
] | Adds this occupant's info to the {@link PlaceObject}. This is called in a transaction on the
place object so if a derived class needs to add additional information for an occupant it
should override this method. It may opt to add the information before calling super if it
wishes to rely on its information being configured when {@link #bodyEntered} is called. | [
"Adds",
"this",
"occupant",
"s",
"info",
"to",
"the",
"{"
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/server/PlaceManager.java#L662-L669 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/commons/IOUtils.java | IOUtils.contentEquals | public static boolean contentEquals(InputStream input1, InputStream input2)
throws IOException {
"""
Compare the contents of two Streams to determine if they are equal or
not.
<p>
This method buffers the input internally using
<code>BufferedInputStream</code> if they are not already buffered.
@param input1 the first stream
@param input2 the second stream
@return true if the content of the streams are equal or they both don't
exist, false otherwise
@throws NullPointerException if either input is null
@throws IOException if an I/O error occurs
"""
if (!(input1 instanceof BufferedInputStream)) {
input1 = new BufferedInputStream(input1);
}
if (!(input2 instanceof BufferedInputStream)) {
input2 = new BufferedInputStream(input2);
}
int ch = input1.read();
while (EOF != ch) {
int ch2 = input2.read();
if (ch != ch2) {
return false;
}
ch = input1.read();
}
int ch2 = input2.read();
return ch2 == EOF;
} | java | public static boolean contentEquals(InputStream input1, InputStream input2)
throws IOException {
if (!(input1 instanceof BufferedInputStream)) {
input1 = new BufferedInputStream(input1);
}
if (!(input2 instanceof BufferedInputStream)) {
input2 = new BufferedInputStream(input2);
}
int ch = input1.read();
while (EOF != ch) {
int ch2 = input2.read();
if (ch != ch2) {
return false;
}
ch = input1.read();
}
int ch2 = input2.read();
return ch2 == EOF;
} | [
"public",
"static",
"boolean",
"contentEquals",
"(",
"InputStream",
"input1",
",",
"InputStream",
"input2",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"(",
"input1",
"instanceof",
"BufferedInputStream",
")",
")",
"{",
"input1",
"=",
"new",
"BufferedInputStream",
"(",
"input1",
")",
";",
"}",
"if",
"(",
"!",
"(",
"input2",
"instanceof",
"BufferedInputStream",
")",
")",
"{",
"input2",
"=",
"new",
"BufferedInputStream",
"(",
"input2",
")",
";",
"}",
"int",
"ch",
"=",
"input1",
".",
"read",
"(",
")",
";",
"while",
"(",
"EOF",
"!=",
"ch",
")",
"{",
"int",
"ch2",
"=",
"input2",
".",
"read",
"(",
")",
";",
"if",
"(",
"ch",
"!=",
"ch2",
")",
"{",
"return",
"false",
";",
"}",
"ch",
"=",
"input1",
".",
"read",
"(",
")",
";",
"}",
"int",
"ch2",
"=",
"input2",
".",
"read",
"(",
")",
";",
"return",
"ch2",
"==",
"EOF",
";",
"}"
] | Compare the contents of two Streams to determine if they are equal or
not.
<p>
This method buffers the input internally using
<code>BufferedInputStream</code> if they are not already buffered.
@param input1 the first stream
@param input2 the second stream
@return true if the content of the streams are equal or they both don't
exist, false otherwise
@throws NullPointerException if either input is null
@throws IOException if an I/O error occurs | [
"Compare",
"the",
"contents",
"of",
"two",
"Streams",
"to",
"determine",
"if",
"they",
"are",
"equal",
"or",
"not",
".",
"<p",
">",
"This",
"method",
"buffers",
"the",
"input",
"internally",
"using",
"<code",
">",
"BufferedInputStream<",
"/",
"code",
">",
"if",
"they",
"are",
"not",
"already",
"buffered",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/IOUtils.java#L467-L487 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.appendWithSeparators | public StrBuilder appendWithSeparators(final Iterable<?> iterable, final String separator) {
"""
Appends an iterable placing separators between each value, but
not before the first or after the last.
Appending a null iterable will have no effect.
Each object is appended using {@link #append(Object)}.
@param iterable the iterable to append
@param separator the separator to use, null means no separator
@return this, to enable chaining
"""
if (iterable != null) {
final String sep = Objects.toString(separator, "");
final Iterator<?> it = iterable.iterator();
while (it.hasNext()) {
append(it.next());
if (it.hasNext()) {
append(sep);
}
}
}
return this;
} | java | public StrBuilder appendWithSeparators(final Iterable<?> iterable, final String separator) {
if (iterable != null) {
final String sep = Objects.toString(separator, "");
final Iterator<?> it = iterable.iterator();
while (it.hasNext()) {
append(it.next());
if (it.hasNext()) {
append(sep);
}
}
}
return this;
} | [
"public",
"StrBuilder",
"appendWithSeparators",
"(",
"final",
"Iterable",
"<",
"?",
">",
"iterable",
",",
"final",
"String",
"separator",
")",
"{",
"if",
"(",
"iterable",
"!=",
"null",
")",
"{",
"final",
"String",
"sep",
"=",
"Objects",
".",
"toString",
"(",
"separator",
",",
"\"\"",
")",
";",
"final",
"Iterator",
"<",
"?",
">",
"it",
"=",
"iterable",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"append",
"(",
"it",
".",
"next",
"(",
")",
")",
";",
"if",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"append",
"(",
"sep",
")",
";",
"}",
"}",
"}",
"return",
"this",
";",
"}"
] | Appends an iterable placing separators between each value, but
not before the first or after the last.
Appending a null iterable will have no effect.
Each object is appended using {@link #append(Object)}.
@param iterable the iterable to append
@param separator the separator to use, null means no separator
@return this, to enable chaining | [
"Appends",
"an",
"iterable",
"placing",
"separators",
"between",
"each",
"value",
"but",
"not",
"before",
"the",
"first",
"or",
"after",
"the",
"last",
".",
"Appending",
"a",
"null",
"iterable",
"will",
"have",
"no",
"effect",
".",
"Each",
"object",
"is",
"appended",
"using",
"{",
"@link",
"#append",
"(",
"Object",
")",
"}",
"."
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L1273-L1285 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java | TransformersLogger.logAttributeWarning | public void logAttributeWarning(PathAddress address, String message, Set<String> attributes) {
"""
Log a warning for the resource at the provided address and the given attributes, using the provided detail
message.
@param address where warning occurred
@param message custom error message to append
@param attributes attributes we that have problems about
"""
messageQueue.add(new AttributeLogEntry(address, null, message, attributes));
} | java | public void logAttributeWarning(PathAddress address, String message, Set<String> attributes) {
messageQueue.add(new AttributeLogEntry(address, null, message, attributes));
} | [
"public",
"void",
"logAttributeWarning",
"(",
"PathAddress",
"address",
",",
"String",
"message",
",",
"Set",
"<",
"String",
">",
"attributes",
")",
"{",
"messageQueue",
".",
"add",
"(",
"new",
"AttributeLogEntry",
"(",
"address",
",",
"null",
",",
"message",
",",
"attributes",
")",
")",
";",
"}"
] | Log a warning for the resource at the provided address and the given attributes, using the provided detail
message.
@param address where warning occurred
@param message custom error message to append
@param attributes attributes we that have problems about | [
"Log",
"a",
"warning",
"for",
"the",
"resource",
"at",
"the",
"provided",
"address",
"and",
"the",
"given",
"attributes",
"using",
"the",
"provided",
"detail",
"message",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/TransformersLogger.java#L133-L135 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java | Properties.set | public <K, V> void set(PropertyMapKey<K, V> property, Map<K, V> value) {
"""
Associates the specified map with the specified property key. If the properties previously contained a mapping for the property key, the old
value is replaced by the specified map.
@param <K>
the type of keys maintained by the map
@param <V>
the type of mapped values
@param property
the property key with which the specified map is to be associated
@param value
the map to be associated with the specified property key
"""
properties.put(property.getName(), value);
} | java | public <K, V> void set(PropertyMapKey<K, V> property, Map<K, V> value) {
properties.put(property.getName(), value);
} | [
"public",
"<",
"K",
",",
"V",
">",
"void",
"set",
"(",
"PropertyMapKey",
"<",
"K",
",",
"V",
">",
"property",
",",
"Map",
"<",
"K",
",",
"V",
">",
"value",
")",
"{",
"properties",
".",
"put",
"(",
"property",
".",
"getName",
"(",
")",
",",
"value",
")",
";",
"}"
] | Associates the specified map with the specified property key. If the properties previously contained a mapping for the property key, the old
value is replaced by the specified map.
@param <K>
the type of keys maintained by the map
@param <V>
the type of mapped values
@param property
the property key with which the specified map is to be associated
@param value
the map to be associated with the specified property key | [
"Associates",
"the",
"specified",
"map",
"with",
"the",
"specified",
"property",
"key",
".",
"If",
"the",
"properties",
"previously",
"contained",
"a",
"mapping",
"for",
"the",
"property",
"key",
"the",
"old",
"value",
"is",
"replaced",
"by",
"the",
"specified",
"map",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/core/model/Properties.java#L144-L146 |
huangp/entityunit | src/main/java/com/github/huangp/entityunit/maker/PreferredValueMakersRegistry.java | PreferredValueMakersRegistry.addConstructorParameterMaker | public PreferredValueMakersRegistry addConstructorParameterMaker(Class ownerType, int argIndex, Maker<?> maker) {
"""
Add a constructor parameter maker to a class type.
i.e. with:
<pre>
{@code
Class Person {
Person(String name, int age)
}
}
</pre>
You could define a custom maker for name as (Person.class, 0, myNameMaker)
@param ownerType
the class that owns the field.
@param argIndex
constructor parameter index (0 based)
@param maker
custom maker
@return this
"""
Preconditions.checkNotNull(ownerType);
Preconditions.checkArgument(argIndex >= 0);
makers.put(Matchers.equalTo(String.format(Settable.FULL_NAME_FORMAT, ownerType.getName(), "arg" + argIndex)), maker);
return this;
} | java | public PreferredValueMakersRegistry addConstructorParameterMaker(Class ownerType, int argIndex, Maker<?> maker) {
Preconditions.checkNotNull(ownerType);
Preconditions.checkArgument(argIndex >= 0);
makers.put(Matchers.equalTo(String.format(Settable.FULL_NAME_FORMAT, ownerType.getName(), "arg" + argIndex)), maker);
return this;
} | [
"public",
"PreferredValueMakersRegistry",
"addConstructorParameterMaker",
"(",
"Class",
"ownerType",
",",
"int",
"argIndex",
",",
"Maker",
"<",
"?",
">",
"maker",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"ownerType",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"argIndex",
">=",
"0",
")",
";",
"makers",
".",
"put",
"(",
"Matchers",
".",
"equalTo",
"(",
"String",
".",
"format",
"(",
"Settable",
".",
"FULL_NAME_FORMAT",
",",
"ownerType",
".",
"getName",
"(",
")",
",",
"\"arg\"",
"+",
"argIndex",
")",
")",
",",
"maker",
")",
";",
"return",
"this",
";",
"}"
] | Add a constructor parameter maker to a class type.
i.e. with:
<pre>
{@code
Class Person {
Person(String name, int age)
}
}
</pre>
You could define a custom maker for name as (Person.class, 0, myNameMaker)
@param ownerType
the class that owns the field.
@param argIndex
constructor parameter index (0 based)
@param maker
custom maker
@return this | [
"Add",
"a",
"constructor",
"parameter",
"maker",
"to",
"a",
"class",
"type",
".",
"i",
".",
"e",
".",
"with",
":",
"<pre",
">",
"{",
"@code"
] | train | https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/maker/PreferredValueMakersRegistry.java#L102-L107 |
prestodb/presto | presto-raptor/src/main/java/com/facebook/presto/raptor/storage/FileStorageService.java | FileStorageService.getFileSystemPath | public static File getFileSystemPath(File base, UUID shardUuid) {
"""
Generate a file system path for a shard UUID.
This creates a three level deep directory structure where the first
two levels each contain two hex digits (lowercase) of the UUID
and the final level contains the full UUID. Example:
<pre>
UUID: 701e1a79-74f7-4f56-b438-b41e8e7d019d
Path: /base/70/1e/701e1a79-74f7-4f56-b438-b41e8e7d019d.orc
</pre>
This ensures that files are spread out evenly through the tree
while a path can still be easily navigated by a human being.
"""
String uuid = shardUuid.toString().toLowerCase(ENGLISH);
return base.toPath()
.resolve(uuid.substring(0, 2))
.resolve(uuid.substring(2, 4))
.resolve(uuid + FILE_EXTENSION)
.toFile();
} | java | public static File getFileSystemPath(File base, UUID shardUuid)
{
String uuid = shardUuid.toString().toLowerCase(ENGLISH);
return base.toPath()
.resolve(uuid.substring(0, 2))
.resolve(uuid.substring(2, 4))
.resolve(uuid + FILE_EXTENSION)
.toFile();
} | [
"public",
"static",
"File",
"getFileSystemPath",
"(",
"File",
"base",
",",
"UUID",
"shardUuid",
")",
"{",
"String",
"uuid",
"=",
"shardUuid",
".",
"toString",
"(",
")",
".",
"toLowerCase",
"(",
"ENGLISH",
")",
";",
"return",
"base",
".",
"toPath",
"(",
")",
".",
"resolve",
"(",
"uuid",
".",
"substring",
"(",
"0",
",",
"2",
")",
")",
".",
"resolve",
"(",
"uuid",
".",
"substring",
"(",
"2",
",",
"4",
")",
")",
".",
"resolve",
"(",
"uuid",
"+",
"FILE_EXTENSION",
")",
".",
"toFile",
"(",
")",
";",
"}"
] | Generate a file system path for a shard UUID.
This creates a three level deep directory structure where the first
two levels each contain two hex digits (lowercase) of the UUID
and the final level contains the full UUID. Example:
<pre>
UUID: 701e1a79-74f7-4f56-b438-b41e8e7d019d
Path: /base/70/1e/701e1a79-74f7-4f56-b438-b41e8e7d019d.orc
</pre>
This ensures that files are spread out evenly through the tree
while a path can still be easily navigated by a human being. | [
"Generate",
"a",
"file",
"system",
"path",
"for",
"a",
"shard",
"UUID",
".",
"This",
"creates",
"a",
"three",
"level",
"deep",
"directory",
"structure",
"where",
"the",
"first",
"two",
"levels",
"each",
"contain",
"two",
"hex",
"digits",
"(",
"lowercase",
")",
"of",
"the",
"UUID",
"and",
"the",
"final",
"level",
"contains",
"the",
"full",
"UUID",
".",
"Example",
":",
"<pre",
">",
"UUID",
":",
"701e1a79",
"-",
"74f7",
"-",
"4f56",
"-",
"b438",
"-",
"b41e8e7d019d",
"Path",
":",
"/",
"base",
"/",
"70",
"/",
"1e",
"/",
"701e1a79",
"-",
"74f7",
"-",
"4f56",
"-",
"b438",
"-",
"b41e8e7d019d",
".",
"orc",
"<",
"/",
"pre",
">",
"This",
"ensures",
"that",
"files",
"are",
"spread",
"out",
"evenly",
"through",
"the",
"tree",
"while",
"a",
"path",
"can",
"still",
"be",
"easily",
"navigated",
"by",
"a",
"human",
"being",
"."
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-raptor/src/main/java/com/facebook/presto/raptor/storage/FileStorageService.java#L145-L153 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.lesserThan | @ArgumentsChecked
@Throws(IllegalNotLesserThanException.class)
public static byte lesserThan(final byte expected, final byte check) {
"""
Ensures that a passed {@code byte} is less than another {@code byte}.
@param expected
Expected value
@param check
Comparable to be checked
@return the passed {@code byte} argument {@code check}
@throws IllegalNotLesserThanException
if the argument value {@code check} is not lesser than value {@code expected}
"""
if (expected <= check) {
throw new IllegalNotLesserThanException(check);
}
return check;
} | java | @ArgumentsChecked
@Throws(IllegalNotLesserThanException.class)
public static byte lesserThan(final byte expected, final byte check) {
if (expected <= check) {
throw new IllegalNotLesserThanException(check);
}
return check;
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"IllegalNotLesserThanException",
".",
"class",
")",
"public",
"static",
"byte",
"lesserThan",
"(",
"final",
"byte",
"expected",
",",
"final",
"byte",
"check",
")",
"{",
"if",
"(",
"expected",
"<=",
"check",
")",
"{",
"throw",
"new",
"IllegalNotLesserThanException",
"(",
"check",
")",
";",
"}",
"return",
"check",
";",
"}"
] | Ensures that a passed {@code byte} is less than another {@code byte}.
@param expected
Expected value
@param check
Comparable to be checked
@return the passed {@code byte} argument {@code check}
@throws IllegalNotLesserThanException
if the argument value {@code check} is not lesser than value {@code expected} | [
"Ensures",
"that",
"a",
"passed",
"{",
"@code",
"byte",
"}",
"is",
"less",
"than",
"another",
"{",
"@code",
"byte",
"}",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1370-L1378 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/comp/Resolve.java | Resolve.resolveBinaryOperator | Symbol resolveBinaryOperator(DiagnosticPosition pos,
JCTree.Tag optag,
Env<AttrContext> env,
Type left,
Type right) {
"""
Resolve binary operator.
@param pos The position to use for error reporting.
@param optag The tag of the operation tree.
@param env The environment current at the operation.
@param left The types of the left operand.
@param right The types of the right operand.
"""
return resolveOperator(pos, optag, env, List.of(left, right));
} | java | Symbol resolveBinaryOperator(DiagnosticPosition pos,
JCTree.Tag optag,
Env<AttrContext> env,
Type left,
Type right) {
return resolveOperator(pos, optag, env, List.of(left, right));
} | [
"Symbol",
"resolveBinaryOperator",
"(",
"DiagnosticPosition",
"pos",
",",
"JCTree",
".",
"Tag",
"optag",
",",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Type",
"left",
",",
"Type",
"right",
")",
"{",
"return",
"resolveOperator",
"(",
"pos",
",",
"optag",
",",
"env",
",",
"List",
".",
"of",
"(",
"left",
",",
"right",
")",
")",
";",
"}"
] | Resolve binary operator.
@param pos The position to use for error reporting.
@param optag The tag of the operation tree.
@param env The environment current at the operation.
@param left The types of the left operand.
@param right The types of the right operand. | [
"Resolve",
"binary",
"operator",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L2721-L2727 |
undertow-io/undertow | core/src/main/java/io/undertow/protocols/http2/Http2Channel.java | Http2Channel.createStream | public synchronized Http2HeadersStreamSinkChannel createStream(HeaderMap requestHeaders) throws IOException {
"""
Creates a strema using a HEADERS frame
@param requestHeaders
@return
@throws IOException
"""
if (!isClient()) {
throw UndertowMessages.MESSAGES.headersStreamCanOnlyBeCreatedByClient();
}
if (!isOpen()) {
throw UndertowMessages.MESSAGES.channelIsClosed();
}
sendConcurrentStreamsAtomicUpdater.incrementAndGet(this);
if(sendMaxConcurrentStreams > 0 && sendConcurrentStreams > sendMaxConcurrentStreams) {
throw UndertowMessages.MESSAGES.streamLimitExceeded();
}
int streamId = streamIdCounter;
streamIdCounter += 2;
Http2HeadersStreamSinkChannel http2SynStreamStreamSinkChannel = new Http2HeadersStreamSinkChannel(this, streamId, requestHeaders);
currentStreams.put(streamId, new StreamHolder(http2SynStreamStreamSinkChannel));
return http2SynStreamStreamSinkChannel;
} | java | public synchronized Http2HeadersStreamSinkChannel createStream(HeaderMap requestHeaders) throws IOException {
if (!isClient()) {
throw UndertowMessages.MESSAGES.headersStreamCanOnlyBeCreatedByClient();
}
if (!isOpen()) {
throw UndertowMessages.MESSAGES.channelIsClosed();
}
sendConcurrentStreamsAtomicUpdater.incrementAndGet(this);
if(sendMaxConcurrentStreams > 0 && sendConcurrentStreams > sendMaxConcurrentStreams) {
throw UndertowMessages.MESSAGES.streamLimitExceeded();
}
int streamId = streamIdCounter;
streamIdCounter += 2;
Http2HeadersStreamSinkChannel http2SynStreamStreamSinkChannel = new Http2HeadersStreamSinkChannel(this, streamId, requestHeaders);
currentStreams.put(streamId, new StreamHolder(http2SynStreamStreamSinkChannel));
return http2SynStreamStreamSinkChannel;
} | [
"public",
"synchronized",
"Http2HeadersStreamSinkChannel",
"createStream",
"(",
"HeaderMap",
"requestHeaders",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"isClient",
"(",
")",
")",
"{",
"throw",
"UndertowMessages",
".",
"MESSAGES",
".",
"headersStreamCanOnlyBeCreatedByClient",
"(",
")",
";",
"}",
"if",
"(",
"!",
"isOpen",
"(",
")",
")",
"{",
"throw",
"UndertowMessages",
".",
"MESSAGES",
".",
"channelIsClosed",
"(",
")",
";",
"}",
"sendConcurrentStreamsAtomicUpdater",
".",
"incrementAndGet",
"(",
"this",
")",
";",
"if",
"(",
"sendMaxConcurrentStreams",
">",
"0",
"&&",
"sendConcurrentStreams",
">",
"sendMaxConcurrentStreams",
")",
"{",
"throw",
"UndertowMessages",
".",
"MESSAGES",
".",
"streamLimitExceeded",
"(",
")",
";",
"}",
"int",
"streamId",
"=",
"streamIdCounter",
";",
"streamIdCounter",
"+=",
"2",
";",
"Http2HeadersStreamSinkChannel",
"http2SynStreamStreamSinkChannel",
"=",
"new",
"Http2HeadersStreamSinkChannel",
"(",
"this",
",",
"streamId",
",",
"requestHeaders",
")",
";",
"currentStreams",
".",
"put",
"(",
"streamId",
",",
"new",
"StreamHolder",
"(",
"http2SynStreamStreamSinkChannel",
")",
")",
";",
"return",
"http2SynStreamStreamSinkChannel",
";",
"}"
] | Creates a strema using a HEADERS frame
@param requestHeaders
@return
@throws IOException | [
"Creates",
"a",
"strema",
"using",
"a",
"HEADERS",
"frame"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/protocols/http2/Http2Channel.java#L881-L898 |
apereo/cas | support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/credential/GoogleAuthenticatorAccountCouchDbRepository.java | GoogleAuthenticatorAccountCouchDbRepository.findByUsername | public List<CouchDbGoogleAuthenticatorAccount> findByUsername(final String username) {
"""
Final all accounts for user.
@param username username for account lookup
@return one time token accounts for user
"""
try {
return queryView("by_username", username);
} catch (final DocumentNotFoundException ignored) {
return null;
}
} | java | public List<CouchDbGoogleAuthenticatorAccount> findByUsername(final String username) {
try {
return queryView("by_username", username);
} catch (final DocumentNotFoundException ignored) {
return null;
}
} | [
"public",
"List",
"<",
"CouchDbGoogleAuthenticatorAccount",
">",
"findByUsername",
"(",
"final",
"String",
"username",
")",
"{",
"try",
"{",
"return",
"queryView",
"(",
"\"by_username\"",
",",
"username",
")",
";",
"}",
"catch",
"(",
"final",
"DocumentNotFoundException",
"ignored",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Final all accounts for user.
@param username username for account lookup
@return one time token accounts for user | [
"Final",
"all",
"accounts",
"for",
"user",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-gauth-couchdb/src/main/java/org/apereo/cas/couchdb/gauth/credential/GoogleAuthenticatorAccountCouchDbRepository.java#L45-L51 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/AlertDto.java | AlertDto.transformToDto | public static List<AlertDto> transformToDto(List<Alert> alerts) {
"""
Converts list of alert entity objects to list of alertDto objects.
@param alerts List of alert entities. Cannot be null.
@return List of alertDto objects.
@throws WebApplicationException If an error occurs.
"""
if (alerts == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
List<AlertDto> result = new ArrayList<AlertDto>();
for (Alert alert : alerts) {
result.add(transformToDto(alert));
}
return result;
} | java | public static List<AlertDto> transformToDto(List<Alert> alerts) {
if (alerts == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
List<AlertDto> result = new ArrayList<AlertDto>();
for (Alert alert : alerts) {
result.add(transformToDto(alert));
}
return result;
} | [
"public",
"static",
"List",
"<",
"AlertDto",
">",
"transformToDto",
"(",
"List",
"<",
"Alert",
">",
"alerts",
")",
"{",
"if",
"(",
"alerts",
"==",
"null",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"\"Null entity object cannot be converted to Dto object.\"",
",",
"Status",
".",
"INTERNAL_SERVER_ERROR",
")",
";",
"}",
"List",
"<",
"AlertDto",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"AlertDto",
">",
"(",
")",
";",
"for",
"(",
"Alert",
"alert",
":",
"alerts",
")",
"{",
"result",
".",
"add",
"(",
"transformToDto",
"(",
"alert",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Converts list of alert entity objects to list of alertDto objects.
@param alerts List of alert entities. Cannot be null.
@return List of alertDto objects.
@throws WebApplicationException If an error occurs. | [
"Converts",
"list",
"of",
"alert",
"entity",
"objects",
"to",
"list",
"of",
"alertDto",
"objects",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/AlertDto.java#L103-L114 |
Netflix/spectator | spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/BucketDistributionSummary.java | BucketDistributionSummary.get | public static BucketDistributionSummary get(Id id, BucketFunction f) {
"""
Creates a distribution summary object that manages a set of distribution summaries based on
the bucket function supplied. Calling record will be mapped to the record on the appropriate
distribution summary.
@param id
Identifier for the metric being registered.
@param f
Function to map values to buckets.
@return
Distribution summary that manages sub-counters based on the bucket function.
"""
return get(Spectator.globalRegistry(), id, f);
} | java | public static BucketDistributionSummary get(Id id, BucketFunction f) {
return get(Spectator.globalRegistry(), id, f);
} | [
"public",
"static",
"BucketDistributionSummary",
"get",
"(",
"Id",
"id",
",",
"BucketFunction",
"f",
")",
"{",
"return",
"get",
"(",
"Spectator",
".",
"globalRegistry",
"(",
")",
",",
"id",
",",
"f",
")",
";",
"}"
] | Creates a distribution summary object that manages a set of distribution summaries based on
the bucket function supplied. Calling record will be mapped to the record on the appropriate
distribution summary.
@param id
Identifier for the metric being registered.
@param f
Function to map values to buckets.
@return
Distribution summary that manages sub-counters based on the bucket function. | [
"Creates",
"a",
"distribution",
"summary",
"object",
"that",
"manages",
"a",
"set",
"of",
"distribution",
"summaries",
"based",
"on",
"the",
"bucket",
"function",
"supplied",
".",
"Calling",
"record",
"will",
"be",
"mapped",
"to",
"the",
"record",
"on",
"the",
"appropriate",
"distribution",
"summary",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/BucketDistributionSummary.java#L44-L46 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.