repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/security/KeyProvider.java | KeyProvider.getPrivateKey | public PrivateKey getPrivateKey(String alias, String password) {
Key key = getKey(alias, password);
if (key instanceof PrivateKey) {
return (PrivateKey) key;
} else {
throw new IllegalStateException(format("Key with alias '%s' was not a private key, but was: %s",
alias, key.getClass().getSimpleName()));
}
} | java | public PrivateKey getPrivateKey(String alias, String password) {
Key key = getKey(alias, password);
if (key instanceof PrivateKey) {
return (PrivateKey) key;
} else {
throw new IllegalStateException(format("Key with alias '%s' was not a private key, but was: %s",
alias, key.getClass().getSimpleName()));
}
} | [
"public",
"PrivateKey",
"getPrivateKey",
"(",
"String",
"alias",
",",
"String",
"password",
")",
"{",
"Key",
"key",
"=",
"getKey",
"(",
"alias",
",",
"password",
")",
";",
"if",
"(",
"key",
"instanceof",
"PrivateKey",
")",
"{",
"return",
"(",
"PrivateKey",... | Gets a asymmetric encryption private key from the key store
@param alias key alias
@param password key password
@return the private key | [
"Gets",
"a",
"asymmetric",
"encryption",
"private",
"key",
"from",
"the",
"key",
"store"
] | train | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/security/KeyProvider.java#L55-L63 |
erlang/otp | lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java | AbstractConnection.sendLink | protected void sendLink(final OtpErlangPid from, final OtpErlangPid dest)
throws IOException {
if (!connected) {
throw new IOException("Not connected");
}
@SuppressWarnings("resource")
final OtpOutputStream header = new OtpOutputStream(headerLen);
// preamble: 4 byte length + "passthrough" tag
header.write4BE(0); // reserve space for length
header.write1(passThrough);
header.write1(version);
// header
header.write_tuple_head(3);
header.write_long(linkTag);
header.write_any(from);
header.write_any(dest);
// fix up length in preamble
header.poke4BE(0, header.size() - 4);
do_send(header);
} | java | protected void sendLink(final OtpErlangPid from, final OtpErlangPid dest)
throws IOException {
if (!connected) {
throw new IOException("Not connected");
}
@SuppressWarnings("resource")
final OtpOutputStream header = new OtpOutputStream(headerLen);
// preamble: 4 byte length + "passthrough" tag
header.write4BE(0); // reserve space for length
header.write1(passThrough);
header.write1(version);
// header
header.write_tuple_head(3);
header.write_long(linkTag);
header.write_any(from);
header.write_any(dest);
// fix up length in preamble
header.poke4BE(0, header.size() - 4);
do_send(header);
} | [
"protected",
"void",
"sendLink",
"(",
"final",
"OtpErlangPid",
"from",
",",
"final",
"OtpErlangPid",
"dest",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"connected",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Not connected\"",
")",
";",
"}",
"@"... | Create a link between the local node and the specified process on the
remote node. If the link is still active when the remote process
terminates, an exit signal will be sent to this connection. Use
{@link #sendUnlink unlink()} to remove the link.
@param dest
the Erlang PID of the remote process.
@exception java.io.IOException
if the connection is not active or a communication error
occurs. | [
"Create",
"a",
"link",
"between",
"the",
"local",
"node",
"and",
"the",
"specified",
"process",
"on",
"the",
"remote",
"node",
".",
"If",
"the",
"link",
"is",
"still",
"active",
"when",
"the",
"remote",
"process",
"terminates",
"an",
"exit",
"signal",
"wil... | train | https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/AbstractConnection.java#L385-L408 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/DdosProtectionPlansInner.java | DdosProtectionPlansInner.beginDelete | public void beginDelete(String resourceGroupName, String ddosProtectionPlanName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String ddosProtectionPlanName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, ddosProtectionPlanName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"ddosProtectionPlanName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"ddosProtectionPlanName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
... | Deletes the specified DDoS protection plan.
@param resourceGroupName The name of the resource group.
@param ddosProtectionPlanName The name of the DDoS protection plan.
@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 | [
"Deletes",
"the",
"specified",
"DDoS",
"protection",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/DdosProtectionPlansInner.java#L180-L182 |
JOML-CI/JOML | src/org/joml/Vector4f.java | Vector4f.fma | public Vector4f fma(Vector4fc a, Vector4fc b) {
return fma(a, b, thisOrNew());
} | java | public Vector4f fma(Vector4fc a, Vector4fc b) {
return fma(a, b, thisOrNew());
} | [
"public",
"Vector4f",
"fma",
"(",
"Vector4fc",
"a",
",",
"Vector4fc",
"b",
")",
"{",
"return",
"fma",
"(",
"a",
",",
"b",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"
] | Add the component-wise multiplication of <code>a * b</code> to this vector.
@param a
the first multiplicand
@param b
the second multiplicand
@return a vector holding the result | [
"Add",
"the",
"component",
"-",
"wise",
"multiplication",
"of",
"<code",
">",
"a",
"*",
"b<",
"/",
"code",
">",
"to",
"this",
"vector",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector4f.java#L700-L702 |
mapsforge/mapsforge | mapsforge-map-awt/src/main/java/org/mapsforge/map/awt/util/AwtUtil.java | AwtUtil.getMinimumCacheSize | public static int getMinimumCacheSize(int tileSize, double overdrawFactor) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
return (int) Math.max(4, Math.round((2 + screenSize.getWidth() * overdrawFactor / tileSize)
* (2 + screenSize.getHeight() * overdrawFactor / tileSize)));
} | java | public static int getMinimumCacheSize(int tileSize, double overdrawFactor) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
return (int) Math.max(4, Math.round((2 + screenSize.getWidth() * overdrawFactor / tileSize)
* (2 + screenSize.getHeight() * overdrawFactor / tileSize)));
} | [
"public",
"static",
"int",
"getMinimumCacheSize",
"(",
"int",
"tileSize",
",",
"double",
"overdrawFactor",
")",
"{",
"Dimension",
"screenSize",
"=",
"Toolkit",
".",
"getDefaultToolkit",
"(",
")",
".",
"getScreenSize",
"(",
")",
";",
"return",
"(",
"int",
")",
... | Compute the minimum cache size for a view, using the size of the screen.
<p>
Combine with <code>FrameBufferController.setUseSquareFrameBuffer(false);</code>
@param tileSize the tile size
@param overdrawFactor the overdraw factor applied to the map view
@return the minimum cache size for the view | [
"Compute",
"the",
"minimum",
"cache",
"size",
"for",
"a",
"view",
"using",
"the",
"size",
"of",
"the",
"screen",
".",
"<p",
">",
"Combine",
"with",
"<code",
">",
"FrameBufferController",
".",
"setUseSquareFrameBuffer",
"(",
"false",
")",
";",
"<",
"/",
"co... | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-awt/src/main/java/org/mapsforge/map/awt/util/AwtUtil.java#L56-L60 |
junit-team/junit4 | src/main/java/org/junit/runners/model/FrameworkMethod.java | FrameworkMethod.validatePublicVoidNoArg | public void validatePublicVoidNoArg(boolean isStatic, List<Throwable> errors) {
validatePublicVoid(isStatic, errors);
if (method.getParameterTypes().length != 0) {
errors.add(new Exception("Method " + method.getName() + " should have no parameters"));
}
} | java | public void validatePublicVoidNoArg(boolean isStatic, List<Throwable> errors) {
validatePublicVoid(isStatic, errors);
if (method.getParameterTypes().length != 0) {
errors.add(new Exception("Method " + method.getName() + " should have no parameters"));
}
} | [
"public",
"void",
"validatePublicVoidNoArg",
"(",
"boolean",
"isStatic",
",",
"List",
"<",
"Throwable",
">",
"errors",
")",
"{",
"validatePublicVoid",
"(",
"isStatic",
",",
"errors",
")",
";",
"if",
"(",
"method",
".",
"getParameterTypes",
"(",
")",
".",
"le... | Adds to {@code errors} if this method:
<ul>
<li>is not public, or
<li>takes parameters, or
<li>returns something other than void, or
<li>is static (given {@code isStatic is false}), or
<li>is not static (given {@code isStatic is true}).
</ul> | [
"Adds",
"to",
"{"
] | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runners/model/FrameworkMethod.java#L82-L87 |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/ClassFile.java | ClassFile.getFieldIndex | int getFieldIndex(TypeElement declaringClass, String name, TypeMirror type)
{
return getFieldIndex(declaringClass, name, Descriptor.getFieldDesriptor(type));
} | java | int getFieldIndex(TypeElement declaringClass, String name, TypeMirror type)
{
return getFieldIndex(declaringClass, name, Descriptor.getFieldDesriptor(type));
} | [
"int",
"getFieldIndex",
"(",
"TypeElement",
"declaringClass",
",",
"String",
"name",
",",
"TypeMirror",
"type",
")",
"{",
"return",
"getFieldIndex",
"(",
"declaringClass",
",",
"name",
",",
"Descriptor",
".",
"getFieldDesriptor",
"(",
"type",
")",
")",
";",
"}... | Returns the constant map index to field
@param declaringClass
@param name
@param type
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"field"
] | train | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/ClassFile.java#L213-L216 |
payneteasy/superfly | superfly-web/src/main/java/com/payneteasy/superfly/web/wicket/component/label/DateLabels.java | DateLabels.forDate | public static DateLabel forDate(String id, Date date) {
return DateLabel.forDatePattern(id, new Model<Date>(date), DATE_PATTERN);
} | java | public static DateLabel forDate(String id, Date date) {
return DateLabel.forDatePattern(id, new Model<Date>(date), DATE_PATTERN);
} | [
"public",
"static",
"DateLabel",
"forDate",
"(",
"String",
"id",
",",
"Date",
"date",
")",
"{",
"return",
"DateLabel",
".",
"forDatePattern",
"(",
"id",
",",
"new",
"Model",
"<",
"Date",
">",
"(",
"date",
")",
",",
"DATE_PATTERN",
")",
";",
"}"
] | Creates a label which displays date only (year, month, day).
@param id component id
@param date date to display
@return date label | [
"Creates",
"a",
"label",
"which",
"displays",
"date",
"only",
"(",
"year",
"month",
"day",
")",
"."
] | train | https://github.com/payneteasy/superfly/blob/4cad6d0f8e951a61f3c302c49b13a51d179076f8/superfly-web/src/main/java/com/payneteasy/superfly/web/wicket/component/label/DateLabels.java#L26-L28 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CameraPlaneProjection.java | CameraPlaneProjection.pixelToPlane | public boolean pixelToPlane( double pixelX , double pixelY , Point2D_F64 plane ) {
// computer normalized image coordinates
pixelToNorm.compute(pixelX,pixelY,norm);
// Ray pointing from camera center through pixel to ground in ground reference frame
pointing.set(norm.x,norm.y,1);
GeometryMath_F64.mult(cameraToPlane.getR(), pointing, pointing);
double height = cameraToPlane.getY();
// If the point vector and the vector from the plane have the same sign then the ray will not intersect
// the plane or the intersection is undefined
if( pointing.y*height >= 0 )
return false;
// compute the location of the point on the plane in 2D
double t = -height / pointing.y;
plane.x = pointing.z*t;
plane.y = -pointing.x*t;
return true;
} | java | public boolean pixelToPlane( double pixelX , double pixelY , Point2D_F64 plane ) {
// computer normalized image coordinates
pixelToNorm.compute(pixelX,pixelY,norm);
// Ray pointing from camera center through pixel to ground in ground reference frame
pointing.set(norm.x,norm.y,1);
GeometryMath_F64.mult(cameraToPlane.getR(), pointing, pointing);
double height = cameraToPlane.getY();
// If the point vector and the vector from the plane have the same sign then the ray will not intersect
// the plane or the intersection is undefined
if( pointing.y*height >= 0 )
return false;
// compute the location of the point on the plane in 2D
double t = -height / pointing.y;
plane.x = pointing.z*t;
plane.y = -pointing.x*t;
return true;
} | [
"public",
"boolean",
"pixelToPlane",
"(",
"double",
"pixelX",
",",
"double",
"pixelY",
",",
"Point2D_F64",
"plane",
")",
"{",
"// computer normalized image coordinates",
"pixelToNorm",
".",
"compute",
"(",
"pixelX",
",",
"pixelY",
",",
"norm",
")",
";",
"// Ray po... | Given a pixel, find the point on the plane. Be sure computeInverse was set to true in
{@link #setPlaneToCamera(georegression.struct.se.Se3_F64, boolean)}
@param pixelX (input) Pixel in the image, x-axis
@param pixelY (input) Pixel in the image, y-axis
@param plane (output) Point on the plane.
@return true if a point on the plane was found in front of the camera | [
"Given",
"a",
"pixel",
"find",
"the",
"point",
"on",
"the",
"plane",
".",
"Be",
"sure",
"computeInverse",
"was",
"set",
"to",
"true",
"in",
"{",
"@link",
"#setPlaneToCamera",
"(",
"georegression",
".",
"struct",
".",
"se",
".",
"Se3_F64",
"boolean",
")",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CameraPlaneProjection.java#L155-L177 |
amlinv/amq-monitor | amq-monitor-web-impl/src/main/java/com/amlinv/activemq/monitor/model/ActiveMQQueueJmxStats.java | ActiveMQQueueJmxStats.addCounts | public ActiveMQQueueJmxStats addCounts(ActiveMQQueueJmxStats other, String resultBrokerName) {
ActiveMQQueueJmxStats result = new ActiveMQQueueJmxStats(resultBrokerName, this.queueName);
result.setCursorPercentUsage(this.getCursorPercentUsage());
result.setDequeueCount(this.getDequeueCount() + other.getDequeueCount());
result.setEnqueueCount(this.getEnqueueCount() + other.getEnqueueCount());
result.setMemoryPercentUsage(this.getMemoryPercentUsage());
result.setNumConsumers(this.getNumConsumers() + other.getNumConsumers());
result.setNumProducers(this.getNumProducers() + other.getNumProducers());
result.setQueueSize(this.getQueueSize() + other.getQueueSize());
result.setInflightCount(this.getInflightCount() + other.getInflightCount());
return result;
} | java | public ActiveMQQueueJmxStats addCounts(ActiveMQQueueJmxStats other, String resultBrokerName) {
ActiveMQQueueJmxStats result = new ActiveMQQueueJmxStats(resultBrokerName, this.queueName);
result.setCursorPercentUsage(this.getCursorPercentUsage());
result.setDequeueCount(this.getDequeueCount() + other.getDequeueCount());
result.setEnqueueCount(this.getEnqueueCount() + other.getEnqueueCount());
result.setMemoryPercentUsage(this.getMemoryPercentUsage());
result.setNumConsumers(this.getNumConsumers() + other.getNumConsumers());
result.setNumProducers(this.getNumProducers() + other.getNumProducers());
result.setQueueSize(this.getQueueSize() + other.getQueueSize());
result.setInflightCount(this.getInflightCount() + other.getInflightCount());
return result;
} | [
"public",
"ActiveMQQueueJmxStats",
"addCounts",
"(",
"ActiveMQQueueJmxStats",
"other",
",",
"String",
"resultBrokerName",
")",
"{",
"ActiveMQQueueJmxStats",
"result",
"=",
"new",
"ActiveMQQueueJmxStats",
"(",
"resultBrokerName",
",",
"this",
".",
"queueName",
")",
";",
... | Return a new queue stats structure with the total of the stats from this structure and the one given. Returning
a new structure keeps all three structures unchanged, in the manner of immutability, to make it easier to have
safe usage under concurrency. Note that non-count values are copied out from this instance; those values from
the given other stats are ignored.
@param other
@param resultBrokerName
@return | [
"Return",
"a",
"new",
"queue",
"stats",
"structure",
"with",
"the",
"total",
"of",
"the",
"stats",
"from",
"this",
"structure",
"and",
"the",
"one",
"given",
".",
"Returning",
"a",
"new",
"structure",
"keeps",
"all",
"three",
"structures",
"unchanged",
"in",... | train | https://github.com/amlinv/amq-monitor/blob/0ae0156f56d7d3edf98bca9c30b153b770fe5bfa/amq-monitor-web-impl/src/main/java/com/amlinv/activemq/monitor/model/ActiveMQQueueJmxStats.java#L146-L158 |
dmerkushov/log-helper | src/main/java/ru/dmerkushov/loghelper/LogHelperDebug.java | LogHelperDebug.printMessage | public static void printMessage (String message, boolean force) {
if (isDebugEnabled () || force) {
String toOutput = "log-helper DEBUG: " + message.replaceAll ("\n", "\nlog-helper DEBUG: ");
System.out.println (toOutput);
}
} | java | public static void printMessage (String message, boolean force) {
if (isDebugEnabled () || force) {
String toOutput = "log-helper DEBUG: " + message.replaceAll ("\n", "\nlog-helper DEBUG: ");
System.out.println (toOutput);
}
} | [
"public",
"static",
"void",
"printMessage",
"(",
"String",
"message",
",",
"boolean",
"force",
")",
"{",
"if",
"(",
"isDebugEnabled",
"(",
")",
"||",
"force",
")",
"{",
"String",
"toOutput",
"=",
"\"log-helper DEBUG: \"",
"+",
"message",
".",
"replaceAll",
"... | Print a message to <code>System.out</code>, with an every-line prefix: "log-helper DEBUG: "
@param message
@param force <code>true</code> if we need to override the debug enabled flag (i.e. the message is REALLY important), <code>false</code> otherwise | [
"Print",
"a",
"message",
"to",
"<code",
">",
"System",
".",
"out<",
"/",
"code",
">",
"with",
"an",
"every",
"-",
"line",
"prefix",
":",
"log",
"-",
"helper",
"DEBUG",
":"
] | train | https://github.com/dmerkushov/log-helper/blob/3b7d3d30faa7f1437b27cd07c10fa579a995de23/src/main/java/ru/dmerkushov/loghelper/LogHelperDebug.java#L52-L57 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.endOfWeek | public static Calendar endOfWeek(Calendar calendar, boolean isSundayAsLastDay) {
if(isSundayAsLastDay) {
calendar.setFirstDayOfWeek(Calendar.MONDAY);
}
return ceiling(calendar, DateField.WEEK_OF_MONTH);
} | java | public static Calendar endOfWeek(Calendar calendar, boolean isSundayAsLastDay) {
if(isSundayAsLastDay) {
calendar.setFirstDayOfWeek(Calendar.MONDAY);
}
return ceiling(calendar, DateField.WEEK_OF_MONTH);
} | [
"public",
"static",
"Calendar",
"endOfWeek",
"(",
"Calendar",
"calendar",
",",
"boolean",
"isSundayAsLastDay",
")",
"{",
"if",
"(",
"isSundayAsLastDay",
")",
"{",
"calendar",
".",
"setFirstDayOfWeek",
"(",
"Calendar",
".",
"MONDAY",
")",
";",
"}",
"return",
"c... | 获取某周的结束时间
@param calendar 日期 {@link Calendar}
@param isSundayAsLastDay 是否周日做为一周的最后一天(false表示周六做为最后一天)
@return {@link Calendar}
@since 3.1.2 | [
"获取某周的结束时间"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L922-L927 |
authlete/authlete-java-common | src/main/java/com/authlete/common/util/Utils.java | Utils.fromJson | public static <T> T fromJson(String json, Class<T> klass)
{
return GSON.fromJson(json, klass);
} | java | public static <T> T fromJson(String json, Class<T> klass)
{
return GSON.fromJson(json, klass);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"fromJson",
"(",
"String",
"json",
",",
"Class",
"<",
"T",
">",
"klass",
")",
"{",
"return",
"GSON",
".",
"fromJson",
"(",
"json",
",",
"klass",
")",
";",
"}"
] | Convert the given JSON string into an object using
<a href="https://github.com/google/gson">Gson</a>.
@param json
The input JSON.
@param klass
The class of the resultant object.
@return
A new object generated based on the input JSON.
@since 2.0 | [
"Convert",
"the",
"given",
"JSON",
"string",
"into",
"an",
"object",
"using",
"<a",
"href",
"=",
"https",
":",
"//",
"github",
".",
"com",
"/",
"google",
"/",
"gson",
">",
"Gson<",
"/",
"a",
">",
"."
] | train | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/Utils.java#L157-L160 |
RestComm/Restcomm-Connect | restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/cache/DiskCacheFactory.java | DiskCacheFactory.getDiskCache | public DiskCache getDiskCache(final String cachePath, final String cacheUri) {
return new DiskCache(downloader, cachePath, cacheUri, true, cfg.isNoWavCache());
} | java | public DiskCache getDiskCache(final String cachePath, final String cacheUri) {
return new DiskCache(downloader, cachePath, cacheUri, true, cfg.isNoWavCache());
} | [
"public",
"DiskCache",
"getDiskCache",
"(",
"final",
"String",
"cachePath",
",",
"final",
"String",
"cacheUri",
")",
"{",
"return",
"new",
"DiskCache",
"(",
"downloader",
",",
"cachePath",
",",
"cacheUri",
",",
"true",
",",
"cfg",
".",
"isNoWavCache",
"(",
"... | constructor for compatibility with existing cache implementation | [
"constructor",
"for",
"compatibility",
"with",
"existing",
"cache",
"implementation"
] | train | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/cache/DiskCacheFactory.java#L27-L29 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/mime/MimeTypeParser.java | MimeTypeParser.safeParseMimeType | @Nullable
public static MimeType safeParseMimeType (@Nullable final String sMimeType)
{
try
{
return parseMimeType (sMimeType, CMimeType.DEFAULT_QUOTING);
}
catch (final MimeTypeParserException ex)
{
return null;
}
} | java | @Nullable
public static MimeType safeParseMimeType (@Nullable final String sMimeType)
{
try
{
return parseMimeType (sMimeType, CMimeType.DEFAULT_QUOTING);
}
catch (final MimeTypeParserException ex)
{
return null;
}
} | [
"@",
"Nullable",
"public",
"static",
"MimeType",
"safeParseMimeType",
"(",
"@",
"Nullable",
"final",
"String",
"sMimeType",
")",
"{",
"try",
"{",
"return",
"parseMimeType",
"(",
"sMimeType",
",",
"CMimeType",
".",
"DEFAULT_QUOTING",
")",
";",
"}",
"catch",
"("... | Try to convert the string representation of a MIME type to an object. The
default quoting algorithm {@link CMimeType#DEFAULT_QUOTING} is used to
unquote strings. Compared to {@link #parseMimeType(String)} this method
swallows all {@link MimeTypeParserException} and simply returns
<code>null</code>.
@param sMimeType
The string representation to be converted. May be <code>null</code>.
@return <code>null</code> if the parsed string is empty or not a valid mime
type. | [
"Try",
"to",
"convert",
"the",
"string",
"representation",
"of",
"a",
"MIME",
"type",
"to",
"an",
"object",
".",
"The",
"default",
"quoting",
"algorithm",
"{",
"@link",
"CMimeType#DEFAULT_QUOTING",
"}",
"is",
"used",
"to",
"unquote",
"strings",
".",
"Compared"... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/mime/MimeTypeParser.java#L390-L401 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/utils/ReflectionUtils.java | ReflectionUtils.getFieldVal | public static Object getFieldVal(final Object obj, final String fieldName, final boolean throwException)
throws IllegalArgumentException {
if (obj == null || fieldName == null) {
if (throwException) {
throw new NullPointerException();
} else {
return null;
}
}
return getFieldVal(obj.getClass(), obj, fieldName, throwException);
} | java | public static Object getFieldVal(final Object obj, final String fieldName, final boolean throwException)
throws IllegalArgumentException {
if (obj == null || fieldName == null) {
if (throwException) {
throw new NullPointerException();
} else {
return null;
}
}
return getFieldVal(obj.getClass(), obj, fieldName, throwException);
} | [
"public",
"static",
"Object",
"getFieldVal",
"(",
"final",
"Object",
"obj",
",",
"final",
"String",
"fieldName",
",",
"final",
"boolean",
"throwException",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"obj",
"==",
"null",
"||",
"fieldName",
"==",
... | Get the value of the named field in the class of the given object or any of its superclasses. If an exception
is thrown while trying to read the field, and throwException is true, then IllegalArgumentException is thrown
wrapping the cause, otherwise this will return null. If passed a null object, returns null unless
throwException is true, then throws IllegalArgumentException.
@param obj
The object.
@param fieldName
The field name.
@param throwException
If true, throw an exception if the field value could not be read.
@return The field value.
@throws IllegalArgumentException
If the field value could not be read. | [
"Get",
"the",
"value",
"of",
"the",
"named",
"field",
"in",
"the",
"class",
"of",
"the",
"given",
"object",
"or",
"any",
"of",
"its",
"superclasses",
".",
"If",
"an",
"exception",
"is",
"thrown",
"while",
"trying",
"to",
"read",
"the",
"field",
"and",
... | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/ReflectionUtils.java#L123-L133 |
mapsforge/mapsforge | mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/model/TDNode.java | TDNode.fromNode | public static TDNode fromNode(Node node, List<String> preferredLanguages) {
SpecialTagExtractionResult ster = OSMUtils.extractSpecialFields(node, preferredLanguages);
Map<Short, Object> knownWayTags = OSMUtils.extractKnownPOITags(node);
return new TDNode(node.getId(), LatLongUtils.degreesToMicrodegrees(node.getLatitude()),
LatLongUtils.degreesToMicrodegrees(node.getLongitude()), ster.getElevation(), ster.getLayer(),
ster.getHousenumber(), ster.getName(), knownWayTags);
} | java | public static TDNode fromNode(Node node, List<String> preferredLanguages) {
SpecialTagExtractionResult ster = OSMUtils.extractSpecialFields(node, preferredLanguages);
Map<Short, Object> knownWayTags = OSMUtils.extractKnownPOITags(node);
return new TDNode(node.getId(), LatLongUtils.degreesToMicrodegrees(node.getLatitude()),
LatLongUtils.degreesToMicrodegrees(node.getLongitude()), ster.getElevation(), ster.getLayer(),
ster.getHousenumber(), ster.getName(), knownWayTags);
} | [
"public",
"static",
"TDNode",
"fromNode",
"(",
"Node",
"node",
",",
"List",
"<",
"String",
">",
"preferredLanguages",
")",
"{",
"SpecialTagExtractionResult",
"ster",
"=",
"OSMUtils",
".",
"extractSpecialFields",
"(",
"node",
",",
"preferredLanguages",
")",
";",
... | Constructs a new TDNode from a given osmosis node entity. Checks the validity of the entity.
@param node the osmosis entity
@param preferredLanguages the preferred language(s) or null if no preference
@return a new TDNode | [
"Constructs",
"a",
"new",
"TDNode",
"from",
"a",
"given",
"osmosis",
"node",
"entity",
".",
"Checks",
"the",
"validity",
"of",
"the",
"entity",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/model/TDNode.java#L42-L49 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/Check.java | Check.superiorStrict | public static void superiorStrict(int a, int b)
{
if (a <= b)
{
throw new LionEngineException(ERROR_ARGUMENT
+ String.valueOf(a)
+ ERROR_SUPERIOR_STRICT
+ String.valueOf(b));
}
} | java | public static void superiorStrict(int a, int b)
{
if (a <= b)
{
throw new LionEngineException(ERROR_ARGUMENT
+ String.valueOf(a)
+ ERROR_SUPERIOR_STRICT
+ String.valueOf(b));
}
} | [
"public",
"static",
"void",
"superiorStrict",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"if",
"(",
"a",
"<=",
"b",
")",
"{",
"throw",
"new",
"LionEngineException",
"(",
"ERROR_ARGUMENT",
"+",
"String",
".",
"valueOf",
"(",
"a",
")",
"+",
"ERROR_SUPER... | Check if <code>a</code> is strictly superior to <code>b</code>.
@param a The parameter to test.
@param b The parameter to compare to.
@throws LionEngineException If check failed. | [
"Check",
"if",
"<code",
">",
"a<",
"/",
"code",
">",
"is",
"strictly",
"superior",
"to",
"<code",
">",
"b<",
"/",
"code",
">",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/Check.java#L82-L91 |
BioPAX/Paxtools | paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java | QueryExecuter.runGOI | public static Set<BioPAXElement> runGOI(
Set<BioPAXElement> sourceSet,
Model model,
int limit,
Filter... filters)
{
return runPathsFromTo(sourceSet, sourceSet, model, LimitType.NORMAL, limit, filters);
} | java | public static Set<BioPAXElement> runGOI(
Set<BioPAXElement> sourceSet,
Model model,
int limit,
Filter... filters)
{
return runPathsFromTo(sourceSet, sourceSet, model, LimitType.NORMAL, limit, filters);
} | [
"public",
"static",
"Set",
"<",
"BioPAXElement",
">",
"runGOI",
"(",
"Set",
"<",
"BioPAXElement",
">",
"sourceSet",
",",
"Model",
"model",
",",
"int",
"limit",
",",
"Filter",
"...",
"filters",
")",
"{",
"return",
"runPathsFromTo",
"(",
"sourceSet",
",",
"s... | Gets paths between the seed nodes.
@param sourceSet Seed to the query
@param model BioPAX model
@param limit Length limit for the paths to be found
@param filters for filtering graph elements
@return BioPAX elements in the result
@deprecated Use runPathsBetween instead | [
"Gets",
"paths",
"between",
"the",
"seed",
"nodes",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L176-L183 |
wg/lettuce | src/main/java/com/lambdaworks/redis/RedisClient.java | RedisClient.connectPubSub | public <K, V> RedisPubSubConnection<K, V> connectPubSub(RedisCodec<K, V> codec) {
BlockingQueue<Command<K, V, ?>> queue = new LinkedBlockingQueue<Command<K, V, ?>>();
PubSubCommandHandler<K, V> handler = new PubSubCommandHandler<K, V>(queue, codec);
RedisPubSubConnection<K, V> connection = new RedisPubSubConnection<K, V>(queue, codec, timeout, unit);
return connect(handler, connection);
} | java | public <K, V> RedisPubSubConnection<K, V> connectPubSub(RedisCodec<K, V> codec) {
BlockingQueue<Command<K, V, ?>> queue = new LinkedBlockingQueue<Command<K, V, ?>>();
PubSubCommandHandler<K, V> handler = new PubSubCommandHandler<K, V>(queue, codec);
RedisPubSubConnection<K, V> connection = new RedisPubSubConnection<K, V>(queue, codec, timeout, unit);
return connect(handler, connection);
} | [
"public",
"<",
"K",
",",
"V",
">",
"RedisPubSubConnection",
"<",
"K",
",",
"V",
">",
"connectPubSub",
"(",
"RedisCodec",
"<",
"K",
",",
"V",
">",
"codec",
")",
"{",
"BlockingQueue",
"<",
"Command",
"<",
"K",
",",
"V",
",",
"?",
">",
">",
"queue",
... | Open a new pub/sub connection to the redis server. Use the supplied
{@link RedisCodec codec} to encode/decode keys and values.
@param codec Use this codec to encode/decode keys and values.
@return A new pub/sub connection. | [
"Open",
"a",
"new",
"pub",
"/",
"sub",
"connection",
"to",
"the",
"redis",
"server",
".",
"Use",
"the",
"supplied",
"{",
"@link",
"RedisCodec",
"codec",
"}",
"to",
"encode",
"/",
"decode",
"keys",
"and",
"values",
"."
] | train | https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/RedisClient.java#L150-L157 |
glyptodon/guacamole-client | guacamole/src/main/java/org/apache/guacamole/extension/LanguageResourceService.java | LanguageResourceService.addLanguageResource | public void addLanguageResource(String key, Resource resource) {
// Skip loading of language if not allowed
if (!isLanguageAllowed(key)) {
logger.debug("OMITTING language: \"{}\"", key);
return;
}
// Merge language resources if already defined
Resource existing = resources.get(key);
if (existing != null) {
try {
// Read the original language resource
JsonNode existingTree = parseLanguageResource(existing);
if (existingTree == null) {
logger.warn("Base language resource \"{}\" does not exist.", key);
return;
}
// Read new language resource
JsonNode resourceTree = parseLanguageResource(resource);
if (resourceTree == null) {
logger.warn("Overlay language resource \"{}\" does not exist.", key);
return;
}
// Merge the language resources
JsonNode mergedTree = mergeTranslations(existingTree, resourceTree);
resources.put(key, new ByteArrayResource("application/json", mapper.writeValueAsBytes(mergedTree)));
logger.debug("Merged strings with existing language: \"{}\"", key);
}
catch (IOException e) {
logger.error("Unable to merge language resource \"{}\": {}", key, e.getMessage());
logger.debug("Error merging language resource.", e);
}
}
// Otherwise, add new language resource
else {
resources.put(key, resource);
logger.debug("Added language: \"{}\"", key);
}
} | java | public void addLanguageResource(String key, Resource resource) {
// Skip loading of language if not allowed
if (!isLanguageAllowed(key)) {
logger.debug("OMITTING language: \"{}\"", key);
return;
}
// Merge language resources if already defined
Resource existing = resources.get(key);
if (existing != null) {
try {
// Read the original language resource
JsonNode existingTree = parseLanguageResource(existing);
if (existingTree == null) {
logger.warn("Base language resource \"{}\" does not exist.", key);
return;
}
// Read new language resource
JsonNode resourceTree = parseLanguageResource(resource);
if (resourceTree == null) {
logger.warn("Overlay language resource \"{}\" does not exist.", key);
return;
}
// Merge the language resources
JsonNode mergedTree = mergeTranslations(existingTree, resourceTree);
resources.put(key, new ByteArrayResource("application/json", mapper.writeValueAsBytes(mergedTree)));
logger.debug("Merged strings with existing language: \"{}\"", key);
}
catch (IOException e) {
logger.error("Unable to merge language resource \"{}\": {}", key, e.getMessage());
logger.debug("Error merging language resource.", e);
}
}
// Otherwise, add new language resource
else {
resources.put(key, resource);
logger.debug("Added language: \"{}\"", key);
}
} | [
"public",
"void",
"addLanguageResource",
"(",
"String",
"key",
",",
"Resource",
"resource",
")",
"{",
"// Skip loading of language if not allowed",
"if",
"(",
"!",
"isLanguageAllowed",
"(",
"key",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"OMITTING language: \\\... | Adds or overlays the given language resource, which need not exist in
the ServletContext. If a language resource is already defined for the
given language key, the strings from the given resource will be overlaid
on top of the existing strings, augmenting or overriding the available
strings for that language.
@param key
The language key of the resource being added. Language keys are
pairs consisting of a language code followed by an underscore and
country code, such as "en_US".
@param resource
The language resource to add. This resource must have the mimetype
"application/json". | [
"Adds",
"or",
"overlays",
"the",
"given",
"language",
"resource",
"which",
"need",
"not",
"exist",
"in",
"the",
"ServletContext",
".",
"If",
"a",
"language",
"resource",
"is",
"already",
"defined",
"for",
"the",
"given",
"language",
"key",
"the",
"strings",
... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/extension/LanguageResourceService.java#L275-L323 |
Netflix/zeno | src/main/java/com/netflix/zeno/util/collections/algorithms/BinarySearch.java | BinarySearch.rangeCheck | private static void rangeCheck(int length, int fromIndex, int toIndex) {
if (fromIndex > toIndex) {
throw new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
}
if (fromIndex < 0) {
throw new ArrayIndexOutOfBoundsException(fromIndex);
}
if (toIndex > length) {
throw new ArrayIndexOutOfBoundsException(toIndex);
}
} | java | private static void rangeCheck(int length, int fromIndex, int toIndex) {
if (fromIndex > toIndex) {
throw new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
}
if (fromIndex < 0) {
throw new ArrayIndexOutOfBoundsException(fromIndex);
}
if (toIndex > length) {
throw new ArrayIndexOutOfBoundsException(toIndex);
}
} | [
"private",
"static",
"void",
"rangeCheck",
"(",
"int",
"length",
",",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"if",
"(",
"fromIndex",
">",
"toIndex",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"fromIndex(\"",
"+",
"fromIndex",
... | Checks that {@code fromIndex} and {@code toIndex} are in the range and
throws an appropriate exception, if they aren't. | [
"Checks",
"that",
"{"
] | train | https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/main/java/com/netflix/zeno/util/collections/algorithms/BinarySearch.java#L34-L44 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/commons/IOUtils.java | IOUtils.copyLarge | public static long copyLarge(InputStream input, OutputStream output)
throws IOException {
return copyLarge(input, output, new byte[DEFAULT_BUFFER_SIZE]);
} | java | public static long copyLarge(InputStream input, OutputStream output)
throws IOException {
return copyLarge(input, output, new byte[DEFAULT_BUFFER_SIZE]);
} | [
"public",
"static",
"long",
"copyLarge",
"(",
"InputStream",
"input",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"return",
"copyLarge",
"(",
"input",
",",
"output",
",",
"new",
"byte",
"[",
"DEFAULT_BUFFER_SIZE",
"]",
")",
";",
"}"
] | Copy bytes from a large (over 2GB) <code>InputStream</code> to an
<code>OutputStream</code>.
<p>
This method buffers the input internally, so there is no need to use a
<code>BufferedInputStream</code>.
<p>
The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}.
@param input the <code>InputStream</code> to read from
@param output the <code>OutputStream</code> to write to
@return the number of bytes copied
@throws NullPointerException if the input or output is null
@throws IOException if an I/O error occurs
@since 1.3 | [
"Copy",
"bytes",
"from",
"a",
"large",
"(",
"over",
"2GB",
")",
"<code",
">",
"InputStream<",
"/",
"code",
">",
"to",
"an",
"<code",
">",
"OutputStream<",
"/",
"code",
">",
".",
"<p",
">",
"This",
"method",
"buffers",
"the",
"input",
"internally",
"so"... | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/commons/IOUtils.java#L297-L300 |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/SimpleObserver.java | SimpleObserver.handleMoveEvents | private static Function<FedoraEvent, Stream<FedoraEvent>> handleMoveEvents(final Session session) {
return evt -> {
if (evt.getTypes().contains(RESOURCE_RELOCATION)) {
final Map<String, String> movePath = evt.getInfo();
final String dest = movePath.get("destAbsPath");
final String src = movePath.get("srcAbsPath");
final FedoraSession fsession = new FedoraSessionImpl(session);
try {
final FedoraResource resource = new FedoraResourceImpl(session.getNode(evt.getPath()));
return concat(of(evt), resource.getChildren(true).map(FedoraResource::getPath)
.flatMap(path -> of(
new FedoraEventImpl(RESOURCE_RELOCATION, path, evt.getResourceTypes(), evt.getUserID(),
fsession.getUserURI(), evt.getDate(), evt.getInfo()),
new FedoraEventImpl(RESOURCE_DELETION, path.replaceFirst(dest, src), evt.getResourceTypes(),
evt.getUserID(), fsession.getUserURI(), evt.getDate(), evt.getInfo()))));
} catch (final RepositoryException ex) {
throw new RepositoryRuntimeException(ex);
}
}
return of(evt);
};
} | java | private static Function<FedoraEvent, Stream<FedoraEvent>> handleMoveEvents(final Session session) {
return evt -> {
if (evt.getTypes().contains(RESOURCE_RELOCATION)) {
final Map<String, String> movePath = evt.getInfo();
final String dest = movePath.get("destAbsPath");
final String src = movePath.get("srcAbsPath");
final FedoraSession fsession = new FedoraSessionImpl(session);
try {
final FedoraResource resource = new FedoraResourceImpl(session.getNode(evt.getPath()));
return concat(of(evt), resource.getChildren(true).map(FedoraResource::getPath)
.flatMap(path -> of(
new FedoraEventImpl(RESOURCE_RELOCATION, path, evt.getResourceTypes(), evt.getUserID(),
fsession.getUserURI(), evt.getDate(), evt.getInfo()),
new FedoraEventImpl(RESOURCE_DELETION, path.replaceFirst(dest, src), evt.getResourceTypes(),
evt.getUserID(), fsession.getUserURI(), evt.getDate(), evt.getInfo()))));
} catch (final RepositoryException ex) {
throw new RepositoryRuntimeException(ex);
}
}
return of(evt);
};
} | [
"private",
"static",
"Function",
"<",
"FedoraEvent",
",",
"Stream",
"<",
"FedoraEvent",
">",
">",
"handleMoveEvents",
"(",
"final",
"Session",
"session",
")",
"{",
"return",
"evt",
"->",
"{",
"if",
"(",
"evt",
".",
"getTypes",
"(",
")",
".",
"contains",
... | Note: This function maps a FedoraEvent to a Stream of some number of FedoraEvents. This is because a MOVE event
may lead to an arbitrarily large number of additional events for any child resources. In the event of this not
being a MOVE event, the same FedoraEvent is returned, wrapped in a Stream. For a MOVEd resource, the resource in
question will be translated to two FedoraEvents: a MOVED event for the new resource location and a REMOVED event
corresponding to the old location. The same pair of FedoraEvents will also be generated for each child resource. | [
"Note",
":",
"This",
"function",
"maps",
"a",
"FedoraEvent",
"to",
"a",
"Stream",
"of",
"some",
"number",
"of",
"FedoraEvents",
".",
"This",
"is",
"because",
"a",
"MOVE",
"event",
"may",
"lead",
"to",
"an",
"arbitrarily",
"large",
"number",
"of",
"addition... | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/observer/SimpleObserver.java#L107-L129 |
js-lib-com/commons | src/main/java/js/util/Params.java | Params.notNullOrEmpty | public static void notNullOrEmpty(String parameter, String name) throws IllegalArgumentException {
if (parameter == null || parameter.isEmpty()) {
throw new IllegalArgumentException(name + " is null or empty.");
}
} | java | public static void notNullOrEmpty(String parameter, String name) throws IllegalArgumentException {
if (parameter == null || parameter.isEmpty()) {
throw new IllegalArgumentException(name + " is null or empty.");
}
} | [
"public",
"static",
"void",
"notNullOrEmpty",
"(",
"String",
"parameter",
",",
"String",
"name",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"parameter",
"==",
"null",
"||",
"parameter",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"Ill... | Test if string parameter is not null or empty.
@param parameter invocation string parameter,
@param name the name of invocation parameter.
@throws IllegalArgumentException if <code>parameter</code> is null or empty. | [
"Test",
"if",
"string",
"parameter",
"is",
"not",
"null",
"or",
"empty",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L94-L98 |
google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/SparseLongArray.java | SparseLongArray.append | public void append(int key, long value) {
if (mSize != 0 && key <= mKeys[mSize - 1]) {
put(key, value);
return;
}
int pos = mSize;
if (pos >= mKeys.length) {
growKeyAndValueArrays(pos + 1);
}
mKeys[pos] = key;
mValues[pos] = value;
mSize = pos + 1;
} | java | public void append(int key, long value) {
if (mSize != 0 && key <= mKeys[mSize - 1]) {
put(key, value);
return;
}
int pos = mSize;
if (pos >= mKeys.length) {
growKeyAndValueArrays(pos + 1);
}
mKeys[pos] = key;
mValues[pos] = value;
mSize = pos + 1;
} | [
"public",
"void",
"append",
"(",
"int",
"key",
",",
"long",
"value",
")",
"{",
"if",
"(",
"mSize",
"!=",
"0",
"&&",
"key",
"<=",
"mKeys",
"[",
"mSize",
"-",
"1",
"]",
")",
"{",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
";",
"}",
"i... | Puts a key/value pair into the array, optimizing for the case where
the key is greater than all existing keys in the array. | [
"Puts",
"a",
"key",
"/",
"value",
"pair",
"into",
"the",
"array",
"optimizing",
"for",
"the",
"case",
"where",
"the",
"key",
"is",
"greater",
"than",
"all",
"existing",
"keys",
"in",
"the",
"array",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/SparseLongArray.java#L229-L243 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java | CommerceNotificationQueueEntryPersistenceImpl.findBySent | @Override
public List<CommerceNotificationQueueEntry> findBySent(boolean sent,
int start, int end) {
return findBySent(sent, start, end, null);
} | java | @Override
public List<CommerceNotificationQueueEntry> findBySent(boolean sent,
int start, int end) {
return findBySent(sent, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationQueueEntry",
">",
"findBySent",
"(",
"boolean",
"sent",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findBySent",
"(",
"sent",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"... | Returns a range of all the commerce notification queue entries where sent = ?.
<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 CommerceNotificationQueueEntryModelImpl}. 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 sent the sent
@param start the lower bound of the range of commerce notification queue entries
@param end the upper bound of the range of commerce notification queue entries (not inclusive)
@return the range of matching commerce notification queue entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"notification",
"queue",
"entries",
"where",
"sent",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java#L1196-L1200 |
mozilla/rhino | src/org/mozilla/javascript/commonjs/module/RequireBuilder.java | RequireBuilder.createRequire | public Require createRequire(Context cx, Scriptable globalScope) {
return new Require(cx, globalScope, moduleScriptProvider, preExec,
postExec, sandboxed);
} | java | public Require createRequire(Context cx, Scriptable globalScope) {
return new Require(cx, globalScope, moduleScriptProvider, preExec,
postExec, sandboxed);
} | [
"public",
"Require",
"createRequire",
"(",
"Context",
"cx",
",",
"Scriptable",
"globalScope",
")",
"{",
"return",
"new",
"Require",
"(",
"cx",
",",
"globalScope",
",",
"moduleScriptProvider",
",",
"preExec",
",",
"postExec",
",",
"sandboxed",
")",
";",
"}"
] | Creates a new require() function. You are still responsible for invoking
either {@link Require#install(Scriptable)} or
{@link Require#requireMain(Context, String)} to effectively make it
available to its JavaScript program.
@param cx the current context
@param globalScope the global scope containing the JS standard natives.
@return a new Require instance. | [
"Creates",
"a",
"new",
"require",
"()",
"function",
".",
"You",
"are",
"still",
"responsible",
"for",
"invoking",
"either",
"{"
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/commonjs/module/RequireBuilder.java#L90-L93 |
JadiraOrg/jadira | cloning/src/main/java/org/jadira/reflection/core/misc/ClassUtils.java | ClassUtils.collectMethods | public static Method[] collectMethods(Class<?> c, int inclusiveModifiers, int exclusiveModifiers) {
return collectMethods(c, inclusiveModifiers, exclusiveModifiers, Object.class);
} | java | public static Method[] collectMethods(Class<?> c, int inclusiveModifiers, int exclusiveModifiers) {
return collectMethods(c, inclusiveModifiers, exclusiveModifiers, Object.class);
} | [
"public",
"static",
"Method",
"[",
"]",
"collectMethods",
"(",
"Class",
"<",
"?",
">",
"c",
",",
"int",
"inclusiveModifiers",
",",
"int",
"exclusiveModifiers",
")",
"{",
"return",
"collectMethods",
"(",
"c",
",",
"inclusiveModifiers",
",",
"exclusiveModifiers",
... | Produces an array with all the methods of the specified class
@param c The class specified
@param inclusiveModifiers An int indicating the {@link Modifier}s that may be applied
@param exclusiveModifiers An int indicating the {@link Modifier}s that must be excluded
@return The array of matched Methods | [
"Produces",
"an",
"array",
"with",
"all",
"the",
"methods",
"of",
"the",
"specified",
"class"
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/core/misc/ClassUtils.java#L271-L274 |
google/truth | core/src/main/java/com/google/common/truth/GraphMatching.java | GraphMatching.maximumCardinalityBipartiteMatching | static <U, V> ImmutableBiMap<U, V> maximumCardinalityBipartiteMatching(Multimap<U, V> graph) {
return HopcroftKarp.overBipartiteGraph(graph).perform();
} | java | static <U, V> ImmutableBiMap<U, V> maximumCardinalityBipartiteMatching(Multimap<U, V> graph) {
return HopcroftKarp.overBipartiteGraph(graph).perform();
} | [
"static",
"<",
"U",
",",
"V",
">",
"ImmutableBiMap",
"<",
"U",
",",
"V",
">",
"maximumCardinalityBipartiteMatching",
"(",
"Multimap",
"<",
"U",
",",
"V",
">",
"graph",
")",
"{",
"return",
"HopcroftKarp",
".",
"overBipartiteGraph",
"(",
"graph",
")",
".",
... | Finds a <a
href="https://en.wikipedia.org/wiki/Matching_(graph_theory)#In_unweighted_bipartite_graphs">
maximum cardinality matching of a bipartite graph</a>. The vertices of one part of the
bipartite graph are identified by objects of type {@code U} using object equality. The vertices
of the other part are similarly identified by objects of type {@code V}. The input bipartite
graph is represented as a {@code Multimap<U, V>}: each entry represents an edge, with the key
representing the vertex in the first part and the value representing the value in the second
part. (Note that, even if {@code U} and {@code V} are the same type, equality between a key and
a value has no special significance: effectively, they are in different domains.) Fails if any
of the vertices (keys or values) are null. The output matching is similarly represented as a
{@code BiMap<U, V>} (the property that a matching has no common vertices translates into the
bidirectional uniqueness property of the {@link BiMap}).
<p>If there are multiple matchings which share the maximum cardinality, an arbitrary one is
returned. | [
"Finds",
"a",
"<a",
"href",
"=",
"https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Matching_",
"(",
"graph_theory",
")",
"#In_unweighted_bipartite_graphs",
">",
"maximum",
"cardinality",
"matching",
"of",
"a",
"bipartite",
"graph<",
... | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/core/src/main/java/com/google/common/truth/GraphMatching.java#L54-L56 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/query/ServiceInstanceQuery.java | ServiceInstanceQuery.getEqualQueryCriterion | public ServiceInstanceQuery getEqualQueryCriterion(String key, String value){
QueryCriterion c = new EqualQueryCriterion(key, value);
addQueryCriterion(c);
return this;
} | java | public ServiceInstanceQuery getEqualQueryCriterion(String key, String value){
QueryCriterion c = new EqualQueryCriterion(key, value);
addQueryCriterion(c);
return this;
} | [
"public",
"ServiceInstanceQuery",
"getEqualQueryCriterion",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"QueryCriterion",
"c",
"=",
"new",
"EqualQueryCriterion",
"(",
"key",
",",
"value",
")",
";",
"addQueryCriterion",
"(",
"c",
")",
";",
"return",
... | Get a metadata value equal QueryCriterion.
Add a QueryCriterion to check ServiceInstance has metadata value
equal to target.
@param key
the metadata key.
@param value
the metadata value should equal to.
@return
the ServiceInstanceQuery. | [
"Get",
"a",
"metadata",
"value",
"equal",
"QueryCriterion",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/query/ServiceInstanceQuery.java#L61-L65 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/MessageBirdClient.java | MessageBirdClient.updateContact | public Contact updateContact(final String id, ContactRequest contactRequest) throws UnauthorizedException, GeneralException {
if (id == null) {
throw new IllegalArgumentException("Contact ID must be specified.");
}
String request = CONTACTPATH + "/" + id;
return messageBirdService.sendPayLoad("PATCH", request, contactRequest, Contact.class);
} | java | public Contact updateContact(final String id, ContactRequest contactRequest) throws UnauthorizedException, GeneralException {
if (id == null) {
throw new IllegalArgumentException("Contact ID must be specified.");
}
String request = CONTACTPATH + "/" + id;
return messageBirdService.sendPayLoad("PATCH", request, contactRequest, Contact.class);
} | [
"public",
"Contact",
"updateContact",
"(",
"final",
"String",
"id",
",",
"ContactRequest",
"contactRequest",
")",
"throws",
"UnauthorizedException",
",",
"GeneralException",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Updates an existing contact. You only need to supply the unique id that
was returned upon creation. | [
"Updates",
"an",
"existing",
"contact",
".",
"You",
"only",
"need",
"to",
"supply",
"the",
"unique",
"id",
"that",
"was",
"returned",
"upon",
"creation",
"."
] | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L579-L585 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterChain.java | FilterChain.onAsyncResponse | public void onAsyncResponse(ConsumerConfig config, SofaRequest request, SofaResponse response, Throwable throwable)
throws SofaRpcException {
try {
for (Filter loadedFilter : loadedFilters) {
loadedFilter.onAsyncResponse(config, request, response, throwable);
}
} catch (SofaRpcException e) {
LOGGER
.errorWithApp(config.getAppName(), "Catch exception when do filtering after asynchronous respond.", e);
}
} | java | public void onAsyncResponse(ConsumerConfig config, SofaRequest request, SofaResponse response, Throwable throwable)
throws SofaRpcException {
try {
for (Filter loadedFilter : loadedFilters) {
loadedFilter.onAsyncResponse(config, request, response, throwable);
}
} catch (SofaRpcException e) {
LOGGER
.errorWithApp(config.getAppName(), "Catch exception when do filtering after asynchronous respond.", e);
}
} | [
"public",
"void",
"onAsyncResponse",
"(",
"ConsumerConfig",
"config",
",",
"SofaRequest",
"request",
",",
"SofaResponse",
"response",
",",
"Throwable",
"throwable",
")",
"throws",
"SofaRpcException",
"{",
"try",
"{",
"for",
"(",
"Filter",
"loadedFilter",
":",
"loa... | Do filtering when async respond from server
@param config Consumer config
@param request SofaRequest
@param response SofaResponse
@param throwable Throwable when invoke
@throws SofaRpcException occur error | [
"Do",
"filtering",
"when",
"async",
"respond",
"from",
"server"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterChain.java#L274-L284 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Base64.java | Base64.getMimeEncoder | public static Encoder getMimeEncoder(int lineLength, byte[] lineSeparator) {
Objects.requireNonNull(lineSeparator);
int[] base64 = Decoder.fromBase64;
for (byte b : lineSeparator) {
if (base64[b & 0xff] != -1)
throw new IllegalArgumentException(
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
}
if (lineLength <= 0) {
return Encoder.RFC4648;
}
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
} | java | public static Encoder getMimeEncoder(int lineLength, byte[] lineSeparator) {
Objects.requireNonNull(lineSeparator);
int[] base64 = Decoder.fromBase64;
for (byte b : lineSeparator) {
if (base64[b & 0xff] != -1)
throw new IllegalArgumentException(
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
}
if (lineLength <= 0) {
return Encoder.RFC4648;
}
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
} | [
"public",
"static",
"Encoder",
"getMimeEncoder",
"(",
"int",
"lineLength",
",",
"byte",
"[",
"]",
"lineSeparator",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"lineSeparator",
")",
";",
"int",
"[",
"]",
"base64",
"=",
"Decoder",
".",
"fromBase64",
";",
... | Returns a {@link Encoder} that encodes using the
<a href="#mime">MIME</a> type base64 encoding scheme
with specified line length and line separators.
@param lineLength
the length of each output line (rounded down to nearest multiple
of 4). If {@code lineLength <= 0} the output will not be separated
in lines
@param lineSeparator
the line separator for each output line
@return A Base64 encoder.
@throws IllegalArgumentException if {@code lineSeparator} includes any
character of "The Base64 Alphabet" as specified in Table 1 of
RFC 2045. | [
"Returns",
"a",
"{",
"@link",
"Encoder",
"}",
"that",
"encodes",
"using",
"the",
"<a",
"href",
"=",
"#mime",
">",
"MIME<",
"/",
"a",
">",
"type",
"base64",
"encoding",
"scheme",
"with",
"specified",
"line",
"length",
"and",
"line",
"separators",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Base64.java#L130-L142 |
astrapi69/mystic-crypt | crypt-data/src/main/java/de/alpharogroup/crypto/factories/KeyStoreFactory.java | KeyStoreFactory.newKeyStore | public static KeyStore newKeyStore(final String type, final String password,
final File keystoreFile) throws NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, KeyStoreException
{
return newKeyStore(type, password, keystoreFile, false);
} | java | public static KeyStore newKeyStore(final String type, final String password,
final File keystoreFile) throws NoSuchAlgorithmException, CertificateException,
FileNotFoundException, IOException, KeyStoreException
{
return newKeyStore(type, password, keystoreFile, false);
} | [
"public",
"static",
"KeyStore",
"newKeyStore",
"(",
"final",
"String",
"type",
",",
"final",
"String",
"password",
",",
"final",
"File",
"keystoreFile",
")",
"throws",
"NoSuchAlgorithmException",
",",
"CertificateException",
",",
"FileNotFoundException",
",",
"IOExcep... | Factory method for load the {@link KeyStore} object from the given file.
@param type
the type of the keystore
@param password
the password of the keystore
@param keystoreFile
the keystore file
@return the loaded {@link KeyStore} object
@throws NoSuchAlgorithmException
the no such algorithm exception
@throws CertificateException
the certificate exception
@throws FileNotFoundException
the file not found exception
@throws IOException
Signals that an I/O exception has occurred.
@throws KeyStoreException
the key store exception | [
"Factory",
"method",
"for",
"load",
"the",
"{",
"@link",
"KeyStore",
"}",
"object",
"from",
"the",
"given",
"file",
"."
] | train | https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/factories/KeyStoreFactory.java#L68-L73 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/routing/ch/PrepareEncoder.java | PrepareEncoder.getScMergeStatus | public static final int getScMergeStatus(int existingScFlags, int newScFlags) {
if ((existingScFlags & scDirMask) == (newScFlags & scDirMask))
return 1;
else if ((newScFlags & scDirMask) == scDirMask)
return 2;
return 0;
} | java | public static final int getScMergeStatus(int existingScFlags, int newScFlags) {
if ((existingScFlags & scDirMask) == (newScFlags & scDirMask))
return 1;
else if ((newScFlags & scDirMask) == scDirMask)
return 2;
return 0;
} | [
"public",
"static",
"final",
"int",
"getScMergeStatus",
"(",
"int",
"existingScFlags",
",",
"int",
"newScFlags",
")",
"{",
"if",
"(",
"(",
"existingScFlags",
"&",
"scDirMask",
")",
"==",
"(",
"newScFlags",
"&",
"scDirMask",
")",
")",
"return",
"1",
";",
"e... | Returns 1 if existingScFlags of an existing shortcut can be overwritten with a new shortcut by
newScFlags without limiting or changing the directions of the existing shortcut.
The method returns 2 for the same condition but only if the new shortcut has to be added
even if weight is higher than existing shortcut weight.
<pre>
| newScFlags:
existingScFlags | -> | <- | <->
-> | 1 | 0 | 2
<- | 0 | 1 | 2
<-> | 0 | 0 | 1
</pre>
@return 1 if newScFlags is identical to existingScFlags for the two direction bits and 0 otherwise.
There are two special cases when it returns 2. | [
"Returns",
"1",
"if",
"existingScFlags",
"of",
"an",
"existing",
"shortcut",
"can",
"be",
"overwritten",
"with",
"a",
"new",
"shortcut",
"by",
"newScFlags",
"without",
"limiting",
"or",
"changing",
"the",
"directions",
"of",
"the",
"existing",
"shortcut",
".",
... | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/ch/PrepareEncoder.java#L69-L76 |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/core/QuartzScheduler.java | QuartzScheduler.triggerJob | public void triggerJob (final JobKey jobKey, final JobDataMap data) throws SchedulerException
{
validateState ();
final IOperableTrigger trig = (IOperableTrigger) newTrigger ().withIdentity (_newTriggerId (),
IScheduler.DEFAULT_GROUP)
.forJob (jobKey)
.build ();
trig.computeFirstFireTime (null);
if (data != null)
{
trig.setJobDataMap (data);
}
boolean collision = true;
while (collision)
{
try
{
m_aResources.getJobStore ().storeTrigger (trig, false);
collision = false;
}
catch (final ObjectAlreadyExistsException oaee)
{
trig.setKey (new TriggerKey (_newTriggerId (), IScheduler.DEFAULT_GROUP));
}
}
notifySchedulerThread (trig.getNextFireTime ().getTime ());
notifySchedulerListenersSchduled (trig);
} | java | public void triggerJob (final JobKey jobKey, final JobDataMap data) throws SchedulerException
{
validateState ();
final IOperableTrigger trig = (IOperableTrigger) newTrigger ().withIdentity (_newTriggerId (),
IScheduler.DEFAULT_GROUP)
.forJob (jobKey)
.build ();
trig.computeFirstFireTime (null);
if (data != null)
{
trig.setJobDataMap (data);
}
boolean collision = true;
while (collision)
{
try
{
m_aResources.getJobStore ().storeTrigger (trig, false);
collision = false;
}
catch (final ObjectAlreadyExistsException oaee)
{
trig.setKey (new TriggerKey (_newTriggerId (), IScheduler.DEFAULT_GROUP));
}
}
notifySchedulerThread (trig.getNextFireTime ().getTime ());
notifySchedulerListenersSchduled (trig);
} | [
"public",
"void",
"triggerJob",
"(",
"final",
"JobKey",
"jobKey",
",",
"final",
"JobDataMap",
"data",
")",
"throws",
"SchedulerException",
"{",
"validateState",
"(",
")",
";",
"final",
"IOperableTrigger",
"trig",
"=",
"(",
"IOperableTrigger",
")",
"newTrigger",
... | <p>
Trigger the identified <code>{@link com.helger.quartz.IJob}</code> (execute
it now) - with a non-volatile trigger.
</p> | [
"<p",
">",
"Trigger",
"the",
"identified",
"<code",
">",
"{"
] | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/core/QuartzScheduler.java#L947-L977 |
openengsb/openengsb | components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/ManipulationUtils.java | ManipulationUtils.addFileFunction | private static void addFileFunction(CtClass clazz, String property)
throws NotFoundException, CannotCompileException {
String wrapperName = property + "wrapper";
String funcName = "set";
funcName = funcName + Character.toUpperCase(wrapperName.charAt(0));
funcName = funcName + wrapperName.substring(1);
String setterName = "set";
setterName = setterName + Character.toUpperCase(property.charAt(0));
setterName = setterName + property.substring(1);
CtClass[] params = generateClassField(FileWrapper.class);
CtMethod newFunc = new CtMethod(CtClass.voidType, funcName, params, clazz);
newFunc.setBody("{ " + setterName + "($1.returnFile());\n }");
clazz.addMethod(newFunc);
} | java | private static void addFileFunction(CtClass clazz, String property)
throws NotFoundException, CannotCompileException {
String wrapperName = property + "wrapper";
String funcName = "set";
funcName = funcName + Character.toUpperCase(wrapperName.charAt(0));
funcName = funcName + wrapperName.substring(1);
String setterName = "set";
setterName = setterName + Character.toUpperCase(property.charAt(0));
setterName = setterName + property.substring(1);
CtClass[] params = generateClassField(FileWrapper.class);
CtMethod newFunc = new CtMethod(CtClass.voidType, funcName, params, clazz);
newFunc.setBody("{ " + setterName + "($1.returnFile());\n }");
clazz.addMethod(newFunc);
} | [
"private",
"static",
"void",
"addFileFunction",
"(",
"CtClass",
"clazz",
",",
"String",
"property",
")",
"throws",
"NotFoundException",
",",
"CannotCompileException",
"{",
"String",
"wrapperName",
"=",
"property",
"+",
"\"wrapper\"",
";",
"String",
"funcName",
"=",
... | Adds the functionality that the models can handle File objects themselves. | [
"Adds",
"the",
"functionality",
"that",
"the",
"models",
"can",
"handle",
"File",
"objects",
"themselves",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/weaver/service/src/main/java/org/openengsb/core/weaver/service/internal/model/ManipulationUtils.java#L498-L511 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_PUT | public void billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_PUT(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long conditionId, OvhOvhPabxDialplanExtensionConditionTime body) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, conditionId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_PUT(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long conditionId, OvhOvhPabxDialplanExtensionConditionTime body) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, conditionId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_conditionTime_conditionId_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"dialplanId",
",",
"Long",
"extensionId",
",",
"Long",
"conditionId",
",",
... | Alter this object properties
REST: PUT /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/conditionTime/{conditionId}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param dialplanId [required]
@param extensionId [required]
@param conditionId [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7139-L7143 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java | SheetResourcesImpl.createSheetInFolderFromTemplate | public Sheet createSheetInFolderFromTemplate(long folderId, Sheet sheet, EnumSet<SheetTemplateInclusion> includes) throws SmartsheetException {
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("include", QueryUtil.generateCommaSeparatedList(includes));
String path = QueryUtil.generateUrl("folders/" + folderId + "/sheets", parameters);
return this.createResource(path, Sheet.class, sheet);
} | java | public Sheet createSheetInFolderFromTemplate(long folderId, Sheet sheet, EnumSet<SheetTemplateInclusion> includes) throws SmartsheetException {
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("include", QueryUtil.generateCommaSeparatedList(includes));
String path = QueryUtil.generateUrl("folders/" + folderId + "/sheets", parameters);
return this.createResource(path, Sheet.class, sheet);
} | [
"public",
"Sheet",
"createSheetInFolderFromTemplate",
"(",
"long",
"folderId",
",",
"Sheet",
"sheet",
",",
"EnumSet",
"<",
"SheetTemplateInclusion",
">",
"includes",
")",
"throws",
"SmartsheetException",
"{",
"HashMap",
"<",
"String",
",",
"Object",
">",
"parameters... | Create a sheet in given folder.
It mirrors to the following Smartsheet REST API method: POST /folder/{folderId}/sheets
Exceptions:
IllegalArgumentException : if any argument is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param folderId the folder id
@param sheet the sheet
@param includes the includes
@return the sheet to create, limited to the following required
attributes: * name (string) * columns (array of Column objects, limited to the following attributes) - title -
primary - type - symbol - options
@throws SmartsheetException the smartsheet exception | [
"Create",
"a",
"sheet",
"in",
"given",
"folder",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L507-L513 |
HsiangLeekwok/hlklib | hlklib/src/main/java/com/hlk/hlklib/lib/datetimepicker/CustomViewPager.java | CustomViewPager.onMeasure | @Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height = 0;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
int h = child.getMeasuredHeight();
if (h > height)
height = h;
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mDatePicker = (DatePicker) findViewById(R.id.hlklib_datetimepicker_date_picker);
mTimePicker = (TimePicker) findViewById(R.id.hlklib_datetimepicker_time_picker);
} | java | @Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height = 0;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
int h = child.getMeasuredHeight();
if (h > height)
height = h;
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mDatePicker = (DatePicker) findViewById(R.id.hlklib_datetimepicker_date_picker);
mTimePicker = (TimePicker) findViewById(R.id.hlklib_datetimepicker_time_picker);
} | [
"@",
"Override",
"public",
"void",
"onMeasure",
"(",
"int",
"widthMeasureSpec",
",",
"int",
"heightMeasureSpec",
")",
"{",
"int",
"height",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getChildCount",
"(",
")",
";",
"i",
"++",
")"... | Setting wrap_content on a ViewPager's layout_height in XML
doesn't seem to be recognized and the ViewPager will fill the
height of the screen regardless. We'll force the ViewPager to
have the same height as its immediate child.
<p>
Thanks to alexrainman for the bugfix! | [
"Setting",
"wrap_content",
"on",
"a",
"ViewPager",
"s",
"layout_height",
"in",
"XML",
"doesn",
"t",
"seem",
"to",
"be",
"recognized",
"and",
"the",
"ViewPager",
"will",
"fill",
"the",
"height",
"of",
"the",
"screen",
"regardless",
".",
"We",
"ll",
"force",
... | train | https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/lib/datetimepicker/CustomViewPager.java#L51-L69 |
lucee/Lucee | core/src/main/java/lucee/runtime/text/xml/XMLCaster.java | XMLCaster.writeTo | public static void writeTo(Node node, Resource file) throws PageException {
OutputStream os = null;
try {
os = IOUtil.toBufferedOutputStream(file.getOutputStream());
writeTo(node, new StreamResult(os), false, false, null, null, null);
}
catch (IOException ioe) {
throw Caster.toPageException(ioe);
}
finally {
IOUtil.closeEL(os);
}
} | java | public static void writeTo(Node node, Resource file) throws PageException {
OutputStream os = null;
try {
os = IOUtil.toBufferedOutputStream(file.getOutputStream());
writeTo(node, new StreamResult(os), false, false, null, null, null);
}
catch (IOException ioe) {
throw Caster.toPageException(ioe);
}
finally {
IOUtil.closeEL(os);
}
} | [
"public",
"static",
"void",
"writeTo",
"(",
"Node",
"node",
",",
"Resource",
"file",
")",
"throws",
"PageException",
"{",
"OutputStream",
"os",
"=",
"null",
";",
"try",
"{",
"os",
"=",
"IOUtil",
".",
"toBufferedOutputStream",
"(",
"file",
".",
"getOutputStre... | write a xml Dom to a file
@param node
@param file
@throws PageException | [
"write",
"a",
"xml",
"Dom",
"to",
"a",
"file"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L518-L530 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/ModelControllerLock.java | ModelControllerLock.lockInterruptibly | boolean lockInterruptibly(final Integer permit, final long timeout, final TimeUnit unit) throws InterruptedException {
if (permit == null) {
throw new IllegalArgumentException();
}
return sync.tryAcquireNanos(permit, unit.toNanos(timeout));
} | java | boolean lockInterruptibly(final Integer permit, final long timeout, final TimeUnit unit) throws InterruptedException {
if (permit == null) {
throw new IllegalArgumentException();
}
return sync.tryAcquireNanos(permit, unit.toNanos(timeout));
} | [
"boolean",
"lockInterruptibly",
"(",
"final",
"Integer",
"permit",
",",
"final",
"long",
"timeout",
",",
"final",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"permit",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentExcepti... | Acquire the exclusive lock, with a max wait timeout to acquire.
@param permit - the permit Integer for this operation. May not be {@code null}.
@param timeout - the timeout scalar quantity.
@param unit - see {@code TimeUnit} for quantities.
@return {@code boolean} true on successful acquire.
@throws InterruptedException - if the acquiring thread was interrupted.
@throws IllegalArgumentException if {@code permit} is null. | [
"Acquire",
"the",
"exclusive",
"lock",
"with",
"a",
"max",
"wait",
"timeout",
"to",
"acquire",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ModelControllerLock.java#L135-L140 |
dihedron/dihedron-commons | src/main/java/org/dihedron/patterns/visitor/VisitorHelper.java | VisitorHelper.getName | public static String getName(String name, String path) {
logger.trace("getting OGNL name for node '{}' at path '{}'", name, path);
StringBuilder buffer = new StringBuilder();
if(path != null) {
buffer.append(path);
}
if(buffer.length() != 0 && name != null && !name.startsWith("[")) {
buffer.append(".");
}
buffer.append(name);
logger.trace("OGNL path of node is '{}'", buffer.toString());
return buffer.toString();
} | java | public static String getName(String name, String path) {
logger.trace("getting OGNL name for node '{}' at path '{}'", name, path);
StringBuilder buffer = new StringBuilder();
if(path != null) {
buffer.append(path);
}
if(buffer.length() != 0 && name != null && !name.startsWith("[")) {
buffer.append(".");
}
buffer.append(name);
logger.trace("OGNL path of node is '{}'", buffer.toString());
return buffer.toString();
} | [
"public",
"static",
"String",
"getName",
"(",
"String",
"name",
",",
"String",
"path",
")",
"{",
"logger",
".",
"trace",
"(",
"\"getting OGNL name for node '{}' at path '{}'\"",
",",
"name",
",",
"path",
")",
";",
"StringBuilder",
"buffer",
"=",
"new",
"StringBu... | Returns the OGNL name of the node.
@param name
the name of the property.
@param path
the object graph navigation path so far.
@return
the OGNL name of the node. | [
"Returns",
"the",
"OGNL",
"name",
"of",
"the",
"node",
"."
] | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/visitor/VisitorHelper.java#L38-L50 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java | EnvironmentSettingsInner.publishAsync | public Observable<Void> publishAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName) {
return publishWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> publishAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName) {
return publishWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"publishAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"String",
"environmentSettingName",
")",
"{",
"return",
"publishWithServiceResponseAsync",
"(",
"resourceGroupNa... | Provisions/deprovisions required resources for an environment setting based on current state of the lab/environment setting.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param environmentSettingName The name of the environment Setting.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Provisions",
"/",
"deprovisions",
"required",
"resources",
"for",
"an",
"environment",
"setting",
"based",
"on",
"current",
"state",
"of",
"the",
"lab",
"/",
"environment",
"setting",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java#L1232-L1239 |
bignerdranch/expandable-recycler-view | sampleapp/src/main/java/com/bignerdranch/expandablerecyclerviewsample/linear/horizontal/HorizontalExpandableAdapter.java | HorizontalExpandableAdapter.onCreateParentViewHolder | @UiThread
@NonNull
@Override
public HorizontalParentViewHolder onCreateParentViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = mInflater.inflate(R.layout.list_item_parent_horizontal, parent, false);
return new HorizontalParentViewHolder(view);
} | java | @UiThread
@NonNull
@Override
public HorizontalParentViewHolder onCreateParentViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = mInflater.inflate(R.layout.list_item_parent_horizontal, parent, false);
return new HorizontalParentViewHolder(view);
} | [
"@",
"UiThread",
"@",
"NonNull",
"@",
"Override",
"public",
"HorizontalParentViewHolder",
"onCreateParentViewHolder",
"(",
"@",
"NonNull",
"ViewGroup",
"parent",
",",
"int",
"viewType",
")",
"{",
"View",
"view",
"=",
"mInflater",
".",
"inflate",
"(",
"R",
".",
... | OnCreateViewHolder implementation for parent items. The desired ParentViewHolder should
be inflated here
@param parent for inflating the View
@return the user's custom parent ViewHolder that must extend ParentViewHolder | [
"OnCreateViewHolder",
"implementation",
"for",
"parent",
"items",
".",
"The",
"desired",
"ParentViewHolder",
"should",
"be",
"inflated",
"here"
] | train | https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/sampleapp/src/main/java/com/bignerdranch/expandablerecyclerviewsample/linear/horizontal/HorizontalExpandableAdapter.java#L41-L47 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/json/JsonDriverFunction.java | JsonDriverFunction.exportTable | @Override
public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String encoding) throws SQLException, IOException {
JsonWriteDriver jsonDriver = new JsonWriteDriver(connection);
jsonDriver.write(progress,tableReference, fileName, encoding);
} | java | @Override
public void exportTable(Connection connection, String tableReference, File fileName, ProgressVisitor progress, String encoding) throws SQLException, IOException {
JsonWriteDriver jsonDriver = new JsonWriteDriver(connection);
jsonDriver.write(progress,tableReference, fileName, encoding);
} | [
"@",
"Override",
"public",
"void",
"exportTable",
"(",
"Connection",
"connection",
",",
"String",
"tableReference",
",",
"File",
"fileName",
",",
"ProgressVisitor",
"progress",
",",
"String",
"encoding",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"Jso... | Save a table or a query to JSON file
@param connection
@param tableReference
@param fileName
@param progress
@param encoding
@throws SQLException
@throws IOException | [
"Save",
"a",
"table",
"or",
"a",
"query",
"to",
"JSON",
"file"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/json/JsonDriverFunction.java#L81-L85 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ExperimentsInner.java | ExperimentsInner.getAsync | public Observable<ExperimentInner> getAsync(String resourceGroupName, String workspaceName, String experimentName) {
return getWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName).map(new Func1<ServiceResponse<ExperimentInner>, ExperimentInner>() {
@Override
public ExperimentInner call(ServiceResponse<ExperimentInner> response) {
return response.body();
}
});
} | java | public Observable<ExperimentInner> getAsync(String resourceGroupName, String workspaceName, String experimentName) {
return getWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName).map(new Func1<ServiceResponse<ExperimentInner>, ExperimentInner>() {
@Override
public ExperimentInner call(ServiceResponse<ExperimentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExperimentInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workspaceName",
",",
"String",
"experimentName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workspaceName",
",",
... | Gets information about an Experiment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExperimentInner object | [
"Gets",
"information",
"about",
"an",
"Experiment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/ExperimentsInner.java#L722-L729 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.getDisplayScript | public static String getDisplayScript(String localeID, String displayLocaleID) {
return getDisplayScriptInternal(new ULocale(localeID), new ULocale(displayLocaleID));
} | java | public static String getDisplayScript(String localeID, String displayLocaleID) {
return getDisplayScriptInternal(new ULocale(localeID), new ULocale(displayLocaleID));
} | [
"public",
"static",
"String",
"getDisplayScript",
"(",
"String",
"localeID",
",",
"String",
"displayLocaleID",
")",
"{",
"return",
"getDisplayScriptInternal",
"(",
"new",
"ULocale",
"(",
"localeID",
")",
",",
"new",
"ULocale",
"(",
"displayLocaleID",
")",
")",
"... | <strong>[icu]</strong> Returns a locale's script localized for display in the provided locale.
This is a cover for the ICU4C API.
@param localeID the id of the locale whose script will be displayed
@param displayLocaleID the id of the locale in which to display the name.
@return the localized script name. | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"a",
"locale",
"s",
"script",
"localized",
"for",
"display",
"in",
"the",
"provided",
"locale",
".",
"This",
"is",
"a",
"cover",
"for",
"the",
"ICU4C",
"API",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1510-L1512 |
sporniket/core | sporniket-core-io/src/main/java/com/sporniket/libre/io/FileTools.java | FileTools.createReaderForInputStream | public static Reader createReaderForInputStream(InputStream source, Encoding encoding)
throws FileNotFoundException, UnsupportedEncodingException
{
return (null == encoding) ? new InputStreamReader(source) : new InputStreamReader(source, encoding.getSunOldIoName());
} | java | public static Reader createReaderForInputStream(InputStream source, Encoding encoding)
throws FileNotFoundException, UnsupportedEncodingException
{
return (null == encoding) ? new InputStreamReader(source) : new InputStreamReader(source, encoding.getSunOldIoName());
} | [
"public",
"static",
"Reader",
"createReaderForInputStream",
"(",
"InputStream",
"source",
",",
"Encoding",
"encoding",
")",
"throws",
"FileNotFoundException",
",",
"UnsupportedEncodingException",
"{",
"return",
"(",
"null",
"==",
"encoding",
")",
"?",
"new",
"InputStr... | Instanciate a Reader for a InputStream using the given encoding.
@param source
source stream.
@param encoding
can be <code>null</code>
@return the reader.
@throws FileNotFoundException
if there is a problem to deal with.
@throws UnsupportedEncodingException
if there is a problem to deal with.
@since 12.06.01 | [
"Instanciate",
"a",
"Reader",
"for",
"a",
"InputStream",
"using",
"the",
"given",
"encoding",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-io/src/main/java/com/sporniket/libre/io/FileTools.java#L171-L175 |
mboudreau/Alternator | src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java | DynamoDBMapper.validBatchGetRequest | private boolean validBatchGetRequest(Map<Class<?>, List<KeyPair>> itemsToGet) {
if (itemsToGet == null || itemsToGet.size() == 0) {
return false;
}
for (Class<?> clazz : itemsToGet.keySet()) {
if (itemsToGet.get(clazz) != null && itemsToGet.get(clazz).size() > 0) {
return true;
}
}
return false;
} | java | private boolean validBatchGetRequest(Map<Class<?>, List<KeyPair>> itemsToGet) {
if (itemsToGet == null || itemsToGet.size() == 0) {
return false;
}
for (Class<?> clazz : itemsToGet.keySet()) {
if (itemsToGet.get(clazz) != null && itemsToGet.get(clazz).size() > 0) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"validBatchGetRequest",
"(",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"List",
"<",
"KeyPair",
">",
">",
"itemsToGet",
")",
"{",
"if",
"(",
"itemsToGet",
"==",
"null",
"||",
"itemsToGet",
".",
"size",
"(",
")",
"==",
"0",
")",
"{... | Check whether the batchGetRequest meet all the constraints.
@param itemsToGet | [
"Check",
"whether",
"the",
"batchGetRequest",
"meet",
"all",
"the",
"constraints",
"."
] | train | https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/datamodeling/DynamoDBMapper.java#L950-L961 |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/cookies/CookieHelper.java | CookieHelper.getCookieValue | public static String getCookieValue(String name, Cookies cookies) {
Cookie c = cookies.get(name);
if (c != null) {
return c.value();
}
return null;
} | java | public static String getCookieValue(String name, Cookies cookies) {
Cookie c = cookies.get(name);
if (c != null) {
return c.value();
}
return null;
} | [
"public",
"static",
"String",
"getCookieValue",
"(",
"String",
"name",
",",
"Cookies",
"cookies",
")",
"{",
"Cookie",
"c",
"=",
"cookies",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"return",
"c",
".",
"value",
"(",
... | Gets the value of the cookie having the given name. The cookie is looked from the given cookies set.
@param name the name of the cookie
@param cookies the set of cookie
@return the value of the cookie, {@literal null} if there are no cookie with the given name in the cookies set. | [
"Gets",
"the",
"value",
"of",
"the",
"cookie",
"having",
"the",
"given",
"name",
".",
"The",
"cookie",
"is",
"looked",
"from",
"the",
"given",
"cookies",
"set",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/cookies/CookieHelper.java#L107-L113 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/authentication/ExtensionAuthentication.java | ExtensionAuthentication.getPopupFlagLoggedOutIndicatorMenu | private PopupContextMenuItemFactory getPopupFlagLoggedOutIndicatorMenu() {
if (this.popupFlagLoggedOutIndicatorMenuFactory == null) {
popupFlagLoggedOutIndicatorMenuFactory = new PopupContextMenuItemFactory("dd - "
+ Constant.messages.getString("context.flag.popup")) {
private static final long serialVersionUID = 2453839120088204123L;
@Override
public ExtensionPopupMenuItem getContextMenu(Context context, String parentMenu) {
return new PopupFlagLoggedOutIndicatorMenu(context);
}
};
}
return this.popupFlagLoggedOutIndicatorMenuFactory;
} | java | private PopupContextMenuItemFactory getPopupFlagLoggedOutIndicatorMenu() {
if (this.popupFlagLoggedOutIndicatorMenuFactory == null) {
popupFlagLoggedOutIndicatorMenuFactory = new PopupContextMenuItemFactory("dd - "
+ Constant.messages.getString("context.flag.popup")) {
private static final long serialVersionUID = 2453839120088204123L;
@Override
public ExtensionPopupMenuItem getContextMenu(Context context, String parentMenu) {
return new PopupFlagLoggedOutIndicatorMenu(context);
}
};
}
return this.popupFlagLoggedOutIndicatorMenuFactory;
} | [
"private",
"PopupContextMenuItemFactory",
"getPopupFlagLoggedOutIndicatorMenu",
"(",
")",
"{",
"if",
"(",
"this",
".",
"popupFlagLoggedOutIndicatorMenuFactory",
"==",
"null",
")",
"{",
"popupFlagLoggedOutIndicatorMenuFactory",
"=",
"new",
"PopupContextMenuItemFactory",
"(",
"... | Gets the popup menu for flagging the "Logged out" pattern.
@return the popup menu | [
"Gets",
"the",
"popup",
"menu",
"for",
"flagging",
"the",
"Logged",
"out",
"pattern",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/authentication/ExtensionAuthentication.java#L178-L193 |
alkacon/opencms-core | src-modules/org/opencms/workplace/list/A_CmsListDialog.java | A_CmsListDialog.setListObject | public void setListObject(Class<?> listDialog, CmsHtmlList listObject) {
if (listObject == null) {
// null object: remove the entry from the map
getListObjectMap(getSettings()).remove(listDialog.getName());
} else {
if ((listObject.getMetadata() != null) && listObject.getMetadata().isVolatile()) {
listObject.setMetadata(null);
}
getListObjectMap(getSettings()).put(listDialog.getName(), listObject);
}
} | java | public void setListObject(Class<?> listDialog, CmsHtmlList listObject) {
if (listObject == null) {
// null object: remove the entry from the map
getListObjectMap(getSettings()).remove(listDialog.getName());
} else {
if ((listObject.getMetadata() != null) && listObject.getMetadata().isVolatile()) {
listObject.setMetadata(null);
}
getListObjectMap(getSettings()).put(listDialog.getName(), listObject);
}
} | [
"public",
"void",
"setListObject",
"(",
"Class",
"<",
"?",
">",
"listDialog",
",",
"CmsHtmlList",
"listObject",
")",
"{",
"if",
"(",
"listObject",
"==",
"null",
")",
"{",
"// null object: remove the entry from the map",
"getListObjectMap",
"(",
"getSettings",
"(",
... | Stores the given object as "list object" for the given list dialog in the current users session.<p>
@param listDialog the list dialog class
@param listObject the list to store | [
"Stores",
"the",
"given",
"object",
"as",
"list",
"object",
"for",
"the",
"given",
"list",
"dialog",
"in",
"the",
"current",
"users",
"session",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/A_CmsListDialog.java#L728-L739 |
apache/groovy | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.firstRow | public GroovyRowResult firstRow(String sql, Object[] params) throws SQLException {
return firstRow(sql, Arrays.asList(params));
} | java | public GroovyRowResult firstRow(String sql, Object[] params) throws SQLException {
return firstRow(sql, Arrays.asList(params));
} | [
"public",
"GroovyRowResult",
"firstRow",
"(",
"String",
"sql",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"SQLException",
"{",
"return",
"firstRow",
"(",
"sql",
",",
"Arrays",
".",
"asList",
"(",
"params",
")",
")",
";",
"}"
] | Performs the given SQL query and return the first row of the result set.
<p>
An Object array variant of {@link #firstRow(String, List)}.
<p>
This method supports named and named ordinal parameters by supplying such
parameters in the <code>params</code> array. See the class Javadoc for more details.
@param sql the SQL statement
@param params an array of parameters
@return a GroovyRowResult object or <code>null</code> if no row is found
@throws SQLException if a database access error occurs | [
"Performs",
"the",
"given",
"SQL",
"query",
"and",
"return",
"the",
"first",
"row",
"of",
"the",
"result",
"set",
".",
"<p",
">",
"An",
"Object",
"array",
"variant",
"of",
"{",
"@link",
"#firstRow",
"(",
"String",
"List",
")",
"}",
".",
"<p",
">",
"T... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L2289-L2291 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cdn_dedicated_serviceName_quota_GET | public ArrayList<String> cdn_dedicated_serviceName_quota_GET(String serviceName, OvhOrderQuotaEnum quota) throws IOException {
String qPath = "/order/cdn/dedicated/{serviceName}/quota";
StringBuilder sb = path(qPath, serviceName);
query(sb, "quota", quota);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> cdn_dedicated_serviceName_quota_GET(String serviceName, OvhOrderQuotaEnum quota) throws IOException {
String qPath = "/order/cdn/dedicated/{serviceName}/quota";
StringBuilder sb = path(qPath, serviceName);
query(sb, "quota", quota);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"cdn_dedicated_serviceName_quota_GET",
"(",
"String",
"serviceName",
",",
"OvhOrderQuotaEnum",
"quota",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cdn/dedicated/{serviceName}/quota\"",
";",
"StringBuilder"... | Get allowed durations for 'quota' option
REST: GET /order/cdn/dedicated/{serviceName}/quota
@param quota [required] quota number in TB that will be added to the CDN service
@param serviceName [required] The internal name of your CDN offer | [
"Get",
"allowed",
"durations",
"for",
"quota",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5337-L5343 |
SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java | Settings.getDouble | @CheckForNull
public Double getDouble(String key) {
String value = getString(key);
if (StringUtils.isNotEmpty(value)) {
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new IllegalStateException(String.format("The property '%s' is not a double value", key));
}
}
return null;
} | java | @CheckForNull
public Double getDouble(String key) {
String value = getString(key);
if (StringUtils.isNotEmpty(value)) {
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new IllegalStateException(String.format("The property '%s' is not a double value", key));
}
}
return null;
} | [
"@",
"CheckForNull",
"public",
"Double",
"getDouble",
"(",
"String",
"key",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"key",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"value",
")",
")",
"{",
"try",
"{",
"return",
"Double",
"... | Effective value as {@code Double}.
@return the value as {@code Double}. If the property does not have value nor default value, then {@code null} is returned.
@throws NumberFormatException if value is not empty and is not a parsable number | [
"Effective",
"value",
"as",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java#L249-L260 |
mapcode-foundation/mapcode-java | src/main/java/com/mapcode/MapcodeCodec.java | MapcodeCodec.decodeToRectangle | @Nonnull
public static Rectangle decodeToRectangle(@Nonnull final String mapcode, @Nullable final Territory defaultTerritoryContext)
throws UnknownMapcodeException, IllegalArgumentException, UnknownPrecisionFormatException {
checkNonnull("mapcode", mapcode);
final MapcodeZone mapcodeZone = decodeToMapcodeZone(mapcode, defaultTerritoryContext);
final Point southWest = Point.fromLatLonFractions(mapcodeZone.getLatFractionMin(), mapcodeZone.getLonFractionMin());
final Point northEast = Point.fromLatLonFractions(mapcodeZone.getLatFractionMax(), mapcodeZone.getLonFractionMax());
final Rectangle rectangle = new Rectangle(southWest, northEast);
assert rectangle.isDefined();
return rectangle;
} | java | @Nonnull
public static Rectangle decodeToRectangle(@Nonnull final String mapcode, @Nullable final Territory defaultTerritoryContext)
throws UnknownMapcodeException, IllegalArgumentException, UnknownPrecisionFormatException {
checkNonnull("mapcode", mapcode);
final MapcodeZone mapcodeZone = decodeToMapcodeZone(mapcode, defaultTerritoryContext);
final Point southWest = Point.fromLatLonFractions(mapcodeZone.getLatFractionMin(), mapcodeZone.getLonFractionMin());
final Point northEast = Point.fromLatLonFractions(mapcodeZone.getLatFractionMax(), mapcodeZone.getLonFractionMax());
final Rectangle rectangle = new Rectangle(southWest, northEast);
assert rectangle.isDefined();
return rectangle;
} | [
"@",
"Nonnull",
"public",
"static",
"Rectangle",
"decodeToRectangle",
"(",
"@",
"Nonnull",
"final",
"String",
"mapcode",
",",
"@",
"Nullable",
"final",
"Territory",
"defaultTerritoryContext",
")",
"throws",
"UnknownMapcodeException",
",",
"IllegalArgumentException",
","... | Decode a mapcode to a Rectangle, which defines the valid zone for a mapcode. The boundaries of the
mapcode zone are inclusive for the South and West borders and exclusive for the North and East borders.
This is essentially the same call as a 'decode', except it returns a rectangle, rather than its center point.
@param mapcode Mapcode.
@param defaultTerritoryContext Default territory context for disambiguation purposes. May be null.
@return Rectangle Mapcode zone. South/West borders are inclusive, North/East borders exclusive.
@throws UnknownMapcodeException Thrown if the mapcode has the correct syntax,
but cannot be decoded into a point.
@throws UnknownPrecisionFormatException Thrown if the precision format is incorrect.
@throws IllegalArgumentException Thrown if arguments are null, or if the syntax of the mapcode is incorrect. | [
"Decode",
"a",
"mapcode",
"to",
"a",
"Rectangle",
"which",
"defines",
"the",
"valid",
"zone",
"for",
"a",
"mapcode",
".",
"The",
"boundaries",
"of",
"the",
"mapcode",
"zone",
"are",
"inclusive",
"for",
"the",
"South",
"and",
"West",
"borders",
"and",
"excl... | train | https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/MapcodeCodec.java#L369-L379 |
stevespringett/Alpine | alpine/src/main/java/alpine/crypto/KeyManager.java | KeyManager.loadKeyPair | private KeyPair loadKeyPair() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
// Read Private Key
final File filePrivateKey = getKeyPath(KeyType.PRIVATE);
// Read Public Key
final File filePublicKey = getKeyPath(KeyType.PUBLIC);
byte[] encodedPrivateKey;
byte[] encodedPublicKey;
try (InputStream pvtfis = Files.newInputStream(filePrivateKey.toPath());
InputStream pubfis = Files.newInputStream(filePublicKey.toPath())) {
encodedPrivateKey = new byte[(int) filePrivateKey.length()];
pvtfis.read(encodedPrivateKey);
encodedPublicKey = new byte[(int) filePublicKey.length()];
pubfis.read(encodedPublicKey);
}
// Generate KeyPair
final KeyFactory keyFactory = KeyFactory.getInstance("RSA");
final X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(encodedPublicKey);
final PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);
final PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(encodedPrivateKey);
final PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec);
return this.keyPair = new KeyPair(publicKey, privateKey);
} | java | private KeyPair loadKeyPair() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
// Read Private Key
final File filePrivateKey = getKeyPath(KeyType.PRIVATE);
// Read Public Key
final File filePublicKey = getKeyPath(KeyType.PUBLIC);
byte[] encodedPrivateKey;
byte[] encodedPublicKey;
try (InputStream pvtfis = Files.newInputStream(filePrivateKey.toPath());
InputStream pubfis = Files.newInputStream(filePublicKey.toPath())) {
encodedPrivateKey = new byte[(int) filePrivateKey.length()];
pvtfis.read(encodedPrivateKey);
encodedPublicKey = new byte[(int) filePublicKey.length()];
pubfis.read(encodedPublicKey);
}
// Generate KeyPair
final KeyFactory keyFactory = KeyFactory.getInstance("RSA");
final X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(encodedPublicKey);
final PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);
final PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(encodedPrivateKey);
final PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec);
return this.keyPair = new KeyPair(publicKey, privateKey);
} | [
"private",
"KeyPair",
"loadKeyPair",
"(",
")",
"throws",
"IOException",
",",
"NoSuchAlgorithmException",
",",
"InvalidKeySpecException",
"{",
"// Read Private Key",
"final",
"File",
"filePrivateKey",
"=",
"getKeyPath",
"(",
"KeyType",
".",
"PRIVATE",
")",
";",
"// Rea... | Loads a key pair.
@return a KeyPair
@throws IOException if the file cannot be read
@throws NoSuchAlgorithmException if the algorithm cannot be found
@throws InvalidKeySpecException if the algorithm's key spec is incorrect | [
"Loads",
"a",
"key",
"pair",
"."
] | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/KeyManager.java#L245-L273 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java | RouteFiltersInner.beginCreateOrUpdate | public RouteFilterInner beginCreateOrUpdate(String resourceGroupName, String routeFilterName, RouteFilterInner routeFilterParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).toBlocking().single().body();
} | java | public RouteFilterInner beginCreateOrUpdate(String resourceGroupName, String routeFilterName, RouteFilterInner routeFilterParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).toBlocking().single().body();
} | [
"public",
"RouteFilterInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeFilterName",
",",
"RouteFilterInner",
"routeFilterParameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeF... | Creates or updates a route filter in a specified resource group.
@param resourceGroupName The name of the resource group.
@param routeFilterName The name of the route filter.
@param routeFilterParameters Parameters supplied to the create or update route filter 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 RouteFilterInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"route",
"filter",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java#L518-L520 |
Activiti/Activiti | activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java | ProcessEngineConfigurationImpl.addWsEndpointAddress | public ProcessEngineConfiguration addWsEndpointAddress(QName endpointName, URL address) {
this.wsOverridenEndpointAddresses.put(endpointName, address);
return this;
} | java | public ProcessEngineConfiguration addWsEndpointAddress(QName endpointName, URL address) {
this.wsOverridenEndpointAddresses.put(endpointName, address);
return this;
} | [
"public",
"ProcessEngineConfiguration",
"addWsEndpointAddress",
"(",
"QName",
"endpointName",
",",
"URL",
"address",
")",
"{",
"this",
".",
"wsOverridenEndpointAddresses",
".",
"put",
"(",
"endpointName",
",",
"address",
")",
";",
"return",
"this",
";",
"}"
] | Add or replace the address of the given web-service endpoint with the given value
@param endpointName The endpoint name for which a new address must be set
@param address The new address of the endpoint | [
"Add",
"or",
"replace",
"the",
"address",
"of",
"the",
"given",
"web",
"-",
"service",
"endpoint",
"with",
"the",
"given",
"value"
] | train | https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L2427-L2430 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java | HttpContext.executeGetRequest | protected <T> Optional<T> executeGetRequest(URI uri, Map<String, Object> headers,
List<String> queryParams, GenericType<T> returnType)
{
WebTarget target = this.client.target(uri);
target = applyQueryParams(target, queryParams);
Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
applyHeaders(invocation, headers);
Response response = invocation.get();
handleResponseError("GET", uri, response);
logResponse(uri, response);
return extractEntityFromResponse(response, returnType);
} | java | protected <T> Optional<T> executeGetRequest(URI uri, Map<String, Object> headers,
List<String> queryParams, GenericType<T> returnType)
{
WebTarget target = this.client.target(uri);
target = applyQueryParams(target, queryParams);
Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON);
applyHeaders(invocation, headers);
Response response = invocation.get();
handleResponseError("GET", uri, response);
logResponse(uri, response);
return extractEntityFromResponse(response, returnType);
} | [
"protected",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"executeGetRequest",
"(",
"URI",
"uri",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
",",
"List",
"<",
"String",
">",
"queryParams",
",",
"GenericType",
"<",
"T",
">",
"returnType",
")... | Execute a GET request and return the result.
@param <T> The type parameter used for the return object
@param uri The URI to call
@param returnType The type to marshall the result back into
@param headers A set of headers to add to the request
@param queryParams A set of query parameters to add to the request
@return The return type | [
"Execute",
"a",
"GET",
"request",
"and",
"return",
"the",
"result",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L342-L353 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/manager/HBCIJobFactory.java | HBCIJobFactory.newJob | public static AbstractHBCIJob newJob(String jobname, HBCIPassportInternal passport) {
log.debug("creating new job " + jobname);
if (jobname == null || jobname.length() == 0)
throw new InvalidArgumentException(HBCIUtils.getLocMsg("EXCMSG_EMPTY_JOBNAME"));
AbstractHBCIJob ret = null;
String className = "org.kapott.hbci.GV.GV" + jobname;
try {
Class cl = Class.forName(className);
Constructor cons = cl.getConstructor(HBCIPassportInternal.class);
ret = (AbstractHBCIJob) cons.newInstance(new Object[]{passport});
} catch (ClassNotFoundException e) {
throw new InvalidUserDataException("*** there is no highlevel job named " + jobname + " - need class " + className);
} catch (Exception e) {
String msg = HBCIUtils.getLocMsg("EXCMSG_JOB_CREATE_ERR", jobname);
throw new HBCI_Exception(msg, e);
}
return ret;
} | java | public static AbstractHBCIJob newJob(String jobname, HBCIPassportInternal passport) {
log.debug("creating new job " + jobname);
if (jobname == null || jobname.length() == 0)
throw new InvalidArgumentException(HBCIUtils.getLocMsg("EXCMSG_EMPTY_JOBNAME"));
AbstractHBCIJob ret = null;
String className = "org.kapott.hbci.GV.GV" + jobname;
try {
Class cl = Class.forName(className);
Constructor cons = cl.getConstructor(HBCIPassportInternal.class);
ret = (AbstractHBCIJob) cons.newInstance(new Object[]{passport});
} catch (ClassNotFoundException e) {
throw new InvalidUserDataException("*** there is no highlevel job named " + jobname + " - need class " + className);
} catch (Exception e) {
String msg = HBCIUtils.getLocMsg("EXCMSG_JOB_CREATE_ERR", jobname);
throw new HBCI_Exception(msg, e);
}
return ret;
} | [
"public",
"static",
"AbstractHBCIJob",
"newJob",
"(",
"String",
"jobname",
",",
"HBCIPassportInternal",
"passport",
")",
"{",
"log",
".",
"debug",
"(",
"\"creating new job \"",
"+",
"jobname",
")",
";",
"if",
"(",
"jobname",
"==",
"null",
"||",
"jobname",
".",... | <p>Erzeugen eines neuen Highlevel-HBCI-Jobs. Diese Methode gibt ein neues Job-Objekt zurück. Dieses
Objekt wird allerdings noch <em>nicht</em> zum HBCI-Dialog hinzugefügt. Statt dessen
müssen erst alle zur Beschreibung des jeweiligen Jobs benötigten Parameter gesetzt werden.
<p>Eine Beschreibung aller unterstützten Geschäftsvorfälle befindet sich
im Package <code>org.kapott.hbci.GV</code>.</p>
@param jobname der Name des Jobs, der erzeugt werden soll. Gültige
Job-Namen sowie die benötigten Parameter sind in der Beschreibung des Packages
<code>org.kapott.hbci.GV</code> zu finden.
@return ein Job-Objekt, für das die entsprechenden Job-Parameter gesetzt werden müssen und
welches anschließend zum HBCI-Dialog hinzugefügt werden kann. | [
"<p",
">",
"Erzeugen",
"eines",
"neuen",
"Highlevel",
"-",
"HBCI",
"-",
"Jobs",
".",
"Diese",
"Methode",
"gibt",
"ein",
"neues",
"Job",
"-",
"Objekt",
"zurück",
".",
"Dieses",
"Objekt",
"wird",
"allerdings",
"noch",
"<em",
">",
"nicht<",
"/",
"em",
">",
... | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIJobFactory.java#L28-L49 |
bazaarvoice/emodb | event/src/main/java/com/bazaarvoice/emodb/event/dedup/DefaultDedupEventStore.java | DefaultDedupEventStore.getQueueReadOnly | private SortedQueue getQueueReadOnly(String queueName, Duration waitDuration) {
DedupQueue service = getQueueReadWrite(queueName, waitDuration);
if (service != null) {
try {
return service.getQueue();
} catch (ReadOnlyQueueException e) {
// Fall through
}
}
return _sortedQueueFactory.create(queueName, true, _queueDAO);
} | java | private SortedQueue getQueueReadOnly(String queueName, Duration waitDuration) {
DedupQueue service = getQueueReadWrite(queueName, waitDuration);
if (service != null) {
try {
return service.getQueue();
} catch (ReadOnlyQueueException e) {
// Fall through
}
}
return _sortedQueueFactory.create(queueName, true, _queueDAO);
} | [
"private",
"SortedQueue",
"getQueueReadOnly",
"(",
"String",
"queueName",
",",
"Duration",
"waitDuration",
")",
"{",
"DedupQueue",
"service",
"=",
"getQueueReadWrite",
"(",
"queueName",
",",
"waitDuration",
")",
";",
"if",
"(",
"service",
"!=",
"null",
")",
"{",... | Returns the persistent sorted queue managed by this JVM, or a stub that supports only read-only operations if
not managed by this JVM. | [
"Returns",
"the",
"persistent",
"sorted",
"queue",
"managed",
"by",
"this",
"JVM",
"or",
"a",
"stub",
"that",
"supports",
"only",
"read",
"-",
"only",
"operations",
"if",
"not",
"managed",
"by",
"this",
"JVM",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/event/src/main/java/com/bazaarvoice/emodb/event/dedup/DefaultDedupEventStore.java#L171-L181 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Octahedron.java | Octahedron.getVertices | @Override
public Point3d[] getVertices() {
Point3d[] octahedron = new Point3d[6];
octahedron[0] = new Point3d(-cirumscribedRadius, 0, 0);
octahedron[1] = new Point3d( cirumscribedRadius, 0, 0);
octahedron[2] = new Point3d(0, -cirumscribedRadius, 0);
octahedron[3] = new Point3d(0, cirumscribedRadius, 0);
octahedron[4] = new Point3d(0, 0, -cirumscribedRadius);
octahedron[5] = new Point3d(0, 0, cirumscribedRadius);
return octahedron;
} | java | @Override
public Point3d[] getVertices() {
Point3d[] octahedron = new Point3d[6];
octahedron[0] = new Point3d(-cirumscribedRadius, 0, 0);
octahedron[1] = new Point3d( cirumscribedRadius, 0, 0);
octahedron[2] = new Point3d(0, -cirumscribedRadius, 0);
octahedron[3] = new Point3d(0, cirumscribedRadius, 0);
octahedron[4] = new Point3d(0, 0, -cirumscribedRadius);
octahedron[5] = new Point3d(0, 0, cirumscribedRadius);
return octahedron;
} | [
"@",
"Override",
"public",
"Point3d",
"[",
"]",
"getVertices",
"(",
")",
"{",
"Point3d",
"[",
"]",
"octahedron",
"=",
"new",
"Point3d",
"[",
"6",
"]",
";",
"octahedron",
"[",
"0",
"]",
"=",
"new",
"Point3d",
"(",
"-",
"cirumscribedRadius",
",",
"0",
... | Returns the vertices of an n-fold polygon of given radius and center
@param n
@param radius
@param center
@return | [
"Returns",
"the",
"vertices",
"of",
"an",
"n",
"-",
"fold",
"polygon",
"of",
"given",
"radius",
"and",
"center"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Octahedron.java#L100-L111 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsInner.java | DatabaseOperationsInner.cancelAsync | public Observable<Void> cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) {
return cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) {
return cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"cancelAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"UUID",
"operationId",
")",
"{",
"return",
"cancelWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Cancels the asynchronous operation on the database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param operationId The operation identifier.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Cancels",
"the",
"asynchronous",
"operation",
"on",
"the",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseOperationsInner.java#L116-L123 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/builder/XmlSqlInfoBuilder.java | XmlSqlInfoBuilder.buildLikeSql | public SqlInfo buildLikeSql(String fieldText, String valueText, String patternText) {
if (StringHelper.isNotBlank(valueText) && StringHelper.isBlank(patternText)) {
return super.buildLikeSql(fieldText, ParseHelper.parseExpressWithException(valueText, context));
} else if (StringHelper.isBlank(valueText) && StringHelper.isNotBlank(patternText)) {
return super.buildLikePatternSql(fieldText, patternText);
} else {
throw new ValidFailException("<like /> 标签中的'value'属性和'pattern'属性不能同时为空或者同时不为空!");
}
} | java | public SqlInfo buildLikeSql(String fieldText, String valueText, String patternText) {
if (StringHelper.isNotBlank(valueText) && StringHelper.isBlank(patternText)) {
return super.buildLikeSql(fieldText, ParseHelper.parseExpressWithException(valueText, context));
} else if (StringHelper.isBlank(valueText) && StringHelper.isNotBlank(patternText)) {
return super.buildLikePatternSql(fieldText, patternText);
} else {
throw new ValidFailException("<like /> 标签中的'value'属性和'pattern'属性不能同时为空或者同时不为空!");
}
} | [
"public",
"SqlInfo",
"buildLikeSql",
"(",
"String",
"fieldText",
",",
"String",
"valueText",
",",
"String",
"patternText",
")",
"{",
"if",
"(",
"StringHelper",
".",
"isNotBlank",
"(",
"valueText",
")",
"&&",
"StringHelper",
".",
"isBlank",
"(",
"patternText",
... | 构建Like模糊查询的sqlInfo信息.
@param fieldText 字段文本值
@param valueText 参数值
@param patternText 模式字符串文本
@return 返回SqlInfo信息 | [
"构建Like模糊查询的sqlInfo信息",
"."
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/builder/XmlSqlInfoBuilder.java#L54-L62 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/types/CompareHelper.java | CompareHelper.ge | public static <T> boolean ge(Comparable<T> a, T b)
{
return ge(a.compareTo(b));
} | java | public static <T> boolean ge(Comparable<T> a, T b)
{
return ge(a.compareTo(b));
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"ge",
"(",
"Comparable",
"<",
"T",
">",
"a",
",",
"T",
"b",
")",
"{",
"return",
"ge",
"(",
"a",
".",
"compareTo",
"(",
"b",
")",
")",
";",
"}"
] | <code>a >= b</code>
@param <T>
@param a
@param b
@return true if a >= b | [
"<code",
">",
"a",
">",
"=",
"b<",
"/",
"code",
">"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/CompareHelper.java#L128-L131 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowControllerFactory.java | FlowControllerFactory.getPageFlowForRequest | public PageFlowController getPageFlowForRequest( RequestContext context )
throws InstantiationException, IllegalAccessException
{
String servletPath = InternalUtils.getDecodedServletPath( context.getHttpRequest() );
return getPageFlowForPath( context, servletPath );
} | java | public PageFlowController getPageFlowForRequest( RequestContext context )
throws InstantiationException, IllegalAccessException
{
String servletPath = InternalUtils.getDecodedServletPath( context.getHttpRequest() );
return getPageFlowForPath( context, servletPath );
} | [
"public",
"PageFlowController",
"getPageFlowForRequest",
"(",
"RequestContext",
"context",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"String",
"servletPath",
"=",
"InternalUtils",
".",
"getDecodedServletPath",
"(",
"context",
".",
"getHttp... | Get the page flow instance that should be associated with the given request. If it doesn't exist, create it.
If one is created, the page flow stack (for nesting) will be cleared or pushed, and the new instance will be
stored as the current page flow.
@param context a {@link RequestContext} object which contains the current request and response.
@return the {@link PageFlowController} for the request, or <code>null</code> if none was found. | [
"Get",
"the",
"page",
"flow",
"instance",
"that",
"should",
"be",
"associated",
"with",
"the",
"given",
"request",
".",
"If",
"it",
"doesn",
"t",
"exist",
"create",
"it",
".",
"If",
"one",
"is",
"created",
"the",
"page",
"flow",
"stack",
"(",
"for",
"n... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowControllerFactory.java#L123-L128 |
google/closure-templates | java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java | Context.getMsgEscapingStrategy | Optional<MsgEscapingStrategy> getMsgEscapingStrategy(SoyNode node) {
switch (state) {
case HTML_PCDATA:
// In normal HTML PCDATA context, it makes sense to escape all of the print nodes, but not
// escape the entire message. This allows Soy to support putting anchors and other small
// bits of HTML in messages.
return Optional.of(new MsgEscapingStrategy(this, ImmutableList.of()));
case CSS_DQ_STRING:
case CSS_SQ_STRING:
case JS_DQ_STRING:
case JS_SQ_STRING:
case TEXT:
case URI:
if (state == HtmlContext.URI && uriPart != UriPart.QUERY) {
// NOTE: Only support the query portion of URIs.
return Optional.absent();
}
// In other contexts like JS and CSS strings, it makes sense to treat the message's
// placeholders as plain text, but escape the entire result of message evaluation.
return Optional.of(
new MsgEscapingStrategy(
new Context(HtmlContext.TEXT), getEscapingModes(node, ImmutableList.of())));
case HTML_RCDATA:
case HTML_NORMAL_ATTR_VALUE:
case HTML_COMMENT:
// The weirdest case is HTML attributes. Ideally, we'd like to treat these as a text string
// and escape when done. However, many messages have HTML entities such as » in them.
// A good way around this is to escape the print nodes in the message, but normalize
// (escape except for ampersands) the final message.
// Also, content inside <title>, <textarea>, and HTML comments have a similar requirement,
// where any entities in the messages are probably intended to be preserved.
return Optional.of(
new MsgEscapingStrategy(this, ImmutableList.of(EscapingMode.NORMALIZE_HTML)));
default:
// Other contexts, primarily source code contexts, don't have a meaningful way to support
// natural language text.
return Optional.absent();
}
} | java | Optional<MsgEscapingStrategy> getMsgEscapingStrategy(SoyNode node) {
switch (state) {
case HTML_PCDATA:
// In normal HTML PCDATA context, it makes sense to escape all of the print nodes, but not
// escape the entire message. This allows Soy to support putting anchors and other small
// bits of HTML in messages.
return Optional.of(new MsgEscapingStrategy(this, ImmutableList.of()));
case CSS_DQ_STRING:
case CSS_SQ_STRING:
case JS_DQ_STRING:
case JS_SQ_STRING:
case TEXT:
case URI:
if (state == HtmlContext.URI && uriPart != UriPart.QUERY) {
// NOTE: Only support the query portion of URIs.
return Optional.absent();
}
// In other contexts like JS and CSS strings, it makes sense to treat the message's
// placeholders as plain text, but escape the entire result of message evaluation.
return Optional.of(
new MsgEscapingStrategy(
new Context(HtmlContext.TEXT), getEscapingModes(node, ImmutableList.of())));
case HTML_RCDATA:
case HTML_NORMAL_ATTR_VALUE:
case HTML_COMMENT:
// The weirdest case is HTML attributes. Ideally, we'd like to treat these as a text string
// and escape when done. However, many messages have HTML entities such as » in them.
// A good way around this is to escape the print nodes in the message, but normalize
// (escape except for ampersands) the final message.
// Also, content inside <title>, <textarea>, and HTML comments have a similar requirement,
// where any entities in the messages are probably intended to be preserved.
return Optional.of(
new MsgEscapingStrategy(this, ImmutableList.of(EscapingMode.NORMALIZE_HTML)));
default:
// Other contexts, primarily source code contexts, don't have a meaningful way to support
// natural language text.
return Optional.absent();
}
} | [
"Optional",
"<",
"MsgEscapingStrategy",
">",
"getMsgEscapingStrategy",
"(",
"SoyNode",
"node",
")",
"{",
"switch",
"(",
"state",
")",
"{",
"case",
"HTML_PCDATA",
":",
"// In normal HTML PCDATA context, it makes sense to escape all of the print nodes, but not",
"// escape the en... | Determines the strategy to escape Soy msg tags.
<p>Importantly, this determines the context that the message should be considered in, how the
print nodes will be escaped, and how the entire message will be escaped. We need different
strategies in different contexts because messages in general aren't trusted, but we also need
to be able to include markup interspersed in an HTML message; for example, an anchor that Soy
factored out of the message.
<p>Note that it'd be very nice to be able to simply escape the strings that came out of the
translation database, and distribute the escaping entirely over the print nodes. However, the
translation machinery, especially in Javascript, doesn't offer a way to escape just the bits
that come from the translation database without also re-escaping the substitutions.
@param node The node, for error messages
@return relevant strategy, or absent in case there's no valid strategy and it is an error to
have a message in this context | [
"Determines",
"the",
"strategy",
"to",
"escape",
"Soy",
"msg",
"tags",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L557-L598 |
TakahikoKawasaki/nv-websocket-client | src/main/java/com/neovisionaries/ws/client/WebSocketFactory.java | WebSocketFactory.createSocket | public WebSocket createSocket(URL url, int timeout) throws IOException
{
if (url == null)
{
throw new IllegalArgumentException("The given URL is null.");
}
if (timeout < 0)
{
throw new IllegalArgumentException("The given timeout value is negative.");
}
try
{
return createSocket(url.toURI(), timeout);
}
catch (URISyntaxException e)
{
throw new IllegalArgumentException("Failed to convert the given URL into a URI.");
}
} | java | public WebSocket createSocket(URL url, int timeout) throws IOException
{
if (url == null)
{
throw new IllegalArgumentException("The given URL is null.");
}
if (timeout < 0)
{
throw new IllegalArgumentException("The given timeout value is negative.");
}
try
{
return createSocket(url.toURI(), timeout);
}
catch (URISyntaxException e)
{
throw new IllegalArgumentException("Failed to convert the given URL into a URI.");
}
} | [
"public",
"WebSocket",
"createSocket",
"(",
"URL",
"url",
",",
"int",
"timeout",
")",
"throws",
"IOException",
"{",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The given URL is null.\"",
")",
";",
"}",
"if",
... | Create a WebSocket.
<p>
This method is an alias of {@link #createSocket(URI, int) createSocket}{@code
(url.}{@link URL#toURI() toURI()}{@code , timeout)}.
</p>
@param url
The URL of the WebSocket endpoint on the server side.
@param timeout
The timeout value in milliseconds for socket connection.
@return
A WebSocket.
@throws IllegalArgumentException
The given URL is {@code null} or failed to be converted into a URI,
or the given timeout value is negative.
@throws IOException
Failed to create a socket. Or, HTTP proxy handshake or SSL
handshake failed.
@since 1.10 | [
"Create",
"a",
"WebSocket",
"."
] | train | https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/WebSocketFactory.java#L445-L465 |
jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/UrlUtil.java | UrlUtil.constructAbsoluteUrl | public static String constructAbsoluteUrl(String theBase, String theEndpoint) {
if (theEndpoint == null) {
return null;
}
if (isAbsolute(theEndpoint)) {
return theEndpoint;
}
if (theBase == null) {
return theEndpoint;
}
try {
return new URL(new URL(theBase), theEndpoint).toString();
} catch (MalformedURLException e) {
ourLog.warn("Failed to resolve relative URL[" + theEndpoint + "] against absolute base[" + theBase + "]", e);
return theEndpoint;
}
} | java | public static String constructAbsoluteUrl(String theBase, String theEndpoint) {
if (theEndpoint == null) {
return null;
}
if (isAbsolute(theEndpoint)) {
return theEndpoint;
}
if (theBase == null) {
return theEndpoint;
}
try {
return new URL(new URL(theBase), theEndpoint).toString();
} catch (MalformedURLException e) {
ourLog.warn("Failed to resolve relative URL[" + theEndpoint + "] against absolute base[" + theBase + "]", e);
return theEndpoint;
}
} | [
"public",
"static",
"String",
"constructAbsoluteUrl",
"(",
"String",
"theBase",
",",
"String",
"theEndpoint",
")",
"{",
"if",
"(",
"theEndpoint",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"isAbsolute",
"(",
"theEndpoint",
")",
")",
"{"... | Resolve a relative URL - THIS METHOD WILL NOT FAIL but will log a warning and return theEndpoint if the input is invalid. | [
"Resolve",
"a",
"relative",
"URL",
"-",
"THIS",
"METHOD",
"WILL",
"NOT",
"FAIL",
"but",
"will",
"log",
"a",
"warning",
"and",
"return",
"theEndpoint",
"if",
"the",
"input",
"is",
"invalid",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/UrlUtil.java#L53-L70 |
pressgang-ccms/PressGangCCMSDatasourceProviders | rest-provider/src/main/java/org/jboss/pressgang/ccms/provider/RESTProviderFactory.java | RESTProviderFactory.registerProvider | public <T extends RESTDataProvider> void registerProvider(Class<T> providerClass, Class<?> providerInterface) {
try {
final Constructor<T> constructor = providerClass.getConstructor(RESTProviderFactory.class);
final T instance = constructor.newInstance(this);
providerMap.put(providerClass, instance);
if (providerInterface != null) {
providerMap.put(providerInterface, instance);
}
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | java | public <T extends RESTDataProvider> void registerProvider(Class<T> providerClass, Class<?> providerInterface) {
try {
final Constructor<T> constructor = providerClass.getConstructor(RESTProviderFactory.class);
final T instance = constructor.newInstance(this);
providerMap.put(providerClass, instance);
if (providerInterface != null) {
providerMap.put(providerInterface, instance);
}
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
} | [
"public",
"<",
"T",
"extends",
"RESTDataProvider",
">",
"void",
"registerProvider",
"(",
"Class",
"<",
"T",
">",
"providerClass",
",",
"Class",
"<",
"?",
">",
"providerInterface",
")",
"{",
"try",
"{",
"final",
"Constructor",
"<",
"T",
">",
"constructor",
... | Register an external provider with the provider factory.
@param providerClass The Class of the Provider.
@param providerInterface The Class that the Provider implements.
@param <T> The Provider class type. | [
"Register",
"an",
"external",
"provider",
"with",
"the",
"provider",
"factory",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSDatasourceProviders/blob/e47588adad0dcd55608b197b37825a512bc8fd25/rest-provider/src/main/java/org/jboss/pressgang/ccms/provider/RESTProviderFactory.java#L223-L241 |
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor | SurveyorCore/src/main/java/org/wwarn/surveyor/server/core/FileChangeMonitor.java | FileChangeMonitor.initNewThread | protected void initNewThread(Path monitoredFile, CountDownLatch start, CountDownLatch stop) throws IOException {
final Runnable watcher = initializeWatcherWithDirectory(monitoredFile, start, stop);
final Thread thread = new Thread(watcher);
thread.setDaemon(false);
thread.start();
} | java | protected void initNewThread(Path monitoredFile, CountDownLatch start, CountDownLatch stop) throws IOException {
final Runnable watcher = initializeWatcherWithDirectory(monitoredFile, start, stop);
final Thread thread = new Thread(watcher);
thread.setDaemon(false);
thread.start();
} | [
"protected",
"void",
"initNewThread",
"(",
"Path",
"monitoredFile",
",",
"CountDownLatch",
"start",
",",
"CountDownLatch",
"stop",
")",
"throws",
"IOException",
"{",
"final",
"Runnable",
"watcher",
"=",
"initializeWatcherWithDirectory",
"(",
"monitoredFile",
",",
"sta... | Added countdown latches as a synchronization aid to allow better unit testing
Allows one or more threads to wait until a set of operations being performed in other threads completes,
@param monitoredFile
@param start calling start.await() waits till file listner is active and ready
@param stop calling stop.await() allows calling code to wait until a fileChangedEvent is processed
@throws IOException | [
"Added",
"countdown",
"latches",
"as",
"a",
"synchronization",
"aid",
"to",
"allow",
"better",
"unit",
"testing",
"Allows",
"one",
"or",
"more",
"threads",
"to",
"wait",
"until",
"a",
"set",
"of",
"operations",
"being",
"performed",
"in",
"other",
"threads",
... | train | https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/server/core/FileChangeMonitor.java#L101-L106 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/host_cpu_core.java | host_cpu_core.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
host_cpu_core_responses result = (host_cpu_core_responses) service.get_payload_formatter().string_to_resource(host_cpu_core_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.host_cpu_core_response_array);
}
host_cpu_core[] result_host_cpu_core = new host_cpu_core[result.host_cpu_core_response_array.length];
for(int i = 0; i < result.host_cpu_core_response_array.length; i++)
{
result_host_cpu_core[i] = result.host_cpu_core_response_array[i].host_cpu_core[0];
}
return result_host_cpu_core;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
host_cpu_core_responses result = (host_cpu_core_responses) service.get_payload_formatter().string_to_resource(host_cpu_core_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.host_cpu_core_response_array);
}
host_cpu_core[] result_host_cpu_core = new host_cpu_core[result.host_cpu_core_response_array.length];
for(int i = 0; i < result.host_cpu_core_response_array.length; i++)
{
result_host_cpu_core[i] = result.host_cpu_core_response_array[i].host_cpu_core[0];
}
return result_host_cpu_core;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"host_cpu_core_responses",
"result",
"=",
"(",
"host_cpu_core_responses",
")",
"service",
".",
"get_payload_fo... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/host_cpu_core.java#L232-L249 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/HexUtil.java | HexUtil.bytesToHex | public static final String bytesToHex(byte[] bs, int off, int length) {
StringBuffer sb = new StringBuffer(length * 2);
bytesToHexAppend(bs, off, length, sb);
return sb.toString();
} | java | public static final String bytesToHex(byte[] bs, int off, int length) {
StringBuffer sb = new StringBuffer(length * 2);
bytesToHexAppend(bs, off, length, sb);
return sb.toString();
} | [
"public",
"static",
"final",
"String",
"bytesToHex",
"(",
"byte",
"[",
"]",
"bs",
",",
"int",
"off",
",",
"int",
"length",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"length",
"*",
"2",
")",
";",
"bytesToHexAppend",
"(",
"bs",
","... | Converts a byte array into a string of upper case hex chars.
@param bs
A byte array
@param off
The index of the first byte to read
@param length
The number of bytes to read.
@return the string of hex chars. | [
"Converts",
"a",
"byte",
"array",
"into",
"a",
"string",
"of",
"upper",
"case",
"hex",
"chars",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/HexUtil.java#L47-L51 |
yanzhenjie/Album | album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java | AlbumUtils.takeImage | public static void takeImage(@NonNull Activity activity, int requestCode, File outPath) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Uri uri = getUri(activity, outPath);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
activity.startActivityForResult(intent, requestCode);
} | java | public static void takeImage(@NonNull Activity activity, int requestCode, File outPath) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Uri uri = getUri(activity, outPath);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
activity.startActivityForResult(intent, requestCode);
} | [
"public",
"static",
"void",
"takeImage",
"(",
"@",
"NonNull",
"Activity",
"activity",
",",
"int",
"requestCode",
",",
"File",
"outPath",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"MediaStore",
".",
"ACTION_IMAGE_CAPTURE",
")",
";",
"Uri",
"uri... | Take picture.
@param activity activity.
@param requestCode code, see {@link Activity#onActivityResult(int, int, Intent)}.
@param outPath file path. | [
"Take",
"picture",
"."
] | train | https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L114-L121 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java | DirectedGraph.removeEdge | public void removeEdge(N a, N b)
{
if(!containsBoth(a, b))
return;
nodes.get(a).getOutgoing().remove(b);
nodes.get(b).getIncoming().remove(a);
} | java | public void removeEdge(N a, N b)
{
if(!containsBoth(a, b))
return;
nodes.get(a).getOutgoing().remove(b);
nodes.get(b).getIncoming().remove(a);
} | [
"public",
"void",
"removeEdge",
"(",
"N",
"a",
",",
"N",
"b",
")",
"{",
"if",
"(",
"!",
"containsBoth",
"(",
"a",
",",
"b",
")",
")",
"return",
";",
"nodes",
".",
"get",
"(",
"a",
")",
".",
"getOutgoing",
"(",
")",
".",
"remove",
"(",
"b",
")... | Removes a directed edge from the network connecting <tt>a</tt> to <tt>b</tt>.
If <tt>a</tt> and <tt>b</tt> are not nodes in the graph, nothing occurs.
@param a the parent node
@param b the child node | [
"Removes",
"a",
"directed",
"edge",
"from",
"the",
"network",
"connecting",
"<tt",
">",
"a<",
"/",
"tt",
">",
"to",
"<tt",
">",
"b<",
"/",
"tt",
">",
".",
"If",
"<tt",
">",
"a<",
"/",
"tt",
">",
"and",
"<tt",
">",
"b<",
"/",
"tt",
">",
"are",
... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/bayesian/graphicalmodel/DirectedGraph.java#L190-L196 |
Impetus/Kundera | src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java | MongoDBClient.createUniqueIndexGFS | private void createUniqueIndexGFS(DBCollection coll, String id)
{
try
{
coll.createIndex(new BasicDBObject("metadata." + id, 1), new BasicDBObject("unique", true));
}
catch (MongoException ex)
{
throw new KunderaException("Error in creating unique indexes in " + coll.getFullName() + " collection on "
+ id + " field");
}
} | java | private void createUniqueIndexGFS(DBCollection coll, String id)
{
try
{
coll.createIndex(new BasicDBObject("metadata." + id, 1), new BasicDBObject("unique", true));
}
catch (MongoException ex)
{
throw new KunderaException("Error in creating unique indexes in " + coll.getFullName() + " collection on "
+ id + " field");
}
} | [
"private",
"void",
"createUniqueIndexGFS",
"(",
"DBCollection",
"coll",
",",
"String",
"id",
")",
"{",
"try",
"{",
"coll",
".",
"createIndex",
"(",
"new",
"BasicDBObject",
"(",
"\"metadata.\"",
"+",
"id",
",",
"1",
")",
",",
"new",
"BasicDBObject",
"(",
"\... | Creates the unique index gfs.
@param coll
the coll
@param id
the id | [
"Creates",
"the",
"unique",
"index",
"gfs",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L1958-L1969 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/sptree/SpTree.java | SpTree.computeNonEdgeForces | public void computeNonEdgeForces(int pointIndex, double theta, INDArray negativeForce, AtomicDouble sumQ) {
// Make sure that we spend no time on empty nodes or self-interactions
if (cumSize == 0 || (isLeaf() && size == 1 && index[0] == pointIndex))
return;
MemoryWorkspace workspace =
workspaceMode == WorkspaceMode.NONE ? new DummyWorkspace()
: Nd4j.getWorkspaceManager().getWorkspaceForCurrentThread(
workspaceConfigurationExternal,
workspaceExternal);
try (MemoryWorkspace ws = workspace.notifyScopeEntered()) {
// Compute distance between point and center-of-mass
buf.assign(data.slice(pointIndex)).subi(centerOfMass);
double D = Nd4j.getBlasWrapper().dot(buf, buf);
// Check whether we can use this node as a "summary"
double maxWidth = boundary.width().max(Integer.MAX_VALUE).getDouble(0);
// Check whether we can use this node as a "summary"
if (isLeaf() || maxWidth / Math.sqrt(D) < theta) {
// Compute and add t-SNE force between point and current node
double Q = 1.0 / (1.0 + D);
double mult = cumSize * Q;
sumQ.addAndGet(mult);
mult *= Q;
negativeForce.addi(buf.muli(mult));
} else {
// Recursively apply Barnes-Hut to children
for (int i = 0; i < numChildren; i++) {
children[i].computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ);
}
}
}
} | java | public void computeNonEdgeForces(int pointIndex, double theta, INDArray negativeForce, AtomicDouble sumQ) {
// Make sure that we spend no time on empty nodes or self-interactions
if (cumSize == 0 || (isLeaf() && size == 1 && index[0] == pointIndex))
return;
MemoryWorkspace workspace =
workspaceMode == WorkspaceMode.NONE ? new DummyWorkspace()
: Nd4j.getWorkspaceManager().getWorkspaceForCurrentThread(
workspaceConfigurationExternal,
workspaceExternal);
try (MemoryWorkspace ws = workspace.notifyScopeEntered()) {
// Compute distance between point and center-of-mass
buf.assign(data.slice(pointIndex)).subi(centerOfMass);
double D = Nd4j.getBlasWrapper().dot(buf, buf);
// Check whether we can use this node as a "summary"
double maxWidth = boundary.width().max(Integer.MAX_VALUE).getDouble(0);
// Check whether we can use this node as a "summary"
if (isLeaf() || maxWidth / Math.sqrt(D) < theta) {
// Compute and add t-SNE force between point and current node
double Q = 1.0 / (1.0 + D);
double mult = cumSize * Q;
sumQ.addAndGet(mult);
mult *= Q;
negativeForce.addi(buf.muli(mult));
} else {
// Recursively apply Barnes-Hut to children
for (int i = 0; i < numChildren; i++) {
children[i].computeNonEdgeForces(pointIndex, theta, negativeForce, sumQ);
}
}
}
} | [
"public",
"void",
"computeNonEdgeForces",
"(",
"int",
"pointIndex",
",",
"double",
"theta",
",",
"INDArray",
"negativeForce",
",",
"AtomicDouble",
"sumQ",
")",
"{",
"// Make sure that we spend no time on empty nodes or self-interactions",
"if",
"(",
"cumSize",
"==",
"0",
... | Compute non edge forces using barnes hut
@param pointIndex
@param theta
@param negativeForce
@param sumQ | [
"Compute",
"non",
"edge",
"forces",
"using",
"barnes",
"hut"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/sptree/SpTree.java#L265-L302 |
Bandwidth/java-bandwidth | src/main/java/com/bandwidth/sdk/model/Call.java | Call.get | public static Call get(final String callId) throws Exception {
final BandwidthClient client = BandwidthClient.getInstance();
return get(client, callId);
} | java | public static Call get(final String callId) throws Exception {
final BandwidthClient client = BandwidthClient.getInstance();
return get(client, callId);
} | [
"public",
"static",
"Call",
"get",
"(",
"final",
"String",
"callId",
")",
"throws",
"Exception",
"{",
"final",
"BandwidthClient",
"client",
"=",
"BandwidthClient",
".",
"getInstance",
"(",
")",
";",
"return",
"get",
"(",
"client",
",",
"callId",
")",
";",
... | Factory method for Call, returns information about an active or completed call.
@param callId call id
@return the call
@throws IOException unexpected error. | [
"Factory",
"method",
"for",
"Call",
"returns",
"information",
"about",
"an",
"active",
"or",
"completed",
"call",
"."
] | train | https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Call.java#L30-L35 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java | MongoDS.createCredentail | private MongoCredential createCredentail(String userName, String database, String password) {
if (StrUtil.hasEmpty(userName, database, database)) {
return null;
}
return MongoCredential.createCredential(userName, database, password.toCharArray());
} | java | private MongoCredential createCredentail(String userName, String database, String password) {
if (StrUtil.hasEmpty(userName, database, database)) {
return null;
}
return MongoCredential.createCredential(userName, database, password.toCharArray());
} | [
"private",
"MongoCredential",
"createCredentail",
"(",
"String",
"userName",
",",
"String",
"database",
",",
"String",
"password",
")",
"{",
"if",
"(",
"StrUtil",
".",
"hasEmpty",
"(",
"userName",
",",
"database",
",",
"database",
")",
")",
"{",
"return",
"n... | 创建{@link MongoCredential},用于服务端验证
@param userName 用户名
@param database 数据库名
@param password 密码
@return {@link MongoCredential}
@since 4.1.20 | [
"创建",
"{",
"@link",
"MongoCredential",
"}",
",用于服务端验证"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/nosql/mongo/MongoDS.java#L315-L320 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java | AttributeDefinition.getAttributeDeprecatedDescription | public String getAttributeDeprecatedDescription(final ResourceBundle bundle, final String prefix) {
String bundleKey = prefix == null ? name : (prefix + "." + name);
bundleKey += "." + ModelDescriptionConstants.DEPRECATED;
return bundle.getString(bundleKey);
} | java | public String getAttributeDeprecatedDescription(final ResourceBundle bundle, final String prefix) {
String bundleKey = prefix == null ? name : (prefix + "." + name);
bundleKey += "." + ModelDescriptionConstants.DEPRECATED;
return bundle.getString(bundleKey);
} | [
"public",
"String",
"getAttributeDeprecatedDescription",
"(",
"final",
"ResourceBundle",
"bundle",
",",
"final",
"String",
"prefix",
")",
"{",
"String",
"bundleKey",
"=",
"prefix",
"==",
"null",
"?",
"name",
":",
"(",
"prefix",
"+",
"\".\"",
"+",
"name",
")",
... | Gets localized deprecation text from the given {@link java.util.ResourceBundle} for the attribute.
@param bundle the resource bundle. Cannot be {@code null}
@param prefix a prefix to dot-prepend to the attribute name to form a key to resolve in the bundle
@return the resolved text | [
"Gets",
"localized",
"deprecation",
"text",
"from",
"the",
"given",
"{",
"@link",
"java",
".",
"util",
".",
"ResourceBundle",
"}",
"for",
"the",
"attribute",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L924-L928 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/DefaultBeanContext.java | DefaultBeanContext.getBeansOfType | protected @Nonnull <T> Collection<T> getBeansOfType(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType) {
return getBeansOfTypeInternal(resolutionContext, beanType, null);
} | java | protected @Nonnull <T> Collection<T> getBeansOfType(@Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType) {
return getBeansOfTypeInternal(resolutionContext, beanType, null);
} | [
"protected",
"@",
"Nonnull",
"<",
"T",
">",
"Collection",
"<",
"T",
">",
"getBeansOfType",
"(",
"@",
"Nullable",
"BeanResolutionContext",
"resolutionContext",
",",
"@",
"Nonnull",
"Class",
"<",
"T",
">",
"beanType",
")",
"{",
"return",
"getBeansOfTypeInternal",
... | Get all beans of the given type.
@param resolutionContext The bean resolution context
@param beanType The bean type
@param <T> The bean type parameter
@return The found beans | [
"Get",
"all",
"beans",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L853-L855 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_federation_activeDirectory_activeDirectoryId_GET | public OvhFederationAccessNetwork serviceName_federation_activeDirectory_activeDirectoryId_GET(String serviceName, Long activeDirectoryId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/federation/activeDirectory/{activeDirectoryId}";
StringBuilder sb = path(qPath, serviceName, activeDirectoryId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhFederationAccessNetwork.class);
} | java | public OvhFederationAccessNetwork serviceName_federation_activeDirectory_activeDirectoryId_GET(String serviceName, Long activeDirectoryId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/federation/activeDirectory/{activeDirectoryId}";
StringBuilder sb = path(qPath, serviceName, activeDirectoryId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhFederationAccessNetwork.class);
} | [
"public",
"OvhFederationAccessNetwork",
"serviceName_federation_activeDirectory_activeDirectoryId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"activeDirectoryId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}/federation/activeDirecto... | Get this object properties
REST: GET /dedicatedCloud/{serviceName}/federation/activeDirectory/{activeDirectoryId}
@param serviceName [required] Domain of the service
@param activeDirectoryId [required] Id of the Active Directory | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1136-L1141 |
lucee/Lucee | core/src/main/java/lucee/runtime/registry/RegistryQuery.java | RegistryQuery.getValue | public static RegistryEntry getValue(String branch, String entry, short type) throws RegistryException, IOException, InterruptedException {
String[] cmd = new String[] { "reg", "query", cleanBrunch(branch), "/v", entry };
RegistryEntry[] rst = filter(executeQuery(cmd), branch, type);
if (rst.length == 1) {
return rst[0];
// if(type==RegistryEntry.TYPE_ANY || type==r.getType()) return r;
}
return null;
} | java | public static RegistryEntry getValue(String branch, String entry, short type) throws RegistryException, IOException, InterruptedException {
String[] cmd = new String[] { "reg", "query", cleanBrunch(branch), "/v", entry };
RegistryEntry[] rst = filter(executeQuery(cmd), branch, type);
if (rst.length == 1) {
return rst[0];
// if(type==RegistryEntry.TYPE_ANY || type==r.getType()) return r;
}
return null;
} | [
"public",
"static",
"RegistryEntry",
"getValue",
"(",
"String",
"branch",
",",
"String",
"entry",
",",
"short",
"type",
")",
"throws",
"RegistryException",
",",
"IOException",
",",
"InterruptedException",
"{",
"String",
"[",
"]",
"cmd",
"=",
"new",
"String",
"... | gets a single value form the registry
@param branch brach to get value from
@param entry entry to get
@param type type of the registry entry to get
@return registry entry or null of not exist
@throws RegistryException
@throws IOException
@throws InterruptedException | [
"gets",
"a",
"single",
"value",
"form",
"the",
"registry"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/registry/RegistryQuery.java#L65-L73 |
classgraph/classgraph | src/main/java/io/github/classgraph/Classfile.java | Classfile.constantPoolStringEquals | private boolean constantPoolStringEquals(final int cpIdx, final String asciiString)
throws ClassfileFormatException, IOException {
final int strOffset = getConstantPoolStringOffset(cpIdx, /* subFieldIdx = */ 0);
if (strOffset == 0) {
return asciiString == null;
} else if (asciiString == null) {
return false;
}
final int strLen = inputStreamOrByteBuffer.readUnsignedShort(strOffset);
final int otherLen = asciiString.length();
if (strLen != otherLen) {
return false;
}
final int strStart = strOffset + 2;
for (int i = 0; i < strLen; i++) {
if ((char) (inputStreamOrByteBuffer.buf[strStart + i] & 0xff) != asciiString.charAt(i)) {
return false;
}
}
return true;
} | java | private boolean constantPoolStringEquals(final int cpIdx, final String asciiString)
throws ClassfileFormatException, IOException {
final int strOffset = getConstantPoolStringOffset(cpIdx, /* subFieldIdx = */ 0);
if (strOffset == 0) {
return asciiString == null;
} else if (asciiString == null) {
return false;
}
final int strLen = inputStreamOrByteBuffer.readUnsignedShort(strOffset);
final int otherLen = asciiString.length();
if (strLen != otherLen) {
return false;
}
final int strStart = strOffset + 2;
for (int i = 0; i < strLen; i++) {
if ((char) (inputStreamOrByteBuffer.buf[strStart + i] & 0xff) != asciiString.charAt(i)) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"constantPoolStringEquals",
"(",
"final",
"int",
"cpIdx",
",",
"final",
"String",
"asciiString",
")",
"throws",
"ClassfileFormatException",
",",
"IOException",
"{",
"final",
"int",
"strOffset",
"=",
"getConstantPoolStringOffset",
"(",
"cpIdx",
",... | Compare a string in the constant pool with a given ASCII string, without constructing the constant pool
String object.
@param cpIdx
the constant pool index
@param asciiString
the ASCII string to compare to
@return true, if successful
@throws ClassfileFormatException
If a problem occurs.
@throws IOException
If an IO exception occurs. | [
"Compare",
"a",
"string",
"in",
"the",
"constant",
"pool",
"with",
"a",
"given",
"ASCII",
"string",
"without",
"constructing",
"the",
"constant",
"pool",
"String",
"object",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/Classfile.java#L661-L681 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/Popups.java | Popups.infoOn | public static InfoPopup infoOn (String message, Widget target)
{
return centerOn(new InfoPopup(message), target);
} | java | public static InfoPopup infoOn (String message, Widget target)
{
return centerOn(new InfoPopup(message), target);
} | [
"public",
"static",
"InfoPopup",
"infoOn",
"(",
"String",
"message",
",",
"Widget",
"target",
")",
"{",
"return",
"centerOn",
"(",
"new",
"InfoPopup",
"(",
"message",
")",
",",
"target",
")",
";",
"}"
] | Displays an info message centered horizontally on the page and centered vertically on the
specified target widget. | [
"Displays",
"an",
"info",
"message",
"centered",
"horizontally",
"on",
"the",
"page",
"and",
"centered",
"vertically",
"on",
"the",
"specified",
"target",
"widget",
"."
] | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Popups.java#L93-L96 |
landawn/AbacusUtil | src/com/landawn/abacus/util/LongMultiset.java | LongMultiset.getAndSet | public long getAndSet(final T e, final long occurrences) {
checkOccurrences(occurrences);
final MutableLong count = valueMap.get(e);
long result = count == null ? 0 : count.value();
if (occurrences == 0) {
if (count != null) {
valueMap.remove(e);
}
} else {
if (count == null) {
valueMap.put(e, MutableLong.of(occurrences));
} else {
count.setValue(occurrences);
}
}
return result;
} | java | public long getAndSet(final T e, final long occurrences) {
checkOccurrences(occurrences);
final MutableLong count = valueMap.get(e);
long result = count == null ? 0 : count.value();
if (occurrences == 0) {
if (count != null) {
valueMap.remove(e);
}
} else {
if (count == null) {
valueMap.put(e, MutableLong.of(occurrences));
} else {
count.setValue(occurrences);
}
}
return result;
} | [
"public",
"long",
"getAndSet",
"(",
"final",
"T",
"e",
",",
"final",
"long",
"occurrences",
")",
"{",
"checkOccurrences",
"(",
"occurrences",
")",
";",
"final",
"MutableLong",
"count",
"=",
"valueMap",
".",
"get",
"(",
"e",
")",
";",
"long",
"result",
"=... | The element will be removed if the specified count is 0.
@param e
@param occurrences
@return | [
"The",
"element",
"will",
"be",
"removed",
"if",
"the",
"specified",
"count",
"is",
"0",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/LongMultiset.java#L201-L220 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BidiTransform.java | BidiTransform.shapeArabic | private void shapeArabic(int digitsDir, int lettersDir) {
if (digitsDir == lettersDir) {
shapeArabic(shapingOptions | digitsDir);
} else {
/* Honor all shape options other than letters (not necessarily digits
only) */
shapeArabic((shapingOptions & ~ArabicShaping.LETTERS_MASK) | digitsDir);
/* Honor all shape options other than digits (not necessarily letters
only) */
shapeArabic((shapingOptions & ~ArabicShaping.DIGITS_MASK) | lettersDir);
}
} | java | private void shapeArabic(int digitsDir, int lettersDir) {
if (digitsDir == lettersDir) {
shapeArabic(shapingOptions | digitsDir);
} else {
/* Honor all shape options other than letters (not necessarily digits
only) */
shapeArabic((shapingOptions & ~ArabicShaping.LETTERS_MASK) | digitsDir);
/* Honor all shape options other than digits (not necessarily letters
only) */
shapeArabic((shapingOptions & ~ArabicShaping.DIGITS_MASK) | lettersDir);
}
} | [
"private",
"void",
"shapeArabic",
"(",
"int",
"digitsDir",
",",
"int",
"lettersDir",
")",
"{",
"if",
"(",
"digitsDir",
"==",
"lettersDir",
")",
"{",
"shapeArabic",
"(",
"shapingOptions",
"|",
"digitsDir",
")",
";",
"}",
"else",
"{",
"/* Honor all shape options... | Performs digit and letter shaping
@param digitsDir Digit shaping option that indicates whether the text
should be treated as logical or visual.
@param lettersDir Letter shaping option that indicates whether the text
should be treated as logical or visual form (can mismatch the digit
option). | [
"Performs",
"digit",
"and",
"letter",
"shaping"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BidiTransform.java#L350-L362 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java | TouchActions.longPress | public TouchActions longPress(WebElement onElement) {
if (touchScreen != null) {
action.addAction(new LongPressAction(touchScreen, (Locatable) onElement));
}
return this;
} | java | public TouchActions longPress(WebElement onElement) {
if (touchScreen != null) {
action.addAction(new LongPressAction(touchScreen, (Locatable) onElement));
}
return this;
} | [
"public",
"TouchActions",
"longPress",
"(",
"WebElement",
"onElement",
")",
"{",
"if",
"(",
"touchScreen",
"!=",
"null",
")",
"{",
"action",
".",
"addAction",
"(",
"new",
"LongPressAction",
"(",
"touchScreen",
",",
"(",
"Locatable",
")",
"onElement",
")",
")... | Allows the execution of long press gestures.
@param onElement The {@link WebElement} to long press
@return self | [
"Allows",
"the",
"execution",
"of",
"long",
"press",
"gestures",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/interactions/touch/TouchActions.java#L143-L148 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckGlobalNames.java | CheckGlobalNames.checkDescendantNames | private void checkDescendantNames(Name name, boolean nameIsDefined) {
if (name.props != null) {
for (Name prop : name.props) {
// if the ancestor of a property is not defined, then we should emit
// warnings for all references to the property.
boolean propIsDefined = false;
if (nameIsDefined) {
// if the ancestor of a property is defined, then let's check that
// the property is also explicitly defined if it needs to be.
propIsDefined =
(!propertyMustBeInitializedByFullName(prop)
|| prop.getGlobalSets() + prop.getLocalSets() > 0);
}
validateName(prop, propIsDefined);
checkDescendantNames(prop, propIsDefined);
}
}
} | java | private void checkDescendantNames(Name name, boolean nameIsDefined) {
if (name.props != null) {
for (Name prop : name.props) {
// if the ancestor of a property is not defined, then we should emit
// warnings for all references to the property.
boolean propIsDefined = false;
if (nameIsDefined) {
// if the ancestor of a property is defined, then let's check that
// the property is also explicitly defined if it needs to be.
propIsDefined =
(!propertyMustBeInitializedByFullName(prop)
|| prop.getGlobalSets() + prop.getLocalSets() > 0);
}
validateName(prop, propIsDefined);
checkDescendantNames(prop, propIsDefined);
}
}
} | [
"private",
"void",
"checkDescendantNames",
"(",
"Name",
"name",
",",
"boolean",
"nameIsDefined",
")",
"{",
"if",
"(",
"name",
".",
"props",
"!=",
"null",
")",
"{",
"for",
"(",
"Name",
"prop",
":",
"name",
".",
"props",
")",
"{",
"// if the ancestor of a pr... | Checks to make sure all the descendants of a name are defined if they
are referenced.
@param name A global name.
@param nameIsDefined If true, {@code name} is defined. Otherwise, it's
undefined, and any references to descendant names should emit warnings. | [
"Checks",
"to",
"make",
"sure",
"all",
"the",
"descendants",
"of",
"a",
"name",
"are",
"defined",
"if",
"they",
"are",
"referenced",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckGlobalNames.java#L132-L150 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java | ParseUtils.unexpectedAttribute | public static XMLStreamException unexpectedAttribute(final XMLExtendedStreamReader reader, final int index, Set<String> possibleAttributes) {
final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.unexpectedAttribute(reader.getAttributeName(index), asStringList(possibleAttributes), reader.getLocation());
return new XMLStreamValidationException(ex.getMessage(),
ValidationError.from(ex, ErrorType.UNEXPECTED_ATTRIBUTE)
.element(reader.getName())
.attribute(reader.getAttributeName(index))
.alternatives(possibleAttributes),
ex);
} | java | public static XMLStreamException unexpectedAttribute(final XMLExtendedStreamReader reader, final int index, Set<String> possibleAttributes) {
final XMLStreamException ex = ControllerLogger.ROOT_LOGGER.unexpectedAttribute(reader.getAttributeName(index), asStringList(possibleAttributes), reader.getLocation());
return new XMLStreamValidationException(ex.getMessage(),
ValidationError.from(ex, ErrorType.UNEXPECTED_ATTRIBUTE)
.element(reader.getName())
.attribute(reader.getAttributeName(index))
.alternatives(possibleAttributes),
ex);
} | [
"public",
"static",
"XMLStreamException",
"unexpectedAttribute",
"(",
"final",
"XMLExtendedStreamReader",
"reader",
",",
"final",
"int",
"index",
",",
"Set",
"<",
"String",
">",
"possibleAttributes",
")",
"{",
"final",
"XMLStreamException",
"ex",
"=",
"ControllerLogge... | Get an exception reporting an unexpected XML attribute.
@param reader the stream reader
@param index the attribute index
@param possibleAttributes attributes that are expected on this element
@return the exception | [
"Get",
"an",
"exception",
"reporting",
"an",
"unexpected",
"XML",
"attribute",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java#L151-L160 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java | LdapConnection.cloneSearchResults | @FFDCIgnore(SizeLimitExceededException.class)
private static int cloneSearchResults(NamingEnumeration<SearchResult> results, CachedNamingEnumeration clone1,
CachedNamingEnumeration clone2) throws WIMSystemException {
final String METHODNAME = "cloneSearchResults(NamingEnumeration, CachedNamingEnumeration, CachedNamingEnumeration)";
int count = 0;
try {
while (results.hasMore()) {
SearchResult result = results.nextElement();
Attributes attrs = (Attributes) result.getAttributes().clone();
SearchResult cachedResult = new SearchResult(result.getName(), null, null, attrs);
clone1.add(result);
clone2.add(cachedResult);
count++;
}
} catch (SizeLimitExceededException e) {
// if size limit is reached because of LDAP server limit, then log the result
// and return the available results
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " " + e.toString(true), e);
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
}
return count;
} | java | @FFDCIgnore(SizeLimitExceededException.class)
private static int cloneSearchResults(NamingEnumeration<SearchResult> results, CachedNamingEnumeration clone1,
CachedNamingEnumeration clone2) throws WIMSystemException {
final String METHODNAME = "cloneSearchResults(NamingEnumeration, CachedNamingEnumeration, CachedNamingEnumeration)";
int count = 0;
try {
while (results.hasMore()) {
SearchResult result = results.nextElement();
Attributes attrs = (Attributes) result.getAttributes().clone();
SearchResult cachedResult = new SearchResult(result.getName(), null, null, attrs);
clone1.add(result);
clone2.add(cachedResult);
count++;
}
} catch (SizeLimitExceededException e) {
// if size limit is reached because of LDAP server limit, then log the result
// and return the available results
if (tc.isDebugEnabled())
Tr.debug(tc, METHODNAME + " " + e.toString(true), e);
} catch (NamingException e) {
String msg = Tr.formatMessage(tc, WIMMessageKey.NAMING_EXCEPTION, WIMMessageHelper.generateMsgParms(e.toString(true)));
throw new WIMSystemException(WIMMessageKey.NAMING_EXCEPTION, msg, e);
}
return count;
} | [
"@",
"FFDCIgnore",
"(",
"SizeLimitExceededException",
".",
"class",
")",
"private",
"static",
"int",
"cloneSearchResults",
"(",
"NamingEnumeration",
"<",
"SearchResult",
">",
"results",
",",
"CachedNamingEnumeration",
"clone1",
",",
"CachedNamingEnumeration",
"clone2",
... | Clone the given {@link NamingNumeration}.
@param results The results to clone.
@param clone1 {@link CachedNamingEnumeration} with the original results.
@param clone2 {@link CachedNamingEnumeration} with the cloned results.
@return The number of entries in the results.
@throws WIMSystemException If the results could not be cloned. | [
"Clone",
"the",
"given",
"{",
"@link",
"NamingNumeration",
"}",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapConnection.java#L1327-L1352 |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix4.java | Matrix4.setToTransform | public Matrix4 setToTransform (IVector3 translation, IQuaternion rotation, double scale) {
return setToRotation(rotation).set(
m00 * scale, m10 * scale, m20 * scale, translation.x(),
m01 * scale, m11 * scale, m21 * scale, translation.y(),
m02 * scale, m12 * scale, m22 * scale, translation.z(),
0f, 0f, 0f, 1f);
} | java | public Matrix4 setToTransform (IVector3 translation, IQuaternion rotation, double scale) {
return setToRotation(rotation).set(
m00 * scale, m10 * scale, m20 * scale, translation.x(),
m01 * scale, m11 * scale, m21 * scale, translation.y(),
m02 * scale, m12 * scale, m22 * scale, translation.z(),
0f, 0f, 0f, 1f);
} | [
"public",
"Matrix4",
"setToTransform",
"(",
"IVector3",
"translation",
",",
"IQuaternion",
"rotation",
",",
"double",
"scale",
")",
"{",
"return",
"setToRotation",
"(",
"rotation",
")",
".",
"set",
"(",
"m00",
"*",
"scale",
",",
"m10",
"*",
"scale",
",",
"... | Sets this to a matrix that first scales, then rotates, then translates.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"matrix",
"that",
"first",
"scales",
"then",
"rotates",
"then",
"translates",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L112-L118 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/metrics/MetricsStore.java | MetricsStore.getFullInstanceId | private static String getFullInstanceId(String hostname, String id) {
String str = hostname == null ? "" : hostname;
str = str.replace('.', '_');
str += (id == null ? "" : "-" + id);
return str;
} | java | private static String getFullInstanceId(String hostname, String id) {
String str = hostname == null ? "" : hostname;
str = str.replace('.', '_');
str += (id == null ? "" : "-" + id);
return str;
} | [
"private",
"static",
"String",
"getFullInstanceId",
"(",
"String",
"hostname",
",",
"String",
"id",
")",
"{",
"String",
"str",
"=",
"hostname",
"==",
"null",
"?",
"\"\"",
":",
"hostname",
";",
"str",
"=",
"str",
".",
"replace",
"(",
"'",
"'",
",",
"'",... | Gets the full instance id of the concatenation of hostname and the id. The dots in the hostname
replaced by underscores.
@param hostname the hostname
@param id the instance id
@return the full instance id of hostname[:id] | [
"Gets",
"the",
"full",
"instance",
"id",
"of",
"the",
"concatenation",
"of",
"hostname",
"and",
"the",
"id",
".",
"The",
"dots",
"in",
"the",
"hostname",
"replaced",
"by",
"underscores",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/metrics/MetricsStore.java#L68-L73 |
facebookarchive/hive-dwrf | hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java | DynamicByteArray.add | public int add(byte[] value, int valueOffset, int valueLength) {
grow(length + valueLength);
data.setBytes(length, value, valueOffset, valueLength);
int result = length;
length += valueLength;
return result;
} | java | public int add(byte[] value, int valueOffset, int valueLength) {
grow(length + valueLength);
data.setBytes(length, value, valueOffset, valueLength);
int result = length;
length += valueLength;
return result;
} | [
"public",
"int",
"add",
"(",
"byte",
"[",
"]",
"value",
",",
"int",
"valueOffset",
",",
"int",
"valueLength",
")",
"{",
"grow",
"(",
"length",
"+",
"valueLength",
")",
";",
"data",
".",
"setBytes",
"(",
"length",
",",
"value",
",",
"valueOffset",
",",
... | Copy a slice of a byte array into our buffer.
@param value the array to copy from
@param valueOffset the first location to copy from value
@param valueLength the number of bytes to copy from value
@return the offset of the start of the value | [
"Copy",
"a",
"slice",
"of",
"a",
"byte",
"array",
"into",
"our",
"buffer",
"."
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java#L79-L85 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/MatchConditionOnElements.java | MatchConditionOnElements.removeMatch | public void removeMatch(String name, PseudoClassType pseudoClass)
{
if (names != null)
{
Set<PseudoClassType> classes = names.get(name);
if (classes != null)
classes.remove(pseudoClass);
}
} | java | public void removeMatch(String name, PseudoClassType pseudoClass)
{
if (names != null)
{
Set<PseudoClassType> classes = names.get(name);
if (classes != null)
classes.remove(pseudoClass);
}
} | [
"public",
"void",
"removeMatch",
"(",
"String",
"name",
",",
"PseudoClassType",
"pseudoClass",
")",
"{",
"if",
"(",
"names",
"!=",
"null",
")",
"{",
"Set",
"<",
"PseudoClassType",
">",
"classes",
"=",
"names",
".",
"get",
"(",
"name",
")",
";",
"if",
"... | Removes the pseudo class from the given element name. Element names are case-insensitive.
@param name the element name
@param pseudoClass the pseudo class to be removed | [
"Removes",
"the",
"pseudo",
"class",
"from",
"the",
"given",
"element",
"name",
".",
"Element",
"names",
"are",
"case",
"-",
"insensitive",
"."
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/MatchConditionOnElements.java#L121-L129 |
pac4j/pac4j | pac4j-core/src/main/java/org/pac4j/core/profile/BasicUserProfile.java | BasicUserProfile.getAuthenticationAttribute | public <T> T getAuthenticationAttribute(final String name, final Class<T> clazz)
{
final Object attribute = getAuthenticationAttribute(name);
return getAttributeByType(name, clazz, attribute);
} | java | public <T> T getAuthenticationAttribute(final String name, final Class<T> clazz)
{
final Object attribute = getAuthenticationAttribute(name);
return getAttributeByType(name, clazz, attribute);
} | [
"public",
"<",
"T",
">",
"T",
"getAuthenticationAttribute",
"(",
"final",
"String",
"name",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"final",
"Object",
"attribute",
"=",
"getAuthenticationAttribute",
"(",
"name",
")",
";",
"return",
"getAttri... | Return authentication attribute with name
@param name Name of authentication attribute
@param clazz The class of the authentication attribute
@param <T> The type of the authentication attribute
@return the named attribute | [
"Return",
"authentication",
"attribute",
"with",
"name"
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/profile/BasicUserProfile.java#L309-L313 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxRetentionPolicyAssignment.java | BoxRetentionPolicyAssignment.createAssignmentToFolder | public static BoxRetentionPolicyAssignment.Info createAssignmentToFolder(BoxAPIConnection api, String policyID,
String folderID) {
return createAssignment(api, policyID, new JsonObject().add("type", TYPE_FOLDER).add("id", folderID), null);
} | java | public static BoxRetentionPolicyAssignment.Info createAssignmentToFolder(BoxAPIConnection api, String policyID,
String folderID) {
return createAssignment(api, policyID, new JsonObject().add("type", TYPE_FOLDER).add("id", folderID), null);
} | [
"public",
"static",
"BoxRetentionPolicyAssignment",
".",
"Info",
"createAssignmentToFolder",
"(",
"BoxAPIConnection",
"api",
",",
"String",
"policyID",
",",
"String",
"folderID",
")",
"{",
"return",
"createAssignment",
"(",
"api",
",",
"policyID",
",",
"new",
"JsonO... | Assigns retention policy with givenID to the folder.
@param api the API connection to be used by the created assignment.
@param policyID id of the assigned retention policy.
@param folderID id of the folder to assign policy to.
@return info about created assignment. | [
"Assigns",
"retention",
"policy",
"with",
"givenID",
"to",
"the",
"folder",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxRetentionPolicyAssignment.java#L77-L80 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.